@ -35,6 +35,7 @@ using System.Windows;
using System.Collections.ObjectModel ;
using System.Collections.ObjectModel ;
using Aucma.Core.ProductOffLine.Models ;
using Aucma.Core.ProductOffLine.Models ;
using System.Globalization ;
using System.Globalization ;
using Admin.Core.Model.ViewModels ;
/ *
/ *
@ -51,17 +52,18 @@ namespace Aucma.Core.ProductOffLine.ViewModels
private readonly IOffLineInfoServices ? _offLineInfoServices = App . ServiceProvider . GetService < IOffLineInfoServices > ( ) ;
private readonly IOffLineInfoServices ? _offLineInfoServices = App . ServiceProvider . GetService < IOffLineInfoServices > ( ) ;
System . Timers . Timer timer = new System . Timers . Timer ( 1000 * 1 ) ; //界面刷新定时器
System . Timers . Timer timer = new System . Timers . Timer ( 1000 * 1 ) ; //界面刷新定时器
private readonly IBaseBomInfoServices ? _baseBomInfoServices ;
private OffLineBusiness offLineBusiness = OffLineBusiness . Instance ;
private OffLineBusiness offLineBusiness = OffLineBusiness . Instance ;
int a = 0 ;
int a = 0 ;
public IndexPageViewModel ( )
public IndexPageViewModel ( )
{
{
offLineBusiness . test ( ) ;
offLineBusiness . test ( ) ;
_offLineInfoServices = App . ServiceProvider . GetService < IOffLineInfoServices > ( ) ;
_offLineInfoServices = App . ServiceProvider . GetService < IOffLineInfoServices > ( ) ;
_baseBomInfoServices = App . ServiceProvider . GetService < IBaseBomInfoServices > ( ) ;
InitEveryDayMethod ( ) ;
InitEveryDayMethod ( ) ;
// 刷新界面信息
// 刷新界面信息
RefreshPageListen ( ) ;
RefreshPageListen ( ) ;
}
}
#region 参数定义
#region 参数定义
@ -303,10 +305,29 @@ namespace Aucma.Core.ProductOffLine.ViewModels
}
}
# endregion
# endregion
private void InitEveryDayMethod ( )
private async void InitEveryDayMethod ( )
{
{
LoadData ( ) ;
LoadData ( ) ;
BeginTime = DateTime . Now . ToString ( "yyyy-mm-dd HH:mm:ss" ) ;
List < WorkTime > listTime = await _baseBomInfoServices . getWorkTime ( ) ;
if ( listTime = = null ) return ;
List < Admin . Core . Model . ViewModels . ChartsByTime > list = await _offLineInfoServices . QueryCharts ( listTime [ 0 ] . startTime , listTime [ 11 ] . startTime ) ;
if ( list = = null ) return ;
List < string > xList = new List < string > ( ) ;
ChartValues < double > achievement2 = new ChartValues < double > ( ) ;
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 > ( ) ;
ChartValues < double > achievement = new ChartValues < double > ( ) ;
Random random = new Random ( ) ;
Random random = new Random ( ) ;
for ( int i = 0 ; i < 5 ; i + + )
for ( int i = 0 ; i < 5 ; i + + )
@ -329,29 +350,6 @@ namespace Aucma.Core.ProductOffLine.ViewModels
"SC-439, 背板" ,
"SC-439, 背板" ,
"SC-439VAM,元气森林,C" ,
"SC-439VAM,元气森林,C" ,
} ;
} ;
ProductionHourList = new List < string > ( )
{
"12" ,
"13" ,
"14" ,
"15" ,
"16" ,
} ;
ChartValues < double > achievement2 = new ChartValues < double > ( ) ;
Random random2 = new Random ( ) ;
for ( int i = 0 ; i < 5 ; i + + )
{
achievement2 . Add ( random2 . Next ( 60 , 100 ) ) ;
}
var column2 = new ColumnSeries ( ) ;
column2 . DataLabels = true ;
column2 . Title = "产量" ;
column2 . Values = achievement2 ;
column2 . Foreground = Brushes . White ;
Achievement . Add ( column2 ) ;
// 加载datagrid
}
}
public async void LoadData ( )
public async void LoadData ( )
{
{