添加错误记录与计数器
This commit is contained in:
commit
e56ca33ecb
2 files changed
+145
-85
No files matched your search
+144
-85
@@ -28,6 +28,7 @@ using System.Xml.Linq;
|
||||
using ScottPlot;
|
||||
using System.Collections;
|
||||
using DyeingComputer.UserClass;
|
||||
using System.Windows;
|
||||
|
||||
namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
||||
{/// <summary>
|
||||
@@ -100,134 +101,192 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
||||
string DAT = e.ByteBlock.Span.ToString(Encoding.UTF8);
|
||||
if (SYSAPI == "SC800")
|
||||
{
|
||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||
Dictionary<string, object> Chart_new = new Dictionary<string, object>();//缓存函数
|
||||
Chart_new = JsonConvert.DeserializeObject<Dictionary<string, object>>(DAT);//反序列化
|
||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "' AND port='" + client.Port + "'").First();
|
||||
drEmployee.BeginEdit();
|
||||
drEmployee["SYSKEY"] = Chart_new.GetValue("SYSKEY").ToString();
|
||||
drEmployee["NAME"] = Chart_new.GetValue("MACHINE").ToString();
|
||||
drEmployee["Groups"] = Chart_new.GetValue("GROUP").ToString();
|
||||
drEmployee["State"] = "802";
|
||||
drEmployee.EndEdit();
|
||||
drEmployee.AcceptChanges();
|
||||
drEmployee.ClearErrors();
|
||||
try
|
||||
{
|
||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||
Dictionary<string, object> Chart_new = new Dictionary<string, object>();//缓存函数
|
||||
Chart_new = JsonConvert.DeserializeObject<Dictionary<string, object>>(DAT);//反序列化
|
||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "' AND port='" + client.Port + "'").First();
|
||||
drEmployee.BeginEdit();
|
||||
drEmployee["SYSKEY"] = Chart_new.GetValue("SYSKEY").ToString();
|
||||
drEmployee["NAME"] = Chart_new.GetValue("MACHINE").ToString();
|
||||
drEmployee["Groups"] = Chart_new.GetValue("GROUP").ToString();
|
||||
drEmployee["State"] = "802";
|
||||
drEmployee.EndEdit();
|
||||
drEmployee.AcceptChanges();
|
||||
drEmployee.ClearErrors();
|
||||
}
|
||||
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||
}
|
||||
else if (SYSAPI == "SC810")
|
||||
{
|
||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||
SQLiteHelpers.Open(); //打开数据库
|
||||
SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 111 } },
|
||||
"WorkOrder ='" + DAT + "'", null);
|
||||
SQLiteHelpers.Close();
|
||||
try
|
||||
{
|
||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||
SQLiteHelpers.Open(); //打开数据库
|
||||
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")
|
||||
{
|
||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||
SQLiteHelpers.Open(); //打开数据库
|
||||
SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 101 } },
|
||||
"WorkOrder ='" + DAT + "'", null);
|
||||
SQLiteHelpers.Close();
|
||||
try
|
||||
{
|
||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||
SQLiteHelpers.Open(); //打开数据库
|
||||
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")
|
||||
{
|
||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||
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() != "----------")
|
||||
try
|
||||
{
|
||||
Dictionary<string, object> Chart_new = new Dictionary<string, object>();//缓存函数
|
||||
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"));
|
||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||
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();
|
||||
|
||||
SQLiteHelpers = new SQLiteHelper(ChartAdress); //数据库连接路径
|
||||
SQLiteHelpers.Open(); //打开数据库
|
||||
SQLiteHelpers.InsertData("Chart", Chart_new);// 执行插入
|
||||
SQLiteHelpers.Close();
|
||||
if (_new.GetValue("Status").ToString() != "----------")
|
||||
{
|
||||
Dictionary<string, object> Chart_new = new Dictionary<string, object>();//缓存函数
|
||||
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")
|
||||
{
|
||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||
MainWindowViewModel.dt_TP = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
|
||||
try
|
||||
{
|
||||
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")
|
||||
{
|
||||
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")
|
||||
{
|
||||
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")
|
||||
{
|
||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||
MainWindowViewModel.dt_d = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
|
||||
try
|
||||
{
|
||||
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")
|
||||
{
|
||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||
MainWindowViewModel.dt_a = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
|
||||
try
|
||||
{
|
||||
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")
|
||||
{
|
||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||
MainWindowViewModel.dt_m = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
|
||||
try
|
||||
{
|
||||
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")
|
||||
{
|
||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||
MainWindowViewModel.dt_ParameterSet = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
|
||||
try
|
||||
{
|
||||
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")
|
||||
{
|
||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||
MainWindowViewModel.dt_SysSet = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
|
||||
try
|
||||
{
|
||||
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")
|
||||
{
|
||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||
SQLiteHelpers.Open(); //打开数据库
|
||||
SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 109 } },
|
||||
"WorkOrder ='" + DAT + "'", null);
|
||||
SQLiteHelpers.Close();
|
||||
try
|
||||
{
|
||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||
SQLiteHelpers.Open(); //打开数据库
|
||||
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")
|
||||
{
|
||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||
SQLiteHelpers.Open(); //打开数据库
|
||||
SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 119 } },
|
||||
"WorkOrder ='" + DAT + "'", null);
|
||||
SQLiteHelpers.Close();
|
||||
try
|
||||
{
|
||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||
SQLiteHelpers.Open(); //打开数据库
|
||||
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;
|
||||
};
|
||||
|
||||
@@ -63,6 +63,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径
|
||||
public static DataTable Machines = new DataTable(); //设备表缓存
|
||||
public static UserControls.info[] inf = new UserControls.info[999]; //定义总览信息卡
|
||||
public static int ERR_c = 0;//错误计数器
|
||||
public MainWindowViewModel()
|
||||
{
|
||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||
|
||||
Reference in new issue
Block a user