diff --git a/MECF.Framework.UI.Client/CenterViews/DataLogs/ProcessHistory/ProcessHistorySqlHelp.cs b/MECF.Framework.UI.Client/CenterViews/DataLogs/ProcessHistory/ProcessHistorySqlHelp.cs index 6845be9..036f887 100644 --- a/MECF.Framework.UI.Client/CenterViews/DataLogs/ProcessHistory/ProcessHistorySqlHelp.cs +++ b/MECF.Framework.UI.Client/CenterViews/DataLogs/ProcessHistory/ProcessHistorySqlHelp.cs @@ -5,6 +5,7 @@ using MECF.Framework.Common.Equipment; using Sicentury.Core; using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Data; using System.Linq; using System.Text; @@ -92,17 +93,17 @@ namespace MECF.Framework.UI.Client.CenterViews.DataLogs.ProcessHistory return processHistoryDataList; } - + //************************************************单步时硬件数据结果查询******************************************************************* - + /// - /// 查询气体体积数据 + /// 拆分的天循查询数据 /// /// 拆分的天 /// PM名称 /// 显示列表对象 /// - public static List GetProcessHistoryDeviceData(IEnumerable daySlices, string moduleName, List processHistoryItemList) + public static ObservableCollection GetProcessHistoryDeviceData(IEnumerable daySlices, string moduleName, List processHistoryItemList) { List dataTableList =new List(); @@ -110,9 +111,9 @@ namespace MECF.Framework.UI.Client.CenterViews.DataLogs.ProcessHistory { dataTableList.Add(GetProcessHistoryDeviceDataListDaySlices(daySlice, moduleName, processHistoryItemList));//拆分后,每次查询结果放入集合中 } - - List processHistoryDeviceDataList = new List(); + + ObservableCollection processHistoryDeviceDataList = new ObservableCollection(); foreach (var item in processHistoryItemList) { diff --git a/MECF.Framework.UI.Client/CenterViews/DataLogs/ProcessHistory/ProcessHistoryTestView.xaml b/MECF.Framework.UI.Client/CenterViews/DataLogs/ProcessHistory/ProcessHistoryTestView.xaml index 647dc53..261d4a2 100644 --- a/MECF.Framework.UI.Client/CenterViews/DataLogs/ProcessHistory/ProcessHistoryTestView.xaml +++ b/MECF.Framework.UI.Client/CenterViews/DataLogs/ProcessHistory/ProcessHistoryTestView.xaml @@ -11,7 +11,8 @@ xmlns:userControls="clr-namespace:MECF.Framework.UI.Client.CenterViews.Core.UserControls" xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" d:DesignHeight="800" - d:DesignWidth="1500" + d:DesignWidth="1900" + FontSize="14" mc:Ignorable="d"> @@ -20,13 +21,13 @@ - - + - + - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/MECF.Framework.UI.Client/CenterViews/DataLogs/ProcessHistory/ProcessHistoryTestViewModel.cs b/MECF.Framework.UI.Client/CenterViews/DataLogs/ProcessHistory/ProcessHistoryTestViewModel.cs index 031e56f..6e3444e 100644 --- a/MECF.Framework.UI.Client/CenterViews/DataLogs/ProcessHistory/ProcessHistoryTestViewModel.cs +++ b/MECF.Framework.UI.Client/CenterViews/DataLogs/ProcessHistory/ProcessHistoryTestViewModel.cs @@ -9,6 +9,8 @@ using MECF.Framework.UI.Client.ClientBase; using SciChart.Charting.Model.DataSeries; using SciChart.Charting.Visuals.Axes; using SciChart.Charting.Visuals.RenderableSeries; +using SciChart.Core.Extensions; +using SciChart.Core.Framework; using SciChart.Data.Model; using Sicentury.Core; using Sicentury.Core.EventArgs; @@ -62,11 +64,29 @@ namespace MECF.Framework.UI.Client.CenterViews.DataLogs.ProcessHistory public ProcessHistoryData SelectProcessHistoryData { get; set; } - public List ProcessHistoryDeviceDataList { get; set; } + private ObservableCollection _processHistoryDeviceDataList; + public ObservableCollection ProcessHistoryDeviceDataList + { + get => _processHistoryDeviceDataList; + set + { + _processHistoryDeviceDataList = value; + NotifyOfPropertyChange(nameof(ProcessHistoryDeviceDataList)); + } + } public ProcessHistoryDeviceData SelectProcessHistoryDeviceData { get; set; } - public ObservableCollection appendedSeries { get; set; } + private ObservableCollection appendedSeries; + public ObservableCollection AppendedSeries + { + get => appendedSeries; + set + { + appendedSeries = value; + NotifyOfPropertyChange(nameof(AppendedSeries)); + } + } private ProcessHistoryItemsDefault ProcessHistoryItemsDefault = new ProcessHistoryItemsDefault(); @@ -77,7 +97,6 @@ namespace MECF.Framework.UI.Client.CenterViews.DataLogs.ProcessHistory IniUIData(); } - /// /// 查询进度信息更新。 /// @@ -96,64 +115,9 @@ namespace MECF.Framework.UI.Client.CenterViews.DataLogs.ProcessHistory StartDateTime = DateTime.Now.Date; EndDateTime = DateTime.Now.Date.AddDays(1).AddTicks(-1); - - VisibleRangeTime = new DateRange(DateTime.Now.AddMinutes(-60), DateTime.Now.AddMinutes(60)); VisibleRangeValue = new DoubleRange(0, 10); - - - //_progQueryUpdate = new Progress(e => - //{ - // if (e.CurrentProgress == e.TotalProgress) - // { - - - // foreach (var renderableSeries in SelectProcessHistoryDeviceData) - // { - // var series = renderableSeries as SicFastLineSeries; - // var dataSeries = series?.GetDataSeries(); - - // try - // { - // if (series != null && dataSeries != null) - // { - // var node = series.BackendParameterNode; - - // if (double.IsInfinity((double)dataSeries.YRange.Diff)) - // { - // node.ClearStatistic(); - // } - // else - // { - // var min = ((double)dataSeries.YMin); - // var max = ((double)dataSeries.YMax); - // var average = - // dataSeries.Metadata.Cast().Average(x => x.Value); - - // node.SetStatistic(min, max, average); - // } - // } - - // } - // catch (Exception ex) - // { - // var err = $"It's failed to load data of {series?.DataName ?? "Unknown"}, {ex.Message}"; - // LOG.Error(err, ex); - // } - // } - - - // ChartAutoRange = AutoRange.Never; - // ((ProcessHistoryTestView)View).chart.ZoomExtents(); - - // } - - - //}); - - - - + Refresh(); } @@ -184,8 +148,11 @@ namespace MECF.Framework.UI.Client.CenterViews.DataLogs.ProcessHistory RecipeProcessHistoryData = dialog.RecipeProcessHistoryData; ProcessHistoryDataList = ProcessHistorySqlHelp.QueryProcessHistoryData(dialog.RecipeProcessHistoryData.ProcessGuid, dialog.RecipeProcessHistoryData.Name); + ProcessHistoryDeviceDataList?.Clear(); Refresh(); } + + } public void DoubleClickItem() @@ -208,22 +175,6 @@ namespace MECF.Framework.UI.Client.CenterViews.DataLogs.ProcessHistory ProcessHistoryDeviceDataList = ProcessHistorySqlHelp.GetProcessHistoryDeviceData(daySlices, CbSelect, ProcessHistoryItemsDefault.ItemList); - ////解析数据库返回的数据 - //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, "")); } public void GetItem() @@ -269,16 +220,9 @@ namespace MECF.Framework.UI.Client.CenterViews.DataLogs.ProcessHistory public void GetDeviceCharting() { + AppendedSeries = new ObservableCollection { SelectProcessHistoryDeviceData.GetLineSeries() }; - - var v= SelectProcessHistoryDeviceData.ToList(); - - appendedSeries = new ObservableCollection { SelectProcessHistoryDeviceData.Append() }; - - - ChartAutoRange = AutoRange.Always; - var dataSeries = appendedSeries[0].DataSeries as XyDataSeries; - + var dataSeries = AppendedSeries[0].DataSeries as XyDataSeries; var dateList = new List(); var valueList = new List(); var metaList = new List(); @@ -289,31 +233,16 @@ namespace MECF.Framework.UI.Client.CenterViews.DataLogs.ProcessHistory var date = new DateTime(long.Parse(SelectProcessHistoryDeviceData.TimeStamp[i])); var cellValue = SelectProcessHistoryDeviceData.DeviceValue[i]; - dateList.Add(date); valueList.Add(cellValue); - metaList.Add(new ParameterNodePoint(date, cellValue)); - - - + metaList.Add(new ParameterNodePoint(date, cellValue)); } dataSeries.Append(dateList, valueList, metaList); - VisibleRangeTime = dataSeries.XRange; - VisibleRangeValue= dataSeries.YRange; - //SelectedData = dataSeries.YRange; - //_progQueryUpdate.Report(new ProgressUpdatingEventArgs(100, 100, "")); - - //var appendedSeries = SelectProcessHistoryDeviceData.ToList(); - - + + Thread.Sleep(10); ChartAutoRange = AutoRange.Never; ((ProcessHistoryTestView)View).chart.ZoomExtents(); - - - Thread.Sleep(100); - - Refresh(); } } } \ No newline at end of file diff --git a/MECF.Framework.UI.Client/CenterViews/DataLogs/ProcessHistory/RecipeProcessHistoryData.cs b/MECF.Framework.UI.Client/CenterViews/DataLogs/ProcessHistory/RecipeProcessHistoryData.cs index 9c6f6d8..47f6da5 100644 --- a/MECF.Framework.UI.Client/CenterViews/DataLogs/ProcessHistory/RecipeProcessHistoryData.cs +++ b/MECF.Framework.UI.Client/CenterViews/DataLogs/ProcessHistory/RecipeProcessHistoryData.cs @@ -9,6 +9,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Media; using SciChart.Data.Numerics; +using DrawingColor = System.Drawing.Color; namespace MECF.Framework.UI.Client.CenterViews.DataLogs.ProcessHistory { @@ -106,12 +107,12 @@ namespace MECF.Framework.UI.Client.CenterViews.DataLogs.ProcessHistory Max = DeviceValue.Count > 0 ? DeviceValue.Max(t => t) : 0; } - public IRenderableSeries Append() + public IRenderableSeries GetLineSeries() { Clear(); SicFastLineSeries sicFastLineSeries = new SicFastLineSeries(DeviceName) { - Foreground = new SolidColorBrush(Colors.Red), + Stroke = Colors.Red, AntiAliasing = true, ResamplingMode = ResamplingMode.MinMax, };