From ac0d220e150a8103b586a81340faf39ddb5e08fe Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期五, 20 九月 2024 10:12:49 +0800
Subject: [PATCH] 一些已知更改

---
 Tiger.Business.MES/Transaction/TestNode.cs |   36 +++++++++++++++++++++++-------------
 1 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/Tiger.Business.MES/Transaction/TestNode.cs b/Tiger.Business.MES/Transaction/TestNode.cs
index 0da6add..248e204 100644
--- a/Tiger.Business.MES/Transaction/TestNode.cs
+++ b/Tiger.Business.MES/Transaction/TestNode.cs
@@ -47,17 +47,20 @@
                     //鍏堝垽鏂綋鍓嶅伐鍗曚笉涓虹┖涓斿綋鍓嶅矖浣嶅湪褰撳墠宸ュ崟鏄笉鏄绔欙紝濡傛灉鏄垯涓嶅厑璁稿彉鏇村綋鍓嶅伐鍗曪紝灏濊瘯鎶婃潯鐮佺粦瀹氬埌褰撳墠宸ュ崟
                     if (!CurBatch.IsNullOrEmpty() && CurBatch.IsFirstNode(PostCode))
                     {
+                        //鏇存柊CurBatch
+                        CurBatch?.Update();
+                        //鎻愪氦鏁版嵁
                         action = NodeSubmit(action, input);
                         //鏇存柊宸ュ簭淇℃伅
                         if (!action.IsSuccessed)
                         {
                             var info = WoContext.GetSnOperInfo(input.SN).Data;
-                            info.InputQty = OperInfoDic[CurBatch.Batch.BATCH_NO].InputQty;
+                            info.InputQty = CurOperInfo(input.Locale).InputQty;
                             action.Data.OperInfo = info;
                         }
                         else if (!IsFinishAllSteps)
                         {
-                            action.Data.OperInfo = SetOperNodeInfo(OperInfoDic[CurBatch.Batch.BATCH_NO], input.Locale);
+                            action.Data.OperInfo = SetOperNodeInfo(CurOperInfo(input.Locale));
                         }
                     }
                     //褰撳墠宀椾綅鍦ㄥ綋鍓嶅伐鍗曚笉鏄绔欙紝鍒欐煡鎵炬潯鐮佸凡缁戝畾鐨勫伐鍗曞綋浣滃綋鍓嶅伐鍗�
@@ -92,17 +95,19 @@
                                         return action;
                                     }
                                 }
+                                //鏇存柊CurBatch
+                                CurBatch?.Update();
                                 //鏉$爜杩囩珯
                                 action = NodeSubmit(action, input);
                                 if (!action.IsSuccessed && !CurWipSNs.Any())
                                 {
                                     var info = WoContext.GetSnOperInfo(input.SN).Data;
-                                    info.InputQty = OperInfoDic[CurBatch.Batch.BATCH_NO].InputQty;
+                                    info.InputQty = CurOperInfo(input.Locale).InputQty;
                                     action.Data.OperInfo = info;
                                 }
                                 else if (!IsFinishAllSteps)
                                 {
-                                    action.Data.OperInfo = SetOperNodeInfo(OperInfoDic[CurBatch.Batch.BATCH_NO], input.Locale);
+                                    action.Data.OperInfo = SetOperNodeInfo(CurOperInfo(input.Locale));
                                 }
                             }
                         }
@@ -133,11 +138,14 @@
                 //瀹屾垚宸ュ簭鑺傜偣宸ユ鍚庯紝寮�濮嬫墽琛屽綋鍓嶅伐搴忕殑琛屼负宸ユ
                 else if (IsFinishNodeSteps && !IsFinishAllSteps)
                 {
+                    //鏇存柊CurBatch
+                    CurBatch?.Update();
+
                     var submitStep = Steps.Where(q => q.ID == input.CurStepID && !q.IsFinished).FirstOrDefault();
                     if (submitStep.IsNullOrEmpty())
                     {
                         action = BeginNextActionStep(input);
-                        action.Data.OperInfo = OperInfoDic[CurBatch.Batch.BATCH_NO];
+                        action.Data.OperInfo = CurOperInfo(input.Locale);
                     }
                     else
                     {
@@ -167,7 +175,7 @@
                         }
                         else
                         {
-                            result.Data.OperInfo = OperInfoDic[CurBatch.Batch.BATCH_NO];
+                            result.Data.OperInfo = CurOperInfo(input.Locale);
                         }
                         return result;
                     }
@@ -176,7 +184,7 @@
                 else
                 {
                     action.Data.ShortMsg = new("閲嶇疆鎵弿", ShortMessage.Types.Error);
-                    action.Data.OperInfo = OperInfoDic.ContainsKey(CurBatch?.Batch?.BATCH_NO ?? "") ? OperInfoDic[CurBatch.Batch.BATCH_NO] : new();
+                    action.Data.OperInfo = CurOperInfo(input.Locale);
                     ResetNode();
 	                action.IsSuccessed = false;
 	                //action.LocaleMsg = new($"宀椾綅[{CurPosition.POST_CODE}]宸ユ鎵ц寮傚父锛岃閲嶆柊鎵弿浜у搧鏉$爜", CurPosition.POST_CODE);
@@ -186,7 +194,7 @@
             catch (Exception ex)
             {
                 action.Data.ShortMsg = new("宸ュ簭寮傚父", ShortMessage.Types.Error);
-                action.Data.OperInfo = OperInfoDic.ContainsKey(CurBatch?.Batch?.BATCH_NO ?? "") ? OperInfoDic[CurBatch.Batch.BATCH_NO] : new();
+                action.Data.OperInfo = CurOperInfo(input.Locale);
                 //action.CatchExceptionWithLog(ex, $"娴嬭瘯宸ュ簭锛氭彁浜ゆ搷浣滄暟鎹紓甯�");
                 action.CatchExceptionWithLog(ex, Biz.L("MES.Transaction.TestNode.SubmitException"));
             }
@@ -212,7 +220,7 @@
                     return woStatus;
                 }
 
