ソースを参照

数据中心程序开发

样式分支
pry 2年前
コミット
5bf99909fc
47個のファイルの変更451行の追加98行の削除
  1. +43
    -0
      BPASmart.DataServer/App.xaml
  2. +94
    -0
      BPASmart.DataServer/App.xaml.cs
  3. +10
    -0
      BPASmart.DataServer/AssemblyInfo.cs
  4. +15
    -0
      BPASmart.DataServer/BPASmart.DataServer.csproj
  5. +2
    -2
      BPASmart.Model/AlarmSet.cs
  6. +2
    -2
      BPASmart.Model/AnalogAlarmModel.cs
  7. +15
    -0
      BPASmart.Model/BPASmart.Model.csproj
  8. +1
    -1
      BPASmart.Model/CommDeviceModel/Invoance.cs
  9. +1
    -1
      BPASmart.Model/CommDeviceModel/KincoOneMachine.cs
  10. +2
    -2
      BPASmart.Model/CommDeviceModel/ModbusRtu.cs
  11. +1
    -1
      BPASmart.Model/CommDeviceModel/ModbusTcp.cs
  12. +2
    -2
      BPASmart.Model/CommDeviceModel/Siemens.cs
  13. +1
    -1
      BPASmart.Model/CommDeviceModel/kinco.cs
  14. +5
    -1
      BPASmart.Model/CommunicationModel.cs
  15. +2
    -2
      BPASmart.Model/CommunicationPar.cs
  16. +1
    -1
      BPASmart.Model/DelegationNotifi.cs
  17. +1
    -1
      BPASmart.Model/DeviceManagermentResult.cs
  18. +2
    -2
      BPASmart.Model/DiscreteAlarmInfo.cs
  19. +2
    -2
      BPASmart.Model/Enums/DisplayFormat.cs
  20. +1
    -1
      BPASmart.Model/Enums/EAlarmType.cs
  21. +1
    -1
      BPASmart.Model/Enums/EAlongTriggerType.cs
  22. +1
    -1
      BPASmart.Model/Enums/EAnalogAlarmType.cs
  23. +1
    -1
      BPASmart.Model/Enums/EDataType.cs
  24. +1
    -1
      BPASmart.Model/Enums/EDeviceType.cs
  25. +1
    -1
      BPASmart.Model/Enums/EOperatorType.cs
  26. +1
    -1
      BPASmart.Model/Enums/EParity.cs
  27. +1
    -1
      BPASmart.Model/Enums/ESiemensPlcType.cs
  28. +1
    -1
      BPASmart.Model/Interfaces/ICommunicationDevice.cs
  29. +13
    -0
      BPASmart.Model/Interfaces/IServer.cs
  30. +1
    -1
      BPASmart.Model/NoticeBase.cs
  31. +2
    -4
      BPASmart.Model/VariableInfo.cs
  32. +19
    -0
      BPASmart.Server/BPASmart.Server.csproj
  33. +35
    -0
      BPASmart.Server/CommunicationServer.cs
  34. +31
    -0
      BPASmart.Server/Main.cs
  35. +13
    -2
      BPASmart.VariableManager/App.xaml.cs
  36. +8
    -9
      BPASmart.VariableManager/BPASmart.VariableManager.csproj
  37. +1
    -1
      BPASmart.VariableManager/Converter/AlarmTypeTextConvert.cs
  38. +2
    -1
      BPASmart.VariableManager/Converter/DeviceVisibleConverter.cs
  39. +5
    -4
      BPASmart.VariableManager/ViewModels/CommunicationSetViewModel.cs
  40. +1
    -2
      BPASmart.VariableManager/ViewModels/NewDeviceViewModel.cs
  41. +1
    -2
      BPASmart.VariableManager/ViewModels/VariableConfigViewModel.cs
  42. +31
    -5
      BPASmart.VariableManager/Views/CommunicationSetView.xaml
  43. +1
    -1
      BPASmart.VariableManager/Views/CommunicationSetView.xaml.cs
  44. +1
    -1
      BPASmart.VariableManager/Views/NewDeviceView.xaml.cs
  45. +1
    -1
      BPASmart.VariableManager/Views/VariableConfig.xaml.cs
  46. +1
    -32
      BPASmartClient.Message/MessageLog.cs
  47. +73
    -2
      SmartClient.sln

