Przeglądaj źródła

报警修改

master
pry 1 rok temu
rodzic
commit
524a5cdb19
9 zmienionych plików z 512 dodań i 194 usunięć
  1. +154
    -26
      BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs
  2. +145
    -0
      BPASmartClient.CustomResource/Pages/Model/AlarmTest.cs
  3. +9
    -9
      BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DeviceInquire.cs
  4. +6
    -9
      DosingSystem/Model/DeviceInquire.cs
  5. +128
    -128
      FryPot_DosingSystem/Control/DosingLogicControl.cs
  6. +18
    -0
      WPFDemo/Class2.cs
  7. +35
    -21
      WPFDemo/TheListBox.xaml
  8. +2
    -1
      WPFDemo/Window2.xaml
  9. +15
    -0
      WPFDemo/Window2.xaml.cs

+ 154
- 26
BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs Wyświetl plik

@@ -16,16 +16,15 @@ namespace BPASmartClient.CustomResource.Pages.Model

public class AlarmHelper<AlarmT> where AlarmT : class, new()
{


//private volatile static ConcurrentDictionary<string, AlarmT> _Instance;
//public static AlarmT GetInstance(string name)
//{
// if (_Instance == null) _Instance = new ConcurrentDictionary<string, AlarmT>();
// if (!_Instance.ContainsKey(name)) _Instance.TryAdd(name, new AlarmT());
// return _Instance[name];
//}
//private AlarmHelper() { }
private volatile static ConcurrentDictionary<string, AlarmT> _Instance;
public static AlarmT GetInstance(string name = "")
{
if (string.IsNullOrEmpty(name)) name = typeof(AlarmT).Name;
if (_Instance == null) _Instance = new ConcurrentDictionary<string, AlarmT>();
if (!_Instance.ContainsKey(name)) _Instance.TryAdd(name, new AlarmT());
return _Instance[name];
}
private AlarmHelper() { }


public static ObservableCollection<Alarm> Alarms { get; set; } = new ObservableCollection<Alarm>();
@@ -36,22 +35,29 @@ namespace BPASmartClient.CustomResource.Pages.Model
public static Action<string> 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<AlarmAttribute>();
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<AlarmAttribute>();
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)
//{

//}




/// <summary>
/// 沿报警检测
/// </summary>
@@ -144,4 +141,135 @@ namespace BPASmartClient.CustomResource.Pages.Model
}

}

//public class AlarmHelper<AlarmT> where AlarmT : class, new()
//{


// //private volatile static ConcurrentDictionary<string, AlarmT> _Instance;
// //public static AlarmT GetInstance(string name)
// //{
// // if (_Instance == null) _Instance = new ConcurrentDictionary<string, AlarmT>();
// // if (!_Instance.ContainsKey(name)) _Instance.TryAdd(name, new AlarmT());
// // return _Instance[name];
// //}
// //private AlarmHelper() { }


// public static ObservableCollection<Alarm> Alarms { get; set; } = new ObservableCollection<Alarm>();
// public static List<Alarm> HistoryAlarms { get; set; } = new List<Alarm>();
// static ConcurrentDictionary<string, bool> flagbit = new ConcurrentDictionary<string, bool>();
// static ConcurrentDictionary<string, Delay> delays = new ConcurrentDictionary<string, Delay>();
// public static Action<string> AddAction { get; set; }
// public static Action<string> 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<AlarmAttribute>();
// 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)
// //{

// //}




// /// <summary>
// /// 沿报警检测
// /// </summary>
// /// <param name="Trigger">触发变量</param>
// /// <param name="text">报警信息</param>
// /// <param name="edgeType">触发类型,上升沿 或 下降沿</param>
// 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;
// }

// /// <summary>
// /// 添加报警信息
// /// </summary>
// /// <param name="AlarmInfo">报警信息</param>
// 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<Alarm>.GetInstance.Base.Add(tempAlarm);
// Sqlite<Alarm>.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();//更改报警通知
// }
// }

// /// <summary>
// /// 移除报警信息
// /// </summary>
// /// <param name="AlarmInfo">报警信息</param>
// 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();
// }
// }

//}
}

+ 145
- 0
BPASmartClient.CustomResource/Pages/Model/AlarmTest.cs Wyświetl plik

