Browse Source

添加用户信息相关

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

3
UserClass/AsyncTcpClient.cs

@ -186,7 +186,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
drEmployee["WaterLevel"] = _new.GetValue("MTL");
drEmployee["Process"] = _new.GetValue("Process");
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["RUN_STEPID"] = _new.GetValue("RUN_STEPID");
drEmployee["CALL"] = _new.GetValue("CALL");

17
ViewModel/MainWindowViewModel.cs

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

25
WindowsView/UserInformation.xaml.cs

@ -45,7 +45,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
}
public void CountDown()
{
timers.Interval = TimeSpan.FromSeconds(10);//秒
timers.Interval = TimeSpan.FromSeconds(5);//秒
timers.Tick += DisTimer_S;
timers.Start();
}//时间周期初始化
@ -67,19 +67,26 @@ namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
synth.SpeakAsync(Properties.Resources.Machine + MainWindow.InfData.Rows[0][0].ToString() +
MainWindow.InfData.Rows[0][1].ToString());//播报
inf_cont = 0;
}
}
if (MainWindow.InfData.Rows.Count == 0) { this.Close(); }
}
private void Button_Click(object sender, RoutedEventArgs e)
{
var button = sender as Button;
DataRowView datarow = (DataRowView)button.Tag;
var id= datarow.Row.Field<int>("ID");
MainWindow.InfData.Select("ID='" + id + "'").First().Delete();
try
{
var button = sender as Button;
DataRowView datarow = (DataRowView)button.Tag;
var id = datarow.Row.Field<int>("ID");
MainWindow.InfData.Select("ID='" + id + "'").First().Delete();
Griddata.ItemsSource = MainWindow.InfData.DefaultView;
if (MainWindow.InfData.Rows.Count == 0) { this.Close(); }
}
Griddata.ItemsSource = MainWindow.InfData.DefaultView;
if (MainWindow.InfData.Rows.Count == 0) { this.Close(); }
}
catch (Exception) { }
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{

Loading…
Cancel
Save