|
|
|
|
using Aucma.Scada.Business;
|
|
|
|
|
using GalaSoft.MvvmLight;
|
|
|
|
|
using GalaSoft.MvvmLight.Command;
|
|
|
|
|
using HighWayIot.Repository.domain;
|
|
|
|
|
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.Scada.UI.viewModel.InventoryInfo
|
|
|
|
|
{
|
|
|
|
|
public class SpaceDetailViewModel : ViewModelBase
|
|
|
|
|
{
|
|
|
|
|
private InventoryInfoBusiness inventoryInfoBusiness = InventoryInfoBusiness.Instance;
|
|
|
|
|
|
|
|
|
|
private string storeCode = string.Empty;
|
|
|
|
|
private string spaceCode = string.Empty;
|
|
|
|
|
public SpaceDetailViewModel(string storeCode, string spaceCode)
|
|
|
|
|
{
|
|
|
|
|
CloseWindowCommand = new RelayCommand<object>(t => CloseWindow(t));
|
|
|
|
|
QueryCommand = new RelayCommand(Query);
|
|
|
|
|
ResetCommand = new RelayCommand(Reset);
|
|
|
|
|
inventoryInfoBusiness.RefreshSpaceDetailsEvent += RefreshSpaceDetails;
|
|
|
|
|
this.storeCode = storeCode;
|
|
|
|
|
this.spaceCode = spaceCode;
|
|
|
|
|
TitleName = "货道明细信息";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 参数定义
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 物料编号
|
|
|
|
|
/// </summary>
|
|
|
|
|
private string materialCodeSearch;
|
|
|
|
|
public string MaterialCodeSearch
|
|
|
|
|
{
|
|
|
|
|
get { return materialCodeSearch; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
materialCodeSearch = value;
|
|
|
|
|
RaisePropertyChanged(nameof(MaterialCodeSearch));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 物料名称
|
|
|
|
|
/// </summary>
|
|
|
|
|
private string materialNameSearch;
|
|
|
|
|
public string MaterialNameSearch
|
|
|
|
|
{
|
|
|
|
|
get { return materialNameSearch; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
materialNameSearch = value;
|
|
|
|
|
RaisePropertyChanged(nameof(MaterialNameSearch));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private string titleName;
|
|
|
|
|
|
|
|
|
|
public string TitleName
|
|
|
|
|
{
|
|
|
|
|
get { return titleName; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
titleName = value;
|
|
|
|
|
RaisePropertyChanged(nameof(TitleName));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 计划列表DataGrid
|
|
|
|
|
/// </summary>
|
|
|
|
|
private ObservableCollection<BaseSpaceDetail> spaceDetailDataGrid;
|
|
|
|
|
|
|
|
|
|
public ObservableCollection<BaseSpaceDetail> SpaceDetailDataGrid
|
|
|
|
|
{
|
|
|
|
|
get { return spaceDetailDataGrid; }
|
|
|
|
|
set { spaceDetailDataGrid = value; RaisePropertyChanged(() => SpaceDetailDataGrid); }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 事件定义
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 关闭事件
|
|
|
|
|
/// </summary>
|
|
|
|
|
public RelayCommand<object> CloseWindowCommand { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 查询事件
|
|
|
|
|
/// </summary>
|
|
|
|
|
public RelayCommand QueryCommand { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 重置事件
|
|
|
|
|
/// </summary>
|
|
|
|
|
public RelayCommand ResetCommand { get; set; }
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
private void CloseWindow(object parameter)
|
|
|
|
|
{
|
|
|
|
|
var window = parameter as Window;
|
|
|
|
|
if (window != null)
|
|
|
|
|
{
|
|
|
|
|
window.Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 查询
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void Query()
|
|
|
|
|
{
|
|
|
|
|
var list = inventoryInfoBusiness.GetBaseSpaceDetails(this.storeCode, this.spaceCode);
|
|
|
|
|
if (!string.IsNullOrEmpty(materialCodeSearch))
|
|
|
|
|
{
|
|
|
|
|
list = list.Where(x => x.materialCode == materialCodeSearch).ToList();
|
|
|
|
|
}
|
|
|
|
|
else if (!string.IsNullOrEmpty(materialNameSearch))
|
|
|
|
|
{
|
|
|
|
|
list = list.Where(x => x.materialName == materialNameSearch).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RefreshSpaceDetails(list);
|
|
|
|
|
}
|
|
|
|
|
public void Reset()
|
|
|
|
|
{
|
|
|
|
|
MaterialCodeSearch = string.Empty;
|
|
|
|
|
MaterialNameSearch = string.Empty;
|
|
|
|
|
this.Query();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 刷新货道明细列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="spaceDetails"></param>
|
|
|
|
|
private void RefreshSpaceDetails(List<BaseSpaceDetail> spaceDetails)
|
|
|
|
|
{
|
|
|
|
|
SpaceDetailDataGrid = new ObservableCollection<BaseSpaceDetail>();
|
|
|
|
|
if (spaceDetails != null)
|
|
|
|
|
{
|
|
|
|
|
spaceDetails.ForEach(
|
|
|
|
|
arg =>
|
|
|
|
|
{
|
|
|
|
|
SpaceDetailDataGrid.Add(arg);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|