From 0d07b90fd906e52ce486484aa53a6850983b1325 Mon Sep 17 00:00:00 2001
From: hutongqing <hutongqing@hnkhzn.com>
Date: 星期二, 15 十月 2024 14:21:57 +0800
Subject: [PATCH] 更新

---
 WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/QuartzExtensions/QuartzJobHostedService.cs |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/QuartzExtensions/QuartzJobHostedService.cs b/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/QuartzExtensions/QuartzJobHostedService.cs
index 82b3d71..ee00077 100644
--- a/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/QuartzExtensions/QuartzJobHostedService.cs
+++ b/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/QuartzExtensions/QuartzJobHostedService.cs
@@ -68,10 +68,10 @@
                     {
                         #region 杩炴帴PLC
                         Assembly assembly = Assembly.Load($"WIDESEAWCS_Communicator");
-                        Type type = assembly.GetType($"WIDESEAWCS_Communicator.{x.DevicePlcType}");
-                        object obj = Activator.CreateInstance(type, new object[] { x.DeviceIp, x.DevicePort, x.DeviceName });
-                        bool connectResult = (bool)type.InvokeMember("Connect", BindingFlags.Default | BindingFlags.InvokeMethod, null, obj, new object[] { });
-                        if (connectResult) ConsoleHelper.WriteSuccessLine(x.DeviceCode + "杩炴帴鎴愬姛"); else ConsoleHelper.WriteErrorLine(x.DeviceCode + "杩炴帴澶辫触");
+                        Type? type = assembly.GetType($"WIDESEAWCS_Communicator.{x.DevicePlcType}");
+                        object? obj = Activator.CreateInstance(type, new object[] { x.DeviceIp, x.DevicePort, x.DeviceName });
+                        bool? connectResult = (bool)type.InvokeMember("Connect", BindingFlags.Default | BindingFlags.InvokeMethod, null, obj, new object[] { });
+                        if (connectResult ?? false) ConsoleHelper.WriteSuccessLine(x.DeviceCode + "杩炴帴鎴愬姛"); else ConsoleHelper.WriteErrorLine(x.DeviceCode + "杩炴帴澶辫触");
 
                         #endregion
 
@@ -105,7 +105,7 @@
                 });
                 for (int i = 0; i < dispatches.Count; i++)
                 {
-                    DeviceInfoDTO? deviceProInfo = deviceInfos.FirstOrDefault(x => x.DeviceType == dispatches[i].JobGroup);
+                    DeviceInfoDTO? deviceProInfo = deviceInfos.FirstOrDefault(x => x.Id == dispatches[i].Id);
                     dispatches[i].JobParams = deviceProInfo?.Device;
                     WebResponseContent responseContent = await _schedulerCenter.AddScheduleJobAsync(dispatches[i]);
                     if (responseContent.Status) ConsoleHelper.WriteSuccessLine(dispatches[i].JobGroup + "璋冨害鏈嶅姟娣诲姞鎴愬姛"); else ConsoleHelper.WriteErrorLine(dispatches[i].JobGroup + "璋冨害鏈嶅姟娣诲姞澶辫触");

--
Gitblit v1.9.3