|
|
|
@ -23,6 +23,7 @@ using NPOI.SS.Formula.Functions;
|
|
|
|
|
using System.Windows.Documents;
|
|
|
|
|
using static Npgsql.Replication.PgOutput.Messages.RelationMessage;
|
|
|
|
|
using System.Windows.Media;
|
|
|
|
|
using log4net;
|
|
|
|
|
|
|
|
|
|
namespace Aucma.Core.OldBoxFoam.ViewModels
|
|
|
|
|
{
|
|
|
|
@ -32,6 +33,7 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
|
|
|
|
|
* */
|
|
|
|
|
public partial class RealRoadPageViewModel : ObservableObject
|
|
|
|
|
{
|
|
|
|
|
private readonly log4net.ILog log = LogManager.GetLogger(typeof(RealRoadPageViewModel));
|
|
|
|
|
protected readonly IBoxFoamPlanServices? _boxFoamPlanServices;
|
|
|
|
|
private IOldBoxFoamTypeServices? _oldBoxFoamTypeServices;
|
|
|
|
|
private IBoxFoamDataServices? _boxFoamDataServices;
|
|
|
|
@ -46,13 +48,7 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
|
|
|
|
|
_boxFoamDataServices = App.ServiceProvider.GetService<IBoxFoamDataServices>();
|
|
|
|
|
//InitData();
|
|
|
|
|
Collection.RefreshSpaceEvent += InitData;
|
|
|
|
|
timer2.Elapsed += new System.Timers.ElapsedEventHandler(InitData); //到达时间的时候执行事件;
|
|
|
|
|
timer2.AutoReset = true;//设置是执行一次(false)还是一直执行(true);
|
|
|
|
|
timer2.Enabled = true;//需要调用 timer.Start()或者timer.Enabled = true来启动它,
|
|
|
|
|
timer2.Start();//timer.Start()的内部原理还是设置timer.Enabled = true;
|
|
|
|
|
|
|
|
|
|
//RefreshHourOutPutChart();
|
|
|
|
|
//RefreshMaterialTypeChart();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 参数定义
|
|
|
|
@ -122,61 +118,71 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
public async void InitData(object? sender, ElapsedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
List<OldBoxFoamType> list = await _oldBoxFoamTypeServices.QueryAsync();
|
|
|
|
|
|
|
|
|
|
if(list != null)
|
|
|
|
|
{
|
|
|
|
|
if(list.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
list = list.OrderBy(x=>x.ObjId).ToList();
|
|
|
|
|
int totalItems = list.Count;
|
|
|
|
|
int half = totalItems / 2;
|
|
|
|
|
|
|
|
|
|
List<OldBoxFoamType> spaceInfoLeft = list.Take(half).ToList();
|
|
|
|
|
List<OldBoxFoamType> spaceInfoRight = list.Skip(half).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
System.Windows.Application.Current.Dispatcher.Invoke((Action)(() =>
|
|
|
|
|
{
|
|
|
|
|
ListItems.Clear();
|
|
|
|
|
if (spaceInfoLeft == null) return;
|
|
|
|
|
for (int i = 0; i < spaceInfoLeft.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
ListItems.Add(new OldBoxFoamTypeModel()
|
|
|
|
|
{
|
|
|
|
|
SpaceName = $"东线{i + 1}",
|
|
|
|
|
Local = spaceInfoLeft[i].Local,
|
|
|
|
|
Status = spaceInfoLeft[i].Storeamount == 3 ? "1" : "0",
|
|
|
|
|
Storeamount = spaceInfoLeft[i].Storeamount,
|
|
|
|
|
MaterialCode = spaceInfoLeft[i].MaterialCode,
|
|
|
|
|
MaterialName = spaceInfoLeft[i].MaterialName,
|
|
|
|
|
Boxtype = spaceInfoLeft[i].Boxtype,
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (spaceInfoRight == null) return;
|
|
|
|
|
for (int i = 0; i < spaceInfoRight.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
ListItems.Add(new OldBoxFoamTypeModel()
|
|
|
|
|
{
|
|
|
|
|
SpaceName = $"西线{i + 1}",
|
|
|
|
|
Local = spaceInfoRight[i].Local,
|
|
|
|
|
Status = spaceInfoRight[i].Storeamount == 3 ? "1" : "0",
|
|
|
|
|
Storeamount = spaceInfoRight[i].Storeamount,
|
|
|
|
|
MaterialCode = spaceInfoRight[i].MaterialCode,
|
|
|
|
|
MaterialName = spaceInfoRight[i].MaterialName,
|
|
|
|
|
Boxtype = spaceInfoRight[i].Boxtype,
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#region 原货道信息刷新 Delete By wenjy 2024-01-13
|
|
|
|
|
//public async void InitData(object? sender, ElapsedEventArgs e)
|
|
|
|
|
//{
|
|
|
|
|
// List<OldBoxFoamType> list = await _oldBoxFoamTypeServices.QueryAsync();
|
|
|
|
|
|
|
|
|
|
// if(list != null)
|
|
|
|
|
// {
|
|
|
|
|
// if(list.Count > 0)
|
|
|
|
|
// {
|
|
|
|
|
// list = list.OrderBy(x=>x.ObjId).ToList();
|
|
|
|
|
// int totalItems = list.Count;
|
|
|
|
|
// int half = totalItems / 2;
|
|
|
|
|
|
|
|
|
|
// List<OldBoxFoamType> spaceInfoLeft = list.Take(half).ToList();
|
|
|
|
|
// List<OldBoxFoamType> spaceInfoRight = list.Skip(half).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// System.Windows.Application.Current.Dispatcher.Invoke((Action)(() =>
|
|
|
|
|
// {
|
|
|
|
|
// ListItems.Clear();
|
|
|
|
|
// if (spaceInfoLeft == null) return;
|
|
|
|
|
// for (int i = 0; i < spaceInfoLeft.Count; i++)
|
|
|
|
|
// {
|
|
|
|
|
// if (i != 1)
|
|
|
|
|
// {
|
|
|
|
|
// spaceInfoLeft[i].Local = "";
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// ListItems.Add(new OldBoxFoamTypeModel()
|
|
|
|
|
// {
|
|
|
|
|
// SpaceName = $"{i + 1}#货道",
|
|
|
|
|
// Local = spaceInfoLeft[i].Local,
|
|
|
|
|
// Status = spaceInfoLeft[i].Storeamount == 3 ? "1" : "0",
|
|
|
|
|
// Storeamount = spaceInfoLeft[i].Storeamount > 3 ? 0 : spaceInfoLeft[i].Storeamount,
|
|
|
|
|
// MaterialCode = spaceInfoLeft[i].MaterialCode,
|
|
|
|
|
// MaterialName = spaceInfoLeft[i].MaterialName,
|
|
|
|
|
// Boxtype = spaceInfoLeft[i].Boxtype,
|
|
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// if (spaceInfoRight == null) return;
|
|
|
|
|
// for (int i = 0; i < spaceInfoRight.Count; i++)
|
|
|
|
|
// {
|
|
|
|
|
// if (i != 1)
|
|
|
|
|
// {
|
|
|
|
|
// spaceInfoRight[i].Local = "";
|
|
|
|
|
// }
|
|
|
|
|
// ListItems.Add(new OldBoxFoamTypeModel()
|
|
|
|
|
// {
|
|
|
|
|
// SpaceName = $"{i + 1}#货道",
|
|
|
|
|
// Local = spaceInfoRight[i].Local,
|
|
|
|
|
// Status = spaceInfoRight[i].Storeamount == 3 ? "1" : "0",
|
|
|
|
|
// Storeamount = spaceInfoRight[i].Storeamount > 3 ? 0 : spaceInfoRight[i].Storeamount,
|
|
|
|
|
// MaterialCode = spaceInfoRight[i].MaterialCode,
|
|
|
|
|
// MaterialName = spaceInfoRight[i].MaterialName,
|
|
|
|
|
// Boxtype = spaceInfoRight[i].Boxtype,
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// }));
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 初始化datagrid
|
|
|
|
|
private ObservableCollection<OldBoxFoamTypeModel> listItems = new ObservableCollection<OldBoxFoamTypeModel>();
|
|
|
|
@ -196,7 +202,7 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
|
|
|
|
|
/// 更新货道信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="spaceDetailModel"></param>
|
|
|
|
|
public async void InitData(List<SpaceDetailModel> spaceDetailModel)
|
|
|
|
|
public async void InitData(List<SpaceDetailModel> spaceDetailModel, List<FixtureStatus> fixtureStatus)
|
|
|
|
|
{
|
|
|
|
|
if (spaceDetailModel == null) return;
|
|
|
|
|
var spaceList = _oldBoxFoamTypeServices.QueryAsync().Result;
|
|
|
|
@ -221,76 +227,163 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
|
|
|
|
|
{
|
|
|
|
|
await _oldBoxFoamTypeServices.UpdateAsync(storeList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RefreshSpaceInfoDataGrid(spaceDetailModel, fixtureStatus);
|
|
|
|
|
RefreshHourOutPutChart();
|
|
|
|
|
RefreshMaterialTypeChart();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void RefreshSpaceInfoDataGrid(List<SpaceDetailModel> spaceDetailModel, List<FixtureStatus> fixtureStatus)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (spaceDetailModel != null)
|
|
|
|
|
{
|
|
|
|
|
if (spaceDetailModel.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
spaceDetailModel = spaceDetailModel.OrderBy(x => x.ObjId).ToList();
|
|
|
|
|
int totalItems = spaceDetailModel.Count;
|
|
|
|
|
int half = totalItems / 2;
|
|
|
|
|
|
|
|
|
|
List<SpaceDetailModel> spaceInfoLeft = spaceDetailModel.Take(half).ToList();
|
|
|
|
|
List<SpaceDetailModel> spaceInfoRight = spaceDetailModel.Skip(half).ToList();
|
|
|
|
|
List<OldBoxFoamType> list = _oldBoxFoamTypeServices.QueryAsync().Result;
|
|
|
|
|
|
|
|
|
|
System.Windows.Application.Current.Dispatcher.Invoke((Action)(() =>
|
|
|
|
|
{
|
|
|
|
|
ListItems.Clear();
|
|
|
|
|
if (spaceInfoLeft == null) return;
|
|
|
|
|
for (int i = 0; i < spaceInfoLeft.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
var spaceInfo = list.Where(x => x.ObjId == spaceInfoLeft[i].ObjId).ToList().First();
|
|
|
|
|
if (i != 1)
|
|
|
|
|
{
|
|
|
|
|
spaceInfo.Local = "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var boxType = spaceInfo.Boxtype;
|
|
|
|
|
int fixtureAmount = fixtureStatus.Where(x => x.FixtureBoxType == boxType && x.Status != 3 && x.Status != 0).ToList().Count();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ListItems.Add(new OldBoxFoamTypeModel()
|
|
|
|
|
{
|
|
|
|
|
SpaceName = $"{i + 1}#货道",
|
|
|
|
|
Local = spaceInfo.Local,
|
|
|
|
|
Status = spaceInfoLeft[i].StoreAmount == 3 ? "1" : "0",
|
|
|
|
|
Storeamount = spaceInfoLeft[i].StoreAmount > 3 ? 0 : spaceInfoLeft[i].StoreAmount,
|
|
|
|
|
MaterialCode = spaceInfo.MaterialCode,
|
|
|
|
|
MaterialName = spaceInfo.MaterialName,
|
|
|
|
|
Boxtype = spaceInfoLeft[i].StoreType,
|
|
|
|
|
QualityResult = fixtureAmount,
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (spaceInfoRight == null) return;
|
|
|
|
|
for (int i = 0; i < spaceInfoRight.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
var spaceInfo = list.Where(x => x.ObjId == spaceInfoRight[i].ObjId).ToList().First();
|
|
|
|
|
if (i != 1)
|
|
|
|
|
{
|
|
|
|
|
spaceInfo.Local = "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var boxType = spaceInfo.Boxtype;
|
|
|
|
|
int fixtureAmount = fixtureStatus.Where(x => x.FixtureBoxType == boxType && x.Status != 3 && x.Status != 0).ToList().Count();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ListItems.Add(new OldBoxFoamTypeModel()
|
|
|
|
|
{
|
|
|
|
|
SpaceName = $"{i + 1}#货道",
|
|
|
|
|
Local = spaceInfo.Local,
|
|
|
|
|
Status = spaceInfoRight[i].StoreAmount == 3 ? "1" : "0",
|
|
|
|
|
Storeamount = spaceInfoRight[i].StoreAmount > 3 ? 0 : spaceInfoRight[i].StoreAmount,
|
|
|
|
|
MaterialCode = spaceInfo.MaterialCode,
|
|
|
|
|
MaterialName = spaceInfo.MaterialName,
|
|
|
|
|
Boxtype = spaceInfoRight[i].StoreType,
|
|
|
|
|
QualityResult = fixtureAmount,
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}catch(Exception ex)
|
|
|
|
|
{
|
|
|
|
|
log.Error($"货道信息列表刷新异常:{ex.Message}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 小时统计图表
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void RefreshHourOutPutChart()
|
|
|
|
|
{
|
|
|
|
|
ChartValues<double> hourAchievement = new ChartValues<double>();
|
|
|
|
|
HourOutPutList = new List<string>();
|
|
|
|
|
App.Current.Dispatcher.BeginInvoke((Action)(() =>
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
ChartValues<double> hourAchievement = new ChartValues<double>();
|
|
|
|
|
HourOutPutList = new List<string>();
|
|
|
|
|
App.Current.Dispatcher.BeginInvoke((Action)(() =>
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
DateTime now = DateTime.Now;
|
|
|
|
|
DateTime now = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
// 判断当前是否是白班时间段
|
|
|
|
|
if (now.Hour >= 8 && now.Hour < 20)
|
|
|
|
|
{
|
|
|
|
|
HourOutPutList = new List<string>() { "8:00", "9:00", "10:00", "11:00", "12:00", "13:00", "14:00", "15:00", "16:00", "17:00", "18:00", "19:00" };
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
HourOutPutList = new List<string>() { "20:00", "21:00", "22:00", "23:00", "00:00", "01:00", "02:00", "03:00", "04:00", "05:00", "06:00", "0:007" };
|
|
|
|
|
}
|
|
|
|
|
// 判断当前是否是白班时间段
|
|
|
|
|
if (now.Hour >= 8 && now.Hour < 20)
|
|
|
|
|
{
|
|
|
|
|
HourOutPutList = new List<string>() { "8:00", "9:00", "10:00", "11:00", "12:00", "13:00", "14:00", "15:00", "16:00", "17:00", "18:00", "19:00" };
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
HourOutPutList = new List<string>() { "20:00", "21:00", "22:00", "23:00", "00:00", "01:00", "02:00", "03:00", "04:00", "05:00", "06:00", "0:007" };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var hourFoamDataList = _boxFoamDataServices.Query(x=>x.ProductLineCode == "CX_01" && x.StationCode == "1105");
|
|
|
|
|
var hourFoamDataList = _boxFoamDataServices.Query(x => x.ProductLineCode == "CX_01" && x.StationCode == "1105");
|
|
|
|
|
|
|
|
|
|
List<int> hours = new List<int>();
|
|
|
|
|
List<int> hours = new List<int>();
|
|
|
|
|
|
|
|
|
|
if (hourFoamDataList != null)
|
|
|
|
|
{
|
|
|
|
|
if (hourFoamDataList != null)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
hourAchievement.Add(hourFoamDataList.Sum(x => x.AnHour));
|
|
|
|
|
hourAchievement.Add(hourFoamDataList.Sum(x => x.TwoHour));
|
|
|
|
|
hourAchievement.Add(hourFoamDataList.Sum(x => x.ThreeHour));
|
|
|
|
|
hourAchievement.Add(hourFoamDataList.Sum(x => x.FourHour));
|
|
|
|
|
hourAchievement.Add(hourFoamDataList.Sum(x => x.FiveHour));
|
|
|
|
|
hourAchievement.Add(hourFoamDataList.Sum(x => x.SixHour));
|
|
|
|
|
hourAchievement.Add(hourFoamDataList.Sum(x => x.SevenHour));
|
|
|
|
|
hourAchievement.Add(hourFoamDataList.Sum(x => x.EightHour));
|
|
|
|
|
hourAchievement.Add(hourFoamDataList.Sum(x => x.NineHour));
|
|
|
|
|
hourAchievement.Add(hourFoamDataList.Sum(x => x.TenHour));
|
|
|
|
|
hourAchievement.Add(hourFoamDataList.Sum(x => x.ElevenHour));
|
|
|
|
|
hourAchievement.Add(hourFoamDataList.Sum(x => x.TwelveHour));
|
|
|
|
|
}
|
|
|
|
|
hourAchievement.Add(hourFoamDataList.Sum(x => x.AnHour));
|
|
|
|
|
hourAchievement.Add(hourFoamDataList.Sum(x => x.TwoHour));
|
|
|
|
|
hourAchievement.Add(hourFoamDataList.Sum(x => x.ThreeHour));
|
|
|
|
|
hourAchievement.Add(hourFoamDataList.Sum(x => x.FourHour));
|
|
|
|
|
hourAchievement.Add(hourFoamDataList.Sum(x => x.FiveHour));
|
|
|
|
|
hourAchievement.Add(hourFoamDataList.Sum(x => x.SixHour));
|
|
|
|
|
hourAchievement.Add(hourFoamDataList.Sum(x => x.SevenHour));
|
|
|
|
|
hourAchievement.Add(hourFoamDataList.Sum(x => x.EightHour));
|
|
|
|
|
hourAchievement.Add(hourFoamDataList.Sum(x => x.NineHour));
|
|
|
|
|
hourAchievement.Add(hourFoamDataList.Sum(x => x.TenHour));
|
|
|
|
|
hourAchievement.Add(hourFoamDataList.Sum(x => x.ElevenHour));
|
|
|
|
|
hourAchievement.Add(hourFoamDataList.Sum(x => x.TwelveHour));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var shellColumn = new ColumnSeries();
|
|
|
|
|
shellColumn.DataLabels = true;
|
|
|
|
|
shellColumn.Title = "小时产量";
|
|
|
|
|
shellColumn.Values = hourAchievement;
|
|
|
|
|
shellColumn.Foreground = Brushes.White;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (HourAchievement.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < hourAchievement.Count; i++)
|
|
|
|
|
var shellColumn = new ColumnSeries();
|
|
|
|
|
shellColumn.DataLabels = true;
|
|
|
|
|
shellColumn.Title = "小时产量";
|
|
|
|
|
shellColumn.Values = hourAchievement;
|
|
|
|
|
shellColumn.Foreground = Brushes.White;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (HourAchievement.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
//hours
|
|
|
|
|
HourAchievement.FirstOrDefault().Values[i] = hourAchievement.ElementAt(i);
|
|
|
|
|
for (int i = 0; i < hourAchievement.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
//hours
|
|
|
|
|
HourAchievement.FirstOrDefault().Values[i] = hourAchievement.ElementAt(i);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
HourAchievement.Add(shellColumn);
|
|
|
|
|
}
|
|
|
|
|
}));
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
HourAchievement.Add(shellColumn);
|
|
|
|
|
}
|
|
|
|
|
}));
|
|
|
|
|
}catch(Exception ex)
|
|
|
|
|
{
|
|
|
|
|
log.Error($"小时统计图表刷新异常:{ex.Message}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -299,43 +392,49 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void RefreshMaterialTypeChart()
|
|
|
|
|
{
|
|
|
|
|
ChartValues<double> materialTypeAchievement = new ChartValues<double>();
|
|
|
|
|
MaterialTypeOutPutList = new List<string>();
|
|
|
|
|
App.Current.Dispatcher.BeginInvoke((Action)(() =>
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
ChartValues<double> materialTypeAchievement = new ChartValues<double>();
|
|
|
|
|
MaterialTypeOutPutList = new List<string>();
|
|
|
|
|
App.Current.Dispatcher.BeginInvoke((Action)(() =>
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
DateTime now = DateTime.Now;
|
|
|
|
|
DateTime now = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
var hourFoamDataList = _boxFoamDataServices.Query(x => x.ProductLineCode == "CX_01" && x.StationCode == "1105");
|
|
|
|
|
var hourFoamDataList = _boxFoamDataServices.Query(x => x.ProductLineCode == "CX_01" && x.StationCode == "1105");
|
|
|
|
|
|
|
|
|
|
if (hourFoamDataList != null)
|
|
|
|
|
{
|
|
|
|
|
var grouped = hourFoamDataList.GroupBy(x => x.Fixtureboxtype);
|
|
|
|
|
foreach (var item in grouped)
|
|
|
|
|
if (hourFoamDataList != null)
|
|
|
|
|
{
|
|
|
|
|
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();
|
|
|
|
|
var grouped = hourFoamDataList.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();
|
|
|
|
|
|
|
|
|
|
MaterialTypeOutPutList.Add(item.Key);
|
|
|
|
|
materialTypeAchievement.Add(flattenedList.Sum());
|
|
|
|
|
MaterialTypeOutPutList.Add(item.Key);
|
|
|
|
|
materialTypeAchievement.Add(flattenedList.Sum());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
var shellColumn = new ColumnSeries();
|
|
|
|
|
shellColumn.DataLabels = true;
|
|
|
|
|
shellColumn.Title = "型号统计";
|
|
|
|
|
shellColumn.Values = materialTypeAchievement;
|
|
|
|
|
shellColumn.Foreground = Brushes.White;
|
|
|
|
|
if (MaterialTypeAchievement.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < materialTypeAchievement.Count; i++)
|
|
|
|
|
var shellColumn = new ColumnSeries();
|
|
|
|
|
shellColumn.DataLabels = true;
|
|
|
|
|
shellColumn.Title = "型号统计";
|
|
|
|
|
shellColumn.Values = materialTypeAchievement;
|
|
|
|
|
shellColumn.Foreground = Brushes.White;
|
|
|
|
|
if (MaterialTypeAchievement.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
MaterialTypeAchievement.FirstOrDefault().Values[i] = materialTypeAchievement.ElementAt(i);
|
|
|
|
|
for (int i = 0; i < materialTypeAchievement.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
MaterialTypeAchievement.FirstOrDefault().Values[i] = materialTypeAchievement.ElementAt(i);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MaterialTypeAchievement.Add(shellColumn);
|
|
|
|
|
}
|
|
|
|
|
}));
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MaterialTypeAchievement.Add(shellColumn);
|
|
|
|
|
}
|
|
|
|
|
}));
|
|
|
|
|
}catch(Exception ex)
|
|
|
|
|
{
|
|
|
|
|
log.Error($"型号统计图表刷新异常:{ex.Message}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|