|
|
@ -738,7 +738,70 @@ namespace formula_manage |
|
|
|
|
|
|
|
|
private void CP_PRODUCT_NAME_DropDownClosed(object sender, EventArgs e)//原料名选择事件
|
|
|
private void CP_PRODUCT_NAME_DropDownClosed(object sender, EventArgs e)//原料名选择事件
|
|
|
{ |
|
|
{ |
|
|
|
|
|
double ang; |
|
|
|
|
|
|
|
|
|
|
|
System.Windows.Controls.ComboBox curComboBox = sender as System.Windows.Controls.ComboBox; |
|
|
|
|
|
int grid_row = Grid_RRODUCT.SelectedIndex; //获取当前行
|
|
|
|
|
|
|
|
|
|
|
|
if (curComboBox.Text != "") |
|
|
|
|
|
{ |
|
|
|
|
|
Name_ = curComboBox.Text; |
|
|
|
|
|
|
|
|
|
|
|
DataRow[] r = MainWindowViewModel.STUFFdatatemp.Select("ProductName ='" + Name_ + "'"); //查询判断原料代码是否有效
|
|
|
|
|
|
|
|
|
|
|
|
DataRow[] c = RRODUCTdataTable.Select("PRODUCT_NAME ='" + Name_ + "'");//查询判断原料代码是否重复
|
|
|
|
|
|
if (c.Any()) |
|
|
|
|
|
{ |
|
|
|
|
|
System.Windows.MessageBox.Show("重复原料"); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
Code_ = r[0].ItemArray[0].ToString(); |
|
|
|
|
|
Type_ = r[0].ItemArray[2].ToString(); |
|
|
|
|
|
Conc_ = r[0].ItemArray[3].ToString(); |
|
|
|
|
|
|
|
|
|
|
|
if (double.TryParse(list_Weight.Text, out ang)) |
|
|
|
|
|
{ |
|
|
|
|
|
Weight_ = double.Parse(list_Weight.Text) * double.Parse(Conc_) / 100; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ((Type_ == "0") || (Type_ == "3")) |
|
|
|
|
|
{ |
|
|
|
|
|
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"; |
|
|
|
|
|
|
|
|
|
|
|
if (double.TryParse(list_Total.Text, out ang)) |
|
|
|
|
|
{ |
|
|
|
|
|
Weight_ = double.Parse(list_Total.Text) * double.Parse(Conc_) / 100; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
System.Windows.MessageBox.Show("请先确认重量及浴比"); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (grid_row == -1) grid_row = 0; |
|
|
|
|
|
DataRow row = RRODUCTdataTable.Rows[grid_row]; //ID列
|
|
|
|
|
|
row.BeginEdit(); |
|
|
|
|
|
row["PRODUCT_CODE"] = Code_; |
|
|
|
|
|
row["PRODUCT_NAME"] = Name_; |
|
|
|
|
|
row["SHIFT"] = Type_; |
|
|
|
|
|
row.EndEdit(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|