From eba391bab959868216418121e963587790301f14 Mon Sep 17 00:00:00 2001 From: git_rabbit Date: Sat, 20 Apr 2024 10:46:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=93=E5=BA=93-=E6=8B=BC=E7=AE=B1=EF=BC=8C?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8F=AF=E8=AE=BE=E7=BD=AE=E6=AC=A1=E7=AE=B1?= =?UTF-8?q?=E5=BE=80=E4=B8=BB=E7=AE=B1=E6=B7=BB=E5=8A=A0=E7=9A=84=E6=95=B0?= =?UTF-8?q?=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ZR.Model/MES/wms/Dto/WmGoodsActionDto.cs | 2 +- ZR.Service/mes/wms/WmGoodsActionService.cs | 68 ++++++++++++++++++---- 2 files changed, 57 insertions(+), 13 deletions(-) diff --git a/ZR.Model/MES/wms/Dto/WmGoodsActionDto.cs b/ZR.Model/MES/wms/Dto/WmGoodsActionDto.cs index 8f0248da..9c388900 100644 --- a/ZR.Model/MES/wms/Dto/WmGoodsActionDto.cs +++ b/ZR.Model/MES/wms/Dto/WmGoodsActionDto.cs @@ -8,7 +8,7 @@ namespace ZR.Model.MES.wms.Dto public class WmGoodsConsolidationDto { public List PackageList { get; set; } - + public int secondNum { get; set; } public string CreateBy { get; set; } } diff --git a/ZR.Service/mes/wms/WmGoodsActionService.cs b/ZR.Service/mes/wms/WmGoodsActionService.cs index 528c3fef..3905a0c3 100644 --- a/ZR.Service/mes/wms/WmGoodsActionService.cs +++ b/ZR.Service/mes/wms/WmGoodsActionService.cs @@ -31,26 +31,50 @@ namespace ZR.Service.Business // 拼箱计数器 int num = 0; int? quantityCount = 0; - List ids = new(); + // 第二箱录入数量(限制只能输入两箱) + int secondNum = parm.secondNum; + int? secondHas = 0; + bool isDelete = false; + string secondId = ""; // 箱验证 foreach (ResultionPackageCodeDto package in list) { num++; + // 有第二箱录入数量的情况下只能两箱拼 + if (num == 3) + { + return null; + } WmGoodsNowProduction check1 = Context.Queryable().Where(it => it.PackageCodeClient == package.PatchCode).First(); if (check1 == null) { return null; } + if (num == 1) { description = "\n主箱:" + package.PatchCode + ",\n次箱:"; + quantityCount += package.Quantity; + continue; + } + if(num==2) + { + secondId = check1.Id; + description += package.PatchCode + ","; + } + // 第二箱数量为正数且比箱子总数量小 + if (num == 2 && secondNum < package.Quantity && secondNum > 0) + { + isDelete = false; + secondHas = package.Quantity - secondNum; + quantityCount += secondNum; } else { - ids.Add(check1.Id); - description += package.PatchCode + ","; + isDelete = true; + secondHas = 0; + quantityCount += package.Quantity; } - quantityCount += package.Quantity; } ResultionPackageCodeDto mainPackage = list[0]; // 短批次 @@ -114,14 +138,34 @@ namespace ZR.Service.Business + "^Qty=" + quantityCount; nowProduction.GoodsNumLogic = quantityCount; nowProduction.GoodsNumAction = quantityCount; - nowProduction.Remark = "拼箱"; + nowProduction.Remark = "拼箱整箱"; // 修改主箱 Context.Updateable(nowProduction).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand(); - // TODO修改打印记录 - - // 删除分箱 - Context.Deleteable().In(ids).ExecuteCommand(); - + // 次箱操作 + if (isDelete) + { + // 删除次箱 + Context.Deleteable().Where(it=>it.Id == secondId).ExecuteCommand(); + } + else + { + // 修改次箱子 + WmGoodsNowProduction nowProduction2 = Context.Queryable() + .Where(it => it.Id == secondId).First(); + if (nowProduction2 == null) + { + return null; + } + nowProduction2.UpdatedBy = parm.CreateBy; + nowProduction2.UpdatedTime = nowTime; + nowProduction2.PackageCodeOriginal = "Code=" + nowProduction2.PackageCodeClient + + "^ItemNumber=" + nowProduction2.Partnumber + + "^Order=" + nowProduction2.PackageCodeClient.Split('_')[0].Substring(2) + + "^Qty=" + secondHas; + nowProduction2.GoodsNumLogic = secondHas; + nowProduction2.GoodsNumAction = secondHas; + nowProduction2.Remark = "拼箱零头箱"; + } return log; } @@ -137,7 +181,7 @@ namespace ZR.Service.Business { return null; } - + description += "\n由主箱:" + mainPackage.PatchCode + "拆分:"; // 短批次 string shortPatchCode = mainPackage.PatchCode.Split('_')[0]; @@ -168,7 +212,7 @@ namespace ZR.Service.Business } } int firstNum = parm.firstNum; - + int? secondNum = mainNowProduction.GoodsNumAction - firstNum; if (secondNum <= 0) {