| | |
| | | //Query Robot IOs |
| | | //SendMsg(RobotMsgType.Send, 0, true, RobotMsgAction.IO, RobotMsgParas.Query, new List<string>()); |
| | | |
| | | //scanMsg = new RobotMsg(); |
| | | //scanMsg.Action = RobotMsgAction.IO; |
| | | //scanMsg.Para1 = RobotMsgParas.Query; |
| | | scanMsg = new RobotMsg(); |
| | | scanMsg.Action = RobotMsgAction.IOQuery; |
| | | |
| | | //Task.Run(() => |
| | | //{ |
| | | // Monitor(); |
| | | //}); |
| | | Task.Run(() => |
| | | { |
| | | Monitor(); |
| | | }); |
| | | } |
| | | |
| | | protected override void Stop() |
| | |
| | | |
| | | if (errorCode != 0) |
| | | { |
| | | var desc = IConfig.RobotWarnings.FirstOrDefault(u => u.WarningCode == errorCode); |
| | | var desc = IConfig.RobotReplyWarnings.FirstOrDefault(u => u.WarningCode == errorCode); |
| | | throw new ProcessException($"{Name}{msg.ID}任务反馈异常{errorCode},异常描述:{(desc == null ? "无" : desc.WarningDescription)}"); |
| | | } |
| | | |
| | |
| | | |
| | | protected virtual void MonitorCheckAndInvoke(List<int> tempNew, List<int> tempOld) |
| | | { |
| | | IConfig.WarningSetCollection.ForEach(w => |
| | | { |
| | | if (w.WarningIndex_Word < 0 || w.WarningIndex_Word >= tempNew.Count) |
| | | return; |
| | | |
| | | bool isOn = tempNew[w.WarningIndex_Word] == 1; |
| | | if (w.CurrentStatus != isOn) |
| | | { |
| | | w.CurrentStatus = isOn; |
| | | OnMonitorAlarm?.BeginInvoke(DateTime.Now, this, w, null, null); |
| | | } |
| | | }); |
| | | |
| | | IConfig.MonitorSetCollection.ForEach(m => |
| | | { |
| | | if (m.TriggerIndex < 0 || m.TriggerIndex >= tempNew.Count) |
| | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | public virtual void ResetAlarm() |
| | | { |
| | | IConfig.WarningSetCollection.ForEach(u => u.CurrentStatus = !u.TriggerValue); |
| | | } |
| | | #endregion |
| | | } |
| | | } |