From 75ef0dfecf2331c0828a1a182b1d3243d3041c51 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期二, 21 四月 2026 13:19:44 +0800
Subject: [PATCH] refactor: 统一日志组件为Serilog并优化相关功能
---
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineTargetAddressSelector.cs | 20 ++++++--------------
1 files changed, 6 insertions(+), 14 deletions(-)
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineTargetAddressSelector.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineTargetAddressSelector.cs
index c4ecdf4..1fd2000 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineTargetAddressSelector.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineTargetAddressSelector.cs
@@ -1,5 +1,4 @@
-using Microsoft.Extensions.Logging;
-using WIDESEAWCS_Core.LogHelper;
+using Serilog;
using WIDESEAWCS_QuartzJob;
namespace WIDESEAWCS_Tasks
@@ -276,7 +275,7 @@
if (device == null)
{
// 璁惧鏈壘鍒版椂璁板綍璋冭瘯鏃ュ織锛屾柟渚挎帓鏌ラ厤缃棶棰�
- _logger.LogDebug("FindDevice锛氭湭鎵惧埌 {DeviceName}", deviceName);
+ _logger.Debug("FindDevice锛氭湭鎵惧埌 {DeviceName}", deviceName);
}
return device; // 鍙兘涓� null锛岀敱璋冪敤鏂硅礋璐� null 妫�鏌�
}
@@ -418,10 +417,7 @@
string deviceType)
{
// 璁板綍褰撳墠璇锋眰鐘舵�佺殑璋冭瘯鏃ュ織锛屼緵鎺掓煡闂浣跨敤
- _logger.LogDebug("ProcessDeviceRequest锛歿DeviceType}锛屽瓙璁惧: {ChildDeviceCode}锛岀墿鏂欒姹�: {MaterialReq}锛屽嚭鏂欒姹�: {OutputReq}",
- deviceType, childDeviceCode, materialRequest, outputRequest);
- // 鍚屾鍐欏叆 Quartz 鏃ュ織鏂囦欢锛堝弻鍐欏彲杩芥函锛岃繖閲屼繚鐣欎笌鍘熼�昏緫涓�鑷寸殑琛屼负锛�
- QuartzLogger.Debug($"ProcessDeviceRequest锛歿deviceType}锛屽瓙璁惧: {childDeviceCode}锛岀墿鏂欒姹�: {materialRequest}锛屽嚭鏂欒姹�: {outputRequest}", conveyorLine.DeviceCode);
+ QuartzLogHelper.LogDebug(_logger, "ProcessDeviceRequest锛歿DeviceType}锛屽瓙璁惧: {ChildDeviceCode}锛岀墿鏂欒姹�: {MaterialReq}锛屽嚭鏂欒姹�: {OutputReq}", $"ProcessDeviceRequest锛歿deviceType}锛屽瓙璁惧: {childDeviceCode}锛岀墿鏂欒姹�: {materialRequest}锛屽嚭鏂欒姹�: {outputRequest}", conveyorLine.DeviceCode, deviceType, childDeviceCode, materialRequest, outputRequest);
// 鍒嗘敮鍒ゆ柇锛氳澶囨槸闇�瑕佺墿鏂欒繕鏄渶瑕佸嚭鏂�
if (materialRequest)
@@ -432,8 +428,7 @@
// 2. 鍥炲 ACK 纭淇″彿锛屽憡鐭ヨ澶囧凡鏀跺埌璇锋眰
conveyorLine.SetValue(ConveyorLineDBNameNew.WCS_ACK, 1, childDeviceCode);
// 3. 璁板綍淇℃伅鏃ュ織锛岃〃鏄庡凡瀹屾垚鐩爣鍦板潃璁剧疆鍜� ACK 鍥炲
- _logger.LogInformation("ProcessDeviceRequest锛歿DeviceType} 闇�瑕佺墿鏂欙紝宸茶缃洰鏍囧湴鍧�鍜孉CK", deviceType);
- QuartzLogger.Info($"ProcessDeviceRequest锛歿deviceType} 闇�瑕佺墿鏂欙紝宸茶缃洰鏍囧湴鍧�鍜孉CK", conveyorLine.DeviceCode);
+ QuartzLogHelper.LogInfo(_logger, "ProcessDeviceRequest锛歿DeviceType} 闇�瑕佺墿鏂欙紝宸茶缃洰鏍囧湴鍧�鍜孉CK", $"ProcessDeviceRequest锛歿deviceType} 闇�瑕佺墿鏂欙紝宸茶缃洰鏍囧湴鍧�鍜孉CK", conveyorLine.DeviceCode, deviceType);
}
else
{
@@ -457,10 +452,7 @@
private void WriteDebug(CommonConveyorLine conveyorLine, string scenario, string childDeviceCode, string nextAddress)
{
// 鍐欏叆缁撴瀯鍖栨棩蹇楋紙鍙 Serilog 绛夋棩蹇楁鏋舵崟鑾凤級
- _logger.LogDebug("Handle{Scenario}锛氬瓙璁惧: {ChildDeviceCode}锛岀洰鏍囧湴鍧�: {NextAddress}",
- scenario, childDeviceCode, nextAddress);
- // 鍐欏叆 Quartz 涓撶敤鏃ュ織鏂囦欢锛堜緵瀹氭椂浠诲姟杞ㄨ抗杩借釜锛�
- QuartzLogger.Debug($"Handle{scenario}锛氬瓙璁惧: {childDeviceCode}锛岀洰鏍囧湴鍧�: {nextAddress}", conveyorLine.DeviceCode);
+ QuartzLogHelper.LogDebug(_logger, "Handle{Scenario}锛氬瓙璁惧: {ChildDeviceCode}锛岀洰鏍囧湴鍧�: {NextAddress}", $"Handle{scenario}锛氬瓙璁惧: {childDeviceCode}锛岀洰鏍囧湴鍧�: {nextAddress}", conveyorLine.DeviceCode, scenario, childDeviceCode, nextAddress);
}
}
-}
+}
\ No newline at end of file
--
Gitblit v1.9.3