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