From e14fe1c9f7753de8bad65b193843748429d6dde1 Mon Sep 17 00:00:00 2001
From: Rodney Chen <rodney.chen@hotmail.com>
Date: 星期日, 04 八月 2024 17:54:53 +0800
Subject: [PATCH] 修改包装行为的打印模板获取方法

---
 Tiger.Business/MES/Biz.WorkBatch.cs |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/Tiger.Business/MES/Biz.WorkBatch.cs b/Tiger.Business/MES/Biz.WorkBatch.cs
index 7b2ce63..d97df4d 100644
--- a/Tiger.Business/MES/Biz.WorkBatch.cs
+++ b/Tiger.Business/MES/Biz.WorkBatch.cs
@@ -55,7 +55,7 @@
             public WorkBatch Init(string lineCode)
             {
                 LineCode = lineCode;
-                WO = Biz.Db.Queryable<BIZ_MES_WO>().Where(q => q.ORDER_NO == OrderNo).First();
+                WO = Biz.Db.Queryable<BIZ_MES_WO>().Where(q => q.ORDER_NO == OrderNo).IncludesAllFirstLayer().First();
                 Product = Biz.Db.Queryable<BAS_ITEM>().Where(q => q.ITEM_CODE == WO.ITEM_CODE && q.AUTH_ORG == WO.AUTH_ORG).First();
                 Batch = Biz.Db.Queryable<BIZ_MES_WO_BATCH>().Where(q => q.ORDER_NO == OrderNo && q.ACT_LINE == LineCode).First();
                 Customer = Biz.Db.Queryable<BAS_CUSTOMER>().Where(q => q.CUST_CODE == WO.CUST_CODE).First();    
@@ -106,10 +106,11 @@
             }
 
             /// <summary>
-            /// 妫�鏌ュ伐鍗曞疄鏃剁姸鎬侊紝鍒ゆ柇鍙互鐢熶骇锛氬伐鍗曡窡鎵规鐘舵�佷笉鏄凡涓嬪彂鎴栬�呯敓浜т腑锛屽垯涓嶅厑璁哥敓浜�
+            /// 妫�鏌ュ伐鍗曞湪褰撳墠宸ュ簭鑺傜偣鏄惁鍙互鐢熶骇
             /// </summary>
+            /// <param name="curNode"></param>
             /// <returns></returns>
-            public ApiAction<SubmitOutput> CheckStatus()
+            public ApiAction<SubmitOutput> CheckCanProduce(MES_WO_NODE curNode)
             {
                 var action = new ApiAction<SubmitOutput>(new SubmitOutput(), true);
 
@@ -131,6 +132,14 @@
                     //action.LocaleMsg = new($"宸ュ崟[{WO.ORDER_NO}]鐘舵�乕{Batch.STATUS.GetEnum<BIZ_MES_WO.STATUSs>().GetName()}]涓嶆槸鍏佽鐢熶骇鐨勭姸鎬侊紝璇锋壂鎻忓厑璁哥敓浜х殑浜у搧鏉$爜");
                     action.LocaleMsg = new("MES.WorkBatch.WoStatusCanNotWork", WO.ORDER_NO, Batch.STATUS.GetEnum<BIZ_MES_WO.STATUSs>().GetName());
                 }
+                //宸ュ崟鎵规鎶曞叆鏁伴噺鍑忓幓鎶ュ簾鏁伴噺濡傛灉澶т簬绛変簬璁″垝鏁伴噺锛屽垯涓嶅厑璁哥敓浜�
+                if (curNode.IS_INPUT == "Y" && Batch.INPUT_QTY - Batch.SCRAP_QTY >= Batch.PLAN_QTY)
+                {
+                    action.IsSuccessed = false;
+                    action.Data.SetValue(this, null);
+                    action.LocaleMsg = new($"宸ュ崟鎵规[{0}]宸叉姇鍏� {1}锛屽叾涓姤搴� {2}锛屼互婊¤冻璁″垝鏁伴噺[{3}]锛屾棤闇�缁х画鎶曞叆");
+                    action.LocaleMsg = new("MES.WorkBatch.WoInputEnough", Batch.BATCH_NO, Batch.INPUT_QTY, Batch.SCRAP_QTY, Batch.PLAN_QTY);
+                }
 
                 return action;
             }

--
Gitblit v1.9.3