From d6081be29c2376af3fa4a594233a448e441bea4d Mon Sep 17 00:00:00 2001 From: liuwf Date: Tue, 9 Jan 2024 15:49:21 +0800 Subject: [PATCH] =?UTF-8?q?change-=E9=97=A8=E4=BD=93=E5=8F=91=E6=B3=A1?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=88=B7=E6=96=B0=E9=97=AA=E7=83=81=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewModels/RealTimePageViewModel.cs | 30 ++++++++++++++++--- Aucma.Core.DoorFoam/Views/IndexPageView.xaml | 4 +-- .../Views/RealTimePageView.xaml | 2 +- 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/Aucma.Core.DoorFoam/ViewModels/RealTimePageViewModel.cs b/Aucma.Core.DoorFoam/ViewModels/RealTimePageViewModel.cs index 31bbd5c7..13d89fcc 100644 --- a/Aucma.Core.DoorFoam/ViewModels/RealTimePageViewModel.cs +++ b/Aucma.Core.DoorFoam/ViewModels/RealTimePageViewModel.cs @@ -26,6 +26,7 @@ using NPOI.SS.Formula.Functions; using Microsoft.Extensions.FileSystemGlobbing.Internal; using System.Text.RegularExpressions; using System.Windows.Controls; +using System.Threading; namespace Aucma.Core.DoorFoam.ViewModels { @@ -48,6 +49,16 @@ namespace Aucma.Core.DoorFoam.ViewModels MvCodeHelper.DoorReceiveCodeDelegateEvent += OnLoadPlanData; OnLoadPlanData("B24010181060282920001"); + + Task.Run(() => + { + Thread.Sleep(2000); + while(true) + { + InitEveryDayMethodAsync();//刷新型号统计图表 + Thread.Sleep(1000); + } + }); } /// /// 获取今天的数据 @@ -63,7 +74,7 @@ namespace Aucma.Core.DoorFoam.ViewModels App.Current.Dispatcher.BeginInvoke((Action)(() => { - ModelStatistics.Clear(); + // ModelStatistics.Clear(); if (info != null) { @@ -77,8 +88,7 @@ namespace Aucma.Core.DoorFoam.ViewModels MaterialNameList.Add(FormatMaterialType(groupItem.MaterialName)); } } - - ModelStatistics.Add(new ColumnSeries() + ColumnSeries column = new ColumnSeries() { DataLabels = true, Title = "型号", @@ -86,7 +96,19 @@ namespace Aucma.Core.DoorFoam.ViewModels Fill = new SolidColorBrush(Color.FromRgb(15, 209, 226)), Foreground = Brushes.White, FontSize = 18 - }); + }; + if (ModelStatistics.Count > 0) + { + for(int i = 0; i < achievement.Count; i++) + { + ModelStatistics.FirstOrDefault().Values[i] = achievement[i]; + } + } + else + { + ModelStatistics.Add(column); + } + })); diff --git a/Aucma.Core.DoorFoam/Views/IndexPageView.xaml b/Aucma.Core.DoorFoam/Views/IndexPageView.xaml index 2f504d16..e16da6ef 100644 --- a/Aucma.Core.DoorFoam/Views/IndexPageView.xaml +++ b/Aucma.Core.DoorFoam/Views/IndexPageView.xaml @@ -90,7 +90,7 @@ @@ -116,7 +116,7 @@ diff --git a/Aucma.Core.DoorFoam/Views/RealTimePageView.xaml b/Aucma.Core.DoorFoam/Views/RealTimePageView.xaml index 56294d26..219b3920 100644 --- a/Aucma.Core.DoorFoam/Views/RealTimePageView.xaml +++ b/Aucma.Core.DoorFoam/Views/RealTimePageView.xaml @@ -169,7 +169,7 @@ - +