+ 43
- 0
BPASmart.DataServer/App.xaml ファイルの表示

@@ -0,0 +1,43 @@
<Application
x:Class="BPASmart.DataServer.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:con="clr-namespace:BPASmartClient.CustomResource.Converters;assembly=BPASmartClient.CustomResource"
xmlns:local="clr-namespace:BPASmart.DataServer">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>

<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecCheckBox.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecTitleBarButton.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/GlobalStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecComboBox.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecIcoButtonStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecToggleButton.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/BeveledRadioButtonStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/DatePickeerDictionary.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecButtonStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/TextBoxStyle.xaml" />

<ResourceDictionary>
<con:ColorConverter x:Key="ColorConverter" />
<con:TextConverter x:Key="TextConverter" />
<con:VisibleTypeConverter x:Key="VisibleTypeConverter" />
<con:StatusConverter x:Key="StatusConverter" />
<con:StringToIconConverter x:Key="StringToIconConverter" />

<!--<locaCon:DataTableRedundantConverter x:Key="tabConvert" />
<locaCon:TextDisplayConvert x:Key="textDisplayConvert" />
<locaCon:DiscreteAlarmConvert x:Key="discreteAlarmConvert" />
<locaCon:AnalogAlarmConvert x:Key="analogAlarmConvert" />
<locaCon:IsEnableConvert x:Key="IsEnableConvert" />-->

<SolidColorBrush x:Key="PoupTextblockColor" Color="#009dff" />
<SolidColorBrush x:Key="tabColor" Color="#FF2AB2E7" />
<SolidColorBrush x:Key="bordColor" Color="#332AB2E7" />
</ResourceDictionary>

</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

+ 94
- 0
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
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
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<SubMenumodel> InfoLog = new ObservableCollection<SubMenumodel>();

InfoLog.Add(new SubMenumodel()
{
SubMenuName = "消息日志",
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.DebugLogView",
SubMenuVisibility = Visibility.Visible,
});

MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe603;",
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<CommunicationPar>.Read();
}
}
}

+ 10
- 0
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)
)]

+ 15
- 0
BPASmart.DataServer/BPASmart.DataServer.csproj ファイルの表示

@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\BPASmart.Server\BPASmart.Server.csproj" />
<ProjectReference Include="..\BPASmartClient.CustomResource\BPASmartClient.CustomResource.csproj" />
</ItemGroup>

</Project>

