Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement
This commit is contained in:
commit
d551ed4cd2
1 file changed
+29
-6
@@ -34,7 +34,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class AsyncTcpClient
|
public class AsyncTcpClient
|
||||||
{
|
{
|
||||||
|
private static SQLiteHelper SQLiteHelpers = null; //定义数据库
|
||||||
|
private static readonly string ChartAdress = Environment.CurrentDirectory + "\\DataBase\\Chart.db"; //数据库路径
|
||||||
public static async Task TcpClient(TcpClient tcpClient, string ip, string port)
|
public static async Task TcpClient(TcpClient tcpClient, string ip, string port)
|
||||||
{
|
{
|
||||||
//TcpClient tcpClient = new TcpClient();
|
//TcpClient tcpClient = new TcpClient();
|
||||||
@@ -95,16 +96,38 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
else if (SYSAPI == "SC830")
|
else if (SYSAPI == "SC830")
|
||||||
{
|
{
|
||||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||||
Dictionary<string, object> Chart_new = new Dictionary<string, object>();//缓存函数
|
Dictionary<string, object> _new = new Dictionary<string, object>();//缓存函数
|
||||||
Chart_new = JsonConvert.DeserializeObject<Dictionary<string, object>>(DAT);//反序列化
|
_new = JsonConvert.DeserializeObject<Dictionary<string, object>>(DAT);//反序列化
|
||||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "' AND port='" + client.Port + "'").First();
|
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "' AND port='" + client.Port + "'").First();
|
||||||
drEmployee.BeginEdit();
|
drEmployee.BeginEdit();
|
||||||
drEmployee["Message"] = Chart_new.GetValue("Status").ToString();
|
drEmployee["Message"] = _new.GetValue("Status").ToString();
|
||||||
drEmployee["WorkOrder"] = Chart_new.GetValue("WorkNumder").ToString();
|
drEmployee["WorkOrder"] = _new.GetValue("WorkNumder").ToString();
|
||||||
drEmployee["Temperature"] = Chart_new.GetValue("MTT").ToString();
|
drEmployee["Temperature"] = _new.GetValue("MTT").ToString();
|
||||||
drEmployee.EndEdit();
|
drEmployee.EndEdit();
|
||||||
drEmployee.AcceptChanges();
|
drEmployee.AcceptChanges();
|
||||||
drEmployee.ClearErrors();
|
drEmployee.ClearErrors();
|
||||||
|
|
||||||
|
Dictionary<string, object> Chart_new = new Dictionary<string, object>();//缓存函数
|
||||||
|
// Chart_new.Add("DYELOT", _new.GetValue("Status"));
|
||||||
|
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();
|
||||||
}
|
}
|
||||||
else if (SYSAPI == "SC831")
|
else if (SYSAPI == "SC831")
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user