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.

65 lines
2.0 KiB
C#

using Admin.Core.Common;
using Admin.Core.IService;
using Aucma.Core.BoxFoaming.Models;
using CommunityToolkit.Mvvm.ComponentModel;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
/*
* 货道明细
* */
namespace Aucma.Core.BoxFoaming.ViewModels
{
public partial class SpaceDetailModelView : ObservableObject
{
public readonly IBaseSpaceDetailServices? _baseSpaceDetailServices;
public SpaceDetailModelView()
{
}
public SpaceDetailModelView(string storeCode,string spaceCode)
{
_baseSpaceDetailServices = App.ServiceProvider.GetService<IBaseSpaceDetailServices>();
LoadData(storeCode, spaceCode);
}
#region 加载DataGrid数据
private async void LoadData(string storeCode, string spaceCode)
{
spaceDetilDataGrid.Clear();
var list = await _baseSpaceDetailServices.QueryAsync(d => d.StoreCode.Equals(storeCode) && d.SpaceCode.Equals(spaceCode));
foreach (var item in list.OrderBy(d => d.CreatedTime))
{
spaceDetilDataGrid.Add(new SpaceDetailView()
{
ObjId = item.ObjId,
StoreCode = item.StoreCode,
SpaceCode = item.SpaceCode,
MaterialCode = item.MaterialCode,
MaterialName = item.MaterialName,
MaterialType = item.MaterialType,
CreatedTime = item.CreatedTime
});
};
}
#endregion
#region 初始化datagrid
private ObservableCollection<SpaceDetailView> spaceDetilDataGrid = new ObservableCollection<SpaceDetailView>();
public ObservableCollection<SpaceDetailView> SpaceDetilDataGrid
{
get => spaceDetilDataGrid;
set => SetProperty(ref spaceDetilDataGrid, value);
}
#endregion
}
}