|
@@ -417,6 +417,7 @@ namespace wms.service.Help.Packing
|
|
|
PreOccupyInventory(rule, allocationResult.BoxInfo);
|
|
|
|
|
|
res.ResCode = ResponseStatusCodeEnum.Sucess.GetHashCode();
|
|
|
+ _logger.LogError($"CP装箱信息:[箱号:{rule.PBoxCode};{allocationResult.BoxInfo.GetLogString()}]");
|
|
|
return res;
|
|
|
}
|
|
|
|
|
@@ -615,7 +616,8 @@ namespace wms.service.Help.Packing
|
|
|
LayerPackingBoxInfo boxInfo)
|
|
|
{
|
|
|
var res = new SRes() { ResCode = ResponseStatusCodeEnum.Sucess.GetHashCode(), ResMsg = ResponseStatusCodeEnum.Sucess.GetDescription() };
|
|
|
- if (boxInfo.Layers.SelectMany(x=>x.Products).Count() != rule.FullCountQty)
|
|
|
+ var productsCount = boxInfo.Layers.SelectMany(x => x.Products).Count();
|
|
|
+ if (productsCount != rule.FullCountQty)
|
|
|
{
|
|
|
res.ResCode = ResponseStatusCodeEnum.Fail.GetHashCode();
|
|
|
res.ResMsg = "成箱产品数与满箱产品数不符";
|
|
@@ -630,20 +632,30 @@ namespace wms.service.Help.Packing
|
|
|
|
|
|
// 更新库存预占用标记
|
|
|
var presign = rule.Id.ToString();
|
|
|
- var layerNumber = 0;
|
|
|
+ var layerNumber = 1;
|
|
|
+ var updateNumber = 0;
|
|
|
foreach (var layer in boxInfo.Layers.OrderByDescending(x => x.TotalTorsion))
|
|
|
{
|
|
|
var layerProductsIds = layer.Products.Select(x => x.ContGrpId).ToList();
|
|
|
- _invNow.UpdateSetColumnsTrue(p => new BillInvnow
|
|
|
+ var result = _invNow.Context.Updateable<BillInvnow>().SetColumns(p => new BillInvnow
|
|
|
{
|
|
|
PreStock = presign,
|
|
|
EditTime = DateTime.Now,
|
|
|
PackingLayer = layerNumber,
|
|
|
Memo = $"箱号预占用:{rule.PBoxCode}"
|
|
|
- }, p => layerProductsIds.Contains(p.ContGrpId));
|
|
|
+ }).Where(p => layerProductsIds.Contains(p.ContGrpId)).ExecuteCommand();
|
|
|
+ updateNumber += result;
|
|
|
layerNumber++;
|
|
|
}
|
|
|
|
|
|
+ if (updateNumber != productsCount)
|
|
|
+ {
|
|
|
+ _db.RollbackTran();
|
|
|
+ res.ResCode = ResponseStatusCodeEnum.Fail.GetHashCode();
|
|
|
+ res.ResMsg = $"更新库存预占用标记失败,应更新:{productsCount},实更新:{updateNumber}";
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
var containerIds = boxInfo.TotalProduct.Select(x => x.ContGrpId).ToList();
|
|
|
_db.CommitTran();
|
|
|
_logger.LogInformation($"{rule.PBoxCode}预占:{JsonConvert.SerializeObject(containerIds)}");
|