liuwf 1 year ago
parent 886b7785d6
commit 771cf621f8

@ -70,67 +70,73 @@ namespace Aucma.Core.BoxFoam.ViewModels
/// <returns></returns> /// <returns></returns>
private Task InitEveryDayMethod() private Task InitEveryDayMethod()
{ {
ProductionHourList = new List<string>(); App.Current.Dispatcher.BeginInvoke((Action)(() =>
List<WorkTime> listTime = _baseBomInfoServices.getWorkTime().Result;
foreach (WorkTime time in listTime)
{ {
ProductionHourList.Add(time.hourTime);
} ModelStatistics.Clear();
// 货道列表
List<BoxFoamData> list = _boxFoamDataServices.QueryAsync(x=>x.ProductLineCode.Equals("CX_02") && x.StationCode=="1005").Result;
ChartValues<double> achievement = new ChartValues<double>();
#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<string>();
ChartValues<int> achievement2 = new ChartValues<int>();
//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();
MaterialNameList.Add(item.Key); ProductionHourList = new List<string>();
achievement2.Add(flattenedList.Sum()); List<WorkTime> listTime = _baseBomInfoServices.getWorkTime().Result;
} ProductionHourList.Clear();
var column2 = new ColumnSeries(); foreach (WorkTime time in listTime)
column2.DataLabels = true; {
column2.Title = "当日型号产量统计"; ProductionHourList.Add(time.hourTime);
column2.Values = achievement2; }
column2.Foreground = Brushes.White; // 货道列表
ModelStatistics.Add(column2); List<BoxFoamData> list = _boxFoamDataServices.QueryAsync(x => x.ProductLineCode.Equals("CX_02") && x.StationCode == "1005").Result;
ChartValues<double> achievement = new ChartValues<double>();
#endregion
#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<string>();
ChartValues<int> achievement2 = new ChartValues<int>();
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(); //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