From 70233af5426b0d1c343ebe87183303a34a9aaa58 Mon Sep 17 00:00:00 2001 From: hutongqing <hutongqing@hnkhzn.com> Date: 星期三, 20 十一月 2024 09:05:38 +0800 Subject: [PATCH] WIDESEAWCS_QuartzJob更新版本 --- WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/OtherDevices/OtherDevice.cs | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/OtherDevices/OtherDevice.cs b/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/OtherDevices/OtherDevice.cs index 1daea08..ab69a34 100644 --- a/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/OtherDevices/OtherDevice.cs +++ b/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/OtherDevices/OtherDevice.cs @@ -141,26 +141,26 @@ GC.SuppressFinalize(this); } - public TRsult GetValue<TEnum, TRsult>(TEnum value) where TEnum : Enum + public TResult GetValue<TEnum, TResult>(TEnum value) where TEnum : Enum { if (!IsConnected) throw new Exception($"閫氳杩炴帴閿欒锛岃妫�鏌ョ綉缁�"); DeviceProDTO? devicePro = _deviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == value.ToString()); - return devicePro == null ? throw new Exception() : (TRsult)Communicator.ReadAsObj(devicePro.DeviceProAddress, devicePro.DeviceDataType); + return devicePro == null ? throw new Exception($"璇诲彇鏁版嵁閿欒,鏈湪鍗忚淇℃伅閲岄潰鎵惧埌鍙傛暟{value.ToString()}") : (TResult)Communicator.ReadAsObj(devicePro.DeviceProAddress, devicePro.DeviceDataType); } /// <summary> /// 璇诲彇PLC鍗忚鍦板潃鐨勬暟鎹� /// </summary> /// <typeparam name="TEnum">鍗忚淇℃伅鐨勬灇涓惧璞′俊鎭��</typeparam> - /// <typeparam name="TRsult">璇诲彇鏁版嵁鐨勭被鍨嬪璞′俊鎭��</typeparam> + /// <typeparam name="TResult">璇诲彇鏁版嵁鐨勭被鍨嬪璞′俊鎭��</typeparam> /// <param name="value">鏋氫妇鍊�</param> /// <param name="deviceChildCode">璁惧瀛愮紪鍙�</param> /// <returns>璇诲彇鍒扮殑鏁版嵁</returns> - public TRsult GetValue<TEnum, TRsult>(TEnum value, string deviceChildCode) where TEnum : Enum + public TResult GetValue<TEnum, TResult>(TEnum value, string deviceChildCode) where TEnum : Enum { if (!IsConnected) throw new Exception($"閫氳杩炴帴閿欒锛岃妫�鏌ョ綉缁�"); DeviceProDTO? devicePro = _deviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == value.ToString() && x.DeviceChildCode == deviceChildCode); - return devicePro == null ? throw new Exception() : (TRsult)Communicator.ReadAsObj(devicePro.DeviceProAddress, devicePro.DeviceDataType); + return devicePro == null ? throw new Exception() : (TResult)Communicator.ReadAsObj(devicePro.DeviceProAddress, devicePro.DeviceDataType); } public bool SetValue<TEnum, TValue>(TEnum @enum, TValue value) @@ -169,7 +169,7 @@ { if (!IsConnected) throw new Exception($"閫氳杩炴帴閿欒锛岃妫�鏌ョ綉缁�"); DeviceProDTO? devicePro = _deviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == @enum.ToString()); - return devicePro == null ? throw new Exception() : Communicator.WriteObj(devicePro.DeviceProAddress, devicePro.DeviceDataType, value); + return devicePro == null ? throw new Exception($"鍐欏叆鏁版嵁閿欒,鏈湪鍗忚淇℃伅閲岄潰鎵惧埌鍙傛暟{value.ToString()}") : Communicator.WriteObj(devicePro.DeviceProAddress, devicePro.DeviceDataType, value); } /// <summary> -- Gitblit v1.9.3