From 1704d383bf3b7a8dda86d0a403500c08fa2f4dae Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期二, 10 十二月 2024 22:57:42 +0800
Subject: [PATCH] 一些优化

---
 Tiger.Business.MES/iERP/U9C_MES.cs            |   32 ++++++++++++++++----------------
 Tiger.Business.MES/Transaction/YadaPacking.cs |    5 ++++-
 Tiger.Business.MES/Transaction/PackingNode.cs |    2 ++
 Tiger.Business.MES/Transaction/TestNode.cs    |    1 +
 4 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/Tiger.Business.MES/Transaction/PackingNode.cs b/Tiger.Business.MES/Transaction/PackingNode.cs
index 26f7d68..4621164 100644
--- a/Tiger.Business.MES/Transaction/PackingNode.cs
+++ b/Tiger.Business.MES/Transaction/PackingNode.cs
@@ -264,6 +264,8 @@
             {
                 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"));
             }
diff --git a/Tiger.Business.MES/Transaction/TestNode.cs b/Tiger.Business.MES/Transaction/TestNode.cs
index 62455eb..d745dd0 100644
--- a/Tiger.Business.MES/Transaction/TestNode.cs
+++ b/Tiger.Business.MES/Transaction/TestNode.cs
@@ -216,6 +216,7 @@
             {
                 action.Data.ShortMsg = new("宸ュ簭寮傚父", ShortMessage.Types.Error);
                 action.Data.OperInfo = CurOperInfo(input.Locale);
+                ResetNode();
                 //action.CatchExceptionWithLog(ex, $"娴嬭瘯宸ュ簭锛氭彁浜ゆ搷浣滄暟鎹紓甯�");
                 action.CatchExceptionWithLog(ex, Biz.L("MES.Transaction.TestNode.SubmitException"));
             }
diff --git a/Tiger.Business.MES/Transaction/YadaPacking.cs b/Tiger.Business.MES/Transaction/YadaPacking.cs
index e4469c4..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);
@@ -774,7 +777,7 @@
                     }
                 };
             }
-
+            //throw new Exception("鍝�");
             //淇濆瓨鏁版嵁搴�
             SaveStepsCommitActionToDB(endAction);
 
diff --git a/Tiger.Business.MES/iERP/U9C_MES.cs b/Tiger.Business.MES/iERP/U9C_MES.cs
index c385d69..7c8579c 100644
--- a/Tiger.Business.MES/iERP/U9C_MES.cs
+++ b/Tiger.Business.MES/iERP/U9C_MES.cs
@@ -493,8 +493,8 @@
             }
             Logger.Scheduler.Info($"瀹㈡埛鏉$爜淇℃伅瀛樺叆瀹炰綋涓紝鎬绘暟锛歔{items.Count}]");
             db = Biz.Db;
-            var dbTran = db.UseTran(() =>
-            {
+            //var dbTran = db.UseTran(() =>
+            //{
                 if (items.Any())
                 {
                     if (items.Count > 100)
@@ -518,12 +518,12 @@
                     }
                 }
 
-            });
-            if (!dbTran.IsSuccess)
-            {
-                action.CatchExceptionWithLog(dbTran.ErrorException, $"鏁版嵁澶勭悊澶辫触");
-                Logger.Scheduler.Error(action.Message);
-            }
+            //});
+            //if (!dbTran.IsSuccess)
+            //{
+            //    action.CatchExceptionWithLog(dbTran.ErrorException, $"鏁版嵁澶勭悊澶辫触");
+            //    Logger.Scheduler.Error(action.Message);
+            //}
             Logger.Scheduler.Info($"瀹㈡埛鏉$爜淇℃伅瀛樺叆鏁版嵁搴擄紝鎬绘暟锛歔{items.Count}]");
             action.Message = $"瀹㈡埛鏉$爜淇℃伅瀛樺叆鏁版嵁搴擄紝鎬绘暟锛歔{items.Count}]";
             return action;
@@ -583,8 +583,8 @@
             }
             Logger.Scheduler.Info($"宸ュ崟淇℃伅瀛樺叆瀹炰綋涓紝鎬绘暟锛歔{items.Count}]");
             db = Biz.Db;
-            var dbTran = db.UseTran(() =>
-            {
+            //var dbTran = db.UseTran(() =>
+            //{
                 if (items.Any())
                 {
                     if (items.Count > 100)
@@ -608,12 +608,12 @@
                     }
                 }
 
-            });
-            if (!dbTran.IsSuccess)
-            {
-                action.CatchExceptionWithLog(dbTran.ErrorException, $"鏁版嵁澶勭悊澶辫触");
-                Logger.Scheduler.Error(action.Message);
-            }
+            //});
+            //if (!dbTran.IsSuccess)
+            //{
+            //    action.CatchExceptionWithLog(dbTran.ErrorException, $"鏁版嵁澶勭悊澶辫触");
+            //    Logger.Scheduler.Error(action.Message);
+            //}
             action.Message = $"宸ュ崟淇℃伅瀛樺叆鏁版嵁搴擄紝鎬绘暟锛歔{items.Count}]";
             Logger.Scheduler.Info($"{action.Message}");
             if (action.IsSuccessed && items.Count > 0)

--
Gitblit v1.9.3