From b7796f5e4d6594976ea948905af769eca863f27c Mon Sep 17 00:00:00 2001
From: helongyang <647556386@qq.com>
Date: 星期一, 07 七月 2025 15:28:15 +0800
Subject: [PATCH] 代码更新

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/MesOutboundOrderService.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_OutboundService/MesOutboundOrderService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/MesOutboundOrderService.cs"
index d1a47ae..42aba4b 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/MesOutboundOrderService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/MesOutboundOrderService.cs"
@@ -60,18 +60,19 @@
             float originalNeedQuantity = mesOutboundOrder.OrderQuantity;
 
             float needQuantity = originalNeedQuantity;
-
+            //鑾峰彇搴撳瓨
             List<Dt_StockInfo> stockInfos = _stockService.StockInfoService.GetUseableStocks(mesOutboundOrder.MaterialCode, "", mesOutboundOrder.WarehouseId);
             if (!stockInfos.Any())
             {
                 throw new Exception($"鏈壘鍒板彲鍒嗛厤搴撳瓨");
             }
             List<Dt_StockInfo> autoAssignStocks = _stockService.StockInfoService.GetOutboundStocks(stockInfos, mesOutboundOrder.MaterialCode, needQuantity, out float residueQuantity);
-            mesOutboundOrder.LockQuantity += needQuantity - residueQuantity;
+            if (residueQuantity>0)
+            {
+                throw new Exception($"搴撳瓨涓嶈冻");
+            }
+            autoAssignStocks.OrderBy(x => x.Details.FirstOrDefault()?.StockQuantity).ToList();
             outStocks.AddRange(autoAssignStocks);
-            float assignQuantity = needQuantity - residueQuantity;
-
-            float orderQuantity = mesOutboundOrder.OrderQuantity;
             for (int j = 0; j < autoAssignStocks.Count; j++)
             {
                 float detailAssignQuantity = outStockLockInfos.Where(x => x.MaterielCode == mesOutboundOrder.MaterialCode).Sum(x => x.AssignQuantity);//鍑哄簱璁㈠崟鏄庣粏宸插垎閰嶆暟閲�

--
Gitblit v1.9.3