From 9f225bb1f1e26d25c1652d3e1ec2a8f239f69615 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期二, 18 三月 2025 10:41:29 +0800
Subject: [PATCH] 1

---
 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs |   50 ++++++++++++++++----------------------------------
 1 files changed, 16 insertions(+), 34 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs"
index 0a2d4fa..c01c72a 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs"
@@ -83,7 +83,7 @@
             List<Dt_OutStockLockInfo>? outStockLockInfos = null;
             List<Dt_LocationInfo>? locationInfos = null;
             List<Dt_LocationInfo>? locationInfos1 = null;
-            Dt_OutboundOrder outboundOrder = null;
+            Dt_OutboundOrder? outboundOrder = null;
 
             (List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?, Dt_OutboundOrder?) result = _outboundService.OutboundOrderDetailService.AssignStockOutbound(outboundOrderDetails);
             if (result.Item1 != null && result.Item1.Count > 0)
@@ -111,7 +111,7 @@
         /// </summary>
         /// <param name="stockInfos"></param>
         /// <returns></returns>
-        public (List<Dt_Task>, List<Dt_LocationInfo>, List<Dt_StockInfo>) GetTasks(List<Dt_StockInfo> stockInfos, TaskTypeEnum taskType, List<Dt_LocationInfo> locationInfos)
+        public (List<Dt_Task>?, List<Dt_LocationInfo>?, List<Dt_StockInfo>?) GetTasks(List<Dt_StockInfo> stockInfos, TaskTypeEnum taskType, List<Dt_LocationInfo>? locationInfos)
         {
             List<Dt_Task> tasks = new List<Dt_Task>();
             List<Dt_LocationInfo> locations = new List<Dt_LocationInfo>();
@@ -211,45 +211,27 @@
             List<Dt_Task> tasks = new List<Dt_Task>();
             Dt_OutboundOrderDetail outboundOrderDetail = _outboundService.OutboundOrderDetailService.Repository.QueryFirst(x => x.Id == orderDetailId);
 
-            if (outboundOrderDetail == null)
-            {
-                throw new Exception("鏈壘鍒板嚭搴撳崟鏄庣粏淇℃伅");
-            }
+            if (outboundOrderDetail == null) throw new Exception("鏈壘鍒板嚭搴撳崟鏄庣粏淇℃伅");
+            if (outboundOrderDetail.OrderDetailStatus != OrderDetailStatusEnum.New.ObjToInt())
+                throw new Exception("鎵�閫夊嚭搴撳崟鏄庣粏瀛樺湪鍑哄簱涓垨宸插畬鎴�");
+
+            Dt_OutboundOrder outboundOrder = _outboundService.OutboundOrderService.Repository.QueryFirst(x => x.Id == outboundOrderDetail.OrderId);
+            outboundOrder.Details = new List<Dt_OutboundOrderDetail> { outboundOrderDetail };
 
             List<Dt_StockInfo>? stockInfos = null;
             Dt_OutboundOrderDetail? orderDetail = null;
             List<Dt_OutStockLockInfo>? outStockLockInfos = null;
             List<Dt_LocationInfo>? locationInfos = null;
-            if (outboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.New.ObjToInt())
-            {
-                (List<Dt_StockInfo>, Dt_OutboundOrderDetail, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.OutboundOrderDetailService.AssignStockOutbound(outboundOrderDetail, stockSelectViews);
-                if (result.Item1 != null && result.Item1.Count > 0)
-                {
-                    tasks = GetTasks(result.Item1);
-                    result.Item2.OrderDetailStatus = OrderDetailStatusEnum.Outbound.ObjToInt();
-                    result.Item3.ForEach(x =>
-                    {
-                        x.Status = OutStockStatus.鍑哄簱涓�.ObjToInt();
-                    });
+            List<Dt_LocationInfo>? locationInfos1 = null;
 
-                    stockInfos = result.Item1;
-                    orderDetail = result.Item2;
-                    outStockLockInfos = result.Item3;
-                    locationInfos = result.Item4;
-                }
-                else
-                {
-                    throw new Exception("鏃犲簱瀛�");
-                }
-            }
-            else if (outboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.AssignOverPartial.ObjToInt() || outboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.AssignOver.ObjToInt())
+            (List<Dt_StockInfo>,  List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.OutboundOrderDetailService.AssignStockOutbound(outboundOrder, stockSelectViews);
+            if (result.Item1 != null && result.Item1.Count > 0)
             {
-                List<Dt_OutStockLockInfo> stockLockInfos = _outboundService.OutboundStockLockInfoService.GetByOrderDetailId(outboundOrderDetail.Id);
-                if (stockLockInfos != null && stockLockInfos.Count > 0)
-                {
-                    List<Dt_StockInfo> stocks = _stockService.StockInfoService.Repository.GetStockInfosByPalletCodes(stockLockInfos.Select(x => x.PalletCode).Distinct().ToList());
-                    tasks = GetTasks(stocks);
-                }
+                
+            }
+            else
+            {
+                throw new Exception("鏃犲簱瀛�");
             }
 
             return (tasks, stockInfos, orderDetail == null ? null : new List<Dt_OutboundOrderDetail> { orderDetail }, outStockLockInfos, locationInfos);

--
Gitblit v1.9.3