From a29bf360f42cc3c6942a0ef6604f0ac84ab54a7c Mon Sep 17 00:00:00 2001
From: liulijun <liulijun@hnkhzn.com>
Date: 星期四, 19 三月 2026 17:19:36 +0800
Subject: [PATCH] 修复老厂排程在没生成任务就不更新缺料状态的问题,按照要求修改库位平面图

---
 项目代码/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Outbound.cs |   34 +++++++++++++++++++++++++---------
 1 files changed, 25 insertions(+), 9 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Outbound.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Outbound.cs"
index adae872..3c8e22f 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Outbound.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Outbound.cs"
@@ -1,4 +1,4 @@
-锘�
+
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -59,6 +59,10 @@
                 {
                     return content.Error($"鐢熸垚浠诲姟澶辫触");
                 }
+                tasks.ForEach(x =>
+                {
+                    x.Grade = 99;
+                });
                 stockInfos.ForEach(x =>
                 {
                     x.StockStatus = StockStatusEmun.鍑哄簱閿佸畾.ObjToInt();
@@ -679,7 +683,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_OutSGOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) result = OutSGTaskDataHandle(keys);
+                (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutSGOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?,string) result = OutSGTaskDataHandle(keys);
                 if (result.Item2 != null && result.Item2.Count > 0)
                 {
                     stockInfos.AddRange(result.Item2);
@@ -700,8 +704,9 @@
                 {
                     tasks.AddRange(result.Item1);
                 }
+                content.Message = result.Item6;
                 //澶勭悊鍑哄簱鏁版嵁
-                return GenerateOutboundTaskDataUpdate(tasks, stockInfos, outSGOrderDetails, outStockLockInfos, locationInfos);
+                return GenerateOutboundTaskDataUpdate(tasks, stockInfos, outSGOrderDetails, outStockLockInfos, locationInfos, result.Item6);
             }
             catch (Exception ex)
             {
@@ -717,7 +722,7 @@
         /// <param name="stockSelectViews"></param>
         /// <returns></returns>
         /// <exception cref="Exception"></exception>
-        public (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutSGOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) OutSGTaskDataHandle(int[] keys)
+        public (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutSGOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?,string) OutSGTaskDataHandle(int[] keys)
         {
             List<Dt_Task> tasks = new List<Dt_Task>();
             List<Dt_OutSGOrderDetail> outSGOrderDetails = _outboundRepository.OutSGOrderDetailRepository.QueryData(x => keys.Contains(x.Id));
@@ -737,7 +742,15 @@
             List<Dt_LocationInfo>? locationInfos = null;
 
             //鍒嗛厤搴撳瓨
-            (List<Dt_StockInfo>, List<Dt_OutSGOrderDetail>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.OutSGOrderDetailService.AssignStockOutbound(outSGOrderDetails);
+            (List<Dt_StockInfo>, List<Dt_OutSGOrderDetail>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>,string) result = _outboundService.OutSGOrderDetailService.AssignStockOutbound(outSGOrderDetails);
+            
+            //淇濆瓨缂烘枡鐘舵�侊紝鏃犺鏄惁鐢熸垚浜嗕换鍔�
+            var shortageDetails = result.Item2.Where(x => x.OutSGOrderDetailStatus == OutOrderStatusEnum.缂烘枡.ObjToInt()).ToList();
+            if (shortageDetails.Any())
+            {
+                _outboundRepository.OutSGOrderDetailRepository.UpdateData(shortageDetails);
+            }
+            
             if (result.Item1 != null && result.Item1.Count > 0)
             {
                 //鑾峰彇浠诲姟
@@ -768,16 +781,17 @@
             }
             else
             {
-                throw new Exception("鏃犲簱瀛�");
+                //娌℃湁搴撳瓨锛屼絾宸茬粡鍦ˋssignStockOutbound鏂规硶涓爣璁颁簡缂烘枡鐘舵�侊紝骞朵笖宸茬粡淇濆瓨
+                orderDetails = result.Item2;
             }
 
-            return (tasks, stockInfos, orderDetails, outStockLockInfos, locationInfos);
+            return (tasks, stockInfos, orderDetails, outStockLockInfos, locationInfos, result.Item5);
         }
         /// <summary>
         /// 澶勭悊鍑哄簱鏁版嵁
         /// </summary>
         /// <returns></returns>
-        public WebResponseContent GenerateOutboundTaskDataUpdate(List<Dt_Task> tasks, List<Dt_StockInfo>? stockInfos = null, List<Dt_OutSGOrderDetail>? outboundOrderDetails = null, List<Dt_OutStockLockInfo>? outStockLockInfos = null, List<Dt_LocationInfo>? locationInfos = null)
+        public WebResponseContent GenerateOutboundTaskDataUpdate(List<Dt_Task> tasks, List<Dt_StockInfo>? stockInfos = null, List<Dt_OutSGOrderDetail>? outboundOrderDetails = null, List<Dt_OutStockLockInfo>? outStockLockInfos = null, List<Dt_LocationInfo>? locationInfos = null, string message = "")
         {
             try
             {
@@ -817,7 +831,7 @@
                 }
                 _unitOfWorkManage.CommitTran();
                 PushTasksToWCS(tasks);
-                return WebResponseContent.Instance.OK();
+                return WebResponseContent.Instance.OK(message);
             }
             catch (Exception ex)
             {
@@ -893,11 +907,13 @@
                     }
                 }
                 #endregion
+                List<Dt_OutLineView> outLineViewsDel = _outboundRepository.OutLineViewRepository.QueryData(x => stockInfos.Select(x=>x.PalletCode).Contains(x.PalletCode));
                 _unitOfWorkManage.BeginTran();
                 _stockRepository.StockInfoRepository.UpdateData(stockInfos);
                 _outboundRepository.OutStockLockInfoRepository.UpdateData(outStockLockInfos);
                 _outboundRepository.OutSGOrderRepository.UpdateData(outSGOrders);
                 _outboundRepository.OutSGOrderDetailRepository.UpdateData(orderDetails);
+                _outboundRepository.OutLineViewRepository.DeleteData(outLineViewsDel);
                 _unitOfWorkManage.CommitTran();
                 content.OK(ExistNoCodes.Count>0 ? string.Join(",", ExistNoCodes)+"鑰佸巶鍙墸搴撳瓨涓嶅瓨鍦�" : "");
             }

--
Gitblit v1.9.3