From ac0d220e150a8103b586a81340faf39ddb5e08fe Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期五, 20 九月 2024 10:12:49 +0800
Subject: [PATCH] 一些已知更改

---
 Tiger.Business/MES/WoContext.cs |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/Tiger.Business/MES/WoContext.cs b/Tiger.Business/MES/WoContext.cs
index 78b28b5..6829945 100644
--- a/Tiger.Business/MES/WoContext.cs
+++ b/Tiger.Business/MES/WoContext.cs
@@ -33,7 +33,11 @@
         /// <returns></returns>
         public static WorkBatch GetBatch(string workorder, string lineCode)
         {
-            return WoBatchDic.FirstOrDefault(q => q.Value.Batch.ORDER_NO == workorder && q.Value.Batch.ACT_LINE == lineCode).Value;
+            if (ExistsBatch(workorder, lineCode))
+            {
+                return WoBatchDic.FirstOrDefault(q => q.Value.Batch.ORDER_NO == workorder && q.Value.Batch.ACT_LINE == lineCode).Value;
+            }
+            return null;
         }
 
         /// <summary>
@@ -200,7 +204,7 @@
                     if (!WoBatchDic.Any(q => q.Value.WO.ORDER_NO == wipSNs.First().WORK_ORDER))
                     {
                         var wb = new WorkBatch(wipSNs.First().WORK_ORDER).Init("");
-                        WoBatchDic.Add(wb.Batch.BATCH_NO, wb);
+                        WoBatchDic.Add(wipSNs.First().BATCH_NO, wb);
                     }
                     var wo = WoBatchDic.FirstOrDefault(q => q.Value.WO.ORDER_NO == wipSNs.First().WORK_ORDER).Value;
                     action.Data = new()

--
Gitblit v1.9.3