@@ -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<AlarmT> where AlarmT : class, new()
{


private volatile static ConcurrentDictionary<string, AlarmT> _Instance;
public static AlarmT GetInstance(string name = "")
{
if (string.IsNullOrEmpty(name)) name = typeof(AlarmT).Name;
if (_Instance == null) _Instance = new ConcurrentDictionary<string, AlarmT>();
if (!_Instance.ContainsKey(name)) _Instance.TryAdd(name, new AlarmT());
return _Instance[name];
}
private AlarmTest() { }


public static ObservableCollection<Alarm> Alarms { get; set; } = new ObservableCollection<Alarm>();
public static List<Alarm> HistoryAlarms { get; set; } = new List<Alarm>();
static ConcurrentDictionary<string, bool> flagbit = new ConcurrentDictionary<string, bool>();
static ConcurrentDictionary<string, Delay> delays = new ConcurrentDictionary<string, Delay>();
public static Action<string> AddAction { get; set; }
public static Action<string> 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<AlarmAttribute>();
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},报警通用模块监听");

}

/// <summary>
/// 沿报警检测
/// </summary>
/// <param name="Trigger">触发变量</param>
/// <param name="text">报警信息</param>
/// <param name="edgeType">触发类型,上升沿 或 下降沿</param>
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;
}

/// <summary>
/// 添加报警信息
/// </summary>
/// <param name="AlarmInfo">报警信息</param>
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<Alarm>.GetInstance.Base.Add(tempAlarm);
Sqlite<Alarm>.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();//更改报警通知
}
}

/// <summary>
/// 移除报警信息
/// </summary>
/// <param name="AlarmInfo">报警信息</param>
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();
}
}

}

}

+ 9
- 9
BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DeviceInquire.cs Wyświetl plik

@@ -100,8 +100,8 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
public void Init()
{
AlarmHelper<AlarmInfo>.Init();
AlarmHelper<AlarmInfo>.Alarm.EStop1 = true;
//AlarmHelper<AlarmInfo>.Init();
//AlarmHelper<AlarmInfo>.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<AlarmInfo>.Alarm.EStop1 = deviceStatus.DeviceAlarmCode.Get16bitValue(1);
AlarmHelper<AlarmInfo>.Alarm.Servo = deviceStatus.DeviceAlarmCode.Get16bitValue(2);
AlarmHelper<AlarmInfo>.Alarm.Inverter = deviceStatus.DeviceAlarmCode.Get16bitValue(3);
AlarmHelper<AlarmInfo>.Alarm.EStop2 = deviceStatus.DeviceAlarmCode.Get16bitValue(7);
AlarmHelper<AlarmInfo>.Alarm.SiloUpperLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(8);
AlarmHelper<AlarmInfo>.Alarm.SiloLowerLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(9);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).EStop1 = deviceStatus.DeviceAlarmCode.Get16bitValue(1);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).Servo = deviceStatus.DeviceAlarmCode.Get16bitValue(2);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).Inverter = deviceStatus.DeviceAlarmCode.Get16bitValue(3);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).EStop2 = deviceStatus.DeviceAlarmCode.Get16bitValue(7);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).SiloUpperLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(8);
AlarmHelper<AlarmInfo>.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);
}



+ 6
- 9
DosingSystem/Model/DeviceInquire.cs Wyświetl plik

@@ -311,15 +311,12 @@ namespace BPASmartClient.DosingSystem
deviceStatus.DeviceNum = (ushort)this.modbusTcp.ReadShort(DeviceAddress.DeviceNum);//获取设备编号
deviceStatus.DeviceAlarmCode = (ushort)this.modbusTcp.ReadShort(DeviceAddress.DeviceAlarmCode);//获取设备故障编码

AlarmHelper<AlarmInfo>.Alarm.EStop1 = deviceStatus.DeviceAlarmCode.Get16bitValue(1);
AlarmHelper<AlarmInfo>.Alarm.Servo = deviceStatus.DeviceAlarmCode.Get16bitValue(2);
AlarmHelper<AlarmInfo>.Alarm.Inverter = deviceStatus.DeviceAlarmCode.Get16bitValue(3);
AlarmHelper<AlarmInfo>.Alarm.EStop2 = deviceStatus.DeviceAlarmCode.Get16bitValue(7);
AlarmHelper<AlarmInfo>.Alarm.SiloUpperLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(8);
AlarmHelper<AlarmInfo>.Alarm.SiloLowerLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(9);

