2023-11-30 13:42:06 +08:00
|
|
|
|
using MECF.Framework.UI.Client.ClientBase;
|
2023-12-01 15:18:22 +08:00
|
|
|
|
using System.Windows.Controls;
|
2023-11-30 13:42:06 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
2023-12-01 15:18:22 +08:00
|
|
|
|
using MECF.Framework.UI.Client.TrayThickness.HistoryData;
|
|
|
|
|
using Caliburn.Micro;
|
|
|
|
|
using MECF.Framework.UI.Client.CenterViews.Editors.Recipe;
|
|
|
|
|
using System.Dynamic;
|
|
|
|
|
using System.Windows;
|
|
|
|
|
using MECF.Framework.Common.DataCenter;
|
|
|
|
|
using System.Reflection;
|
2023-11-30 13:42:06 +08:00
|
|
|
|
|
|
|
|
|
namespace MECF.Framework.UI.Client.CenterViews.DataLogs.ProcessHistory
|
|
|
|
|
{
|
|
|
|
|
public class ProcessHistoryTestViewModel : UiViewModelBase
|
|
|
|
|
{
|
2023-12-01 15:18:22 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 返回ViewModel绑定的视图对象。
|
|
|
|
|
/// </summary>
|
|
|
|
|
public UserControl View { get; private set; }
|
|
|
|
|
|
|
|
|
|
public DateTime StartDateTime
|
|
|
|
|
{
|
|
|
|
|
get => ((ProcessHistoryTestView)View).wfTimeFrom.Value;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
((ProcessHistoryTestView)View).wfTimeFrom.Value = value;
|
|
|
|
|
NotifyOfPropertyChange(nameof(StartDateTime));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public DateTime EndDateTime
|
|
|
|
|
{
|
|
|
|
|
get => ((ProcessHistoryTestView)View).wfTimeTo.Value;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
((ProcessHistoryTestView)View).wfTimeTo.Value = value;
|
|
|
|
|
NotifyOfPropertyChange(nameof(EndDateTime));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<string> PmList { get; set; }
|
|
|
|
|
|
|
|
|
|
public string CbSelect { get;set; }
|
|
|
|
|
|
|
|
|
|
public RecipeProcessHistoryData RecipeProcessHistoryData { get; set; }
|
|
|
|
|
|
|
|
|
|
public List<ProcessHistoryData> ProcessHistoryDataList { get;set; }
|
|
|
|
|
|
|
|
|
|
public ProcessHistoryData SelectProcessHistoryData { get;set; }
|
|
|
|
|
|
|
|
|
|
protected override void OnViewLoaded(object _view)
|
|
|
|
|
{
|
|
|
|
|
base.OnViewLoaded(_view);
|
|
|
|
|
View = (UserControl)_view;
|
|
|
|
|
IniUIData();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void IniUIData()
|
|
|
|
|
{
|
|
|
|
|
PmList = new List<string>();
|
|
|
|
|
for (int i = 1; i <= 2; i++)
|
|
|
|
|
{
|
|
|
|
|
if ((bool)QueryDataClient.Instance.Service.GetConfig($"PM.PM{i}.TMAEnable"))
|
|
|
|
|
PmList.Add($"PM{i}");
|
|
|
|
|
}
|
|
|
|
|
if (PmList.Count > 0)
|
|
|
|
|
CbSelect = PmList[0];
|
|
|
|
|
StartDateTime = DateTime.Now.Date;
|
|
|
|
|
EndDateTime = DateTime.Now.Date.AddDays(1).AddTicks(-1);
|
|
|
|
|
Refresh();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void QueryRecipeProcessHistory()
|
|
|
|
|
{
|
|
|
|
|
if (StartDateTime > EndDateTime)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("time range invalid, start time should be early than end time.", "Error",
|
|
|
|
|
MessageBoxButton.OK,
|
|
|
|
|
MessageBoxImage.Error);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var dialog = new ProcessHistoryInfMessageBoxViewModel(StartDateTime.ToString(), EndDateTime.ToString(), CbSelect);
|
|
|
|
|
var wm = new WindowManager();
|
|
|
|
|
|
|
|
|
|
dynamic settings = new ExpandoObject();
|
|
|
|
|
settings.WindowStartupLocation = WindowStartupLocation.CenterOwner;
|
|
|
|
|
settings.Title = "Recipe历史生产数据选择";
|
|
|
|
|
settings.ResizeMode = ResizeMode.NoResize;
|
|
|
|
|
settings.ShowInTaskbar = false;
|
|
|
|
|
|
|
|
|
|
var bret = wm.ShowDialog(dialog, null, settings);
|
|
|
|
|
if ((bool)bret)
|
|
|
|
|
{
|
|
|
|
|
if (dialog.RecipeProcessHistoryData == null)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
RecipeProcessHistoryData = dialog.RecipeProcessHistoryData;
|
|
|
|
|
ProcessHistoryDataList = ProcessHistorySqlHelp.QueryProcessHistoryData(dialog.RecipeProcessHistoryData.ProcessGuid, dialog.RecipeProcessHistoryData.Name);
|
|
|
|
|
Refresh();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void DoubleClickItem()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public void QuerDeviceData()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
2023-11-30 13:42:06 +08:00
|
|
|
|
}
|
|
|
|
|
}
|