From fcdbb4d6cc8eb3629b871a4945ff2da599d64107 Mon Sep 17 00:00:00 2001
From: pan <antony1029@163.com>
Date: 星期六, 29 十一月 2025 17:51:43 +0800
Subject: [PATCH] 提交

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs"
index d68097a..0cf697c 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs"
@@ -637,7 +637,7 @@
         /// <summary>
         /// 鍒嗘壒鍒嗛厤搴撳瓨
         /// </summary>
-        public async Task<WebResponseContent> BatchAllocateStock(string orderNo, int orderDetailId, decimal batchQuantity, string outStation)
+        public async Task<WebResponseContent> GenerateOutboundBatchTasksAsync(int orderDetailId, decimal batchQuantity, string outStation) 
         {
             try
             {
@@ -647,7 +647,7 @@
                 List<Dt_OutStockLockInfo> outStockLockInfos = new List<Dt_OutStockLockInfo>();
                 List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>();
 
-                (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) result = await BatchAllocateStockDataHandle(orderNo, orderDetailId, batchQuantity, outStation);
+                (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) result = await BatchAllocateStockDataHandle(orderDetailId, batchQuantity, outStation);
 
                 if (result.Item2 != null && result.Item2.Count > 0)
                 {
@@ -676,7 +676,7 @@
             catch (Exception ex)
             {
                 _unitOfWorkManage.RollbackTran();
-                _logger.LogError($"鍒嗘壒鍒嗛厤搴撳瓨澶辫触 - OrderNo: {orderNo}, OrderDetailId: {orderDetailId}, Quantity: {batchQuantity}, Error: {ex.Message}");
+                _logger.LogError($"鍒嗘壒鍒嗛厤搴撳瓨澶辫触 -  OrderDetailId: {orderDetailId}, Quantity: {batchQuantity}, Error: {ex.Message}");
                 return WebResponseContent.Instance.Error($"鍒嗘壒鍒嗛厤澶辫触锛歿ex.Message}");
             }
         }
@@ -685,7 +685,7 @@
         /// 鍒嗘壒鍒嗛厤搴撳瓨鏁版嵁澶勭悊
         /// </summary>
         public async Task<(List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?)>
-            BatchAllocateStockDataHandle(string orderNo, int orderDetailId, decimal batchQuantity, string outStation)
+            BatchAllocateStockDataHandle( int orderDetailId, decimal batchQuantity, string outStation)
         {
             List<Dt_Task> tasks = new List<Dt_Task>();
 
@@ -697,7 +697,11 @@
             {
                 throw new Exception("鏈壘鍒板嚭搴撳崟鏄庣粏淇℃伅");
             }
-
+            var  outboundOrder = await _outboundOrderService.Db.Queryable<Dt_OutboundOrder>().FirstAsync(x => x.Id == outboundOrderDetail.OrderId);
+            if(outboundOrder == null)
+            {
+                throw new Exception("鏈壘鍒板嚭搴撳崟淇℃伅");
+            }
             // 楠岃瘉璁㈠崟鏄庣粏鐘舵��
             if (outboundOrderDetail.OrderDetailStatus > OrderDetailStatusEnum.New.ObjToInt() &&
                 outboundOrderDetail.OrderDetailStatus != OrderDetailStatusEnum.AssignOverPartial.ObjToInt())
@@ -732,9 +736,8 @@
             if (allocateResult.Item1 != null && allocateResult.Item1.Count > 0)
             {
                 // 鍒涘缓鍒嗘壒璁板綍
-                await CreateBatchRecord(orderNo, orderDetailId, batchQuantity, batchNo);
-
-                Dt_OutboundOrder outboundOrder = await _outboundOrderService.Repository.QueryFirstAsync(x => x.Id == outboundOrderDetail.OrderId);
+                await CreateBatchRecord(outboundOrder.OrderNo, orderDetailId, batchQuantity, batchNo);
+ 
                 TaskTypeEnum typeEnum = outboundOrder.OrderType switch
                 {
                     (int)OutOrderTypeEnum.Issue => TaskTypeEnum.Outbound,

--
Gitblit v1.9.3