From 569e91c63636345391f741df049c9374a141a434 Mon Sep 17 00:00:00 2001
From: hutongqing <hutongqing@hnkhzn.com>
Date: 星期一, 26 八月 2024 08:57:33 +0800
Subject: [PATCH] 添加路由新建配置,重新导出种子数据

---
 WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/QuartzExtensions/QuartzJobHostedService.cs |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/QuartzExtensions/QuartzJobHostedService.cs b/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/QuartzExtensions/QuartzJobHostedService.cs
index da1ef7a..82b3d71 100644
--- a/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/QuartzExtensions/QuartzJobHostedService.cs
+++ b/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/QuartzExtensions/QuartzJobHostedService.cs
@@ -15,6 +15,7 @@
  *----------------------------------------------------------------*/
 #endregion << 鐗� 鏈� 娉� 閲� >>
 
+using Microsoft.AspNetCore.Mvc;
 using Microsoft.Extensions.Hosting;
 using Microsoft.Extensions.Logging;
 using System;
@@ -24,6 +25,7 @@
 using System.Text;
 using System.Threading.Tasks;
 using WIDESEAWCS_Core;
+using WIDESEAWCS_Core.Helper;
 using WIDESEAWCS_QuartzJob.DeviceBase;
 using WIDESEAWCS_QuartzJob.DTO;
 using WIDESEAWCS_QuartzJob.Models;
@@ -62,13 +64,14 @@
 
                 deviceInfos.ForEach(x =>
                 {
-                    if(dispatches.Exists(d=>d.JobGroup == x.DeviceType))
+                    if (dispatches.Exists(d => d.JobGroup == x.DeviceType))
                     {
                         #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 });
-                        type.InvokeMember("Connect", BindingFlags.Default | BindingFlags.InvokeMethod, null, obj, new object[] { });
+                        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 + "杩炴帴澶辫触");
 
                         #endregion
 
@@ -105,6 +108,7 @@
                     DeviceInfoDTO? deviceProInfo = deviceInfos.FirstOrDefault(x => x.DeviceType == dispatches[i].JobGroup);
                     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 + "璋冨害鏈嶅姟娣诲姞澶辫触");
                 }
                 await _schedulerCenter.StartScheduleAsync();
             }

--
Gitblit v1.9.3