添加错误记录与计数器
This commit is contained in:
commit
e56ca33ecb
2 files changed
+146
-86
No files matched your search
+145
-86
@@ -28,6 +28,7 @@ using System.Xml.Linq;
|
|||||||
using ScottPlot;
|
using ScottPlot;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using DyeingComputer.UserClass;
|
using DyeingComputer.UserClass;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
||||||
{/// <summary>
|
{/// <summary>
|
||||||
@@ -100,135 +101,193 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
string DAT = e.ByteBlock.Span.ToString(Encoding.UTF8);
|
string DAT = e.ByteBlock.Span.ToString(Encoding.UTF8);
|
||||||
if (SYSAPI == "SC800")
|
if (SYSAPI == "SC800")
|
||||||
{
|
{
|
||||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
try
|
||||||
Dictionary<string, object> Chart_new = new Dictionary<string, object>();//缓存函数
|
{
|
||||||
Chart_new = JsonConvert.DeserializeObject<Dictionary<string, object>>(DAT);//反序列化
|
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "' AND port='" + client.Port + "'").First();
|
Dictionary<string, object> Chart_new = new Dictionary<string, object>();//缓存函数
|
||||||
drEmployee.BeginEdit();
|
Chart_new = JsonConvert.DeserializeObject<Dictionary<string, object>>(DAT);//反序列化
|
||||||
drEmployee["SYSKEY"] = Chart_new.GetValue("SYSKEY").ToString();
|
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "' AND port='" + client.Port + "'").First();
|
||||||
drEmployee["NAME"] = Chart_new.GetValue("MACHINE").ToString();
|
drEmployee.BeginEdit();
|
||||||
drEmployee["Groups"] = Chart_new.GetValue("GROUP").ToString();
|
drEmployee["SYSKEY"] = Chart_new.GetValue("SYSKEY").ToString();
|
||||||
drEmployee["State"] = "802";
|
drEmployee["NAME"] = Chart_new.GetValue("MACHINE").ToString();
|
||||||
drEmployee.EndEdit();
|
drEmployee["Groups"] = Chart_new.GetValue("GROUP").ToString();
|
||||||
drEmployee.AcceptChanges();
|
drEmployee["State"] = "802";
|
||||||
drEmployee.ClearErrors();
|
drEmployee.EndEdit();
|
||||||
|
drEmployee.AcceptChanges();
|
||||||
|
drEmployee.ClearErrors();
|
||||||
|
}
|
||||||
|
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||||
}
|
}
|
||||||
else if (SYSAPI == "SC810")
|
else if (SYSAPI == "SC810")
|
||||||
{
|
{
|
||||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
try
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
{
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||||
SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 111 } },
|
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
"WorkOrder ='" + DAT + "'", null);
|
SQLiteHelpers.Open(); //打开数据库
|
||||||
SQLiteHelpers.Close();
|
SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 111 } },
|
||||||
|
"WorkOrder ='" + DAT + "'", null);
|
||||||
|
SQLiteHelpers.Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||||
}
|
}
|
||||||
else if (SYSAPI == "SC811")
|
else if (SYSAPI == "SC811")
|
||||||
{
|
{
|
||||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
try
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
{
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||||
SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 101 } },
|
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
"WorkOrder ='" + DAT + "'", null);
|
SQLiteHelpers.Open(); //打开数据库
|
||||||
SQLiteHelpers.Close();
|
SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 101 } },
|
||||||
|
"WorkOrder ='" + DAT + "'", null);
|
||||||
|
SQLiteHelpers.Close();
|
||||||
|
}catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||||
}
|
}
|
||||||
else if (SYSAPI == "SC830")
|
else if (SYSAPI == "SC830")
|
||||||
{
|
{
|
||||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
try
|
||||||
Dictionary<string, object> _new = new Dictionary<string, object>();//缓存函数
|
|
||||||
_new = JsonConvert.DeserializeObject<Dictionary<string, object>>(DAT);//反序列化
|
|
||||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "' AND port='" + client.Port + "'").First();
|
|
||||||
drEmployee.BeginEdit();
|
|
||||||
drEmployee["Message"] = _new.GetValue("Status");
|
|
||||||
drEmployee["WorkOrder"] = _new.GetValue("WorkNumder");
|
|
||||||
drEmployee["Temperature"] = _new.GetValue("MTT");
|
|
||||||
drEmployee["WaterLevel"] = _new.GetValue("MTL");
|
|
||||||
drEmployee["Process"] = _new.GetValue("Process");
|
|
||||||
drEmployee["Step"] = _new.GetValue("Step");
|
|
||||||
drEmployee.EndEdit();
|
|
||||||
drEmployee.AcceptChanges();
|
|
||||||
drEmployee.ClearErrors();
|
|
||||||
|
|
||||||
if (_new.GetValue("Status").ToString() != "----------")
|
|
||||||
{
|
{
|
||||||
Dictionary<string, object> Chart_new = new Dictionary<string, object>();//缓存函数
|
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||||
Chart_new.Add("WorkOrder", _new.GetValue("WorkNumder"));
|
Dictionary<string, object> _new = new Dictionary<string, object>();//缓存函数
|
||||||
Chart_new.Add("Machine", _new.GetValue("Machine"));
|
_new = JsonConvert.DeserializeObject<Dictionary<string, object>>(DAT);//反序列化
|
||||||
Chart_new.Add("Time", _new.GetValue("Time"));
|
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "' AND port='" + client.Port + "'").First();
|
||||||
Chart_new.Add("MST", _new.GetValue("MST"));
|
drEmployee.BeginEdit();
|
||||||
Chart_new.Add("MTT", _new.GetValue("MTT"));
|
drEmployee["Message"] = _new.GetValue("Status");
|
||||||
Chart_new.Add("MTL", _new.GetValue("MTL"));
|
drEmployee["WorkOrder"] = _new.GetValue("WorkNumder");
|
||||||
Chart_new.Add("MTH", _new.GetValue("MTH"));
|
drEmployee["Temperature"] = _new.GetValue("MTT");
|
||||||
Chart_new.Add("MUT", _new.GetValue("MUT"));
|
drEmployee["WaterLevel"] = _new.GetValue("MTL");
|
||||||
Chart_new.Add("STTA", _new.GetValue("STTA"));
|
drEmployee["Process"] = _new.GetValue("Process");
|
||||||
Chart_new.Add("STLA", _new.GetValue("STLA"));
|
drEmployee["Step"] = _new.GetValue("Step");
|
||||||
Chart_new.Add("STTB", _new.GetValue("STTB"));
|
drEmployee.EndEdit();
|
||||||
Chart_new.Add("STLB", _new.GetValue("STLB"));
|
drEmployee.AcceptChanges();
|
||||||
Chart_new.Add("STTC", _new.GetValue("STTC"));
|
drEmployee.ClearErrors();
|
||||||
Chart_new.Add("STLC", _new.GetValue("STLC"));
|
|
||||||
|
|
||||||
SQLiteHelpers = new SQLiteHelper(ChartAdress); //数据库连接路径
|
if (_new.GetValue("Status").ToString() != "----------")
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
{
|
||||||
SQLiteHelpers.InsertData("Chart", Chart_new);// 执行插入
|
Dictionary<string, object> Chart_new = new Dictionary<string, object>();//缓存函数
|
||||||
SQLiteHelpers.Close();
|
Chart_new.Add("WorkOrder", _new.GetValue("WorkNumder"));
|
||||||
|
Chart_new.Add("Machine", _new.GetValue("Machine"));
|
||||||
|
Chart_new.Add("Time", _new.GetValue("Time"));
|
||||||
|
Chart_new.Add("MST", _new.GetValue("MST"));
|
||||||
|
Chart_new.Add("MTT", _new.GetValue("MTT"));
|
||||||
|
Chart_new.Add("MTL", _new.GetValue("MTL"));
|
||||||
|
Chart_new.Add("MTH", _new.GetValue("MTH"));
|
||||||
|
Chart_new.Add("MUT", _new.GetValue("MUT"));
|
||||||
|
Chart_new.Add("STTA", _new.GetValue("STTA"));
|
||||||
|
Chart_new.Add("STLA", _new.GetValue("STLA"));
|
||||||
|
Chart_new.Add("STTB", _new.GetValue("STTB"));
|
||||||
|
Chart_new.Add("STLB", _new.GetValue("STLB"));
|
||||||
|
Chart_new.Add("STTC", _new.GetValue("STTC"));
|
||||||
|
Chart_new.Add("STLC", _new.GetValue("STLC"));
|
||||||
|
|
||||||
|
SQLiteHelpers = new SQLiteHelper(ChartAdress); //数据库连接路径
|
||||||
|
SQLiteHelpers.Open(); //打开数据库
|
||||||
|
SQLiteHelpers.InsertData("Chart", Chart_new);// 执行插入
|
||||||
|
SQLiteHelpers.Close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||||
}
|
}
|
||||||
else if (SYSAPI == "SC831")
|
else if (SYSAPI == "SC831")
|
||||||
{
|
{
|
||||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
try
|
||||||
MainWindowViewModel.dt_TP = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
|
{
|
||||||
|
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||||
|
MainWindowViewModel.dt_TP = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
|
||||||
|
}
|
||||||
|
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||||
}
|
}
|
||||||
else if (SYSAPI == "SC832")
|
else if (SYSAPI == "SC832")
|
||||||
{
|
{
|
||||||
MainWindowViewModel.MachineLOG = DAT.Substring(DAT.IndexOf("]") + 1);
|
try
|
||||||
|
{
|
||||||
|
MainWindowViewModel.MachineLOG = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||||
|
}
|
||||||
|
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||||
}//当前细节信息
|
}//当前细节信息
|
||||||
else if (SYSAPI == "SC833")
|
else if (SYSAPI == "SC833")
|
||||||
{
|
{
|
||||||
MainWindowViewModel.MachineLOG = DAT.Substring(DAT.IndexOf("]") + 1);
|
try
|
||||||
|
{
|
||||||
|
MainWindowViewModel.MachineLOG = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||||
|
}
|
||||||
|
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||||
}//当前领料单信息
|
}//当前领料单信息
|
||||||
else if (SYSAPI == "SC851")
|
else if (SYSAPI == "SC851")
|
||||||
{
|
{
|
||||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
try
|
||||||
MainWindowViewModel.dt_d = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
|
{
|
||||||
|
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||||
|
MainWindowViewModel.dt_d = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
|
||||||
|
}
|
||||||
|
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||||
}//数字开关表
|
}//数字开关表
|
||||||
else if (SYSAPI == "SC852")
|
else if (SYSAPI == "SC852")
|
||||||
{
|
{
|
||||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
try
|
||||||
MainWindowViewModel.dt_a = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
|
{
|
||||||
|
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||||
|
MainWindowViewModel.dt_a = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
|
||||||
|
}
|
||||||
|
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||||
}//寄存器表
|
}//寄存器表
|
||||||
else if (SYSAPI == "SC853")
|
else if (SYSAPI == "SC853")
|
||||||
{
|
{
|
||||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
try
|
||||||
MainWindowViewModel.dt_m = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
|
{
|
||||||
|
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||||
|
MainWindowViewModel.dt_m = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
|
||||||
|
}
|
||||||
|
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||||
}//缓存表
|
}//缓存表
|
||||||
else if (SYSAPI == "SC854")
|
else if (SYSAPI == "SC854")
|
||||||
{
|
{
|
||||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
try
|
||||||
MainWindowViewModel.dt_ParameterSet = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
|
{
|
||||||
|
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||||
|
MainWindowViewModel.dt_ParameterSet = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
|
||||||
|
}
|
||||||
|
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||||
}//程序设置表
|
}//程序设置表
|
||||||
else if (SYSAPI == "SC855")
|
else if (SYSAPI == "SC855")
|
||||||
{
|
{
|
||||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
try
|
||||||
MainWindowViewModel.dt_SysSet = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
|
{
|
||||||
|
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||||
|
MainWindowViewModel.dt_SysSet = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
|
||||||
|
}
|
||||||
|
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||||
}//系统设置表
|
}//系统设置表
|
||||||
else if (SYSAPI == "SC910")
|
else if (SYSAPI == "SC910")
|
||||||
{
|
{
|
||||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
try
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
{
|
||||||
SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 109 } },
|
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||||
"WorkOrder ='" + DAT + "'", null);
|
SQLiteHelpers.Open(); //打开数据库
|
||||||
SQLiteHelpers.Close();
|
SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 109 } },
|
||||||
|
"WorkOrder ='" + DAT + "'", null);
|
||||||
|
SQLiteHelpers.Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||||
}//发布失败
|
}//发布失败
|
||||||
else if (SYSAPI == "SC911")
|
else if (SYSAPI == "SC911")
|
||||||
{
|
{
|
||||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
try
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
{
|
||||||
SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 119 } },
|
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||||
"WorkOrder ='" + DAT + "'", null);
|
SQLiteHelpers.Open(); //打开数据库
|
||||||
SQLiteHelpers.Close();
|
SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 119 } },
|
||||||
|
"WorkOrder ='" + DAT + "'", null);
|
||||||
|
SQLiteHelpers.Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||||
}//细节错误
|
}//细节错误
|
||||||
|
else if (SYSAPI == "SC980")
|
||||||
|
{
|
||||||
|
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||||
|
MessageBox.Show(DAT);
|
||||||
|
}
|
||||||
|
|
||||||
return EasyTask.CompletedTask;
|
return EasyTask.CompletedTask;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径
|
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径
|
||||||
public static DataTable Machines = new DataTable(); //设备表缓存
|
public static DataTable Machines = new DataTable(); //设备表缓存
|
||||||
public static UserControls.info[] inf = new UserControls.info[999]; //定义总览信息卡
|
public static UserControls.info[] inf = new UserControls.info[999]; //定义总览信息卡
|
||||||
|
public static int ERR_c = 0;//错误计数器
|
||||||
public MainWindowViewModel()
|
public MainWindowViewModel()
|
||||||
{
|
{
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
|
|||||||
Reference in new issue
Block a user