From 24c0e02411353dd5ea2c17449ef4cd1a0db1ce82 Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期四, 19 十二月 2024 17:04:14 +0800 Subject: [PATCH] 入库标签也是出货标签时也需要HWDate, LOTNO --- Tiger.Business.MES/Transaction/YadaPacking.cs | 44 +++++++++++++++++++++++++------------------- 1 files changed, 25 insertions(+), 19 deletions(-) diff --git a/Tiger.Business.MES/Transaction/YadaPacking.cs b/Tiger.Business.MES/Transaction/YadaPacking.cs index 501eaaa..20bb28e 100644 --- a/Tiger.Business.MES/Transaction/YadaPacking.cs +++ b/Tiger.Business.MES/Transaction/YadaPacking.cs @@ -298,8 +298,11 @@ { action.Data.ShortMsg = new("宸ュ簭寮傚父", ShortMessage.Types.Error); action.Data.OperInfo = CurOperInfo(input.Locale); + RemoveCurSnFromCurPackage(Context.ContainsKey("CurPackage") ? (Context["CurPackage"] as WipPkg).Item : null); + ResetNode(); //action.CatchExceptionWithLog(ex, $"鍖呰宸ュ簭锛氭彁浜ゆ搷浣滄暟鎹紓甯�"); action.CatchExceptionWithLog(ex, Biz.L("MES.Transaction.PackingNode.SubmitException")); + } debug.Log(new StackFrame(true), "***** 9", info => { ConsoleExt.WriteLine(info.ToString()); }); return SetOutPutMqttMsg(action, input.Locale); @@ -349,7 +352,6 @@ FLOW_SN = input.SN, STATUS = MES_WIP_DATA.STATUSs.Init.GetValue(), ITEM_CODE = CurBatch.WO.ITEM_CODE, - QTY = 1, WORK_ORDER = CurBatch.Batch.ORDER_NO, BATCH_NO = CurBatch.Batch.BATCH_NO, FTY_CODE = CurFactory.FTY_CODE, @@ -423,25 +425,9 @@ ShippingOrder = IsPrintCustomerLabel ? ship?.ShipDoc ?? "" : ""; //缂撳瓨鍑鸿揣鏁伴噺 Context.SetOrAdd("CurShipQty", CurShipQty); - //if (Context.ContainsKey("CurShipQty")) - //{ - // Context["CurShipQty"] = CurShipQty; - //} - //else - //{ - // Context.Add("CurShipQty", CurShipQty); - //} //缂撳瓨鍑鸿揣绠辨暟 Context.SetOrAdd("CurWaitShipmentCarton", WaitShipmentCarton); Context.SetOrAdd("CurWaitShipment", WaitShipment); - //if (Context.ContainsKey("CurWaitShipmentCarton")) - //{ - // Context["CurWaitShipmentCarton"] = WaitShipmentCarton; - //} - //else - //{ - // Context.Add("CurWaitShipmentCarton", WaitShipmentCarton); - //} debug.Log(new StackFrame(true), "***** 12", info => { ConsoleExt.WriteLine(info.ToString()); }); //缁戝畾鏉$爜鍒板伐鍗� @@ -457,7 +443,6 @@ FLOW_SN = wipSN.SN, TRAY_SN = wipSN.TRAY_SN, STATUS = BIZ_MES_WO_SN.STATUSs.NotInput.GetValue(), - QTY = 1, }); } } @@ -708,6 +693,7 @@ catch (Exception ex) { action.Data.ShortMsg = new("宸ユ寮傚父", ShortMessage.Types.Error); + RemoveCurSnFromCurPackage(Context.ContainsKey("CurPackage") ? (Context["CurPackage"] as WipPkg).Item : null); ResetNode(); //action.CatchExceptionWithLog(ex, $"{curNode.NODE_NAME}锛氬伐搴忚妭鐐瑰伐姝ユ彁浜ゆ暟鎹紓甯革紝璇锋鏌ュ伐搴忚妭鐐硅缃�"); action.CatchExceptionWithLog(ex, Biz.L("MES.Transaction.PackingNode.NodeSubmitException", curNode.NODE_NAME)); @@ -791,7 +777,7 @@ } }; } - + //throw new Exception("鍝�"); //淇濆瓨鏁版嵁搴� SaveStepsCommitActionToDB(endAction); @@ -1008,6 +994,26 @@ NodeCmd = null; } + public void RemoveCurSnFromCurPackage(WipPkgItem pkgItem) + { + if (!pkgItem.IsNullOrEmpty()) + { + var delItem = pkgItem.Items.Where(q => CurWipSNs.Any(sn => q.WipSNs.ContainsKey(sn.ID))).ToList(); + if (delItem.Any()) + { + pkgItem.Items.RemoveAll(q => CurWipSNs.Any(sn => q.WipSNs.ContainsKey(sn.ID))); + pkgItem.IsFinished = false; + } + else + { + foreach (var item in pkgItem.Items) + { + RemoveCurSnFromCurPackage(item); + } + } + } + } + public override bool Close(bool needSaveHistoryLog = false) { //needSaveHistoryLog = true; -- Gitblit v1.9.3