处理lock (Machines.Rows.SyncRoot)并发写datatable问题
This commit is contained in:
commit
d3375fd6ac
7 files changed
+1938
-1129
No files matched your search
+96
-86
@@ -75,95 +75,103 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
if (!string.IsNullOrEmpty(comboBoxMachine.Text))
|
||||
{
|
||||
Dictionary<string, object> Machines_DAT = new Dictionary<string, object>();//缓存函数
|
||||
if (MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from Machines where name ='" + comboBoxMachine.Text + "'", null).Tables[0].Rows.Count == 0)
|
||||
{
|
||||
DataRow dat_= MainWindowViewModel.Machines.NewRow();
|
||||
dat_.BeginEdit();
|
||||
dat_["Name"] = comboBoxMachine.Text;
|
||||
dat_["Groups"] = TextMachineGroup.Text;
|
||||
dat_["IP"] = IP.Text;
|
||||
dat_["PORT"] = PORT.Text;
|
||||
dat_["Serial"] = comboBoxCOM0.Text;
|
||||
dat_["Model"] = comboBoxtype.Text;
|
||||
dat_["Station"] = Station.Text;
|
||||
dat_["ID"] = 999;
|
||||
dat_["ERR"] = false;
|
||||
dat_["AUTO"] = false;
|
||||
dat_["CALL"] = false;
|
||||
dat_["LOCK"] = false;
|
||||
dat_["State"] = 800;
|
||||
dat_["Temperature"] = 0;
|
||||
dat_["WaterLevel"] = 0;
|
||||
dat_["WORK_RUN"] = -1;
|
||||
dat_["UserInfoStart"] = 900;
|
||||
if (comboBoxtype.Text.Contains( link_model))
|
||||
if (MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from Machines where name ='" + comboBoxMachine.Text + "'", null).Tables[0].Rows.Count == 0)
|
||||
{
|
||||
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
|
||||
{
|
||||
dat_["Desktop"] = true;
|
||||
dat_["Type"] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
dat_["Desktop"] = false;
|
||||
dat_["Type"] = false;
|
||||
}
|
||||
dat_.EndEdit();
|
||||
MainWindowViewModel.Machines.Rows.Add(dat_);
|
||||
DatSteps(MainWindowViewModel.Machines);
|
||||
MainWindowViewModel.SQLiteHelpers.Delete("Machines", null, null);//
|
||||
for (int x = 0; x < MainWindowViewModel.Machines.Rows.Count; x++)
|
||||
{
|
||||
Machines_DAT.Add("ID", MainWindowViewModel.Machines.Rows[x]["ID"]);
|
||||
Machines_DAT.Add("Name", MainWindowViewModel.Machines.Rows[x]["Name"]);
|
||||
Machines_DAT.Add("IP", MainWindowViewModel.Machines.Rows[x]["IP"]);
|
||||
Machines_DAT.Add("PORT", MainWindowViewModel.Machines.Rows[x]["PORT"]);
|
||||
Machines_DAT.Add("Serial", MainWindowViewModel.Machines.Rows[x]["Serial"]);
|
||||
Machines_DAT.Add("Station", MainWindowViewModel.Machines.Rows[x]["Station"]);
|
||||
Machines_DAT.Add("Groups", MainWindowViewModel.Machines.Rows[x]["Groups"]);
|
||||
Machines_DAT.Add("Desktop", MainWindowViewModel.Machines.Rows[x]["Desktop"]);
|
||||
Machines_DAT.Add("Dispense", MainWindowViewModel.Machines.Rows[x]["Dispense"]);
|
||||
Machines_DAT.Add("Type", MainWindowViewModel.Machines.Rows[x]["Type"]);
|
||||
Machines_DAT.Add("Model", MainWindowViewModel.Machines.Rows[x]["Model"]);
|
||||
MainWindowViewModel.SQLiteHelpers.InsertData("Machines", Machines_DAT);//行插入
|
||||
Machines_DAT.Clear();
|
||||
DataRow dat_ = MainWindowViewModel.Machines.NewRow();
|
||||
dat_.BeginEdit();
|
||||
dat_["Name"] = comboBoxMachine.Text;
|
||||
dat_["Groups"] = TextMachineGroup.Text;
|
||||
dat_["IP"] = IP.Text;
|
||||
dat_["PORT"] = PORT.Text;
|
||||
dat_["Serial"] = comboBoxCOM0.Text;
|
||||
dat_["Model"] = comboBoxtype.Text;
|
||||
dat_["Station"] = Station.Text;
|
||||
dat_["ID"] = 999;
|
||||
dat_["ERR"] = false;
|
||||
dat_["AUTO"] = false;
|
||||
dat_["CALL"] = false;
|
||||
dat_["LOCK"] = false;
|
||||
dat_["State"] = 800;
|
||||
dat_["Temperature"] = 0;
|
||||
dat_["WaterLevel"] = 0;
|
||||
dat_["WORK_RUN"] = -1;
|
||||
dat_["UserInfoStart"] = 900;
|
||||
if (comboBoxtype.Text.Contains(link_model))
|
||||
{
|
||||
dat_["Desktop"] = true;
|
||||
dat_["Type"] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
dat_["Desktop"] = false;
|
||||
dat_["Type"] = false;
|
||||
}
|
||||
dat_.EndEdit();
|
||||
MainWindowViewModel.Machines.Rows.Add(dat_);
|
||||
DatSteps(MainWindowViewModel.Machines);
|
||||
MainWindowViewModel.SQLiteHelpers.Delete("Machines", null, null);//
|
||||
for (int x = 0; x < MainWindowViewModel.Machines.Rows.Count; x++)
|
||||
{
|
||||
Machines_DAT.Add("ID", MainWindowViewModel.Machines.Rows[x]["ID"]);
|
||||
Machines_DAT.Add("Name", MainWindowViewModel.Machines.Rows[x]["Name"]);
|
||||
Machines_DAT.Add("IP", MainWindowViewModel.Machines.Rows[x]["IP"]);
|
||||
Machines_DAT.Add("PORT", MainWindowViewModel.Machines.Rows[x]["PORT"]);
|
||||
Machines_DAT.Add("Serial", MainWindowViewModel.Machines.Rows[x]["Serial"]);
|
||||
Machines_DAT.Add("Station", MainWindowViewModel.Machines.Rows[x]["Station"]);
|
||||
Machines_DAT.Add("Groups", MainWindowViewModel.Machines.Rows[x]["Groups"]);
|
||||
Machines_DAT.Add("Desktop", MainWindowViewModel.Machines.Rows[x]["Desktop"]);
|
||||
Machines_DAT.Add("Dispense", MainWindowViewModel.Machines.Rows[x]["Dispense"]);
|
||||
Machines_DAT.Add("Type", MainWindowViewModel.Machines.Rows[x]["Type"]);
|
||||
Machines_DAT.Add("Model", MainWindowViewModel.Machines.Rows[x]["Model"]);
|
||||
MainWindowViewModel.SQLiteHelpers.InsertData("Machines", Machines_DAT);//行插入
|
||||
Machines_DAT.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DataRow dr = MainWindowViewModel.Machines.Rows[ID_];
|
||||
dr.BeginEdit();
|
||||
dr["Name"] = comboBoxMachine.Text;
|
||||
dr["Groups"] = TextMachineGroup.Text;
|
||||
dr["IP"] = IP.Text;
|
||||
dr["PORT"] = PORT.Text;
|
||||
dr["Serial"] = comboBoxCOM0.Text;
|
||||
dr["Model"] = comboBoxtype.Text;
|
||||
dr["Station"] = Station.Text;
|
||||
if (comboBoxtype.Text.Contains(link_model))
|
||||
{ dr["Desktop"] = true;
|
||||
dr["Type"] = true; }
|
||||
else
|
||||
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
|
||||
{
|
||||
dr["Desktop"] = false;
|
||||
dr["Type"] = false;
|
||||
}
|
||||
dr.EndEdit();
|
||||
MainWindowViewModel.SQLiteHelpers.Delete("Machines", null, null);//
|
||||
for (int x = 0; x < MainWindowViewModel.Machines.Rows.Count; x++)
|
||||
{
|
||||
Machines_DAT.Add("ID", MainWindowViewModel.Machines.Rows[x]["ID"]);
|
||||
Machines_DAT.Add("Name", MainWindowViewModel.Machines.Rows[x]["Name"]);
|
||||
Machines_DAT.Add("IP", MainWindowViewModel.Machines.Rows[x]["IP"]);
|
||||
Machines_DAT.Add("PORT", MainWindowViewModel.Machines.Rows[x]["PORT"]);
|
||||
Machines_DAT.Add("Serial", MainWindowViewModel.Machines.Rows[x]["Serial"]);
|
||||
Machines_DAT.Add("Station", MainWindowViewModel.Machines.Rows[x]["Station"]);
|
||||
Machines_DAT.Add("Groups", MainWindowViewModel.Machines.Rows[x]["Groups"]);
|
||||
Machines_DAT.Add("Desktop", MainWindowViewModel.Machines.Rows[x]["Desktop"]);
|
||||
Machines_DAT.Add("Dispense", MainWindowViewModel.Machines.Rows[x]["Dispense"]);
|
||||
Machines_DAT.Add("Type", MainWindowViewModel.Machines.Rows[x]["Type"]);
|
||||
Machines_DAT.Add("Model", MainWindowViewModel.Machines.Rows[x]["Model"]);
|
||||
Machines_DAT.Add("LOCK", "FALSE");
|
||||
MainWindowViewModel.SQLiteHelpers.InsertData("Machines", Machines_DAT);//行插入
|
||||
Machines_DAT.Clear();
|
||||
DataRow dr = MainWindowViewModel.Machines.Rows[ID_];
|
||||
dr.BeginEdit();
|
||||
dr["Name"] = comboBoxMachine.Text;
|
||||
dr["Groups"] = TextMachineGroup.Text;
|
||||
dr["IP"] = IP.Text;
|
||||
dr["PORT"] = PORT.Text;
|
||||
dr["Serial"] = comboBoxCOM0.Text;
|
||||
dr["Model"] = comboBoxtype.Text;
|
||||
dr["Station"] = Station.Text;
|
||||
if (comboBoxtype.Text.Contains(link_model))
|
||||
{
|
||||
dr["Desktop"] = true;
|
||||
dr["Type"] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
dr["Desktop"] = false;
|
||||
dr["Type"] = false;
|
||||
}
|
||||
dr.EndEdit();
|
||||
MainWindowViewModel.SQLiteHelpers.Delete("Machines", null, null);//
|
||||
for (int x = 0; x < MainWindowViewModel.Machines.Rows.Count; x++)
|
||||
{
|
||||
Machines_DAT.Add("ID", MainWindowViewModel.Machines.Rows[x]["ID"]);
|
||||
Machines_DAT.Add("Name", MainWindowViewModel.Machines.Rows[x]["Name"]);
|
||||
Machines_DAT.Add("IP", MainWindowViewModel.Machines.Rows[x]["IP"]);
|
||||
Machines_DAT.Add("PORT", MainWindowViewModel.Machines.Rows[x]["PORT"]);
|
||||
Machines_DAT.Add("Serial", MainWindowViewModel.Machines.Rows[x]["Serial"]);
|
||||
Machines_DAT.Add("Station", MainWindowViewModel.Machines.Rows[x]["Station"]);
|
||||
Machines_DAT.Add("Groups", MainWindowViewModel.Machines.Rows[x]["Groups"]);
|
||||
Machines_DAT.Add("Desktop", MainWindowViewModel.Machines.Rows[x]["Desktop"]);
|
||||
Machines_DAT.Add("Dispense", MainWindowViewModel.Machines.Rows[x]["Dispense"]);
|
||||
Machines_DAT.Add("Type", MainWindowViewModel.Machines.Rows[x]["Type"]);
|
||||
Machines_DAT.Add("Model", MainWindowViewModel.Machines.Rows[x]["Model"]);
|
||||
Machines_DAT.Add("LOCK", "FALSE");
|
||||
MainWindowViewModel.SQLiteHelpers.InsertData("Machines", Machines_DAT);//行插入
|
||||
Machines_DAT.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
Griddata.ItemsSource = MainWindowViewModel.Machines.DefaultView;
|
||||
@@ -187,9 +195,11 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
MessageBoxResult vr = System.Windows.MessageBox.Show(Properties.Resources.Delete + comboBoxMachine.Text, "SCCM", MessageBoxButton.OKCancel, MessageBoxImage.Question);
|
||||
if (vr == MessageBoxResult.OK) // 如果是确定,就执行下面代码
|
||||
{
|
||||
MainWindowViewModel.Machines.Rows.RemoveAt(ID_ - 1);
|
||||
DatSteps(MainWindowViewModel.Machines);
|
||||
|
||||
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
|
||||
{
|
||||
MainWindowViewModel.Machines.Rows.RemoveAt(ID_ - 1);
|
||||
DatSteps(MainWindowViewModel.Machines);
|
||||
}
|
||||
Dictionary<string, object> Machines_DAT = new Dictionary<string, object>();//缓存函数
|
||||
|
||||
MainWindowViewModel.SQLiteHelpers.Delete("Machines", null, null);//
|
||||
|
||||
+541
-190
@@ -146,77 +146,80 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
{
|
||||
if (!string.IsNullOrEmpty(machine))
|
||||
{
|
||||
bool mode = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First().Field<bool>("LOCK");
|
||||
|
||||
Dictionary<string, object> dat_ = new Dictionary<string, object>();
|
||||
dat_.Clear();
|
||||
|
||||
if (!mode)
|
||||
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
|
||||
{
|
||||
dat_.Add("NAME", "LOCK");
|
||||
dat_.Add("VALUE", "True");
|
||||
MainWindowViewModel.Updata_Machines(MainWindowViewModel.Machines, "LOCK", "Name='" + machine + "'", "True");
|
||||
}
|
||||
else
|
||||
{
|
||||
dat_.Add("NAME", "LOCK");
|
||||
dat_.Add("VALUE", "False");
|
||||
MainWindowViewModel.Updata_Machines(MainWindowViewModel.Machines, "LOCK", "Name='" + machine + "'", "False");
|
||||
}
|
||||
bool mode = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First().Field<bool>("LOCK");
|
||||
|
||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
||||
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
||||
Dictionary<string, object> dat_ = new Dictionary<string, object>();
|
||||
dat_.Clear();
|
||||
|
||||
if (drEmployee.Field<bool>("Type"))
|
||||
{//网络
|
||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||
if (!mode)
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC829" + drEmployee.Field<string>("SYSKEY") + dat_.ToJsonString()
|
||||
});
|
||||
}
|
||||
else
|
||||
{//串口
|
||||
if (drEmployee.Field<string>("Serial") == "PORT1")
|
||||
dat_.Add("NAME", "LOCK");
|
||||
dat_.Add("VALUE", "True");
|
||||
MainWindowViewModel.Updata_Machines(MainWindowViewModel.Machines, "LOCK", "Name='" + machine + "'", "True");
|
||||
}
|
||||
else
|
||||
{
|
||||
stringQueueSerial_1.Enqueue(new QueueSerial
|
||||
dat_.Add("NAME", "LOCK");
|
||||
dat_.Add("VALUE", "False");
|
||||
MainWindowViewModel.Updata_Machines(MainWindowViewModel.Machines, "LOCK", "Name='" + machine + "'", "False");
|
||||
}
|
||||
|
||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
||||
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
||||
|
||||
if (drEmployee.Field<bool>("Type"))
|
||||
{//网络
|
||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC829" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'") + dat_.ToJsonString()
|
||||
DAT = "SC829" + drEmployee.Field<string>("SYSKEY") + dat_.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT2")
|
||||
{
|
||||
stringQueueSerial_2.Enqueue(new QueueSerial
|
||||
else
|
||||
{//串口
|
||||
if (drEmployee.Field<string>("Serial") == "PORT1")
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC829" + drEmployee.Field<string>("Station") + dat_.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT3")
|
||||
{
|
||||
stringQueueSerial_3.Enqueue(new QueueSerial
|
||||
stringQueueSerial_1.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC829" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'") + dat_.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT2")
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC829" + drEmployee.Field<string>("Station") + dat_.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT4")
|
||||
{
|
||||
stringQueueSerial_4.Enqueue(new QueueSerial
|
||||
stringQueueSerial_2.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC829" + drEmployee.Field<string>("Station") + dat_.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT3")
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC829" + drEmployee.Field<string>("Station") + dat_.ToJsonString()
|
||||
});
|
||||
stringQueueSerial_3.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC829" + drEmployee.Field<string>("Station") + dat_.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT4")
|
||||
{
|
||||
stringQueueSerial_4.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC829" + drEmployee.Field<string>("Station") + dat_.ToJsonString()
|
||||
});
|
||||
}
|
||||
}
|
||||
if (!mode)
|
||||
{
|
||||
MessageBox.Show(machine + Properties.Resources.user_lock, "800", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(machine + Properties.Resources.user_unlock, "800", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
}
|
||||
if (!mode)
|
||||
{
|
||||
MessageBox.Show(machine + Properties.Resources.user_lock, "800", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(machine + Properties.Resources.user_unlock, "800", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
}
|
||||
}//锁定
|
||||
@@ -224,67 +227,70 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
{
|
||||
if (!string.IsNullOrEmpty(machine))
|
||||
{
|
||||
bool mode = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First().Field<bool>("AUTO");
|
||||
|
||||
Dictionary<string, object> dat_ = new Dictionary<string, object>();
|
||||
dat_.Clear();
|
||||
|
||||
if (!mode)
|
||||
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
|
||||
{
|
||||
dat_.Add("NAME", "AUTO");
|
||||
dat_.Add("VALUE", "True");
|
||||
MainWindowViewModel.Updata_Machines(MainWindowViewModel.Machines, "AUTO", "Name='" + machine + "'", "True");
|
||||
}
|
||||
else
|
||||
{
|
||||
dat_.Add("NAME", "AUTO");
|
||||
dat_.Add("VALUE", "FALSE");
|
||||
MainWindowViewModel.Updata_Machines(MainWindowViewModel.Machines, "AUTO", "Name='" + machine + "'", "False");
|
||||
}
|
||||
bool mode = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First().Field<bool>("AUTO");
|
||||
|
||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
||||
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
||||
if (drEmployee.Field<bool>("Type"))
|
||||
{//网络
|
||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||
Dictionary<string, object> dat_ = new Dictionary<string, object>();
|
||||
dat_.Clear();
|
||||
|
||||
if (!mode)
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC829" + drEmployee.Field<string>("SYSKEY") + dat_.ToJsonString()
|
||||
});
|
||||
}
|
||||
else
|
||||
{//串口
|
||||
if (drEmployee.Field<string>("Serial") == "PORT1")
|
||||
dat_.Add("NAME", "AUTO");
|
||||
dat_.Add("VALUE", "True");
|
||||
MainWindowViewModel.Updata_Machines(MainWindowViewModel.Machines, "AUTO", "Name='" + machine + "'", "True");
|
||||
}
|
||||
else
|
||||
{
|
||||
stringQueueSerial_1.Enqueue(new QueueSerial
|
||||
dat_.Add("NAME", "AUTO");
|
||||
dat_.Add("VALUE", "FALSE");
|
||||
MainWindowViewModel.Updata_Machines(MainWindowViewModel.Machines, "AUTO", "Name='" + machine + "'", "False");
|
||||
}
|
||||
|
||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
||||
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
||||
if (drEmployee.Field<bool>("Type"))
|
||||
{//网络
|
||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC829" + drEmployee.Field<string>("Station") + dat_.ToJsonString()
|
||||
DAT = "SC829" + drEmployee.Field<string>("SYSKEY") + dat_.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT2")
|
||||
{
|
||||
stringQueueSerial_2.Enqueue(new QueueSerial
|
||||
else
|
||||
{//串口
|
||||
if (drEmployee.Field<string>("Serial") == "PORT1")
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC829" + drEmployee.Field<string>("Station") + dat_.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT3")
|
||||
{
|
||||
stringQueueSerial_3.Enqueue(new QueueSerial
|
||||
stringQueueSerial_1.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC829" + drEmployee.Field<string>("Station") + dat_.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT2")
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC829" + drEmployee.Field<string>("Station") + dat_.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT4")
|
||||
{
|
||||
stringQueueSerial_4.Enqueue(new QueueSerial
|
||||
stringQueueSerial_2.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC829" + drEmployee.Field<string>("Station") + dat_.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT3")
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC829" + drEmployee.Field<string>("Station") + dat_.ToJsonString()
|
||||
});
|
||||
stringQueueSerial_3.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC829" + drEmployee.Field<string>("Station") + dat_.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT4")
|
||||
{
|
||||
stringQueueSerial_4.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC829" + drEmployee.Field<string>("Station") + dat_.ToJsonString()
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -296,49 +302,52 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
Dictionary<string, object> dat_821 = new Dictionary<string, object>();
|
||||
dat_821.Clear();
|
||||
dat_821.Add("INSTRUCTION", "STOP");
|
||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
||||
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
||||
if (drEmployee.Field<bool>("Type"))
|
||||
{//网络
|
||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("SYSKEY") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
else
|
||||
{//串口
|
||||
if (drEmployee.Field<string>("Serial") == "PORT1")
|
||||
{
|
||||
stringQueueSerial_1.Enqueue(new QueueSerial
|
||||
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
|
||||
{
|
||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
||||
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
||||
if (drEmployee.Field<bool>("Type"))
|
||||
{//网络
|
||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||
DAT = "SC821" + drEmployee.Field<string>("SYSKEY") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT2")
|
||||
{
|
||||
stringQueueSerial_2.Enqueue(new QueueSerial
|
||||
else
|
||||
{//串口
|
||||
if (drEmployee.Field<string>("Serial") == "PORT1")
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT3")
|
||||
{
|
||||
stringQueueSerial_3.Enqueue(new QueueSerial
|
||||
stringQueueSerial_1.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT2")
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT4")
|
||||
{
|
||||
stringQueueSerial_4.Enqueue(new QueueSerial
|
||||
stringQueueSerial_2.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT3")
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||
});
|
||||
stringQueueSerial_3.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT4")
|
||||
{
|
||||
stringQueueSerial_4.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -465,12 +474,49 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
}
|
||||
|
||||
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC833" + drEmployee.Field<string>("SYSKEY")
|
||||
});
|
||||
|
||||
if (drEmployee.Field<bool>("Type"))
|
||||
{//网络
|
||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC833" + drEmployee.Field<string>("SYSKEY")
|
||||
});
|
||||
}
|
||||
else
|
||||
{//串口
|
||||
if (drEmployee.Field<string>("Serial") == "PORT1")
|
||||
{
|
||||
stringQueueSerial_1.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC833" + drEmployee.Field<string>("Station")
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT2")
|
||||
{
|
||||
stringQueueSerial_2.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC833" + drEmployee.Field<string>("Station")
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT3")
|
||||
{
|
||||
stringQueueSerial_3.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC833" + drEmployee.Field<string>("Station")
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT4")
|
||||
{
|
||||
stringQueueSerial_4.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC833" + drEmployee.Field<string>("Station")
|
||||
});
|
||||
}
|
||||
}
|
||||
machines_info = 2;
|
||||
log.Visibility = Visibility.Collapsed;
|
||||
rdp.Visibility = Visibility.Collapsed;
|
||||
@@ -498,11 +544,49 @@ 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.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("SYSKEY") + dat_821.ToJsonString()
|
||||
});
|
||||
if (drEmployee.Field<bool>("Type"))
|
||||
{//网络
|
||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("SYSKEY") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
else
|
||||
{//串口
|
||||
if (drEmployee.Field<string>("Serial") == "PORT1")
|
||||
{
|
||||
stringQueueSerial_1.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT2")
|
||||
{
|
||||
stringQueueSerial_2.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT3")
|
||||
{
|
||||
stringQueueSerial_3.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT4")
|
||||
{
|
||||
stringQueueSerial_4.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Insert.IsHitTestVisible = false;
|
||||
edit.IsHitTestVisible = false;
|
||||
@@ -521,11 +605,49 @@ 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.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("SYSKEY") + dat_821.ToJsonString()
|
||||
});
|
||||
if (drEmployee.Field<bool>("Type"))
|
||||
{//网络
|
||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("SYSKEY") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
else
|
||||
{//串口
|
||||
if (drEmployee.Field<string>("Serial") == "PORT1")
|
||||
{
|
||||
stringQueueSerial_1.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT2")
|
||||
{
|
||||
stringQueueSerial_2.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT3")
|
||||
{
|
||||
stringQueueSerial_3.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT4")
|
||||
{
|
||||
stringQueueSerial_4.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Insert.IsHitTestVisible = true;
|
||||
edit.IsHitTestVisible = true;
|
||||
@@ -545,11 +667,49 @@ 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.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("SYSKEY") + dat_821.ToJsonString()
|
||||
});
|
||||
if (drEmployee.Field<bool>("Type"))
|
||||
{//网络
|
||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("SYSKEY") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
else
|
||||
{//串口
|
||||
if (drEmployee.Field<string>("Serial") == "PORT1")
|
||||
{
|
||||
stringQueueSerial_1.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT2")
|
||||
{
|
||||
stringQueueSerial_2.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT3")
|
||||
{
|
||||
stringQueueSerial_3.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT4")
|
||||
{
|
||||
stringQueueSerial_4.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}//停止
|
||||
private void ListViewItem_edit(object sender, MouseButtonEventArgs e)
|
||||
@@ -607,11 +767,49 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
|
||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
||||
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("SYSKEY") + dat_821.ToJsonString()
|
||||
});
|
||||
if (drEmployee.Field<bool>("Type"))
|
||||
{//网络
|
||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("SYSKEY") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
else
|
||||
{//串口
|
||||
if (drEmployee.Field<string>("Serial") == "PORT1")
|
||||
{
|
||||
stringQueueSerial_1.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT2")
|
||||
{
|
||||
stringQueueSerial_2.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT3")
|
||||
{
|
||||
stringQueueSerial_3.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT4")
|
||||
{
|
||||
stringQueueSerial_4.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
}
|
||||
TechnologicalProcess_bool = true;
|
||||
}
|
||||
private void ListViewItem_Jump(object sender, MouseButtonEventArgs e)
|
||||
@@ -635,11 +833,49 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
|
||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
||||
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("SYSKEY") + dat_821.ToJsonString()
|
||||
});
|
||||
if (drEmployee.Field<bool>("Type"))
|
||||
{//网络
|
||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("SYSKEY") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
else
|
||||
{//串口
|
||||
if (drEmployee.Field<string>("Serial") == "PORT1")
|
||||
{
|
||||
stringQueueSerial_1.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT2")
|
||||
{
|
||||
stringQueueSerial_2.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT3")
|
||||
{
|
||||
stringQueueSerial_3.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT4")
|
||||
{
|
||||
stringQueueSerial_4.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
TechnologicalProcess_bool = true;
|
||||
}//跳步
|
||||
@@ -698,11 +934,49 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
|
||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
||||
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("SYSKEY") + dat_821.ToJsonString()
|
||||
});
|
||||
if (drEmployee.Field<bool>("Type"))
|
||||
{//网络
|
||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("SYSKEY") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
else
|
||||
{//串口
|
||||
if (drEmployee.Field<string>("Serial") == "PORT1")
|
||||
{
|
||||
stringQueueSerial_1.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT2")
|
||||
{
|
||||
stringQueueSerial_2.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT3")
|
||||
{
|
||||
stringQueueSerial_3.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT4")
|
||||
{
|
||||
stringQueueSerial_4.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
private void ListViewItem_Delete(object sender, MouseButtonEventArgs e)
|
||||
@@ -715,11 +989,49 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
dat_821.Add("ID", ID);
|
||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
||||
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("SYSKEY") + dat_821.ToJsonString()
|
||||
});
|
||||
if (drEmployee.Field<bool>("Type"))
|
||||
{//网络
|
||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("SYSKEY") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
else
|
||||
{//串口
|
||||
if (drEmployee.Field<string>("Serial") == "PORT1")
|
||||
{
|
||||
stringQueueSerial_1.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT2")
|
||||
{
|
||||
stringQueueSerial_2.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT3")
|
||||
{
|
||||
stringQueueSerial_3.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT4")
|
||||
{
|
||||
stringQueueSerial_4.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
MainWindowViewModel.dt_TP.Select("Step="+ID).First().Delete();
|
||||
MainWindowViewModel.dt_TP.AcceptChanges();
|
||||
@@ -762,6 +1074,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
}
|
||||
}
|
||||
private void MenuItem_Delete(object sender, RoutedEventArgs e)//右键删除
|
||||
|
||||
{
|
||||
int rownum = Gridstep.SelectedIndex;//获取鼠标选中行并定义变量
|
||||
if (rownum != -1)//判断鼠标定位是否有效
|
||||
@@ -775,11 +1088,49 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
dat_821.Add("ID", ID);
|
||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
||||
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("SYSKEY") + dat_821.ToJsonString()
|
||||
});
|
||||
if (drEmployee.Field<bool>("Type"))
|
||||
{//网络
|
||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("SYSKEY") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
else
|
||||
{//串口
|
||||
if (drEmployee.Field<string>("Serial") == "PORT1")
|
||||
{
|
||||
stringQueueSerial_1.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT2")
|
||||
{
|
||||
stringQueueSerial_2.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT3")
|
||||
{
|
||||
stringQueueSerial_3.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
else if (drEmployee.Field<string>("Serial") == "PORT4")
|
||||
{
|
||||
stringQueueSerial_4.Enqueue(new QueueSerial
|
||||
{
|
||||
ID = index,
|
||||
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
MainWindowViewModel.dt_TP.Select("Step=" + ID).First().Delete();
|
||||
MainWindowViewModel.dt_TP.AcceptChanges();
|
||||
|
||||
Reference in new issue
Block a user