Browse Source

变量管理器修改

样式分支
pry 2 years ago
parent
commit
2135215b94
5 changed files with 24 additions and 2 deletions
  1. +1
    -0
      BPASmart.Model/RedisDataModel.cs
  2. +1
    -1
      BPASmart.Model/VariableInfo.cs
  3. +2
    -1
      BPASmart.Server/CommunicationServer.cs
  4. +11
    -0
      BPASmart.VariableManager/App.xaml.cs
  5. +9
    -0
      ComputerTestDemo/Form1.cs

+ 1
- 0
BPASmart.Model/RedisDataModel.cs View File

@@ -10,5 +10,6 @@ namespace BPASmart.Model
{
public string VarName { get; set; }
public string VarVaule { get; set; }
public EDataType DataType { get; set; }
}
}

+ 1
- 1
BPASmart.Model/VariableInfo.cs View File

@@ -17,7 +17,7 @@ namespace BPASmart.Model
{
public class VariableInfo : AlarmSet
{
private ICommunicationDevice DeviceType;
private ICommunicationDevice DeviceType = new kinco();
public VariableInfo(params object[] s)
{
if (s != null && s.Length >= 0)


+ 2
- 1
BPASmart.Server/CommunicationServer.cs View File

@@ -185,7 +185,8 @@ namespace BPASmart.Server
reeisDataModels.Add(new ReeisDataModel()
{
VarName = tempVar.VarName,
VarVaule = tempVar.CurrentValue
VarVaule = tempVar.CurrentValue,
DataType = (EDataType)Enum.Parse(typeof(EDataType), tempVar.DataType)
});
}
});


+ 11
- 0
BPASmart.VariableManager/App.xaml.cs View File

@@ -112,6 +112,17 @@ namespace BPASmart.VariableManager

private void DataSave()
{
for (int i = 0; i < Json<CommunicationPar>.Data.CommunicationDevices.Count; i++)
{
for (int m = 0; m < Json<CommunicationPar>.Data.CommunicationDevices.ElementAt(i).VarTableModels.Count; m++)
{
var deviceType = Json<CommunicationPar>.Data.CommunicationDevices.ElementAt(i).CommDevice;
var deviceValue = Json<CommunicationPar>.Data.CommunicationDevices.ElementAt(i).VarTableModels.ElementAt(m).Address;
string RealAddress = AddressConvert.GetInstance.PlcConverter(deviceType, deviceValue);
Json<CommunicationPar>.Data.CommunicationDevices.ElementAt(i).VarTableModels.ElementAt(m).RealAddress = RealAddress;
}
}

Json<CommunicationPar>.Save();
}



+ 9
- 0
ComputerTestDemo/Form1.cs View File

@@ -2,6 +2,7 @@ using BPA.Helper;
using BPASmart.Model;
using BPA.Communication;
using Newtonsoft.Json;
using System.Diagnostics;

namespace ComputerTestDemo
{
@@ -22,6 +23,14 @@ namespace ComputerTestDemo
}));
}

private TResult GetData<TResult>()
{
Type type = typeof(TResult);
var name = type.Name;
Debug.WriteLine(name);
return default;
}

MqttHelper mqttHelper = new MqttHelper();
private void MqttInit()
{


Loading…
Cancel
Save