Browse Source

配方列表编辑

master
sc 2 years ago
parent
commit
c120a2164f
  1. 52
      MainWindow.xaml.cs

52
MainWindow.xaml.cs

@ -451,6 +451,7 @@ namespace formula_manage
} }
} }
string Code_;
string Name_; string Name_;
string Type_; string Type_;
string Conc_; string Conc_;
@ -462,7 +463,7 @@ namespace formula_manage
if (e.Key == Key.Enter) if (e.Key == Key.Enter)
{ {
System.Windows.Controls.ComboBox curComboBox = sender as System.Windows.Controls.ComboBox; System.Windows.Controls.ComboBox curComboBox = sender as System.Windows.Controls.ComboBox;
string Code_ = curComboBox.Text; Code_ = curComboBox.Text;
if (Code_ == "") return; if (Code_ == "") return;
DataRow[] r = MainWindowViewModel.STUFFdatatemp.Select("ProductCode ='" + Code_ + "'"); DataRow[] r = MainWindowViewModel.STUFFdatatemp.Select("ProductCode ='" + Code_ + "'");
@ -474,8 +475,6 @@ namespace formula_manage
return; return;
} }
Name_ = r[0].ItemArray[1].ToString(); Name_ = r[0].ItemArray[1].ToString();
Type_ = r[0].ItemArray[2].ToString(); Type_ = r[0].ItemArray[2].ToString();
Conc_ = r[0].ItemArray[3].ToString(); Conc_ = r[0].ItemArray[3].ToString();
@ -485,10 +484,33 @@ namespace formula_manage
Weight_ = double.Parse(list_Weight.Text) * double.Parse(Conc_) / 100; Weight_ = double.Parse(list_Weight.Text) * double.Parse(Conc_) / 100;
} }
if ((Type_ == "0") || (Type_ == "3")) Type_ = "%"; if ((Type_ == "0") || (Type_ == "3"))
if ((Type_ == "1") || (Type_ == "2")) Type_ = "g/L"; {
Type_ = "%";
if (double.TryParse(list_Weight.Text, out ang))
{
Weight_ = double.Parse(list_Weight.Text) * double.Parse(Conc_) *10;
}
else
{
System.Windows.MessageBox.Show("请先确认重量及浴比");
return;
}
}
if ((Type_ == "1") || (Type_ == "2"))
{
Type_ = "g/L";
//RRODUCTdataTable.Load(r.ElementAt(1).ToString()); if (double.TryParse(list_Total.Text, out ang))
{
Weight_ = double.Parse(list_Total.Text) * double.Parse(Conc_) / 100;
}
else
{
System.Windows.MessageBox.Show("请先确认重量及浴比");
return;
}
}
DataRow row = RRODUCTdataTable.Rows[ID_N-1]; //ID列 DataRow row = RRODUCTdataTable.Rows[ID_N-1]; //ID列
row.BeginEdit(); row.BeginEdit();
@ -530,19 +552,27 @@ namespace formula_manage
curTextBox.Text = ""; curTextBox.Text = "";
return; return;
} }
Weight_ = Weight_* conc;
DataRow row = RRODUCTdataTable.Rows[ID_N - 1]; //ID列
row.BeginEdit();
row["TARGET_WT"] = Weight_;
row.EndEdit();
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);
PressKey.PressKeys(Keys.Tab, true); PressKey.PressKeys(Keys.Tab, true);
DataRow row = RRODUCTdataTable.NewRow(); //ID列 DataRow rowadd = RRODUCTdataTable.NewRow(); //ID列
row = RRODUCTdataTable.NewRow(); rowadd = RRODUCTdataTable.NewRow();
ID_N++; ID_N++;
row["ID"] = ID_N; rowadd["ID"] = ID_N;
// row["STEP"] = "1"; // row["STEP"] = "1";
row["UNIT"] = "g"; rowadd["UNIT"] = "g";
// row["STEP"] = Procedures_P.Text; // row["STEP"] = Procedures_P.Text;
RRODUCTdataTable.Rows.Add(row); RRODUCTdataTable.Rows.Add(rowadd);
DataGridHelper.SetRealTimeCommit(Grid_RRODUCT, true); //实时更新datagrid DataGridHelper.SetRealTimeCommit(Grid_RRODUCT, true); //实时更新datagrid
} }

Loading…
Cancel
Save