| | |
| | | public abstract void WriteSingleAddress(int address, int writeValue, bool waitForReply = true); |
| | | |
| | | #region IMonitor |
| | | public event Action<DateTime, string, IDevice, MonitorSet> OnMonitorInvoke; |
| | | public event Action<DateTime, IDevice, WarningSet> OnMonitorAlarm; |
| | | public event Action<DateTime, string, IDevice, IMonitorSet> OnMonitorInvoke; |
| | | public event Action<DateTime, IDevice, IWarningSet> OnMonitorAlarm; |
| | | |
| | | public List<int> MonitorValues { get; set; } = new List<int>(); |
| | | |
| | |
| | | //PLCIConfig.MonitorSetCollection.ForEach(set => |
| | | Parallel.ForEach(PLCIConfig.MonitorSetCollection, set => |
| | | { |
| | | MonitorSet monitorSet = set as MonitorSet; |
| | | PLCMonitorSet monitorSet = set as PLCMonitorSet; |
| | | if (monitorSet.TriggerIndex < 0 || monitorSet.TriggerIndex >= tempNew.Count) |
| | | { |
| | | return; |
| | |
| | | |
| | | private void OnMethodInvoked(IAsyncResult ar) |
| | | { |
| | | MonitorSet monitorSet = ar.AsyncState as MonitorSet; |
| | | PLCMonitorSet monitorSet = ar.AsyncState as PLCMonitorSet; |
| | | |
| | | ProcessResponse resValues = monitorSet.Response; |
| | | |
| | | if (resValues.ResultValue == (int)PLCReplyValue.IGNORE) |
| | | if (resValues.ResultValue == (int)ReplyValue.IGNORE) |
| | | { |
| | | return; |
| | | } |
| | |
| | | } |
| | | |
| | | object _alarmLock = new object(); |
| | | private async void SaveAlarmCSVAsync(DateTime now, string plcName, WarningSet ws) |
| | | private async void SaveAlarmCSVAsync(DateTime now, string plcName, PLCWarningSet ws) |
| | | { |
| | | await Task.Run(() => |
| | | { |
| | |
| | | [DisplayName("警报配置")] |
| | | [TypeConverter(typeof(CollectionCountConvert))] |
| | | [Editor(typeof(WarningSetsEditor), typeof(UITypeEditor))] |
| | | public List<WarningSet> WarningSetCollection { get; set; } = new List<WarningSet>(); |
| | | public List<PLCWarningSet> WarningSetCollection { get; set; } = new List<PLCWarningSet>(); |
| | | |
| | | #region IMonitorConfig |
| | | [Category("监听设置")] |
| | | [Description("监听操作配置集合")] |
| | | [DisplayName("监听配置")] |
| | | [TypeConverter(typeof(CollectionCountConvert))] |
| | | [Editor(typeof(ComplexCollectionEditor<MonitorSet>), typeof(UITypeEditor))] |
| | | [Editor(typeof(ComplexCollectionEditor<PLCMonitorSet>), typeof(UITypeEditor))] |
| | | public List<IMonitorSet> MonitorSetCollection { get; set; } = new List<IMonitorSet>(); |
| | | |
| | | [Category("监听设置")] |
| | |
| | | } |
| | | } |
| | | |
| | | private List<WarningSet> GetWarningSets() |
| | | private List<PLCWarningSet> GetWarningSets() |
| | | { |
| | | List<WarningSet> wsList = new List<WarningSet>(); |
| | | List<PLCWarningSet> wsList = new List<PLCWarningSet>(); |
| | | |
| | | OpenFileDialog ofd = new OpenFileDialog(); |
| | | ofd.Multiselect = false; |
| | |
| | | |
| | | if (!string.IsNullOrWhiteSpace(list[1])) |
| | | { |
| | | WarningSet ws = new WarningSet(); |
| | | PLCWarningSet ws = new PLCWarningSet(); |
| | | |
| | | ws.WarningCode = list[0]; |
| | | ws.WarningDescription = list[1]; |
| | |
| | | /// <returns></returns> |
| | | protected override Type CreateCollectionItemType() |
| | | { |
| | | return typeof(WarningSet); |
| | | return typeof(PLCWarningSet); |
| | | } |
| | | |
| | | protected override string GetDisplayText(object value) |