From 582d7ab9eb6879f4b5f3e1b1b7d162f3d53a0e39 Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期日, 27 十月 2024 14:12:32 +0800
Subject: [PATCH] Merge branch 'master' into master_ben

---
 Tiger.Business.MES/WorkAction/PrintLabel.cs |   29 ++++++++++++++++++++++++-----
 1 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/Tiger.Business.MES/WorkAction/PrintLabel.cs b/Tiger.Business.MES/WorkAction/PrintLabel.cs
index ff6a384..a818341 100644
--- a/Tiger.Business.MES/WorkAction/PrintLabel.cs
+++ b/Tiger.Business.MES/WorkAction/PrintLabel.cs
@@ -42,6 +42,9 @@
 
             Label = Biz.Db.Queryable<BAS_LABEL_TEMP>().Where(q => q.LABEL_CODE == setting.LABEL_CODE).IncludesAllFirstLayer().First();
             LabelPV = Biz.Db.Queryable<BAS_LABEL_PV>().ToList();
+
+            CurStep.Message = Biz.L("绛夊緟鏍囩鎵撳嵃");
+            CurStep.Status = StepStatus.Normal;
         }
 
         /// <summary>
@@ -64,11 +67,14 @@
             var action = new ApiAction<SubmitOutput>(new SubmitOutput());
 
             //璁剧疆鎵撳嵃鍙橀噺鍊�
-            Label = CurPosition.SetLabelVariables(LabelPV, Label);
+            Label = CurPosition.SetLabelVariables(LabelPV, Label, this);
             action.Data.Data = Label;
 
             //濡傛灉杩斿洖鎴愬姛鍒欒涓哄綋鍓嶈涓哄彲浠ュ紑濮嬫墽琛岋紝鍚﹀垯杩斿洖澶辫触
+            CurStep.Message = Biz.L("鎵撳嵃寮�濮�");
+            CurStep.Status = StepStatus.Normal;
             action.IsSuccessed = true;
+            action.Data.ShortMsg = new("鎵撳嵃寮�濮�", ShortMessage.Types.Success);
             return action;
         }
 
@@ -82,11 +88,14 @@
             //鎻愪氦鏁版嵁鎵ц鎴愬姛
             if (input.Data.ToBoolean())
             {
-                action = End();
+                action = End(input);
             }
             //鎻愪氦鏁版嵁鎵ц澶辫触
             else
             {
+                CurStep.Message = Biz.L("鎵撳嵃澶辫触");
+                CurStep.Status = StepStatus.Error;
+                action.Data.ShortMsg = new("鎵撳嵃澶辫触", ShortMessage.Types.Failed);
                 action.IsSuccessed = false;
                 //action.LocaleMsg = new($"鏍囩{Label.LABEL_NAME}[{Label.LABEL_CODE}]鎵撳嵃澶辫触", Label.LABEL_NAME);
                 action.LocaleMsg = new("MES.WorkAction.PrintLabel.PrintFail", Label.LABEL_NAME, Label.LABEL_CODE);
@@ -102,7 +111,7 @@
         /// 缁撴潫鎵ц宸ュ簭琛屼负
         /// </summary>
         /// <returns></returns>
-        public ApiAction<SubmitOutput> End()
+        public ApiAction<SubmitOutput> End(SubmitInput input)
         {
             var action = new ApiAction<SubmitOutput>(new SubmitOutput());
 
@@ -115,6 +124,7 @@
                     AUTH_ORG = CurPosition.WorkBatch.WO.AUTH_ORG,
                     AUTH_PROD = CurPosition.CurLine.LINE_CODE,
                     HIS_ID = CurPosition.CurWipSNHiss.First(q => q.SN == wipSn.SN).ID,
+                    WIP_ID = wipSn.ID,
                     SN = wipSn.SN,
                     STATUS = wipSn.STATUS,
                     ITEM_CODE = wipSn.ITEM_CODE,
@@ -131,7 +141,11 @@
                     POST_CODE = wipSn.POST_CODE,
                     OPER_CODE = wipSn.OPER_CODE,
                     SEGMENT = wipSn.SEGMENT,
+                    FLOW_SN = wipSn.FLOW_SN,
                     TRAY_SN = wipSn.TRAY_SN,
+                    INNER_SN = wipSn.INNER_SN,
+                    CARTON_SN = wipSn.CARTON_SN,
+                    PALLET_SN = wipSn.PALLET_SN,
                     OPERATION_TIME = DateTime.Now,
                     SFTS_CODE = wipSn.SFTS_CODE,
                     SFT_CODE = wipSn.SFT_CODE,
@@ -141,20 +155,25 @@
                     ACT_VALUE_1 = Label.LABEL_CODE,
                     ACT_VALUE_2 = Label.Variables.ToJson(),
                     ACT_RESULT = "Y",
+                    ELAPSED_TIME = CurStep.GetElapsedTime().TotalMilliseconds.ToInt64(),
                     TRACE_INFO = $"鏍囩{Label.LABEL_NAME}[{Label.LABEL_CODE}]鎵撳嵃鎴愬姛",
                 };
                 wipActs.Add(wipAct);
             }
-            
 
+            //鍒涘缓鍙橀噺鍏嬮殕瀵硅薄鐢ㄤ簬浼犲叆DBSubmitAction涓繚瀛樺綋鍓嶉渶瑕佹殏瀛樼殑鏁版嵁鍊�
+            var _wipActs = wipActs.Clone();
             //淇濆瓨鏁版嵁
             CurStep.DBSubmitAction = () =>
             {
                 var db = CurPosition.GetCommitDB();
-                db.Storageable(wipActs, CurPosition.UserCode).ExecuteCommand();
+                db.Storageable(_wipActs, CurPosition.UserCode).ExecuteCommand();
             };
 
             IsFinished = true;
+            CurStep.Message = Biz.L("鎵撳嵃瀹屾垚");
+            CurStep.Status = StepStatus.Finished;
+            action.Data.ShortMsg = new("鎵撳嵃瀹屾垚", ShortMessage.Types.Success);
             //action.LocaleMsg = new($"鏍囩{Label.LABEL_NAME}[{Label.LABEL_CODE}]鎵撳嵃鎴愬姛", Label.LABEL_NAME);
             action.LocaleMsg = new("MES.WorkAction.PrintLabel.PrintSuccess", Label.LABEL_NAME, Label.LABEL_CODE);
             return action;

--
Gitblit v1.9.3