From d0093b0350c908383c5867ba3b91fc14c686c7bf Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期六, 26 十月 2024 00:38:51 +0800
Subject: [PATCH] Merge branch 'master' into master_ben

---
 Tiger.Api/Language.db                                            |    0 
 Tiger.Business.MES/Transaction/PackingNode.cs                    |   23 -----------
 Tiger.Business.MES/WorkAction/PrintInStoreLabel.cs               |   32 ++++++++++-----
 Tiger.Business.MES/WorkAction/PackingAction.cs                   |    8 ++++
 Tiger.Model.Net/Entitys/MES/ParameterEntity/PositionParameter.cs |    4 ++
 5 files changed, 33 insertions(+), 34 deletions(-)

diff --git a/Tiger.Api/Language.db b/Tiger.Api/Language.db
index 7701243..e41a479 100644
--- a/Tiger.Api/Language.db
+++ b/Tiger.Api/Language.db
Binary files differ
diff --git a/Tiger.Business.MES/Transaction/PackingNode.cs b/Tiger.Business.MES/Transaction/PackingNode.cs
index 05cb530..2884e5f 100644
--- a/Tiger.Business.MES/Transaction/PackingNode.cs
+++ b/Tiger.Business.MES/Transaction/PackingNode.cs
@@ -48,16 +48,6 @@
             var action = new ApiAction<SubmitOutput>(new SubmitOutput());
             try
             {
-                if (input.Qty.ToInt32() <= 0)
-                {
-                    action.Data.ShortMsg = new("璇疯緭鍏ュ寘瑁呮暟閲�", ShortMessage.Types.Error);
-                    action.Data.OperInfo = new();
-                    action.Data.Data = "QtyError";
-                    action.IsSuccessed = false;
-                    action.LocaleMsg = new($"鍖呰鏁伴噺[{input.Qty}]涓嶆纭紝璇烽噸鏂拌緭鍏ユ暟閲忓悗缁х画鍖呰鎿嶄綔");
-                    //action.LocaleMsg = new("MES.Transaction.PackingNode.Submit.QtyError", input.Qty);
-                    return action;
-                }
                 //PkgSubmit锛氭墜鍔ㄧ粨鏉熷寘瑁咃紝鎵嬪姩淇濆瓨鏆傚瓨鐨勫寘瑁呮暟鎹�
                 if (NodeCmd == "PkgSubmit")
                 {
@@ -729,19 +719,6 @@
                     {
                         TempPkgAction = new PackingAction();
                         TempPkgAction.Init(this);
-
-                        var CurPkg = Context["CurPackage"] as WipPkg;
-                        int shipQty = input.Data.ToInt32();
-                        int curQty = CurPkg.Item.TotalQty;
-                        int ruleQty = TempPkgAction.PkgRule.GetTotalQty();
-                        //鏈夊~鍑鸿揣鏁伴噺鍒欓獙璇佸綋鍓嶅寘瑁呮暟閲忓繀椤荤瓑浜庯紙鍑鸿揣鏁伴噺/鍖呰瑙勫垯鏁伴噺锛夌殑浣欐暟
-                        if (shipQty > 0 && curQty != shipQty % ruleQty)
-                        {
-                            action.IsSuccessed = false;
-                            //action.LocaleMsg = new($"鍑鸿揣鏁伴噺璁惧畾涓篬{0}]锛岀洰鍓嶅寘瑁呬簡[{1}]锛屽寘瑁呭熬鏁扮殑鏁伴噺蹇呴渶鏄痆{2}]锛岃瑁呭鏁伴噺鍚庡啀缁撴潫鍖呰");
-                            action.LocaleMsg = new("MES.Transaction.PackingNode.NotMatchShipQty", shipQty, curQty, shipQty % ruleQty);
-                            return action;
-                        }
 
                         NodeCmd = "PkgSubmit";
                         action = TempPkgAction.Submit(null);
diff --git a/Tiger.Business.MES/WorkAction/PackingAction.cs b/Tiger.Business.MES/WorkAction/PackingAction.cs
index 4e0bfd3..d0cf4fb 100644
--- a/Tiger.Business.MES/WorkAction/PackingAction.cs
+++ b/Tiger.Business.MES/WorkAction/PackingAction.cs
@@ -6,6 +6,7 @@
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using Tiger.Business.MES.Transaction;
 using Tiger.IBusiness;
 using Tiger.IBusiness.MES.WorkAction;
 using Tiger.Model;
@@ -228,6 +229,7 @@
                 data.ExecCode = "Print";
                 data.PkgLevel = min.PKG_LEVEL;
                 data.PrintLable = LabelDic[min.PKG_LEVEL];
+                data.RealPrint = data.PkgLevel != CurPkg.Item.PKG_LEVEL || CurPosition is not YadaPacking || (CurPosition as YadaPacking).IsPrintCustomerLabel;
                 CurCmd = data;
                 PrintTimes++;
                 CurStep?.SetStatusMessage(StepStatus.Normal, Biz.L("鎵撳嵃鏍囩"));
@@ -396,6 +398,7 @@
                                     data.ExecCode = "Print";
                                     data.PkgLevel = dtl.PKG_LEVEL;
                                     data.PrintLable = LabelDic[dtl.PKG_LEVEL];
+                                    data.RealPrint = data.PkgLevel != CurPkg.Item.PKG_LEVEL || CurPosition is not YadaPacking || (CurPosition as YadaPacking).IsPrintCustomerLabel;
                                     CurCmd = data;
                                     PrintTimes++;
                                     CurStep?.SetStatusMessage(StepStatus.Normal, Biz.L("鎵撳嵃鏍囩"));
@@ -493,6 +496,7 @@
                             data.ExecCode = "Print";
                             data.PkgLevel = dtl.PKG_LEVEL;
                             data.PrintLable = LabelDic[dtl.PKG_LEVEL];
+                            data.RealPrint = data.PkgLevel != CurPkg.Item.PKG_LEVEL || CurPosition is not YadaPacking || (CurPosition as YadaPacking).IsPrintCustomerLabel;
                             CurCmd = data;
                             PrintTimes++;
                             CurStep?.SetStatusMessage(StepStatus.Normal, Biz.L("鎵撳嵃鏍囩"));
@@ -712,6 +716,7 @@
                                     data.ExecCode = "Print";
                                     data.PkgLevel = dtl.PKG_LEVEL;
                                     data.PrintLable = LabelDic[dtl.PKG_LEVEL];
+                                    data.RealPrint = data.PkgLevel != CurPkg.Item.PKG_LEVEL || CurPosition is not YadaPacking || (CurPosition as YadaPacking).IsPrintCustomerLabel;
                                     CurCmd = data;
                                     PrintTimes++;
                                     CurStep?.SetStatusMessage(StepStatus.Normal, Biz.L("鎵撳嵃鏍囩"));
@@ -856,6 +861,9 @@
                         ACT_TYPE = NodeAct.ACT_TYPE,
                         ACT_SN = wipSn.SN,
                         ACT_RESULT = "Y",
+                        ACT_VALUE_1 = CurPkg.IsFinished ? "Y" : "N",
+                        ACT_VALUE_2 = CurPkg.ToJson(),
+                        ACT_VALUE_3 = CurPkg.IsFinished ? LabelDic[CurPkg.Item.PKG_LEVEL].ToJson() : "",
                         ELAPSED_TIME = CurStep.GetElapsedTime().TotalMilliseconds.ToInt64(),
                         TRACE_INFO = $"浜у搧鏉$爜[{string.Join("锛�", CurPosition.CurSN)}]鍖呰瀹屾垚",
                     };
diff --git a/Tiger.Business.MES/WorkAction/PrintInStoreLabel.cs b/Tiger.Business.MES/WorkAction/PrintInStoreLabel.cs
index 545a495..84c318f 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 NoNeedInStorePrint { 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)
+            NoNeedInStorePrint = (!CurPosition.Context.ContainsKey("CurPackage") || !(CurPosition.Context["CurPackage"] as WipPkg).IsFinished) 
+                                    || (CurPosition is YadaPacking && (CurPosition as YadaPacking).IsPrintCustomerLabel);
+            if (NoNeedInStorePrint)
             {
                 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 = NoNeedInStorePrint ? $"鏃犻渶鎵撳嵃鍏ュ簱鏍囩" : $"鏍囩{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 (NoNeedInStorePrint)
+            {
+                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;
         }
 
diff --git a/Tiger.Model.Net/Entitys/MES/ParameterEntity/PositionParameter.cs b/Tiger.Model.Net/Entitys/MES/ParameterEntity/PositionParameter.cs
index 2517a72..dd09f36 100644
--- a/Tiger.Model.Net/Entitys/MES/ParameterEntity/PositionParameter.cs
+++ b/Tiger.Model.Net/Entitys/MES/ParameterEntity/PositionParameter.cs
@@ -152,6 +152,10 @@
         /// </summary>
         public int PkgLevel { get; set; }
         /// <summary>
+        /// 鏄惁闇�瑕�
+        /// </summary>
+        public bool RealPrint { get; set; } = true;
+        /// <summary>
         /// 褰撳墠闇�瑕佹墦鍗扮殑鍖呰灞傜骇鐨勬爣绛句俊鎭�
         /// </summary>
         public BAS_LABEL_TEMP PrintLable { get; set; }

--
Gitblit v1.9.3