Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement
This commit is contained in:
commit
54d8cc7266
1 file changed
+74
-4
@@ -16,6 +16,7 @@ using System.Windows;
|
|||||||
using TouchSocket.Core;
|
using TouchSocket.Core;
|
||||||
using TouchSocket.SerialPorts;
|
using TouchSocket.SerialPorts;
|
||||||
using TouchSocket.Sockets;
|
using TouchSocket.Sockets;
|
||||||
|
using static OpenTK.Graphics.OpenGL.GL;
|
||||||
using static SkiaSharp.HarfBuzz.SKShaper;
|
using static SkiaSharp.HarfBuzz.SKShaper;
|
||||||
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
|
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
|
||||||
using static SunlightCentralizedControlManagement_SCCM_.ViewModel.MainWindowViewModel;
|
using static SunlightCentralizedControlManagement_SCCM_.ViewModel.MainWindowViewModel;
|
||||||
@@ -193,7 +194,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
|
||||||
DataTable dataTable = JsonConvert.DeserializeObject<DataTable>(DAT).Copy();//反序列化
|
DataTable dataTable = JsonConvert.DeserializeObject<DataTable>(DAT).Copy();//反序列化
|
||||||
System.Windows.Application.Current.Dispatcher.Invoke(() =>
|
System.Windows.Application.Current.Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
@@ -306,7 +306,34 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
Dictionary<string, object> _dat;
|
||||||
|
_dat = SerializeConvert.JsonDeserializeFromString<Dictionary<string, object>>(DAT);
|
||||||
|
string[] DO = _dat.GetValue("DO").ToString().Split(',');
|
||||||
|
string[] DQ = _dat.GetValue("DQ").ToString().Split(',');
|
||||||
|
DataTable dataTable = new DataTable();
|
||||||
|
dataTable.Columns.Add("ID", Type.GetType("System.String"));
|
||||||
|
dataTable.Columns.Add("type", Type.GetType("System.String"));
|
||||||
|
dataTable.Columns.Add("DIO", Type.GetType("System.Bool"));
|
||||||
|
dataTable.Columns.Add("PLC", Type.GetType("System.String"));
|
||||||
|
for (int DOi = 0; DOi < DO.Length; DOi++)
|
||||||
|
{
|
||||||
|
DataRow newRow = dataTable.NewRow();
|
||||||
|
newRow["ID"] = DOi+2001;
|
||||||
|
newRow["type"] = "DO";
|
||||||
|
newRow["DIO"] = DO[DOi];
|
||||||
|
newRow["PLC"] = DOi + 2001;
|
||||||
|
dataTable.Rows.Add(newRow);
|
||||||
|
}
|
||||||
|
for (int DQi = 0; DQi < DO.Length; DQi++)
|
||||||
|
{
|
||||||
|
DataRow newRow = dataTable.NewRow();
|
||||||
|
newRow["ID"] = DQi + 3001;
|
||||||
|
newRow["type"] = "DQ";
|
||||||
|
newRow["DIO"] = DQ[DQi];
|
||||||
|
newRow["PLC"] = DQi + 3001;
|
||||||
|
dataTable.Rows.Add(newRow);
|
||||||
|
}
|
||||||
|
MainWindowViewModel.dt_d = dataTable;
|
||||||
}
|
}
|
||||||
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||||
}//数字开关表
|
}//数字开关表
|
||||||
@@ -314,7 +341,34 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
Dictionary<string, object> _dat;
|
||||||
|
_dat = SerializeConvert.JsonDeserializeFromString<Dictionary<string, object>>(DAT);
|
||||||
|
string[] AI = _dat.GetValue("DO").ToString().Split(',');
|
||||||
|
string[] AO = _dat.GetValue("DQ").ToString().Split(',');
|
||||||
|
DataTable dataTable = new DataTable();
|
||||||
|
dataTable.Columns.Add("ID", Type.GetType("System.String"));
|
||||||
|
dataTable.Columns.Add("type", Type.GetType("System.String"));
|
||||||
|
dataTable.Columns.Add("AIO", Type.GetType("System.Int"));
|
||||||
|
dataTable.Columns.Add("PLC", Type.GetType("System.String"));
|
||||||
|
for (int AIi = 0; AIi < AI.Length; AIi++)
|
||||||
|
{
|
||||||
|
DataRow newRow = dataTable.NewRow();
|
||||||
|
newRow["ID"] = AIi + 4001;
|
||||||
|
newRow["type"] = "DO";
|
||||||
|
newRow["AIO"] = AI[AIi];
|
||||||
|
newRow["PLC"] = AIi + 4001;
|
||||||
|
dataTable.Rows.Add(newRow);
|
||||||
|
}
|
||||||
|
for (int AOi = 0; AOi < AO.Length; AOi++)
|
||||||
|
{
|
||||||
|
DataRow newRow = dataTable.NewRow();
|
||||||
|
newRow["ID"] = AOi + 5001;
|
||||||
|
newRow["type"] = "DQ";
|
||||||
|
newRow["AIO"] = AO[AOi];
|
||||||
|
newRow["PLC"] = AOi + 5001;
|
||||||
|
dataTable.Rows.Add(newRow);
|
||||||
|
}
|
||||||
|
MainWindowViewModel.dt_a = dataTable;
|
||||||
}
|
}
|
||||||
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||||
}//寄存器表
|
}//寄存器表
|
||||||
@@ -322,7 +376,23 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
Dictionary<string, object> _dat;
|
||||||
|
_dat = SerializeConvert.JsonDeserializeFromString<Dictionary<string, object>>(DAT);
|
||||||
|
string[] M = _dat.GetValue("M").ToString().Split(',');
|
||||||
|
DataTable dataTable = new DataTable();
|
||||||
|
dataTable.Columns.Add("ID", Type.GetType("System.String"));
|
||||||
|
dataTable.Columns.Add("type", Type.GetType("System.String"));
|
||||||
|
dataTable.Columns.Add("Value", Type.GetType("System.Double"));
|
||||||
|
dataTable.Columns.Add("PLC", Type.GetType("System.String"));
|
||||||
|
for (int Mi = 0; Mi < M.Length; Mi++)
|
||||||
|
{
|
||||||
|
DataRow newRow = dataTable.NewRow();
|
||||||
|
newRow["ID"] = Mi + 1001;
|
||||||
|
newRow["type"] = "M";
|
||||||
|
newRow["Value"] = M[Mi];
|
||||||
|
newRow["PLC"] = Mi + 1001;
|
||||||
|
dataTable.Rows.Add(newRow);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||||
|
|||||||
Reference in new issue
Block a user