AlarmHelper<AlarmInfo>("dd").Alarm.SiloLowerLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(9);

AlarmHelper<AlarmInfo>.GetInstance(DeviceName).EStop1 = deviceStatus.DeviceAlarmCode.Get16bitValue(1);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).Servo = deviceStatus.DeviceAlarmCode.Get16bitValue(2);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).Inverter = deviceStatus.DeviceAlarmCode.Get16bitValue(3);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).EStop2 = deviceStatus.DeviceAlarmCode.Get16bitValue(7);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).SiloUpperLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(8);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).SiloLowerLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(9);
Thread.Sleep(100);
}), $"{DeviceName} 开始监听", true);
}


+ 128
- 128
FryPot_DosingSystem/Control/DosingLogicControl.cs Wyświetl plik

@@ -1408,13 +1408,13 @@ namespace FryPot_DosingSystem.Control
globalVar.rollerLineTwo.OutMaterialingSingle = data[4];
globalVar.rollerLineThree.OutMaterialingSingle = data[5];

AlarmHelper<AlarmInfo>.Alarm.LineOneRollerRunning = data[3];
AlarmHelper<AlarmInfo>.Alarm.LineTwoRollerRunning = data[4];
AlarmHelper<AlarmInfo>.Alarm.LineThreeRollerRunning = data[5];
AlarmHelper<AlarmInfo>.GetInstance().LineOneRollerRunning = data[3];
AlarmHelper<AlarmInfo>.GetInstance().LineTwoRollerRunning = data[4];
AlarmHelper<AlarmInfo>.GetInstance().LineThreeRollerRunning = data[5];

AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble = data[6];
AlarmHelper<AlarmInfo>.Alarm.LTwoRollerTrouble = data[7];
AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble = data[8];
AlarmHelper<AlarmInfo>.GetInstance().LOneRollerTrouble = data[6];
AlarmHelper<AlarmInfo>.GetInstance().LTwoRollerTrouble = data[7];
AlarmHelper<AlarmInfo>.GetInstance().LThreeRollerTrouble = data[8];

}));
GetAddressData("D2040", new Action<ushort[]>((data) =>
@@ -1425,11 +1425,11 @@ namespace FryPot_DosingSystem.Control
globalVar.fryPotFour.InputMaterialRollerRunningSingle = data[3];
globalVar.fryPotFive.InputMaterialRollerRunningSingle = data[4];

AlarmHelper<AlarmInfo>.Alarm.FryPotOneRollerRunning = data[0];
AlarmHelper<AlarmInfo>.Alarm.FryPotTwoRollerRunning = data[1];
AlarmHelper<AlarmInfo>.Alarm.FryPotThreeRollerRunning = data[2];
AlarmHelper<AlarmInfo>.Alarm.FryPotFourRollerRunning = data[3];
AlarmHelper<AlarmInfo>.Alarm.FryPotFiveRollerRunning = data[4];
AlarmHelper<AlarmInfo>.GetInstance().FryPotOneRollerRunning = data[0];
AlarmHelper<AlarmInfo>.GetInstance().FryPotTwoRollerRunning = data[1];
AlarmHelper<AlarmInfo>.GetInstance().FryPotThreeRollerRunning = data[2];
AlarmHelper<AlarmInfo>.GetInstance().FryPotFourRollerRunning = data[3];
AlarmHelper<AlarmInfo>.GetInstance().FryPotFiveRollerRunning = data[4];

}));
GetAddressData("D2045", new Action<ushort[]>((data) =>
@@ -1456,11 +1456,11 @@ namespace FryPot_DosingSystem.Control
globalVar.fryPotFour.EmptyBarrelRollerRunningSingle = data[3];
globalVar.fryPotFive.EmptyBarrelRollerRunningSingle = data[4];

AlarmHelper<AlarmInfo>.Alarm.FryPotOneEmptyRollerRunning = data[0];
AlarmHelper<AlarmInfo>.Alarm.FryPotTwoEmptyRollerRunning = data[1];
AlarmHelper<AlarmInfo>.Alarm.FryPotThreeEmptyRollerRunning = data[2];
AlarmHelper<AlarmInfo>.Alarm.FryPotFourEmptyRollerRunning = data[3];
AlarmHelper<AlarmInfo>.Alarm.FryPotFiveEmptyRollerRunning = data[4];
AlarmHelper<AlarmInfo>.GetInstance().FryPotOneEmptyRollerRunning = data[0];
AlarmHelper<AlarmInfo>.GetInstance().FryPotTwoEmptyRollerRunning = data[1];
AlarmHelper<AlarmInfo>.GetInstance().FryPotThreeEmptyRollerRunning = data[2];
AlarmHelper<AlarmInfo>.GetInstance().FryPotFourEmptyRollerRunning = data[3];
AlarmHelper<AlarmInfo>.GetInstance().FryPotFiveEmptyRollerRunning = data[4];
}));
GetAddressData("D2070", new Action<ushort[]>((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<AlarmInfo>.Alarm.FryPotOneRollerTrouble = data[0];
AlarmHelper<AlarmInfo>.Alarm.FryPotTwoRollerTrouble = data[1];
AlarmHelper<AlarmInfo>.Alarm.FryPotThreeRollerTrouble = data[2];
AlarmHelper<AlarmInfo>.Alarm.FryPotFourRollerTrouble = data[3];
AlarmHelper<AlarmInfo>.Alarm.FryPotFiveRollerTrouble = data[4];
AlarmHelper<AlarmInfo>.GetInstance().FryPotOneRollerTrouble = data[0];
AlarmHelper<AlarmInfo>.GetInstance().FryPotTwoRollerTrouble = data[1];
AlarmHelper<AlarmInfo>.GetInstance().FryPotThreeRollerTrouble = data[2];
AlarmHelper<AlarmInfo>.GetInstance().FryPotFourRollerTrouble = data[3];
AlarmHelper<AlarmInfo>.GetInstance().FryPotFiveRollerTrouble = data[4];
}));
GetAddressData("D2078", new Action<ushort[]>(data =>
{
@@ -1483,7 +1483,7 @@ namespace FryPot_DosingSystem.Control
}));
GetAddressData("D2075", new Action<ushort[]>(data =>
{
AlarmHelper<AlarmInfo>.Alarm.CleanEnterRollerRunning = data[0];
AlarmHelper<AlarmInfo>.GetInstance().CleanEnterRollerRunning = data[0];
globalVar.CleadBarrelEnterSingle = data[0];
}));
GetAddressData("2076", new Action<ushort[]>(data =>
@@ -1493,7 +1493,7 @@ namespace FryPot_DosingSystem.Control
}));
GetAddressData("D2077", new Action<ushort[]>(data =>
{
AlarmHelper<AlarmInfo>.Alarm.CleanOutputRollerRunning = data[0];
AlarmHelper<AlarmInfo>.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<AlarmInfo>.Alarm.LOneRollerTrouble == 0)
if (AlarmHelper<AlarmInfo>.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<AlarmInfo>.Alarm.LTwoRollerTrouble == 0)
if (AlarmHelper<AlarmInfo>.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<AlarmInfo>.Alarm.LThreeRollerTrouble == 0)
if (AlarmHelper<AlarmInfo>.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<AlarmInfo>.Alarm.CleanOutputRollerRunning == 0)
erp: if (AlarmHelper<AlarmInfo>.GetInstance().CleanOutputRollerRunning == 0)
{
//plc交互
WritePlcData("D1066", 1);//AGV空桶出桶就位信号下发PlC
@@ -2131,7 +2131,7 @@ namespace FryPot_DosingSystem.Control
}
else//有故障
{
while (AlarmHelper<AlarmInfo>.Alarm.CleanOutputRollerRunning == 1)
while (AlarmHelper<AlarmInfo>.GetInstance().CleanOutputRollerRunning == 1)
{
Thread.Sleep(1000);
if (globalVar.ExitLineOneTask)
@@ -2148,7 +2148,7 @@ namespace FryPot_DosingSystem.Control
/// </summary>
private void AgvFromLineOneToCleanPlate()
{
if (AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble == 0)//输送线无故障
if (AlarmHelper<AlarmInfo>.GetInstance().LOneRollerTrouble == 0)//输送线无故障
{
//线体1到清洗台
if (!globalVar.rollerLineOne.IsEpmtyBefore && globalVar.rollerLineOne.CanRun)
@@ -2192,7 +2192,7 @@ namespace FryPot_DosingSystem.Control
{

// 线体2到清洗台
if (AlarmHelper<AlarmInfo>.Alarm.LTwoRollerTrouble == 0)//输送线无故障
if (AlarmHelper<AlarmInfo>.GetInstance().LTwoRollerTrouble == 0)//输送线无故障
{
if (!globalVar.rollerLineTwo.IsEpmtyBefore && globalVar.rollerLineTwo.CanRun)
{
@@ -2234,7 +2234,7 @@ namespace FryPot_DosingSystem.Control
private void AgvFromLineThreeToCleanPlate()
{
//线体3到清洗台
if (AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble == 0)//输送线无故障
if (AlarmHelper<AlarmInfo>.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<AlarmInfo>.Alarm.CleanEnterRollerRunning == 0)
erp: if (AlarmHelper<AlarmInfo>.GetInstance().CleanEnterRollerRunning == 0)
{
//plc交互
WritePlcData("D1065", 1);//AGV空桶洗桶就位信号下发PLC
@@ -2287,7 +2287,7 @@ namespace FryPot_DosingSystem.Control
}
else//有故障
{
while (AlarmHelper<AlarmInfo>.Alarm.CleanEnterRollerRunning == 1)
while (AlarmHelper<AlarmInfo>.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<AlarmInfo>.Alarm.CleanEnterRollerRunning == 0)
erp: if (AlarmHelper<AlarmInfo>.GetInstance().CleanEnterRollerRunning == 0)
{
//plc交互
WritePlcData("D1065", 1);//AGV空桶洗桶就位信号下发PLC
@@ -2319,7 +2319,7 @@ namespace FryPot_DosingSystem.Control
}
else//有故障
{
while (AlarmHelper<AlarmInfo>.Alarm.CleanEnterRollerRunning == 1)
while (AlarmHelper<AlarmInfo>.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<AlarmInfo>.Alarm.CleanEnterRollerRunning == 0)
erp: if (AlarmHelper<AlarmInfo>.GetInstance().CleanEnterRollerRunning == 0)
{
//plc交互
WritePlcData("D1065", 1);//AGV空桶洗桶就位信号下发PLC
@@ -2350,7 +2350,7 @@ namespace FryPot_DosingSystem.Control
}
else//有故障
{
while (AlarmHelper<AlarmInfo>.Alarm.CleanEnterRollerRunning == 1)
while (AlarmHelper<AlarmInfo>.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
/// <param name="lineAlarm"></param>
public void AgvFromLineOneToFryPot()
{
erp: if (AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble == 0)
erp: if (AlarmHelper<AlarmInfo>.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<AlarmInfo>.Alarm.LOneRollerTrouble == 1)
while (AlarmHelper<AlarmInfo>.GetInstance().LOneRollerTrouble == 1)
{
Thread.Sleep(1000);
if (globalVar.ExitLineOneTask)
@@ -3748,7 +3748,7 @@ namespace FryPot_DosingSystem.Control
/// </summary>
public void AgvFromLineOneToClean(ushort emptyRollerNum)
{
erp: if (AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble == 0)//无故障
erp: if (AlarmHelper<AlarmInfo>.GetInstance().LOneRollerTrouble == 0)//无故障
{
if (globalVar.agvArriveLineOneLoadEmptyRoller)//agv到达上料位置
{
@@ -3770,7 +3770,7 @@ namespace FryPot_DosingSystem.Control
}
else//有故障
{
while (AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble == 1)
while (AlarmHelper<AlarmInfo>.GetInstance().LOneRollerTrouble == 1)
{
Thread.Sleep(1000);
if (globalVar.ExitLineOneTask)
@@ -3788,7 +3788,7 @@ namespace FryPot_DosingSystem.Control
/// <param name="lineAlarm"></param>
public void AgvFromLineTwoToFryPot()
{
erp: if (AlarmHelper<AlarmInfo>.Alarm.LTwoRollerTrouble == 0)//无故障
erp: if (AlarmHelper<AlarmInfo>.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<AlarmInfo>.Alarm.LTwoRollerTrouble == 1)
while (AlarmHelper<AlarmInfo>.GetInstance().LTwoRollerTrouble == 1)
{
Thread.Sleep(1000);
if (globalVar.ExitLineTwoTask)
@@ -3827,7 +3827,7 @@ namespace FryPot_DosingSystem.Control
/// </summary>
public void AgvFromLineTwoToClean(ushort emptyRollerNum)
{
erp: if (AlarmHelper<AlarmInfo>.Alarm.LTwoRollerTrouble == 0)//无故障
erp: if (AlarmHelper<AlarmInfo>.GetInstance().LTwoRollerTrouble == 0)//无故障
{
if (globalVar.agvArriveLineTwoLoadEmptyRoller)//agv到达上料位置
{
@@ -3850,7 +3850,7 @@ namespace FryPot_DosingSystem.Control
}
else//有故障
{
while (AlarmHelper<AlarmInfo>.Alarm.LTwoRollerTrouble == 1)
while (AlarmHelper<AlarmInfo>.GetInstance().LTwoRollerTrouble == 1)
{
Thread.Sleep(1000);
if (globalVar.ExitLineOneTask)
@@ -3868,7 +3868,7 @@ namespace FryPot_DosingSystem.Control
/// <param name="lineAlarm"></param>
public void AgvFromLineThreeToFryPot()
{
erp: if (AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble == 0)//无故障
erp: if (AlarmHelper<AlarmInfo>.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<AlarmInfo>.Alarm.LThreeRollerTrouble == 1)
while (AlarmHelper<AlarmInfo>.GetInstance().LThreeRollerTrouble == 1)
{
Thread.Sleep(1000);
if (globalVar.ExitLineThreeTask)
@@ -3907,7 +3907,7 @@ namespace FryPot_DosingSystem.Control
/// </summary>
public void AgvFromLineThreeToClean(ushort emptyRollerNum)
{
erp: if (AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble == 0)//无故障
erp: if (AlarmHelper<AlarmInfo>.GetInstance().LThreeRollerTrouble == 0)//无故障
{
if (globalVar.agvArriveLineThreeLoadEmptyRoller)//agv到达上料位置
{
@@ -3931,7 +3931,7 @@ namespace FryPot_DosingSystem.Control
}
else//有故障
{
while (AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble == 1)
while (AlarmHelper<AlarmInfo>.GetInstance().LThreeRollerTrouble == 1)
{
Thread.Sleep(1000);
if (globalVar.ExitLineOneTask)
@@ -4038,7 +4038,7 @@ namespace FryPot_DosingSystem.Control

public void AgvToLineOneLoadRoller()
{
if (AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble == 0)//输送线无故障
if (AlarmHelper<AlarmInfo>.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<AlarmInfo>.Alarm.LTwoRollerTrouble == 0)//输送线无故障
if (AlarmHelper<AlarmInfo>.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<AlarmInfo>.Alarm.LThreeRollerTrouble == 0)//输送线无故障
if (AlarmHelper<AlarmInfo>.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<AlarmInfo>.Alarm.FryPotOneRollerTrouble == 1)
if (AlarmHelper<AlarmInfo>.GetInstance().FryPotOneRollerTrouble == 1)
{
FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障");
}
@@ -4461,7 +4461,7 @@ namespace FryPot_DosingSystem.Control
FryPotAlarm = 1; return;

}
while (AlarmHelper<AlarmInfo>.Alarm.FryPotOneRollerTrouble == 1)
while (AlarmHelper<AlarmInfo>.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<AlarmInfo>.Alarm.FryPotFourRollerTrouble == 1) { FryPotFourAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotFourAlarm = 1; return; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotFourRollerTrouble == 1)
if (AlarmHelper<AlarmInfo>.GetInstance().FryPotFourRollerTrouble == 1) { FryPotFourAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotFourAlarm = 1; return; } while (AlarmHelper<AlarmInfo>.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<AlarmInfo>.Alarm.FryPotTwoRollerTrouble == 1) { FryPotTwoAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotTwoAlarm = 1; return; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotTwoRollerTrouble == 1)
if (AlarmHelper<AlarmInfo>.GetInstance().FryPotTwoRollerTrouble == 1) { FryPotTwoAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotTwoAlarm = 1; return; } while (AlarmHelper<AlarmInfo>.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<AlarmInfo>.Alarm.FryPotFiveRollerTrouble == 1) { FryPotFiveAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotFiveAlarm = 1; return; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotFiveRollerTrouble == 1)
if (AlarmHelper<AlarmInfo>.GetInstance().FryPotFiveRollerTrouble == 1) { FryPotFiveAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotFiveAlarm = 1; return; } while (AlarmHelper<AlarmInfo>.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<AlarmInfo>.Alarm.FryPotThreeRollerTrouble == 1) { FryPotThreeAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【3】输送滚筒发生故障"); } else { FryPotThreeAlarm = 1; return; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotThreeRollerTrouble == 1)
if (AlarmHelper<AlarmInfo>.GetInstance().FryPotThreeRollerTrouble == 1) { FryPotThreeAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【3】输送滚筒发生故障"); } else { FryPotThreeAlarm = 1; return; } while (AlarmHelper<AlarmInfo>.GetInstance().FryPotThreeRollerTrouble == 1)
{
Thread.Sleep(1000); if (globalVar.ExitLineThreeTask)
return;


+ 18
- 0
WPFDemo/Class2.cs Wyświetl plik

@@ -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; }
}
}

+ 35
- 21
WPFDemo/TheListBox.xaml Wyświetl plik

@@ -1,29 +1,43 @@
<UserControl x:Class="WPFDemo.TheListBox"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:WPFDemo"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<ListView x:Name="listView"
ItemsSource="{Binding ViewItems,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Background="{x:Null}" Foreground="White"
PreviewMouseMove="ListView_PreviewMouseMove"
PreviewMouseLeftButtonUp="lisbox_PreviewMouseLeftButtonUp">
<UserControl
x:Class="WPFDemo.TheListBox"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:WPFDemo"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<ListView
x:Name="listView"
Background="{x:Null}"
Foreground="White"
ItemsSource="{Binding ViewItems, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
PreviewMouseLeftButtonUp="lisbox_PreviewMouseLeftButtonUp"
PreviewMouseMove="ListView_PreviewMouseMove">
<ListBox.ItemTemplate>
<ItemContainerTemplate>
<Border x:Name="border" Tag="border" BorderBrush="Aquamarine" MouseLeftButtonDown="Border_MouseLeftButtonDown" BorderThickness="1" Padding="5" Background="#FF18888A">
<Border
x:Name="border"
Padding="5"
Background="#FF18888A"
BorderBrush="Aquamarine"
BorderThickness="1"
MouseLeftButtonDown="Border_MouseLeftButtonDown"
Tag="border">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="60"/>
<ColumnDefinition/>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="60"/>
<ColumnDefinition Width="60" />
<ColumnDefinition />
<ColumnDefinition Width="100" />
<ColumnDefinition Width="60" />
</Grid.ColumnDefinitions>
<TextBlock Margin="10,0,10,0" Grid.Column="0" Text="{Binding Name,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Grid.Column="1" Text="{Binding Ph,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBox Width="100" Grid.Column="1"></TextBox>
<TextBlock
Grid.Column="0"
Margin="10,0,10,0"
Text="{Binding Name, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Grid.Column="1" Text="{Binding Ph, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" />
<TextBox Grid.Column="1" Width="100" />
<ComboBox Grid.Column="2" Width="60">
<ComboBoxItem>sdsds</ComboBoxItem>
<ComboBoxItem>sdsds</ComboBoxItem>


+ 2
- 1
WPFDemo/Window2.xaml Wyświetl plik

@@ -10,7 +10,8 @@
<Canvas.Background>
<ImageBrush ImageSource="/bj.png"/>
</Canvas.Background>
<local:TheListBox Canvas.Left="180" Canvas.Top="100" HorizontalAlignment="Right" Grid.Row="1"></local:TheListBox>
<Button Width="100" Height="30" Click="Button_Click"/>
</Canvas>
</Window>

+ 15
- 0
WPFDemo/Window2.xaml.cs Wyświetl plik

@@ -15,6 +15,7 @@ using System.Windows.Media;
using System.Windows.Media.Effects;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using BPASmartClient.CustomResource.Pages.Model;

namespace WPFDemo
{
@@ -26,6 +27,20 @@ namespace WPFDemo
public Window2()
{
InitializeComponent();
AlarmHelper<Class2>.Init();
AlarmHelper<Class2>.GetInstance("设备1").TT = true;
AlarmHelper<Class2>.GetInstance("设备1").CC = true;
AlarmHelper<Class2>.GetInstance("设备2").TT = true;
AlarmHelper<Class2>.GetInstance("设备2").CC = true;

//AlarmHelper<Class2>.GetInstance().TT = true;
//AlarmHelper<Class2>.GetInstance().CC = true;

}

private void Button_Click(object sender, RoutedEventArgs e)
{
var res = AlarmHelper<Class2>.Alarms;
}
}
}

Ładowanie…
Anuluj
Zapisz