From d14030746fcd0310d3c9b028fe2c0a5b78984eb6 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期二, 21 四月 2026 19:44:16 +0800
Subject: [PATCH] Merge branch 'dev' of http://115.159.85.185:8098/r/SuZhouGuanHong/ShanMeiXinNengYuan into dev

---
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Flows/RelocationTaskFlowService.cs |   47 ++++++++++++++++++++++++++++++++++-------------
 1 files changed, 34 insertions(+), 13 deletions(-)

diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Flows/RelocationTaskFlowService.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Flows/RelocationTaskFlowService.cs
index 4a35391..3f74943 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Flows/RelocationTaskFlowService.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Flows/RelocationTaskFlowService.cs
@@ -1,4 +1,5 @@
 锘縰sing System.Diagnostics.CodeAnalysis;
+using Serilog;
 using WIDESEAWCS_Common.HttpEnum;
 using WIDESEAWCS_Common.TaskEnum;
 using WIDESEA_Core;
@@ -8,6 +9,7 @@
 using WIDESEAWCS_DTO.TaskInfo;
 using WIDESEAWCS_ITaskInfoService;
 using WIDESEAWCS_Model.Models;
+using WIDESEAWCS_Tasks;
 
 namespace WIDESEAWCS_TaskInfoService.Flows
 {
@@ -18,14 +20,16 @@
     public class RelocationTaskFlowService : IRelocationTaskFlowService
     {
         private readonly HttpClientHelper _httpClientHelper;
+        private readonly ILogger _logger;
 
         /// <summary>
         /// 鍒濆鍖栫Щ搴撲换鍔℃祦绋嬫湇鍔°��
         /// </summary>
         /// <param name="httpClientHelper">WMS鎺ュ彛璋冪敤甯姪绫汇��</param>
-        public RelocationTaskFlowService(HttpClientHelper httpClientHelper)
+        public RelocationTaskFlowService(HttpClientHelper httpClientHelper, ILogger logger)
         {
             _httpClientHelper = httpClientHelper;
+            _logger = logger;
         }
 
         /// <summary>
@@ -34,9 +38,10 @@
         /// </summary>
         /// <param name="task">浠诲姟瀹炰綋銆�</param>
         /// <param name="source">WMS浠诲姟鍘熷鏁版嵁銆�</param>
-        public void InitializeOnReceive([NotNull] Dt_Task task, [NotNull] WMSTaskDTO source)
+        public WebResponseContent InitializeOnReceive([NotNull] Dt_Task task, [NotNull] WMSTaskDTO source)
         {
             // 褰撳墠鐗堟湰绉诲簱浠诲姟鎺ユ敹鏃朵笉闇�瑕侀澶栬缃矾鐢辨垨鐘舵�併��
+            return WebResponseContent.Instance.OK();
         }
 
         /// <summary>
@@ -100,13 +105,21 @@
         /// <returns>鍚屾缁撴灉銆�</returns>
         private WebResponseContent UpdateWMSTaskStatus(Dt_Task task)
         {
+            string configKey = nameof(ConfigKey.UpdateTaskByStatus);
+            string requestParam = new UpdateTaskDto { Id = task.TaskNum, NewStatus = task.TaskStatus, NextAddress = task.NextAddress, CurrentAddress = task.CurrentAddress }.ToJson();
+            DateTime startTime = DateTime.Now;
+
             var result = _httpClientHelper.Post<WebResponseContent>(
-                nameof(ConfigKey.UpdateTaskByStatus),
-                new UpdateTaskDto { Id = task.TaskNum, NewStatus = task.TaskStatus }.ToJson());
+                configKey,
+                requestParam);
 
             if (!result.IsSuccess || !result.Data.Status)
+            {
+                QuartzLogHelper.LogError(_logger, $"璋冪敤WMS鎺ュ彛澶辫触,鎺ュ彛:銆恵configKey}銆�,璇锋眰鍙傛暟:銆恵requestParam}銆�,閿欒淇℃伅:銆恵result.Data?.Message}銆�", "RelocationTaskFlowService");
                 return WebResponseContent.Instance.Error($"璋冪敤WMS鎺ュ彛鏇存柊浠诲姟鐘舵�佸け璐�,浠诲姟鍙�:銆恵task.TaskNum}銆�,閿欒淇℃伅:銆恵result.Data?.Message}銆�");
+            }
 
+            QuartzLogHelper.LogInfo(_logger, $"璋冪敤WMS鎺ュ彛鎴愬姛,鎺ュ彛:銆恵configKey}銆�,鍝嶅簲鏁版嵁:銆恵result.Data?.Data}銆�,鑰楁椂:{(DateTime.Now - startTime).TotalMilliseconds}ms", "RelocationTaskFlowService");
             return WebResponseContent.Instance.OK();
         }
 
@@ -117,20 +130,28 @@
         /// <returns>閫氱煡缁撴灉銆�</returns>
         private WebResponseContent NotifyWMSRelocationFinish(Dt_Task task)
         {
+            string configKey = nameof(ConfigKey.RelocationFinishTask);
+            string requestParam = new CreateTaskDto
+            {
+                PalletCode = task.PalletCode,
+                SourceAddress = task.CurrentAddress,
+                TargetAddress = task.TargetAddress,
+                Roadway = task.Roadway,
+                TaskType = task.TaskType
+            }.ToJson();
+            DateTime startTime = DateTime.Now;
+
             var result = _httpClientHelper.Post<WebResponseContent>(
-                nameof(ConfigKey.RelocationFinishTask),
-                new CreateTaskDto
-                {
-                    PalletCode = task.PalletCode,
-                    SourceAddress = task.CurrentAddress,
-                    TargetAddress = task.TargetAddress,
-                    Roadway = task.Roadway,
-                    TaskType = task.TaskType
-                }.ToJson());
+                configKey,
+                requestParam);
 
             if (!result.IsSuccess || !result.Data.Status)
+            {
+                QuartzLogHelper.LogError(_logger, $"璋冪敤WMS鎺ュ彛澶辫触,鎺ュ彛:銆恵configKey}銆�,璇锋眰鍙傛暟:銆恵requestParam}銆�,閿欒淇℃伅:銆恵result.Data?.Message}銆�", "RelocationTaskFlowService");
                 return WebResponseContent.Instance.Error($"閫氱煡WMS绯荤粺绉诲簱瀹屾垚澶辫触,浠诲姟鍙�:銆恵task.TaskNum}銆�,鎵樼洏鍙�:銆恵task.PalletCode}銆�,閿欒淇℃伅:銆恵result.Data?.Message}銆�");
+            }
 
+            QuartzLogHelper.LogInfo(_logger, $"璋冪敤WMS鎺ュ彛鎴愬姛,鎺ュ彛:銆恵configKey}銆�,鍝嶅簲鏁版嵁:銆恵result.Data?.Data}銆�,鑰楁椂:{(DateTime.Now - startTime).TotalMilliseconds}ms", "RelocationTaskFlowService");
             return WebResponseContent.Instance.OK();
         }
     }

--
Gitblit v1.9.3