diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs index a934274..a9bc0cf 100644 --- a/MainWindow.xaml.cs +++ b/MainWindow.xaml.cs @@ -486,6 +486,10 @@ namespace formula_manage { 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, true); // PressKey.PressKeys(Keys.Up, false); @@ -505,27 +509,27 @@ namespace formula_manage private void CP_CONC_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)//目标饱和度输入事件 { double ang; - double conc; + double conc=0; System.Windows.Controls.TextBox curTextBox = sender as System.Windows.Controls.TextBox; - if (!double.TryParse(curTextBox.Text, out ang) && curTextBox.Text != "") - { - System.Windows.MessageBox.Show("错误,重新输入"); - curTextBox.Text = ""; - } - else + if (e.Key == Key.Enter) { - conc = double.Parse(curTextBox.Text); //转换后判断数值输入是否异常 - if (conc > 100) + if (!double.TryParse(curTextBox.Text, out ang)) { - System.Windows.MessageBox.Show("比例错误"); + System.Windows.MessageBox.Show("错误,重新输入"); curTextBox.Text = ""; - return; } - - if (e.Key == Key.Enter) + else { + if (curTextBox.Text != "") conc = double.Parse(curTextBox.Text); //转换后判断数值输入是否异常 + if (conc > 100) + { + System.Windows.MessageBox.Show("比例错误"); + curTextBox.Text = ""; + return; + } + PressKey.PressKeys(Keys.Left, false); PressKey.PressKeys(Keys.Left, true); PressKey.PressKeys(Keys.Tab, false); @@ -535,11 +539,13 @@ namespace formula_manage row = RRODUCTdataTable.NewRow(); ID_N++; row["ID"] = ID_N; + row["STEP"] = "1"; row["UNIT"] = "g"; // row["STEP"] = Procedures_P.Text; RRODUCTdataTable.Rows.Add(row); + + DataGridHelper.SetRealTimeCommit(Grid_RRODUCT, true); //实时更新datagrid } - DataGridHelper.SetRealTimeCommit(Grid_RRODUCT, true); //实时更新datagrid } } //目标饱和度输入事件 @@ -547,8 +553,14 @@ namespace formula_manage { System.Windows.Controls.ComboBox curComboBox = sender as System.Windows.Controls.ComboBox; 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(); + + } } } } diff --git a/ViewModel/MainWindowViewModel.cs b/ViewModel/MainWindowViewModel.cs index eef55c1..cc38112 100644 --- a/ViewModel/MainWindowViewModel.cs +++ b/ViewModel/MainWindowViewModel.cs @@ -95,7 +95,6 @@ namespace formula_manage.ViewModel Dissolve_data.Fill(DissolvedataTable); //Dissolve_data查询结果存入缓存 conn_SC.Close(); //关闭连接 - } catch (Exception) { @@ -113,6 +112,8 @@ namespace formula_manage.ViewModel mac_Machine = ToObservableCollection(MACHINEdataTable); flow_Workflow = ToObservableCollection(DissolvedataTable); + STUFFdatatemp = STUFFdataTable; + } public ObservableCollection stuff_Product { get; set; } //stuff_Product动态表实力化