You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 lines
4.0 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace Audit.View
{
/// <summary>
/// QueryView.xaml 的交互逻辑
/// </summary>
public partial class QueryView : UserControl
{
///<Summary>
/// QueryView
///</Summary>
public QueryView()
{
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)//确认按钮事件
{
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;//传递结束时间
if (string.IsNullOrWhiteSpace(DataGridDyelots_Button))//工单为空进入下一步判断
{
if (string.IsNullOrWhiteSpace(query_start) || string.IsNullOrWhiteSpace(query_end))//判断查询时间是否存在
{
MessageBox.Show("SC:无效查询信息");//返回无效信息弹窗
}
else
{
int query_TimeCompare = DateTime.Compare(Convert.ToDateTime(query_start), Convert.ToDateTime(query_end)); //比较开始结束时间,小于-1 等于0 大于1
if (query_TimeCompare == 1)//判断查询时间是否有效,等于1无效
{
MessageBox.Show("SC:无效查询时间");//返回无效时间弹窗
}
else
{
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_Directory(object sender, SelectionChangedEventArgs e)
{
}
private void DataGridDyelot_MouseDoubleClick(object sender, MouseButtonEventArgs e)// DataGridDyelot表格双击事件
{
int rownum = this.DataGridDyelots.SelectedIndex;//获取鼠标选中行并定义变量
string DataGridDyelots_value = (DataGridDyelots.Columns[0].GetCellContent(DataGridDyelots.Items[rownum]) as TextBlock).Text;//定位第0列选中行单元格,单号
string DataGridReDye_value = (DataGridDyelots.Columns[1].GetCellContent(DataGridDyelots.Items[rownum]) as TextBlock).Text;//定位第1列选中行单元格,重染
string DataGridMachine_value = (DataGridDyelots.Columns[2].GetCellContent(DataGridDyelots.Items[rownum]) as TextBlock).Text;//定位第2列选中行单元格,机台
Dyelots_Dyelot.Text = DataGridDyelots_value.ToString();//获取单元格变量填入工单输入框
Dyelots_ReDye.Text = DataGridReDye_value.ToString(); //获取单元格变量填入重染框
Dyelots_Machine.Text = DataGridMachine_value.ToString();//获取单元格变量填入机台输入框
if (string.IsNullOrWhiteSpace(DataGridDyelots_value))
{ }
else
{
}
}
}
}