From c5c3e4e538a11f2a6391e6b2613375b1f92eb20a Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期三, 15 四月 2026 14:39:18 +0800
Subject: [PATCH] feat: 添加Quartz日志助手类并重构任务服务日志记录
---
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/CommonConveyorLineNewJob.cs | 22 ++++++----------------
1 files changed, 6 insertions(+), 16 deletions(-)
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/CommonConveyorLineNewJob.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/CommonConveyorLineNewJob.cs
index e9c6ad5..edbdda4 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/CommonConveyorLineNewJob.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/CommonConveyorLineNewJob.cs
@@ -133,8 +133,7 @@
if (childDeviceCodes == null || childDeviceCodes.Count == 0)
{
// 娌℃湁瀛愯澶囷紝鐩存帴杩斿洖
- _logger.LogInformation("杈撻�佺嚎 {DeviceCode} 娌℃湁瀛愯澶�", conveyorLine.DeviceCode);
- QuartzLogger.Info($"杈撻�佺嚎 {conveyorLine.DeviceCode} 娌℃湁瀛愯澶�", conveyorLine.DeviceCode);
+ QuartzLogHelper.LogInfo(_logger, "杈撻�佺嚎 {DeviceCode} 娌℃湁瀛愯澶�", $"杈撻�佺嚎 {conveyorLine.DeviceCode} 娌℃湁瀛愯澶�", conveyorLine.DeviceCode, conveyorLine.DeviceCode);
return Task.CompletedTask;
}
@@ -162,8 +161,6 @@
// 濡傛灉鍛戒护涓虹┖锛岃烦杩�
if (command == null)
{
- _logger.LogDebug("Execute锛氬瓙璁惧 {ChildDeviceCode} 鍛戒护涓虹┖锛岃烦杩�", childDeviceCode);
- QuartzLogger.Debug($"瀛愯澶� {childDeviceCode} 鍛戒护涓虹┖锛岃烦杩�", conveyorLine.DeviceCode);
continue;
}
@@ -186,8 +183,7 @@
{
// 娌℃湁浠诲姟锛屽悜 WMS 璇锋眰鍑哄簱鎵樼洏浠诲姟
var position = checkPalletPositions.FirstOrDefault(x => x.Code == childDeviceCode);
- _logger.LogInformation("Execute锛氭鏌ユ墭鐩樹綅缃� {ChildDeviceCode}锛岃姹俉MS鍑哄簱鎵樼洏浠诲姟", childDeviceCode);
- QuartzLogger.Info($"妫�鏌ユ墭鐩樹綅缃� {childDeviceCode}锛岃姹俉MS鍑哄簱鎵樼洏浠诲姟", conveyorLine.DeviceCode);
+ QuartzLogHelper.LogInfo(_logger, "Execute锛氭鏌ユ墭鐩樹綅缃� {ChildDeviceCode}锛岃姹俉MS鍑哄簱鎵樼洏浠诲姟", $"妫�鏌ユ墭鐩樹綅缃� {childDeviceCode}锛岃姹俉MS鍑哄簱鎵樼洏浠诲姟", conveyorLine.DeviceCode, childDeviceCode);
var responseResult = _httpClientHelper.Post<WebResponseContent>("GetOutBoundTrayTaskAsync", new CreateTaskDto()
{
@@ -229,8 +225,7 @@
}
catch (Exception ex)
{
- _logger.LogError(ex, "澶勭悊鎵嬪姩鍏ュ簱浠诲姟寮傚父");
- QuartzLogger.Error($"澶勭悊鎵嬪姩鍏ュ簱浠诲姟寮傚父: {ex.Message}", "CommonConveyorLineNewJob", ex);
+ QuartzLogHelper.LogError(_logger, ex, "澶勭悊鎵嬪姩鍏ュ簱浠诲姟寮傚父", $"澶勭悊鎵嬪姩鍏ュ簱浠诲姟寮傚父: {ex.Message}", "CommonConveyorLineNewJob");
}
continue;
}
@@ -239,8 +234,6 @@
// 鏃犳墭鐩樻潯鐮佹椂锛岃姹傚嚭搴撲换鍔�
if (command.Barcode.IsNullOrEmpty() || command.Barcode.Replace("\0", "") == "")
{
- _logger.LogDebug("Execute锛氬瓙璁惧 {ChildDeviceCode} 鏃犳墭鐩樻潯鐮侊紝璇锋眰鍑哄簱浠诲姟", childDeviceCode);
- QuartzLogger.Debug($"瀛愯澶� {childDeviceCode} 鏃犳墭鐩樻潯鐮侊紝璇锋眰鍑哄簱浠诲姟", conveyorLine.DeviceCode);
_conveyorLineDispatch.RequestOutbound(conveyorLine, command, childDeviceCode);
continue;
}
@@ -252,8 +245,7 @@
Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNo, childDeviceCode);
if (!task.IsNullOrEmpty())
{
- _logger.LogInformation("Execute锛氬瓙璁惧 {ChildDeviceCode} 澶勭悊浠诲姟 {TaskNum}锛岀姸鎬�: {Status}", childDeviceCode, task.TaskNum, task.TaskStatus);
- QuartzLogger.Info($"澶勭悊浠诲姟 {task.TaskNum}锛岀姸鎬�: {task.TaskStatus}", conveyorLine.DeviceCode);
+ QuartzLogHelper.LogInfo(_logger, "Execute锛氬瓙璁惧 {ChildDeviceCode} 澶勭悊浠诲姟 {TaskNum}锛岀姸鎬�: {Status}", $"澶勭悊浠诲姟 {task.TaskNum}锛岀姸鎬�: {task.TaskStatus}", conveyorLine.DeviceCode, childDeviceCode, task.TaskNum, task.TaskStatus);
// 澶勭悊浠诲姟鐘舵�侊紙鏍规嵁鐘舵�佸垎鍙戝埌涓嶅悓鏂规硶锛�
ProcessTaskState(conveyorLine, command, task, childDeviceCode);
return Task.CompletedTask;
@@ -263,8 +255,7 @@
catch (Exception innerEx)
{
// 璁板綍寮傚父锛屼絾涓嶅奖鍝嶅叾浠栧瓙璁惧鐨勫鐞�
- _logger.LogError(innerEx, "Execute锛氬瓙璁惧 {ChildDeviceCode} 澶勭悊寮傚父锛孋orrelationId: {CorrelationId}", childDeviceCode, correlationId);
- QuartzLogger.Error($"瀛愯澶囧鐞嗗紓甯�: {innerEx.Message}", conveyorLine.DeviceCode, innerEx);
+ QuartzLogHelper.LogError(_logger, innerEx, "Execute锛氬瓙璁惧 {ChildDeviceCode} 澶勭悊寮傚父锛孋orrelationId: {CorrelationId}", $"瀛愯澶囧鐞嗗紓甯�: {innerEx.Message}", conveyorLine.DeviceCode, childDeviceCode, correlationId);
}
}
}
@@ -272,8 +263,7 @@
catch (Exception ex)
{
// 璁板綍鏁翠綋寮傚父
- _logger.LogError(ex, "Execute锛氳緭閫佺嚎 {DeviceCode} 鎵ц寮傚父", ex.Message);
- QuartzLogger.Error($"杈撻�佺嚎鎵ц寮傚父: {ex.Message}", "CommonConveyorLineNewJob", ex);
+ QuartzLogHelper.LogError(_logger, ex, "Execute锛氳緭閫佺嚎 {DeviceCode} 鎵ц寮傚父", $"杈撻�佺嚎鎵ц寮傚父: {ex.Message}", "CommonConveyorLineNewJob", ex.Message);
}
return Task.CompletedTask;
}
--
Gitblit v1.9.3