From 85fdfa7d141e1a9d9fc170f636cfeac89f65c2b4 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期一, 30 三月 2026 11:00:59 +0800
Subject: [PATCH] feat(TaskService): InboundFinishTaskAsync添加MES进站调用

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

diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
index 81bbbf0..0464857 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
@@ -12,6 +12,7 @@
 using WIDESEA_Core.Core;
 using WIDESEA_Core.Helper;
 using WIDESEA_DTO.GradingMachine;
+using WIDESEA_DTO.MES;
 using WIDESEA_DTO.Stock;
 using WIDESEA_DTO.Task;
 using WIDESEA_IBasicService;
@@ -29,6 +30,7 @@
         private readonly HttpClientHelper _httpClientHelper;
         private readonly IConfiguration _configuration;
         private readonly RoundRobinService _roundRobinService;
+        private readonly IMesService _mesService;
 
         public IRepository<Dt_Task> Repository => BaseDal;
 
@@ -48,7 +50,8 @@
             ILocationInfoService locationInfoService,
             HttpClientHelper httpClientHelper,
             IConfiguration configuration,
-            RoundRobinService roundRobinService) : base(BaseDal)
+            RoundRobinService roundRobinService,
+            IMesService mesService) : base(BaseDal)
         {
             _mapper = mapper;
             _stockInfoService = stockInfoService;
@@ -56,6 +59,7 @@
             _httpClientHelper = httpClientHelper;
             _configuration = configuration;
             _roundRobinService = roundRobinService;
+            _mesService = mesService;
         }
 
         #region WCS閫昏緫澶勭悊
@@ -214,6 +218,7 @@
 
                 return await ExecuteWithinTransactionAsync(async () =>
                 {
+                    WebResponseContent content = new WebResponseContent();
                     stockInfo.LocationCode = location.LocationCode;
                     stockInfo.LocationId = location.Id;
                     stockInfo.OutboundDate = task.Roadway switch
@@ -230,6 +235,19 @@
                     var updateStockResult = await _stockInfoService.UpdateStockAsync(stockInfo);
                     if (!updateLocationResult || !updateStockResult)
                         return WebResponseContent.Instance.Error("浠诲姟瀹屾垚澶辫触");
+                    // 璋冪敤MES鎵樼洏杩涚珯
+                    var inboundRequest = new InboundInContainerRequest
+                    {
+                        EquipmentCode = "STK-GROUP-001",
+                        ResourceCode = "STK-GROUP-001",
+                        LocalTime = DateTime.Now,
+                        ContainerCode = taskDto.PalletCode
+                    };
+                    var inboundResult = _mesService.InboundInContainer(inboundRequest);
+                    if (inboundResult == null || inboundResult.Data == null || !inboundResult.Data.IsSuccess)
+                    {
+                        return content.Error($"浠诲姟瀹屾垚澶辫触锛歁ES杩涚珯澶辫触: {inboundResult?.Data?.Msg ?? inboundResult?.ErrorMessage ?? "鏈煡閿欒"}");
+                    }
                     return await CompleteTaskAsync(task);
                 });
             }

--
Gitblit v1.9.3