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.

96 lines
3.1 KiB

using Audit.View;
using GalaSoft.MvvmLight;
using Models;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Threading;
namespace Audit.ViewModel
{
///<Summary>
/// QueryViewModel
///</Summary>
public class QueryViewModel : ViewModelBase
{
private List<Dyelots> dyelots = new List<Dyelots>();
private List<DyelotsBulkedRecipe> dyelotsBulkedRecipe = new List<DyelotsBulkedRecipe>();
/// <summary>
/// 所有工单
/// </summary>
public List<Dyelots> Dyelots
{
get
{
return dyelots;
}
set
{
dyelots = value;
RaisePropertyChanged();
}
}
/// <summary>
/// DyelotsBulkedRecipe
/// </summary>
public List<DyelotsBulkedRecipe> DyelotsBulkedRecipe
{
get
{
return dyelotsBulkedRecipe;
}
set
{
dyelotsBulkedRecipe = value;
RaisePropertyChanged();
}
}
/// <summary>
///
/// </summary>
public QueryViewModel()
{
// dyelots = new DyelotsProvider().Select();//显示单号
// dyelotsBulkedRecipe = new DyelotsBulkedRecipeProvider().Select();//显示明显
DispatcherTimer timer = new DispatcherTimer//初始化循环,每0.5秒调用一次Tick_Event
{
Interval = TimeSpan.FromSeconds(0.1)
};
timer.Tick += Tick_Event;
timer.Start();
}
void Tick_Event(object sender, EventArgs e)//Tick_Event周期执行事件
{
if (QueryView.sqlButton_Click == 10)
{
Dyelots = new DyelotsProvider().Select();//显示单号
QueryView.sqlButton_Click = 0;
}
if (QueryView.sqlButton_Click == 2)
{
DyelotsBulkedRecipe = new DyelotsBulkedRecipeProvider().Selectsql(QueryView.DyelotsBulkedRecipe_Button);//根据单号查询明细
QueryView.sqlButton_Click = 0;
}
if (QueryView.sqlButton_Click == 1)
{
DyelotsBulkedRecipe = new DyelotsBulkedRecipeProvider().Selectsql(QueryView.DyelotsBulkedRecipe_Button);//根据单号查询明细
Dyelots = new DyelotsProvider().Selectsql(QueryView.Dyelots_Button);//根据单号查询头
QueryView.sqlButton_Click = 0;
}
if (QueryView.sqlButton_Click == 3)
{
Dyelots = new DyelotsProvider().Selecttime(QueryView.Dyelots_Button);//根据单号查询头
QueryView.sqlButton_Click = 0;
}
if (QueryView.sqlButton_Click == 4)
{
Dyelots = new DyelotsProvider().SelectMachine(QueryView.Dyelots_Button);//根据单号查询头
QueryView.sqlButton_Click = 0;
}
}
}
}