From fcf0f53de620c6f3c6218e59dbdeff01fda4eb3b Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期四, 23 四月 2026 08:38:07 +0800
Subject: [PATCH] fix: 修复WCS和WMS系统中的多个问题
---
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Flows/RelocationTaskFlowService.cs | 46 +++++++++++++++++++++++++++++++++-------------
1 files changed, 33 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 0556392..321df15 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>
@@ -91,7 +95,7 @@
return content.Error($"閫氱煡WMS绯荤粺鍫嗗灈鏈虹Щ搴撳畬鎴愬け璐�,浠诲姟鍙�:銆恵task.TaskNum}銆�,鎵樼洏鍙�:銆恵task.PalletCode}銆�,閿欒淇℃伅:銆恵result.Message}銆�");
}
- return content.Error($"閫氱煡WMS绯荤粺鍫嗗灈鏈虹Щ搴撳畬鎴愭垚鍔�,浠诲姟鍙�:銆恵task.TaskNum}銆�,鎵樼洏鍙�:銆恵task.PalletCode}銆�");
+ return content.OK($"閫氱煡WMS绯荤粺鍫嗗灈鏈虹Щ搴撳畬鎴愭垚鍔�,浠诲姟鍙�:銆恵task.TaskNum}銆�,鎵樼洏鍙�:銆恵task.PalletCode}銆�");
}
/// <summary>
@@ -101,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, NextAddress = task.NextAddress, CurrentAddress = task.CurrentAddress }.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();
}
@@ -118,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