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