|
|
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));
|
|
|
public EnterWarehouseStatisticsPageViewModel() { LoadData(); }
|
|
|
List<MaterialComplateInfo> materialComplateInfos = new List<MaterialComplateInfo>();
|
|
|
|
|
|
#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 });
|
|
|
MaterialDataGrid.Add(new MaterialComplateInfo() { No = 2,MaterialBarCode= "8659452123", ProductPlanCode = "8659452123", MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉,SC", PlanAmount = 60, CompleteAmount = 40, EnterWarehouseTime=DateTime.Now });
|
|
|
MaterialDataGrid.Add(new MaterialComplateInfo() { No = 3,MaterialBarCode= "8659452123", ProductPlanCode = "8659452123", MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉,SC", PlanAmount = 50, CompleteAmount = 10, EnterWarehouseTime=DateTime.Now });
|
|
|
MaterialDataGrid.Add(new MaterialComplateInfo() { No = 4,MaterialBarCode= "8659452123", ProductPlanCode = "8659452123", MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉,SC", PlanAmount = 40, CompleteAmount = 10, EnterWarehouseTime=DateTime.Now });
|
|
|
MaterialDataGrid.Add(new MaterialComplateInfo() { No = 5,MaterialBarCode= "8659452123", ProductPlanCode = "8659452123", MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉,SC", PlanAmount = 30, CompleteAmount = 10, EnterWarehouseTime=DateTime.Now });
|
|
|
MaterialDataGrid.Add(new MaterialComplateInfo() { No = 6,MaterialBarCode= "8659452123", ProductPlanCode = "8659452123", MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉,SC", PlanAmount = 50, CompleteAmount = 20, EnterWarehouseTime=DateTime.Now });
|
|
|
MaterialDataGrid.Add(new MaterialComplateInfo() { No = 7,MaterialBarCode= "8659452123", ProductPlanCode = "8659452123", MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉,SC", PlanAmount = 10, CompleteAmount = 10, EnterWarehouseTime=DateTime.Now });
|
|
|
MaterialDataGrid.Add(new MaterialComplateInfo() { No = 8,MaterialBarCode= "8659452123", ProductPlanCode = "8659452123", MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉,SC", PlanAmount = 50, CompleteAmount = 10, EnterWarehouseTime = DateTime.Now });
|
|
|
MaterialDataGrid.Add(new MaterialComplateInfo() { No = 9, MaterialBarCode = "8659452123", ProductPlanCode = "8659452123", MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉,SC", PlanAmount = 80, CompleteAmount = 10, EnterWarehouseTime = DateTime.Now });
|
|
|
MaterialDataGrid.Add(new MaterialComplateInfo() { No = 10, 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;
|
|
|
}
|
|
|
var beginTime = result.BeginTime;
|
|
|
var endTime = result.EndTime;
|
|
|
|
|
|
System.Windows.Application.Current.Dispatcher.Invoke((Action)(() =>
|
|
|
{
|
|
|
if (!string.IsNullOrEmpty(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
|
|
|
|
|
|
}
|
|
|
}
|