忱 沈 4 years ago
parent
commit
e1615e2add
  1. 4
      View/QueryView.xaml
  2. 48
      View/QueryView.xaml.cs

4
View/QueryView.xaml

@ -86,8 +86,8 @@
<TextBox x:Name="Dyelots_Machine" HorizontalAlignment="Left" Height="30" Margin="200,0,0,50" VerticalAlignment="Bottom" Width="115" FontSize="16" MaxLines="1" MaxLength="9"/> <TextBox x:Name="Dyelots_Machine" HorizontalAlignment="Left" Height="30" Margin="200,0,0,50" VerticalAlignment="Bottom" Width="115" FontSize="16" MaxLines="1" MaxLength="9"/>
<TextBox x:Name="Dyelots_CreationTime" HorizontalAlignment="Left" Height="30" Margin="450,0,0,50" VerticalAlignment="Bottom" Width="225" FontSize="16" IsReadOnly="True" MaxLines="1"/> <TextBox x:Name="Dyelots_CreationTime" HorizontalAlignment="Left" Height="30" Margin="450,0,0,50" VerticalAlignment="Bottom" Width="225" FontSize="16" IsReadOnly="True" MaxLines="1"/>
<TextBox x:Name="Dyelots_ReDye" HorizontalAlignment="Left" Height="30" Margin="65,0,0,50" VerticalAlignment="Bottom" Width="80" FontSize="16" IsReadOnly="True" MaxLines="1"/> <TextBox x:Name="Dyelots_ReDye" HorizontalAlignment="Left" Height="30" Margin="65,0,0,50" VerticalAlignment="Bottom" Width="80" FontSize="16" IsReadOnly="True" MaxLines="1"/>
<DatePicker x:Name="query_date_start" HorizontalAlignment="Left" Height="30" Margin="450,0,0,100" VerticalAlignment="Bottom" Width="225" FontSize="16"/> <DatePicker x:Name="query_date_start" HorizontalAlignment="Left" Height="30" Margin="450,0,0,100" VerticalAlignment="Bottom" Width="225" FontSize="16" Cursor="No" SelectedDateFormat="Short"/>
<DatePicker x:Name="query_date_end" HorizontalAlignment="Left" Height="30" Margin="715,0,0,100" VerticalAlignment="Bottom" Width="225" FontSize="16"/> <DatePicker x:Name="query_date_end" HorizontalAlignment="Left" Height="30" Margin="715,0,0,100" VerticalAlignment="Bottom" Width="225" FontSize="16" Cursor="No" SelectedDateFormat="Short"/>
<TextBlock HorizontalAlignment="Left" Height="30" Margin="15,0,0,100" TextWrapping="Wrap" Text="工单" VerticalAlignment="Bottom" Width="45" FontSize="20"/> <TextBlock HorizontalAlignment="Left" Height="30" Margin="15,0,0,100" TextWrapping="Wrap" Text="工单" VerticalAlignment="Bottom" Width="45" FontSize="20"/>
<TextBlock HorizontalAlignment="Left" Height="30" Margin="15,0,0,50" TextWrapping="Wrap" Text="重染" VerticalAlignment="Bottom" Width="45" FontSize="20"/> <TextBlock HorizontalAlignment="Left" Height="30" Margin="15,0,0,50" TextWrapping="Wrap" Text="重染" VerticalAlignment="Bottom" Width="45" FontSize="20"/>
<TextBlock HorizontalAlignment="Left" Height="30" Margin="155,0,0,50" TextWrapping="Wrap" Text="染机" VerticalAlignment="Bottom" Width="45" FontSize="20"/> <TextBlock HorizontalAlignment="Left" Height="30" Margin="155,0,0,50" TextWrapping="Wrap" Text="染机" VerticalAlignment="Bottom" Width="45" FontSize="20"/>

48
View/QueryView.xaml.cs

@ -30,40 +30,40 @@ namespace Audit.View
private void Button_Click(object sender, RoutedEventArgs e)//确认按钮事件 private void Button_Click(object sender, RoutedEventArgs e)//确认按钮事件
{ {
string DataGridDyelots_Button = this.Dyelots_Dyelot.Text;//定义工单输入框 string DataGridDyelots_Button = this.Dyelots_Dyelot.Text;//传递工单输入框
string DataGridMachine_Button = this.Dyelots_Machine.Text;//定义机台输入框 string DataGridMachine_Button = this.Dyelots_Machine.Text;//传递机台输入框
DateTime query_start = DateTime.Parse(query_date_start);//定义并转换开始时间 string query_start = this.query_date_start.Text;//传递开始时间
DateTime query_end = DateTime.Parse(query_date_end);//定义并转换结束时间 string query_end = this.query_date_end.Text;//传递结束时间
int query_DateTime = DateTime.Compare(query_end,query_start); int query_TimeCompare = DateTime.Compare(Convert.ToDateTime(query_start), Convert.ToDateTime(query_end)); //比较开始结束时间,小于-1 等于0 大于1
if (query_date_start != null && query_date_end != null)//判断查询时间 if (string.IsNullOrWhiteSpace(DataGridDyelots_Button))//工单为空进入下一步判断
{ {
if (query_DateTime <= 0)//查询时间是否有效 if (string.IsNullOrWhiteSpace(query_start) && string.IsNullOrWhiteSpace(query_end))//判断查询时间是否存在
{ {
MessageBox.Show("SC:无效查询信息");//返回无效信息弹窗
}
else
{
MessageBox.Show("SC:请输入有效查询时间");//返回弹窗
}
}
else
{
if ((DataGridDyelots_Button == null) && (DataGridMachine_Button != null))//优先以工单查询
{
} }
else else
{ {
if ((DataGridDyelots_Button != null) && (DataGridMachine_Button == null))//以机台查询 if (query_TimeCompare == 1)//判断查询时间是否有效,等于1无效
{ {
MessageBox.Show("SC:无效查询时间");//返回无效时间弹窗
} }
else else
{ {
MessageBox.Show("SC:请输入有效查询信息");//返回弹窗 if (string.IsNullOrWhiteSpace(DataGridMachine_Button))//查询时间及机台
{
MessageBox.Show("SC:查询时间");
}
else
{
MessageBox.Show("SC:查询机台");
}
} }
} }
} }
else
{
MessageBox.Show("SC:查询工单");//有单号查询
}
} }
private void DataGrid_Detailed(object sender, SelectionChangedEventArgs e) private void DataGrid_Detailed(object sender, SelectionChangedEventArgs e)

Loading…
Cancel
Save