From f165524436ee7a5040c4066081609d1d1e4ffb64 Mon Sep 17 00:00:00 2001
From: Rodney Chen <rodney.chen@hotmail.com>
Date: 星期五, 25 十月 2024 11:05:52 +0800
Subject: [PATCH] 优化打印入库标签行为

---
 Tiger.Business.MES/WorkAction/PrintInStoreLabel.cs |   32 +++++++++++++++++++++-----------
 1 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/Tiger.Business.MES/WorkAction/PrintInStoreLabel.cs b/Tiger.Business.MES/WorkAction/PrintInStoreLabel.cs
index 545a495..13a9776 100644
--- a/Tiger.Business.MES/WorkAction/PrintInStoreLabel.cs
+++ b/Tiger.Business.MES/WorkAction/PrintInStoreLabel.cs
@@ -25,6 +25,7 @@
         #endregion
         public BAS_LABEL_TEMP Label { get; set; }
         public List<BAS_LABEL_PV> LabelPV { get; set; }
+        public bool NoNeedPrint { get; set; }
         #endregion Propertys & Variables
 
         #region Functions
@@ -67,7 +68,9 @@
         {
             var action = new ApiAction<SubmitOutput>(new SubmitOutput());
 
-            if (CurPosition is YadaPacking && !(CurPosition as YadaPacking).IsPrintCustomerLabel)
+            NoNeedPrint = (!CurPosition.Context.ContainsKey("CurPackage") || !(CurPosition.Context["CurPackage"] as WipPkg).IsFinished) 
+                                    || (CurPosition is YadaPacking && (CurPosition as YadaPacking).IsPrintCustomerLabel);
+            if (NoNeedPrint)
             {
                 action = End(input);
             } 
@@ -164,12 +167,8 @@
                     ACT_VALUE_2 = Label.Variables.ToJson(),
                     ACT_RESULT = "Y",
                     ELAPSED_TIME = CurStep.GetElapsedTime().TotalMilliseconds.ToInt64(),
-                    TRACE_INFO = $"鏍囩{Label.LABEL_NAME}[{Label.LABEL_CODE}]鎵撳嵃鎴愬姛",
+                    TRACE_INFO = NoNeedPrint ? $"鏃犻渶鎵撳嵃鍏ュ簱鏍囩" : $"鏍囩{Label.LABEL_NAME}[{Label.LABEL_CODE}]鎵撳嵃鎴愬姛",
                 };
-                if (CurPosition is YadaPacking && !(CurPosition as YadaPacking).IsPrintCustomerLabel)
-                {
-                    wipAct.TRACE_INFO = $"鏃犻渶鎵撳嵃鍏ュ簱鏍囩";
-                }
                 wipActs.Add(wipAct);
             }
 
@@ -183,11 +182,22 @@
             };
 
             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.PrintInStoreLabel.PrintSuccess", Label.LABEL_NAME, Label.LABEL_CODE);
+            if (NoNeedPrint)
+            {
+                CurStep.Message = Biz.L("鏃犻渶鎵撳嵃");
+                CurStep.Status = StepStatus.Finished;
+                action.Data.ShortMsg = new("鏃犻渶鎵撳嵃", ShortMessage.Types.Success);
+                //action.LocaleMsg = new($"鏃犻渶鎵撳嵃鍏ュ簱鏍囩{0}[{1}]");
+                action.LocaleMsg = new("MES.WorkAction.PrintInStoreLabel.NoNeedPrint", Label.LABEL_NAME, Label.LABEL_CODE);
+            } 
+            else
+            {
+	            CurStep.Message = Biz.L("鎵撳嵃瀹屾垚");
+	            CurStep.Status = StepStatus.Finished;
+	            action.Data.ShortMsg = new("鎵撳嵃瀹屾垚", ShortMessage.Types.Success);
+                //action.LocaleMsg = new($"鍏ュ簱鏍囩{0}[{1}鎵撳嵃鎴愬姛");
+                action.LocaleMsg = new("MES.WorkAction.PrintInStoreLabel.PrintSuccess", Label.LABEL_NAME, Label.LABEL_CODE);
+            }
             return action;
         }
 

--
Gitblit v1.9.3