From 7ddfdc009d19186a6084f16612de9cef14030b9a Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期一, 30 三月 2026 11:34:23 +0800
Subject: [PATCH] feat(TaskService): 新增OutboundFinishTaskTrayAsync空托盘出库完成方法

---
 Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs |   41 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
index 82545f8..528f1a9 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
@@ -469,6 +469,47 @@
         }
 
         /// <summary>
+        /// 绌烘墭鐩樺嚭搴撳畬鎴�
+        /// </summary>
+        public async Task<WebResponseContent> OutboundFinishTaskTrayAsync(CreateTaskDto taskDto)
+        {
+            try
+            {
+                var task = await BaseDal.QueryFirstAsync(s => s.PalletCode == taskDto.PalletCode);
+                if (task == null) return WebResponseContent.Instance.Error("鏈壘鍒板搴旂殑浠诲姟");
+
+                var location = await _locationInfoService.GetLocationInfo(task.Roadway, task.SourceAddress);
+                if (location == null) return WebResponseContent.Instance.Error("鏈壘鍒板搴旂殑璐т綅");
+
+                var stockInfo = await _stockInfoService.GetStockInfoAsync(taskDto.PalletCode);
+                if (stockInfo == null) return WebResponseContent.Instance.Error("鏈壘鍒板搴斿簱瀛樹俊鎭�");
+
+                return await ExecuteWithinTransactionAsync(async () =>
+                {
+                    stockInfo.LocationId = 0;
+                    stockInfo.LocationCode = null;
+                    stockInfo.StockStatus = StockStatusEmun.鍑哄簱瀹屾垚.GetHashCode();
+
+                    location.LocationStatus = LocationStatusEnum.Free.GetHashCode();
+
+                    var updateLocationResult = await _locationInfoService.UpdateLocationInfoAsync(location);
+                    var updateStockResult = await _stockInfoService.UpdateStockAsync(stockInfo);
+                    if (!updateLocationResult || !updateStockResult)
+                        return WebResponseContent.Instance.Error("浠诲姟瀹屾垚澶辫触");
+
+                    var deleteResult = await BaseDal.DeleteDataAsync(task);
+                    if (!deleteResult) return WebResponseContent.Instance.Error("浠诲姟瀹屾垚澶辫触");
+
+                    return WebResponseContent.Instance.OK("浠诲姟瀹屾垚");
+                });
+            }
+            catch (Exception ex)
+            {
+                return WebResponseContent.Instance.Error($"瀹屾垚浠诲姟澶辫触: {ex.Message}");
+            }
+        }
+
+        /// <summary>
         /// 淇敼浠诲姟鐘舵�侊紙鏍规嵁浠诲姟ID淇敼涓烘寚瀹氱姸鎬侊級
         /// </summary>
         /// <param name="taskId"></param>

--
Gitblit v1.9.3