From ea0628889f64f802768c4fdf17d2223424e5e29f Mon Sep 17 00:00:00 2001 From: hutongqing <hutongqing@hnkhzn.com> Date: 星期三, 30 十月 2024 11:13:22 +0800 Subject: [PATCH] 1 --- WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/StackerCrane/Common/CommonStackerCrane.cs | 23 +++++++++++++++-------- 1 files changed, 15 insertions(+), 8 deletions(-) diff --git a/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/StackerCrane/Common/CommonStackerCrane.cs b/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/StackerCrane/Common/CommonStackerCrane.cs index c1f1ae4..55dde71 100644 --- a/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/StackerCrane/Common/CommonStackerCrane.cs +++ b/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/StackerCrane/Common/CommonStackerCrane.cs @@ -352,19 +352,26 @@ /// <returns></returns> public bool SendCommand<T>(T command) where T : IDataTransfer, new() { - if (!IsConnected) throw new Exception($"閫氳杩炴帴閿欒锛岃妫�鏌ョ綉缁�"); - DeviceProDTO? devicePro = _deviceProDTOs.Where(x => x.DeviceProParamType == nameof(DeviceCommand)).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); - if (devicePro == null) + if(Communicator is SiemensS7) { + if (!IsConnected) throw new Exception($"閫氳杩炴帴閿欒锛岃妫�鏌ョ綉缁�"); + DeviceProDTO? devicePro = _deviceProDTOs.Where(x => x.DeviceProParamType == nameof(DeviceCommand)).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); + if (devicePro == null) + { + return false; + } + if (Communicator.WriteCustomer(devicePro.DeviceProAddress, command)) + { + StackerCraneTaskCommand = command; + CheckStackerCraneTaskCompleted(); + return true; + } return false; } - if (Communicator.WriteCustomer(devicePro.DeviceProAddress, command)) + else { - StackerCraneTaskCommand = command; - CheckStackerCraneTaskCompleted(); - return true; + throw new Exception("鏆備笉鏀寔闄よタ闂ㄥ瓙涔嬪鐨凱LC"); } - return false; } /// <summary> -- Gitblit v1.9.3