diff --git a/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs b/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs index 8192ebe5..1ca88c78 100644 --- a/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs +++ b/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs @@ -16,16 +16,15 @@ 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() { } + private volatile static ConcurrentDictionary _Instance; + public static AlarmT GetInstance(string name = "") + { + if (string.IsNullOrEmpty(name)) name = typeof(AlarmT).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(); @@ -36,22 +35,29 @@ namespace BPASmartClient.CustomResource.Pages.Model public static Action RemoveAction { get; set; } public static Action ChangeAction { get; set; } - public static AlarmT Alarm { get; set; } = new AlarmT(); + //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 (_Instance != null) { - if (item.CustomAttributes.Count() > 0) + foreach (var temp in _Instance) { - var AlarmModel = item.GetCustomAttribute(); - if (AlarmModel != null) + foreach (var item in temp.Value.GetType().GetProperties()) { - bool value = Convert.ToBoolean(Alarm.GetType().GetProperty(item.Name)?.GetValue(Alarm)); - EdgeAlarm(value, AlarmModel.AlarmInfo, 1, AlarmModel.AlarmLevel, AlarmModel.AlarmType); + if (item.CustomAttributes.Count() > 0) + { + var AlarmModel = item.GetCustomAttribute(); + if (AlarmModel != null) + { + bool value = Convert.ToBoolean(_Instance[temp.Key].GetType().GetProperty(item.Name)?.GetValue(_Instance[temp.Key])); + string text = typeof(AlarmT).Name == temp.Key ? AlarmModel.AlarmInfo : $"{temp.Key}:{AlarmModel.AlarmInfo}"; + EdgeAlarm(value, text, 1, AlarmModel.AlarmLevel, AlarmModel.AlarmType); + } + } } } } @@ -60,15 +66,6 @@ namespace BPASmartClient.CustomResource.Pages.Model } - - //public static void AnalogAlarm(dynamic Trigger, string info, dynamic HH = null, dynamic H = 0, dynamic L = 0, dynamic LL = 0) - //{ - - //} - - - - /// /// 沿报警检测 /// @@ -144,4 +141,135 @@ 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.CustomResource/Pages/Model/AlarmTest.cs b/BPASmartClient.CustomResource/Pages/Model/AlarmTest.cs new file mode 100644 index 00000000..b7d1bce3 --- /dev/null +++ b/BPASmartClient.CustomResource/Pages/Model/AlarmTest.cs @@ -0,0 +1,145 @@ +using BPASmartClient.CustomResource.Pages.ViewModel; +using BPASmartClient.Helper; +using BPASmartClient.Model; +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Reflection; +using System.Threading; +using System.Threading.Tasks; +using System.Windows; + +namespace BPASmartClient.CustomResource.Pages.Model +{ + public class AlarmTest where AlarmT : class, new() + { + + + private volatile static ConcurrentDictionary _Instance; + public static AlarmT GetInstance(string name = "") + { + if (string.IsNullOrEmpty(name)) name = typeof(AlarmT).Name; + if (_Instance == null) _Instance = new ConcurrentDictionary(); + if (!_Instance.ContainsKey(name)) _Instance.TryAdd(name, new AlarmT()); + return _Instance[name]; + } + private AlarmTest() { } + + + 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(() => + { + if (_Instance != null) + { + foreach (var temp in _Instance) + { + foreach (var item in temp.Value.GetType().GetProperties()) + { + if (item.CustomAttributes.Count() > 0) + { + var AlarmModel = item.GetCustomAttribute(); + if (AlarmModel != null) + { + bool value = Convert.ToBoolean(_Instance[temp.Key].GetType().GetProperty(item.Name)?.GetValue(_Instance[temp.Key])); + EdgeAlarm(value, $"{temp.Key}:{AlarmModel.AlarmInfo}", 1, AlarmModel.AlarmLevel, AlarmModel.AlarmType); + } + } + } + } + } + Thread.Sleep(100); + }), $"{typeof(AlarmT).Name},报警通用模块监听"); + + } + + /// + /// 沿报警检测 + /// + /// 触发变量 + /// 报警信息 + /// 触发类型,上升沿 或 下降沿 + 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.JXJFoodSmallStation/Model/RawMaterial/DeviceInquire.cs b/BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DeviceInquire.cs index 0041ebfb..c11079f6 100644 --- a/BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DeviceInquire.cs +++ b/BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DeviceInquire.cs @@ -100,8 +100,8 @@ namespace BPASmartClient.JXJFoodSmallStation.Model } public void Init() { - AlarmHelper.Init(); - AlarmHelper.Alarm.EStop1 = true; + //AlarmHelper.Init(); + //AlarmHelper.Alarm.EStop1 = true; //TestData(); IpAddressLines(); @@ -321,12 +321,12 @@ namespace BPASmartClient.JXJFoodSmallStation.Model deviceStatus.NowWeightFeedback = (float)this.modbusTcp.GetUint(DeviceAddress.CutWeightFeedback);//获取下料重量 deviceStatus.DeviceNum = (ushort)this.modbusTcp.ReadShort(DeviceAddress.DeviceNum);//获取设备编号 deviceStatus.DeviceAlarmCode = (ushort)this.modbusTcp.ReadShort(DeviceAddress.DeviceAlarmCode);//获取设备故障编码 - AlarmHelper.Alarm.EStop1 = deviceStatus.DeviceAlarmCode.Get16bitValue(1); - AlarmHelper.Alarm.Servo = deviceStatus.DeviceAlarmCode.Get16bitValue(2); - AlarmHelper.Alarm.Inverter = deviceStatus.DeviceAlarmCode.Get16bitValue(3); - AlarmHelper.Alarm.EStop2 = deviceStatus.DeviceAlarmCode.Get16bitValue(7); - AlarmHelper.Alarm.SiloUpperLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(8); - AlarmHelper.Alarm.SiloLowerLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(9); + AlarmHelper.GetInstance(DeviceName).EStop1 = deviceStatus.DeviceAlarmCode.Get16bitValue(1); + AlarmHelper.GetInstance(DeviceName).Servo = deviceStatus.DeviceAlarmCode.Get16bitValue(2); + AlarmHelper.GetInstance(DeviceName).Inverter = deviceStatus.DeviceAlarmCode.Get16bitValue(3); + AlarmHelper.GetInstance(DeviceName).EStop2 = deviceStatus.DeviceAlarmCode.Get16bitValue(7); + AlarmHelper.GetInstance(DeviceName).SiloUpperLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(8); + AlarmHelper.GetInstance(DeviceName).SiloLowerLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(9); Thread.Sleep(10); }), $"{DeviceName} 开始监听", true); @@ -341,7 +341,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model public bool StatusReset() { - return this.modbusTcp.Write(DeviceAddress.FinfishStatus, (ushort)1).ToString(); + return this.modbusTcp.Write(DeviceAddress.FinfishStatus, (ushort)1); //var res = modbusTcp.Read(DeviceAddress.RunStatus); } diff --git a/DosingSystem/Model/DeviceInquire.cs b/DosingSystem/Model/DeviceInquire.cs index e4bc1699..0be08513 100644 --- a/DosingSystem/Model/DeviceInquire.cs +++ b/DosingSystem/Model/DeviceInquire.cs @@ -311,15 +311,12 @@ namespace BPASmartClient.DosingSystem deviceStatus.DeviceNum = (ushort)this.modbusTcp.ReadShort(DeviceAddress.DeviceNum);//获取设备编号 deviceStatus.DeviceAlarmCode = (ushort)this.modbusTcp.ReadShort(DeviceAddress.DeviceAlarmCode);//获取设备故障编码 - AlarmHelper.Alarm.EStop1 = deviceStatus.DeviceAlarmCode.Get16bitValue(1); - AlarmHelper.Alarm.Servo = deviceStatus.DeviceAlarmCode.Get16bitValue(2); - AlarmHelper.Alarm.Inverter = deviceStatus.DeviceAlarmCode.Get16bitValue(3); - AlarmHelper.Alarm.EStop2 = deviceStatus.DeviceAlarmCode.Get16bitValue(7); - AlarmHelper.Alarm.SiloUpperLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(8); - AlarmHelper.Alarm.SiloLowerLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(9); - - AlarmHelper("dd").Alarm.SiloLowerLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(9); - + AlarmHelper.GetInstance(DeviceName).EStop1 = deviceStatus.DeviceAlarmCode.Get16bitValue(1); + AlarmHelper.GetInstance(DeviceName).Servo = deviceStatus.DeviceAlarmCode.Get16bitValue(2); + AlarmHelper.GetInstance(DeviceName).Inverter = deviceStatus.DeviceAlarmCode.Get16bitValue(3); + AlarmHelper.GetInstance(DeviceName).EStop2 = deviceStatus.DeviceAlarmCode.Get16bitValue(7); + AlarmHelper.GetInstance(DeviceName).SiloUpperLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(8); + AlarmHelper.GetInstance(DeviceName).SiloLowerLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(9); Thread.Sleep(100); }), $"{DeviceName} 开始监听", true); } diff --git a/FryPot_DosingSystem/Control/DosingLogicControl.cs b/FryPot_DosingSystem/Control/DosingLogicControl.cs index 3a74e5ec..c264d589 100644 --- a/FryPot_DosingSystem/Control/DosingLogicControl.cs +++ b/FryPot_DosingSystem/Control/DosingLogicControl.cs @@ -1408,13 +1408,13 @@ namespace FryPot_DosingSystem.Control globalVar.rollerLineTwo.OutMaterialingSingle = data[4]; globalVar.rollerLineThree.OutMaterialingSingle = data[5]; - AlarmHelper.Alarm.LineOneRollerRunning = data[3]; - AlarmHelper.Alarm.LineTwoRollerRunning = data[4]; - AlarmHelper.Alarm.LineThreeRollerRunning = data[5]; + AlarmHelper.GetInstance().LineOneRollerRunning = data[3]; + AlarmHelper.GetInstance().LineTwoRollerRunning = data[4]; + AlarmHelper.GetInstance().LineThreeRollerRunning = data[5]; - AlarmHelper.Alarm.LOneRollerTrouble = data[6]; - AlarmHelper.Alarm.LTwoRollerTrouble = data[7]; - AlarmHelper.Alarm.LThreeRollerTrouble = data[8]; + AlarmHelper.GetInstance().LOneRollerTrouble = data[6]; + AlarmHelper.GetInstance().LTwoRollerTrouble = data[7]; + AlarmHelper.GetInstance().LThreeRollerTrouble = data[8]; })); GetAddressData("D2040", new Action((data) => @@ -1425,11 +1425,11 @@ namespace FryPot_DosingSystem.Control globalVar.fryPotFour.InputMaterialRollerRunningSingle = data[3]; globalVar.fryPotFive.InputMaterialRollerRunningSingle = data[4]; - AlarmHelper.Alarm.FryPotOneRollerRunning = data[0]; - AlarmHelper.Alarm.FryPotTwoRollerRunning = data[1]; - AlarmHelper.Alarm.FryPotThreeRollerRunning = data[2]; - AlarmHelper.Alarm.FryPotFourRollerRunning = data[3]; - AlarmHelper.Alarm.FryPotFiveRollerRunning = data[4]; + AlarmHelper.GetInstance().FryPotOneRollerRunning = data[0]; + AlarmHelper.GetInstance().FryPotTwoRollerRunning = data[1]; + AlarmHelper.GetInstance().FryPotThreeRollerRunning = data[2]; + AlarmHelper.GetInstance().FryPotFourRollerRunning = data[3]; + AlarmHelper.GetInstance().FryPotFiveRollerRunning = data[4]; })); GetAddressData("D2045", new Action((data) => @@ -1456,11 +1456,11 @@ namespace FryPot_DosingSystem.Control globalVar.fryPotFour.EmptyBarrelRollerRunningSingle = data[3]; globalVar.fryPotFive.EmptyBarrelRollerRunningSingle = data[4]; - AlarmHelper.Alarm.FryPotOneEmptyRollerRunning = data[0]; - AlarmHelper.Alarm.FryPotTwoEmptyRollerRunning = data[1]; - AlarmHelper.Alarm.FryPotThreeEmptyRollerRunning = data[2]; - AlarmHelper.Alarm.FryPotFourEmptyRollerRunning = data[3]; - AlarmHelper.Alarm.FryPotFiveEmptyRollerRunning = data[4]; + AlarmHelper.GetInstance().FryPotOneEmptyRollerRunning = data[0]; + AlarmHelper.GetInstance().FryPotTwoEmptyRollerRunning = data[1]; + AlarmHelper.GetInstance().FryPotThreeEmptyRollerRunning = data[2]; + AlarmHelper.GetInstance().FryPotFourEmptyRollerRunning = data[3]; + AlarmHelper.GetInstance().FryPotFiveEmptyRollerRunning = data[4]; })); GetAddressData("D2070", new Action((data) => { @@ -1469,11 +1469,11 @@ namespace FryPot_DosingSystem.Control //globalVar.fryPotThree.RollerTroubleSingle = data[2]; //globalVar.fryPotFour.RollerTroubleSingle = data[3]; //globalVar.fryPotFive.RollerTroubleSingle = data[4]; - AlarmHelper.Alarm.FryPotOneRollerTrouble = data[0]; - AlarmHelper.Alarm.FryPotTwoRollerTrouble = data[1]; - AlarmHelper.Alarm.FryPotThreeRollerTrouble = data[2]; - AlarmHelper.Alarm.FryPotFourRollerTrouble = data[3]; - AlarmHelper.Alarm.FryPotFiveRollerTrouble = data[4]; + AlarmHelper.GetInstance().FryPotOneRollerTrouble = data[0]; + AlarmHelper.GetInstance().FryPotTwoRollerTrouble = data[1]; + AlarmHelper.GetInstance().FryPotThreeRollerTrouble = data[2]; + AlarmHelper.GetInstance().FryPotFourRollerTrouble = data[3]; + AlarmHelper.GetInstance().FryPotFiveRollerTrouble = data[4]; })); GetAddressData("D2078", new Action(data => { @@ -1483,7 +1483,7 @@ namespace FryPot_DosingSystem.Control })); GetAddressData("D2075", new Action(data => { - AlarmHelper.Alarm.CleanEnterRollerRunning = data[0]; + AlarmHelper.GetInstance().CleanEnterRollerRunning = data[0]; globalVar.CleadBarrelEnterSingle = data[0]; })); GetAddressData("2076", new Action(data => @@ -1493,7 +1493,7 @@ namespace FryPot_DosingSystem.Control })); GetAddressData("D2077", new Action(data => { - AlarmHelper.Alarm.CleanOutputRollerRunning = data[0]; + AlarmHelper.GetInstance().CleanOutputRollerRunning = data[0]; globalVar.CleadBarrelExitSingle = data[0]; })); //炒锅1状态数据 @@ -1826,7 +1826,7 @@ namespace FryPot_DosingSystem.Control hardWareStatusModel.RollerOneModel.LocSixRollerSerial = globalVar.rollerLineOne.StationSix; hardWareStatusModel.RollerOneModel.LocSevenRollerSerial = globalVar.rollerLineOne.StationSeven; hardWareStatusModel.RollerOneModel.LocEightRollerSerial = globalVar.rollerLineOne.StationEight; - if (AlarmHelper.Alarm.LOneRollerTrouble == 0) + if (AlarmHelper.GetInstance().LOneRollerTrouble == 0) { hardWareStatusModel.RollerOneModel.RollerAlarmState = Color.FromRgb(130, 232, 139);//无故障 @@ -1854,7 +1854,7 @@ namespace FryPot_DosingSystem.Control hardWareStatusModel.RollerTwoModel.LocSixRollerSerial = globalVar.rollerLineTwo.StationSix; hardWareStatusModel.RollerTwoModel.LocSevenRollerSerial = globalVar.rollerLineTwo.StationSeven; hardWareStatusModel.RollerTwoModel.LocEightRollerSerial = globalVar.rollerLineTwo.StationEight; - if (AlarmHelper.Alarm.LTwoRollerTrouble == 0) + if (AlarmHelper.GetInstance().LTwoRollerTrouble == 0) { hardWareStatusModel.RollerTwoModel.RollerAlarmState = Color.FromRgb(130, 232, 139);//无故障 } @@ -1880,7 +1880,7 @@ namespace FryPot_DosingSystem.Control hardWareStatusModel.RollerThreeModel.LocSixRollerSerial = globalVar.rollerLineThree.StationSix; hardWareStatusModel.RollerThreeModel.LocSevenRollerSerial = globalVar.rollerLineThree.StationSeven; hardWareStatusModel.RollerThreeModel.LocEightRollerSerial = globalVar.rollerLineThree.StationEight; - if (AlarmHelper.Alarm.LThreeRollerTrouble == 0) + if (AlarmHelper.GetInstance().LThreeRollerTrouble == 0) { hardWareStatusModel.RollerThreeModel.RollerAlarmState = Color.FromRgb(130, 232, 139);//无故障 } @@ -2123,7 +2123,7 @@ namespace FryPot_DosingSystem.Control { globalVar.agvArriveCleanLoad = false; MessageLog.GetInstance.ShowRunLog("AGV到达清洗台空桶上料位置"); - erp: if (AlarmHelper.Alarm.CleanOutputRollerRunning == 0) + erp: if (AlarmHelper.GetInstance().CleanOutputRollerRunning == 0) { //plc交互 WritePlcData("D1066", 1);//AGV空桶出桶就位信号下发PlC @@ -2131,7 +2131,7 @@ namespace FryPot_DosingSystem.Control } else//有故障 { - while (AlarmHelper.Alarm.CleanOutputRollerRunning == 1) + while (AlarmHelper.GetInstance().CleanOutputRollerRunning == 1) { Thread.Sleep(1000); if (globalVar.ExitLineOneTask) @@ -2148,7 +2148,7 @@ namespace FryPot_DosingSystem.Control /// private void AgvFromLineOneToCleanPlate() { - if (AlarmHelper.Alarm.LOneRollerTrouble == 0)//输送线无故障 + if (AlarmHelper.GetInstance().LOneRollerTrouble == 0)//输送线无故障 { //线体1到清洗台 if (!globalVar.rollerLineOne.IsEpmtyBefore && globalVar.rollerLineOne.CanRun) @@ -2192,7 +2192,7 @@ namespace FryPot_DosingSystem.Control { // 线体2到清洗台 - if (AlarmHelper.Alarm.LTwoRollerTrouble == 0)//输送线无故障 + if (AlarmHelper.GetInstance().LTwoRollerTrouble == 0)//输送线无故障 { if (!globalVar.rollerLineTwo.IsEpmtyBefore && globalVar.rollerLineTwo.CanRun) { @@ -2234,7 +2234,7 @@ namespace FryPot_DosingSystem.Control private void AgvFromLineThreeToCleanPlate() { //线体3到清洗台 - if (AlarmHelper.Alarm.LThreeRollerTrouble == 0)//输送线无故障 + if (AlarmHelper.GetInstance().LThreeRollerTrouble == 0)//输送线无故障 { if (!globalVar.rollerLineThree.IsEpmtyBefore && globalVar.rollerLineThree.CanRun) { @@ -2279,7 +2279,7 @@ namespace FryPot_DosingSystem.Control globalVar.rollerLineOne.agvArriveCleanUnLoad = false; MessageLog.GetInstance.ShowRunLog("空桶从线体1到达清洗位置,准备卸桶"); - erp: if (AlarmHelper.Alarm.CleanEnterRollerRunning == 0) + erp: if (AlarmHelper.GetInstance().CleanEnterRollerRunning == 0) { //plc交互 WritePlcData("D1065", 1);//AGV空桶洗桶就位信号下发PLC @@ -2287,7 +2287,7 @@ namespace FryPot_DosingSystem.Control } else//有故障 { - while (AlarmHelper.Alarm.CleanEnterRollerRunning == 1) + while (AlarmHelper.GetInstance().CleanEnterRollerRunning == 1) { Thread.Sleep(1000); if (globalVar.ExitLineOneTask) @@ -2311,7 +2311,7 @@ namespace FryPot_DosingSystem.Control globalVar.rollerLineTwo.agvArriveCleanUnLoad = false; MessageLog.GetInstance.ShowRunLog("空桶从线体2到达清洗位置,准备卸桶"); - erp: if (AlarmHelper.Alarm.CleanEnterRollerRunning == 0) + erp: if (AlarmHelper.GetInstance().CleanEnterRollerRunning == 0) { //plc交互 WritePlcData("D1065", 1);//AGV空桶洗桶就位信号下发PLC @@ -2319,7 +2319,7 @@ namespace FryPot_DosingSystem.Control } else//有故障 { - while (AlarmHelper.Alarm.CleanEnterRollerRunning == 1) + while (AlarmHelper.GetInstance().CleanEnterRollerRunning == 1) { Thread.Sleep(1000); if (globalVar.ExitLineOneTask) @@ -2342,7 +2342,7 @@ namespace FryPot_DosingSystem.Control { globalVar.rollerLineThree.agvArriveCleanUnLoad = false; MessageLog.GetInstance.ShowRunLog("空桶从线体3到达清洗位置,准备卸桶"); - erp: if (AlarmHelper.Alarm.CleanEnterRollerRunning == 0) + erp: if (AlarmHelper.GetInstance().CleanEnterRollerRunning == 0) { //plc交互 WritePlcData("D1065", 1);//AGV空桶洗桶就位信号下发PLC @@ -2350,7 +2350,7 @@ namespace FryPot_DosingSystem.Control } else//有故障 { - while (AlarmHelper.Alarm.CleanEnterRollerRunning == 1) + while (AlarmHelper.GetInstance().CleanEnterRollerRunning == 1) { Thread.Sleep(1000); if (globalVar.ExitLineOneTask) @@ -3014,7 +3014,7 @@ namespace FryPot_DosingSystem.Control globalVar.LThreeInOrOutputLock = true; globalVar.LThreePotOutputRollerArrive = true; } - + } } } @@ -3078,33 +3078,33 @@ namespace FryPot_DosingSystem.Control // FryPotOneRollerTroubleCheck(); //if (FryPotAlarm == 1 || FryPotFourAlarm == 1)//无故障 //{ - if (globalVar.agvFryPotEmptyRollerArrive) + if (globalVar.agvFryPotEmptyRollerArrive) + { + FryPotOneOrFourOutEmpetyRollerOperate(); + if (OutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料 { - FryPotOneOrFourOutEmpetyRollerOperate(); - if (OutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料 - { - //AgvViewModel.GetInstance().Set小车是否承载物品(1, IsBool.OnllYes); - //if (globalVar.LOneFryPotSerial == 1) - //{ - // AgvViewModel.GetInstance().Set小车运动(1, CartMotionTrajectory.hs_1); - //} - //else if (globalVar.LOneFryPotSerial == 4) - //{ - // AgvViewModel.GetInstance().Set小车运动(1, CartMotionTrajectory.hs_4); - //} - globalVar.agvFryPotEmptyRollerArrive = false; - globalVar.InOrOutputLock = false; - MessageLog.GetInstance.ShowRunLog($"AGV在【{globalVar.LOneFryPotSerial}】号炒锅将空桶回收到4号滚筒线"); - //AGV拿到空桶,让AGV运桶到指定位置,同时可以让下一个AGV从线体装料运到炒锅 - globalVar.AllowAgvToLineLoadRoller = true; - globalVar.LoadRoller = false; - globalVar.AgvToFryPot = false; - globalVar.PotOneInputMaterialArrive = false; - globalVar.PotOneOutputRollerArrive = false; - globalVar.AgvArrivePot = false; + //AgvViewModel.GetInstance().Set小车是否承载物品(1, IsBool.OnllYes); + //if (globalVar.LOneFryPotSerial == 1) + //{ + // AgvViewModel.GetInstance().Set小车运动(1, CartMotionTrajectory.hs_1); + //} + //else if (globalVar.LOneFryPotSerial == 4) + //{ + // AgvViewModel.GetInstance().Set小车运动(1, CartMotionTrajectory.hs_4); + //} + globalVar.agvFryPotEmptyRollerArrive = false; + globalVar.InOrOutputLock = false; + MessageLog.GetInstance.ShowRunLog($"AGV在【{globalVar.LOneFryPotSerial}】号炒锅将空桶回收到4号滚筒线"); + //AGV拿到空桶,让AGV运桶到指定位置,同时可以让下一个AGV从线体装料运到炒锅 + globalVar.AllowAgvToLineLoadRoller = true; + globalVar.LoadRoller = false; + globalVar.AgvToFryPot = false; + globalVar.PotOneInputMaterialArrive = false; + globalVar.PotOneOutputRollerArrive = false; + globalVar.AgvArrivePot = false; - } } + } //} } @@ -3131,37 +3131,37 @@ namespace FryPot_DosingSystem.Control { if ((globalVar.fryPotTwo.EmptyBarrelArrivedSingle == 1 || globalVar.fryPotFive.EmptyBarrelArrivedSingle == 1) && LTwoOutputMaterialQuene.Count > 0 && globalVar.LTwoAgvArrivePot) { - + //if (FryPotTwoAlarm == 1 || FryPotFiveAlarm == 1)//无故障 //{ - if (globalVar.LTwoagvFryPotEmptyRollerArrive) + if (globalVar.LTwoagvFryPotEmptyRollerArrive) + { + FryPotTwoOrFiveOutEmpetyRollerOperate(); + if (LTwoOutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料 { - FryPotTwoOrFiveOutEmpetyRollerOperate(); - if (LTwoOutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料 - { - //AgvViewModel.GetInstance().Set小车是否承载物品(2, IsBool.OnllYes); - //if (globalVar.LTwoFryPotSerial == 2) - //{ - // AgvViewModel.GetInstance().Set小车运动(2, CartMotionTrajectory.hs_2); - //} - //else if (globalVar.LTwoFryPotSerial == 5) - //{ - // AgvViewModel.GetInstance().Set小车运动(2, CartMotionTrajectory.hs_5); - //} - globalVar.LTwoagvFryPotEmptyRollerArrive = false; - globalVar.LTwoInOrOutputLock = false; - - MessageLog.GetInstance.ShowRunLog($"AGV在【{globalVar.LTwoFryPotSerial}】号炒锅将空桶回收到4号滚筒线"); - //AGV拿到空桶,让AGV运桶到指定位置,同时可以让下一个AGV从线体装料运到炒锅 - globalVar.AllowAgvToLineTwoLoadRoller = true; - globalVar.LTwoLoadRoller = false; - globalVar.LTwoAgvToFryPot = false; - globalVar.LTwoPotInputMaterialArrive = false; - globalVar.LTwoPotOutputRollerArrive = false; - globalVar.LTwoAgvArrivePot = false; + //AgvViewModel.GetInstance().Set小车是否承载物品(2, IsBool.OnllYes); + //if (globalVar.LTwoFryPotSerial == 2) + //{ + // AgvViewModel.GetInstance().Set小车运动(2, CartMotionTrajectory.hs_2); + //} + //else if (globalVar.LTwoFryPotSerial == 5) + //{ + // AgvViewModel.GetInstance().Set小车运动(2, CartMotionTrajectory.hs_5); + //} + globalVar.LTwoagvFryPotEmptyRollerArrive = false; + globalVar.LTwoInOrOutputLock = false; + + MessageLog.GetInstance.ShowRunLog($"AGV在【{globalVar.LTwoFryPotSerial}】号炒锅将空桶回收到4号滚筒线"); + //AGV拿到空桶,让AGV运桶到指定位置,同时可以让下一个AGV从线体装料运到炒锅 + globalVar.AllowAgvToLineTwoLoadRoller = true; + globalVar.LTwoLoadRoller = false; + globalVar.LTwoAgvToFryPot = false; + globalVar.LTwoPotInputMaterialArrive = false; + globalVar.LTwoPotOutputRollerArrive = false; + globalVar.LTwoAgvArrivePot = false; - } } + } //} } @@ -3187,28 +3187,28 @@ namespace FryPot_DosingSystem.Control { //if (FryPotThreeAlarm == 1)//无故障 //{ - if (globalVar.LThreeagvFryPotEmptyRollerArrive) + if (globalVar.LThreeagvFryPotEmptyRollerArrive) + { + FryPotThreeOutEmpetyRollerOperate(); + if (LThreeOutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料 { - FryPotThreeOutEmpetyRollerOperate(); - if (LThreeOutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料 - { - //AgvViewModel.GetInstance().Set小车是否承载物品(3, IsBool.OnllYes); - //AgvViewModel.GetInstance().Set小车运动(3, CartMotionTrajectory.hs_3); - globalVar.LThreeagvFryPotEmptyRollerArrive = false; - globalVar.LThreeInOrOutputLock = false; - - MessageLog.GetInstance.ShowRunLog($"AGV在【{globalVar.LThreeFryPotSerial}】号炒锅将空桶回收到4号滚筒线"); - //AGV拿到空桶,让AGV运桶到指定位置,同时可以让下一个AGV从线体装料运到炒锅 - globalVar.AllowAgvToLineThreeLoadRoller = true; - globalVar.LThreeLoadRoller = false; - globalVar.LThreeAgvToFryPot = false; - globalVar.LThreePotInputMaterialArrive = false; - globalVar.LThreePotOutputRollerArrive = false; - globalVar.LThreeAgvArrivePot = false; + //AgvViewModel.GetInstance().Set小车是否承载物品(3, IsBool.OnllYes); + //AgvViewModel.GetInstance().Set小车运动(3, CartMotionTrajectory.hs_3); + globalVar.LThreeagvFryPotEmptyRollerArrive = false; + globalVar.LThreeInOrOutputLock = false; + + MessageLog.GetInstance.ShowRunLog($"AGV在【{globalVar.LThreeFryPotSerial}】号炒锅将空桶回收到4号滚筒线"); + //AGV拿到空桶,让AGV运桶到指定位置,同时可以让下一个AGV从线体装料运到炒锅 + globalVar.AllowAgvToLineThreeLoadRoller = true; + globalVar.LThreeLoadRoller = false; + globalVar.LThreeAgvToFryPot = false; + globalVar.LThreePotInputMaterialArrive = false; + globalVar.LThreePotOutputRollerArrive = false; + globalVar.LThreeAgvArrivePot = false; - } } - // } + } + // } } } @@ -3710,7 +3710,7 @@ namespace FryPot_DosingSystem.Control /// public void AgvFromLineOneToFryPot() { - erp: if (AlarmHelper.Alarm.LOneRollerTrouble == 0) + erp: if (AlarmHelper.GetInstance().LOneRollerTrouble == 0) { if (globalVar.agvArriveUpLoad && globalVar.LoadRoller && globalVar.rollerLineOne.StationEight == InputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.AgvToFryPot)//无故障 { @@ -3732,7 +3732,7 @@ namespace FryPot_DosingSystem.Control } else//有故障 { - while (AlarmHelper.Alarm.LOneRollerTrouble == 1) + while (AlarmHelper.GetInstance().LOneRollerTrouble == 1) { Thread.Sleep(1000); if (globalVar.ExitLineOneTask) @@ -3748,7 +3748,7 @@ namespace FryPot_DosingSystem.Control /// public void AgvFromLineOneToClean(ushort emptyRollerNum) { - erp: if (AlarmHelper.Alarm.LOneRollerTrouble == 0)//无故障 + erp: if (AlarmHelper.GetInstance().LOneRollerTrouble == 0)//无故障 { if (globalVar.agvArriveLineOneLoadEmptyRoller)//agv到达上料位置 { @@ -3770,7 +3770,7 @@ namespace FryPot_DosingSystem.Control } else//有故障 { - while (AlarmHelper.Alarm.LOneRollerTrouble == 1) + while (AlarmHelper.GetInstance().LOneRollerTrouble == 1) { Thread.Sleep(1000); if (globalVar.ExitLineOneTask) @@ -3788,7 +3788,7 @@ namespace FryPot_DosingSystem.Control /// public void AgvFromLineTwoToFryPot() { - erp: if (AlarmHelper.Alarm.LTwoRollerTrouble == 0)//无故障 + erp: if (AlarmHelper.GetInstance().LTwoRollerTrouble == 0)//无故障 { if (globalVar.agvArriveLTwoUpLoad && globalVar.LTwoLoadRoller && globalVar.rollerLineTwo.StationEight == LTwoInputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.LTwoAgvToFryPot)//无故障 { @@ -3811,7 +3811,7 @@ namespace FryPot_DosingSystem.Control } else//有故障 { - while (AlarmHelper.Alarm.LTwoRollerTrouble == 1) + while (AlarmHelper.GetInstance().LTwoRollerTrouble == 1) { Thread.Sleep(1000); if (globalVar.ExitLineTwoTask) @@ -3827,7 +3827,7 @@ namespace FryPot_DosingSystem.Control /// public void AgvFromLineTwoToClean(ushort emptyRollerNum) { - erp: if (AlarmHelper.Alarm.LTwoRollerTrouble == 0)//无故障 + erp: if (AlarmHelper.GetInstance().LTwoRollerTrouble == 0)//无故障 { if (globalVar.agvArriveLineTwoLoadEmptyRoller)//agv到达上料位置 { @@ -3850,7 +3850,7 @@ namespace FryPot_DosingSystem.Control } else//有故障 { - while (AlarmHelper.Alarm.LTwoRollerTrouble == 1) + while (AlarmHelper.GetInstance().LTwoRollerTrouble == 1) { Thread.Sleep(1000); if (globalVar.ExitLineOneTask) @@ -3868,7 +3868,7 @@ namespace FryPot_DosingSystem.Control /// public void AgvFromLineThreeToFryPot() { - erp: if (AlarmHelper.Alarm.LThreeRollerTrouble == 0)//无故障 + erp: if (AlarmHelper.GetInstance().LThreeRollerTrouble == 0)//无故障 { if (globalVar.agvArriveLThreeUpLoad && globalVar.LThreeLoadRoller && globalVar.rollerLineThree.StationEight == LThreeInputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.LThreeAgvToFryPot)//无故障 { @@ -3891,7 +3891,7 @@ namespace FryPot_DosingSystem.Control } else //有故障 { - while (AlarmHelper.Alarm.LThreeRollerTrouble == 1) + while (AlarmHelper.GetInstance().LThreeRollerTrouble == 1) { Thread.Sleep(1000); if (globalVar.ExitLineThreeTask) @@ -3907,7 +3907,7 @@ namespace FryPot_DosingSystem.Control /// public void AgvFromLineThreeToClean(ushort emptyRollerNum) { - erp: if (AlarmHelper.Alarm.LThreeRollerTrouble == 0)//无故障 + erp: if (AlarmHelper.GetInstance().LThreeRollerTrouble == 0)//无故障 { if (globalVar.agvArriveLineThreeLoadEmptyRoller)//agv到达上料位置 { @@ -3931,7 +3931,7 @@ namespace FryPot_DosingSystem.Control } else//有故障 { - while (AlarmHelper.Alarm.LThreeRollerTrouble == 1) + while (AlarmHelper.GetInstance().LThreeRollerTrouble == 1) { Thread.Sleep(1000); if (globalVar.ExitLineOneTask) @@ -4038,7 +4038,7 @@ namespace FryPot_DosingSystem.Control public void AgvToLineOneLoadRoller() { - if (AlarmHelper.Alarm.LOneRollerTrouble == 0)//输送线无故障 + if (AlarmHelper.GetInstance().LOneRollerTrouble == 0)//输送线无故障 { if (InputMaterialQuene.Count > 0 && globalVar.AllowAgvToLineLoadRoller && globalVar.rollerLineOne.OutMaterialingSingle == 1 && !globalVar.LoadRoller) { @@ -4099,7 +4099,7 @@ namespace FryPot_DosingSystem.Control } public void AgvToLineTwoLoadRoller() { - if (AlarmHelper.Alarm.LTwoRollerTrouble == 0)//输送线无故障 + if (AlarmHelper.GetInstance().LTwoRollerTrouble == 0)//输送线无故障 { if (LTwoInputMaterialQuene.Count > 0 && globalVar.AllowAgvToLineTwoLoadRoller && globalVar.rollerLineTwo.OutMaterialingSingle == 1 && !globalVar.LTwoLoadRoller) { @@ -4154,7 +4154,7 @@ namespace FryPot_DosingSystem.Control } public void AgvToLineThreeLoadRoller() { - if (AlarmHelper.Alarm.LThreeRollerTrouble == 0)//输送线无故障 + if (AlarmHelper.GetInstance().LThreeRollerTrouble == 0)//输送线无故障 { if (LThreeInputMaterialQuene.Count > 0 && globalVar.AllowAgvToLineThreeLoadRoller && globalVar.rollerLineThree.OutMaterialingSingle == 1 && !globalVar.LThreeLoadRoller) { @@ -4452,7 +4452,7 @@ namespace FryPot_DosingSystem.Control switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100) { case 1: - if (AlarmHelper.Alarm.FryPotOneRollerTrouble == 1) + if (AlarmHelper.GetInstance().FryPotOneRollerTrouble == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障"); } @@ -4461,7 +4461,7 @@ namespace FryPot_DosingSystem.Control FryPotAlarm = 1; return; } - while (AlarmHelper.Alarm.FryPotOneRollerTrouble == 1) + while (AlarmHelper.GetInstance().FryPotOneRollerTrouble == 1) { Thread.Sleep(1000); if (globalVar.ExitLineOneTask) return; @@ -4469,7 +4469,7 @@ namespace FryPot_DosingSystem.Control MessageLog.GetInstance.ShowRunLog("炒锅【1】输送滚筒故障解除,继续运行"); FryPotAlarm = 1; break; case 4: - if (AlarmHelper.Alarm.FryPotFourRollerTrouble == 1) { FryPotFourAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotFourAlarm = 1; return; } while (AlarmHelper.Alarm.FryPotFourRollerTrouble == 1) + if (AlarmHelper.GetInstance().FryPotFourRollerTrouble == 1) { FryPotFourAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotFourAlarm = 1; return; } while (AlarmHelper.GetInstance().FryPotFourRollerTrouble == 1) { Thread.Sleep(1000); if (globalVar.ExitLineOneTask) return; @@ -4489,7 +4489,7 @@ namespace FryPot_DosingSystem.Control switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100) { case 2: - if (AlarmHelper.Alarm.FryPotTwoRollerTrouble == 1) { FryPotTwoAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotTwoAlarm = 1; return; } while (AlarmHelper.Alarm.FryPotTwoRollerTrouble == 1) + if (AlarmHelper.GetInstance().FryPotTwoRollerTrouble == 1) { FryPotTwoAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotTwoAlarm = 1; return; } while (AlarmHelper.GetInstance().FryPotTwoRollerTrouble == 1) { Thread.Sleep(1000); if (globalVar.ExitLineTwoTask) return; @@ -4497,7 +4497,7 @@ namespace FryPot_DosingSystem.Control MessageLog.GetInstance.ShowRunLog("炒锅【1】输送滚筒故障解除,继续运行"); FryPotTwoAlarm = 1; break; case 5: - if (AlarmHelper.Alarm.FryPotFiveRollerTrouble == 1) { FryPotFiveAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotFiveAlarm = 1; return; } while (AlarmHelper.Alarm.FryPotFiveRollerTrouble == 1) + if (AlarmHelper.GetInstance().FryPotFiveRollerTrouble == 1) { FryPotFiveAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotFiveAlarm = 1; return; } while (AlarmHelper.GetInstance().FryPotFiveRollerTrouble == 1) { Thread.Sleep(1000); if (globalVar.ExitLineTwoTask) return; @@ -4512,7 +4512,7 @@ namespace FryPot_DosingSystem.Control public void FryPotThreeRollerTroubleCheck() { FryPotThreeAlarm = 0; - if (AlarmHelper.Alarm.FryPotThreeRollerTrouble == 1) { FryPotThreeAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【3】输送滚筒发生故障"); } else { FryPotThreeAlarm = 1; return; } while (AlarmHelper.Alarm.FryPotThreeRollerTrouble == 1) + if (AlarmHelper.GetInstance().FryPotThreeRollerTrouble == 1) { FryPotThreeAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【3】输送滚筒发生故障"); } else { FryPotThreeAlarm = 1; return; } while (AlarmHelper.GetInstance().FryPotThreeRollerTrouble == 1) { Thread.Sleep(1000); if (globalVar.ExitLineThreeTask) return; diff --git a/WPFDemo/Class2.cs b/WPFDemo/Class2.cs new file mode 100644 index 00000000..be7e5f7c --- /dev/null +++ b/WPFDemo/Class2.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using BPASmartClient.CustomResource.Pages.Model; + +namespace WPFDemo +{ + public class Class2 + { + [Alarm("测试报警1")] + public bool TT { get; set; } + + [Alarm("测试报警2")] + public bool CC { get; set; } + } +} diff --git a/WPFDemo/TheListBox.xaml b/WPFDemo/TheListBox.xaml index 433f3c9e..de65695d 100644 --- a/WPFDemo/TheListBox.xaml +++ b/WPFDemo/TheListBox.xaml @@ -1,29 +1,43 @@ - - + + - + - - - - + + + + - - - + + + sdsds sdsds diff --git a/WPFDemo/Window2.xaml b/WPFDemo/Window2.xaml index 96617065..7c1e1da7 100644 --- a/WPFDemo/Window2.xaml +++ b/WPFDemo/Window2.xaml @@ -10,7 +10,8 @@ - + +