diff --git a/BPASmart.VariableManager/Converter/DeviceVisibleConverter.cs b/BPASmart.VariableManager/Converter/DeviceVisibleConverter.cs index 0892559a..557bd01e 100644 --- a/BPASmart.VariableManager/Converter/DeviceVisibleConverter.cs +++ b/BPASmart.VariableManager/Converter/DeviceVisibleConverter.cs @@ -18,7 +18,8 @@ namespace BPASmart.VariableManager.Converter if (type != null && parameter != null) { - if (type.Name == parameter.ToString()) + string typeName = type.BaseType.Name == "Object" ? type.Name : type.BaseType.Name; + if (typeName == parameter.ToString()) return Visibility.Visible; else return Visibility.Collapsed; diff --git a/BPASmart.VariableManager/Models/AnalogAlarmInfo.cs b/BPASmart.VariableManager/Models/AnalogAlarmInfo.cs deleted file mode 100644 index 6772a903..00000000 --- a/BPASmart.VariableManager/Models/AnalogAlarmInfo.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace BPASmart.VariableManager.Models -{ - /// - /// 模拟量报警信息 - /// - [Table(nameof(AnalogAlarmInfo))] - public class AnalogAlarmInfo - { - //[Key] - //public int Id { get; set; } - - ///// - ///// 高高报警 - ///// - //public AnalogAlarmModel Condition_HIHI_Value { get; set; } = new AnalogAlarmModel(); - ///// - ///// 高报警 - ///// - //public AnalogAlarmModel Condition_HI_Value { get; set; } = new AnalogAlarmModel(); - ///// - ///// 低低报警 - ///// - //public AnalogAlarmModel Condition_LOLO_Value { get; set; } = new AnalogAlarmModel(); - ///// - ///// 低报警 - ///// - //public AnalogAlarmModel Condition_LO_Value { get; set; } = new AnalogAlarmModel(); - - //[ForeignKey("AlarmSetId")] - //public int AlarmSetId { get; set; } - - //public AlarmSet AlarmSet { get; set; } - - } -} diff --git a/BPASmart.VariableManager/Models/CommDeviceModel/Invoance.cs b/BPASmart.VariableManager/Models/CommDeviceModel/Invoance.cs new file mode 100644 index 00000000..2870607d --- /dev/null +++ b/BPASmart.VariableManager/Models/CommDeviceModel/Invoance.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPASmart.VariableManager.Models +{ + /// + /// 汇川PLC + /// + public class Invoance : ModbusTcp + { + } +} diff --git a/BPASmart.VariableManager/Models/CommDeviceModel/KincoOneMachine.cs b/BPASmart.VariableManager/Models/CommDeviceModel/KincoOneMachine.cs new file mode 100644 index 00000000..cfef2d29 --- /dev/null +++ b/BPASmart.VariableManager/Models/CommDeviceModel/KincoOneMachine.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPASmart.VariableManager.Models +{ + /// + /// 步科一体机 + /// + public class KincoOneMachine : ModbusTcp + { + } +} diff --git a/BPASmart.VariableManager/Models/CommDeviceModel/ModbusRtu.cs b/BPASmart.VariableManager/Models/CommDeviceModel/ModbusRtu.cs index aade69db..3520c84e 100644 --- a/BPASmart.VariableManager/Models/CommDeviceModel/ModbusRtu.cs +++ b/BPASmart.VariableManager/Models/CommDeviceModel/ModbusRtu.cs @@ -12,15 +12,6 @@ namespace BPASmart.VariableManager.Models { public class ModbusRtu : ICommunicationDevice { - //public ModbusRtu() - //{ - // Init(); - //} - - /// - /// 显示/隐藏设置 - /// - //public Visibility ModbusRtuVisible { get; set; } = Visibility.Collapsed; /// /// 串口端口 @@ -52,37 +43,5 @@ namespace BPASmart.VariableManager.Models /// public string Parity { get; set; } - - //public ObservableCollection Ports { get; set; } = new ObservableCollection(); - - //public ObservableCollection BaudRates { get; set; } = new ObservableCollection(); - - //public ObservableCollection Paritys { get; set; } = new ObservableCollection(); - - //private void Init() - //{ - // Ports.Clear(); - // foreach (var item in SerialPort.GetPortNames()) - // { - // Ports.Add(item); - // } - - - // BaudRates.Clear(); - // BaudRates.Add("110"); - // int initValue = 300; - // for (int i = 0; i < 17; i++) - // { - // BaudRates.Add(initValue.ToString()); - // initValue *= 2; - // } - - - // Paritys.Clear(); - // foreach (var item in Enum.GetNames(typeof(EParity))) - // { - // Paritys.Add(item); - // } - //} } } diff --git a/BPASmart.VariableManager/Models/CommDeviceModel/ModbusTcp.cs b/BPASmart.VariableManager/Models/CommDeviceModel/ModbusTcp.cs index 29f5a44c..ebf6241a 100644 --- a/BPASmart.VariableManager/Models/CommDeviceModel/ModbusTcp.cs +++ b/BPASmart.VariableManager/Models/CommDeviceModel/ModbusTcp.cs @@ -9,10 +9,6 @@ namespace BPASmart.VariableManager.Models { public class ModbusTcp : ICommunicationDevice { - /// - /// 显示/隐藏设置 - /// - //public Visibility ModbusTcpVisible { get; set; } = Visibility.Collapsed; /// /// IP地址 diff --git a/BPASmart.VariableManager/Models/CommDeviceModel/Siemens.cs b/BPASmart.VariableManager/Models/CommDeviceModel/Siemens.cs index 6a5d97fd..4f67206a 100644 --- a/BPASmart.VariableManager/Models/CommDeviceModel/Siemens.cs +++ b/BPASmart.VariableManager/Models/CommDeviceModel/Siemens.cs @@ -11,15 +11,6 @@ namespace BPASmart.VariableManager.Models { public class Siemens : ICommunicationDevice { - //public Siemens() - //{ - // Init(); - //} - - /// - /// 显示/隐藏设置 - /// - //public Visibility SiemensVisible { get; set; } = Visibility.Collapsed; /// /// IP地址 @@ -46,18 +37,6 @@ namespace BPASmart.VariableManager.Models /// public string PlcType { get; set; } - //public ObservableCollection PlcTypes { get; set; } = new ObservableCollection(); - - //private void Init() - //{ - // PlcTypes.Clear(); - // foreach (var item in Enum.GetNames(typeof(ESiemensPlcType))) - // { - // PlcTypes.Add(item.Substring(1)); - // } - //} - - } diff --git a/BPASmart.VariableManager/Models/VarTableModel.cs b/BPASmart.VariableManager/Models/CommDeviceModel/kinco.cs similarity index 66% rename from BPASmart.VariableManager/Models/VarTableModel.cs rename to BPASmart.VariableManager/Models/CommDeviceModel/kinco.cs index 6ab9192a..fdd99955 100644 --- a/BPASmart.VariableManager/Models/VarTableModel.cs +++ b/BPASmart.VariableManager/Models/CommDeviceModel/kinco.cs @@ -6,7 +6,10 @@ using System.Threading.Tasks; namespace BPASmart.VariableManager.Models { - public class VarTableModel : NoticeBase + /// + /// 步科PLC + /// + public class kinco : ModbusTcp { } } diff --git a/BPASmart.VariableManager/Models/CommunicationSet.cs b/BPASmart.VariableManager/Models/CommunicationSet.cs deleted file mode 100644 index 93e7ac88..00000000 --- a/BPASmart.VariableManager/Models/CommunicationSet.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using Microsoft.Toolkit.Mvvm.ComponentModel; -using System.Collections.ObjectModel; -using BPASmart.VariableManager.Enums; -using System.IO.Ports; -using Microsoft.Toolkit.Mvvm.Input; -using BPASmart.VariableManager.Models; - -namespace BPASmart.VariableManager.Models -{ - public class CommunicationSet : ObservableObject - { - - public CommunicationSet() - { - RemoveCommand = new RelayCommand((o) => { if (RemoveAction != null) RemoveAction(o); }); - } - - public Action RemoveAction { get; set; } - - public Siemens CommSiemens { get { return _mCommSiemens; } set { _mCommSiemens = value; OnPropertyChanged(); } } - private Siemens _mCommSiemens = new Siemens(); - - public ModbusTcp CommModbusTcp { get { return _mCommModbusTcp; } set { _mCommModbusTcp = value; OnPropertyChanged(); } } - private ModbusTcp _mCommModbusTcp = new ModbusTcp(); - - public ModbusRtu CommModbusRtu { get { return _mCommModbusRtu; } set { _mCommModbusRtu = value; OnPropertyChanged(); } } - private ModbusRtu _mCommModbusRtu = new ModbusRtu(); - - /// - /// 是否激活 - /// - public bool IsActive { get { return _mIsActive; } set { _mIsActive = value; OnPropertyChanged(); } } - private bool _mIsActive; - - - /// - /// 新增设备名称 - /// - public string DeviceName { get { return _mDeviceName; } set { _mDeviceName = value; OnPropertyChanged(); } } - private string _mDeviceName; - - - public RelayCommand RemoveCommand { get; set; } - - } -} diff --git a/BPASmart.VariableManager/Models/DeviceManagment.cs b/BPASmart.VariableManager/Models/DeviceManagment.cs deleted file mode 100644 index 7f428032..00000000 --- a/BPASmart.VariableManager/Models/DeviceManagment.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Microsoft.Toolkit.Mvvm.ComponentModel; -using Microsoft.Toolkit.Mvvm.Input; - -namespace BPASmart.VariableManager.Models -{ - public class DeviceManagment : ObservableObject - { - public string Content { get { return _mContent; } set { _mContent = value; OnPropertyChanged(); } } - private string _mContent; - - public string CommandParameter { get { return _mCommandParameter; } set { _mCommandParameter = value; OnPropertyChanged(); } } - private string _mCommandParameter; - - - public string DeviceIco { get { return _mDeviceIco; } set { _mDeviceIco = value; OnPropertyChanged(); } } - private string _mDeviceIco; - - - public RelayCommand NavChangedCommand { get; set; } - - } -} diff --git a/BPASmart.VariableManager/Models/DynamicMenu.cs b/BPASmart.VariableManager/Models/DynamicMenu.cs deleted file mode 100644 index e3a68eab..00000000 --- a/BPASmart.VariableManager/Models/DynamicMenu.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace BPASmart.VariableManager.Models -{ - public class DynamicMenu - { - /// - /// 通讯设备菜单管理 - /// - public List CommunDeviceManagments { get; set; } = new List(); - - /// - /// 变量菜单管理 - /// - public List VariableManagments { get; set; } = new List(); - - /// - /// 变量监控菜单管理 - /// - public List VariableMonitors { get; set; } = new List(); - } -} diff --git a/BPASmart.VariableManager/Models/PropBindInfo.cs b/BPASmart.VariableManager/Models/PropBindInfo.cs deleted file mode 100644 index 6c39ee9a..00000000 --- a/BPASmart.VariableManager/Models/PropBindInfo.cs +++ /dev/null @@ -1,80 +0,0 @@ -using BPASmart.VariableManager.Enums; -using Microsoft.Toolkit.Mvvm.Input; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace BPASmart.VariableManager.Models -{ - /// - /// 属性绑定信息 - /// - public class PropBindInfo : VariableInfo - { - //public PropBindInfo() - //{ - // ComboBoxItemInit(); - // //CancelCommand = new RelayCommand(() => { IsOpen = false; }); - // //ConfirmCommand = new RelayCommand(() => { IsOpen = false; }); - //} - - ///// - ///// 数据类型下拉列表 - ///// - //public ObservableCollection dataType { get; set; } = new ObservableCollection(); - - ///// - ///// 报警类型下拉列表 - ///// - //public ObservableCollection alarmType { get; set; } = new ObservableCollection(); - - ///// - ///// 报警设置窗离散量报警类型 - ///// - //public ObservableCollection PopupDiscreteAlarmType { get; set; } = new ObservableCollection(); - - ///// - ///// 是否显示报警设置框 - ///// - //public bool IsOpen { get { return _mIsOpen; } set { _mIsOpen = value; OnPropertyChanged(); } } - //private bool _mIsOpen; - - - //public bool IsRedundant { get { return _mIsRedundant; } set { _mIsRedundant = value; OnPropertyChanged(); } } - //private bool _mIsRedundant; - - - ///// - ///// 报警设置框取消操作 - ///// - //public RelayCommand CancelCommand { get; set; } - - ///// - ///// 报警设置框确认按钮 - ///// - //public RelayCommand ConfirmCommand { get; set; } - - - ///// - ///// 下拉列表初始化 - ///// - //private void ComboBoxItemInit() - //{ - // dataType.Clear(); - // alarmType.Clear(); - // PopupDiscreteAlarmType.Clear(); - // string[] DataTypeNames = Enum.GetNames(typeof(EDataType)); - // foreach (var item in DataTypeNames) { dataType.Add(item); } - - // string[] AlarmTypeNames = Enum.GetNames(typeof(EAlarmType)); - // foreach (var item in AlarmTypeNames) { alarmType.Add(item); } - - // string[] PopupAlarmTypes = Enum.GetNames(typeof(EAlongTriggerType)); - // foreach (var item in PopupAlarmTypes) { PopupDiscreteAlarmType.Add(item); } - //} - } -} diff --git a/BPASmart.VariableManager/Models/VarMonitorPropInfo.cs b/BPASmart.VariableManager/Models/VarMonitorPropInfo.cs deleted file mode 100644 index 2b8ef710..00000000 --- a/BPASmart.VariableManager/Models/VarMonitorPropInfo.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using BPASmart.VariableManager.Enums; -using Microsoft.Toolkit.Mvvm.ComponentModel; - - -namespace BPASmart.VariableManager.Models -{ - internal class VarMonitorPropInfo : VariableInfo - { - public VarMonitorPropInfo() - { - Init(); - } - - /// - /// 数据显示格式 - /// - public string DataDisplayFormat { get { return _mDataDisplayFormat; } set { _mDataDisplayFormat = value; OnPropertyChanged(); } } - private string _mDataDisplayFormat; - - /// - /// 修改值 - /// - public string ModifyValue { get { return _mModifyValue; } set { _mModifyValue = value; OnPropertyChanged(); } } - private string _mModifyValue; - - public ObservableCollection DisplayFormat { get; set; } = new ObservableCollection(); - - private void Init() - { - DisplayFormat.Clear(); - foreach (var item in Enum.GetNames(typeof(DisplayFormat))) - { - DisplayFormat.Add(item); - } - } - - } -} diff --git a/BPASmart.VariableManager/ViewModels/CommunicationSetViewModel.cs b/BPASmart.VariableManager/ViewModels/CommunicationSetViewModel.cs index b8d61a22..1f5a9179 100644 --- a/BPASmart.VariableManager/ViewModels/CommunicationSetViewModel.cs +++ b/BPASmart.VariableManager/ViewModels/CommunicationSetViewModel.cs @@ -29,13 +29,6 @@ namespace BPASmart.VariableManager.ViewModels RemoveDeviceCommand = new RelayCommand(RemoveDevice); SaveConnectSetCommand = new RelayCommand(() => { Json.Save(); }); - //Json.Read(); - //foreach (var item in Json.Data.CommunicationDevices) - //{ - // //item.RemoveAction = RemoveDevice; - // Json.Data.CommunicationDevices.Add(item); - //} - DelegationNotifi.GetInstance.AddDeviceVerify = new Func((p) => { return Json.Data.CommunicationDevices.FirstOrDefault(s => s.DeviceName == p.DeviceName) == null; diff --git a/BPASmart.VariableManager/ViewModels/VariableMonitorViewModel.cs b/BPASmart.VariableManager/ViewModels/VariableMonitorViewModel.cs deleted file mode 100644 index 2d54582d..00000000 --- a/BPASmart.VariableManager/ViewModels/VariableMonitorViewModel.cs +++ /dev/null @@ -1,75 +0,0 @@ -using BPASmart.VariableManager.Models; -using Microsoft.EntityFrameworkCore; -using Microsoft.Toolkit.Mvvm.ComponentModel; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace BPASmart.VariableManager.ViewModels -{ - internal class VariableMonitorViewModel : ObservableObject - { - public VariableMonitorViewModel() - { - GetLocalDataAsync(); - } - - /// - /// 异步获取本地数据 - /// - private Task GetLocalDataAsync() - { - //var DataList = SqlHelper.GetInstance.DbObj.ToList(); - //App.Current.Dispatcher.Invoke(new Action(() => { varialeInfos.Clear(); })); - //foreach (var item in DataList) - //{ - // if (item.VarName?.Length > 0) - // { - // VarMonitorPropInfo varMonitorPropInfo = new VarMonitorPropInfo(); - // varMonitorPropInfo.ID = item.ID; - // varMonitorPropInfo.VarName = item.VarName; - // varMonitorPropInfo.Address = item.Address; - // varMonitorPropInfo.DataType = item.DataType; - // varMonitorPropInfo.DataDisplayFormat = TypeEnum.DisplayFormat.十进制.ToString(); - // App.Current?.Dispatcher.Invoke(new Action(() => { varialeInfos.Add(varMonitorPropInfo); })); - // } - //} - return Task.FromResult(true); - } - - /// - /// 异步保存数据 - /// - /// - private Task SaveDataAsync() - { - //SqlHelper.GetInstance.DbObj.RemoveRange(SqlHelper.GetInstance.DbObj.ToArray()); - //foreach (var item in varialeInfos) - //{ - // SqlHelper.GetInstance.Add(new VariableInfo() - // { - // ID = item.ID, - // VarName = item.VarName, - // Address = item.Address, - // DataType = item.DataType, - // IsEnableAlarm = item.IsEnableAlarm, - // CurrentValue = item.CurrentValue, - // AlarmSetProp = item.AlarmSetProp, - - // }); - //} - //SqlHelper.GetInstance.Save(); - return Task.FromResult(true); - } - - /// - /// 变量信息 - /// - public ObservableCollection varialeInfos { get; set; } = new ObservableCollection(); - - } -} - diff --git a/BPASmart.VariableManager/Views/VariableMonitorView.xaml b/BPASmart.VariableManager/Views/VariableMonitorView.xaml deleted file mode 100644 index c2529582..00000000 --- a/BPASmart.VariableManager/Views/VariableMonitorView.xaml +++ /dev/null @@ -1,284 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/BPASmart.VariableManager/Views/VariableMonitorView.xaml.cs b/BPASmart.VariableManager/Views/VariableMonitorView.xaml.cs deleted file mode 100644 index 4d2a96c3..00000000 --- a/BPASmart.VariableManager/Views/VariableMonitorView.xaml.cs +++ /dev/null @@ -1,28 +0,0 @@ -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 BPASmart.VariableManager.Views -{ - /// - /// VariableMonitorView.xaml 的交互逻辑 - /// - public partial class VariableMonitorView : UserControl - { - public VariableMonitorView() - { - InitializeComponent(); - } - } -} diff --git a/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs b/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs index 5cc1ad38..1bdbc5e4 100644 --- a/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs +++ b/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs @@ -1,6 +1,5 @@ using BPASmartClient.CustomResource.Pages.ViewModel; using BPASmartClient.Helper; -//using BPASmartClient.Message; using BPASmartClient.Model; using System; using System.Collections.Concurrent; @@ -48,6 +47,15 @@ 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) + //{ + + //} + + + + /// /// 沿报警检测 ///