From 1d61b45846ac2e5cb0a8366365613c44c1319289 Mon Sep 17 00:00:00 2001 From: Rodney Chen <rodney.chen@hotmail.com> Date: 星期三, 26 三月 2025 18:06:17 +0800 Subject: [PATCH] 优化收货单上架行数量判断 --- Tiger.Business.WMS/Transaction/In_SemiProd.cs | 48 +++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 41 insertions(+), 7 deletions(-) diff --git a/Tiger.Business.WMS/Transaction/In_SemiProd.cs b/Tiger.Business.WMS/Transaction/In_SemiProd.cs index c05caa6..8b103a4 100644 --- a/Tiger.Business.WMS/Transaction/In_SemiProd.cs +++ b/Tiger.Business.WMS/Transaction/In_SemiProd.cs @@ -19,6 +19,8 @@ using static Microsoft.CodeAnalysis.CSharp.SyntaxTokenParser; using Tiger.Model.Entitys.MES.U9C; using Tiger.Model.Entitys.MES.BizPrintInstoreDoc; +using Tiger.Model.Entitys.MES.Position; +using IronPython.Runtime.Operations; namespace Tiger.Business.WMS.Transaction { @@ -79,9 +81,11 @@ { action.IsSuccessed = false; action.LocaleMsg = Biz.L("WMS.InSemiProd.ScanItem.WoEmptyFailure", input.SN); // $"宸ュ崟[{input.SN}]涓嶅瓨鍦�" - return action; + return SetOutPutMqttMsg(action, input.Locale); } - + + var semiTemplateQty = (input.Data ?? "").JsonToObject<SemiTemplateQty>() ?? new SemiTemplateQty(); + InStoreInfo Info = new() { ErpProdInBth = new() @@ -92,7 +96,8 @@ ITEM_CODE = wo.ITEM_CODE, ITEM_NAME = wo.ItemInfo?.ITEM_DESC, SapCode = wo.ItemInfo?.ExtInfo?.SapCode, - SCAN_QTY = input.Data.ToInt32(), + SCAN_QTY = semiTemplateQty.PackQty, + CompleteQty = semiTemplateQty.CompleteQty, IS_HANDLED = "N" //Y-宸茬敓鎴愶紝N-鏈敓鎴愶紝F-澶辫触 }, InStoreScanInfo = new() @@ -101,7 +106,7 @@ SALES_ORDER = wo.SALES_ORDER, WORK_ORDER = wo.ORDER_NO, BATCH_NO = "", - SCAN_QTY = input.Data.ToInt32() + SCAN_QTY = semiTemplateQty.PackQty.ToDouble() } }; @@ -273,7 +278,7 @@ ErpProdInBths.Clear(); InStoreScanInfos.Clear(); RcvRptInput.ErpProdInBths = Biz.Db.Queryable<BIZ_ERP_PROD_IN_BTH>() - .Where(q => q.BATCH_NO == SqlFunc.Subqueryable<BIZ_ERP_PROD_IN_BTH>().Where(s => s.ORDER_NO == UserCode && s.GHOST_ROW == false).Select(s => s.BATCH_NO)) + .Where(q => q.BATCH_NO == SqlFunc.Subqueryable<BIZ_ERP_PROD_IN_BTH>().Where(s => s.ORDER_NO == UserCode && s.GHOST_ROW == false).Select(s => s.BATCH_NO) && q.IS_HANDLED == "N") .IncludesAllFirstLayer().ToList(); foreach (var item in RcvRptInput.ErpProdInBths) { @@ -376,8 +381,8 @@ WorkOrder = item.WORK_ORDER, ItemCode = item.ITEM_CODE, WhCode = "10105", - PkgQty = item.SCAN_QTY.ToInt32(), - CompleteQty = item.SCAN_QTY.ToInt32(), + PkgQty = item.SCAN_QTY, + CompleteQty = item.CompleteQty, OutputType = 0, StorageType = 4, DocState = 1, @@ -467,6 +472,35 @@ ErpProdInSns = new(); inStoreInfos = new() { }; + //涓存椂浠g爜锛屾祴璇曠敤 + //DbClient _db = Biz.DataSource["YadaU9C"].Client; + //var items = Biz.Db.Queryable<WMS_ITEM>().Where(q => SqlFunc.IsNullOrEmpty(q.SUPP_LOTNO)).ToList(); + //var snlist = items.Select(q => q.SN).ToList(); + ////var list = _db.Ado.SqlQuery<mes_MaterialBarCodeByBin>($"select *,cast('{DateTime.Now.ToString("yyyy-MM-dd")}' as DATETIME) as PROD_DATE,'' as Unit,'' as LotNo from mes_MaterialBarCodeByBin where Code in ({string.Join(',', snlist.Select(x=> $"'{x}'"))})"); + //var list = _db.Queryable<mes_MaterialBarCode>().Where(q => snlist.Contains(q.Code)).ToList(); + //foreach (var item in list) + //{ + // var wmsitem = items.Where(q => q.SN == item.Code).FirstOrDefault(); + // if (!wmsitem.IsNullOrEmpty()) + // { + // wmsitem.SUPP_LOTNO = item.Segment7; + // } + //} + + + ////淇濆瓨鏁版嵁搴� + //var db = Business.Biz.Db; + //var dbTran = db.UseTran(() => + //{ + // db.Updateable(items).UpdateColumns(q => new { q.SUPP_LOTNO }).ExecuteCommand(); + //}); + //if (!dbTran.IsSuccess) + //{ + // Logger.Default.Fatal(dbTran.ErrorException, "Database transaction save exception"); + // this.Close(!dbTran.IsSuccess); + // throw dbTran.ErrorException; + //} + //淇濆瓨鏁版嵁搴� var db = Business.Biz.Db; var dbTran = db.UseTran(() => -- Gitblit v1.9.3