From e0dabde622e384c2dc5849f65acab82d0b8a0adb Mon Sep 17 00:00:00 2001 From: hutongqing <hutongqing@hnkhzn.com> Date: 星期三, 16 十月 2024 14:43:51 +0800 Subject: [PATCH] 新增堆垛机封装类 --- WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/QuartzExtensions/QuartzJobHostedService.cs | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/QuartzExtensions/QuartzJobHostedService.cs b/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/QuartzExtensions/QuartzJobHostedService.cs index b554eeb..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 -- Gitblit v1.9.3