From 96adc295cb04fd135d63d3a907f2732274f90965 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期二, 21 四月 2026 01:11:21 +0800
Subject: [PATCH] feat: 添加MES异步上传辅助服务并重构相关代码

---
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/QuartzNet/QuartzNetExtension.cs |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/QuartzNet/QuartzNetExtension.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/QuartzNet/QuartzNetExtension.cs
index 50b4e4e..9caa056 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/QuartzNet/QuartzNetExtension.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/QuartzNet/QuartzNetExtension.cs
@@ -3,6 +3,8 @@
 using WIDESEAWCS_Core;
 using WIDESEAWCS_Core.Caches;
 using WIDESEAWCS_Core.Helper;
+using WIDESEAWCS_Core.LogHelper;
+using WIDESEAWCS_Model.Models;
 using WIDESEAWCS_QuartzJob.DTO;
 using WIDESEAWCS_QuartzJob.Service;
 
@@ -48,7 +50,7 @@
 
                 deviceInfos.ForEach(x =>
                 {
-                    if (!Storage.Devices.Exists(d => d.DeviceCode == x.DeviceCode))
+                    if (!Storage.Devices.Any(d => d.DeviceCode == x.DeviceCode))
                     {
                         try
                         {
@@ -118,7 +120,7 @@
                         }
                         catch (Exception ex)
                         {
-                            Console.WriteLine("璋冨害鏈嶅姟寮�鍚紓甯�" + ex.ToString());
+                            QuartzLogger.Error($"璋冨害鏈嶅姟寮�鍚紓甯�", "QuartzNetExtension", ex);
                         }
                     }
                     else
@@ -141,13 +143,22 @@
                         _ => targetDevice.Device
                     };
                     WebResponseContent responseContent = await _schedulerCenter.AddScheduleJobAsync(dispatches[i]);
-                    if (responseContent.Status) ConsoleHelper.WriteSuccessLine(dispatches[i].Name + "璋冨害鏈嶅姟娣诲姞鎴愬姛"); else ConsoleHelper.WriteErrorLine(dispatches[i].Name + "璋冨害鏈嶅姟娣诲姞澶辫触");
+                    if (responseContent.Status)
+                    {
+                        QuartzLogger.Info($"{dispatches[i].Name}璋冨害鏈嶅姟娣诲姞鎴愬姛", "QuartzNetExtension");
+                        ConsoleHelper.WriteSuccessLine(dispatches[i].Name + "璋冨害鏈嶅姟娣诲姞鎴愬姛");
+                    }
+                    else
+                    {
+                        QuartzLogger.Error($"{dispatches[i].Name}璋冨害鏈嶅姟娣诲姞澶辫触", "QuartzNetExtension");
+                        ConsoleHelper.WriteErrorLine(dispatches[i].Name + "璋冨害鏈嶅姟娣诲姞澶辫触");
+                    }
                 }
                 //await _schedulerCenter.StartScheduleAsync();
             }
             catch (Exception ex)
             {
-                Console.WriteLine("璋冨害鏈嶅姟寮�鍚紓甯�" + ex.ToString());
+                QuartzLogger.Error($"璋冨害鏈嶅姟寮�鍚紓甯�", "QuartzNetExtension", ex);
                 throw;
             }
         }

--
Gitblit v1.9.3