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/StackerCrane/Spec/SpeStackerCrane.cs | 83 +---------------------------------------- 1 files changed, 3 insertions(+), 80 deletions(-) diff --git a/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/StackerCrane/Spec/SpeStackerCrane.cs b/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/StackerCrane/Spec/SpeStackerCrane.cs index d70e398..49abede 100644 --- a/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/StackerCrane/Spec/SpeStackerCrane.cs +++ b/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/StackerCrane/Spec/SpeStackerCrane.cs @@ -17,10 +17,7 @@ /// <summary> /// 鑷畾涔夊爢鍨涙満 /// </summary> - /// <typeparam name="T1">鍫嗗灈鏈虹姸鎬�1娉涘瀷</typeparam> - /// <typeparam name="T2">鍫嗗灈鏈虹姸鎬�2娉涘瀷</typeparam> - /// <typeparam name="T3">鍫嗗灈鏈虹姸鎬�3娉涘瀷</typeparam> - [Description("鍫嗗灈鏈�")] + [Description("鍫嗗灈鏈�2")] public class SpeStackerCrane : IStackerCrane { #region Private Member @@ -73,16 +70,7 @@ public string DeviceName => _deviceName; - public bool IsFault => throw new NotImplementedException(); - public bool IsConnected => Communicator.IsConnected && _isConnected; - - public DeviceStatus Status => throw new NotImplementedException(); - - /// <summary> - /// 鏃犵敤 - /// </summary> - public event EventHandler<StackerCraneTaskCompletedEventArgs> StackerCraneTaskCompletedEventHandler; public object StackerCraneTaskCommand { get; set; } #endregion @@ -137,7 +125,7 @@ private int GetCurrentTaskNum() { DeviceProDTO? devicePro = _deviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == nameof(CurrentTaskNum)); - return devicePro == null ? throw new Exception() : (int)Communicator.ReadAsObj(devicePro.DeviceProAddress, devicePro.DeviceDataType); + return devicePro == null ? throw new Exception($"璇诲彇褰撳墠浠诲姟鍙烽敊璇�,鏈幏鍙栧埌鍗忚淇℃伅,璇锋鏌ラ厤缃弬鏁板悕绉版槸鍚﹂厤缃�,涓旈厤缃负涓簕nameof(CurrentTaskNum)}") : (int)Communicator.ReadAsObj(devicePro.DeviceProAddress, devicePro.DeviceDataType); } private void CheckConnect() @@ -193,7 +181,7 @@ public bool SendCommand<T>(T command) where T : IDataTransfer, new() { - if(Communicator is SiemensS7) + if (Communicator is SiemensS7) { if (!IsConnected) throw new Exception($"閫氳杩炴帴閿欒锛岃妫�鏌ョ綉缁�"); DeviceProDTO? devicePro = _deviceProDTOs.Where(x => x.DeviceProParamType == nameof(DeviceCommand)).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); @@ -213,71 +201,6 @@ { throw new Exception("鏆備笉鏀寔闄よタ闂ㄥ瓙涔嬪鐨凱LC"); } - } - - /// <summary> - /// 鐩戞祴鍫嗗灈鏈轰换鍔℃槸鍚﹀畬鎴�(闃叉浠诲姟瀹屾垚浜嬩欢鐩戞祴瓒呮椂锛屽畾涔夋墜鍔ㄨЕ鍙戝姛鑳�) - /// </summary> - void CheckStackerCraneTaskCompleted() - { - if (_isChecked) - return; - - Task.Run(() => - { - _isChecked = true; - try - { - DeviceProDTO? devicePro = _deviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == nameof(StackerCraneWorkStatus)); - if (devicePro != null) - { - DeviceProtocolDetailDTO? deviceProtocolDetail = _deviceProtocolDetailDTOs.FirstOrDefault(x => x.DeviceProParamName == devicePro.DeviceProParamName && x.ProtocolDetailType == StackerCraneWorkStatus.WorkCompleted.ToString()); - if (deviceProtocolDetail != null) - { - OperateResult<TimeSpan> operateResult = new OperateResult<TimeSpan>(); - TypeCode typeCode = SiemensDBDataType.GetTypeCode(devicePro.DeviceDataType); - switch (typeCode) - { - case TypeCode.Boolean: - operateResult = Communicator.Wait(devicePro.DeviceProAddress, 500, 10 * 6000, Convert.ToBoolean(deviceProtocolDetail.ProtocalDetailValue)); - break; - case TypeCode.Byte: - operateResult = Communicator.Wait(devicePro.DeviceProAddress, 500, 10 * 6000, Convert.ToByte(deviceProtocolDetail.ProtocalDetailValue)); - break; - case TypeCode.Int16: - operateResult = Communicator.Wait(devicePro.DeviceProAddress, 500, 10 * 6000, Convert.ToInt16(deviceProtocolDetail.ProtocalDetailValue)); - break; - case TypeCode.Int32: - operateResult = Communicator.Wait(devicePro.DeviceProAddress, 500, 10 * 6000, Convert.ToInt32(deviceProtocolDetail.ProtocalDetailValue)); - break; - case TypeCode.UInt16: - operateResult = Communicator.Wait(devicePro.DeviceProAddress, 500, 10 * 6000, Convert.ToUInt16(deviceProtocolDetail.ProtocalDetailValue)); - break; - case TypeCode.UInt32: - operateResult = Communicator.Wait(devicePro.DeviceProAddress, 500, 10 * 6000, Convert.ToUInt32(deviceProtocolDetail.ProtocalDetailValue)); - break; - default: - break; - } - int taskNum = CurrentTaskNum; - if (operateResult.IsSuccess /*&& LastTaskNum != taskNum*/) - { - StackerCraneTaskCompletedEventArgs args = new(taskNum); - StackerCraneTaskCompletedEventHandler?.Invoke(this, args); - _lastTaskNum = taskNum; - } - } - } - } - catch (Exception ex) - { - - } - finally - { - _isChecked = false; - } - }); } public bool SetValue<TEnum, TValue>(TEnum @enum, TValue value) -- Gitblit v1.9.3