BPASmart.VariableManager/Models/AlarmSet.cs → 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
{

BPASmart.VariableManager/Models/AnalogAlarmModel.cs → 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
{
/// <summary>
/// 模拟量报警模块

+ 15
- 0
BPASmart.Model/BPASmart.Model.csproj ファイルの表示

@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="System.IO.Ports" Version="6.0.0" />
</ItemGroup>

</Project>

BPASmart.VariableManager/Models/CommDeviceModel/Invoance.cs → 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
{
/// <summary>
/// 汇川PLC

BPASmart.VariableManager/Models/CommDeviceModel/KincoOneMachine.cs → 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
{
/// <summary>
/// 步科一体机

BPASmart.VariableManager/Models/CommDeviceModel/ModbusRtu.cs → 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
{

BPASmart.VariableManager/Models/CommDeviceModel/ModbusTcp.cs → 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
{

BPASmart.VariableManager/Models/CommDeviceModel/Siemens.cs → 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
{

BPASmart.VariableManager/Models/CommDeviceModel/kinco.cs → 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
{
/// <summary>
/// 步科PLC

BPASmart.VariableManager/Models/CommunicationModel.cs → 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;

/// <summary>
/// 变量表数据
/// </summary>

BPASmart.VariableManager/Models/CommunicationPar.cs → 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<CommunicationModel> CommunicationDevices { get; set; } = new ObservableCollection<CommunicationModel>();
}

BPASmart.VariableManager/Models/DelegationNotifi.cs → 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
{

BPASmart.VariableManager/Models/DeviceManagermentResult.cs → 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
{

BPASmart.VariableManager/Models/DiscreteAlarmInfo.cs → 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
{
/// <summary>
/// 离散量报警信息

BPASmart.VariableManager/Enums/DisplayFormat.cs → 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
{
二进制,
十进制,

BPASmart.VariableManager/Enums/EAlarmType.cs → 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
{
/// <summary>
/// 报警类型

BPASmart.VariableManager/Enums/EAlongTriggerType.cs → 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
{
/// <summary>
/// 沿触发类型枚举

BPASmart.VariableManager/Enums/EAnalogAlarmType.cs → 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
{
/// <summary>
/// 模拟量报警类型

BPASmart.VariableManager/Enums/EDataType.cs → 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
{
/// <summary>
/// 数据类型枚举

BPASmart.VariableManager/Enums/EDeviceType.cs → 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
{

BPASmart.VariableManager/Enums/EOperatorType.cs → 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
{
/// <summary>
/// 判断操作符枚举

BPASmart.VariableManager/Enums/EParity.cs → 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
{

BPASmart.VariableManager/Enums/ESiemensPlcType.cs → 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
{

BPASmart.VariableManager/Interfaces/ICommunicationDevice.cs → 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
{

+ 13
- 0
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();
}
}

BPASmart.VariableManager/Models/NoticeBase.cs → 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
{

BPASmart.VariableManager/Models/VariableInfo.cs → 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
{

+ 19
- 0
BPASmart.Server/BPASmart.Server.csproj ファイルの表示

@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.Communication" Version="1.0.8" />
<PackageReference Include="BPA.Helper" Version="1.0.6" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\BPASmart.Model\BPASmart.Model.csproj" />
<ProjectReference Include="..\BPASmartClient.Message\BPASmartClient.Message.csproj" />
</ItemGroup>

</Project>

+ 35
- 0
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<CommunicationPar>.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;
}
});
}
}
}

+ 31
- 0
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<CommunicationPar>.Read();
Assembly.GetExecutingAssembly().GetTypes()?.ToList()?.ForEach(item =>
{
if (item.GetInterfaces().Contains(typeof(IServer)))
{
(Activator.CreateInstance(item) as IServer)?.Init();
}
});
}

}
}

+ 13
- 2
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<object>((o) =>
{
if (o != null && o is CommunicationModel menumodel)
{
var res = RecipeManage.FirstOrDefault(p => p.SubMenuName == menumodel.DeviceName);
if (res != null) RecipeManage.Remove(res);
}

}), "RemoveCommunicationDevice");


Json<CommunicationPar>.Data.CommunicationDevices?.ToList()?.ForEach(item =>
{
RecipeManage.Add(AddSubMenuModel(item.DeviceName));


+ 8
- 9
BPASmart.VariableManager/BPASmart.VariableManager.csproj ファイルの表示

@@ -7,6 +7,13 @@
<UseWPF>true</UseWPF>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Servers\**" />
<EmbeddedResource Remove="Servers\**" />
<None Remove="Servers\**" />
<Page Remove="Servers\**" />
</ItemGroup>

<ItemGroup>
<None Remove="Resources\Fonts\iconfont.ttf" />
<None Remove="Resources\Images\HBL.png" />
@@ -22,15 +29,7 @@
</ItemGroup>

<ItemGroup>
<Folder Include="Servers\" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" />
<PackageReference Include="System.IO.Ports" Version="6.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\BPASmart.Model\BPASmart.Model.csproj" />
<ProjectReference Include="..\BPASmartClient.CustomResource\BPASmartClient.CustomResource.csproj" />
</ItemGroup>



+ 1
- 1
BPASmart.VariableManager/Converter/AlarmTypeTextConvert.cs ファイルの表示

@@ -5,7 +5,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using BPASmart.VariableManager.Enums;
using BPASmart.Model;
namespace BPASmart.VariableManager.Converter
{
/// <summary>


+ 2
- 1
BPASmart.VariableManager/Converter/DeviceVisibleConverter.cs ファイルの表示

@@ -6,7 +6,8 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;
using BPASmart.VariableManager.Models;
using BPASmart.Model;


namespace BPASmart.VariableManager.Converter
{


+ 5
- 4
BPASmart.VariableManager/ViewModels/CommunicationSetViewModel.cs ファイルの表示

@@ -9,8 +9,7 @@ using Microsoft.Toolkit.Mvvm.Input;
using BPASmart.VariableManager.Views;
using System.Windows;
using BPASmartClient.Helper;
using BPASmart.VariableManager.Models;
using BPASmart.VariableManager.Enums;
using BPASmart.Model;
//using BPASmartClient.Model;
using System.IO.Ports;
using System.IO;
@@ -59,11 +58,12 @@ namespace BPASmart.VariableManager.ViewModels
if (obj == null)
{
CommunicationModel communicationObj = new CommunicationModel();
Type type = Assembly.Load("BPASmart.VariableManager").GetType($"BPASmart.VariableManager.Models.{ResultTag.DeviceType}");
Type type = Assembly.Load("BPASmart.Model").GetType($"BPASmart.Model.{ResultTag.DeviceType}");
//Type type = Assembly.Load("BPASmart.VariableManager").GetType($"BPASmart.VariableManager.Models.{ResultTag.DeviceType}");
var res = Activator.CreateInstance(type) as ICommunicationDevice;
communicationObj.DeviceName = ResultTag.DeviceName;
communicationObj.CommDevice = res;
communicationObj.ModelName = type.Name;
Json<CommunicationPar>.Data.CommunicationDevices.Add(communicationObj);
ActionManage.GetInstance.Send("AddCommunicationDevice", ResultTag.DeviceName);
}
@@ -78,6 +78,7 @@ namespace BPASmart.VariableManager.ViewModels
if (result != null)
{
Json<CommunicationPar>.Data.CommunicationDevices.Remove(result);
ActionManage.GetInstance.Send("RemoveCommunicationDevice", result);
}
}



+ 1
- 2
BPASmart.VariableManager/ViewModels/NewDeviceViewModel.cs ファイルの表示

@@ -9,8 +9,7 @@ using System.Collections.ObjectModel;
using Microsoft.Toolkit.Mvvm.Input;
using Microsoft.Toolkit.Mvvm.Messaging;
using System.Diagnostics;
using BPASmart.VariableManager.Models;
using BPASmart.VariableManager.Enums;
using BPASmart.Model;
using System.Reflection;

namespace BPASmart.VariableManager.ViewModels


+ 1
- 2
BPASmart.VariableManager/ViewModels/VariableConfigViewModel.cs ファイルの表示

@@ -4,10 +4,9 @@ using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BPASmart.VariableManager.Enums;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using BPASmart.VariableManager.Models;
using BPASmart.Model;
using System.Diagnostics;
using Microsoft.EntityFrameworkCore;
using BPASmartClient.Helper;


+ 31
- 5
BPASmart.VariableManager/Views/CommunicationSetView.xaml ファイルの表示

@@ -95,6 +95,9 @@
Name="cy"
Height="180"
Margin="0,0,0,30">
<!--<Grid.Background>
<ImageBrush ImageSource="/Resources/Images/边框1.png" />
</Grid.Background>-->
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition />
@@ -110,14 +113,37 @@

<pry:TitleTextBlock Margin="2,2,0,0" />

<TextBlock
<StackPanel
Margin="5"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontFamily="楷体"
FontSize="20"
Foreground="Aqua"
Text="{Binding DeviceName}" />
Orientation="Horizontal">
<TextBlock
Margin="0,0,10,0"
FontFamily="楷体"
FontSize="20"
Foreground="Aqua"
Text="{Binding DeviceName}" />

<TextBlock
FontFamily="楷体"
FontSize="20"
Foreground="Yellow"
Text="[" />

<TextBlock
FontFamily="楷体"
FontSize="20"
Foreground="Yellow"
Text="{Binding ModelName}" />

<TextBlock
FontFamily="楷体"
FontSize="20"
Foreground="Yellow"
Text="]" />
</StackPanel>

</Grid>
<!--#endregion-->



+ 1
- 1
BPASmart.VariableManager/Views/CommunicationSetView.xaml.cs ファイルの表示

@@ -1,4 +1,4 @@
using BPASmart.VariableManager.Models;
using BPASmart.Model;
using BPASmartClient.Helper;
using System;
using System.Collections.Generic;


+ 1
- 1
BPASmart.VariableManager/Views/NewDeviceView.xaml.cs ファイルの表示

@@ -14,7 +14,7 @@ using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Microsoft.Toolkit.Mvvm.Messaging;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPASmart.VariableManager.Models;
using BPASmart.Model;

namespace BPASmart.VariableManager.Views
{


+ 1
- 1
BPASmart.VariableManager/Views/VariableConfig.xaml.cs ファイルの表示

@@ -1,4 +1,4 @@
using BPASmart.VariableManager.Models;
using BPASmart.Model;
using BPASmart.VariableManager.ViewModels;
using BPASmartClient.Helper;
using System;


+ 1
- 32
BPASmartClient.Message/MessageLog.cs ファイルの表示

@@ -138,38 +138,7 @@ namespace BPASmartClient.Message

#endregion

#region 查找设备ID
/// <summary>
/// 查询设备ID
/// </summary>
/// <returns></returns>
public object ReturnDeviceID()
{
object DeviceId = null;
//StackTrace trace = new StackTrace();
//for (int i = 1; i < 10; i++)
//{
// Type type = trace.GetFrame(i).GetMethod().ReflectedType;
// try
// {
// object obj = Activator.CreateInstance(type);
// if (obj is IPeripheral)
// {
// IPeripheral peripheral = obj as IPeripheral;
// DeviceId = type?.GetProperty("DeviceId")?.GetValue(peripheral, null);
// }
// if (DeviceId != null) break;
// }
// catch (Exception ex)
// {

// }

//}

return DeviceId;
}
#endregion






+ 73
- 2
SmartClient.sln ファイルの表示

@@ -154,7 +154,15 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "4.界面加载实例", "4.
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SCADA.Test", "SCADA.Test\SCADA.Test.csproj", "{1696D557-C908-4136-A5F2-FF59D69E642C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmart.VariableManager", "BPASmart.VariableManager\BPASmart.VariableManager.csproj", "{2C17B9A9-B27B-4F07-AFB0-0F56A975D501}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmart.VariableManager", "BPASmart.VariableManager\BPASmart.VariableManager.csproj", "{2C17B9A9-B27B-4F07-AFB0-0F56A975D501}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DistributedHostComputer", "DistributedHostComputer", "{CDC1E762-5E1D-4AE1-9DF2-B85761539086}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmart.DataServer", "BPASmart.DataServer\BPASmart.DataServer.csproj", "{00C5B45D-9799-43F1-B07B-9F638AA9FF72}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmart.Model", "BPASmart.Model\BPASmart.Model.csproj", "{5083C91F-B23E-445D-8B7F-AF87E636E847}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmart.Server", "BPASmart.Server\BPASmart.Server.csproj", "{F67FBFAC-6C80-466D-A596-1B9B10E885FC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -1430,6 +1438,66 @@ Global
{2C17B9A9-B27B-4F07-AFB0-0F56A975D501}.Release|x64.Build.0 = Release|Any CPU
{2C17B9A9-B27B-4F07-AFB0-0F56A975D501}.Release|x86.ActiveCfg = Release|Any CPU
{2C17B9A9-B27B-4F07-AFB0-0F56A975D501}.Release|x86.Build.0 = Release|Any CPU
{00C5B45D-9799-43F1-B07B-9F638AA9FF72}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{00C5B45D-9799-43F1-B07B-9F638AA9FF72}.Debug|Any CPU.Build.0 = Debug|Any CPU
{00C5B45D-9799-43F1-B07B-9F638AA9FF72}.Debug|ARM.ActiveCfg = Debug|Any CPU
{00C5B45D-9799-43F1-B07B-9F638AA9FF72}.Debug|ARM.Build.0 = Debug|Any CPU
{00C5B45D-9799-43F1-B07B-9F638AA9FF72}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{00C5B45D-9799-43F1-B07B-9F638AA9FF72}.Debug|ARM64.Build.0 = Debug|Any CPU
{00C5B45D-9799-43F1-B07B-9F638AA9FF72}.Debug|x64.ActiveCfg = Debug|Any CPU
{00C5B45D-9799-43F1-B07B-9F638AA9FF72}.Debug|x64.Build.0 = Debug|Any CPU
{00C5B45D-9799-43F1-B07B-9F638AA9FF72}.Debug|x86.ActiveCfg = Debug|Any CPU
{00C5B45D-9799-43F1-B07B-9F638AA9FF72}.Debug|x86.Build.0 = Debug|Any CPU
{00C5B45D-9799-43F1-B07B-9F638AA9FF72}.Release|Any CPU.ActiveCfg = Release|Any CPU
{00C5B45D-9799-43F1-B07B-9F638AA9FF72}.Release|Any CPU.Build.0 = Release|Any CPU
{00C5B45D-9799-43F1-B07B-9F638AA9FF72}.Release|ARM.ActiveCfg = Release|Any CPU
{00C5B45D-9799-43F1-B07B-9F638AA9FF72}.Release|ARM.Build.0 = Release|Any CPU
{00C5B45D-9799-43F1-B07B-9F638AA9FF72}.Release|ARM64.ActiveCfg = Release|Any CPU
{00C5B45D-9799-43F1-B07B-9F638AA9FF72}.Release|ARM64.Build.0 = Release|Any CPU
{00C5B45D-9799-43F1-B07B-9F638AA9FF72}.Release|x64.ActiveCfg = Release|Any CPU
{00C5B45D-9799-43F1-B07B-9F638AA9FF72}.Release|x64.Build.0 = Release|Any CPU
{00C5B45D-9799-43F1-B07B-9F638AA9FF72}.Release|x86.ActiveCfg = Release|Any CPU
{00C5B45D-9799-43F1-B07B-9F638AA9FF72}.Release|x86.Build.0 = Release|Any CPU
{5083C91F-B23E-445D-8B7F-AF87E636E847}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5083C91F-B23E-445D-8B7F-AF87E636E847}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5083C91F-B23E-445D-8B7F-AF87E636E847}.Debug|ARM.ActiveCfg = Debug|Any CPU
{5083C91F-B23E-445D-8B7F-AF87E636E847}.Debug|ARM.Build.0 = Debug|Any CPU
{5083C91F-B23E-445D-8B7F-AF87E636E847}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{5083C91F-B23E-445D-8B7F-AF87E636E847}.Debug|ARM64.Build.0 = Debug|Any CPU
{5083C91F-B23E-445D-8B7F-AF87E636E847}.Debug|x64.ActiveCfg = Debug|Any CPU
{5083C91F-B23E-445D-8B7F-AF87E636E847}.Debug|x64.Build.0 = Debug|Any CPU
{5083C91F-B23E-445D-8B7F-AF87E636E847}.Debug|x86.ActiveCfg = Debug|Any CPU
{5083C91F-B23E-445D-8B7F-AF87E636E847}.Debug|x86.Build.0 = Debug|Any CPU
{5083C91F-B23E-445D-8B7F-AF87E636E847}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5083C91F-B23E-445D-8B7F-AF87E636E847}.Release|Any CPU.Build.0 = Release|Any CPU
{5083C91F-B23E-445D-8B7F-AF87E636E847}.Release|ARM.ActiveCfg = Release|Any CPU
{5083C91F-B23E-445D-8B7F-AF87E636E847}.Release|ARM.Build.0 = Release|Any CPU
{5083C91F-B23E-445D-8B7F-AF87E636E847}.Release|ARM64.ActiveCfg = Release|Any CPU
{5083C91F-B23E-445D-8B7F-AF87E636E847}.Release|ARM64.Build.0 = Release|Any CPU
{5083C91F-B23E-445D-8B7F-AF87E636E847}.Release|x64.ActiveCfg = Release|Any CPU
{5083C91F-B23E-445D-8B7F-AF87E636E847}.Release|x64.Build.0 = Release|Any CPU
{5083C91F-B23E-445D-8B7F-AF87E636E847}.Release|x86.ActiveCfg = Release|Any CPU
{5083C91F-B23E-445D-8B7F-AF87E636E847}.Release|x86.Build.0 = Release|Any CPU
{F67FBFAC-6C80-466D-A596-1B9B10E885FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F67FBFAC-6C80-466D-A596-1B9B10E885FC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F67FBFAC-6C80-466D-A596-1B9B10E885FC}.Debug|ARM.ActiveCfg = Debug|Any CPU
{F67FBFAC-6C80-466D-A596-1B9B10E885FC}.Debug|ARM.Build.0 = Debug|Any CPU
{F67FBFAC-6C80-466D-A596-1B9B10E885FC}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{F67FBFAC-6C80-466D-A596-1B9B10E885FC}.Debug|ARM64.Build.0 = Debug|Any CPU
{F67FBFAC-6C80-466D-A596-1B9B10E885FC}.Debug|x64.ActiveCfg = Debug|Any CPU
{F67FBFAC-6C80-466D-A596-1B9B10E885FC}.Debug|x64.Build.0 = Debug|Any CPU
{F67FBFAC-6C80-466D-A596-1B9B10E885FC}.Debug|x86.ActiveCfg = Debug|Any CPU
{F67FBFAC-6C80-466D-A596-1B9B10E885FC}.Debug|x86.Build.0 = Debug|Any CPU
{F67FBFAC-6C80-466D-A596-1B9B10E885FC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F67FBFAC-6C80-466D-A596-1B9B10E885FC}.Release|Any CPU.Build.0 = Release|Any CPU
{F67FBFAC-6C80-466D-A596-1B9B10E885FC}.Release|ARM.ActiveCfg = Release|Any CPU
{F67FBFAC-6C80-466D-A596-1B9B10E885FC}.Release|ARM.Build.0 = Release|Any CPU
{F67FBFAC-6C80-466D-A596-1B9B10E885FC}.Release|ARM64.ActiveCfg = Release|Any CPU
{F67FBFAC-6C80-466D-A596-1B9B10E885FC}.Release|ARM64.Build.0 = Release|Any CPU
{F67FBFAC-6C80-466D-A596-1B9B10E885FC}.Release|x64.ActiveCfg = Release|Any CPU
{F67FBFAC-6C80-466D-A596-1B9B10E885FC}.Release|x64.Build.0 = Release|Any CPU
{F67FBFAC-6C80-466D-A596-1B9B10E885FC}.Release|x86.ActiveCfg = Release|Any CPU
{F67FBFAC-6C80-466D-A596-1B9B10E885FC}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -1501,7 +1569,10 @@ Global
{B6213013-2A0E-41DD-BA9F-775D53C19374} = {5300552F-560D-474A-8D96-0A2747D08F64}
{309D579E-DDA8-4B01-A0AA-0F381BC37801} = {7B0175AD-BB74-4A98-B9A7-1E289032485E}
{1696D557-C908-4136-A5F2-FF59D69E642C} = {309D579E-DDA8-4B01-A0AA-0F381BC37801}
{2C17B9A9-B27B-4F07-AFB0-0F56A975D501} = {8712125E-14CD-4E1B-A1CE-4BDE03805942}
{2C17B9A9-B27B-4F07-AFB0-0F56A975D501} = {CDC1E762-5E1D-4AE1-9DF2-B85761539086}
{00C5B45D-9799-43F1-B07B-9F638AA9FF72} = {CDC1E762-5E1D-4AE1-9DF2-B85761539086}
{5083C91F-B23E-445D-8B7F-AF87E636E847} = {CDC1E762-5E1D-4AE1-9DF2-B85761539086}
{F67FBFAC-6C80-466D-A596-1B9B10E885FC} = {CDC1E762-5E1D-4AE1-9DF2-B85761539086}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9AEC9B81-0222-4DE9-B642-D915C29222AC}


読み込み中…
キャンセル
保存