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/StackerCraneJob/CommonStackerCraneJob.cs |   21 +++++++--------------
 1 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
index 8060907..e444092 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
@@ -174,8 +174,7 @@
                 if (!flag || value is not CommonStackerCrane commonStackerCrane)
                 {
                     // 鍙傛暟鏃犳晥锛岀洿鎺ヨ繑鍥�
-                    _logger.LogWarning("Execute锛氬弬鏁版棤鏁�");
-                    QuartzLogger.Warn("Execute锛氬弬鏁版棤鏁�", "CommonStackerCraneJob");
+                    QuartzLogHelper.LogWarn(_logger, "Execute锛氬弬鏁版棤鏁�", "Execute锛氬弬鏁版棤鏁�", "CommonStackerCraneJob");
                     return Task.CompletedTask;
                 }
 
@@ -186,8 +185,7 @@
                 {
                     // 缁戝畾浠诲姟瀹屾垚浜嬩欢澶勭悊鏂规硶
                     commonStackerCrane.StackerCraneTaskCompletedEventHandler += CommonStackerCrane_StackerCraneTaskCompletedEventHandler;
-                    _logger.LogInformation("Execute锛氳闃呬换鍔″畬鎴愪簨浠讹紝璁惧: {DeviceCode}", _deviceCode);
-                    QuartzLogger.Info($"璁㈤槄浠诲姟瀹屾垚浜嬩欢", _deviceCode);
+                    QuartzLogHelper.LogInfo(_logger, "Execute锛氳闃呬换鍔″畬鎴愪簨浠讹紝璁惧: {DeviceCode}", "璁㈤槄浠诲姟瀹屾垚浜嬩欢", _deviceCode, _deviceCode);
                 }
 
                 // ========== 妫�鏌ュ爢鍨涙満浠诲姟瀹屾垚鐘舵�� ==========
@@ -225,8 +223,7 @@
                 if (stackerCraneTaskCommand == null)
                 {
                     // 鍛戒护鏋勫缓澶辫触
-                    _logger.LogWarning("Execute锛氬懡浠ゆ瀯寤哄け璐ワ紝璁惧: {DeviceCode}锛屼换鍔″彿: {TaskNum}", _deviceCode, task.TaskNum);
-                    QuartzLogger.Warn($"鍛戒护鏋勫缓澶辫触锛屼换鍔″彿: {task.TaskNum}", _deviceCode);
+                    QuartzLogHelper.LogWarn(_logger, "Execute锛氬懡浠ゆ瀯寤哄け璐ワ紝璁惧: {DeviceCode}锛屼换鍔″彿: {TaskNum}", $"鍛戒护鏋勫缓澶辫触锛屼换鍔″彿: {task.TaskNum}", _deviceCode, _deviceCode, task.TaskNum);
                     return Task.CompletedTask;
                 }
 
@@ -240,20 +237,17 @@
                     commonStackerCrane.LastTaskType = task.TaskType;
                     _taskService.UpdateTaskStatusToNext(task.TaskNum);
 
-                    _logger.LogInformation("Execute锛氬懡浠ゅ彂閫佹垚鍔燂紝璁惧: {DeviceCode}锛屼换鍔″彿: {TaskNum}", _deviceCode, task.TaskNum);
-                    QuartzLogger.Info($"鍛戒护鍙戦�佹垚鍔燂紝浠诲姟鍙�: {task.TaskNum}", _deviceCode);
+                    QuartzLogHelper.LogInfo(_logger, "Execute锛氬懡浠ゅ彂閫佹垚鍔燂紝璁惧: {DeviceCode}锛屼换鍔″彿: {TaskNum}", $"鍛戒护鍙戦�佹垚鍔燂紝浠诲姟鍙�: {task.TaskNum}", _deviceCode, _deviceCode, task.TaskNum);
                 }
                 else
                 {
-                    _logger.LogError("Execute锛氬懡浠ゅ彂閫佸け璐ワ紝璁惧: {DeviceCode}锛屼换鍔″彿: {TaskNum}", _deviceCode, task.TaskNum);
-                    QuartzLogger.Error($"鍛戒护鍙戦�佸け璐�", _deviceCode);
+                    QuartzLogHelper.LogError(_logger, "Execute锛氬懡浠ゅ彂閫佸け璐ワ紝璁惧: {DeviceCode}锛屼换鍔″彿: {TaskNum}", $"鍛戒护鍙戦�佸け璐�", _deviceCode, _deviceCode, task.TaskNum);
                 }
             }
             catch (Exception ex)
             {
                 // 璁板綍寮傚父
-                _logger.LogError(ex, "Execute锛氭墽琛屽紓甯革紝璁惧: {DeviceCode}", _deviceCode);
-                QuartzLogger.Error($"鎵ц寮傚父: {ex.Message}", _deviceCode, ex);
+                QuartzLogHelper.LogError(_logger, ex, "Execute锛氭墽琛屽紓甯革紝璁惧: {DeviceCode}", $"鎵ц寮傚父: {ex.Message}", _deviceCode, _deviceCode);
             }
 
             return Task.CompletedTask;
@@ -277,8 +271,7 @@
             if (stackerCrane != null)
             {
                 // 璁板綍鏃ュ織
-                _logger.LogInformation("CommonStackerCrane_StackerCraneTaskCompletedEventHandler锛氫换鍔″畬鎴愶紝浠诲姟鍙�: {TaskNum}", e.TaskNum);
-                QuartzLogger.Info($"浠诲姟瀹屾垚锛屼换鍔″彿: {e.TaskNum}", stackerCrane.DeviceCode);
+                QuartzLogHelper.LogInfo(_logger, "CommonStackerCrane_StackerCraneTaskCompletedEventHandler锛氫换鍔″畬鎴愶紝浠诲姟鍙�: {TaskNum}", $"浠诲姟瀹屾垚锛屼换鍔″彿: {e.TaskNum}", stackerCrane.DeviceCode, e.TaskNum);
 
                 // 鏇存柊浠诲姟鐘舵�佷负瀹屾垚
                 if (_taskService.StackCraneTaskCompleted(e.TaskNum).Status)

--
Gitblit v1.9.3