From 2c60540518b5f2071987dcbe6aa237af4b97c77a Mon Sep 17 00:00:00 2001
From: Rodney Chen <rodney.chen@hotmail.com>
Date: 星期一, 12 五月 2025 23:49:52 +0800
Subject: [PATCH] 修复了一些已知问题

---
 Tiger.Business.WMS/Transaction/Old/ProductionMaterialReq.cs |    8 ++++----
 Tiger.Business.WMS/WMS_ITEM_Biz.cs                          |    3 ++-
 Tiger.Business.WMS/Transaction/Old/OutWorkOrder.cs          |    2 +-
 Tiger.Business.WMS/Transaction/Yada/Out_BIZ_WMS_PREP.cs     |   13 ++++---------
 Tiger.Business.WMS/Transaction/Old/OutTransfer.cs           |    2 +-
 Tiger.Business.WMS/Transaction/Old/OutOther.cs              |    2 +-
 Tiger.Business.WMS/Transaction/Old/OutSale.cs               |    2 +-
 7 files changed, 14 insertions(+), 18 deletions(-)

diff --git a/Tiger.Business.WMS/Transaction/Old/OutOther.cs b/Tiger.Business.WMS/Transaction/Old/OutOther.cs
index 430437a..da66417 100644
--- a/Tiger.Business.WMS/Transaction/Old/OutOther.cs
+++ b/Tiger.Business.WMS/Transaction/Old/OutOther.cs
@@ -266,7 +266,7 @@
                         var actQty = sumDtls.Where(x => x.ItemCode == inv.Item.ITEM_CODE).Select(x => x.actQty).First();
                         if (actQty > 0)
                         {
-                            inv.poolItem = inv.Item.GetPoolItem(input.AuthOption.OrgCode, nameof(req), req.BILLCODE, null, actQty, false);
+                            inv.poolItem = inv.Item.GetPoolItem(input.AuthOption.OrgCode, TransID, nameof(req), req.BILLCODE, null, actQty, false);
                         }
                         else
                         {
diff --git a/Tiger.Business.WMS/Transaction/Old/OutSale.cs b/Tiger.Business.WMS/Transaction/Old/OutSale.cs
index c4fd9b0..5f4f97b 100644
--- a/Tiger.Business.WMS/Transaction/Old/OutSale.cs
+++ b/Tiger.Business.WMS/Transaction/Old/OutSale.cs
@@ -113,7 +113,7 @@
                     var actQty = sumDtls.Where(x => x.ItemCode == inv.Item.ITEM_CODE).Select(x => x.actQty).First();
                     if (actQty > 0)
                     {
-                        inv.poolItem = inv.Item.GetPoolItem(input.AuthOption.OrgCode, nameof(req), req.BILLCODE, null, actQty, false);
+                        inv.poolItem = inv.Item.GetPoolItem(input.AuthOption.OrgCode, TransID, nameof(req), req.BILLCODE, null, actQty, false);
                     }
                     else
                     {
diff --git a/Tiger.Business.WMS/Transaction/Old/OutTransfer.cs b/Tiger.Business.WMS/Transaction/Old/OutTransfer.cs
index e7dd561..fc4f281 100644
--- a/Tiger.Business.WMS/Transaction/Old/OutTransfer.cs
+++ b/Tiger.Business.WMS/Transaction/Old/OutTransfer.cs
@@ -120,7 +120,7 @@
                     var actQty = sumDtls.ToList().Where(x => x.ItemCode.Trim() == inv.Item.ITEM_CODE.Trim()).Select(x => x.actQty).FirstOrDefault();
                     if (actQty > 0)
                     {
-                        inv.poolItem = inv.Item.GetPoolItem(input.AuthOption.OrgCode, nameof(req), req.ORDER_NO, null, actQty, false);
+                        inv.poolItem = inv.Item.GetPoolItem(input.AuthOption.OrgCode, TransID, nameof(req), req.ORDER_NO, null, actQty, false);
                     }
                     else
                     {
diff --git a/Tiger.Business.WMS/Transaction/Old/OutWorkOrder.cs b/Tiger.Business.WMS/Transaction/Old/OutWorkOrder.cs
index b542fd4..0a1d901 100644
--- a/Tiger.Business.WMS/Transaction/Old/OutWorkOrder.cs
+++ b/Tiger.Business.WMS/Transaction/Old/OutWorkOrder.cs
@@ -287,7 +287,7 @@
                         var actQty = sumDtls.Where(x => x.ItemCode == inv.Item.ITEM_CODE).Select(x => x.actQty).First();
                         if (actQty > 0)
                         {
-                            inv.poolItem = inv.Item.GetPoolItem(input.AuthOption.OrgCode, nameof(req), req.BILLCODE, null, actQty, false);
+                            inv.poolItem = inv.Item.GetPoolItem(input.AuthOption.OrgCode, TransID, nameof(req), req.BILLCODE, null, actQty, false);
                         }
                         else
                         {
diff --git a/Tiger.Business.WMS/Transaction/Old/ProductionMaterialReq.cs b/Tiger.Business.WMS/Transaction/Old/ProductionMaterialReq.cs
index 3245a62..7d347e5 100644
--- a/Tiger.Business.WMS/Transaction/Old/ProductionMaterialReq.cs
+++ b/Tiger.Business.WMS/Transaction/Old/ProductionMaterialReq.cs
@@ -147,7 +147,7 @@
                         var actQty = req.Dtls.First().PRQTY - req.Dtls.First().QTY;
                         if (inv != null && actQty > 0)
                         {
-                            inv.poolItem = inv.Item.GetPoolItem(input.AuthOption.OrgCode, nameof(req), req.BILLCODE, req.Dtls[0].BILLLINE, actQty, false);
+                            inv.poolItem = inv.Item.GetPoolItem(input.AuthOption.OrgCode, TransID, nameof(req), req.BILLCODE, req.Dtls[0].BILLLINE, actQty, false);
                         }
                         else
                         {
@@ -202,7 +202,7 @@
                         var actQty = sumDtls.Where(x => x.ItemCode == inv.Item.ITEM_CODE).Select(x => x.actQty).First();
                         if (actQty > 0)
                         {
-                            inv.poolItem = inv.Item.GetPoolItem(input.AuthOption.OrgCode, nameof(req), req.BILLCODE, null, actQty, false);
+                            inv.poolItem = inv.Item.GetPoolItem(input.AuthOption.OrgCode, TransID, nameof(req), req.BILLCODE, null, actQty, false);
                         }
                         else
                         {
@@ -255,7 +255,7 @@
                         var actQty = sumDtls.Where(x => x.ItemCode == inv.Item.ITEM_CODE).Select(x => x.actQty).First();
                         if (actQty > 0)
                         {
-                            inv.poolItem = inv.Item.GetPoolItem(input.AuthOption.OrgCode, nameof(req), req.BILLCODE, null, actQty, false);
+                            inv.poolItem = inv.Item.GetPoolItem(input.AuthOption.OrgCode, TransID, nameof(req), req.BILLCODE, null, actQty, false);
                         }
                         else
                         {
@@ -388,7 +388,7 @@
                         var actQty = sumDtls.Where(x => x.ItemCode == inv.Item.ITEM_CODE).Select(x => x.actQty).First();
                         if (actQty > 0)
                         {
-                            inv.poolItem = inv.Item.GetPoolItem(OrgCode, nameof(req), req.BILLCODE, null, actQty, false);
+                            inv.poolItem = inv.Item.GetPoolItem(OrgCode, TransID, nameof(req), req.BILLCODE, null, actQty, false);
                         }
                         else
                         {
diff --git a/Tiger.Business.WMS/Transaction/Yada/Out_BIZ_WMS_PREP.cs b/Tiger.Business.WMS/Transaction/Yada/Out_BIZ_WMS_PREP.cs
index 8407dd9..e8bd236 100644
--- a/Tiger.Business.WMS/Transaction/Yada/Out_BIZ_WMS_PREP.cs
+++ b/Tiger.Business.WMS/Transaction/Yada/Out_BIZ_WMS_PREP.cs
@@ -10,12 +10,7 @@
 using Tiger.Model;
 using Tiger.IBusiness;
 using Tiger.Business.WMS.Common;
-using Org.BouncyCastle.Ocsp;
-using Tiger.Model.Sharetronic.Shelf;
-using MailKit.Search;
 using Tiger.Business.WMS.Extensions;
-using static Tiger.Model.BIZ_WMS_PREP_BTH;
-using Microsoft.CodeAnalysis.Options;
 
 namespace Tiger.Business.WMS.Transaction
 {
@@ -224,7 +219,7 @@
                         var actQty = CurPrepDtl.QTY_PREP > CurPREP.BizType.GetActReqQty(CurPrepDtl) ? 0 : (CurPREP.BizType.GetActReqQty(CurPrepDtl) - CurPrepDtl.QTY_PREP);
                         if (inv != null && actQty > 0)
                         {
-                            inv.poolItem = inv.Item.GetPoolItem(OrgCode, nameof(CurPREP.Order), CurPrepDtl.ORDER_NO, CurPrepDtl.ORDER_LINE, actQty, true);
+                            inv.poolItem = inv.Item.GetPoolItem(OrgCode, TransID, nameof(CurPREP.Order), CurPrepDtl.ORDER_NO, CurPrepDtl.ORDER_LINE, actQty, true);
                         }
                         else
                         {
@@ -254,7 +249,7 @@
                     {
                         if (remain > 0)
                         {
-                            inv.poolItem = inv.Item.GetPoolItem(input.AuthOption.OrgCode, nameof(CurPREP.Order), CurPrepDtl.ORDER_NO, CurPrepDtl.ORDER_LINE, remain, false);
+                            inv.poolItem = inv.Item.GetPoolItem(OrgCode, TransID, nameof(CurPREP.Order), CurPrepDtl.ORDER_NO, CurPrepDtl.ORDER_LINE, remain, false);
                             remain -= inv.poolItem.ALLOC_QTY;
                         }
                         else
@@ -795,7 +790,7 @@
         /// <returns></returns>
         public async Task<ApiAction> GenerateDlvyBatch(BaseInput input)
         {
-            var range = input.Data.ToInt32().GetEnum<BATCH_RANGEs>();
+            var range = input.Data.ToInt32().GetEnum<BIZ_WMS_PREP_BTH.BATCH_RANGEs>();
             var action = await CurPREP.Order.BIZ_TYPE.GetEnum<BIZ_WMS_PREP.BIZ_TYPEs>() .GenerateDlvyBatch(this, range);
             return action;
         }
@@ -830,7 +825,7 @@
             //CloseLight(LocationHis).Wait();
             if (!(CurPREP?.Order?.ORDER_NO ?? "").IsNullOrEmpty())
             {
-                MainDB.Deleteable<WMS_ITEM_POOL>().Where(x => x.TRANS_NO == CurPREP.Order.ORDER_NO).ExecuteCommand();
+                MainDB.Deleteable<WMS_ITEM_POOL>().Where(q => q.TRANS_NO == CurPREP.Order.ORDER_NO || q.TRANS_ID == TransID).ExecuteCommand();
             }
 
             this.IsFinished = true;
diff --git a/Tiger.Business.WMS/WMS_ITEM_Biz.cs b/Tiger.Business.WMS/WMS_ITEM_Biz.cs
index 5e22b24..ada66ee 100644
--- a/Tiger.Business.WMS/WMS_ITEM_Biz.cs
+++ b/Tiger.Business.WMS/WMS_ITEM_Biz.cs
@@ -737,11 +737,12 @@
         /// <param name="transLine"></param>
         /// <param name="actQty"></param>
         /// <param name="isFirst"></param>
-        public static WMS_ITEM_POOL GetPoolItem(this WMS_ITEM item, string orgCode, string transCode, string transNo, string transLine, double actQty, bool isFirst)
+        public static WMS_ITEM_POOL GetPoolItem(this WMS_ITEM item, string orgCode, string transId, string transCode, string transNo, string transLine, double actQty, bool isFirst)
         {
             var poolItem = new WMS_ITEM_POOL()
             {
                 AUTH_ORG = orgCode,
+                TRANS_ID = transId,
                 TRANS_CODE = transCode,
                 TRANS_NO = transNo,
                 TRANS_LINE = transLine,

--
Gitblit v1.9.3