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.
126 lines
3.5 KiB
C#
126 lines
3.5 KiB
C#
using Admin.Core.Model;
|
|
using Aucma.Scada.UI;
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
using CommunityToolkit.Mvvm.Input;
|
|
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.Linq;
|
|
using System.Windows;
|
|
|
|
namespace Aucma.Scada.UI.ViewModel.InventoryInfo
|
|
{
|
|
public partial class SpaceDetailViewModel : ObservableObject
|
|
{
|
|
private InventoryInfoBusiness inventoryInfoBusiness = new InventoryInfoBusiness();// InventoryInfoBusiness.Instance;
|
|
|
|
private string storeCode = string.Empty;
|
|
private string spaceCode = string.Empty;
|
|
public SpaceDetailViewModel(string storeCode, string spaceCode)
|
|
{
|
|
inventoryInfoBusiness.RefreshSpaceDetailsEvent += RefreshSpaceDetails;
|
|
this.storeCode = storeCode;
|
|
this.spaceCode = spaceCode;
|
|
TitleName = "货道明细信息";
|
|
}
|
|
|
|
#region 参数定义
|
|
|
|
/// <summary>
|
|
/// 物料编号
|
|
/// </summary>
|
|
private string materialCodeSearch;
|
|
public string MaterialCodeSearch
|
|
{
|
|
get => materialCodeSearch;
|
|
set => SetProperty(ref materialCodeSearch, value);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 物料名称
|
|
/// </summary>
|
|
private string materialNameSearch;
|
|
public string MaterialNameSearch
|
|
{
|
|
get => materialNameSearch;
|
|
set => SetProperty(ref materialNameSearch, value);
|
|
}
|
|
|
|
private string titleName;
|
|
|
|
public string TitleName
|
|
{
|
|
get => titleName;
|
|
set => SetProperty(ref titleName, value);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 计划列表DataGrid
|
|
/// </summary>
|
|
private ObservableCollection<BaseSpaceDetail> spaceDetailDataGrid;
|
|
|
|
public ObservableCollection<BaseSpaceDetail> SpaceDetailDataGrid
|
|
{
|
|
get => spaceDetailDataGrid;
|
|
set => SetProperty(ref spaceDetailDataGrid, value);
|
|
}
|
|
#endregion
|
|
|
|
|
|
[RelayCommand]
|
|
private void CloseWindow(object parameter)
|
|
{
|
|
var window = parameter as Window;
|
|
if (window != null)
|
|
{
|
|
window.Close();
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查询
|
|
/// </summary>
|
|
[RelayCommand]
|
|
private async void Query()
|
|
{
|
|
var list =await 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);
|
|
}
|
|
[RelayCommand]
|
|
public void Reset()
|
|
{
|
|
MaterialCodeSearch = string.Empty;
|
|
MaterialNameSearch = string.Empty;
|
|
this.Query();
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 刷新货道明细列表
|
|
/// </summary>
|
|
/// <param name="spaceDetails"></param>
|
|
[RelayCommand]
|
|
private void RefreshSpaceDetails(List<BaseSpaceDetail> spaceDetails)
|
|
{
|
|
SpaceDetailDataGrid = new ObservableCollection<BaseSpaceDetail>();
|
|
if (spaceDetails != null)
|
|
{
|
|
spaceDetails.ForEach(
|
|
arg =>
|
|
{
|
|
SpaceDetailDataGrid.Add(arg);
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|