using CommunityToolkit.Mvvm.ComponentModel; using System; using log4net; using LiveCharts.Wpf; using LiveCharts; using System.Collections.Generic; using System.Windows.Media; /* * 成品分舵入库首页信息 * */ namespace Aucma.Core.Palletiz.ViewModels { public partial class IndexPageViewModel : ObservableObject { private static readonly log4net.ILog log = LogManager.GetLogger(typeof(IndexPageViewModel)); public IndexPageViewModel() { StationName = "成品分垛入库"; MaterialName = "SC-AUCMA-农夫山泉,SC"; OrderNo = "8512365486"; BeginTime = DateTime.Now.ToString("yyyy-mm-dd HH:mm:ss"); InitEveryDayMethod(); } #region 扫描信息 #region 物料条码 private string _stationName; public string StationName { get { return _stationName; } set { _stationName = value; SetProperty(ref _stationName, value); } } #endregion #region 物料名称 private string _materialName; public string MaterialName { get { return _materialName; } set { _materialName = value; SetProperty(ref _materialName, value); } } #endregion #region 订单信息 private string _orderNo; public string OrderNo { get { return _orderNo; } set { _orderNo = value; SetProperty(ref _orderNo, value); } } #endregion #region 开始时间 private string _beginTime; public string BeginTime { get { return _beginTime; } set { _beginTime = value; SetProperty(ref _beginTime, value); } } #endregion #endregion private void InitEveryDayMethod() { ChartValues achievement = new ChartValues(); Random random = new Random(); for (int i = 0; i < 2; i++) { achievement.Add(random.Next(1, 50)); } var column = new ColumnSeries(); column.DataLabels = true; column.Title = "小时产量"; column.Values = achievement; column.Foreground = Brushes.White; ModelStatistics.Add(column); ProductionHourList = new List() { "7:30", "8:30", "9:30", "10:30", "11:30", }; ChartValues achievement2 = new ChartValues(); Random random2 = new Random(); for (int i = 0; i < 5; i++) { achievement2.Add(random2.Next(0, 30)); } var column2 = new ColumnSeries(); column2.DataLabels = true; column2.Title = "型号统计"; column2.Values = achievement2; column2.Foreground = Brushes.White; Achievement.Add(column2); } #region 日产量柱状图 /// /// 日产量柱状图 /// private SeriesCollection achievement = new SeriesCollection(); public SeriesCollection Achievement { get { return achievement; } set { achievement = value; } } #endregion #region 型号统计柱状图 /// /// 型号统计柱状图 /// private SeriesCollection modelStatistics = new SeriesCollection(); public SeriesCollection ModelStatistics { get { return modelStatistics; } set { modelStatistics = value; } } #endregion #region 日产量柱状图X轴日期 /// /// 日产量柱状图X轴日期 /// private List productionHourList; public List ProductionHourList { get { return productionHourList; } set { productionHourList = value; } } #endregion } }