From a96e763c96401cbc7695acbcd6b18770d8aedf8d Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期三, 06 十一月 2024 15:35:25 +0800
Subject: [PATCH] 单独解绑更新

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

diff --git a/Tiger.Business.MES/WorkAction/PrintInStoreLabel.cs b/Tiger.Business.MES/WorkAction/PrintInStoreLabel.cs
index e066dbd..42c1fbe 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 WipPkg CurPkg { get; set; }
         public bool NoNeedInStorePrint { get; set; }
         #endregion Propertys & Variables
 
@@ -67,6 +68,7 @@
         public ApiAction<SubmitOutput> TryBegin(SubmitInput input)
         {
             var action = new ApiAction<SubmitOutput>(new SubmitOutput());
+            CurPkg = CurPosition.Context.ContainsKey("CurPackage") ? CurPosition.Context["CurPackage"] as WipPkg : null;
 
             if (Label.IsNullOrEmpty())
             {
@@ -76,14 +78,14 @@
             {
 	            //璁剧疆鎵撳嵃鍙橀噺鍊�
 	            Label = CurPosition.SetLabelVariables(LabelPV, Label, this);
-	            if (CurPosition.Context.ContainsKey("CurPackage"))
+	            if (!CurPkg.IsNullOrEmpty())
 	            {
-                    (CurPosition.Context["CurPackage"] as WipPkg).InStoreActID = NodeAct.ID;
-                    (CurPosition.Context["CurPackage"] as WipPkg).InStoreLabel = Label;
+                    CurPkg.InStoreActID = NodeAct.ID;
+                    CurPkg.InStoreLabel = Label;
 	            }
 	
 	            //鍒ゆ柇鏄惁闇�瑕佹墦鍗板叆搴撴爣绛�
-	            NoNeedInStorePrint = (!CurPosition.Context.ContainsKey("CurPackage") || !(CurPosition.Context["CurPackage"] as WipPkg).IsFinished) 
+	            NoNeedInStorePrint = (CurPkg.IsNullOrEmpty() || !CurPkg.IsFinished) 
 	                                    || (CurPosition is YadaPacking && (CurPosition as YadaPacking).IsPrintCustomerLabel);
 	            if (NoNeedInStorePrint)
 	            {
@@ -140,7 +142,6 @@
         {
             var action = new ApiAction<SubmitOutput>(new SubmitOutput());
 
-            var CurPkg = CurPosition.Context.ContainsKey("CurPackage") ? CurPosition.Context["CurPackage"] as WipPkg : null;
             //璁板綍琛屼负鎿嶄綔璁板綍
             var wipActs = new List<MES_WIP_ACT>();
             foreach (var wipSn in CurPosition.CurWipSNs)

--
Gitblit v1.9.3