From 69a1f63305d303745b831d55168cd2c8990f6fa9 Mon Sep 17 00:00:00 2001
From: Rodney Chen <rodney.chen@hotmail.com>
Date: 星期六, 21 九月 2024 09:56:17 +0800
Subject: [PATCH] 修复包装行为,手动结束包装不称重和创建package对象异常

---
 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