From a7ceaaa38a4394b82501ca60230e97d25a6871e3 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期六, 18 一月 2025 17:30:33 +0800
Subject: [PATCH] 1

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs"
index 2f92c4b..00a078d 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs"
@@ -623,7 +623,6 @@
                 }
 
                 List<Dt_StockInfoDetail> stockInfoDetails = new List<Dt_StockInfoDetail>();
-                List<int> detailKeys = new List<int>();
                 foreach (var model in models)
                 {
                     if (purchaseOrderNos.FirstOrDefault(x => x == model.PurchaseOrderNo) == null)
@@ -631,13 +630,12 @@
                         return WebResponseContent.Instance.Error($"鏈湪鏀惰揣鍗曟槑缁嗕腑鎵惧埌璇ラ噰璐崟");
                     }
 
-                    Dt_InboundOrderDetail? notGroupDetail = inboundOrderDetails.Where(x => x.OrderDetailStatus == OrderDetailStatusEnum.New.ObjToInt() && x.OrderQuantity == model.Quantity && !detailKeys.Contains(x.Id) && x.OrderQuantity > x.ReceiptQuantity).FirstOrDefault();
+                    Dt_InboundOrderDetail? notGroupDetail = inboundOrderDetails.Where(x => x.OrderDetailStatus < OrderDetailStatusEnum.Inbounding.ObjToInt() && x.MaterielCode==model.MaterielCode && x.BatchNo==model.LotNo && x.OrderQuantity > x.ReceiptQuantity).FirstOrDefault();
 
                     if (notGroupDetail == null)
                     {
                         return WebResponseContent.Instance.Error($"璇ョ墿鏂欏湪璇ュ叆搴撳崟涓凡鍏ㄩ儴缁勭洏瀹屾垚");
                     }
-                    detailKeys.Add(notGroupDetail.Id);
                     Dt_StockInfoDetail stockInfoDetail = new Dt_StockInfoDetail()
                     {
                         BatchNo = model.LotNo,
@@ -662,8 +660,11 @@
 
                     stockInfoDetails.Add(stockInfoDetail);
 
-                    notGroupDetail.ReceiptQuantity = model.Quantity;
-                    notGroupDetail.OrderDetailStatus = OrderDetailStatusEnum.GroupAndInbound.ObjToInt();
+                    notGroupDetail.ReceiptQuantity += model.Quantity;
+                    if (notGroupDetail.OrderDetailStatus == OrderDetailStatusEnum.New.ObjToInt())
+                    {
+                        notGroupDetail.OrderDetailStatus = OrderDetailStatusEnum.GroupAndInbound.ObjToInt();
+                    }
                 }
 
                 float totalQuantity = stockInfo.Details.Sum(x => x.StockQuantity);

--
Gitblit v1.9.3