Browse Source

批量下单接口验证来源sku

AddValidOverTime
shanji 2 years ago
parent
commit
914e2cd9d8
  1. 23
      BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs

23
BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs

@ -207,8 +207,10 @@ namespace BBWY.Server.Business
public BatchCreareOrderResponse BatchCreateOrder(BatchPurchaseCreateOrderRequest request) public BatchCreareOrderResponse BatchCreateOrder(BatchPurchaseCreateOrderRequest request)
{ {
/* /*
*/ */
var loggerName = $"批量采购-{request.ShopName}";
nLogManager.GetLogger(loggerName).Info(JsonConvert.SerializeObject(request));
if (request.ProductParamList == null || request.ProductParamList.Count() == 0) if (request.ProductParamList == null || request.ProductParamList.Count() == 0)
throw new BusinessException("缺少商品参数"); throw new BusinessException("缺少商品参数");
@ -250,13 +252,18 @@ namespace BBWY.Server.Business
#region 处理JD SKU和拳探SKU的对应关系 #region 处理JD SKU和拳探SKU的对应关系
var belongSkus_mappingList = new List<JObject>(); var belongSkus_mappingList = new List<JObject>();
foreach (var belongSkuGroup in belongSkuGroups) if (purchasePlatform == Enums.Platform.)
{ {
var firstProductParam = belongSkuGroup.FirstOrDefault(); foreach (var belongSkuGroup in belongSkuGroups)
if (!belongSkus_mappingList.Any(j => j.Value<string>("BelongSkuId") == firstProductParam.BelongSkuId))
{ {
belongSkus_mappingList.Add(JObject.FromObject(new { firstProductParam.BelongSkuId, SkuId = firstProductParam.PurchaseSkuId })); var firstProductParam = belongSkuGroup.FirstOrDefault();
if (!belongSkus_mappingList.Any(j => j.Value<string>("BelongSkuId") == firstProductParam.BelongSkuId))
{
belongSkus_mappingList.Add(JObject.FromObject(new { firstProductParam.BelongSkuId, SkuId = firstProductParam.PurchaseSkuId }));
}
} }
if (belongSkus_mappingList.Count() == 0)
throw new BusinessException("缺少来源SKU信息");
} }
#endregion #endregion
@ -331,14 +338,14 @@ namespace BBWY.Server.Business
}; };
insertPurchaseOrderSkuList.Add(purchaseOrderSku); insertPurchaseOrderSkuList.Add(purchaseOrderSku);
if (purchasePlatform == Enums.Platform.) if (purchasePlatform == Enums.Platform.)
{ {
var skuPackConfig = request.PackSkuConfigList?.FirstOrDefault(s => s.SkuId == firstProductParam.BelongSkuId); var skuPackConfig = request.PackSkuConfigList?.FirstOrDefault(s => s.SkuId == firstProductParam.BelongSkuId);
if (skuPackConfig != null) if (skuPackConfig != null)
{ {
skuPackConfigList.Add(new skuPackConfigList.Add(new
{ {
skuId = firstProductParam.BelongSkuId, skuId = firstProductParam.BelongSkuId,

Loading…
Cancel
Save