diff --git a/BPASmart.DataServer/App.xaml b/BPASmart.DataServer/App.xaml
new file mode 100644
index 00000000..44fc811d
--- /dev/null
+++ b/BPASmart.DataServer/App.xaml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BPASmart.DataServer/App.xaml.cs b/BPASmart.DataServer/App.xaml.cs
new file mode 100644
index 00000000..f8a32c1b
--- /dev/null
+++ b/BPASmart.DataServer/App.xaml.cs
@@ -0,0 +1,94 @@
+using BPASmartClient.CustomResource.Pages.Enums;
+using BPASmartClient.CustomResource.Pages.Model;
+using BPASmartClient.CustomResource.Pages.View;
+using BPASmartClient.Helper;
+using BPASmartClient.Model;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Configuration;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows;
+using BPASmart.Server;
+using BPASmartClient.CustomResource.Pages.ViewModel;
+
+namespace BPASmart.DataServer
+{
+ ///
+ /// Interaction logic for App.xaml
+ ///
+ public partial class App : Application
+ {
+ public static Window MainWindow;
+ protected override void OnStartup(StartupEventArgs e)
+ {
+ base.OnStartup(e);
+ AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
+ MenuInit();
+ MainView mv = new MainView();
+ mv.WindowState = WindowState.Normal;
+ MainWindow = mv;
+ mv.Show();
+ BPASmart.Server.Main.GetInstance.Init();
+ }
+
+ private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
+ {
+ //数据服务中心异常退出后自动重启
+ }
+
+ protected override void OnExit(ExitEventArgs e)
+ {
+ base.OnExit(e);
+ }
+
+ private void MenuInit()
+ {
+ #region 消息中心
+ ObservableCollection InfoLog = new ObservableCollection();
+
+ InfoLog.Add(new SubMenumodel()
+ {
+ SubMenuName = "消息日志",
+ AssemblyName = "BPASmartClient.CustomResource",
+ ToggleWindowPath = "Pages.View.DebugLogView",
+ SubMenuVisibility = Visibility.Visible,
+ });
+
+ MenuManage.GetInstance.menuModels.Add(new MenuModel()
+ {
+ MainMenuIcon = "",
+ MainMenuName = "消息中心",
+ Alias = "Device Management",
+ subMenumodels = InfoLog,
+ });
+ #endregion
+
+
+
+ }
+
+ private SubMenumodel AddSubMenuModel(string s)
+ {
+ return new SubMenumodel()
+ {
+ SubMenuName = s,
+ AssemblyName = "BPASmart.VariableManager",
+ ToggleWindowPath = "Views.VariableConfig",
+ SubMenuVisibility = Visibility.Visible,
+ };
+ }
+
+ private void DataSave()
+ {
+ }
+
+
+ private void DataRead()
+ {
+ Json.Read();
+ }
+ }
+}
diff --git a/BPASmart.DataServer/AssemblyInfo.cs b/BPASmart.DataServer/AssemblyInfo.cs
new file mode 100644
index 00000000..8b5504ec
--- /dev/null
+++ b/BPASmart.DataServer/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.DataServer/BPASmart.DataServer.csproj b/BPASmart.DataServer/BPASmart.DataServer.csproj
new file mode 100644
index 00000000..5e617223
--- /dev/null
+++ b/BPASmart.DataServer/BPASmart.DataServer.csproj
@@ -0,0 +1,15 @@
+
+
+
+ WinExe
+ net6.0-windows
+ enable
+ true
+
+
+
+
+
+
+
+
diff --git a/BPASmart.VariableManager/Models/AlarmSet.cs b/BPASmart.Model/AlarmSet.cs
similarity index 93%
rename from BPASmart.VariableManager/Models/AlarmSet.cs
rename to BPASmart.Model/AlarmSet.cs
index 210e5dcf..6d175200 100644
--- a/BPASmart.VariableManager/Models/AlarmSet.cs
+++ b/BPASmart.Model/AlarmSet.cs
@@ -1,4 +1,4 @@
-using BPASmart.VariableManager.Enums;
+using BPASmart.Model;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -8,7 +8,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace BPASmart.VariableManager.Models
+namespace BPASmart.Model
{
public class AlarmSet : NoticeBase
{
diff --git a/BPASmart.VariableManager/Models/AnalogAlarmModel.cs b/BPASmart.Model/AnalogAlarmModel.cs
similarity index 94%
rename from BPASmart.VariableManager/Models/AnalogAlarmModel.cs
rename to BPASmart.Model/AnalogAlarmModel.cs
index 87dba823..14aab6bd 100644
--- a/BPASmart.VariableManager/Models/AnalogAlarmModel.cs
+++ b/BPASmart.Model/AnalogAlarmModel.cs
@@ -1,4 +1,4 @@
-using BPASmart.VariableManager.Enums;
+using BPASmart.Model;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
@@ -7,7 +7,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace BPASmart.VariableManager.Models
+namespace BPASmart.Model
{
///
/// 模拟量报警模块
diff --git a/BPASmart.Model/BPASmart.Model.csproj b/BPASmart.Model/BPASmart.Model.csproj
new file mode 100644
index 00000000..92946c2e
--- /dev/null
+++ b/BPASmart.Model/BPASmart.Model.csproj
@@ -0,0 +1,15 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
+
+
+
+
+
+
diff --git a/BPASmart.VariableManager/Models/CommDeviceModel/Invoance.cs b/BPASmart.Model/CommDeviceModel/Invoance.cs
similarity index 84%
rename from BPASmart.VariableManager/Models/CommDeviceModel/Invoance.cs
rename to BPASmart.Model/CommDeviceModel/Invoance.cs
index 2870607d..fe49c55b 100644
--- a/BPASmart.VariableManager/Models/CommDeviceModel/Invoance.cs
+++ b/BPASmart.Model/CommDeviceModel/Invoance.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace BPASmart.VariableManager.Models
+namespace BPASmart.Model
{
///
/// 汇川PLC
diff --git a/BPASmart.VariableManager/Models/CommDeviceModel/KincoOneMachine.cs b/BPASmart.Model/CommDeviceModel/KincoOneMachine.cs
similarity index 85%
rename from BPASmart.VariableManager/Models/CommDeviceModel/KincoOneMachine.cs
rename to BPASmart.Model/CommDeviceModel/KincoOneMachine.cs
index cfef2d29..13298913 100644
--- a/BPASmart.VariableManager/Models/CommDeviceModel/KincoOneMachine.cs
+++ b/BPASmart.Model/CommDeviceModel/KincoOneMachine.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace BPASmart.VariableManager.Models
+namespace BPASmart.Model
{
///
/// 步科一体机
diff --git a/BPASmart.VariableManager/Models/CommDeviceModel/ModbusRtu.cs b/BPASmart.Model/CommDeviceModel/ModbusRtu.cs
similarity index 93%
rename from BPASmart.VariableManager/Models/CommDeviceModel/ModbusRtu.cs
rename to BPASmart.Model/CommDeviceModel/ModbusRtu.cs
index 3520c84e..32a1533c 100644
--- a/BPASmart.VariableManager/Models/CommDeviceModel/ModbusRtu.cs
+++ b/BPASmart.Model/CommDeviceModel/ModbusRtu.cs
@@ -1,4 +1,4 @@
-using BPASmart.VariableManager.Enums;
+using BPASmart.Model;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -8,7 +8,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows;
-namespace BPASmart.VariableManager.Models
+namespace BPASmart.Model
{
public class ModbusRtu : ICommunicationDevice
{
diff --git a/BPASmart.VariableManager/Models/CommDeviceModel/ModbusTcp.cs b/BPASmart.Model/CommDeviceModel/ModbusTcp.cs
similarity index 93%
rename from BPASmart.VariableManager/Models/CommDeviceModel/ModbusTcp.cs
rename to BPASmart.Model/CommDeviceModel/ModbusTcp.cs
index ebf6241a..93f2fae3 100644
--- a/BPASmart.VariableManager/Models/CommDeviceModel/ModbusTcp.cs
+++ b/BPASmart.Model/CommDeviceModel/ModbusTcp.cs
@@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows;
-namespace BPASmart.VariableManager.Models
+namespace BPASmart.Model
{
public class ModbusTcp : ICommunicationDevice
{
diff --git a/BPASmart.VariableManager/Models/CommDeviceModel/Siemens.cs b/BPASmart.Model/CommDeviceModel/Siemens.cs
similarity index 90%
rename from BPASmart.VariableManager/Models/CommDeviceModel/Siemens.cs
rename to BPASmart.Model/CommDeviceModel/Siemens.cs
index 4f67206a..171b3df7 100644
--- a/BPASmart.VariableManager/Models/CommDeviceModel/Siemens.cs
+++ b/BPASmart.Model/CommDeviceModel/Siemens.cs
@@ -1,4 +1,4 @@
-using BPASmart.VariableManager.Enums;
+using BPASmart.Model;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -7,7 +7,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows;
-namespace BPASmart.VariableManager.Models
+namespace BPASmart.Model
{
public class Siemens : ICommunicationDevice
{
diff --git a/BPASmart.VariableManager/Models/CommDeviceModel/kinco.cs b/BPASmart.Model/CommDeviceModel/kinco.cs
similarity index 84%
rename from BPASmart.VariableManager/Models/CommDeviceModel/kinco.cs
rename to BPASmart.Model/CommDeviceModel/kinco.cs
index fdd99955..dcc9bcb7 100644
--- a/BPASmart.VariableManager/Models/CommDeviceModel/kinco.cs
+++ b/BPASmart.Model/CommDeviceModel/kinco.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace BPASmart.VariableManager.Models
+namespace BPASmart.Model
{
///
/// 步科PLC
diff --git a/BPASmart.VariableManager/Models/CommunicationModel.cs b/BPASmart.Model/CommunicationModel.cs
similarity index 87%
rename from BPASmart.VariableManager/Models/CommunicationModel.cs
rename to BPASmart.Model/CommunicationModel.cs
index 0b5df4a5..9b70221f 100644
--- a/BPASmart.VariableManager/Models/CommunicationModel.cs
+++ b/BPASmart.Model/CommunicationModel.cs
@@ -7,7 +7,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace BPASmart.VariableManager.Models
+namespace BPASmart.Model
{
public class CommunicationModel : NoticeBase
{
@@ -33,6 +33,10 @@ namespace BPASmart.VariableManager.Models
public string DeviceName { get { return _mDeviceName; } set { _mDeviceName = value; OnPropertyChanged(); } }
private string _mDeviceName;
+
+ public string ModelName { get { return _mModelName; } set { _mModelName = value; OnPropertyChanged(); } }
+ private string _mModelName;
+
///
/// 变量表数据
///
diff --git a/BPASmart.VariableManager/Models/CommunicationPar.cs b/BPASmart.Model/CommunicationPar.cs
similarity index 80%
rename from BPASmart.VariableManager/Models/CommunicationPar.cs
rename to BPASmart.Model/CommunicationPar.cs
index 0c4f051f..765c6822 100644
--- a/BPASmart.VariableManager/Models/CommunicationPar.cs
+++ b/BPASmart.Model/CommunicationPar.cs
@@ -5,9 +5,9 @@ using System.Text;
using System.Threading.Tasks;
using System.Collections.ObjectModel;
-namespace BPASmart.VariableManager.Models
+namespace BPASmart.Model
{
- internal class CommunicationPar
+ public class CommunicationPar
{
public ObservableCollection CommunicationDevices { get; set; } = new ObservableCollection();
}
diff --git a/BPASmart.VariableManager/Models/DelegationNotifi.cs b/BPASmart.Model/DelegationNotifi.cs
similarity index 96%
rename from BPASmart.VariableManager/Models/DelegationNotifi.cs
rename to BPASmart.Model/DelegationNotifi.cs
index 0a589349..398409a4 100644
--- a/BPASmart.VariableManager/Models/DelegationNotifi.cs
+++ b/BPASmart.Model/DelegationNotifi.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace BPASmart.VariableManager.Models
+namespace BPASmart.Model
{
public class DelegationNotifi
{
diff --git a/BPASmart.VariableManager/Models/DeviceManagermentResult.cs b/BPASmart.Model/DeviceManagermentResult.cs
similarity index 86%
rename from BPASmart.VariableManager/Models/DeviceManagermentResult.cs
rename to BPASmart.Model/DeviceManagermentResult.cs
index 203f26a3..16632956 100644
--- a/BPASmart.VariableManager/Models/DeviceManagermentResult.cs
+++ b/BPASmart.Model/DeviceManagermentResult.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace BPASmart.VariableManager.Models
+namespace BPASmart.Model
{
public class DeviceManagermentResult
{
diff --git a/BPASmart.VariableManager/Models/DiscreteAlarmInfo.cs b/BPASmart.Model/DiscreteAlarmInfo.cs
similarity index 91%
rename from BPASmart.VariableManager/Models/DiscreteAlarmInfo.cs
rename to BPASmart.Model/DiscreteAlarmInfo.cs
index e65cc592..b5e6bdd3 100644
--- a/BPASmart.VariableManager/Models/DiscreteAlarmInfo.cs
+++ b/BPASmart.Model/DiscreteAlarmInfo.cs
@@ -5,9 +5,9 @@ using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using BPASmart.VariableManager.Enums;
+using BPASmart.Model;
-namespace BPASmart.VariableManager.Models
+namespace BPASmart.Model
{
///
/// 离散量报警信息
diff --git a/BPASmart.VariableManager/Enums/DisplayFormat.cs b/BPASmart.Model/Enums/DisplayFormat.cs
similarity index 72%
rename from BPASmart.VariableManager/Enums/DisplayFormat.cs
rename to BPASmart.Model/Enums/DisplayFormat.cs
index 9e1a8e93..81e6034e 100644
--- a/BPASmart.VariableManager/Enums/DisplayFormat.cs
+++ b/BPASmart.Model/Enums/DisplayFormat.cs
@@ -4,9 +4,9 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace BPASmart.VariableManager.Enums
+namespace BPASmart.Model
{
- internal enum DisplayFormat
+ public enum DisplayFormat
{
二进制,
十进制,
diff --git a/BPASmart.VariableManager/Enums/EAlarmType.cs b/BPASmart.Model/Enums/EAlarmType.cs
similarity index 92%
rename from BPASmart.VariableManager/Enums/EAlarmType.cs
rename to BPASmart.Model/Enums/EAlarmType.cs
index 70db0498..e369b9d9 100644
--- a/BPASmart.VariableManager/Enums/EAlarmType.cs
+++ b/BPASmart.Model/Enums/EAlarmType.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace BPASmart.VariableManager.Enums
+namespace BPASmart.Model
{
///
/// 报警类型
diff --git a/BPASmart.VariableManager/Enums/EAlongTriggerType.cs b/BPASmart.Model/Enums/EAlongTriggerType.cs
similarity index 91%
rename from BPASmart.VariableManager/Enums/EAlongTriggerType.cs
rename to BPASmart.Model/Enums/EAlongTriggerType.cs
index 1d8e4f90..456d2327 100644
--- a/BPASmart.VariableManager/Enums/EAlongTriggerType.cs
+++ b/BPASmart.Model/Enums/EAlongTriggerType.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace BPASmart.VariableManager.Enums
+namespace BPASmart.Model
{
///
/// 沿触发类型枚举
diff --git a/BPASmart.VariableManager/Enums/EAnalogAlarmType.cs b/BPASmart.Model/Enums/EAnalogAlarmType.cs
similarity index 89%
rename from BPASmart.VariableManager/Enums/EAnalogAlarmType.cs
rename to BPASmart.Model/Enums/EAnalogAlarmType.cs
index ef5381ac..46ca2144 100644
--- a/BPASmart.VariableManager/Enums/EAnalogAlarmType.cs
+++ b/BPASmart.Model/Enums/EAnalogAlarmType.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace BPASmart.VariableManager.Enums
+namespace BPASmart.Model
{
///
/// 模拟量报警类型
diff --git a/BPASmart.VariableManager/Enums/EDataType.cs b/BPASmart.Model/Enums/EDataType.cs
similarity index 89%
rename from BPASmart.VariableManager/Enums/EDataType.cs
rename to BPASmart.Model/Enums/EDataType.cs
index 840bc11e..463447a4 100644
--- a/BPASmart.VariableManager/Enums/EDataType.cs
+++ b/BPASmart.Model/Enums/EDataType.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace BPASmart.VariableManager.Enums
+namespace BPASmart.Model
{
///
/// 数据类型枚举
diff --git a/BPASmart.VariableManager/Enums/EDeviceType.cs b/BPASmart.Model/Enums/EDeviceType.cs
similarity index 85%
rename from BPASmart.VariableManager/Enums/EDeviceType.cs
rename to BPASmart.Model/Enums/EDeviceType.cs
index 2dd11cde..651e3440 100644
--- a/BPASmart.VariableManager/Enums/EDeviceType.cs
+++ b/BPASmart.Model/Enums/EDeviceType.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace BPASmart.VariableManager.Enums
+namespace BPASmart.Model
{
public enum EDeviceType
{
diff --git a/BPASmart.VariableManager/Enums/EOperatorType.cs b/BPASmart.Model/Enums/EOperatorType.cs
similarity index 94%
rename from BPASmart.VariableManager/Enums/EOperatorType.cs
rename to BPASmart.Model/Enums/EOperatorType.cs
index b2a762c1..996edb4b 100644
--- a/BPASmart.VariableManager/Enums/EOperatorType.cs
+++ b/BPASmart.Model/Enums/EOperatorType.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace BPASmart.VariableManager.Enums
+namespace BPASmart.Model
{
///
/// 判断操作符枚举
diff --git a/BPASmart.VariableManager/Enums/EParity.cs b/BPASmart.Model/Enums/EParity.cs
similarity index 83%
rename from BPASmart.VariableManager/Enums/EParity.cs
rename to BPASmart.Model/Enums/EParity.cs
index 8920cb62..ffac319d 100644
--- a/BPASmart.VariableManager/Enums/EParity.cs
+++ b/BPASmart.Model/Enums/EParity.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace BPASmart.VariableManager.Enums
+namespace BPASmart.Model
{
public enum EParity
{
diff --git a/BPASmart.VariableManager/Enums/ESiemensPlcType.cs b/BPASmart.Model/Enums/ESiemensPlcType.cs
similarity index 85%
rename from BPASmart.VariableManager/Enums/ESiemensPlcType.cs
rename to BPASmart.Model/Enums/ESiemensPlcType.cs
index 5bfc6b99..cb922307 100644
--- a/BPASmart.VariableManager/Enums/ESiemensPlcType.cs
+++ b/BPASmart.Model/Enums/ESiemensPlcType.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace BPASmart.VariableManager.Enums
+namespace BPASmart.Model
{
public enum ESiemensPlcType
{
diff --git a/BPASmart.VariableManager/Interfaces/ICommunicationDevice.cs b/BPASmart.Model/Interfaces/ICommunicationDevice.cs
similarity index 83%
rename from BPASmart.VariableManager/Interfaces/ICommunicationDevice.cs
rename to BPASmart.Model/Interfaces/ICommunicationDevice.cs
index 78a9cb42..954a8885 100644
--- a/BPASmart.VariableManager/Interfaces/ICommunicationDevice.cs
+++ b/BPASmart.Model/Interfaces/ICommunicationDevice.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace BPASmart.VariableManager
+namespace BPASmart.Model
{
public interface ICommunicationDevice
{
diff --git a/BPASmart.Model/Interfaces/IServer.cs b/BPASmart.Model/Interfaces/IServer.cs
new file mode 100644
index 00000000..30978ab6
--- /dev/null
+++ b/BPASmart.Model/Interfaces/IServer.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmart.Model
+{
+ public interface IServer
+ {
+ void Init();
+ }
+}
diff --git a/BPASmart.VariableManager/Models/NoticeBase.cs b/BPASmart.Model/NoticeBase.cs
similarity index 89%
rename from BPASmart.VariableManager/Models/NoticeBase.cs
rename to BPASmart.Model/NoticeBase.cs
index 22b29370..9656d4bf 100644
--- a/BPASmart.VariableManager/Models/NoticeBase.cs
+++ b/BPASmart.Model/NoticeBase.cs
@@ -7,7 +7,7 @@ using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using System.Collections.ObjectModel;
-namespace BPASmart.VariableManager
+namespace BPASmart.Model
{
public class NoticeBase : ObservableObject
{
diff --git a/BPASmart.VariableManager/Models/VariableInfo.cs b/BPASmart.Model/VariableInfo.cs
similarity index 96%
rename from BPASmart.VariableManager/Models/VariableInfo.cs
rename to BPASmart.Model/VariableInfo.cs
index de428963..26c62e6c 100644
--- a/BPASmart.VariableManager/Models/VariableInfo.cs
+++ b/BPASmart.Model/VariableInfo.cs
@@ -5,16 +5,14 @@ using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using BPASmart.VariableManager.Models;
-using BPASmart.VariableManager.Enums;
+using BPASmart.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Newtonsoft.Json;
using System.Collections.ObjectModel;
using System.Windows;
using Microsoft.Toolkit.Mvvm.Input;
-using BPASmartClient.Helper;
-namespace BPASmart.VariableManager.Models
+namespace BPASmart.Model
{
public class VariableInfo : AlarmSet
{
diff --git a/BPASmart.Server/BPASmart.Server.csproj b/BPASmart.Server/BPASmart.Server.csproj
new file mode 100644
index 00000000..46e749d2
--- /dev/null
+++ b/BPASmart.Server/BPASmart.Server.csproj
@@ -0,0 +1,19 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BPASmart.Server/CommunicationServer.cs b/BPASmart.Server/CommunicationServer.cs
new file mode 100644
index 00000000..2cd030d7
--- /dev/null
+++ b/BPASmart.Server/CommunicationServer.cs
@@ -0,0 +1,35 @@
+using BPASmart.Model;
+using BPA.Helper;
+using BPA.Communication;
+using Microsoft.EntityFrameworkCore.Metadata.Conventions;
+
+namespace BPASmart.Server
+{
+ internal class CommunicationServer : IServer
+ {
+ public void Init()
+ {
+ BPASmartClient.Message.MessageLog.GetInstance.ShowDebugLog("通讯模块初始化");
+ Json.Data.CommunicationDevices.ToList()?.ForEach(item =>
+ {
+ switch (item.CommDevice)
+ {
+ case ModbusRtu _modbusRtu:
+ break;
+ case ModbusTcp _modbusTcp:
+ ModbusTcpMaster modbusTcpMaster = new ModbusTcpMaster();
+ modbusTcpMaster.ConnectOk = new Action(() =>
+ {
+
+ });
+ modbusTcpMaster.ModbusTcpConnect(DeviceType.kinco_PLC, _modbusTcp.IP, _modbusTcp.PortNum);
+ break;
+ case Siemens _siemens:
+ break;
+ default:
+ break;
+ }
+ });
+ }
+ }
+}
\ No newline at end of file
diff --git a/BPASmart.Server/Main.cs b/BPASmart.Server/Main.cs
new file mode 100644
index 00000000..260f6ab0
--- /dev/null
+++ b/BPASmart.Server/Main.cs
@@ -0,0 +1,31 @@
+using BPA.Helper;
+using BPASmart.Model;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmart.Server
+{
+ public class Main
+ {
+ private volatile static Main _Instance;
+ public static Main GetInstance => _Instance ?? (_Instance = new Main());
+ private Main() { }
+
+ public void Init()
+ {
+ Json.Read();
+ Assembly.GetExecutingAssembly().GetTypes()?.ToList()?.ForEach(item =>
+ {
+ if (item.GetInterfaces().Contains(typeof(IServer)))
+ {
+ (Activator.CreateInstance(item) as IServer)?.Init();
+ }
+ });
+ }
+
+ }
+}
diff --git a/BPASmart.VariableManager/App.xaml.cs b/BPASmart.VariableManager/App.xaml.cs
index b6730b7e..5720ffc8 100644
--- a/BPASmart.VariableManager/App.xaml.cs
+++ b/BPASmart.VariableManager/App.xaml.cs
@@ -1,5 +1,4 @@
-using BPASmart.VariableManager.Models;
-using BPASmartClient.CustomResource.Pages.Enums;
+using BPASmartClient.CustomResource.Pages.Enums;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.CustomResource.Pages.View;
using BPASmartClient.Helper;
@@ -11,6 +10,7 @@ using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
+using BPASmart.Model;
namespace BPASmart.VariableManager
{
@@ -72,6 +72,17 @@ namespace BPASmart.VariableManager
RecipeManage.Add(AddSubMenuModel(o.ToString()));
}), "AddCommunicationDevice");
+ ActionManage.GetInstance.Register(new Action