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.

33 lines
1.5 KiB
C#

using System.Collections.Generic;
using System.Linq.Expressions;
using Sln.Wcs.Model.Domain;
using Sln.Wcs.Repository.service;
using Sln.Wcs.UI.ViewModels.Base;
namespace Sln.Wcs.UI.ViewModels.Base;
public class MaterialInfoViewModel : CrudPageViewModel<BaseMaterialInfo>
{
public MaterialInfoViewModel(IBaseMaterialInfoService service) : base(service)
{
PageTitle = "物料信息管理";
}
public override List<FieldConfig> FieldConfigs => new()
{
new() { PropertyName = "materialCode", DisplayName = "物料编号", IsRequired = true },
new() { PropertyName = "materialName", DisplayName = "物料名称" },
new() { PropertyName = "materialType", DisplayName = "物料类型" },
new() { PropertyName = "materialBarcode", DisplayName = "物料条码" },
new() { PropertyName = "minStorageCycle", DisplayName = "最短存放周期", FieldType = FieldType.Number },
new() { PropertyName = "maxStorageCycle", DisplayName = "最长存放周期", FieldType = FieldType.Number },
new() { PropertyName = "isFlag", DisplayName = "启用", FieldType = FieldType.CheckBox },
new() { PropertyName = "remark", DisplayName = "备注" },
};
protected override Expression<Func<BaseMaterialInfo, bool>>? BuildSearchExpression(string search)
=> x => x.materialCode.Contains(search) || (x.materialName != null && x.materialName.Contains(search));
public override Avalonia.Controls.Control CreateView() => new Sln.Wcs.UI.Views.Base.MaterialInfoListView();
}