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-12-05 08:51:05 +08:00
|
|
|
|
using MECF.Framework.Common.Aitex.Core.Common.DeviceData;
|
|
|
|
|
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.GasFlow;
|
|
|
|
|
using Sicentury.Core.EventArgs;
|
|
|
|
|
using Sicentury.Core;
|
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; }
|
|
|
|
|
|
2023-12-05 08:51:05 +08:00
|
|
|
|
public List<ProcessHistoryDeviceData> ProcessHistoryDeviceDataList { get; set; }
|
|
|
|
|
|
|
|
|
|
public ProcessHistoryDeviceData SelectProcessHistoryDeviceData { get; set; }
|
|
|
|
|
|
|
|
|
|
private ProcessHistoryItemsDefault ProcessHistoryItemsDefault = new ProcessHistoryItemsDefault();
|
|
|
|
|
|
2023-12-01 15:18:22 +08:00
|
|
|
|
protected override void OnViewLoaded(object _view)
|
|
|
|
|
{
|
|
|
|
|
base.OnViewLoaded(_view);
|
|
|
|
|
View = (UserControl)_view;
|
|
|
|
|
IniUIData();
|
2023-12-05 08:51:05 +08:00
|
|
|
|
|
2023-12-01 15:18:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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()
|
|
|
|
|
{
|
2023-12-05 08:51:05 +08:00
|
|
|
|
|
|
|
|
|
Query(SelectProcessHistoryData);
|
|
|
|
|
|
|
|
|
|
Refresh();
|
2023-12-01 15:18:22 +08:00
|
|
|
|
}
|
|
|
|
|
public void QuerDeviceData()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
2023-12-05 08:51:05 +08:00
|
|
|
|
|
|
|
|
|
public void Query( ProcessHistoryData processHistoryData)
|
|
|
|
|
{
|
|
|
|
|
var daySlices = DateRangeHelper.SplitInToHours(new DateRangeHelper( Convert.ToDateTime( processHistoryData.StepBeginTime), Convert.ToDateTime(processHistoryData.StepEndTime)), 12);
|
|
|
|
|
List<List<GasFlowSum>> gasFlowRunVent = new List<List<GasFlowSum>>();
|
|
|
|
|
|
|
|
|
|
//按天查询数据库,单天返回数据类型为List<GasFlowSum>
|
2023-12-05 13:59:28 +08:00
|
|
|
|
|
|
|
|
|
ProcessHistoryDeviceDataList = ProcessHistorySqlHelp.GetProcessHistoryDeviceData(daySlices, CbSelect, ProcessHistoryItemsDefault.ItemList);
|
2023-12-05 08:51:05 +08:00
|
|
|
|
|
2023-12-05 13:59:28 +08:00
|
|
|
|
|
2023-12-05 08:51:05 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
////解析数据库返回的数据
|
|
|
|
|
//foreach (var items in gasFlowRunVent)
|
|
|
|
|
//{
|
|
|
|
|
// foreach (var item in items)
|
|
|
|
|
// {
|
|
|
|
|
// var gasFlowSum = dayGasFlowList.Where(obj => item.Name.Contains(obj.Name)).First();
|
|
|
|
|
// if (item.Name.Contains("Run"))
|
|
|
|
|
// gasFlowSum.RunVolume += item.Volume;
|
|
|
|
|
// else
|
|
|
|
|
// gasFlowSum.VentVolume += item.Volume;
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//使用公式转换单位
|
|
|
|
|
|
|
|
|
|
//_busyIndicatorContentExport.Report(new ProgressUpdatingEventArgs(100, 100, ""));
|
|
|
|
|
}
|
2023-11-30 13:42:06 +08:00
|
|
|
|
}
|
|
|
|
|
}
|