|
|
|
@ -54,6 +54,7 @@ namespace Aucma.Core.ProductOffLine.ViewModels
|
|
|
|
|
System.Timers.Timer timer = new System.Timers.Timer(1000 * 1);//界面刷新定时器
|
|
|
|
|
private readonly IBaseBomInfoServices? _baseBomInfoServices;
|
|
|
|
|
private OffLineBusiness offLineBusiness = OffLineBusiness.Instance;
|
|
|
|
|
private static double aaa = 100.0;
|
|
|
|
|
int a = 0;
|
|
|
|
|
public IndexPageViewModel()
|
|
|
|
|
{
|
|
|
|
@ -63,6 +64,7 @@ namespace Aucma.Core.ProductOffLine.ViewModels
|
|
|
|
|
InitEveryDayMethod();
|
|
|
|
|
// 刷新界面信息
|
|
|
|
|
RefreshPageListen();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -270,6 +272,9 @@ namespace Aucma.Core.ProductOffLine.ViewModels
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
public void RefreshPage(object source, System.Timers.ElapsedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
InitEveryDayMethod();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (OffLineBusiness.TempOffLineInfo1.ProductRefreshFlag == true)
|
|
|
|
|
{
|
|
|
|
|
ModelToPage(OffLineBusiness.TempOffLineInfo1);
|
|
|
|
@ -308,53 +313,69 @@ namespace Aucma.Core.ProductOffLine.ViewModels
|
|
|
|
|
|
|
|
|
|
private async void InitEveryDayMethod()
|
|
|
|
|
{
|
|
|
|
|
LoadData();
|
|
|
|
|
List<WorkTime> listTime = await _baseBomInfoServices.getWorkTime();
|
|
|
|
|
if (listTime == null) return;
|
|
|
|
|
// var aa =_offLineInfoServices.Query(x=>x.ProductScanTime>= listTime[0].startTime && x.ProductScanTime<= listTime[11].startTime)
|
|
|
|
|
// List<dynamic> hourAmount = _offLineInfoServices.QueryCharts1("CX_01");
|
|
|
|
|
|
|
|
|
|
List<Admin.Core.Model.ViewModels.ChartsByTime> list = await _offLineInfoServices.QueryCharts(listTime[0].startTime, listTime[11].startTime);
|
|
|
|
|
if (list == null) return;
|
|
|
|
|
var hourList = list.Where(x => int.Parse(x.hour) >= listTime[0].startTime.Hour && int.Parse(x.hour) <= listTime[11].startTime.Hour && x.productLineCode.Equals("CX_02"));
|
|
|
|
|
|
|
|
|
|
List<string> xList = new List<string>();
|
|
|
|
|
ChartValues<double> achievement2 = new ChartValues<double>();
|
|
|
|
|
foreach (var item in hourList)
|
|
|
|
|
{
|
|
|
|
|
xList.Add(item.hour);
|
|
|
|
|
achievement2.Add(item.Amount);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//for (int i = 0; i < 12; i++)
|
|
|
|
|
//{
|
|
|
|
|
// // xList.Add(list[i].time.Substring(11, 2) + ":00");
|
|
|
|
|
// achievement2.Add(list[i].Amount);
|
|
|
|
|
//}
|
|
|
|
|
var column2 = new ColumnSeries();
|
|
|
|
|
column2.DataLabels = true;
|
|
|
|
|
column2.Title = "产量";
|
|
|
|
|
column2.Values = achievement2;
|
|
|
|
|
column2.Foreground = Brushes.White;
|
|
|
|
|
Achievement.Add(column2);
|
|
|
|
|
ProductionHourList = xList;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ChartValues<double> achievement = new ChartValues<double>();
|
|
|
|
|
Random random = new Random();
|
|
|
|
|
for (int i = 0; i < 5; i++)
|
|
|
|
|
await App.Current.Dispatcher.BeginInvoke((Action)(() =>
|
|
|
|
|
{
|
|
|
|
|
achievement.Add(random.Next(60, 100));
|
|
|
|
|
}
|
|
|
|
|
LoadData();
|
|
|
|
|
List<WorkTime> listTime = _baseBomInfoServices.getWorkTime().Result;
|
|
|
|
|
if (listTime == null) return;
|
|
|
|
|
// var aa =_offLineInfoServices.Query(x=>x.ProductScanTime>= listTime[0].startTime && x.ProductScanTime<= listTime[11].startTime)
|
|
|
|
|
// List<dynamic> hourAmount = _offLineInfoServices.QueryCharts1("CX_01");
|
|
|
|
|
|
|
|
|
|
List<Admin.Core.Model.ViewModels.ChartsByTime> list = _offLineInfoServices.QueryCharts(listTime[0].startTime, listTime[11].startTime).Result;
|
|
|
|
|
if (list == null) return;
|
|
|
|
|
var hourList = list.Where(x => int.Parse(x.hour) >= listTime[0].startTime.Hour && int.Parse(x.hour) <= listTime[11].startTime.Hour && x.productLineCode.Equals("CX_02"));
|
|
|
|
|
|
|
|
|
|
List<string> xList = new List<string>();
|
|
|
|
|
ChartValues<int> achievement2 = new ChartValues<int>();
|
|
|
|
|
foreach (var item in hourList)
|
|
|
|
|
{
|
|
|
|
|
xList.Add(item.hour);
|
|
|
|
|
achievement2.Add(item.Amount);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var column = new ColumnSeries();
|
|
|
|
|
column.DataLabels = true;
|
|
|
|
|
column.Title = "型号";
|
|
|
|
|
column.Values = achievement;
|
|
|
|
|
column.Foreground = Brushes.White;
|
|
|
|
|
|
|
|
|
|
ModelStatistics.Add(column);
|
|
|
|
|
MaterialNameList = new List<string>()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var column2 = new ColumnSeries();
|
|
|
|
|
column2.DataLabels = true;
|
|
|
|
|
column2.Title = "产量";
|
|
|
|
|
column2.Values = achievement2;
|
|
|
|
|
column2.Foreground = Brushes.White;
|
|
|
|
|
// Achievement.Clear();
|
|
|
|
|
//Achievement.Add(column2);
|
|
|
|
|
if (Achievement.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < hourList.Count(); i++)
|
|
|
|
|
{
|
|
|
|
|
Achievement.FirstOrDefault().Values[i] = hourList.ElementAt(i).Amount;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Achievement.Add(column2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ProductionHourList = xList;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ChartValues<double> achievement = new ChartValues<double>();
|
|
|
|
|
Random random = new Random();
|
|
|
|
|
for (int i = 0; i < 5; i++)
|
|
|
|
|
{
|
|
|
|
|
achievement.Add(random.Next(60, 100));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var column = new ColumnSeries();
|
|
|
|
|
column.DataLabels = true;
|
|
|
|
|
column.Title = "型号";
|
|
|
|
|
column.Values = achievement;
|
|
|
|
|
column.Foreground = Brushes.White;
|
|
|
|
|
|
|
|
|
|
ModelStatistics.Clear();
|
|
|
|
|
MaterialNameList = null;
|
|
|
|
|
ModelStatistics.Add(column);
|
|
|
|
|
MaterialNameList = new List<string>()
|
|
|
|
|
{
|
|
|
|
|
"SC-230,11W/H成品",
|
|
|
|
|
"SC-439,箱体",
|
|
|
|
@ -362,9 +383,10 @@ namespace Aucma.Core.ProductOffLine.ViewModels
|
|
|
|
|
"SC-439,背板",
|
|
|
|
|
"SC-439VAM,元气森林,C",
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//private async void InitEveryDayMethod()
|
|
|
|
|
//{
|
|
|
|
|
// LoadData();
|
|
|
|
|