|
|
|
|
using Audit.View;
|
|
|
|
|
using GalaSoft.MvvmLight;
|
|
|
|
|
using Models;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Globalization;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Web.Services.Description;
|
|
|
|
|
using System.Windows.Controls;
|
|
|
|
|
using System.Windows.Data;
|
|
|
|
|
using System.Windows.Threading;
|
|
|
|
|
|
|
|
|
|
namespace Audit.ViewModel
|
|
|
|
|
{
|
|
|
|
|
///<Summary>
|
|
|
|
|
/// StatisticsViewModel
|
|
|
|
|
///</Summary>
|
|
|
|
|
public class StatisticsViewModel : ViewModelBase
|
|
|
|
|
{
|
|
|
|
|
private List<Product> products = new List<Product>();
|
|
|
|
|
private List<Machines> machiness = new List<Machines>();
|
|
|
|
|
private List<Dyelots> dyelotss = new List<Dyelots>();
|
|
|
|
|
|
|
|
|
|
public List<Product> Product
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return products;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
products = value;
|
|
|
|
|
RaisePropertyChanged();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<Machines> Machines
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return machiness;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
machiness = value;
|
|
|
|
|
RaisePropertyChanged();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<Dyelots> Dyelots
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return dyelotss;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
dyelotss = value;
|
|
|
|
|
RaisePropertyChanged();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public StatisticsViewModel()
|
|
|
|
|
{
|
|
|
|
|
// products = new ProductProvider().Select();
|
|
|
|
|
// machiness = new MachinesProvider().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 (StatisticsView.Button_sql == true)//获取按钮状态
|
|
|
|
|
{
|
|
|
|
|
if (StatisticsView.Buttontype_sql == -2)
|
|
|
|
|
{
|
|
|
|
|
Product = new ProductProvider().Select();
|
|
|
|
|
StatisticsView.Button_machines_sql = true;
|
|
|
|
|
}
|
|
|
|
|
if (StatisticsView.Buttontype_sql == -1) Product = new ProductProvider().Select();
|
|
|
|
|
if (StatisticsView.Buttontype_sql == 0) Product = new ProductProvider().Selects0();
|
|
|
|
|
if (StatisticsView.Buttontype_sql == 1) Product = new ProductProvider().Selects1();
|
|
|
|
|
if (StatisticsView.Buttontype_sql == 2) Product = new ProductProvider().Selects2();
|
|
|
|
|
if (StatisticsView.Buttontype_sql == 3) Product = new ProductProvider().Selects3();
|
|
|
|
|
StatisticsView.Button_sql = false;//清除按钮状态
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (StatisticsView.Button_machines_sql == true)
|
|
|
|
|
{
|
|
|
|
|
Machines = new MachinesProvider().Select();
|
|
|
|
|
StatisticsView.Button_machines_sql = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|