sc 2 years ago
parent
commit
1d6e6816f3
  1. 26
      MainWindow.xaml.cs
  2. 3
      ViewModel/MainWindowViewModel.cs

26
MainWindow.xaml.cs

@ -486,6 +486,10 @@ namespace formula_manage
{ {
if (e.Key == Key.Enter) if (e.Key == Key.Enter)
{ {
System.Windows.Controls.ComboBox curComboBox = sender as System.Windows.Controls.ComboBox;
string a = curComboBox.Text;
if (a == "") return;
PressKey.PressKeys(Keys.Right, false); PressKey.PressKeys(Keys.Right, false);
PressKey.PressKeys(Keys.Right, true); PressKey.PressKeys(Keys.Right, true);
// PressKey.PressKeys(Keys.Up, false); // PressKey.PressKeys(Keys.Up, false);
@ -505,18 +509,20 @@ namespace formula_manage
private void CP_CONC_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)//目标饱和度输入事件 private void CP_CONC_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)//目标饱和度输入事件
{ {
double ang; double ang;
double conc; double conc=0;
System.Windows.Controls.TextBox curTextBox = sender as System.Windows.Controls.TextBox; System.Windows.Controls.TextBox curTextBox = sender as System.Windows.Controls.TextBox;
if (!double.TryParse(curTextBox.Text, out ang) && curTextBox.Text != "") if (e.Key == Key.Enter)
{
if (!double.TryParse(curTextBox.Text, out ang))
{ {
System.Windows.MessageBox.Show("错误,重新输入"); System.Windows.MessageBox.Show("错误,重新输入");
curTextBox.Text = ""; curTextBox.Text = "";
} }
else else
{ {
conc = double.Parse(curTextBox.Text); //转换后判断数值输入是否异常 if (curTextBox.Text != "") conc = double.Parse(curTextBox.Text); //转换后判断数值输入是否异常
if (conc > 100) if (conc > 100)
{ {
System.Windows.MessageBox.Show("比例错误"); System.Windows.MessageBox.Show("比例错误");
@ -524,8 +530,6 @@ namespace formula_manage
return; return;
} }
if (e.Key == Key.Enter)
{
PressKey.PressKeys(Keys.Left, false); PressKey.PressKeys(Keys.Left, false);
PressKey.PressKeys(Keys.Left, true); PressKey.PressKeys(Keys.Left, true);
PressKey.PressKeys(Keys.Tab, false); PressKey.PressKeys(Keys.Tab, false);
@ -535,20 +539,28 @@ namespace formula_manage
row = RRODUCTdataTable.NewRow(); row = RRODUCTdataTable.NewRow();
ID_N++; ID_N++;
row["ID"] = ID_N; row["ID"] = ID_N;
row["STEP"] = "1";
row["UNIT"] = "g"; row["UNIT"] = "g";
// row["STEP"] = Procedures_P.Text; // row["STEP"] = Procedures_P.Text;
RRODUCTdataTable.Rows.Add(row); RRODUCTdataTable.Rows.Add(row);
}
DataGridHelper.SetRealTimeCommit(Grid_RRODUCT, true); //实时更新datagrid DataGridHelper.SetRealTimeCommit(Grid_RRODUCT, true); //实时更新datagrid
} }
}
} //目标饱和度输入事件 } //目标饱和度输入事件
private void CP_PRODUCT_CODE_LostFocus(object sender, RoutedEventArgs e) private void CP_PRODUCT_CODE_LostFocus(object sender, RoutedEventArgs e)
{ {
System.Windows.Controls.ComboBox curComboBox = sender as System.Windows.Controls.ComboBox; System.Windows.Controls.ComboBox curComboBox = sender as System.Windows.Controls.ComboBox;
string a = curComboBox.Text; string a = curComboBox.Text;
MainWindowViewModel.STUFFdatatemp.Select("ProductCode ='"+ a +"'");
DataTable data = null;
if (a != "")
{
data = MainWindowViewModel.STUFFdatatemp.Select("ProductCode ='" + a + "'").CopyToDataTable();
//Grid_RRODUCT.ItemsSource = data.Columns.//Add("ProductName").ToString();
}
} }
} }
} }

3
ViewModel/MainWindowViewModel.cs

@ -95,7 +95,6 @@ namespace formula_manage.ViewModel
Dissolve_data.Fill(DissolvedataTable); //Dissolve_data查询结果存入缓存 Dissolve_data.Fill(DissolvedataTable); //Dissolve_data查询结果存入缓存
conn_SC.Close(); //关闭连接 conn_SC.Close(); //关闭连接
} }
catch (Exception) catch (Exception)
{ {
@ -113,6 +112,8 @@ namespace formula_manage.ViewModel
mac_Machine = ToObservableCollection<Machine>(MACHINEdataTable); mac_Machine = ToObservableCollection<Machine>(MACHINEdataTable);
flow_Workflow = ToObservableCollection<Workflow>(DissolvedataTable); flow_Workflow = ToObservableCollection<Workflow>(DissolvedataTable);
STUFFdatatemp = STUFFdataTable;
} }
public ObservableCollection<Product> stuff_Product { get; set; } //stuff_Product动态表实力化 public ObservableCollection<Product> stuff_Product { get; set; } //stuff_Product动态表实力化

Loading…
Cancel
Save