From d21995836f488e6e438321e825182176b1f52cfa Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期二, 18 十一月 2025 11:12:10 +0800
Subject: [PATCH] 删除杂文件

---
 项目代码/WMS/WMSServices/WIDESEA_OutboundService/OutSGOrderDetailService.cs |   11 +++++++----
 1 files changed, 7 insertions(+), 4 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 571ca18..eb116ca 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"
@@ -76,10 +76,10 @@
                 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($"鏈壘鍒板彲鍒嗛厤搴撳瓨");
+                    continue;
                 }
                 //鍒嗛厤瀹為檯搴撳瓨
-                List<Dt_StockInfo> autoAssignStocks = _stockService.StockInfoService.GetOutboundStocks(stockInfos, needQuantity).OrderBy(x => x.StockLength - x.StockOutLength).ToList();
+                List<Dt_StockInfo> autoAssignStocks = _stockService.StockInfoService.GetOutOldStocks(stockInfos, needQuantity).ToList();
                 //娣诲姞搴撳瓨鍒嗛厤
                 outStocks.AddRange(autoAssignStocks);
                 //鑾峰彇鎵�鏈夎鐗╂枡鍗曟嵁
@@ -100,17 +100,20 @@
 
                         decimal orderDetailNeedQuantity = details[i].XqLen - detailAssignQuantity;
 
+                        if (autoAssignStocks.Count==0)
+                        {
+                            break;
+                        }
+
                         decimal useStockLength = autoAssignStocks[0].StockLength- autoAssignStocks[0].StockOutLength;
                         Dt_OutSGOrder? sGOrder = outBSTOrders.FirstOrDefault(x => x.Id == details[i].OutSGOrderId);
                         if (orderDetailNeedQuantity > useStockLength)
                         {
-                             
                             //鐢熸垚璇︽儏
                             Dt_OutStockLockInfo outStockLockInfo = _outStockLockInfoService.GetOutStockLockInfo(sGOrder, details[i], autoAssignStocks[0], useStockLength);
                             outStockLockInfos.Add(outStockLockInfo);
                             details[i].AssignTotalUsage += useStockLength;
                             autoAssignStocks.Remove(autoAssignStocks[0]);
-
                         }
                         else
                         {

--
Gitblit v1.9.3