From 5bf99909fcbdd34d8b3651fc3ebc64e8a1846e1a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=A6=82=E6=84=8F=20=E5=BD=AD?= <2417589739@qq.com>
Date: Thu, 8 Sep 2022 20:42:39 +0800
Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E4=B8=AD=E5=BF=83=E7=A8=8B?=
=?UTF-8?q?=E5=BA=8F=E5=BC=80=E5=8F=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
BPASmart.DataServer/App.xaml | 43 +++++++++
BPASmart.DataServer/App.xaml.cs | 94 +++++++++++++++++++
BPASmart.DataServer/AssemblyInfo.cs | 10 ++
.../BPASmart.DataServer.csproj | 15 +++
.../Models => BPASmart.Model}/AlarmSet.cs | 4 +-
.../AnalogAlarmModel.cs | 4 +-
BPASmart.Model/BPASmart.Model.csproj | 15 +++
.../CommDeviceModel/Invoance.cs | 2 +-
.../CommDeviceModel/KincoOneMachine.cs | 2 +-
.../CommDeviceModel/ModbusRtu.cs | 4 +-
.../CommDeviceModel/ModbusTcp.cs | 2 +-
.../CommDeviceModel/Siemens.cs | 4 +-
.../CommDeviceModel/kinco.cs | 2 +-
.../CommunicationModel.cs | 6 +-
.../CommunicationPar.cs | 4 +-
.../DelegationNotifi.cs | 2 +-
.../DeviceManagermentResult.cs | 2 +-
.../DiscreteAlarmInfo.cs | 4 +-
.../Enums/DisplayFormat.cs | 4 +-
.../Enums/EAlarmType.cs | 2 +-
.../Enums/EAlongTriggerType.cs | 2 +-
.../Enums/EAnalogAlarmType.cs | 2 +-
.../Enums/EDataType.cs | 2 +-
.../Enums/EDeviceType.cs | 2 +-
.../Enums/EOperatorType.cs | 2 +-
.../Enums/EParity.cs | 2 +-
.../Enums/ESiemensPlcType.cs | 2 +-
.../Interfaces/ICommunicationDevice.cs | 2 +-
BPASmart.Model/Interfaces/IServer.cs | 13 +++
.../Models => BPASmart.Model}/NoticeBase.cs | 2 +-
.../Models => BPASmart.Model}/VariableInfo.cs | 6 +-
BPASmart.Server/BPASmart.Server.csproj | 19 ++++
BPASmart.Server/CommunicationServer.cs | 35 +++++++
BPASmart.Server/Main.cs | 31 ++++++
BPASmart.VariableManager/App.xaml.cs | 15 ++-
.../BPASmart.VariableManager.csproj | 17 ++--
.../Converter/AlarmTypeTextConvert.cs | 2 +-
.../Converter/DeviceVisibleConverter.cs | 3 +-
.../ViewModels/CommunicationSetViewModel.cs | 9 +-
.../ViewModels/NewDeviceViewModel.cs | 3 +-
.../ViewModels/VariableConfigViewModel.cs | 3 +-
.../Views/CommunicationSetView.xaml | 36 ++++++-
.../Views/CommunicationSetView.xaml.cs | 2 +-
.../Views/NewDeviceView.xaml.cs | 2 +-
.../Views/VariableConfig.xaml.cs | 2 +-
BPASmartClient.Message/MessageLog.cs | 33 +------
SmartClient.sln | 75 ++++++++++++++-
47 files changed, 451 insertions(+), 98 deletions(-)
create mode 100644 BPASmart.DataServer/App.xaml
create mode 100644 BPASmart.DataServer/App.xaml.cs
create mode 100644 BPASmart.DataServer/AssemblyInfo.cs
create mode 100644 BPASmart.DataServer/BPASmart.DataServer.csproj
rename {BPASmart.VariableManager/Models => BPASmart.Model}/AlarmSet.cs (93%)
rename {BPASmart.VariableManager/Models => BPASmart.Model}/AnalogAlarmModel.cs (94%)
create mode 100644 BPASmart.Model/BPASmart.Model.csproj
rename {BPASmart.VariableManager/Models => BPASmart.Model}/CommDeviceModel/Invoance.cs (84%)
rename {BPASmart.VariableManager/Models => BPASmart.Model}/CommDeviceModel/KincoOneMachine.cs (85%)
rename {BPASmart.VariableManager/Models => BPASmart.Model}/CommDeviceModel/ModbusRtu.cs (93%)
rename {BPASmart.VariableManager/Models => BPASmart.Model}/CommDeviceModel/ModbusTcp.cs (93%)
rename {BPASmart.VariableManager/Models => BPASmart.Model}/CommDeviceModel/Siemens.cs (90%)
rename {BPASmart.VariableManager/Models => BPASmart.Model}/CommDeviceModel/kinco.cs (84%)
rename {BPASmart.VariableManager/Models => BPASmart.Model}/CommunicationModel.cs (87%)
rename {BPASmart.VariableManager/Models => BPASmart.Model}/CommunicationPar.cs (80%)
rename {BPASmart.VariableManager/Models => BPASmart.Model}/DelegationNotifi.cs (96%)
rename {BPASmart.VariableManager/Models => BPASmart.Model}/DeviceManagermentResult.cs (86%)
rename {BPASmart.VariableManager/Models => BPASmart.Model}/DiscreteAlarmInfo.cs (91%)
rename {BPASmart.VariableManager => BPASmart.Model}/Enums/DisplayFormat.cs (72%)
rename {BPASmart.VariableManager => BPASmart.Model}/Enums/EAlarmType.cs (92%)
rename {BPASmart.VariableManager => BPASmart.Model}/Enums/EAlongTriggerType.cs (91%)
rename {BPASmart.VariableManager => BPASmart.Model}/Enums/EAnalogAlarmType.cs (89%)
rename {BPASmart.VariableManager => BPASmart.Model}/Enums/EDataType.cs (89%)
rename {BPASmart.VariableManager => BPASmart.Model}/Enums/EDeviceType.cs (85%)
rename {BPASmart.VariableManager => BPASmart.Model}/Enums/EOperatorType.cs (94%)
rename {BPASmart.VariableManager => BPASmart.Model}/Enums/EParity.cs (83%)
rename {BPASmart.VariableManager => BPASmart.Model}/Enums/ESiemensPlcType.cs (85%)
rename {BPASmart.VariableManager => BPASmart.Model}/Interfaces/ICommunicationDevice.cs (83%)
create mode 100644 BPASmart.Model/Interfaces/IServer.cs
rename {BPASmart.VariableManager/Models => BPASmart.Model}/NoticeBase.cs (89%)
rename {BPASmart.VariableManager/Models => BPASmart.Model}/VariableInfo.cs (96%)
create mode 100644 BPASmart.Server/BPASmart.Server.csproj
create mode 100644 BPASmart.Server/CommunicationServer.cs
create mode 100644 BPASmart.Server/Main.cs
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