Browse Source

添加用户信息相关

master
sc 3 months ago
parent
commit
9ce3d975b4
  1. 3
      UserClass/AsyncTcpClient.cs
  2. 17
      ViewModel/MainWindowViewModel.cs
  3. 9
      WindowsView/UserInformation.xaml.cs

3
UserClass/AsyncTcpClient.cs

@ -186,7 +186,8 @@ 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"); if (_new.GetValue("UserButton").ToString()!="900") drEmployee["UserButton"] = _new.GetValue("UserButton");
drEmployee["UserInfo"] = _new.GetValue("UserInfo");
drEmployee["WORK_RUN"] = _new.GetValue("WORK_RUN"); drEmployee["WORK_RUN"] = _new.GetValue("WORK_RUN");
drEmployee["RUN_STEPID"] = _new.GetValue("RUN_STEPID"); drEmployee["RUN_STEPID"] = _new.GetValue("RUN_STEPID");
drEmployee["CALL"] = _new.GetValue("CALL"); drEmployee["CALL"] = _new.GetValue("CALL");

17
ViewModel/MainWindowViewModel.cs

@ -305,7 +305,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
void Tick_Event_5S()//Tick_Event周期执行事件5S void Tick_Event_5S()//Tick_Event周期执行事件5S
{ {
for (int i = 0; i < Machinesdata_Count; i++) for (int i = 0; i < Machinesdata_Count; i++)
{ {/**发送800指令**/
if (Selet_Machines(Machines, "State", "ID='" + i + "'").ToString() == "801") if (Selet_Machines(Machines, "State", "ID='" + i + "'").ToString() == "801")
{ {
stringQueue.Enqueue(new QueueString stringQueue.Enqueue(new QueueString
@ -318,23 +318,23 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
/**染机用户信息**/ /**染机用户信息**/
try try
{ {
if ((bool)Selet_Machines(Machines, "UserButton", "ID='" + i + "'")) if (Selet_Machines(Machines, "UserButton", "ID='" + i + "'").ToString() == "901")
{ {
MainWindow.InfData.Rows.Add(new object[] { MainWindow.InfData.Rows.Add(new object[] {
Selet_Machines(Machines, "Name", "ID='" + i + "'"), Selet_Machines(Machines, "Name", "ID='" + i + "'"),
Properties.Resources.Pequest + Selet_Machines(Machines, "UserInfo", "ID='" + i + "'"), Properties.Resources.Pequest + Selet_Machines(Machines, "UserInfo", "ID='" + i + "'"),
Selet_Machines(Machines, "SYSKEY", "ID='" + i + "'"), Selet_Machines(Machines, "SYSKEY", "ID='" + i + "'"),
Selet_Machines(Machines, "ID", "ID='" + i + "'")}); Selet_Machines(Machines, "ID", "ID='" + i + "'")});
Updata_Machines(Machines, "UserButton", "ID='" + i + "'", "900");
}
if (Selet_Machines(Machines, "UserButton", "ID='" + i + "'").ToString() == "902")
{
MainWindow.InfData.Select("ID='" + i + "'").First().Delete();
} }
} }
catch (Exception) { } catch (Exception) { }
}//发送800指令 }
// MainWindow.InfData.Rows.Add(new object[] { "1", Properties.Resources.Pequest+"a", "423", "12" });
} }
void Tick_Event_60S() void Tick_Event_60S()
@ -370,6 +370,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
Updata_Machines(Machines, "WaterLevel", "ID='" + Convert.ToInt16(dt["ID"]) + "'", "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, "WORK_RUN", "ID='" + Convert.ToInt16(dt["ID"]) + "'", "-1");
Updata_Machines(Machines, "ERR", "ID='" + Convert.ToInt16(dt["ID"]) + "'", "False"); Updata_Machines(Machines, "ERR", "ID='" + Convert.ToInt16(dt["ID"]) + "'", "False");
Updata_Machines(Machines, "UserButton", "ID='" + Convert.ToInt16(dt["ID"]) + "'", "900");
_ = 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());

9
WindowsView/UserInformation.xaml.cs

@ -45,7 +45,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
} }
public void CountDown() public void CountDown()
{ {
timers.Interval = TimeSpan.FromSeconds(10);//秒 timers.Interval = TimeSpan.FromSeconds(5);//秒
timers.Tick += DisTimer_S; timers.Tick += DisTimer_S;
timers.Start(); timers.Start();
}//时间周期初始化 }//时间周期初始化
@ -68,9 +68,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
MainWindow.InfData.Rows[0][1].ToString());//播报 MainWindow.InfData.Rows[0][1].ToString());//播报
inf_cont = 0; inf_cont = 0;
} }
if (MainWindow.InfData.Rows.Count == 0) { this.Close(); }
} }
private void Button_Click(object sender, RoutedEventArgs e) private void Button_Click(object sender, RoutedEventArgs e)
{
try
{ {
var button = sender as Button; var button = sender as Button;
DataRowView datarow = (DataRowView)button.Tag; DataRowView datarow = (DataRowView)button.Tag;
@ -80,6 +84,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
Griddata.ItemsSource = MainWindow.InfData.DefaultView; Griddata.ItemsSource = MainWindow.InfData.DefaultView;
if (MainWindow.InfData.Rows.Count == 0) { this.Close(); } if (MainWindow.InfData.Rows.Count == 0) { this.Close(); }
} }
catch (Exception) { }
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{ {

Loading…
Cancel
Save