Browse Source

830指令添加信息项目

master
sc 4 months ago
parent
commit
37435ca60c
  1. 4
      UserClass/AsyncTcpClient.cs
  2. 4
      View/Whole.xaml.cs
  3. 6
      ViewModel/MainWindowViewModel.cs

4
UserClass/AsyncTcpClient.cs

@ -182,6 +182,10 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
drEmployee["WaterLevel"] = _new.GetValue("MTL"); drEmployee["WaterLevel"] = _new.GetValue("MTL");
drEmployee["Process"] = _new.GetValue("Process"); drEmployee["Process"] = _new.GetValue("Process");
drEmployee["Step"] = _new.GetValue("Step"); drEmployee["Step"] = _new.GetValue("Step");
drEmployee["UserButton"] = _new.GetValue("UserButton");
drEmployee["WORK_RUN"] = _new.GetValue("WORK_RUN");
drEmployee["RUN_STEPID"] = _new.GetValue("RUN_STEPID");
drEmployee["CALL"] = _new.GetValue("CALL");
drEmployee.EndEdit(); drEmployee.EndEdit();
drEmployee.AcceptChanges(); drEmployee.AcceptChanges();

4
View/Whole.xaml.cs

@ -55,7 +55,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
else else
{ inf[i].name.Background = new SolidColorBrush(Color.FromRgb(255, 0, 0)); } { inf[i].name.Background = new SolidColorBrush(Color.FromRgb(255, 0, 0)); }
inf[i].temp.Text = (string)Selet_Machines(MainWindowViewModel.Machines, "Temperature", i) + "°C"; inf[i].temp.Text = Selet_Machines(MainWindowViewModel.Machines, "Temperature", i).ToString() + "°C";
inf[i].Process.Text = (string)Selet_Machines(MainWindowViewModel.Machines, "Process", i); inf[i].Process.Text = (string)Selet_Machines(MainWindowViewModel.Machines, "Process", i);
inf[i].Step.Text = (string)Selet_Machines(MainWindowViewModel.Machines, "Step", i); inf[i].Step.Text = (string)Selet_Machines(MainWindowViewModel.Machines, "Step", i);
inf[i].Message.Text = (string)Selet_Machines(MainWindowViewModel.Machines, "Message", i); inf[i].Message.Text = (string)Selet_Machines(MainWindowViewModel.Machines, "Message", i);
@ -109,7 +109,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
else else
{ inf[i].name.Background = new SolidColorBrush(Color.FromRgb(255, 0, 0)); } { inf[i].name.Background = new SolidColorBrush(Color.FromRgb(255, 0, 0)); }
inf[i].temp.Text = (string)Selet_Machines(MainWindowViewModel.Machines, "Temperature", i) + "°C"; inf[i].temp.Text = Selet_Machines(MainWindowViewModel.Machines, "Temperature", i).ToString() + "°C";
inf[i].Process.Text = (string)Selet_Machines(MainWindowViewModel.Machines, "Process", i); inf[i].Process.Text = (string)Selet_Machines(MainWindowViewModel.Machines, "Process", i);
inf[i].Step.Text = (string)Selet_Machines(MainWindowViewModel.Machines, "Step", i); inf[i].Step.Text = (string)Selet_Machines(MainWindowViewModel.Machines, "Step", i);
inf[i].Message.Text = (string)Selet_Machines(MainWindowViewModel.Machines, "Message", i); inf[i].Message.Text = (string)Selet_Machines(MainWindowViewModel.Machines, "Message", i);

6
ViewModel/MainWindowViewModel.cs

@ -69,7 +69,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
private SQLiteHelper SQLiteHelpers = null; //定义数据库 private SQLiteHelper SQLiteHelpers = null; //定义数据库
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 DataRow MachinesROW; // public static DataRow MachinesROW;
public static DataTable USER_data = new DataTable(); public static DataTable USER_data = 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 static int ERR_c = 0;//错误计数器
@ -96,7 +96,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
USER_data = SQLiteHelpers.ExecuteDataSet("select * from USER order by Name desc", null).Tables[0]; USER_data = SQLiteHelpers.ExecuteDataSet("select * from USER order by Name desc", null).Tables[0];
SQLiteHelpers.Close(); SQLiteHelpers.Close();
MachinesROW = Machines.NewRow(); // MachinesROW = Machines.NewRow();
USERCapacity(App.USER_Purview);//App.USER_Purview); USERCapacity(App.USER_Purview);//App.USER_Purview);
CountDown(); CountDown();
@ -327,6 +327,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
MachiensTcpClient[i] = new TcpClient(); MachiensTcpClient[i] = new TcpClient();
DataRow dt = machinesdata[i]; DataRow dt = machinesdata[i];
Updata_Machines(Machines, "State", "ID='" + Convert.ToInt16(dt["ID"]) + "'", "800"); 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");
_ = AsyncTcpClient.TcpClient(MachiensTcpClient[i] //建立tcp连接 _ = AsyncTcpClient.TcpClient(MachiensTcpClient[i] //建立tcp连接
, Selet_Machines(Machines, "IP", "ID='" + Convert.ToInt16(dt["ID"]) + "'").ToString() , Selet_Machines(Machines, "IP", "ID='" + Convert.ToInt16(dt["ID"]) + "'").ToString()
, Selet_Machines(Machines, "PORT", "ID='" + Convert.ToInt16(dt["ID"]) + "'").ToString()); , Selet_Machines(Machines, "PORT", "ID='" + Convert.ToInt16(dt["ID"]) + "'").ToString());

Loading…
Cancel
Save