From 8bc453e47b30f0acf4333bec955ec86dadf428d5 Mon Sep 17 00:00:00 2001
From: Rodney Chen <rodney.chen@hotmail.com>
Date: 星期三, 16 十月 2024 14:32:11 +0800
Subject: [PATCH] 优化了一些已知问题

---
 Tiger.Business.MES/Common/WorkBatch.cs |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/Tiger.Business.MES/Common/WorkBatch.cs b/Tiger.Business.MES/Common/WorkBatch.cs
index 214a269..a96d8bb 100644
--- a/Tiger.Business.MES/Common/WorkBatch.cs
+++ b/Tiger.Business.MES/Common/WorkBatch.cs
@@ -161,7 +161,7 @@
             }
             //宸ュ崟鎵规鎶曞叆鏁伴噺鍑忓幓鎶ュ簾鏁伴噺濡傛灉澶т簬绛変簬璁″垝鏁伴噺锛屽垯涓嶅厑璁哥敓浜�
             //if (curNode.IS_INPUT == "Y" && Batch.INPUT_QTY - Batch.SCRAP_QTY >= Batch.PLAN_QTY)
-            if (curNodeSetting.IS_INPUT == "Y" && WoSNs.Count(q => q.STATUS > BIZ_MES_WO_SN.STATUSs.NotInput.GetValue() && q.BATCH_NO == Batch.BATCH_NO) - Batch.SCRAP_QTY >= Batch.PLAN_QTY)
+            if (curNode.IS_FIRST_NODE == "Y" && WoSNs.Count(q => q.STATUS > BIZ_MES_WO_SN.STATUSs.NotInput.GetValue() && q.BATCH_NO == Batch.BATCH_NO) - Batch.SCRAP_QTY >= Batch.PLAN_QTY)
             {
                 action.IsSuccessed = false;
                 action.Data.SetValue(this, null);
@@ -169,7 +169,7 @@
                 action.LocaleMsg = new("MES.WorkBatch.BatchInputEnough", Batch.BATCH_NO, WoSNs.Count(q => q.BATCH_NO == Batch.BATCH_NO), Batch.SCRAP_QTY, Batch.PLAN_QTY);
             }
             //宸ュ崟鎶曞叆鏁伴噺鍑忓幓鎶ュ簾鏁伴噺濡傛灉澶т簬绛変簬璁″垝鏁伴噺锛屽垯涓嶅厑璁哥敓浜�
-            if (curNodeSetting.IS_INPUT == "Y" && WoSNs.Count(q => q.STATUS > BIZ_MES_WO_SN.STATUSs.NotInput.GetValue() && q.WORK_ORDER == WO.ORDER_NO) - WO.SCRAP_QTY >= WO.PLAN_QTY)
+            if (curNode.IS_FIRST_NODE == "Y" && WoSNs.Count(q => q.STATUS > BIZ_MES_WO_SN.STATUSs.NotInput.GetValue() && q.WORK_ORDER == WO.ORDER_NO) - WO.SCRAP_QTY >= WO.PLAN_QTY)
             {
                 action.IsSuccessed = false;
                 action.Data.SetValue(this, null);
@@ -274,6 +274,19 @@
                 Logger.Default.Fatal(dbTran.ErrorException, $"妫�鏌ュ伐鍗曟壒娆{Batch.BATCH_NO}]鏄惁瀹屽伐寮傚父");
                 return false;
             }
+            //鍒犻櫎缂撳瓨
+            if (Batch.STATUS == BIZ_MES_WO_BATCH.STATUSs.Closed.GetValue())
+            {
+                WoContext.WoBatchDic.Remove(Batch.BATCH_NO);
+            }
+            if (WO.STATUS == BIZ_MES_WO.STATUSs.Closed.GetValue())
+            {
+                var list = WoContext.WoBatchDic.Where(q => q.Value.WO.ORDER_NO == OrderNo).Select(q => q.Key);
+                foreach (var item in list)
+                {
+                    WoContext.WoBatchDic.Remove(item);
+                }
+            }
 
             return true;
         }

--
Gitblit v1.9.3