sc 2 years ago
parent
commit
741704c8aa
  1. 2
      MainWindow.xaml
  2. 36
      MainWindow.xaml.cs

2
MainWindow.xaml

@ -72,7 +72,7 @@
<ComboBox x:Name="Forms_" HorizontalAlignment="Left" Height="30" Margin="38,175,0,0" VerticalAlignment="Top" Width="105" FontSize="20" IsTabStop="True" Grid.Column="1"/> <ComboBox x:Name="Forms_" HorizontalAlignment="Left" Height="30" Margin="38,175,0,0" VerticalAlignment="Top" Width="105" FontSize="20" IsTabStop="True" Grid.Column="1"/>
<TextBox x:Name="Number" HorizontalAlignment="Left" Height="30" Margin="95,35,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="200" FontSize="20" KeyUp="SearchBox_OnKeyDownd" Grid.ColumnSpan="2"/> <TextBox x:Name="Number" HorizontalAlignment="Left" Height="30" Margin="95,35,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="200" FontSize="20" KeyUp="SearchBox_OnKeyDownd" Grid.ColumnSpan="2"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="95,70,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="200" FontSize="20" KeyUp="SearchBox_OnKeyDownd" IsTabStop="False" Grid.ColumnSpan="2"/> <TextBox HorizontalAlignment="Left" Height="30" Margin="95,70,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="200" FontSize="20" KeyUp="SearchBox_OnKeyDownd" IsTabStop="False" Grid.ColumnSpan="2"/>
<TextBox x:Name="Anew" HorizontalAlignment="Left" Height="30" Margin="38,35,0,0" TextWrapping="Wrap" Text="0" VerticalAlignment="Top" Width="30" FontSize="20" <TextBox x:Name="ReDye" HorizontalAlignment="Left" Height="30" Margin="38,35,0,0" TextWrapping="Wrap" Text="0" VerticalAlignment="Top" Width="30" FontSize="20"
MaxLines="1" MaxLength="2" PreviewTextInput="Tb_KeyPress" InputMethod.IsInputMethodEnabled="False" Focusable ="False" Grid.Column="1"/> MaxLines="1" MaxLength="2" PreviewTextInput="Tb_KeyPress" InputMethod.IsInputMethodEnabled="False" Focusable ="False" Grid.Column="1"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="95,105,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="200" FontSize="20" KeyUp="SearchBox_OnKeyDownd" IsTabStop="False" Grid.ColumnSpan="2"/> <TextBox HorizontalAlignment="Left" Height="30" Margin="95,105,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="200" FontSize="20" KeyUp="SearchBox_OnKeyDownd" IsTabStop="False" Grid.ColumnSpan="2"/>
<ComboBox x:Name="Machine" DisplayMemberPath="Name" <ComboBox x:Name="Machine" DisplayMemberPath="Name"

36
MainWindow.xaml.cs

@ -359,8 +359,42 @@ namespace formula_manage
{ {
} }
private void save(object sender, RoutedEventArgs e) //保存按钮 private async void save(object sender, RoutedEventArgs e) //保存按钮
{ {
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 =="") if (Machine.Text =="")
{ {
System.Windows.MessageBox.Show("请选择机台", "注意",MessageBoxButton.OK , MessageBoxImage.Question) ; System.Windows.MessageBox.Show("请选择机台", "注意",MessageBoxButton.OK , MessageBoxImage.Question) ;

Loading…
Cancel
Save