|
|
@ -19,6 +19,7 @@ using SDKAdapter.OperationPlatform.Models; |
|
|
|
using SDKAdapter.PurchasePlatform.Client; |
|
|
|
using SDKAdapter.PurchasePlatform.Models; |
|
|
|
using System.Text; |
|
|
|
using System.Text.RegularExpressions; |
|
|
|
using Yitter.IdGenerator; |
|
|
|
|
|
|
|
namespace BBWYB.Server.Business |
|
|
@ -144,7 +145,6 @@ namespace BBWYB.Server.Business |
|
|
|
#endregion
|
|
|
|
|
|
|
|
var extJArray = new List<object>(); |
|
|
|
var errorBuilder = new StringBuilder(); |
|
|
|
var freightAmount = 0M; |
|
|
|
var productAmount = 0M; |
|
|
|
var totalAmount = 0M; |
|
|
@ -201,8 +201,33 @@ namespace BBWYB.Server.Business |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
var errorBuilder = new StringBuilder(); |
|
|
|
errorBuilder.AppendLine($"采购商:{cargoParamGroup.PurchaserName}"); |
|
|
|
errorBuilder.AppendLine(ex.Message); |
|
|
|
#region 匹配订单sku
|
|
|
|
if (ex.Message.Contains("库存不足")) |
|
|
|
{ |
|
|
|
var match = Regex.Match(ex.Message, @"商品\[(\d+)_(\w+)\]"); |
|
|
|
if (match.Success) |
|
|
|
{ |
|
|
|
var purchaseProductId = match.Groups[1].Value; |
|
|
|
var purchaseSkuSpecId = match.Groups[2].Value; |
|
|
|
|
|
|
|
var errorCargoParam = cargoParamGroup.CargoParamList.FirstOrDefault(c => c.SpecId == purchaseSkuSpecId && c.ProductId == purchaseProductId); |
|
|
|
if (errorCargoParam != null) |
|
|
|
{ |
|
|
|
errorBuilder.AppendLine($"订单sku[{errorCargoParam.BelongSkuId}]所使用的配件[${errorCargoParam.SkuId}]库存不足"); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
errorBuilder.AppendLine(ex.Message); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
errorBuilder.AppendLine(ex.Message); |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
throw new BusinessException(errorBuilder.ToString()); |
|
|
|
} |
|
|
|
} |
|
|
@ -796,10 +821,10 @@ namespace BBWYB.Server.Business |
|
|
|
#region 补齐采购关系
|
|
|
|
foreach (var assOrderCostDetail in purchaseOrder.AssocationOrderCostDetailList) |
|
|
|
{ |
|
|
|
var matchResultList = MatchPurchaseScheme(assOrderCostDetail.SkuId, |
|
|
|
assOrderCostDetail.PurchaseQuantity, |
|
|
|
var matchResultList = MatchPurchaseScheme(assOrderCostDetail.SkuId, |
|
|
|
assOrderCostDetail.PurchaseQuantity, |
|
|
|
purchaserId, |
|
|
|
purchaseSchemeList, |
|
|
|
purchaseSchemeList, |
|
|
|
purchaseOrderSimpleInfo); |
|
|
|
if (matchResultList.Count() == 0) |
|
|
|
throw new BusinessException($"采购单{purchaseOrder.PurchaseOrderId} 采购商Id {purchaserId} Sku{assOrderCostDetail.SkuId}缺少采购方案"); |
|
|
|