修改重复原料判断逻辑
This commit is contained in:
commit
7c3d3ecf3a
1 file changed
+12
-9
+12
-9
@@ -650,6 +650,7 @@ namespace formula_manage
|
||||
{
|
||||
System.Windows.Controls.ComboBox curComboBox = sender as System.Windows.Controls.ComboBox;
|
||||
int grid_row = Grid_RRODUCT.SelectedIndex; //获取当前行
|
||||
if (grid_row == -1) grid_row = 0;
|
||||
|
||||
Code_ = curComboBox.Text;
|
||||
if (Code_ == "")
|
||||
@@ -657,8 +658,9 @@ namespace formula_manage
|
||||
if (Procedures_N.Text == Procedures_P.Text)
|
||||
{
|
||||
MessageBoxResult P = System.Windows.MessageBox.Show("是否保存", "确认", MessageBoxButton.OKCancel, MessageBoxImage.Exclamation); //提示
|
||||
if (P == MessageBoxResult.Cancel) { }
|
||||
return;
|
||||
if (P == MessageBoxResult.Cancel) return;
|
||||
if (P == MessageBoxResult.OK) Save.Focus();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -680,8 +682,8 @@ namespace formula_manage
|
||||
curComboBox.Text = "";
|
||||
return;
|
||||
}
|
||||
|
||||
DataRow[] c = RRODUCTdataTable.Select("PRODUCT_CODE ='" + Code_ + "'");//查询判断原料代码是否重复
|
||||
int ID_ = grid_row + 1;
|
||||
DataRow[] c = RRODUCTdataTable.Select("PRODUCT_CODE ='" + Code_ + "'and ID <> '" + ID_ + "'");//查询判断原料代码是否重复
|
||||
if (c.Any())
|
||||
{
|
||||
System.Windows.MessageBox.Show("重复原料");
|
||||
@@ -725,7 +727,6 @@ namespace formula_manage
|
||||
}
|
||||
}
|
||||
|
||||
if (grid_row == -1) grid_row = 0;
|
||||
DataRow row = RRODUCTdataTable.Rows[grid_row]; //ID列
|
||||
row.BeginEdit();
|
||||
row["PRODUCT_CODE"] = Code_;
|
||||
@@ -748,11 +749,12 @@ namespace formula_manage
|
||||
PressKey.PressKeys(Keys.Tab, false);
|
||||
PressKey.PressKeys(Keys.Tab, true);
|
||||
}
|
||||
}
|
||||
|
||||
Save.IsEnabled = false;
|
||||
Confirm.IsEnabled = false;
|
||||
DataGridHelper.SetRealTimeCommit(Grid_RRODUCT, true); //实时更新datagrid
|
||||
}
|
||||
}
|
||||
private void CP_CONC_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)//目标饱和度输入事件
|
||||
{
|
||||
double ang;
|
||||
@@ -823,8 +825,8 @@ namespace formula_manage
|
||||
if (Procedures_N.Text == Procedures_P.Text)
|
||||
{
|
||||
MessageBoxResult P = System.Windows.MessageBox.Show("是否保存", "确认", MessageBoxButton.OKCancel, MessageBoxImage.Exclamation); //提示
|
||||
if (P == MessageBoxResult.Cancel) { }
|
||||
return;
|
||||
if (P == MessageBoxResult.Cancel) return;
|
||||
if (P == MessageBoxResult.OK) Save.Focus(); //聚焦到保存按钮
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -847,7 +849,8 @@ namespace formula_manage
|
||||
return;
|
||||
}
|
||||
|
||||
DataRow[] c = RRODUCTdataTable.Select("PRODUCT_CODE ='" + Code_ + "'");//查询判断原料代码是否重复
|
||||
int ID_ = grid_row + 1;
|
||||
DataRow[] c = RRODUCTdataTable.Select("PRODUCT_CODE ='" + Code_ + "'and ID <> '" + ID_ + "'");//查询判断原料代码是否重复
|
||||
if (c.Any())
|
||||
{
|
||||
System.Windows.MessageBox.Show("重复原料");
|
||||
|
||||
Reference in new issue
Block a user