Browse Source

Merge branch 'MultiPurchaser'

yijia
shanji 2 years ago
parent
commit
b98fc62172
  1. 35
      BBWYB.Server.Business/PurchaseOrder/PurchaseOrderBusiness.cs

35
BBWYB.Server.Business/PurchaseOrder/PurchaseOrderBusiness.cs

@ -19,6 +19,7 @@ using SDKAdapter.OperationPlatform.Models;
using SDKAdapter.PurchasePlatform.Client; using SDKAdapter.PurchasePlatform.Client;
using SDKAdapter.PurchasePlatform.Models; using SDKAdapter.PurchasePlatform.Models;
using System.Text; using System.Text;
using System.Text.RegularExpressions;
using Yitter.IdGenerator; using Yitter.IdGenerator;
namespace BBWYB.Server.Business namespace BBWYB.Server.Business
@ -144,7 +145,6 @@ namespace BBWYB.Server.Business
#endregion #endregion
var extJArray = new List<object>(); var extJArray = new List<object>();
var errorBuilder = new StringBuilder();
var freightAmount = 0M; var freightAmount = 0M;
var productAmount = 0M; var productAmount = 0M;
var totalAmount = 0M; var totalAmount = 0M;
@ -201,8 +201,33 @@ namespace BBWYB.Server.Business
} }
catch (Exception ex) catch (Exception ex)
{ {
var errorBuilder = new StringBuilder();
errorBuilder.AppendLine($"采购商:{cargoParamGroup.PurchaserName}"); 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()); throw new BusinessException(errorBuilder.ToString());
} }
} }
@ -796,10 +821,10 @@ namespace BBWYB.Server.Business
#region 补齐采购关系 #region 补齐采购关系
foreach (var assOrderCostDetail in purchaseOrder.AssocationOrderCostDetailList) foreach (var assOrderCostDetail in purchaseOrder.AssocationOrderCostDetailList)
{ {
var matchResultList = MatchPurchaseScheme(assOrderCostDetail.SkuId, var matchResultList = MatchPurchaseScheme(assOrderCostDetail.SkuId,
assOrderCostDetail.PurchaseQuantity, assOrderCostDetail.PurchaseQuantity,
purchaserId, purchaserId,
purchaseSchemeList, purchaseSchemeList,
purchaseOrderSimpleInfo); purchaseOrderSimpleInfo);
if (matchResultList.Count() == 0) if (matchResultList.Count() == 0)
throw new BusinessException($"采购单{purchaseOrder.PurchaseOrderId} 采购商Id {purchaserId} Sku{assOrderCostDetail.SkuId}缺少采购方案"); throw new BusinessException($"采购单{purchaseOrder.PurchaseOrderId} 采购商Id {purchaserId} Sku{assOrderCostDetail.SkuId}缺少采购方案");

Loading…
Cancel
Save