From c6f6be2d942214580e61c2647c846d7e11e06f48 Mon Sep 17 00:00:00 2001
From: yangpeixing <yangpeixing@hnkhzn.com>
Date: 星期一, 19 一月 2026 15:42:11 +0800
Subject: [PATCH] 1

---
 WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/OutboundOrderDetailService.cs |   33 +++++++++++++++++++++++++++------
 1 files changed, 27 insertions(+), 6 deletions(-)

diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/OutboundOrderDetailService.cs b/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/OutboundOrderDetailService.cs
index a60e0fb..493c5f0 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/OutboundOrderDetailService.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/OutboundOrderDetailService.cs
@@ -355,11 +355,21 @@
                 {
                     throw new Exception($"鏈壘鍒板彲鍒嗛厤搴撳瓨");
                 }
-                List<Dt_StockInfo> autoAssignStocks = _stockService.StockInfoService.GetOutboundStocks(stockInfos, item.MaterielCode, needQuantity, out decimal residueQuantity);
-
-                item.LockQuantity += needQuantity - residueQuantity;
+                List<Dt_StockInfo> autoAssignStocks = new List<Dt_StockInfo>();
+                decimal newResidueQuantity = 0; 
+                if (warehouse.Any(x => x.WarehouseCode.Contains("DW")) || warehouse.Any(x => x.WarehouseCode.Contains("YS")))
+                {
+                    autoAssignStocks = _stockService.StockInfoService.DWANDYSGetOutboundStocks(stockInfos, item.MaterielCode, item.BatchNo, needQuantity,out decimal residueQuantity);
+                    newResidueQuantity = residueQuantity;   
+                }
+                else
+                {
+                    autoAssignStocks = _stockService.StockInfoService.GetOutboundStocks(stockInfos, item.MaterielCode, needQuantity, out decimal residueQuantity);
+                    newResidueQuantity = residueQuantity;
+                }
+                item.LockQuantity += needQuantity - newResidueQuantity;
                 outStocks.AddRange(autoAssignStocks);
-                decimal assignQuantity = needQuantity - residueQuantity;
+                decimal assignQuantity = needQuantity - newResidueQuantity;
 
                 List<Dt_OutboundOrderDetail> details = outboundOrderDetails.Where(x => !string.IsNullOrEmpty(x.BatchNo) ? x.BatchNo == item.BatchNo : true && x.MaterielCode == item.MaterielCode).ToList();
 
@@ -375,7 +385,17 @@
                         {
                             palletAssignQuantity = outStockLockInfos.Where(x => x.MaterielCode == item.MaterielCode && x.PalletCode == autoAssignStocks[j].PalletCode).Sum(x => x.AssignQuantity);//鍑哄簱璇︽儏宸插垎閰嶆暟閲�
                         }
-                        decimal palletOutboundQuantity = autoAssignStocks[j].Details.Sum(x => x.OutboundQuantity);
+                        decimal palletOutboundQuantity = 0;
+                        if (warehouse.Any(x => x.WarehouseCode.Contains("DW")) || warehouse.Any(x => x.WarehouseCode.Contains("YS")))
+                        {
+                            palletOutboundQuantity = autoAssignStocks[j].Details.Where(x => x.BatchNo == item.BatchNo).Sum(x => x.OutboundQuantity);
+
+                        }
+                        else
+                        {
+                             palletOutboundQuantity = autoAssignStocks[j].Details.Sum(x => x.OutboundQuantity);
+
+                        }
                         if (palletAssignQuantity < palletOutboundQuantity)//濡傛灉鍑哄簱璇︽儏宸插垎閰嶆暟閲忓皬浜庢墭鐩樺凡鍒嗛厤鏁伴噺锛屽垯鍙互缁х画娣诲姞璇ユ墭鐩樺嚭搴撲俊鎭�
                         {
                             decimal orderDetailNeedQuantity = details[i].OrderQuantity - detailAssignQuantity;
@@ -506,7 +526,8 @@
                     using (client = new HttpClient())
                     {
                         // 2. 鍙戦�佽姹�
-                        var response = HttpHelper.Post<WebResponseContent>(ToCancelOutFeedbackERP, postContent, "鍑哄簱鏄庣粏鍙栨秷鍥炰紶ERP");
+                        string url = $"{ToCancelOutFeedbackERP}?ids={Uri.EscapeDataString(ids)}";
+                        var response = HttpHelper.Post<WebResponseContent>(url, "鍑哄簱鏄庣粏鍙栨秷鍥炰紶ERP");
 
                         if (response.Code !=0)
                         {

--
Gitblit v1.9.3