From 8dd7b24e5649edf6f73e1146c4db576f7eb3dcdb Mon Sep 17 00:00:00 2001 From: wells <123> Date: 星期六, 11 七月 2020 14:16:54 +0800 Subject: [PATCH] 7.11 --- src/Bro.M071.Process/M071Process_MotionCard.cs | 75 ++++++++++++++++++++++++++++++++----- 1 files changed, 65 insertions(+), 10 deletions(-) diff --git a/src/Bro.M071.Process/M071Process_MotionCard.cs b/src/Bro.M071.Process/M071Process_MotionCard.cs index 62fd994..70bb5c8 100644 --- a/src/Bro.M071.Process/M071Process_MotionCard.cs +++ b/src/Bro.M071.Process/M071Process_MotionCard.cs @@ -206,17 +206,23 @@ // } //} - if (IsSafetyBeamTrigged || IsSafetyDoorTrigged) + if (!IsAllowedWork) { - LogAsync(DateTime.Now, $"{(IsSafetyDoorTrigged ? "瀹夊叏闂�" : "")}{(IsSafetyBeamTrigged ? " 瀹夊叏鍏夌嚎" : "")}瑙﹀彂涓紝澶嶄綅澶辫触", ""); + LogAsync(DateTime.Now, $"{(IsSafetyDoorTrigged ? "瀹夊叏闂�" : "")}{(IsSafetyBeamTrigged ? " 瀹夊叏鍏夌嚎" : "")}{(isEmergencyStopped ? " 鎬ュ仠鎸夐挳" : "")}瑙﹀彂涓紝澶嶄綅澶辫触", ""); return new ProcessResponse(false); } MotionCardDefaultRun("Reset", ref opConfig, ref invokeDevice); - //(invokeDevice as IMotionCard).Reset(); + (invokeDevice as MotionCardBase).ResetAlarm(); RaisedAlarm(""); MachineState = MachineState.Ready; + + if (IsEmergencyStopped) + { + RaisedAlarm("鎬ュ仠鎸夐挳鏈仮澶嶏紝璇锋墽琛屽ぇ澶嶄綅"); + MachineState = MachineState.Alarm; + } if (ResetTimer == null) { @@ -251,7 +257,8 @@ } } - [ProcessMethod("MotionCardOperationConfigCollection", "FullReset", "澶у浣嶆搷浣�", InvokeType.TestInvoke)] + //[ProcessMethod("MotionCardOperationConfigCollection", "FullReset", "澶у浣嶆搷浣�", InvokeType.TestInvoke)] + [ProcessMethod("MotionCardBase", "FullReset", "澶у浣嶆搷浣�", InvokeType.TestInvoke)] public ProcessResponse FullReset(IOperationConfig opConfig, IDevice invokeDevice, IDevice sourceDevice) { //if (opConfig == null) @@ -276,6 +283,7 @@ //{ // motionCard.Run(opConfig); //} + MachineState = MachineState.Resetting; MotionCardDefaultRun("FullReset", ref opConfig, ref invokeDevice); @@ -284,7 +292,11 @@ OnFullResetDone?.Invoke(); + isFullResetCovered = true; + LogAsync(DateTime.Now, "澶у浣嶅姩浣滃畬鎴�", ""); + + RaisedAlarm(""); MachineState = MachineState.Ready; return new ProcessResponse(true); @@ -302,7 +314,7 @@ }; MachineState _machineStateBeforePause = MachineState.Unknown; List<MachineState> _statesAllowPause = new List<MachineState>() { MachineState.Running, MachineState.Ready, MachineState.Pause }; - [ProcessMethod("", "PauseJob", "鏆傚仠娴佺▼", InvokeType.TestInvoke)] + [ProcessMethod("", "SwitchJobStatus", "娴佺▼鐘舵�佸垏鎹�", InvokeType.TestInvoke)] public ProcessResponse SwitchJobStatus(IOperationConfig opConfig, IDevice invokeDevice, IDevice sourceDevice) { if (!_statesAllowPause.Contains(MachineState)) @@ -328,7 +340,7 @@ if (!_pauseHandle.WaitResult) { #region 鏉垮崱鏆傚仠鍔ㄤ綔 - motionDevice.StateChange(DeviceState.DSPause); + motionDevice.SetImmediatePause(); #endregion _pauseHandle.WaitHandle.Reset(); @@ -339,7 +351,7 @@ else if (!_pauseHandle.WaitResult) { #region 鏉垮崱鎭㈠鍔ㄤ綔 - motionDevice.StateChange(DeviceState.DSOpen); + motionDevice.ResetImmediatePause(); #endregion _pauseHandle.WaitHandle.Set(); @@ -354,7 +366,7 @@ if (!_pauseHandle.WaitResult) { #region 鏉垮崱鏆傚仠鍔ㄤ綔 - motionDevice.StateChange(DeviceState.DSPause); + motionDevice.SetImmediatePause(); #endregion _pauseHandle.WaitHandle.Reset(); @@ -367,7 +379,7 @@ if (!_pauseHandle.WaitResult) { #region 鏉垮崱鎭㈠鍔ㄤ綔 - motionDevice.StateChange(DeviceState.DSOpen); + motionDevice.ResetImmediatePause(); #endregion _pauseHandle.WaitHandle.Set(); @@ -553,7 +565,7 @@ private void MotionCardDefaultRun(string methodCode, ref IOperationConfig opConfig, ref IDevice invokeDevice) { IMonitorSet monitorSet = null; - if (opConfig == null) + if (opConfig == null || !(opConfig is MotionCardOperationConfigBase)) { monitorSet = Config.MonitorSetCollection.FirstOrDefault(u => u.MethodCode == methodCode); if (monitorSet == null) @@ -579,6 +591,11 @@ throw new ProcessException($"{motionCard.Name}寮傚父锛寋response.Message}", null, ExceptionLevel.Fatal); } } + } + + bool IsAllowedWork + { + get => !(IsSafetyBeamTrigged || IsSafetyDoorTrigged || IsEmergencyStopped); } #region 瀹夊叏闂� & 瀹夊叏鍏夌嚎 @@ -630,5 +647,43 @@ return new ProcessResponse(true); } #endregion + + #region 鎬ュ仠 + bool isEmergencyStopped = false; + bool isFullResetCovered = true; + public bool IsEmergencyStopped + { + get => isEmergencyStopped && isFullResetCovered; + set + { + if (value) + { + isFullResetCovered = false; + isEmergencyStopped = true; + } + else + { + isEmergencyStopped = false; + } + } + } + + [ProcessMethod("", "EmergencyStop", "鎬ュ仠鎸夐挳琚媿涓�", InvokeType.TestInvoke)] + public ProcessResponse EmergencyStop(IOperationConfig opConfig, IDevice invokeDevice, IDevice sourceDevice) + { + if (opConfig.InputPara == null || opConfig.InputPara.Count == 0) + throw new ProcessException("鎬ュ仠鎸夐挳鏈厤缃緭鍏ヤ俊鍙�"); + + IsEmergencyStopped = opConfig.InputPara[0] == 1; + + if (IsEmergencyStopped) + { + RaisedAlarm("鎬ュ仠鎸夐挳琚媿涓�"); + MachineState = MachineState.Alarm; + } + + return new ProcessResponse(true); + } + #endregion } } -- Gitblit v1.8.0