From 733c975cd8647f6d006736f1863bad731e32e6fb Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期日, 26 十月 2025 17:15:52 +0800
Subject: [PATCH] 上传最新代码,ERP接口,MES接口优化,WMS业务优化等

---
 项目代码/WMS/WMSServices/WIDESEA_OutboundService/OutSGOrderDetailService.cs |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_OutboundService/OutSGOrderDetailService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_OutboundService/OutSGOrderDetailService.cs"
index 374b95b..571ca18 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_OutboundService/OutSGOrderDetailService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_OutboundService/OutSGOrderDetailService.cs"
@@ -73,7 +73,7 @@
             {
                 decimal needQuantity = item.XqLen;
                 //鑾峰彇鍙敤搴撳瓨
-                List<Dt_StockInfo> stockInfos = _stockService.StockInfoService.GetUseableStocks(item.MaterialNo, item.Width, outBSTOrders.FirstOrDefault().WarehouseId);
+                List<Dt_StockInfo> stockInfos = _stockService.StockInfoService.GetUseableStocks(item.MaterialNo, item.Width, outBSTOrders.FirstOrDefault().WarehouseId).Where(x=>!outStocks.Select(x=>x.PalletCode).Contains(x.PalletCode)).ToList();
                 if (!stockInfos.Any())
                 {
                     throw new Exception($"鏈壘鍒板彲鍒嗛厤搴撳瓨");
@@ -118,7 +118,11 @@
                             Dt_OutStockLockInfo outStockLockInfo = _outStockLockInfoService.GetOutStockLockInfo(sGOrder, details[i], autoAssignStocks[0], orderDetailNeedQuantity);
                             outStockLockInfos.Add(outStockLockInfo);
                             details[i].AssignTotalUsage = orderQuantity;
-                            autoAssignStocks[0].StockOutLength-= orderDetailNeedQuantity;
+                            autoAssignStocks[0].StockOutLength+= orderDetailNeedQuantity;
+                            if (autoAssignStocks[0].StockOutLength== autoAssignStocks[0].StockLength)
+                            {
+                                autoAssignStocks.Remove(autoAssignStocks[0]);
+                            }
                             assignStop =false;
                         }
                     }

--
Gitblit v1.9.3