From d85a4b97325020b7efe1a6cdbd55025c6408cec9 Mon Sep 17 00:00:00 2001 From: hutongqing <hutongqing@hnkhzn.com> Date: 星期五, 25 十月 2024 10:12:06 +0800 Subject: [PATCH] 更新 --- WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/ConveyorLine/CommonConveyorLine.cs | 19 +++++++++++++------ 1 files changed, 13 insertions(+), 6 deletions(-) diff --git a/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/ConveyorLine/CommonConveyorLine.cs b/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/ConveyorLine/CommonConveyorLine.cs index 7aa2adf..b2b90aa 100644 --- a/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/ConveyorLine/CommonConveyorLine.cs +++ b/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/ConveyorLine/CommonConveyorLine.cs @@ -186,17 +186,24 @@ /// <exception cref="Exception"></exception> public bool SendCommand<T>(T command, string deviceChildCode) where T : IDataTransfer, new() { - if (!IsConnected) throw new Exception($"閫氳杩炴帴閿欒锛岃妫�鏌ョ綉缁�"); - DeviceProDTO? devicePro = _deviceProDTOs.Where(x => x.DeviceProParamType == nameof(DeviceCommand) && x.DeviceChildCode == deviceChildCode).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) && x.DeviceChildCode == deviceChildCode).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); + if (devicePro == null) + { + return false; + } + if (Communicator.WriteCustomer(devicePro.DeviceProAddress, command)) + { + return true; + } return false; } - if (Communicator.WriteCustomer(devicePro.DeviceProAddress, command)) + else { - return true; + throw new Exception("鏆備笉鏀寔闄よタ闂ㄥ瓙涔嬪鐨凱LC"); } - return false; } /// <summary> -- Gitblit v1.9.3