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.
121 lines
6.3 KiB
121 lines
6.3 KiB
using Models;
|
|
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();
|
|
this.DataGridDyelots.LoadingRow += new EventHandler<DataGridRowEventArgs>(this.DataGridEquipment_LoadingRow);//生成序列号
|
|
}
|
|
|
|
/// <summary>
|
|
/// 生成序列号的方法
|
|
/// </summary>
|
|
private void DataGridEquipment_LoadingRow(object sender, DataGridRowEventArgs e)
|
|
{
|
|
e.Row.Header = e.Row.GetIndex() + 1;
|
|
}
|
|
|
|
public static string query_start = null;//全局变量开始时间
|
|
public static string query_end = null;//全局变量结束时间
|
|
private void UserControl_Loaded(object sender, RoutedEventArgs e)//打开页面执行
|
|
{
|
|
this.query_date_start.Text = DateTime.Now.ToString("yyyy-MM-dd");//填入当天时间
|
|
this.query_date_end.Text = DateTime.Now.ToString("yyyy-MM-dd");//填入当天时间
|
|
}
|
|
|
|
//public static string Dyelots_Button = null;
|
|
public static int sqlButton_Click=10;
|
|
public static Dyelots Dyelots_Button = new Dyelots();
|
|
public static DyelotsBulkedRecipe DyelotsBulkedRecipe_Button = new DyelotsBulkedRecipe();
|
|
private void Button_Click(object sender, RoutedEventArgs e)//确认按钮事件
|
|
{
|
|
string DataGridDyelots_Button = this.Dyelots_Dyelot.Text;//传递工单输入框
|
|
string DataGridMachine_Button = this.Dyelots_Machine.Text;//传递机台输入框
|
|
query_start = this.query_date_start.Text;//传递开始时间
|
|
query_end = this.query_date_end.Text;//传递结束时间
|
|
if (string.IsNullOrWhiteSpace(DataGridDyelots_Button))//工单为空进入下一步判断
|
|
{
|
|
if (string.IsNullOrWhiteSpace(query_start) && string.IsNullOrWhiteSpace(query_end))//判断查询时间是否存在
|
|
{
|
|
sqlButton_Click = 0;
|
|
}
|
|
else
|
|
{
|
|
string t =DateTime.Now.ToString("yyyy-MM-dd");
|
|
int query_endT = DateTime.Compare(Convert.ToDateTime(query_end), Convert.ToDateTime(t)); //比较结束时间及当期,小于-1 等于0 大于1
|
|
if(query_endT == 0) query_end = DateTime.Now.AddDays(1).ToString("yyyy-MM-dd"); //如果结束时间为空则填入当天时间加1天
|
|
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))//查询机台
|
|
{
|
|
Dyelots_Button.StartTime = Convert.ToDateTime(query_start);
|
|
Dyelots_Button.EndTime = Convert.ToDateTime(query_end);
|
|
sqlButton_Click = 3;//传递按钮信息以时间查询
|
|
}
|
|
else
|
|
{
|
|
Dyelots_Button.StartTime = Convert.ToDateTime(query_start);
|
|
Dyelots_Button.EndTime = Convert.ToDateTime(query_end);
|
|
Dyelots_Button.Machine = DataGridMachine_Button;
|
|
sqlButton_Click = 4;//传递按钮信息以时间机台查询
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
DyelotsBulkedRecipe_Button.Dyelot = DataGridDyelots_Button;//传递单号
|
|
Dyelots_Button.Dyelot = DataGridDyelots_Button;//传递单号
|
|
sqlButton_Click = 1;//发生按钮状态单号查询
|
|
}
|
|
}
|
|
|
|
private void DataGridDyelot_MouseDoubleClick(object sender, MouseButtonEventArgs e)// DataGridDyelot表格双击事件
|
|
{
|
|
int rownum = this.DataGridDyelots.SelectedIndex;//获取鼠标选中行并定义变量
|
|
if (rownum != -1)
|
|
{
|
|
string DataGridDyelots_value = (DataGridDyelots.Columns[1].GetCellContent(DataGridDyelots.Items[rownum]) as TextBlock).Text;//定位第0列选中行单元格,单号
|
|
string DataGridReDye_value = (DataGridDyelots.Columns[2].GetCellContent(DataGridDyelots.Items[rownum]) as TextBlock).Text;//定位第1列选中行单元格,重染
|
|
string DataGridMachine_value = (DataGridDyelots.Columns[3].GetCellContent(DataGridDyelots.Items[rownum]) as TextBlock).Text;//定位第2列选中行单元格,机台
|
|
string DataGridCreationTime_value = (DataGridDyelots.Columns[4].GetCellContent(DataGridDyelots.Items[rownum]) as TextBlock).Text;//定位第3列选中行单元格,开单时间
|
|
Dyelots_Dyelot.Text = DataGridDyelots_value.ToString();//获取工单单元格字符串填入工单输入框
|
|
Dyelots_ReDye.Text = DataGridReDye_value.ToString(); //获取重染单元格字符串填入重染框
|
|
Dyelots_Machine.Text = DataGridMachine_value.ToString();//获取机台单元格字符串填入机台输入框
|
|
Dyelots_CreationTime.Text = DataGridCreationTime_value.ToString();//获取开单时间单元格字符串填入开单时间框
|
|
DyelotsBulkedRecipe_Button.Dyelot = DataGridDyelots_value;//传递工单信息至sql实例
|
|
sqlButton_Click = 2;//传递按钮信息以查询
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|