From 2f75b4c0a67ccc3a443e7cc4f2f0f909defd9a92 Mon Sep 17 00:00:00 2001 From: hutongqing <hutongqing@hnkhzn.com> Date: 星期五, 01 十一月 2024 09:49:23 +0800 Subject: [PATCH] 版本更新 --- WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/ConveyorLine/CommonConveyorLine.cs | 28 +++++++++++++--------------- 1 files changed, 13 insertions(+), 15 deletions(-) diff --git a/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/ConveyorLine/CommonConveyorLine.cs b/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/ConveyorLine/CommonConveyorLine.cs index 7aa2adf..28b40e2 100644 --- a/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/ConveyorLine/CommonConveyorLine.cs +++ b/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/ConveyorLine/CommonConveyorLine.cs @@ -91,19 +91,10 @@ public string DeviceName => _deviceName; /// <summary> - /// 鏄惁鏈夋晠闅� - /// </summary> - public bool IsFault => false; - - /// <summary> /// 閫氳鏄惁宸茶繛鎺� /// </summary> public bool IsConnected => Communicator.IsConnected && _isConnected; - /// <summary> - /// 璁惧鐘舵�� - /// </summary> - public DeviceStatus Status => DeviceStatus.Offline; #endregion #region Constructor Function @@ -186,17 +177,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