diff --git a/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj b/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj index fc288dab..2a15730c 100644 --- a/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj +++ b/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj @@ -459,7 +459,7 @@ - + diff --git a/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs b/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs index d6bd905b..896da888 100644 --- a/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs +++ b/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs @@ -31,8 +31,8 @@ namespace BPASmartClient.CustomResource.Pages.Model private AlarmHelper() { } - public static ObservableCollection Alarms { get; set; } = new ObservableCollection(); - public static List HistoryAlarms { get; set; } = new List(); + public static ObservableCollection Alarms { get; set; } = new ObservableCollection(); + public static List HistoryAlarms { get; set; } = new List(); static ConcurrentDictionary flagbit = new ConcurrentDictionary(); static ConcurrentDictionary delays = new ConcurrentDictionary(); public static Action AddAction { get; set; } @@ -97,7 +97,7 @@ namespace BPASmartClient.CustomResource.Pages.Model /// 报警信息 private static void AddAlarm(object value, string AlarmInfo, AlarmLevel alarmLevel) { - Alarm tempAlarm = new Alarm() + BPASmartClient.Model.Alarm tempAlarm = new BPASmartClient.Model.Alarm() { NumId = Alarms.Count + 1, Date = DateTime.Now.ToString("yyyy/MM/dd"), @@ -107,8 +107,8 @@ namespace BPASmartClient.CustomResource.Pages.Model Time = DateTime.Now.ToString("HH:mm:ss"), }; - var res = Sqlite.GetInstance.Base.Add(tempAlarm); - Sqlite.GetInstance.Save(); + var res = Sqlite.GetInstance.Base.Add(tempAlarm); + Sqlite.GetInstance.Save(); if (Alarms.FirstOrDefault(p => p.Info == AlarmInfo) == null) { @@ -145,134 +145,4 @@ namespace BPASmartClient.CustomResource.Pages.Model } - //public class AlarmHelper where AlarmT : class, new() - //{ - - - // //private volatile static ConcurrentDictionary _Instance; - // //public static AlarmT GetInstance(string name) - // //{ - // // if (_Instance == null) _Instance = new ConcurrentDictionary(); - // // if (!_Instance.ContainsKey(name)) _Instance.TryAdd(name, new AlarmT()); - // // return _Instance[name]; - // //} - // //private AlarmHelper() { } - - - // public static ObservableCollection Alarms { get; set; } = new ObservableCollection(); - // public static List HistoryAlarms { get; set; } = new List(); - // static ConcurrentDictionary flagbit = new ConcurrentDictionary(); - // static ConcurrentDictionary delays = new ConcurrentDictionary(); - // public static Action AddAction { get; set; } - // public static Action RemoveAction { get; set; } - // public static Action ChangeAction { get; set; } - - // public static AlarmT Alarm { get; set; } = new AlarmT(); - - // public static void Init() - // { - // AlarmViewModel.AlarmInfos = Alarms; - // ThreadManage.GetInstance().StartLong(new Action(() => - // { - // foreach (var item in Alarm.GetType().GetProperties()) - // { - // if (item.CustomAttributes.Count() > 0) - // { - // var AlarmModel = item.GetCustomAttribute(); - // if (AlarmModel != null) - // { - // bool value = Convert.ToBoolean(Alarm.GetType().GetProperty(item.Name)?.GetValue(Alarm)); - // EdgeAlarm(value, AlarmModel.AlarmInfo, 1, AlarmModel.AlarmLevel, AlarmModel.AlarmType); - // } - // } - // } - // Thread.Sleep(100); - // }), $"{typeof(AlarmT).Name},报警通用模块监听"); - - // } - - - // //public static void AnalogAlarm(dynamic Trigger, string info, dynamic HH = null, dynamic H = 0, dynamic L = 0, dynamic LL = 0) - // //{ - - // //} - - - - - // /// - // /// 沿报警检测 - // /// - // /// 触发变量 - // /// 报警信息 - // /// 触发类型,上升沿 或 下降沿 - // private static void EdgeAlarm(bool Trigger, string text, int delay = 2, AlarmLevel alarmLevel = AlarmLevel.一般报警, AlarmTriggerType edgeType = AlarmTriggerType.Rising) - // { - // if (!flagbit.ContainsKey(text)) flagbit.TryAdd(text, false); - // if (!delays.ContainsKey(text)) delays.TryAdd(text, Delay.GetInstance(text)); - // if (edgeType == AlarmTriggerType.Rising ? delays[text].Start(Trigger, delay) : delays[text].Start(!Trigger, delay)) - // { - // if (edgeType == AlarmTriggerType.Rising ? !flagbit[text] : flagbit[text]) - // { - // AddAlarm(Trigger, text, alarmLevel); - // flagbit[text] = edgeType == AlarmTriggerType.Rising ? true : false; - // } - // } - // else RemoveAlarm(text); - // if (edgeType == AlarmTriggerType.Rising ? flagbit[text] : !flagbit[text]) flagbit[text] = Trigger; - // } - - // /// - // /// 添加报警信息 - // /// - // /// 报警信息 - // private static void AddAlarm(object value, string AlarmInfo, AlarmLevel alarmLevel) - // { - // Alarm tempAlarm = new Alarm() - // { - // NumId = Alarms.Count + 1, - // Date = DateTime.Now.ToString("yyyy/MM/dd"), - // Grade = alarmLevel.ToString(), - // Info = AlarmInfo, - // Value = value.ToString(), - // Time = DateTime.Now.ToString("HH:mm:ss"), - // }; - - // var res = Sqlite.GetInstance.Base.Add(tempAlarm); - // Sqlite.GetInstance.Save(); - - // if (Alarms.FirstOrDefault(p => p.Info == AlarmInfo) == null) - // { - // Application.Current.Dispatcher.Invoke(new Action(() => - // { - // Alarms.Insert(0, tempAlarm); - // for (int i = 0; i < Alarms.Count; i++) { Alarms.ElementAt(i).NumId = i + 1; } - // })); - - // AddAction?.Invoke(AlarmInfo);//添加报警通知 - // ChangeAction?.Invoke();//更改报警通知 - // } - // } - - // /// - // /// 移除报警信息 - // /// - // /// 报警信息 - // private static void RemoveAlarm(string AlarmInfo) - // { - // var result = Alarms.FirstOrDefault(p => p.Info == AlarmInfo); - // if (result != null) - // { - // Application.Current.Dispatcher.Invoke(new Action(() => - // { - // Alarms.Remove(result); - // for (int i = 0; i < Alarms.Count; i++) { Alarms.ElementAt(i).NumId = i + 1; } - // })); - - // if (RemoveAction != null) RemoveAction(AlarmInfo); - // if (ChangeAction != null) ChangeAction(); - // } - // } - - //} } diff --git a/BPASmartClient.IceMaker/IceMakerMachine.cs b/BPASmartClient.IceMaker/IceMakerMachine.cs index 1fb4d607..1bc4e81a 100644 --- a/BPASmartClient.IceMaker/IceMakerMachine.cs +++ b/BPASmartClient.IceMaker/IceMakerMachine.cs @@ -3,7 +3,7 @@ using BPA.Helper; using BPASmartClient.Model; using BPASmartClient.Peripheral; using BPASmartClient.SerialPort; - +using static BPA.Helper.EventBus; namespace BPASmartClient.IceMaker { diff --git a/BPASmartClient.JakaRobot/BPASmartClient.JakaRobot.csproj b/BPASmartClient.JakaRobot/BPASmartClient.JakaRobot.csproj index 5ab54de7..85bec872 100644 --- a/BPASmartClient.JakaRobot/BPASmartClient.JakaRobot.csproj +++ b/BPASmartClient.JakaRobot/BPASmartClient.JakaRobot.csproj @@ -7,7 +7,7 @@ - + diff --git a/BPASmartClient.Modbus/BPASmartClient.Modbus.csproj b/BPASmartClient.Modbus/BPASmartClient.Modbus.csproj index 33e9f8cd..0792c82e 100644 --- a/BPASmartClient.Modbus/BPASmartClient.Modbus.csproj +++ b/BPASmartClient.Modbus/BPASmartClient.Modbus.csproj @@ -5,7 +5,7 @@ - + diff --git a/BPASmartClient.Model/BPASmartClient.Model.csproj b/BPASmartClient.Model/BPASmartClient.Model.csproj index 1e11df1c..292e66dc 100644 --- a/BPASmartClient.Model/BPASmartClient.Model.csproj +++ b/BPASmartClient.Model/BPASmartClient.Model.csproj @@ -13,7 +13,7 @@ - + diff --git a/BPASmartClient.Nfc/BPASmartClient.Nfc.csproj b/BPASmartClient.Nfc/BPASmartClient.Nfc.csproj index e54eeb6f..acd5e94b 100644 --- a/BPASmartClient.Nfc/BPASmartClient.Nfc.csproj +++ b/BPASmartClient.Nfc/BPASmartClient.Nfc.csproj @@ -21,7 +21,7 @@ - + diff --git a/BPASmartClient.S7Net/BPASmartClient.S7Net.csproj b/BPASmartClient.S7Net/BPASmartClient.S7Net.csproj index 69e6c9f5..642839d7 100644 --- a/BPASmartClient.S7Net/BPASmartClient.S7Net.csproj +++ b/BPASmartClient.S7Net/BPASmartClient.S7Net.csproj @@ -7,7 +7,7 @@ - + diff --git a/BPASmartClient.SerialPort/BPASmartClient.SerialPort.csproj b/BPASmartClient.SerialPort/BPASmartClient.SerialPort.csproj index 8425c6a8..58e2b5f0 100644 --- a/BPASmartClient.SerialPort/BPASmartClient.SerialPort.csproj +++ b/BPASmartClient.SerialPort/BPASmartClient.SerialPort.csproj @@ -5,8 +5,8 @@ - - + + diff --git a/BPASmartClient.Update/BPASmartClient.Update.csproj b/BPASmartClient.Update/BPASmartClient.Update.csproj index 63ab12fd..4ca5cbe3 100644 --- a/BPASmartClient.Update/BPASmartClient.Update.csproj +++ b/BPASmartClient.Update/BPASmartClient.Update.csproj @@ -8,7 +8,7 @@ - + diff --git a/DosingSystem/BPASmartClient.DosingSystem.csproj b/DosingSystem/BPASmartClient.DosingSystem.csproj index 22eb4ff7..437e8b2e 100644 --- a/DosingSystem/BPASmartClient.DosingSystem.csproj +++ b/DosingSystem/BPASmartClient.DosingSystem.csproj @@ -21,7 +21,7 @@ - +