Browse Source

1

JXJAgvReake
pry 1 year ago
parent
commit
c8c0f36f13
11 changed files with 16 additions and 146 deletions
  1. +1
    -1
      BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
  2. +5
    -135
      BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs
  3. +1
    -1
      BPASmartClient.IceMaker/IceMakerMachine.cs
  4. +1
    -1
      BPASmartClient.JakaRobot/BPASmartClient.JakaRobot.csproj
  5. +1
    -1
      BPASmartClient.Modbus/BPASmartClient.Modbus.csproj
  6. +1
    -1
      BPASmartClient.Model/BPASmartClient.Model.csproj
  7. +1
    -1
      BPASmartClient.Nfc/BPASmartClient.Nfc.csproj
  8. +1
    -1
      BPASmartClient.S7Net/BPASmartClient.S7Net.csproj
  9. +2
    -2
      BPASmartClient.SerialPort/BPASmartClient.SerialPort.csproj
  10. +1
    -1
      BPASmartClient.Update/BPASmartClient.Update.csproj
  11. +1
    -1
      DosingSystem/BPASmartClient.DosingSystem.csproj

+ 1
- 1
BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj View File

@@ -459,7 +459,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BPA.Helper" Version="1.0.65" />
<PackageReference Include="BPA.Helper" Version="1.0.66" />
<PackageReference Include="BPA.Message" Version="1.0.86" />
<PackageReference Include="MahApps.Metro.IconPacks.FontAwesome" Version="4.11.0" />
</ItemGroup>


+ 5
- 135
BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs View File

@@ -31,8 +31,8 @@ namespace BPASmartClient.CustomResource.Pages.Model
private AlarmHelper() { }


public static ObservableCollection<Alarm> Alarms { get; set; } = new ObservableCollection<Alarm>();
public static List<Alarm> HistoryAlarms { get; set; } = new List<Alarm>();
public static ObservableCollection<BPASmartClient.Model.Alarm> Alarms { get; set; } = new ObservableCollection<BPASmartClient.Model.Alarm>();
public static List<BPASmartClient.Model.Alarm> HistoryAlarms { get; set; } = new List<BPASmartClient.Model.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; }
@@ -97,7 +97,7 @@ namespace BPASmartClient.CustomResource.Pages.Model
/// <param name="AlarmInfo">报警信息</param>
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<Alarm>.GetInstance.Base.Add(tempAlarm);
Sqlite<Alarm>.GetInstance.Save();
var res = Sqlite<BPASmartClient.Model.Alarm>.GetInstance.Base.Add(tempAlarm);
Sqlite<BPASmartClient.Model.Alarm>.GetInstance.Save();

if (Alarms.FirstOrDefault(p => p.Info == AlarmInfo) == null)
{
@@ -145,134 +145,4 @@ 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();
// }
// }

//}
}

+ 1
- 1
BPASmartClient.IceMaker/IceMakerMachine.cs View File

@@ -3,7 +3,7 @@ using BPA.Helper;
using BPASmartClient.Model;
using BPASmartClient.Peripheral;
using BPASmartClient.SerialPort;
using static BPA.Helper.EventBus;

namespace BPASmartClient.IceMaker
{


+ 1
- 1
BPASmartClient.JakaRobot/BPASmartClient.JakaRobot.csproj View File

@@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.Helper" Version="1.0.65" />
<PackageReference Include="BPA.Helper" Version="1.0.66" />
</ItemGroup>

</Project>

+ 1
- 1
BPASmartClient.Modbus/BPASmartClient.Modbus.csproj View File

@@ -5,7 +5,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.Helper" Version="1.0.65" />
<PackageReference Include="BPA.Helper" Version="1.0.66" />
<PackageReference Include="NModbus" Version="3.0.72" />
<PackageReference Include="System.IO.Ports" Version="6.0.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="6.0.0" />


+ 1
- 1
BPASmartClient.Model/BPASmartClient.Model.csproj View File

@@ -13,7 +13,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BPA.Helper" Version="1.0.65" />
<PackageReference Include="BPA.Helper" Version="1.0.66" />
<PackageReference Include="BPA.Message" Version="1.0.86" />
</ItemGroup>



+ 1
- 1
BPASmartClient.Nfc/BPASmartClient.Nfc.csproj View File

@@ -21,7 +21,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BPA.Helper" Version="1.0.65" />
<PackageReference Include="BPA.Helper" Version="1.0.66" />
</ItemGroup>

</Project>

+ 1
- 1
BPASmartClient.S7Net/BPASmartClient.S7Net.csproj View File

@@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.Helper" Version="1.0.65" />
<PackageReference Include="BPA.Helper" Version="1.0.66" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="S7netplus" Version="0.14.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="6.0.0" />


+ 2
- 2
BPASmartClient.SerialPort/BPASmartClient.SerialPort.csproj View File

@@ -5,8 +5,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.Helper" Version="1.0.64" />
<PackageReference Include="System.IO.Ports" Version="6.0.0" />
<PackageReference Include="BPA.Helper" Version="1.0.66" />
<PackageReference Include="System.IO.Ports" Version="7.0.0" />
</ItemGroup>

</Project>

+ 1
- 1
BPASmartClient.Update/BPASmartClient.Update.csproj View File

@@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.Helper" Version="1.0.65" />
<PackageReference Include="BPA.Helper" Version="1.0.66" />
</ItemGroup>

</Project>

+ 1
- 1
DosingSystem/BPASmartClient.DosingSystem.csproj View File

@@ -21,7 +21,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BPA.Helper" Version="1.0.65" />
<PackageReference Include="BPA.Helper" Version="1.0.66" />
<PackageReference Include="BPA.Message" Version="1.0.86" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>


Loading…
Cancel
Save