|
|
@ -131,6 +131,10 @@ namespace formula_manage |
|
|
{ |
|
|
{ |
|
|
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";User ID=" + TEXT_SQLUSER + ";Password=" + TEXT_SQLPASWOR; |
|
|
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";User ID=" + TEXT_SQLUSER + ";Password=" + TEXT_SQLPASWOR; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
list_Weight.Text = Configini.IniReadvalue("SOFTWARE_SET", "T4"); //自定义
|
|
|
|
|
|
list_Proportion.Text = Configini.IniReadvalue("SOFTWARE_SET", "T5"); //自定义
|
|
|
|
|
|
list_Total.Text =(double.Parse(list_Proportion.Text)* double.Parse(list_Weight.Text)).ToString(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private async void Permissions_() |
|
|
private async void Permissions_() |
|
|
@ -463,17 +467,44 @@ 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; |
|
|
|
|
|
int grid_row = Grid_RRODUCT.SelectedIndex; //获取当前行
|
|
|
|
|
|
|
|
|
Code_ = curComboBox.Text; |
|
|
Code_ = curComboBox.Text; |
|
|
if (Code_ == "") return; |
|
|
if (Code_ == "") |
|
|
|
|
|
{ |
|
|
|
|
|
if (Procedures_N.Text == Procedures_P.Text) |
|
|
|
|
|
{ |
|
|
|
|
|
MessageBoxResult P = System.Windows.MessageBox.Show("是否保存", "确认", MessageBoxButton.OKCancel, MessageBoxImage.Exclamation); //提示
|
|
|
|
|
|
if (P == MessageBoxResult.Cancel) { } |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
MessageBoxResult P = System.Windows.MessageBox.Show("是否进入下一步", "确认", MessageBoxButton.OKCancel, MessageBoxImage.Exclamation); //提示
|
|
|
|
|
|
if (P == MessageBoxResult.Cancel) return; |
|
|
|
|
|
|
|
|
|
|
|
Procedures_P.Text = (int.Parse(Procedures_P.Text) + 1).ToString(); |
|
|
|
|
|
PressKey.PressKeys(Keys.Tab, false); |
|
|
|
|
|
PressKey.PressKeys(Keys.Tab, true); |
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
DataRow[] r = MainWindowViewModel.STUFFdatatemp.Select("ProductCode ='" + Code_ + "'"); |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if (!r.Any()) |
|
|
DataRow[] r = MainWindowViewModel.STUFFdatatemp.Select("ProductCode ='" + Code_ + "'"); //查询判断原料代码是否有效
|
|
|
|
|
|
if (!r.Any()) //检查原料信息
|
|
|
{ |
|
|
{ |
|
|
System.Windows.MessageBox.Show("原料不存在"); |
|
|
System.Windows.MessageBox.Show("原料不存在"); |
|
|
curComboBox.Text = ""; |
|
|
curComboBox.Text = ""; |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
DataRow[] c = RRODUCTdataTable.Select("PRODUCT_CODE ='" + Code_ + "'");//查询判断原料代码是否重复
|
|
|
|
|
|
if (c.Any()) |
|
|
|
|
|
{ |
|
|
|
|
|
System.Windows.MessageBox.Show("重复原料"); |
|
|
|
|
|
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(); |
|
|
@ -512,21 +543,31 @@ namespace formula_manage |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
DataRow row = RRODUCTdataTable.Rows[ID_N-1]; //ID列
|
|
|
if (grid_row == -1) grid_row = 0; |
|
|
|
|
|
DataRow row = RRODUCTdataTable.Rows[grid_row]; //ID列
|
|
|
row.BeginEdit(); |
|
|
row.BeginEdit(); |
|
|
row["PRODUCT_CODE"] = Code_; |
|
|
row["PRODUCT_CODE"] = Code_; |
|
|
row["PRODUCT_NAME"] = Name_; |
|
|
row["PRODUCT_NAME"] = Name_; |
|
|
row["SHIFT"] = Type_; |
|
|
row["SHIFT"] = Type_; |
|
|
row.EndEdit(); |
|
|
row.EndEdit(); |
|
|
|
|
|
if (grid_row == (ID_N - 1)) |
|
|
|
|
|
{ |
|
|
PressKey.PressKeys(Keys.Right, false); |
|
|
PressKey.PressKeys(Keys.Right, false); |
|
|
PressKey.PressKeys(Keys.Right, true); |
|
|
PressKey.PressKeys(Keys.Right, true); |
|
|
PressKey.PressKeys(Keys.Tab, false); |
|
|
PressKey.PressKeys(Keys.Tab, false); |
|
|
PressKey.PressKeys(Keys.Tab, true); |
|
|
PressKey.PressKeys(Keys.Tab, true); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
PressKey.PressKeys(Keys.Right, false); |
|
|
|
|
|
PressKey.PressKeys(Keys.Right, true); |
|
|
|
|
|
PressKey.PressKeys(Keys.Up, false); |
|
|
|
|
|
PressKey.PressKeys(Keys.Up, true); |
|
|
|
|
|
PressKey.PressKeys(Keys.Tab, false); |
|
|
|
|
|
PressKey.PressKeys(Keys.Tab, true); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
DataGridHelper.SetRealTimeCommit(Grid_RRODUCT, true); //实时更新datagrid
|
|
|
DataGridHelper.SetRealTimeCommit(Grid_RRODUCT, true); //实时更新datagrid
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void CP_CONC_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)//目标饱和度输入事件
|
|
|
private void CP_CONC_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)//目标饱和度输入事件
|
|
|
@ -535,6 +576,7 @@ namespace formula_manage |
|
|
double conc=0; |
|
|
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; |
|
|
|
|
|
int grid_row = Grid_RRODUCT.SelectedIndex; //获取当前行
|
|
|
|
|
|
|
|
|
if (e.Key == Key.Enter) |
|
|
if (e.Key == Key.Enter) |
|
|
{ |
|
|
{ |
|
|
@ -542,6 +584,7 @@ namespace formula_manage |
|
|
{ |
|
|
{ |
|
|
System.Windows.MessageBox.Show("错误,重新输入"); |
|
|
System.Windows.MessageBox.Show("错误,重新输入"); |
|
|
curTextBox.Text = ""; |
|
|
curTextBox.Text = ""; |
|
|
|
|
|
return; |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
@ -552,45 +595,150 @@ namespace formula_manage |
|
|
curTextBox.Text = ""; |
|
|
curTextBox.Text = ""; |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
double Weight_t = Weight_ * conc; |
|
|
|
|
|
|
|
|
|
|
|
DataRow row = RRODUCTdataTable.Rows[grid_row]; //ID列
|
|
|
|
|
|
row.BeginEdit(); |
|
|
|
|
|
row["STEP"] = Procedures_P.Text; |
|
|
|
|
|
row["CONC"] = string.Format("{0:N6}", conc); |
|
|
|
|
|
row["TARGET_WT"] = string.Format("{0:N3}", Weight_t); |
|
|
|
|
|
row.EndEdit(); |
|
|
|
|
|
|
|
|
|
|
|
if (grid_row == (ID_N - 1)) |
|
|
|
|
|
{ |
|
|
|
|
|
PressKey.PressKeys(Keys.Left, false); |
|
|
|
|
|
PressKey.PressKeys(Keys.Left, true); |
|
|
|
|
|
PressKey.PressKeys(Keys.Tab, false); |
|
|
|
|
|
PressKey.PressKeys(Keys.Tab, true); |
|
|
|
|
|
|
|
|
|
|
|
DataRow rowadd = RRODUCTdataTable.NewRow(); //ID列
|
|
|
|
|
|
rowadd = RRODUCTdataTable.NewRow(); |
|
|
|
|
|
ID_N++; |
|
|
|
|
|
rowadd["ID"] = ID_N; |
|
|
|
|
|
// row["STEP"] = "1";
|
|
|
|
|
|
rowadd["UNIT"] = "g"; |
|
|
|
|
|
// row["STEP"] = Procedures_P.Text;
|
|
|
|
|
|
RRODUCTdataTable.Rows.Add(rowadd); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
DataGridHelper.SetRealTimeCommit(Grid_RRODUCT, true); //实时更新datagrid
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} //目标饱和度输入事件
|
|
|
|
|
|
|
|
|
Weight_ = Weight_* conc; |
|
|
private void CP_PRODUCT_CODE_DropDownClosed(object sender, EventArgs e)//原料代码选择事件
|
|
|
|
|
|
{ |
|
|
|
|
|
double ang; |
|
|
|
|
|
|
|
|
|
|
|
System.Windows.Controls.ComboBox curComboBox = sender as System.Windows.Controls.ComboBox; |
|
|
|
|
|
int grid_row = Grid_RRODUCT.SelectedIndex; //获取当前行
|
|
|
|
|
|
|
|
|
DataRow row = RRODUCTdataTable.Rows[ID_N - 1]; //ID列
|
|
|
Code_ = curComboBox.Text; |
|
|
row.BeginEdit(); |
|
|
if (Code_ == "") |
|
|
row["TARGET_WT"] = Weight_; |
|
|
{ |
|
|
row.EndEdit(); |
|
|
if (Procedures_N.Text == Procedures_P.Text) |
|
|
|
|
|
{ |
|
|
|
|
|
MessageBoxResult P = System.Windows.MessageBox.Show("是否保存", "确认", MessageBoxButton.OKCancel, MessageBoxImage.Exclamation); //提示
|
|
|
|
|
|
if (P == MessageBoxResult.Cancel) { } |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
MessageBoxResult P = System.Windows.MessageBox.Show("是否进入下一步", "确认", MessageBoxButton.OKCancel, MessageBoxImage.Exclamation); //提示
|
|
|
|
|
|
if (P == MessageBoxResult.Cancel) return; |
|
|
|
|
|
|
|
|
PressKey.PressKeys(Keys.Left, false); |
|
|
Procedures_P.Text = (int.Parse(Procedures_P.Text) + 1).ToString(); |
|
|
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); |
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
DataRow rowadd = RRODUCTdataTable.NewRow(); //ID列
|
|
|
} |
|
|
rowadd = RRODUCTdataTable.NewRow(); |
|
|
} |
|
|
ID_N++; |
|
|
|
|
|
rowadd["ID"] = ID_N; |
|
|
|
|
|
// row["STEP"] = "1";
|
|
|
|
|
|
rowadd["UNIT"] = "g"; |
|
|
|
|
|
// row["STEP"] = Procedures_P.Text;
|
|
|
|
|
|
RRODUCTdataTable.Rows.Add(rowadd); |
|
|
|
|
|
|
|
|
|
|
|
DataGridHelper.SetRealTimeCommit(Grid_RRODUCT, true); //实时更新datagrid
|
|
|
DataRow[] r = MainWindowViewModel.STUFFdatatemp.Select("ProductCode ='" + Code_ + "'"); //查询判断原料代码是否有效
|
|
|
|
|
|
if (!r.Any()) //检查原料信息
|
|
|
|
|
|
{ |
|
|
|
|
|
System.Windows.MessageBox.Show("原料不存在"); |
|
|
|
|
|
curComboBox.Text = ""; |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
DataRow[] c = RRODUCTdataTable.Select("PRODUCT_CODE ='" + Code_ + "'");//查询判断原料代码是否重复
|
|
|
|
|
|
if (c.Any()) |
|
|
|
|
|
{ |
|
|
|
|
|
System.Windows.MessageBox.Show("重复原料"); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Name_ = r[0].ItemArray[1].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"; |
|
|
|
|
|
|
|
|
private void CP_PRODUCT_CODE_LostFocus(object sender, RoutedEventArgs e) |
|
|
if (double.TryParse(list_Total.Text, out ang)) |
|
|
{ |
|
|
{ |
|
|
/* System.Windows.Controls.ComboBox curComboBox = sender as System.Windows.Controls.ComboBox; |
|
|
Weight_ = double.Parse(list_Total.Text) * double.Parse(Conc_) / 100; |
|
|
string a = curComboBox.Text; |
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
System.Windows.MessageBox.Show("请先确认重量及浴比"); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
DataTable data = null; |
|
|
if (grid_row == -1) grid_row = 0; |
|
|
if (a != "") |
|
|
DataRow row = RRODUCTdataTable.Rows[grid_row]; //ID列
|
|
|
|
|
|
row.BeginEdit(); |
|
|
|
|
|
row["PRODUCT_CODE"] = Code_; |
|
|
|
|
|
row["PRODUCT_NAME"] = Name_; |
|
|
|
|
|
row["SHIFT"] = Type_; |
|
|
|
|
|
row.EndEdit(); |
|
|
|
|
|
if (grid_row == (ID_N - 1)) |
|
|
|
|
|
{ |
|
|
|
|
|
PressKey.PressKeys(Keys.Right, false); |
|
|
|
|
|
PressKey.PressKeys(Keys.Right, true); |
|
|
|
|
|
PressKey.PressKeys(Keys.Tab, false); |
|
|
|
|
|
PressKey.PressKeys(Keys.Tab, true); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
{ |
|
|
{ |
|
|
data = MainWindowViewModel.STUFFdatatemp.Select("ProductCode ='" + a + "'").CopyToDataTable(); |
|
|
PressKey.PressKeys(Keys.Right, false); |
|
|
//Grid_RRODUCT.ItemsSource = data.Columns.//Add("ProductName").ToString();
|
|
|
PressKey.PressKeys(Keys.Right, true); |
|
|
|
|
|
PressKey.PressKeys(Keys.Up, false); |
|
|
|
|
|
PressKey.PressKeys(Keys.Up, true); |
|
|
|
|
|
PressKey.PressKeys(Keys.Tab, false); |
|
|
|
|
|
PressKey.PressKeys(Keys.Tab, true); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
DataGridHelper.SetRealTimeCommit(Grid_RRODUCT, true); //实时更新datagrid
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void CP_PRODUCT_NAME_DropDownClosed(object sender, EventArgs e)//原料名选择事件
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
}*/ |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|