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.
AUCMA_SCADA/Aucma.Core.BoxFoaming/ViewModels/EnterWarehouseStatisticsPag...

100 lines
3.2 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 Aucma.Core.BoxFoaming.Models;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using log4net;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
/*
* 入库统计
* */
namespace Aucma.Core.BoxFoaming.ViewModels
{
public partial class EnterWarehouseStatisticsPageViewModel : ObservableObject
{
private static readonly log4net.ILog log = LogManager.GetLogger(typeof(EnterWarehouseStatisticsPageViewModel));
List<MaterialComplateInfo> materialComplateInfos = new List<MaterialComplateInfo>();
public EnterWarehouseStatisticsPageViewModel()
{
LoadData();
}
#region 加载DataGrid数据
private void LoadData()
{
MaterialDataGrid.Add(new MaterialComplateInfo() { No = 1, MaterialBarCode= "8659452123", ProductPlanCode = "8659452123", MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉SC", PlanAmount = 50, CompleteAmount = 10, EnterWarehouseTime=DateTime.Now });
}
#endregion
#region 初始化datagrid
private ObservableCollection<MaterialComplateInfo> materialDataGrid = new ObservableCollection<MaterialComplateInfo>();
public ObservableCollection<MaterialComplateInfo> MaterialDataGrid
{
get { return materialDataGrid; }
set
{
materialDataGrid = value;
OnPropertyChanged();//属性通知
}
}
#endregion
#region 查询
/// <summary>
/// 查询
/// </summary>
[RelayCommand]
private void ExecQuery(object obj)
{
var result = (StatisticModel)obj;
if (result==null)
{
MessageBox.Show("查询参数不能为空!");
return;
}
if (string.IsNullOrEmpty(result.BeginTime))
{
MessageBox.Show("开始时间不能为空!");
return;
}
if (string.IsNullOrEmpty(result.EndTime))
{
MessageBox.Show("结束时间不能为空!");
return;
}
System.Windows.Application.Current.Dispatcher.Invoke((Action)(() =>
{
if (!string.IsNullOrEmpty(result.BeginTime))
{
MaterialDataGrid.Clear();
MaterialDataGrid.Add(new MaterialComplateInfo() {
No = 1,
MaterialBarCode = "8659452123",
ProductPlanCode = "8659452123",
MaterialCode = "8659452123",
MaterialName = "SC-AUCMA-可口可乐SC",
PlanAmount = 50, CompleteAmount = 10 });
}
else
{
MaterialDataGrid.Clear();
LoadData();
}
//Datalist.Insert(0, Datalist[Datalist.Count - 1]);
//Datalist.RemoveAt(Datalist.Count - 1);
}));
}
#endregion
}
}