liuwf 1 year ago
parent 886b7785d6
commit 771cf621f8

@ -70,14 +70,20 @@ namespace Aucma.Core.BoxFoam.ViewModels
/// <returns></returns> /// <returns></returns>
private Task InitEveryDayMethod() private Task InitEveryDayMethod()
{ {
App.Current.Dispatcher.BeginInvoke((Action)(() =>
{
ModelStatistics.Clear();
ProductionHourList = new List<string>(); ProductionHourList = new List<string>();
List<WorkTime> listTime = _baseBomInfoServices.getWorkTime().Result; List<WorkTime> listTime = _baseBomInfoServices.getWorkTime().Result;
ProductionHourList.Clear();
foreach (WorkTime time in listTime) foreach (WorkTime time in listTime)
{ {
ProductionHourList.Add(time.hourTime); ProductionHourList.Add(time.hourTime);
} }
// 货道列表 // 货道列表
List<BoxFoamData> list = _boxFoamDataServices.QueryAsync(x=>x.ProductLineCode.Equals("CX_02") && x.StationCode=="1005").Result; List<BoxFoamData> list = _boxFoamDataServices.QueryAsync(x => x.ProductLineCode.Equals("CX_02") && x.StationCode == "1005").Result;
ChartValues<double> achievement = new ChartValues<double>(); ChartValues<double> achievement = new ChartValues<double>();
@ -99,7 +105,7 @@ namespace Aucma.Core.BoxFoam.ViewModels
column.Title = "当日小时产量统计"; column.Title = "当日小时产量统计";
column.Values = achievement; column.Values = achievement;
column.Foreground = Brushes.White; column.Foreground = Brushes.White;
Achievement.Clear();
Achievement.Add(column); Achievement.Add(column);
#endregion #endregion
@ -109,10 +115,7 @@ namespace Aucma.Core.BoxFoam.ViewModels
#region 按类型统计 #region 按类型统计
MaterialNameList = new List<string>(); MaterialNameList = new List<string>();
ChartValues<int> achievement2 = new ChartValues<int>(); ChartValues<int> achievement2 = new ChartValues<int>();
//foreach(BoxFoamData space in list) MaterialNameList.Clear();
//{
// MaterialNameList.Add(space.Fixtureboxtype);
//}
var grouped = list.GroupBy(x => x.Fixtureboxtype); var grouped = list.GroupBy(x => x.Fixtureboxtype);
foreach (var item in grouped) foreach (var item in grouped)
{ {
@ -126,11 +129,14 @@ namespace Aucma.Core.BoxFoam.ViewModels
column2.Title = "当日型号产量统计"; column2.Title = "当日型号产量统计";
column2.Values = achievement2; column2.Values = achievement2;
column2.Foreground = Brushes.White; column2.Foreground = Brushes.White;
ModelStatistics.Clear();
ModelStatistics.Add(column2); ModelStatistics.Add(column2);
#endregion #endregion
}));
//await InitExecMethod(); //await InitExecMethod();
return Task.CompletedTask; return Task.CompletedTask;
@ -335,7 +341,8 @@ namespace Aucma.Core.BoxFoam.ViewModels
public async void RealTimeFoamingTask(object? sender, ElapsedEventArgs e) public async void RealTimeFoamingTask(object? sender, ElapsedEventArgs e)
{ {
semaphore.WaitOne(); semaphore.WaitOne();
//刷新统计图表
InitEveryDayMethod();
try try
{ {
string productLineCode = Appsettings.app("StationInfo", "ProductLineCode"); string productLineCode = Appsettings.app("StationInfo", "ProductLineCode");

Loading…
Cancel
Save