| | |
| | | /// <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("暂不支持除西门子之外的PLC"); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /// <summary> |