|
|
|
@ -359,9 +359,43 @@ namespace formula_manage |
|
|
|
{ |
|
|
|
} |
|
|
|
|
|
|
|
private void save(object sender, RoutedEventArgs e) //保存按钮
|
|
|
|
private async void save(object sender, RoutedEventArgs e) //保存按钮
|
|
|
|
{ |
|
|
|
if(Machine.Text =="") |
|
|
|
|
|
|
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); |
|
|
|
string DYELOTS_sql = "SELECT count(*) FROM [Dispensing].[dbo].[DYELOTS_RECIPE] WHERE Dyelot = '" + Number.Text + "' and ReDye = '" + ReDye.Text + "'";//单号查询语句
|
|
|
|
try |
|
|
|
{ |
|
|
|
await conn_SC.OpenAsync(); //打开数据连接
|
|
|
|
SqlDataAdapter DYELOTS_data = new SqlDataAdapter(DYELOTS_sql, Connstr_SC); //查询
|
|
|
|
conn_SC.Close(); //关闭连接
|
|
|
|
DataTable ds = new DataTable(); |
|
|
|
DYELOTS_data.Fill(ds); |
|
|
|
if (ds.Rows[0][0].ToString() != "0") |
|
|
|
{ |
|
|
|
MessageBoxResult result = System.Windows.MessageBox.Show("当前料单已经存在是否重染", "注意", MessageBoxButton.OKCancel, MessageBoxImage.Question, MessageBoxResult.Cancel); |
|
|
|
if (result == MessageBoxResult.OK) |
|
|
|
{ |
|
|
|
ReDye.Text = (int.Parse(ReDye.Text) + 1).ToString(); |
|
|
|
System.Windows.MessageBox.Show("重染已经变更请再次保存", "注意"); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (result == MessageBoxResult.Cancel) |
|
|
|
{ |
|
|
|
System.Windows.MessageBox.Show("请使用新单号保存", "注意"); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (result == MessageBoxResult.None) return; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
catch (Exception) |
|
|
|
{ |
|
|
|
System.Windows.MessageBox.Show("数据访问失败,重试"); |
|
|
|
return; |
|
|
|
} //单号重复检查
|
|
|
|
|
|
|
|
if (Machine.Text =="") |
|
|
|
{ |
|
|
|
System.Windows.MessageBox.Show("请选择机台", "注意",MessageBoxButton.OK , MessageBoxImage.Question) ; |
|
|
|
return; |
|
|
|
|