From 0aed9c9ee65bd8a17837d83ec05e756d11fab297 Mon Sep 17 00:00:00 2001
From: xiazhengtongxue <133085197+xiazhengtongxue@users.noreply.github.com>
Date: 星期二, 21 四月 2026 15:29:48 +0800
Subject: [PATCH] Merge branch 'dev' of http://115.159.85.185:8098/r/SuZhouGuanHong/ShanMeiXinNengYuan into dev

---
 Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Inbound.cs |   75 ++++++++++++++++++-------------------
 1 files changed, 36 insertions(+), 39 deletions(-)

diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Inbound.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Inbound.cs
index 20956e7..4cbd519 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Inbound.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Inbound.cs
@@ -1,6 +1,4 @@
-using Microsoft.AspNetCore.Http.HttpResults;
 using Newtonsoft.Json;
-using System.Diagnostics;
 using WIDESEA_Common.Constants;
 using WIDESEA_Common.LocationEnum;
 using WIDESEA_Common.StockEnum;
@@ -122,7 +120,6 @@
         /// </summary>
         public async Task<WebResponseContent> InboundFinishTaskAsync(CreateTaskDto taskDto)
         {
-            var stopwatch = Stopwatch.StartNew();
             try
             {
                 var task = await BaseDal.QueryFirstAsync(s => s.PalletCode == taskDto.PalletCode);
@@ -153,8 +150,6 @@
                 }
                 else
                 {
-
-
                     // 鍒ゆ柇鏄笉鏄瀬鍗峰簱浠诲姟
                     if (taskDto.WarehouseId == (int)WarehouseEnum.FJ1 || taskDto.WarehouseId == (int)WarehouseEnum.ZJ1)
                     {
@@ -179,41 +174,43 @@
                             return WebResponseContent.Instance.Error("浠诲姟瀹屾垚澶辫触");
 
                         // 鏍规嵁搴撳瓨Remark閫夋嫨闈欑疆璁惧锛屾煡MES鍔ㄦ�佸嚟璇�
-                        //string deviceName = stockInfo.Remark == "GW_1" ? "楂樻俯闈欑疆1"
-                        //    : stockInfo.Remark == "GW_2" ? "楂樻俯闈欑疆2"
-                        //    : "甯告俯闈欑疆1";
-                        //var mesConfig = _mesDeviceConfigService.GetByDeviceName(deviceName);
-                        //string equipmentCode = mesConfig?.EquipmentCode ?? StockConstants.MES_EQUIPMENT_CODE;
-                        //string resourceCode = mesConfig?.ResourceCode ?? StockConstants.MES_RESOURCE_CODE;
-                        //string token = mesConfig?.Token;
+                        string deviceName = stockInfo.Remark == "GW_1" ? "楂樻俯闈欑疆1"
+                            : stockInfo.Remark == "GW_2" ? "楂樻俯闈欑疆2"
+                            : "甯告俯闈欑疆1";
+                        var mesConfig = _mesDeviceConfigService.GetByDeviceName(deviceName);
+                        string equipmentCode = mesConfig?.EquipmentCode ?? StockConstants.MES_EQUIPMENT_CODE;
+                        string resourceCode = mesConfig?.ResourceCode ?? StockConstants.MES_RESOURCE_CODE;
+                        string token = mesConfig?.Token;
 
-                        // 璋冪敤MES鎵樼洏杩涚珯
-                        //var inboundRequest = new InboundInContainerRequest
-                        //{
-                        //    EquipmentCode = equipmentCode,
-                        //    ResourceCode = resourceCode,
-                        //    LocalTime = DateTime.Now,
-                        //    ContainerCode = taskDto.PalletCode
-                        //};
-                        //string requestJson = inboundRequest.ToJson();
-                        //var inboundResult = string.IsNullOrWhiteSpace(token)
-                        //    ? _mesService.InboundInContainer(inboundRequest)
-                        //    : _mesService.InboundInContainer(inboundRequest, token);
-                        //stopwatch.Stop();
-                        //await _mesLogService.LogAsync(new MesApiLogDto
-                        //{
-                        //    ApiType = "InboundInContainer",
-                        //    RequestJson = requestJson,
-                        //    ResponseJson = JsonConvert.SerializeObject(inboundResult),
-                        //    IsSuccess = inboundResult.IsSuccess,
-                        //    ErrorMessage = inboundResult.ErrorMessage,
-                        //    ElapsedMs = (int)stopwatch.ElapsedMilliseconds,
-                        //    Creator = "systeam"
-                        //});
-                        //if (inboundResult == null || inboundResult.Data == null || !inboundResult.Data.IsSuccess)
-                        //{
-                        //    return content.Error($"浠诲姟瀹屾垚澶辫触锛歁ES杩涚珯澶辫触: {inboundResult?.Data?.Msg ?? inboundResult?.ErrorMessage ?? "鏈煡閿欒"}");
-                        //}
+                        // 寮傛璋冪敤MES鎵樼洏杩涚珯锛屼笉闃诲涓婚�昏緫
+                        var inboundRequest = new InboundInContainerRequest
+                        {
+                            EquipmentCode = equipmentCode,
+                            ResourceCode = resourceCode,
+                            LocalTime = DateTime.Now,
+                            ContainerCode = taskDto.PalletCode
+                        };
+                        string requestJson = inboundRequest.ToJson();
+                        var palletCode = taskDto.PalletCode;
+
+                        _mesUploadHelper.FireAndForget(
+                            palletCode,
+                            MesUploadStatusEnum.杩涚珯涓婁紶鎴愬姛,
+                            "InboundInContainer",
+                            requestJson,
+                            () =>
+                            {
+                                var result = string.IsNullOrWhiteSpace(token)
+                                    ? _mesService.InboundInContainer(inboundRequest)
+                                    : _mesService.InboundInContainer(inboundRequest, token);
+                                return (
+                                    result?.Data?.IsSuccess ?? false,
+                                    JsonConvert.SerializeObject(result),
+                                    result?.Data?.Msg ?? result?.ErrorMessage ?? "鏈煡閿欒",
+                                    _mesService.BuildConfig(token ?? string.Empty).ToJson()
+                                );
+                            });
+
                         return await CompleteTaskAsync(task, "鍏ュ簱瀹屾垚");
                     });
                 }

--
Gitblit v1.9.3