sc 11 months ago
parent
commit
f226938084
  1. 50
      UserClass/AsyncTcpClient.cs
  2. 30
      View/MonitorView.xaml.cs

50
UserClass/AsyncTcpClient.cs

@ -102,32 +102,38 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
drEmployee.BeginEdit();
drEmployee["Message"] = _new.GetValue("Status").ToString();
drEmployee["WorkOrder"] = _new.GetValue("WorkNumder").ToString();
drEmployee["Temperature"] = _new.GetValue("MTT").ToString();
drEmployee["Temperature"] = _new.GetValue("MTT").ToString();
drEmployee["WaterLevel"] = _new.GetValue("MTL").ToString();
drEmployee["Process"] = _new.GetValue("Process").ToString();
drEmployee["Step"] = _new.GetValue("Step").ToString();
drEmployee.EndEdit();
drEmployee.AcceptChanges();
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();
if (_new.GetValue("Status").ToString() != "----------")
{
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")
{

30
View/MonitorView.xaml.cs

@ -97,7 +97,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
dat_821.Add("INSTRUCTION", "CONTINUE");
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
MainWindowViewModel.MachiensTcpClient[index].SendAsync("SC821" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index) + dat_821.ToJsonString());
// MainWindowViewModel.MachiensTcpClient[index].SendAsync("SC821" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index) + dat_821.ToJsonString());
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString { ID = index, DAT = "SC821" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index) + dat_821.ToJsonString() });
}
@ -115,13 +116,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
dat_821.Add("INSTRUCTION", "PAUSE");
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
MainWindowViewModel.MachiensTcpClient[index].SendAsync("SC821" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index) + dat_821.ToJsonString());
// MainWindowViewModel.MachiensTcpClient[index].SendAsync("SC821" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index) + dat_821.ToJsonString());
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString { ID = index, DAT = "SC821" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index) + dat_821.ToJsonString() });
}
Insert.IsEnabled = true;
edit.IsEnabled = true;
Paused.IsEnabled = true;
Resume.IsEnabled = true;
Delete.IsEnabled = true;
}//暂停
private void ListViewItem_Stop(object sender, MouseButtonEventArgs e)
{
@ -132,7 +135,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
dat_821.Add("INSTRUCTION", "STOP");
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
MainWindowViewModel.MachiensTcpClient[index].SendAsync("SC821" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index)+dat_821.ToJsonString());
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString { ID = index, DAT = "SC821" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index) + dat_821.ToJsonString() });
// MainWindowViewModel.MachiensTcpClient[index].SendAsync("SC821" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index)+dat_821.ToJsonString());
}
}//停止
private void ListViewItem_edit(object sender, MouseButtonEventArgs e)
@ -163,7 +168,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
MainWindowViewModel.MachiensTcpClient[index].SendAsync("SC821" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index) + dat_821.ToJsonString());
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString { ID = index, DAT = "SC821" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index) + dat_821.ToJsonString() });
// MainWindowViewModel.MachiensTcpClient[index].SendAsync("SC821" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index) + dat_821.ToJsonString());
}
private void ListViewItem_Jump(object sender, MouseButtonEventArgs e)
@ -194,11 +201,24 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
MainWindowViewModel.MachiensTcpClient[index].SendAsync("SC821" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index) + dat_821.ToJsonString());
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString { ID = index, DAT = "SC821" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index) + dat_821.ToJsonString() });
// MainWindowViewModel.MachiensTcpClient[index].SendAsync("SC821" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index) + dat_821.ToJsonString());
}
private void ListViewItem_Delete(object sender, MouseButtonEventArgs e)
{
if (!string.IsNullOrEmpty(machine))
{
Dictionary<string, object> dat_821 = new Dictionary<string, object>();
dat_821.Clear();
dat_821.Add("INSTRUCTION", "DELETE");
dat_821.Add("ID", ID);
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
// MainWindowViewModel.MachiensTcpClient[index].SendAsync("SC821" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index) + dat_821.ToJsonString());
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString { ID = index, DAT = "SC821" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index) + dat_821.ToJsonString() });
}
}//删除
public void CountDown()

Loading…
Cancel
Save