123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Windows;
- using Aitex.Core.RT.Log;
- using Aitex.Sorter.Common;
- using MECF.Framework.Common.CommonData;
- using VirgoUI.Client.Models.Sys;
- using MECF.Framework.Common.DataCenter;
- using OpenSEMI.ClientBase;
- namespace VirgoUI.Client.Models.DataLog.WaferHistory
- {
- public class WaferHistoryViewModel : BaseModel
- {
- public DateTime BeginDate { get; set; }
- public DateTime UIBeginTime { get; set; }
- public DateTime EndDate { get; set; }
- public DateTime UIEndTime { get; set; }
- public ObservableCollection<HistoryProcessData> ProcessData { get; set; }
- public ObservableCollection<HistoryCarrierData> CarrierData { get; set; }
-
- public WaferHistoryViewModel()
- {
- this.DisplayName = "Wafer History";
- this.ProcessData = new ObservableCollection<HistoryProcessData>();
- this.CarrierData = new ObservableCollection<HistoryCarrierData>();
- var now = DateTime.Now;
- EndDate = now;
- BeginDate = now;
- UIBeginTime = new DateTime(now.Year, now.Month, now.Day, 0, 0, 0, 0);
- UIEndTime = new DateTime(now.Year, now.Month, now.Day, 23, 59, 59, 999);
- }
- public void Query()
- {
- this.UpdateProcessData(BeginTime, EndTime);
- this.UpdateCarrierData(BeginTime, EndTime);
- }
- public void UpdateProcessData(DateTime begin, DateTime end)
- {
- try
- {
- string sql = string.Format(
- "SELECT * FROM \"process_data\" where \"process_begin_time\" >= '{0}' and \"process_begin_time\" <= '{1}' order by \"process_begin_time\" ASC;",
- begin.ToString("yyyy/MM/dd HH:mm:ss.fff"), end.ToString("yyyy/MM/dd HH:mm:ss.fff"));
- List<HistoryProcessData> result = QueryDataClient.Instance.Service. QueryDBProcess(sql);
- Application.Current.Dispatcher.BeginInvoke(new Action(() =>
- {
- ProcessData = new ObservableCollection<HistoryProcessData>();
- if (result != null)
- {
- foreach (HistoryProcessData ev in result)
- {
- ProcessData.Add(ev);
- }
- }
- NotifyOfPropertyChange("ProcessData");
-
- }));
- }
- catch (Exception e)
- {
- LOG.Write(e);
- }
- }
- public void UpdateCarrierData(DateTime begin, DateTime end)
- {
- try
- {
- string sql = string.Format(
- "SELECT * FROM \"carrier_data\" where \"load_time\" >= '{0}' and \"load_time\" <= '{1}' order by \"load_time\" ASC;",
- begin.ToString("yyyy/MM/dd HH:mm:ss.fff"), end.ToString("yyyy/MM/dd HH:mm:ss.fff"));
- List<HistoryCarrierData> result = QueryDataClient.Instance.Service.QueryDBCarrier(sql);
- Application.Current.Dispatcher.BeginInvoke(new Action(() =>
- {
- CarrierData = new ObservableCollection<HistoryCarrierData>();
- if (result != null)
- {
- foreach (HistoryCarrierData ev in result)
- {
- CarrierData.Add(ev);
- }
- }
- NotifyOfPropertyChange("CarrierData");
-
- }));
- }
- catch (Exception e)
- {
- LOG.Write(e);
- }
- }
- private HistoryCarrierData selectedHistoryProcessData;
- public HistoryCarrierData SelectedHistoryProcessData
- {
- get { return this.selectedHistoryProcessData; }
- set
- {
- this.selectedHistoryProcessData = value;
- }
- }
- private HistoryCarrierData selectedHistoryCarrierData;
- public HistoryCarrierData SelectedHistoryCarrierData
- {
- get { return this.selectedHistoryCarrierData; }
- set
- {
- this.selectedHistoryCarrierData = value;
- }
- }
- private DateTime BeginTime
- {
- get
- {
- return new DateTime(BeginDate.Year, BeginDate.Month, BeginDate.Day,
- UIBeginTime.Hour, UIBeginTime.Minute, UIBeginTime.Second);
- }
- }
- private DateTime EndTime
- {
- get
- {
- return new DateTime(EndDate.Year, EndDate.Month, EndDate.Day,
- UIEndTime.Hour, UIEndTime.Minute, UIEndTime.Second, 999);
- }
- }
- }
- }
|