diff --git a/ConvertMoels/StateToColorConvert.cs b/ConvertMoels/StateToColorConvert.cs index 0be5ef3..8595047 100644 --- a/ConvertMoels/StateToColorConvert.cs +++ b/ConvertMoels/StateToColorConvert.cs @@ -22,9 +22,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.ConvertMoels string i = value.ToString(); if (i == "201") return "#FF00FF00"; - else if (i == "202") return "#FFFFFF00"; - else if (i == "309") return "#FFFFFFFF"; - else if (i == "800") return "#FFFF0000"; + else if (i == "202") return "Green"; + else if (i == "309") return "#FF000000"; + else if (i == "800") return "Red"; else return "#FF000000"; } } diff --git a/UserClass/AsyncTcpClient.cs b/UserClass/AsyncTcpClient.cs index 7362c0e..fd85b4d 100644 --- a/UserClass/AsyncTcpClient.cs +++ b/UserClass/AsyncTcpClient.cs @@ -75,6 +75,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass drEmployee["Step"] = ""; drEmployee["Message"] = ""; drEmployee["SYSKEY"] = ""; + drEmployee["WORK_RUN"] = "-1"; drEmployee.EndEdit(); drEmployee.AcceptChanges(); LogGing.LogGingDATA("[IP='" + client.IP + "' AND port='" + client.Port + "']=Link_STOP"); @@ -100,6 +101,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass drEmployee["Step"] = ""; drEmployee["Message"] = ""; drEmployee["SYSKEY"] = ""; + drEmployee["WORK_RUN"] = "-1"; drEmployee.EndEdit(); drEmployee.AcceptChanges(); LogGing.LogGingDATA("[IP='" + client.IP + "' AND port='" + client.Port + "']=Link_INTERRUPT"); @@ -175,6 +177,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass _new = JsonConvert.DeserializeObject>(DAT);//反序列化 DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").First(); drEmployee.BeginEdit(); + drEmployee["ERR"] = _new.GetValue("ERR"); drEmployee["LOCK"] = _new.GetValue("LOCK"); drEmployee["Message"] = _new.GetValue("Status"); drEmployee["WorkOrder"] = _new.GetValue("WorkNumder"); diff --git a/View/MonitorView.xaml b/View/MonitorView.xaml index 74a5177..b9937e7 100644 --- a/View/MonitorView.xaml +++ b/View/MonitorView.xaml @@ -45,6 +45,9 @@ + + + @@ -103,7 +106,7 @@ - + diff --git a/ViewModel/MainWindowViewModel.cs b/ViewModel/MainWindowViewModel.cs index 2805788..ab741e3 100644 --- a/ViewModel/MainWindowViewModel.cs +++ b/ViewModel/MainWindowViewModel.cs @@ -12,6 +12,7 @@ using System.Collections.ObjectModel; using System.ComponentModel; using System.Data; using System.Data.SqlClient; +using System.Diagnostics.Eventing.Reader; using System.Linq; using System.Reflection; using System.Text; @@ -259,6 +260,25 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel } for (int i = 0; i < Machinesdata_Count; i++) { + int m_run = (int)Selet_Machines(Machines, "WORK_RUN", "ID='" + i + "'"); + if (m_run==0) + { + Updata_Machines(Machines, "State", "ID='" + i + "'", "101");//停止状态 + } + else if (m_run==1) + { + Updata_Machines(Machines, "State", "ID='" + i + "'", "101");//暂停状态 + } + else if (m_run==2) + { + Updata_Machines(Machines, "State", "ID='" + i + "'", "202");//运行 + } + + if ((bool)Selet_Machines(Machines, "ERR", "ID='" + i + "'")) + { + Updata_Machines(Machines, "State", "ID='" + i + "'", "309");//错误 + } + string mac_s = Selet_Machines(Machines, "State", "ID='" + i + "'").ToString(); if ((mac_s == "101") || (mac_s == "201") || (mac_s == "202") || (mac_s == "301") || (mac_s == "309"))//获取信息 { @@ -329,12 +349,14 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel Updata_Machines(Machines, "State", "ID='" + Convert.ToInt16(dt["ID"]) + "'", "800"); Updata_Machines(Machines, "Temperature", "ID='" + Convert.ToInt16(dt["ID"]) + "'", "0.0"); Updata_Machines(Machines, "WaterLevel", "ID='" + Convert.ToInt16(dt["ID"]) + "'", "0"); + Updata_Machines(Machines, "WORK_RUN", "ID='" + Convert.ToInt16(dt["ID"]) + "'", "-1"); + Updata_Machines(Machines, "ERR", "ID='" + Convert.ToInt16(dt["ID"]) + "'", "False"); _ = AsyncTcpClient.TcpClient(MachiensTcpClient[i] //建立tcp连接 , Selet_Machines(Machines, "IP", "ID='" + Convert.ToInt16(dt["ID"]) + "'").ToString() , Selet_Machines(Machines, "PORT", "ID='" + Convert.ToInt16(dt["ID"]) + "'").ToString()); } } - + public static string SYS_WorkNumder; //工单号 public static int SYS_AT1; //附缸1-3 public static int SYS_AT2;