|
|
|
@ -70,67 +70,73 @@ namespace Aucma.Core.BoxFoam.ViewModels
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private Task InitEveryDayMethod()
|
|
|
|
|
{
|
|
|
|
|
ProductionHourList = new List<string>();
|
|
|
|
|
List<WorkTime> listTime = _baseBomInfoServices.getWorkTime().Result;
|
|
|
|
|
foreach (WorkTime time in listTime)
|
|
|
|
|
App.Current.Dispatcher.BeginInvoke((Action)(() =>
|
|
|
|
|
{
|
|
|
|
|
ProductionHourList.Add(time.hourTime);
|
|
|
|
|
}
|
|
|
|
|
// 货道列表
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
|
|
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<string>();
|
|
|
|
|
List<WorkTime> listTime = _baseBomInfoServices.getWorkTime().Result;
|
|
|
|
|
ProductionHourList.Clear();
|
|
|
|
|
foreach (WorkTime time in listTime)
|
|
|
|
|
{
|
|
|
|
|
ProductionHourList.Add(time.hourTime);
|
|
|
|
|
}
|
|
|
|
|
// 货道列表
|
|
|
|
|
List<BoxFoamData> list = _boxFoamDataServices.QueryAsync(x => x.ProductLineCode.Equals("CX_02") && x.StationCode == "1005").Result;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
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.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();
|
|
|
|
|
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");
|
|
|
|
|