From c476c9cf07c1b1920cc4bf51f60a78f5768c30fa Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期一, 23 十二月 2024 19:41:33 +0800 Subject: [PATCH] 实体变化引起变更 --- Tiger.Business.MES/Transaction/YadaPacking.cs | 28 ++++++++++++++++++++++++++-- 1 files changed, 26 insertions(+), 2 deletions(-) diff --git a/Tiger.Business.MES/Transaction/YadaPacking.cs b/Tiger.Business.MES/Transaction/YadaPacking.cs index d6f5e44..488cd68 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); @@ -401,7 +404,7 @@ //鑾峰彇鍑鸿揣鐘舵�� var ship = U9CDB.Queryable<mes_ShipList>().Where(q => q.MoDoc == CurBatch.WO.ORDER_NO && q.Status == 2 && SqlFunc.DateIsSame(q.BusinessDate, DateTime.Now)).First(); - int CurShipQty = 0; + decimal CurShipQty = 0; int WaitShipmentCarton = 0; int WaitShipment = 0; if (ship.IsNullOrEmpty()) { IsPrintCustomerLabel = false; } @@ -690,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)); @@ -773,7 +777,7 @@ } }; } - + //throw new Exception("鍝�"); //淇濆瓨鏁版嵁搴� SaveStepsCommitActionToDB(endAction); @@ -990,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