You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

327 lines
8.4 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using CommunityToolkit.Mvvm.ComponentModel;
using System;
using log4net;
using LiveCharts.Wpf;
using LiveCharts;
using System.Collections.Generic;
using System.Windows.Media;
using CommunityToolkit.Mvvm.Input;
using Aucma.Core.Palletiz.Views;
using Aucma.Core.Palletiz.Business;
using Admin.Core.Model;
using System.Windows.Documents;
using System.Windows.Interop;
using Admin.Core.Common;
/*
* 成品分垛入库首页信息
* 2024-02-28
*/
namespace Aucma.Core.Palletiz.ViewModels
{
public partial class IndexPageViewModel : ObservableObject
{
private static readonly log4net.ILog log = LogManager.GetLogger(typeof(IndexPageViewModel));
private InstoreBusiness inStoreBusiness = InstoreBusiness.Instance;//初始化业务执行类
public IndexPageViewModel()
{
StationName = Appsettings.app("StoreInfo", "StationName");//分垛库A
//MaterialName = "SC-AUCMA-农夫山泉SC";
//OrderNo = "8512365486";
//BeginTime = DateTime.Now.ToString("yyyy-mm-dd HH:mm:ss");
TotalEnterStoreNum = 0;
PromptInfo("提示信息","White");
InstoreBusiness.LogInStoreInfoDelegateEvent += PromptInfo;//成品入库提示信息
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<double> achievement = new ChartValues<double>();
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.ScalesYAt = 0;
column.Foreground = Brushes.White;
ModelStatistics.Add(column);
ProductionHourList = new List<string>()
{
"7:30",
"8:30",
"9:30",
"10:30",
"11:30",
};
ChartValues<double> achievement2 = new ChartValues<double>();
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.ScalesYAt = 0;
column2.Values = achievement2;
column2.Foreground = Brushes.White;
Achievement.Add(column2);
}
#region 手动分垛
/// <summary>
/// 手动分垛
/// </summary>
[RelayCommand]
private void HandPalletiz()
{
HandPalletizView handPalletizPage = new HandPalletizView();
handPalletizPage.ShowDialog();
}
#endregion
#region 界面变量定义
#region 产品条码
private string _productSNCode;
public string ProductSNCode
{
get { return _productSNCode; }
set
{
_productSNCode = value;
OnPropertyChanged(nameof(ProductSNCode));
}
}
#endregion
#region 扫描时间
private string _productScanTime;
public string ProductScanTime
{
get { return _productScanTime; }
set
{
_productScanTime = value;
OnPropertyChanged(nameof(ProductScanTime));
}
}
#endregion
#region 产品型号
private string _productModel;
public string ProductModel
{
get { return _productModel; }
set
{
_productModel = value;
OnPropertyChanged(nameof(ProductModel));
}
}
#endregion
#region 订单编号
private string _productOrderNo;
public string ProductOrderNo
{
get { return _productOrderNo; }
set
{
_productOrderNo = value;
OnPropertyChanged(nameof(ProductOrderNo));
}
}
#endregion
#region 订单数量
private string _orderQty;
public string OrderQty
{
get { return _orderQty; }
set
{
_orderQty = value;
OnPropertyChanged(nameof(OrderQty));
}
}
#endregion
#region 订单已上传
private string _actQty;
public string ActQty
{
get { return _actQty; }
set
{
_actQty = value;
OnPropertyChanged(nameof(ActQty));
}
}
#endregion
#region 界面提示信息
private string _msgInfo;
public string MsgInfo
{
get { return _msgInfo; }
set
{
_msgInfo = value;
OnPropertyChanged(nameof(MsgInfo));
}
}
private string _msgColor;
public string MsgColor
{
get { return _msgColor; }
set
{
_msgColor = value;
OnPropertyChanged(nameof(MsgColor));
}
}
#endregion
#endregion
#region 提示信息
/// <summary>
/// 提示信息
/// </summary>
/// <param name="mesg"></param>
/// <param name="color"></param>
public void PromptInfo(string mesg, string color)
{
MsgInfo = mesg;
MsgColor = color;
}
#endregion
#region 日产量柱状图
/// <summary>
/// 日产量柱状图
/// </summary>
private SeriesCollection achievement = new SeriesCollection();
public SeriesCollection Achievement
{
get { return achievement; }
set { achievement = value; }
}
#endregion
#region 型号统计柱状图
/// <summary>
/// 型号统计柱状图
/// </summary>
private SeriesCollection modelStatistics = new SeriesCollection();
public SeriesCollection ModelStatistics
{
get { return modelStatistics; }
set { modelStatistics = value; }
}
#endregion
#region 日产量柱状图X轴日期
/// <summary>
/// 日产量柱状图X轴日期
/// </summary>
private List<string> productionHourList;
public List<string> ProductionHourList
{
get { return productionHourList; }
set { productionHourList = value; }
}
#endregion
#region 总计入库数量
private int _totalEnterStoreNum;
public int TotalEnterStoreNum
{
get { return _totalEnterStoreNum; }
set
{
_totalEnterStoreNum = value;
OnPropertyChanged(nameof(_totalEnterStoreNum));
}
}
#endregion
}
}