diff --git a/BPASmart.VariableManager/App.xaml b/BPASmart.VariableManager/App.xaml
new file mode 100644
index 00000000..f2760f36
--- /dev/null
+++ b/BPASmart.VariableManager/App.xaml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BPASmart.VariableManager/App.xaml.cs b/BPASmart.VariableManager/App.xaml.cs
new file mode 100644
index 00000000..ab4d284b
--- /dev/null
+++ b/BPASmart.VariableManager/App.xaml.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace BPASmart.VariableManager
+{
+ ///
+ /// Interaction logic for App.xaml
+ ///
+ public partial class App : Application
+ {
+ }
+}
diff --git a/BPASmart.VariableManager/AssemblyInfo.cs b/BPASmart.VariableManager/AssemblyInfo.cs
new file mode 100644
index 00000000..8b5504ec
--- /dev/null
+++ b/BPASmart.VariableManager/AssemblyInfo.cs
@@ -0,0 +1,10 @@
+using System.Windows;
+
+[assembly: ThemeInfo(
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
+)]
diff --git a/BPASmart.VariableManager/BPASmart.VariableManager.csproj b/BPASmart.VariableManager/BPASmart.VariableManager.csproj
new file mode 100644
index 00000000..12fe325b
--- /dev/null
+++ b/BPASmart.VariableManager/BPASmart.VariableManager.csproj
@@ -0,0 +1,51 @@
+
+
+
+ WinExe
+ net6.0-windows
+ enable
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BPASmart.VariableManager/Converter/AlarmTypeTextConvert.cs b/BPASmart.VariableManager/Converter/AlarmTypeTextConvert.cs
new file mode 100644
index 00000000..703fb6bb
--- /dev/null
+++ b/BPASmart.VariableManager/Converter/AlarmTypeTextConvert.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+using BPASmart.VariableManager.Enums;
+namespace BPASmart.VariableManager.Converter
+{
+ ///
+ /// 报警类型文本转换
+ ///
+ public class AlarmTypeTextConvert : IValueConverter
+ {
+ //当值从绑定源传播给绑定目标时,调用方法Convert,绑定源是控件的数据,绑定目标是后台值
+ //界面传递给后台数据
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value != null)
+ {
+ if (value.ToString() == "Bool")
+ return EAlarmType.离散量报警.ToString();
+ else
+ return EAlarmType.模拟量报警.ToString();
+ }
+ return EAlarmType.无.ToString();
+ }
+
+ //当值从绑定目标传播给绑定源时,调用此方法ConvertBack
+ //从后台数据传递给界面
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ return value.ToString();
+ }
+ }
+}
diff --git a/BPASmart.VariableManager/Converter/AnalogAlarmConvert.cs b/BPASmart.VariableManager/Converter/AnalogAlarmConvert.cs
new file mode 100644
index 00000000..90d76abe
--- /dev/null
+++ b/BPASmart.VariableManager/Converter/AnalogAlarmConvert.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Data;
+
+namespace BPASmart.VariableManager.Converter
+{
+ ///
+ /// 模拟量报警显示转换
+ ///
+ public class AnalogAlarmConvert : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value != null)
+ {
+ return value.ToString() != "Bool" ? Visibility.Visible : Visibility.Collapsed;
+ }
+ return Visibility.Visible;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/BPASmart.VariableManager/Converter/DiscreteAlarmConvert.cs b/BPASmart.VariableManager/Converter/DiscreteAlarmConvert.cs
new file mode 100644
index 00000000..300f8bc7
--- /dev/null
+++ b/BPASmart.VariableManager/Converter/DiscreteAlarmConvert.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Data;
+
+namespace BPASmart.VariableManager.Converter
+{
+ ///
+ /// 离散量报警显示转换
+ ///
+ public class DiscreteAlarmConvert : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value != null)
+ {
+ return value.ToString() == "Bool" ? Visibility.Visible : Visibility.Collapsed;
+ }
+ return Visibility.Visible;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/BPASmart.VariableManager/Converter/IsEnableConvert.cs b/BPASmart.VariableManager/Converter/IsEnableConvert.cs
new file mode 100644
index 00000000..50b364a4
--- /dev/null
+++ b/BPASmart.VariableManager/Converter/IsEnableConvert.cs
@@ -0,0 +1,39 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+
+namespace BPASmart.VariableManager.Converter
+{
+ public class IsEnableConvert : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ bool returnValue = false;
+ if (value != null)
+ {
+ switch (value.ToString())
+ {
+ case "无":
+ returnValue = false;
+ break;
+ case "离散量报警":
+ case "模拟量报警":
+ returnValue = true;
+ break;
+ default:
+ break;
+ }
+ }
+ return returnValue;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/BPASmart.VariableManager/Converter/TextDisplayConvert.cs b/BPASmart.VariableManager/Converter/TextDisplayConvert.cs
new file mode 100644
index 00000000..4cd13dd0
--- /dev/null
+++ b/BPASmart.VariableManager/Converter/TextDisplayConvert.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+
+namespace BPASmart.VariableManager.Converter
+{
+ public class TextDisplayConvert : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value != null && bool.TryParse(value.ToString(), out bool result))
+ {
+ if (result)
+ {
+ return "取消报警";
+ }
+ else
+ {
+ return "启用报警";
+ }
+ }
+ return "启用报警";
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/BPASmart.VariableManager/Enums/DisplayFormat.cs b/BPASmart.VariableManager/Enums/DisplayFormat.cs
new file mode 100644
index 00000000..9e1a8e93
--- /dev/null
+++ b/BPASmart.VariableManager/Enums/DisplayFormat.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmart.VariableManager.Enums
+{
+ internal enum DisplayFormat
+ {
+ 二进制,
+ 十进制,
+ 十六进制,
+ }
+}
diff --git a/BPASmart.VariableManager/Enums/EAlarmType.cs b/BPASmart.VariableManager/Enums/EAlarmType.cs
new file mode 100644
index 00000000..70db0498
--- /dev/null
+++ b/BPASmart.VariableManager/Enums/EAlarmType.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmart.VariableManager.Enums
+{
+ ///
+ /// 报警类型
+ ///
+ public enum EAlarmType
+ {
+ ///
+ /// 无报警
+ ///
+ 无 = 1,
+
+ ///
+ /// 模拟量报警
+ ///
+ 模拟量报警 = 2,
+
+ ///
+ /// 离散量报警
+ ///
+ 离散量报警 = 3
+ }
+}
diff --git a/BPASmart.VariableManager/Enums/EAlongTriggerType.cs b/BPASmart.VariableManager/Enums/EAlongTriggerType.cs
new file mode 100644
index 00000000..1d8e4f90
--- /dev/null
+++ b/BPASmart.VariableManager/Enums/EAlongTriggerType.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmart.VariableManager.Enums
+{
+ ///
+ /// 沿触发类型枚举
+ ///
+ public enum EAlongTriggerType
+ {
+ ///
+ /// 下降沿触发
+ ///
+ 下降沿 = 1,
+ ///
+ /// 上升沿触发
+ ///
+ 上升沿 = 2
+ }
+
+}
diff --git a/BPASmart.VariableManager/Enums/EAnalogAlarmType.cs b/BPASmart.VariableManager/Enums/EAnalogAlarmType.cs
new file mode 100644
index 00000000..ef5381ac
--- /dev/null
+++ b/BPASmart.VariableManager/Enums/EAnalogAlarmType.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmart.VariableManager.Enums
+{
+ ///
+ /// 模拟量报警类型
+ ///
+ public enum EAnalogAlarmType
+ {
+ 高高报警 = 1,
+ 高报警 = 2,
+ 低报警 = 3,
+ 低低报警 = 4,
+ }
+}
diff --git a/BPASmart.VariableManager/Enums/EDataType.cs b/BPASmart.VariableManager/Enums/EDataType.cs
new file mode 100644
index 00000000..840bc11e
--- /dev/null
+++ b/BPASmart.VariableManager/Enums/EDataType.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmart.VariableManager.Enums
+{
+ ///
+ /// 数据类型枚举
+ ///
+ public enum EDataType
+ {
+ Bool = 1,
+ Byte = 2,
+ Int = 3,
+ Word = 4,
+ Dint = 5,
+ Dword = 6,
+ Float = 7
+ }
+}
diff --git a/BPASmart.VariableManager/Enums/EDeviceType.cs b/BPASmart.VariableManager/Enums/EDeviceType.cs
new file mode 100644
index 00000000..2dd11cde
--- /dev/null
+++ b/BPASmart.VariableManager/Enums/EDeviceType.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmart.VariableManager.Enums
+{
+ public enum EDeviceType
+ {
+ Siemens,
+ ModbusRtu,
+ ModbusTcp,
+ SerialPort,
+ }
+}
diff --git a/BPASmart.VariableManager/Enums/EOperatorType.cs b/BPASmart.VariableManager/Enums/EOperatorType.cs
new file mode 100644
index 00000000..b2a762c1
--- /dev/null
+++ b/BPASmart.VariableManager/Enums/EOperatorType.cs
@@ -0,0 +1,39 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmart.VariableManager.Enums
+{
+ ///
+ /// 判断操作符枚举
+ ///
+ public enum EOperatorType
+ {
+ ///
+ /// 大于
+ ///
+ P_GT = 1,
+ ///
+ /// 大于等于
+ ///
+ P_GE = 2,
+ ///
+ /// 等于
+ ///
+ P_EQ = 3,
+ ///
+ /// 不等于
+ ///
+ P_NE = 4,
+ ///
+ /// 小于
+ ///
+ P_LT = 5,
+ ///
+ /// 小于等于
+ ///
+ P_LE = 6
+ }
+}
diff --git a/BPASmart.VariableManager/Enums/EParity.cs b/BPASmart.VariableManager/Enums/EParity.cs
new file mode 100644
index 00000000..8920cb62
--- /dev/null
+++ b/BPASmart.VariableManager/Enums/EParity.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmart.VariableManager.Enums
+{
+ public enum EParity
+ {
+ 无,
+ 奇校验,
+ 偶校验
+ }
+}
diff --git a/BPASmart.VariableManager/Enums/ESiemensPlcType.cs b/BPASmart.VariableManager/Enums/ESiemensPlcType.cs
new file mode 100644
index 00000000..5bfc6b99
--- /dev/null
+++ b/BPASmart.VariableManager/Enums/ESiemensPlcType.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmart.VariableManager.Enums
+{
+ public enum ESiemensPlcType
+ {
+ S1200,
+ S1500,
+ S300_400,
+ S200_Smart
+ }
+}
diff --git a/BPASmart.VariableManager/Models/AlarmSet.cs b/BPASmart.VariableManager/Models/AlarmSet.cs
new file mode 100644
index 00000000..eda317b5
--- /dev/null
+++ b/BPASmart.VariableManager/Models/AlarmSet.cs
@@ -0,0 +1,53 @@
+using BPASmart.VariableManager.Enums;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+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(AlarmSet))]
+ public class AlarmSet
+ {
+ public AlarmSet()
+ {
+ AnalogAlarmModels.Clear();
+ foreach (var item in Enum.GetNames(typeof(EAnalogAlarmType)))
+ {
+ AnalogAlarmModels.Add(new AnalogAlarmModel()
+ {
+ AlarmTag = item,
+ SortTag = (EAnalogAlarmType)Enum.Parse(typeof(EAnalogAlarmType), item)
+ });
+ }
+ }
+
+ [Key]
+ public int Id { get; set; }
+
+ ///
+ /// 模拟量报警信息
+ ///
+ public ObservableCollection AnalogAlarmModels { get; set; } = new ObservableCollection();
+
+ ///
+ /// 离散量报警信息
+ ///
+ public DiscreteAlarmInfo DiscreteAlarmInfoSet { get; set; } = new DiscreteAlarmInfo();
+
+ ///
+ /// 设置外键
+ ///
+ [ForeignKey("VariableInfoId")]
+ public int VariableInfoId { get; set; }
+
+ ///
+ /// 设置导航属性
+ ///
+ public VariableInfo VariableInfo { get; set; }
+ }
+}
diff --git a/BPASmart.VariableManager/Models/AnalogAlarmInfo.cs b/BPASmart.VariableManager/Models/AnalogAlarmInfo.cs
new file mode 100644
index 00000000..7137165f
--- /dev/null
+++ b/BPASmart.VariableManager/Models/AnalogAlarmInfo.cs
@@ -0,0 +1,43 @@
+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/AnalogAlarmModel.cs b/BPASmart.VariableManager/Models/AnalogAlarmModel.cs
new file mode 100644
index 00000000..4b329ce4
--- /dev/null
+++ b/BPASmart.VariableManager/Models/AnalogAlarmModel.cs
@@ -0,0 +1,56 @@
+using BPASmart.VariableManager.Enums;
+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
+{
+ ///
+ /// 模拟量报警模块
+ ///
+ public class AnalogAlarmModel
+ {
+ [Key]
+ public int Id { get; set; }
+
+ ///
+ /// 设定报警值
+ ///
+ public int AlarmValue { get; set; } = 0;
+
+ ///
+ /// 是否启用该报警
+ ///
+ public bool IsEnable { get; set; }
+
+ ///
+ /// 报警信息
+ ///
+ public string AlarmInfo { get; set; }
+
+ ///
+ /// 报警标签
+ ///
+ public string AlarmTag { get; set; }
+
+ ///
+ /// 排序标签
+ ///
+ public EAnalogAlarmType SortTag { get; set; }
+
+ ///
+ /// 设置外键
+ ///
+ [ForeignKey("AlarmSetId")]
+ public int AlarmSetId { get; set; }
+
+ ///
+ /// 设置导航属性
+ ///
+ public AlarmSet AlarmSet { get; set; }
+ }
+}
diff --git a/BPASmart.VariableManager/Models/CommunicationModel.cs b/BPASmart.VariableManager/Models/CommunicationModel.cs
new file mode 100644
index 00000000..0bd640fc
--- /dev/null
+++ b/BPASmart.VariableManager/Models/CommunicationModel.cs
@@ -0,0 +1,44 @@
+using Microsoft.Toolkit.Mvvm.Input;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmart.VariableManager.Models
+{
+ public class CommunicationModel : NoticeBase
+ {
+ public CommunicationModel()
+ {
+ RemoveCommand = new RelayCommand