diff --git a/Aucma.Core.BoxFoam/ViewModels/FoamMonitorPageViewModel.cs b/Aucma.Core.BoxFoam/ViewModels/FoamMonitorPageViewModel.cs
index 7b4ff3dc..ab464dfc 100644
--- a/Aucma.Core.BoxFoam/ViewModels/FoamMonitorPageViewModel.cs
+++ b/Aucma.Core.BoxFoam/ViewModels/FoamMonitorPageViewModel.cs
@@ -70,67 +70,73 @@ namespace Aucma.Core.BoxFoam.ViewModels
///
private Task InitEveryDayMethod()
{
- ProductionHourList = new List();
- List listTime = _baseBomInfoServices.getWorkTime().Result;
- foreach (WorkTime time in listTime)
+ App.Current.Dispatcher.BeginInvoke((Action)(() =>
{
- ProductionHourList.Add(time.hourTime);
- }
- // 货道列表
- List list = _boxFoamDataServices.QueryAsync(x=>x.ProductLineCode.Equals("CX_02") && x.StationCode=="1005").Result;
-
- ChartValues achievement = new ChartValues();
-
- #region 按时间统计
- achievement.Add(list.Sum(x => x.AnHour));
- achievement.Add(list.Sum(x => x.TwoHour));
- achievement.Add(list.Sum(x => x.ThreeHour));
- achievement.Add(list.Sum(x => x.FourHour));
- achievement.Add(list.Sum(x => x.FiveHour));
- achievement.Add(list.Sum(x => x.SixHour));
- achievement.Add(list.Sum(x => x.SevenHour));
- achievement.Add(list.Sum(x => x.EightHour));
- achievement.Add(list.Sum(x => x.NineHour));
- achievement.Add(list.Sum(x => x.TenHour));
- achievement.Add(list.Sum(x => x.ElevenHour));
- achievement.Add(list.Sum(x => x.TwelveHour));
- var column = new ColumnSeries();
- column.DataLabels = true;
- column.Title = "当日小时产量统计";
- column.Values = achievement;
- column.Foreground = Brushes.White;
-
- Achievement.Add(column);
-
- #endregion
-
-
-
- #region 按类型统计
- MaterialNameList = new List();
- ChartValues achievement2 = new ChartValues();
- //foreach(BoxFoamData space in list)
- //{
- // MaterialNameList.Add(space.Fixtureboxtype);
- //}
- var grouped = list.GroupBy(x => x.Fixtureboxtype);
- foreach (var item in grouped)
- {
- var flattenedList = item.SelectMany(p => new[] { p.AnHour, p.TwoHour, p.ThreeHour, p.FourHour, p.FiveHour, p.SixHour, p.SevenHour, p.EightHour, p.NineHour, p.TenHour, p.ElevenHour, p.TwelveHour }).ToList();
+
+ ModelStatistics.Clear();
- MaterialNameList.Add(item.Key);
- achievement2.Add(flattenedList.Sum());
- }
- var column2 = new ColumnSeries();
- column2.DataLabels = true;
- column2.Title = "当日型号产量统计";
- column2.Values = achievement2;
- column2.Foreground = Brushes.White;
- ModelStatistics.Add(column2);
+ ProductionHourList = new List();
+ List listTime = _baseBomInfoServices.getWorkTime().Result;
+ ProductionHourList.Clear();
+ foreach (WorkTime time in listTime)
+ {
+ ProductionHourList.Add(time.hourTime);
+ }
+ // 货道列表
+ List list = _boxFoamDataServices.QueryAsync(x => x.ProductLineCode.Equals("CX_02") && x.StationCode == "1005").Result;
-
- #endregion
+ ChartValues achievement = new ChartValues();
+
+ #region 按时间统计
+ achievement.Add(list.Sum(x => x.AnHour));
+ achievement.Add(list.Sum(x => x.TwoHour));
+ achievement.Add(list.Sum(x => x.ThreeHour));
+ achievement.Add(list.Sum(x => x.FourHour));
+ achievement.Add(list.Sum(x => x.FiveHour));
+ achievement.Add(list.Sum(x => x.SixHour));
+ achievement.Add(list.Sum(x => x.SevenHour));
+ achievement.Add(list.Sum(x => x.EightHour));
+ achievement.Add(list.Sum(x => x.NineHour));
+ achievement.Add(list.Sum(x => x.TenHour));
+ achievement.Add(list.Sum(x => x.ElevenHour));
+ achievement.Add(list.Sum(x => x.TwelveHour));
+ var column = new ColumnSeries();
+ column.DataLabels = true;
+ column.Title = "当日小时产量统计";
+ column.Values = achievement;
+ column.Foreground = Brushes.White;
+ Achievement.Clear();
+ Achievement.Add(column);
+
+ #endregion
+
+
+
+ #region 按类型统计
+ MaterialNameList = new List();
+ ChartValues achievement2 = new ChartValues();
+ MaterialNameList.Clear();
+ var grouped = list.GroupBy(x => x.Fixtureboxtype);
+ foreach (var item in grouped)
+ {
+ var flattenedList = item.SelectMany(p => new[] { p.AnHour, p.TwoHour, p.ThreeHour, p.FourHour, p.FiveHour, p.SixHour, p.SevenHour, p.EightHour, p.NineHour, p.TenHour, p.ElevenHour, p.TwelveHour }).ToList();
+ MaterialNameList.Add(item.Key);
+ achievement2.Add(flattenedList.Sum());
+ }
+ var column2 = new ColumnSeries();
+ column2.DataLabels = true;
+ column2.Title = "当日型号产量统计";
+ column2.Values = achievement2;
+ column2.Foreground = Brushes.White;
+ ModelStatistics.Clear();
+ ModelStatistics.Add(column2);
+
+
+ #endregion
+
+ }));
+
//await InitExecMethod();
return Task.CompletedTask;
@@ -335,7 +341,8 @@ namespace Aucma.Core.BoxFoam.ViewModels
public async void RealTimeFoamingTask(object? sender, ElapsedEventArgs e)
{
semaphore.WaitOne();
-
+ //刷新统计图表
+ InitEveryDayMethod();
try
{
string productLineCode = Appsettings.app("StationInfo", "ProductLineCode");