From 0be9278cafe353fd47e069429709933d900e227b Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期二, 21 四月 2026 00:02:13 +0800
Subject: [PATCH] feat(stock): 新增组盘、拆盘按钮调用MES接口

---
 Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Outbound.cs |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Outbound.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Outbound.cs
index 499b063..cac934b 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Outbound.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Outbound.cs
@@ -1,9 +1,11 @@
+using System.Diagnostics;
 using WIDESEA_Common.Constants;
 using WIDESEA_Common.LocationEnum;
 using WIDESEA_Common.StockEnum;
 using WIDESEA_Common.TaskEnum;
 using WIDESEA_Common.WareHouseEnum;
 using WIDESEA_Core;
+using WIDESEA_Core.Helper;
 using WIDESEA_DTO.MES;
 using WIDESEA_DTO.Task;
 using WIDESEA_IBasicService;
@@ -58,6 +60,7 @@
         /// </summary>
         public async Task<WebResponseContent> OutboundFinishTaskAsync(CreateTaskDto taskDto)
         {
+            var stopwatch = Stopwatch.StartNew();
             try
             {
                 var task = await BaseDal.QueryFirstAsync(s => s.PalletCode == taskDto.PalletCode);
@@ -135,13 +138,15 @@
                         LocalTime = DateTime.Now,
                         ContainerCode = taskDto.PalletCode
                     };
-                    var outboundResult = string.IsNullOrWhiteSpace(token)
-                        ? _mesService.OutboundInContainer(outboundRequest)
-                        : _mesService.OutboundInContainer(outboundRequest, token);
-                    if (outboundResult == null || outboundResult.Data == null || !outboundResult.Data.IsSuccess)
+                    string palletCode = taskDto.PalletCode;
+
+                    // Fire-and-forget: 寮傛鎵цMES鍑虹珯锛屼笉闃诲涓讳笟鍔¢�昏緫
+                    _ = Task.Run(() => MesUploadAsync(palletCode, MesUploadStatusEnum.鍑虹珯涓婁紶鎴愬姛, async () =>
                     {
-                        return content.Error($"鍑哄簱瀹屾垚澶辫触锛歁ES鍑虹珯澶辫触: {outboundResult?.Data?.Msg ?? outboundResult?.ErrorMessage ?? "鏈煡閿欒"}");
-                    }
+                        return await Task.FromResult(string.IsNullOrWhiteSpace(token)
+                            ? _mesService.OutboundInContainer(outboundRequest)
+                            : _mesService.OutboundInContainer(outboundRequest, token));
+                    }));
 
                     var completeResult = await CompleteTaskAsync(task, "鍑哄簱瀹屾垚");
                     if (!completeResult.Status)

--
Gitblit v1.9.3