diff --git a/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj b/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
index c514ab2e..fbb4b445 100644
--- a/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
+++ b/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
@@ -236,6 +236,12 @@
+
+
+
+
+
+
diff --git a/BPASmartClient.CustomResource/Pages/Model/AlarmAttribute.cs b/BPASmartClient.CustomResource/Pages/Model/AlarmAttribute.cs
new file mode 100644
index 00000000..391c0941
--- /dev/null
+++ b/BPASmartClient.CustomResource/Pages/Model/AlarmAttribute.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.CustomResource.Pages.Model
+{
+ [AttributeUsage(AttributeTargets.Property)]
+ public class AlarmAttribute : Attribute
+ {
+ public AlarmAttribute(string Info, AlarmTriggerType alarmTriggerType = AlarmTriggerType.Rising, AlarmLevel alarmLevel = AlarmLevel.一般报警)
+ {
+ AlarmInfo = Info;
+ AlarmType = alarmTriggerType;
+ @AlarmLevel = alarmLevel;
+ }
+
+ ///
+ /// 报警信息
+ ///
+ public string AlarmInfo { get; set; }
+
+ ///
+ /// 告警类型
+ ///
+ public AlarmTriggerType AlarmType { get; set; }
+
+ ///
+ /// 告警级别
+ ///
+ public AlarmLevel @AlarmLevel { get; set; }
+ }
+}
diff --git a/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs b/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs
new file mode 100644
index 00000000..96bdab04
--- /dev/null
+++ b/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs
@@ -0,0 +1,126 @@
+using BPASmartClient.Helper;
+using BPASmartClient.Message;
+using BPASmartClient.Model;
+using System;
+using System.Collections.Concurrent;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Collections.ObjectModel;
+using System.Windows;
+
+namespace BPASmartClient.CustomResource.Pages.Model
+{
+ public class AlarmHelper where AlarmT : class, new()
+ {
+ 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()
+ {
+ 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);
+ }), "报警通用模块监听");
+
+ }
+
+ ///
+ /// 沿报警检测
+ ///
+ /// 触发变量
+ /// 报警信息
+ /// 触发类型,上升沿 或 下降沿
+ 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();//更改报警通知
+ MessageLog.GetInstance.AddDeviceAlarmLogShow(tempAlarm.Info, Guid.NewGuid().ToString());
+ }
+ }
+
+ ///
+ /// 移除报警信息
+ ///
+ /// 报警信息
+ 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/AlarmLevel.cs b/BPASmartClient.CustomResource/Pages/Model/AlarmLevel.cs
new file mode 100644
index 00000000..f5e18422
--- /dev/null
+++ b/BPASmartClient.CustomResource/Pages/Model/AlarmLevel.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.CustomResource.Pages.Model
+{
+ public enum AlarmLevel
+ {
+ 一般报警,
+ 严重报警
+ }
+}
diff --git a/BPASmartClient.CustomResource/Pages/Model/AlarmTriggerType.cs b/BPASmartClient.CustomResource/Pages/Model/AlarmTriggerType.cs
new file mode 100644
index 00000000..2fdb7e72
--- /dev/null
+++ b/BPASmartClient.CustomResource/Pages/Model/AlarmTriggerType.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.CustomResource.Pages.Model
+{
+ public enum AlarmTriggerType
+ {
+ ///
+ /// 上升沿
+ ///
+ Rising,
+ ///
+ /// 下降沿
+ ///
+ Falling
+ }
+}
diff --git a/BPASmartClient.CustomResource/Pages/View/AlarmView.xaml b/BPASmartClient.CustomResource/Pages/View/AlarmView.xaml
new file mode 100644
index 00000000..9e780547
--- /dev/null
+++ b/BPASmartClient.CustomResource/Pages/View/AlarmView.xaml
@@ -0,0 +1,379 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BPASmartClient.CustomResource/Pages/View/AlarmView.xaml.cs b/BPASmartClient.CustomResource/Pages/View/AlarmView.xaml.cs
new file mode 100644
index 00000000..a21a82bf
--- /dev/null
+++ b/BPASmartClient.CustomResource/Pages/View/AlarmView.xaml.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace BPASmartClient.CustomResource.Pages.View
+{
+ ///
+ /// AlarmView.xaml 的交互逻辑
+ ///
+ public partial class AlarmView : UserControl
+ {
+ public AlarmView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/BPASmartClient.CustomResource/Pages/ViewModel/AlarmViewModel.cs b/BPASmartClient.CustomResource/Pages/ViewModel/AlarmViewModel.cs
new file mode 100644
index 00000000..b3c58e0d
--- /dev/null
+++ b/BPASmartClient.CustomResource/Pages/ViewModel/AlarmViewModel.cs
@@ -0,0 +1,140 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+using System.Collections.Concurrent;
+using System.Collections.ObjectModel;
+using System.Windows;
+using BPASmartClient.Helper;
+using Microsoft.Toolkit.Mvvm.Input;
+using BPASmartClient.Model;
+using BPASmartClient.CustomResource.Pages.Model;
+
+namespace BPASmartClient.CustomResource.Pages.ViewModel
+{
+ public class AlarmViewModel : ObservableObject
+ {
+ public AlarmViewModel()
+ {
+ ControlCommand = new RelayCommand(() =>
+ {
+ if (ControlButText == "报警复位")
+ {
+ return;
+ }
+ if (ControlButText == "开始查询")
+ {
+ var lists = Sqlite.GetInstance.GetData();
+ var res = lists.Where(p => Convert.ToDateTime(p.Date) >= StartDateTime && Convert.ToDateTime(p.Date) <= EndDateTime).ToList();
+ if (res != null)
+ {
+ HistoryAlarm.Clear();
+ foreach (var item in res)
+ {
+ HistoryAlarm.Add(item);
+ }
+ }
+ }
+
+ });
+
+ SwitchCommand = new RelayCommand(() =>
+ {
+ if (ButContent == "历史报警")
+ {
+ GetHistoryAlarm();
+ CurrentDataVis = Visibility.Hidden;
+ HistoryDataVis = Visibility.Visible;
+ IsVisibility = Visibility.Visible;
+ ControlButText = "开始查询";
+ ButContent = "实时报警";
+ return;
+ }
+
+ if (ButContent == "实时报警")
+ {
+ HistoryDataVis = Visibility.Hidden;
+ CurrentDataVis = Visibility.Visible;
+ IsVisibility = Visibility.Hidden;
+ ControlButText = "报警复位";
+ ButContent = "历史报警";
+ return;
+ }
+ });
+
+ //AlarmInfos = AlarmHelper.Alarms;
+ //AlarmHelper.Init();
+ }
+
+ private void GetHistoryAlarm()
+ {
+ var data = Sqlite.GetInstance.GetData();
+ if (data != null)
+ {
+ HistoryAlarm.Clear();
+ foreach (var item in data)
+ {
+ int day = DateTime.Now.Subtract(Convert.ToDateTime(item.Date)).Days;
+ if (day == 0)
+ {
+ HistoryAlarm.Add(item);
+ }
+ }
+ }
+ }
+
+ public RelayCommand SwitchCommand { get; set; }
+
+ public RelayCommand ControlCommand { get; set; }
+
+
+ public Visibility CurrentDataVis { get { return _mCurrentDataVis; } set { _mCurrentDataVis = value; OnPropertyChanged(); } }
+ private Visibility _mCurrentDataVis = Visibility.Visible;
+
+
+ public Visibility HistoryDataVis { get { return _mHistoryDataVis; } set { _mHistoryDataVis = value; OnPropertyChanged(); } }
+ private Visibility _mHistoryDataVis = Visibility.Hidden;
+
+
+ ///
+ /// 是否显示
+ ///
+ public Visibility IsVisibility { get { return _mIsVisibility; } set { _mIsVisibility = value; OnPropertyChanged(); } }
+ private Visibility _mIsVisibility = Visibility.Hidden;
+
+ ///
+ /// 文字显示
+ ///
+ public string ButContent { get { return _mButContent; } set { _mButContent = value; OnPropertyChanged(); } }
+ private string _mButContent = "历史报警";
+
+ ///
+ /// 控制按钮文本显示
+ ///
+ public string ControlButText { get { return _mControlButText; } set { _mControlButText = value; OnPropertyChanged(); } }
+ private string _mControlButText = "报警复位";
+
+
+ ///
+ /// 开始时间
+ ///
+ public DateTime StartDateTime { get { return _mStartDateTime; } set { _mStartDateTime = value; OnPropertyChanged(); } }
+ private DateTime _mStartDateTime = DateTime.Now;
+
+ ///
+ /// 结束时间
+ ///
+ public DateTime EndDateTime { get { return _mEndDateTime; } set { _mEndDateTime = value; OnPropertyChanged(); } }
+ private DateTime _mEndDateTime = DateTime.Now;
+
+
+ public ObservableCollection AlarmInfos { get; set; }
+
+ public ObservableCollection HistoryAlarm { get; set; } = new ObservableCollection();
+
+
+ }
+
+}
diff --git a/BPASmartClient.Device/Alarm.cs b/BPASmartClient.Device/Alarm.cs
deleted file mode 100644
index 82588982..00000000
--- a/BPASmartClient.Device/Alarm.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-//using System;
-//using System.Collections.Generic;
-//using System.ComponentModel.DataAnnotations;
-//using System.Linq;
-//using System.Text;
-//using System.Threading.Tasks;
-
-
-//namespace BPASmartClient.Device
-//{
-// public class Alarm
-// {
-// ///
-// /// ID
-// ///
-// [Key]
-// public int Id { get { return _mId; } set { _mId = value; } }
-// private int _mId;
-
-// ///
-// /// 编号ID
-// ///
-// public int NumId { get { return _mNumId; } set { _mNumId = value; } }
-// private int _mNumId;
-
-
-// ///
-// /// 日期
-// ///
-// public string Date { get { return _mDate; } set { _mDate = value; } }
-// private string _mDate;
-
-// ///
-// /// 时间
-// ///
-// public string Time { get { return _mTime; } set { _mTime = value; } }
-// private string _mTime;
-
-// ///
-// /// 报警信息
-// ///
-// public string Info { get { return _mInfo; } set { _mInfo = value; } }
-// private string _mInfo;
-
-// ///
-// /// 报警值
-// ///
-// public string Value { get { return _mValue; } set { _mValue = value; } }
-// private string _mValue;
-
-// ///
-// /// 报警等级
-// ///
-// public string Grade { get { return _mGrade; } set { _mGrade = value; } }
-// private string _mGrade;
-// }
-//}
diff --git a/BPASmartClient.Helper/BPASmartClient.Helper.csproj b/BPASmartClient.Helper/BPASmartClient.Helper.csproj
index 7a60890d..a2b3bcbc 100644
--- a/BPASmartClient.Helper/BPASmartClient.Helper.csproj
+++ b/BPASmartClient.Helper/BPASmartClient.Helper.csproj
@@ -13,6 +13,7 @@
0
false
true
+ true
diff --git a/BPASmartClient.Helper/SystemUtils.cs b/BPASmartClient.Helper/SystemUtils.cs
index 3dca5ab3..c31c2ad1 100644
--- a/BPASmartClient.Helper/SystemUtils.cs
+++ b/BPASmartClient.Helper/SystemUtils.cs
@@ -6,6 +6,8 @@ using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
+using System.ComponentModel;
+using System.IO;
namespace BPASmartClient.Helper
{
@@ -13,26 +15,81 @@ namespace BPASmartClient.Helper
{
//private static ILogger logger = NLog.LogManager.GetCurrentClassLogger();
- public static bool isShowNumBoard = false;
+ //public static bool isShowNumBoard = false;
+
+ //[DllImport("kernel32.dll", SetLastError = true)]
+ //public static extern bool Wow64DisableWow64FsRedirection(ref IntPtr ptr);
+
+ //[DllImport("kernel32.dll", SetLastError = true)]
+ //public static extern bool Wow64RevertWow64FsRedirection(IntPtr ptr);
+
+ //public static IntPtr ptr = new IntPtr();
+
+
+
+ public static bool isShowNumBoard = false;
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool Wow64DisableWow64FsRedirection(ref IntPtr ptr);
-
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool Wow64RevertWow64FsRedirection(IntPtr ptr);
- public static IntPtr ptr = new IntPtr();
+
+ public static void StartKeyBoardFun()
+ {
+ try
+ {
+
+ }
+ catch (Exception)
+ {
+
+ throw;
+ }
+
+
+ }
+
public static void ShowScreenKeyboard()
{
try
{
+
+ //string file = @"C:\Program Files\Common Files\microsoft shared\ink\TabTip.exe";
+ ////if (!System.IO.File.Exists(file))
+ //// return;
+ //Process.Start(file);
+
+ string path = "C:/Program Files/Common Files/microsoft shared/ink/TabTip.exe";
+ if (File.Exists(path))
+ {
+ Process p = Process.Start(path);
+ }
+ else
+ {
+ //判断软键盘是否进程是否已经存在,如果不存在进行调用
+ Process[] pro = Process.GetProcessesByName("osk");
+ //说明已经存在,不再进行调用
+ if (pro != null && pro.Length > 0)
+ return;
+ IntPtr ptr = new IntPtr();
+ bool isWow64FsRedirectionDisabled = Wow64DisableWow64FsRedirection(ref ptr);
+ if (isWow64FsRedirectionDisabled)
+ {
+ Process.Start(@"C:\WINDOWS\system32\osk.exe");
+ bool isWow64FsRedirectionReverted = Wow64RevertWow64FsRedirection(ptr);
+ }
+ }
+
+
+
//ProcessStartInfo psi = new ProcessStartInfo();
//psi.FileName = @"C:\Windows\System32\osk.exe";
//psi.UseShellExecute = false;
//psi.CreateNoWindow = true;
//Process.Start(psi);
- Process kbpr = System.Diagnostics.Process.Start(@"C:\Windows\System32\osk.exe"); // 打开系统键盘
+ //Process kbpr = System.Diagnostics.Process.Start(@"C:\Windows\System32\osk.exe"); // 打开系统键盘
////判断软键盘是否进程是否已经存在,如果不存在进行调用
//Process[] pro = Process.GetProcessesByName("osk");
@@ -185,4 +242,7 @@ namespace BPASmartClient.Helper
+
+
+
}
diff --git a/DosingSystem/App.xaml b/DosingSystem/App.xaml
index a0fd7aba..bc96f972 100644
--- a/DosingSystem/App.xaml
+++ b/DosingSystem/App.xaml
@@ -1,9 +1,9 @@
diff --git a/DosingSystem/App.xaml.cs b/DosingSystem/App.xaml.cs
index c3181d4e..80265bc7 100644
--- a/DosingSystem/App.xaml.cs
+++ b/DosingSystem/App.xaml.cs
@@ -6,7 +6,7 @@ using System.Linq;
using System.Threading.Tasks;
using System.Windows;
-namespace DosingSystem
+namespace BPASmartClient.DosingSystem
{
///
/// Interaction logic for App.xaml
diff --git a/DosingSystem/DosingSystem.csproj b/DosingSystem/BPASmartClient.DosingSystem.csproj
similarity index 100%
rename from DosingSystem/DosingSystem.csproj
rename to DosingSystem/BPASmartClient.DosingSystem.csproj
diff --git a/DosingSystem/Model/ActionMenu.cs b/DosingSystem/Model/ActionMenu.cs
index 1313a488..428bede8 100644
--- a/DosingSystem/Model/ActionMenu.cs
+++ b/DosingSystem/Model/ActionMenu.cs
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
-namespace DosingSystem.Model
+namespace BPASmartClient.DosingSystem.Model
{
public class ActionMenu : ObservableObject
{
@@ -19,5 +19,10 @@ namespace DosingSystem.Model
public string MenuName { get { return _mMenuName; } set { _mMenuName = value; OnPropertyChanged(); } }
private string _mMenuName;
+
+ //public string NameSpace { get { return _mNameSpace; } set { _mNameSpace = value; OnPropertyChanged(); } }
+ //private string _mNameSpace;
+
+
}
}
diff --git a/DosingSystem/Model/Config.cs b/DosingSystem/Model/Config.cs
index 607e43f8..6c4dda70 100644
--- a/DosingSystem/Model/Config.cs
+++ b/DosingSystem/Model/Config.cs
@@ -7,7 +7,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace DosingSystem.Model
+namespace BPASmartClient.DosingSystem.Model
{
public class Config
{
diff --git a/DosingSystem/Model/DeviceAddress.cs b/DosingSystem/Model/DeviceAddress.cs
index dbaba074..7c57aaa8 100644
--- a/DosingSystem/Model/DeviceAddress.cs
+++ b/DosingSystem/Model/DeviceAddress.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace DosingSystem.Model
+namespace BPASmartClient.DosingSystem.Model
{
public class DeviceAddress
{
diff --git a/DosingSystem/Model/DeviceInquire.cs b/DosingSystem/Model/DeviceInquire.cs
index 41561399..181abeda 100644
--- a/DosingSystem/Model/DeviceInquire.cs
+++ b/DosingSystem/Model/DeviceInquire.cs
@@ -1,7 +1,7 @@
using BPASmartClient.Helper;
using BPASmartClient.Message;
using BPASmartClient.Modbus;
-using DosingSystem.ViewModel;
+using BPASmartClient.DosingSystem.ViewModel;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
@@ -12,7 +12,7 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
-namespace DosingSystem.Model
+namespace BPASmartClient.DosingSystem.Model
{
public class DeviceInquire
{
@@ -38,6 +38,11 @@ namespace DosingSystem.Model
}), "配料机设备上线监听", true);
}
+ public void Rescan()
+ {
+ InvalidIP.Clear();
+ }
+
public DeviceStatus GetDevice(string ip)
{
if (ip != null)
@@ -172,14 +177,15 @@ namespace DosingSystem.Model
{
ThreadManage.GetInstance().StartLong(new Action(() =>
{
+ //获取设备运行状态
var res = this.modbusTcp.Read(DeviceAddress.RunStatus);
if (res != null && res is ushort[] ushortValue)
{
if (ushortValue.Length >= 1) deviceStatus.RunStatus = ushortValue[0];
}
- var res1 = this.modbusTcp.GetUint("LW202");
-
+ //获取设备料仓剩余重量
+ deviceStatus.WeightFeedback = this.modbusTcp.GetUint(DeviceAddress.WeightFeedback) * 10;
Thread.Sleep(100);
}), $"{DeviceName} 开始监听", true);
diff --git a/DosingSystem/Model/Global.cs b/DosingSystem/Model/Global.cs
index d068c78a..fc697e0c 100644
--- a/DosingSystem/Model/Global.cs
+++ b/DosingSystem/Model/Global.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace DosingSystem.Model
+namespace BPASmartClient.DosingSystem.Model
{
public class Global
{
diff --git a/DosingSystem/Model/LocaPar.cs b/DosingSystem/Model/LocaPar.cs
index ab3a8c56..31815e0c 100644
--- a/DosingSystem/Model/LocaPar.cs
+++ b/DosingSystem/Model/LocaPar.cs
@@ -4,9 +4,9 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.ObjectModel;
-using DosingSystem.ViewModel;
+using BPASmartClient.DosingSystem.ViewModel;
-namespace DosingSystem.Model
+namespace BPASmartClient.DosingSystem.Model
{
public class LocaPar
{
diff --git a/DosingSystem/Model/RawMaterialDeviceStatus.cs b/DosingSystem/Model/RawMaterialDeviceStatus.cs
index 9fb8acaa..1febc8a9 100644
--- a/DosingSystem/Model/RawMaterialDeviceStatus.cs
+++ b/DosingSystem/Model/RawMaterialDeviceStatus.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace DosingSystem.Model
+namespace BPASmartClient.DosingSystem.Model
{
public class RawMaterialDeviceStatus
{
diff --git a/DosingSystem/Model/RawMaterialModel.cs b/DosingSystem/Model/RawMaterialModel.cs
index 186804ca..7b5f3eb5 100644
--- a/DosingSystem/Model/RawMaterialModel.cs
+++ b/DosingSystem/Model/RawMaterialModel.cs
@@ -5,7 +5,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace DosingSystem.Model
+namespace BPASmartClient.DosingSystem.Model
{
///
/// 原料模块
diff --git a/DosingSystem/Model/RecipeModel.cs b/DosingSystem/Model/RecipeModel.cs
index 58ca0f20..ce4513c3 100644
--- a/DosingSystem/Model/RecipeModel.cs
+++ b/DosingSystem/Model/RecipeModel.cs
@@ -5,10 +5,10 @@ using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
-using DosingSystem.ViewModel;
+using BPASmartClient.DosingSystem.ViewModel;
using Microsoft.Toolkit.Mvvm.ComponentModel;
-namespace DosingSystem.Model
+namespace BPASmartClient.DosingSystem.Model
{
///
/// 配方模块
diff --git a/DosingSystem/Model/UserManager.cs b/DosingSystem/Model/UserManager.cs
index 6c2fc247..234eb09e 100644
--- a/DosingSystem/Model/UserManager.cs
+++ b/DosingSystem/Model/UserManager.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace DosingSystem.Model
+namespace BPASmartClient.DosingSystem.Model
{
public class UserManager
{
@@ -24,7 +24,7 @@ namespace DosingSystem.Model
管理员 = 1,
操作员 = 2,
观察员 = 3,
- 技术员=4
+ 技术员 = 4
}
}
diff --git a/DosingSystem/View/AdminstratorsView.xaml b/DosingSystem/View/AdminstratorsView.xaml
index 208b641a..13178b56 100644
--- a/DosingSystem/View/AdminstratorsView.xaml
+++ b/DosingSystem/View/AdminstratorsView.xaml
@@ -1,13 +1,13 @@
/// AdministratorsView.xaml 的交互逻辑
diff --git a/DosingSystem/View/AlarmRecordView.xaml b/DosingSystem/View/AlarmRecordView.xaml
index 61550b78..bfdfa310 100644
--- a/DosingSystem/View/AlarmRecordView.xaml
+++ b/DosingSystem/View/AlarmRecordView.xaml
@@ -1,27 +1,380 @@
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/DosingSystem/View/AlarmRecordView.xaml.cs b/DosingSystem/View/AlarmRecordView.xaml.cs
index 3843f3e4..d30b0210 100644
--- a/DosingSystem/View/AlarmRecordView.xaml.cs
+++ b/DosingSystem/View/AlarmRecordView.xaml.cs
@@ -13,7 +13,7 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
-namespace DosingSystem.View
+namespace BPASmartClient.DosingSystem.View
{
///
/// AlarmRecordView.xaml 的交互逻辑
diff --git a/DosingSystem/View/ChangeDeviceNameView.xaml b/DosingSystem/View/ChangeDeviceNameView.xaml
index 0dea173e..5538aa49 100644
--- a/DosingSystem/View/ChangeDeviceNameView.xaml
+++ b/DosingSystem/View/ChangeDeviceNameView.xaml
@@ -1,11 +1,11 @@
/// ChangeDeviceNameView.xaml 的交互逻辑
diff --git a/DosingSystem/View/DeviceListView.xaml b/DosingSystem/View/DeviceListView.xaml
index 1ccc3824..002d3266 100644
--- a/DosingSystem/View/DeviceListView.xaml
+++ b/DosingSystem/View/DeviceListView.xaml
@@ -1,13 +1,13 @@
diff --git a/DosingSystem/View/DeviceListView.xaml.cs b/DosingSystem/View/DeviceListView.xaml.cs
index 5c57d6ad..16366e98 100644
--- a/DosingSystem/View/DeviceListView.xaml.cs
+++ b/DosingSystem/View/DeviceListView.xaml.cs
@@ -13,7 +13,7 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
-namespace DosingSystem.View
+namespace BPASmartClient.DosingSystem.View
{
///
/// DeviceListView.xaml 的交互逻辑
diff --git a/DosingSystem/View/HardwareStatusView.xaml b/DosingSystem/View/HardwareStatusView.xaml
index ecf4e484..347782e3 100644
--- a/DosingSystem/View/HardwareStatusView.xaml
+++ b/DosingSystem/View/HardwareStatusView.xaml
@@ -1,13 +1,13 @@
diff --git a/DosingSystem/View/HardwareStatusView.xaml.cs b/DosingSystem/View/HardwareStatusView.xaml.cs
index a98e5ed5..c0faa0fd 100644
--- a/DosingSystem/View/HardwareStatusView.xaml.cs
+++ b/DosingSystem/View/HardwareStatusView.xaml.cs
@@ -13,7 +13,7 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
-namespace DosingSystem.View
+namespace BPASmartClient.DosingSystem.View
{
///
/// HardwareStatusView.xaml 的交互逻辑
diff --git a/DosingSystem/View/Helper/PasswordBoxHelper.cs b/DosingSystem/View/Helper/PasswordBoxHelper.cs
index e6c4ec6a..e66a5db7 100644
--- a/DosingSystem/View/Helper/PasswordBoxHelper.cs
+++ b/DosingSystem/View/Helper/PasswordBoxHelper.cs
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
-namespace DosingSystem.View.Helper
+namespace BPASmartClient.DosingSystem.View.Helper
{
///
/// 为PasswordBox控件的Password增加绑定功能
diff --git a/DosingSystem/View/MainWindow.xaml b/DosingSystem/View/MainWindow.xaml
index 45e64487..292ff2cf 100644
--- a/DosingSystem/View/MainWindow.xaml
+++ b/DosingSystem/View/MainWindow.xaml
@@ -1,13 +1,13 @@
/// Interaction logic for MainWindow.xaml
diff --git a/DosingSystem/View/NewRecipeView.xaml b/DosingSystem/View/NewRecipeView.xaml
index 58a502a5..82df5006 100644
--- a/DosingSystem/View/NewRecipeView.xaml
+++ b/DosingSystem/View/NewRecipeView.xaml
@@ -1,11 +1,11 @@
/// NewRecipeView.xaml 的交互逻辑
diff --git a/DosingSystem/View/RecipeControlView.xaml b/DosingSystem/View/RecipeControlView.xaml
index 79f0d6b2..70d70e54 100644
--- a/DosingSystem/View/RecipeControlView.xaml
+++ b/DosingSystem/View/RecipeControlView.xaml
@@ -1,13 +1,13 @@
diff --git a/DosingSystem/View/RecipeControlView.xaml.cs b/DosingSystem/View/RecipeControlView.xaml.cs
index 4baeac2e..6e9330e3 100644
--- a/DosingSystem/View/RecipeControlView.xaml.cs
+++ b/DosingSystem/View/RecipeControlView.xaml.cs
@@ -13,7 +13,7 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
-namespace DosingSystem.View
+namespace BPASmartClient.DosingSystem.View
{
///
/// RecipeControlView.xaml 的交互逻辑
diff --git a/DosingSystem/View/RecipeSettingsView.xaml b/DosingSystem/View/RecipeSettingsView.xaml
index 55b934b3..b1fcdd49 100644
--- a/DosingSystem/View/RecipeSettingsView.xaml
+++ b/DosingSystem/View/RecipeSettingsView.xaml
@@ -1,13 +1,13 @@
diff --git a/DosingSystem/View/RecipeSettingsView.xaml.cs b/DosingSystem/View/RecipeSettingsView.xaml.cs
index a269ad62..3785ab57 100644
--- a/DosingSystem/View/RecipeSettingsView.xaml.cs
+++ b/DosingSystem/View/RecipeSettingsView.xaml.cs
@@ -13,7 +13,7 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
-namespace DosingSystem.View
+namespace BPASmartClient.DosingSystem.View
{
///
/// RecipeSettingsView.xaml 的交互逻辑
diff --git a/DosingSystem/ViewModel/AdminstratorsViewModel.cs b/DosingSystem/ViewModel/AdminstratorsViewModel.cs
index fb826d22..acb7d712 100644
--- a/DosingSystem/ViewModel/AdminstratorsViewModel.cs
+++ b/DosingSystem/ViewModel/AdminstratorsViewModel.cs
@@ -8,7 +8,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Collections.ObjectModel;
-namespace DosingSystem.ViewModel
+namespace BPASmartClient.DosingSystem.ViewModel
{
public class AdminstratorsViewModel : ObservableObject
{
@@ -33,7 +33,7 @@ namespace DosingSystem.ViewModel
{
AdminLoginCommand = new RelayCommand(() =>
{
- var rest = ActionManage.GetInstance.SendResult("LoginDosingSystem", $"{Admin}-={Password}-={SelectText}");
+ var rest = ActionManage.GetInstance.SendResult("LoginBPASmartClient.DosingSystem", $"{Admin}-={Password}-={SelectText}");
if (rest != null && rest is string str)
{
ErrorMessage = str;
diff --git a/DosingSystem/ViewModel/AlarmRecordViewModel.cs b/DosingSystem/ViewModel/AlarmRecordViewModel.cs
index f81769ad..977c6ecf 100644
--- a/DosingSystem/ViewModel/AlarmRecordViewModel.cs
+++ b/DosingSystem/ViewModel/AlarmRecordViewModel.cs
@@ -10,7 +10,7 @@ using System.Windows;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.Input;
-namespace DosingSystem.ViewModel
+namespace BPASmartClient.DosingSystem.ViewModel
{
public class AlarmRecordViewModel : ObservableObject
{
diff --git a/DosingSystem/ViewModel/ChangeDeviceNameViewModel.cs b/DosingSystem/ViewModel/ChangeDeviceNameViewModel.cs
index a2593c29..3344882e 100644
--- a/DosingSystem/ViewModel/ChangeDeviceNameViewModel.cs
+++ b/DosingSystem/ViewModel/ChangeDeviceNameViewModel.cs
@@ -4,11 +4,11 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BPASmartClient.Helper;
-using DosingSystem.Model;
+using BPASmartClient.DosingSystem.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
-namespace DosingSystem.ViewModel
+namespace BPASmartClient.DosingSystem.ViewModel
{
public class ChangeDeviceNameViewModel : ObservableObject
{
diff --git a/DosingSystem/ViewModel/DeviceListViewModel.cs b/DosingSystem/ViewModel/DeviceListViewModel.cs
index ecb6cde7..1823e92e 100644
--- a/DosingSystem/ViewModel/DeviceListViewModel.cs
+++ b/DosingSystem/ViewModel/DeviceListViewModel.cs
@@ -9,9 +9,9 @@ using System.Collections.ObjectModel;
using System.Windows;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.Input;
-using DosingSystem.View;
+using BPASmartClient.DosingSystem.View;
-namespace DosingSystem.ViewModel
+namespace BPASmartClient.DosingSystem.ViewModel
{
public class DeviceListViewModel : ObservableObject
{
diff --git a/DosingSystem/ViewModel/HardwareStatusViewModel.cs b/DosingSystem/ViewModel/HardwareStatusViewModel.cs
index e48e3e3f..acedf8fa 100644
--- a/DosingSystem/ViewModel/HardwareStatusViewModel.cs
+++ b/DosingSystem/ViewModel/HardwareStatusViewModel.cs
@@ -10,7 +10,7 @@ using System.Windows;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.Input;
-namespace DosingSystem.ViewModel
+namespace BPASmartClient.DosingSystem.ViewModel
{
public class HardwareStatusViewModel : ObservableObject
{
diff --git a/DosingSystem/ViewModel/MainViewModel.cs b/DosingSystem/ViewModel/MainViewModel.cs
index 21356c36..3881dffe 100644
--- a/DosingSystem/ViewModel/MainViewModel.cs
+++ b/DosingSystem/ViewModel/MainViewModel.cs
@@ -9,11 +9,12 @@ using System.Collections.ObjectModel;
using System.Windows;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.Input;
-using DosingSystem.Model;
+using BPASmartClient.DosingSystem.Model;
using Newtonsoft.Json;
using System.IO;
+using System.Reflection;
-namespace DosingSystem.ViewModel
+namespace BPASmartClient.DosingSystem.ViewModel
{
public class MainViewModel : ObservableObject
{
@@ -40,7 +41,7 @@ namespace DosingSystem.ViewModel
{
Json.Read();
TogglePag = new RelayCommand