From 6f3b05c06125b457d0c78e259f3befe4910881cf Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期日, 27 十月 2024 16:54:29 +0800
Subject: [PATCH] 计划任务更新

---
 Tiger.Business.MES/Common/WoContext.cs |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Tiger.Business.MES/Common/WoContext.cs b/Tiger.Business.MES/Common/WoContext.cs
index 107746d..fda4192 100644
--- a/Tiger.Business.MES/Common/WoContext.cs
+++ b/Tiger.Business.MES/Common/WoContext.cs
@@ -35,7 +35,7 @@
         {
             if (ExistsBatch(workorder, lineCode, batchNo))
             {
-                return WoBatchDic.FirstOrDefault(q => q.Value.Batch.ORDER_NO == workorder && q.Value.Batch.ACT_LINE == lineCode && (batchNo.IsNullOrEmpty() || q.Value.Batch.BATCH_NO == batchNo)).Value;
+                return WoBatchDic.FirstOrDefault(q => !q.Value.Batch.IsNullOrEmpty() && q.Value.Batch.ORDER_NO == workorder && q.Value.Batch.ACT_LINE == lineCode && (batchNo.IsNullOrEmpty() || q.Value.Batch.BATCH_NO == batchNo)).Value;
             }
             return null;
         }
@@ -45,10 +45,13 @@
         /// </summary>
         /// <param name="workorder"></param>
         /// <param name="lineCode"></param>
+        /// <param name="batchNo"></param>
+        /// <param name="canDoWork"></param>
         /// <returns></returns>
-        public static bool ExistsBatch(string workorder, string lineCode, string batchNo = "")
+        public static bool ExistsBatch(string workorder, string lineCode, string batchNo = "", bool canDoWork = false)
         {
-            return WoBatchDic.Any(q => q.Value.Batch.ORDER_NO == workorder && q.Value.Batch.ACT_LINE == lineCode && (batchNo.IsNullOrEmpty() || q.Value.Batch.BATCH_NO == batchNo));
+            return WoBatchDic.WhereIF(canDoWork, q => !q.Value.Batch.IsNullOrEmpty() && (q.Value.Batch.STATUS == BIZ_MES_WO_BATCH.STATUSs.Release.GetValue() || q.Value.Batch.STATUS == BIZ_MES_WO_BATCH.STATUSs.Working.GetValue()))
+                .Any(q => q.Value.Batch.ORDER_NO == workorder && q.Value.Batch.ACT_LINE == lineCode && (batchNo.IsNullOrEmpty() || q.Value.Batch.BATCH_NO == batchNo));
         }
 
         /// 浠庡伐鍗曟壒娆″瓧鍏镐腑鍒犻櫎涓�涓伐鍗曟壒娆″璞�

--
Gitblit v1.9.3