From 5b0cab677e7d899c6ab6629ee6645b297b6b8c9f Mon Sep 17 00:00:00 2001
From: Rodney Chen <rodney.chen@hotmail.com>
Date: 星期三, 14 八月 2024 23:01:32 +0800
Subject: [PATCH] 增加销售订单

---
 Tiger.Business.MES/Transaction/PackingNode.cs |   56 ++++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 36 insertions(+), 20 deletions(-)

diff --git a/Tiger.Business.MES/Transaction/PackingNode.cs b/Tiger.Business.MES/Transaction/PackingNode.cs
index 1ba8aed..e66574b 100644
--- a/Tiger.Business.MES/Transaction/PackingNode.cs
+++ b/Tiger.Business.MES/Transaction/PackingNode.cs
@@ -212,7 +212,8 @@
 	                var wipSN = new MES_WIP_DATA()
 	                {
 	                    SN = input.SN,
-	                    STATUS = MES_WIP_DATA.STATUSs.Init.GetValue(),
+                        FLOW_SN = input.SN,
+                        STATUS = MES_WIP_DATA.STATUSs.Init.GetValue(),
 	                    ITEM_CODE = CurBatch.WO.ITEM_CODE,
 	                    WORK_ORDER = CurBatch.Batch.ORDER_NO,
 	                    BATCH_NO = CurBatch.Batch.BATCH_NO,
@@ -242,6 +243,7 @@
                             CurBatch.WoSNs.Add(new()
                             {
                                 WORK_ORDER = CurBatch.Batch.ORDER_NO,
+                                WIP_ID = wipSN.ID,
                                 SN = wipSN.SN,
                                 TRAY_SN = wipSN.TRAY_SN,
                                 STATUS = BIZ_MES_WO_SN.STATUSs.NotInput.GetValue(),
@@ -326,8 +328,10 @@
                                 DFT_CODE = dft.DFT_CODE,
                                 DFT_NAME = dft.DFT_NAME,
                                 DFT_LEVEL = dft.DFT_LEVEL,
+                                FLOW_SN = wipSN.FLOW_SN,
                                 TRAY_SN = wipSN.TRAY_SN,
-                                CONTAINER_SN = wipSN.CONTAINER_SN,
+                                INNER_SN = wipSN.INNER_SN,
+                                CARTON_SN = wipSN.CARTON_SN,
                                 PALLET_SN = wipSN.PALLET_SN,
                                 INV_FLAG = wipSN.INV_FLAG,
                                 OPERATION_TIME = DateTime.Now,
@@ -352,6 +356,14 @@
                         CurWipSNHiss.Add(new MES_WIP_HIS(wipSN, $"宸ュ崟[{wipSN.WORK_ORDER}]鏉$爜[{wipSN.SN}]鍦ㄥ矖浣峓{wipSN.POST_CODE}]杩囩珯宸ュ簭[{wipSN.NODE_NAME}]鎴愬姛"));
                     }
 
+                    //鍒涘缓鍙橀噺鍏嬮殕瀵硅薄鐢ㄤ簬浼犲叆DBSubmitAction涓繚瀛樺綋鍓嶉渶瑕佹殏瀛樼殑鏁版嵁鍊�
+                    var _woSns = woSNs.Clone();
+                    var _wipSns = wipSNs.Clone();
+                    var _wipHiss = CurWipSNHiss.Clone();
+                    var _defect = CurDefects.Clone();
+                    var _curNode = curNode.Clone();
+                    var _Batch = CurBatch.Batch.Clone();
+
                     //鍒濆鍖栧伐姝ュ垪琛�
                     Steps.Clear();
 	                var curStep = new Biz.WorkStep(IWorkStep.Types.Node, this) 
@@ -360,26 +372,28 @@
 	                    Node = curNode,
 	                    DBSubmitAction = () =>
 	                    {
-	                        var db = GetCommitDB();
-	                        db.Storageable(woSNs, UserCode).ExecuteCommand();
-	                        db.Storageable(wipSNs, UserCode).ExecuteCommand();
-	                        db.Storageable(CurWipSNHiss, UserCode).ExecuteCommand();
+                            //浣跨敤缁熶竴鐨勪簨鍔B瀵硅薄
+                            var db = GetCommitDB();
+                            //鏁版嵁淇濆瓨閫昏緫
+	                        db.Storageable(_woSns, UserCode).ExecuteCommand();
+	                        db.Storageable(_wipSns, UserCode).ExecuteCommand();
+	                        db.Storageable(_wipHiss, UserCode).ExecuteCommand();
                             //濡傛灉鏈変笉鑹垯淇濆瓨
-                            if (CurDefects.Any())
+                            if (_defect.Any())
                             {
-                                db.Storageable(CurDefects, UserCode).ExecuteCommand();
+                                db.Storageable(_defect, UserCode).ExecuteCommand();
                             }
                             //濡傛灉鏄姇鍏ョ珯
-                            if (curNode.IS_INPUT == "Y")
+                            if (_curNode.IS_INPUT == "Y")
                             {
-                                db.Updateable<BIZ_MES_WO>().SetColumns(q => q.INPUT_QTY == q.INPUT_QTY + wipSNs.Count).Where(q => q.ORDER_NO == CurBatch.WO.ORDER_NO).ExecuteCommand();
-                                db.Updateable<BIZ_MES_WO_BATCH>().SetColumns(q => q.INPUT_QTY == q.INPUT_QTY + wipSNs.Count).Where(q => q.BATCH_NO == CurBatch.Batch.BATCH_NO).ExecuteCommand();
+                                db.Updateable<BIZ_MES_WO>().SetColumns(q => q.INPUT_QTY == q.INPUT_QTY + _woSns.Count).Where(q => q.ORDER_NO == _Batch.ORDER_NO).ExecuteCommand();
+                                db.Updateable<BIZ_MES_WO_BATCH>().SetColumns(q => q.INPUT_QTY == q.INPUT_QTY + _woSns.Count).Where(q => q.BATCH_NO == _Batch.BATCH_NO).ExecuteCommand();
                             }
                             //濡傛灉鏄骇鍑虹珯
-                            if (curNode.IS_OUTPUT == "Y")
+                            if (_curNode.IS_OUTPUT == "Y")
                             {
-                                db.Updateable<BIZ_MES_WO>().SetColumns(q => q.OUTPUT_QTY == q.OUTPUT_QTY + wipSNs.Count).Where(q => q.ORDER_NO == CurBatch.WO.ORDER_NO).ExecuteCommand();
-                                db.Updateable<BIZ_MES_WO_BATCH>().SetColumns(q => q.OUTPUT_QTY == q.OUTPUT_QTY + wipSNs.Count).Where(q => q.BATCH_NO == CurBatch.Batch.BATCH_NO).ExecuteCommand();
+                                db.Updateable<BIZ_MES_WO>().SetColumns(q => q.OUTPUT_QTY == q.OUTPUT_QTY + _woSns.Count).Where(q => q.ORDER_NO == _Batch.ORDER_NO).ExecuteCommand();
+                                db.Updateable<BIZ_MES_WO_BATCH>().SetColumns(q => q.OUTPUT_QTY == q.OUTPUT_QTY + _woSns.Count).Where(q => q.BATCH_NO == _Batch.BATCH_NO).ExecuteCommand();
                             }
                         }
 	                };
@@ -415,7 +429,6 @@
                 //鏈畬鎴愭墍鏈夊伐姝�
                 if (!IsFinishAllSteps)
                 {
-                    var result = new ApiAction<SubmitOutput>(new SubmitOutput());
                     //鏈畬鎴愭墍鏈夊伐搴忚妭鐐瑰伐姝�
                     if (!IsFinishNodeSteps)
                     {
@@ -424,14 +437,14 @@
                         NextSteps.Clear();
                         NextSteps.Add(next);
                         //鏍规嵁鍚庣画宸ユ杩斿洖ApiAction
-                        result.Data.SetValue(CurBatch, CurStep, next.ID, IsFinishAllSteps);
+                        action.Data.SetValue(CurBatch, CurStep, next.ID, IsFinishAllSteps);
 
                         //鏍规嵁宸ュ簭鑺傜偣宸ユ鐨勫簭鍙疯繑鍥炵浉搴旂殑鎿嶄綔鎻愮ず
                         switch (next.Sequence)
                         {
                             case 2:
                                 //action.LocaleMsg = new($"璇锋墽琛岀浜屾");
-                                result.LocaleMsg = new("MES.Transaction.CollectNode.绗簩姝ユ搷浣滄彁绀�");
+                                action.LocaleMsg = new("MES.Transaction.CollectNode.绗簩姝ユ搷浣滄彁绀�");
                                 break;
                             default:
                                 break;
@@ -440,9 +453,8 @@
                     //宸插畬鎴愭墍鏈夊伐搴忚妭鐐瑰伐姝ワ紝寮�濮嬫墽琛岃涓哄伐姝�
                     else
                     {
-                        result = BeginNextActionStep(input);
+                        action = BeginNextActionStep(input);
                     }
-                    return result;
                 }
                 //宸插畬鎴愭墍鏈夊伐姝�
                 if (IsFinishAllSteps)
@@ -474,7 +486,11 @@
             //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>());
             //閲嶇疆宸ュ簭
-            ResetNode();
+            //if (!isClone)
+            {
+                ResetNode();
+            }
+            
             return action;
         }
 

--
Gitblit v1.9.3