-                var wipSNs = Biz.Db.Queryable<MES_WIP_DATA>().IncludesAllFirstLayer().Where(q => (q.SN == input.SN || q.TRAY_SN == input.SN) && q.WORK_ORDER == CurBatch.WO.ORDER_NO).ToList();
+                var wipSNs = Biz.Db.Queryable<MES_WIP_DATA>().IncludesAllFirstLayer().Where(q => q.SN == input.SN || q.FLOW_SN == input.SN || q.TRAY_SN == input.SN).ToList();
                 if (wipSNs.IsNullOrEmpty())
                 {
                     var wipSN = new MES_WIP_DATA()
@@ -245,7 +253,7 @@
                         action.Data.ShortMsg = new("宸ュ崟閿欒", ShortMessage.Types.Error);
                         action.IsSuccessed = false;
                         //action.LocaleMsg = new($"浜у搧[{CurSN}]涓嶅睘浜庡綋鍓嶅伐鍗曪紝璇峰垏鎹㈠埌宸ュ崟[{wipSNs.First().WORK_ORDER}]鍚庡啀鎵弿");
-                        action.LocaleMsg = new("MES.Transaction.TestNode.NodeSubmit.WoError", CurSN, wipSNs.First().WORK_ORDER);
+                        action.LocaleMsg = new("MES.Transaction.TestNode.NodeSubmit.WoError", input.SN, wipSNs.First().WORK_ORDER);
                         return action;
                     }
                     else
@@ -253,7 +261,7 @@
                         action.Data.ShortMsg = new("浜х嚎閿欒", ShortMessage.Types.Error);
                         action.IsSuccessed = false;
                         //action.LocaleMsg = new($"浜у搧[{CurSN}]宸插湪浜х嚎[{wipSNs.First().LINE_CODE}]鎶曚骇锛岃鍒颁骇绾縖{wipSNs.First().LINE_CODE}]鎵弿");
-                        action.LocaleMsg = new("MES.Transaction.TestNode.NodeSubmit.LineError", CurSN, wipSNs.First().LINE_CODE);
+                        action.LocaleMsg = new("MES.Transaction.TestNode.NodeSubmit.LineError", input.SN, wipSNs.First().LINE_CODE);
                         return action;
                     }
                 }
@@ -454,6 +462,7 @@
                     }
 
                     //瀹屾垚绗竴涓伐搴忚妭鐐瑰伐姝�
+                    curStep.IsFinished = true;
                     curStep.Status = StepStatus.Finished;
                     CurStep = curStep;
                 }
@@ -462,6 +471,7 @@
                     var curStep = Steps.Where(q => q.NodeType == IWorkStep.NodeTypes.Node && !q.IsFinished).OrderBy(q => q.Sequence).First();
 
                     //瀹屾垚褰撳墠宸ュ簭鑺傜偣宸ユ
+                    curStep.IsFinished = true;
                     curStep.Status = StepStatus.Finished;
                     CurStep = curStep;
                 }
@@ -524,8 +534,8 @@
             SaveStepsCommitActionToDB();
 
             //淇濆瓨鎴愬姛锛岃繑鍥炶繃绔欐秷鎭�
-            OperInfoDic[CurBatch.Batch.BATCH_NO].InputQty += CurWipSNs.Count;
-            action.Data.OperInfo = SetOperNodeInfo(OperInfoDic[CurBatch.Batch.BATCH_NO], locale);
+            CurOperInfo(locale).InputQty += CurWipSNs.Count;
+            action.Data.OperInfo = SetOperNodeInfo(CurOperInfo(locale));
             action.Data.ShortMsg = new("杩囩珯鎴愬姛", ShortMessage.Types.Success);
             //action.LocaleMsg = new($"宸ュ崟[{CurWipSN.WORK_ORDER}]鐨勬潯鐮乕{CurWipSN.SN}]鍦ㄥ矖浣峓{CurWipSN.POST_CODE}]宸ュ簭[{CurWipSN.NODE_NAME}]杩囩珯鎴愬姛锛岀姸鎬乕{CurWipSN.STATUS.GetEnumDesc<MES_WIP_DATA.STATUSs>()}]");
             action.LocaleMsg = new("MES.Transaction.CollectNode.ScanSn.PassSuccess", CurWipSNs.First().WORK_ORDER, CurSN, CurWipSNs.First().POST_CODE, CurWipSNs.First().NODE_NAME, CurWipSNs.First().STATUS.GetEnumDesc<MES_WIP_DATA.STATUSs>());

--
Gitblit v1.9.3