2024-01-31 10:21:57 +08:00

108 lines
4.6 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Core.Extensions;
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using HHWMS.Web.Models;
namespace HHWMS.Web
{
public partial class Material2ListVM : BasePagedListVM<Material2_View, Material2Searcher>
{
protected override List<GridAction> InitGridAction()
{
return new List<GridAction>
{
this.MakeStandardAction("Material2", GridActionStandardTypesEnum.Create, Localizer["Sys.Create"],"xwms", dialogWidth: 800),
this.MakeStandardAction("Material2", GridActionStandardTypesEnum.Edit, Localizer["Sys.Edit"], "xwms", dialogWidth: 800),
this.MakeStandardAction("Material2", GridActionStandardTypesEnum.Delete, Localizer["Sys.Delete"], "xwms", dialogWidth: 800),
this.MakeStandardAction("Material2", GridActionStandardTypesEnum.Details, Localizer["Sys.Details"], "xwms", dialogWidth: 800),
this.MakeStandardAction("Material2", GridActionStandardTypesEnum.BatchEdit, Localizer["Sys.BatchEdit"], "xwms", dialogWidth: 800),
this.MakeStandardAction("Material2", GridActionStandardTypesEnum.BatchDelete, Localizer["Sys.BatchDelete"], "xwms", dialogWidth: 800),
this.MakeStandardAction("Material2", GridActionStandardTypesEnum.Import, Localizer["Sys.Import"], "xwms", dialogWidth: 800),
this.MakeStandardAction("Material2", GridActionStandardTypesEnum.ExportExcel, Localizer["Sys.Export"], "xwms"),
};
}
protected override IEnumerable<IGridColumn<Material2_View>> InitGridHeader()
{
return new List<GridColumn<Material2_View>>{
this.MakeGridHeader(x => x.Code).SetWidth(150),
this.MakeGridHeader(x => x.Type),
this.MakeGridHeader(x => x.Name).SetWidth(150),
this.MakeGridHeader(x => x.MasterUnit),
this.MakeGridHeader(x => x.Specification),
this.MakeGridHeader(x => x.ClassA),
this.MakeGridHeaderAction(width: 200)
};
}
public override IOrderedQueryable<Material2_View> GetSearchQuery()
{
var dc2 = Wtm.CreateDC(cskey: "hangyong");
var query = dc2.Set<Material2>()
.Where(x => x.WarehouseId == 6)
.CheckContain(Searcher.Code, x => x.Code)
.CheckContain(Searcher.Name, x => x.Name)
.CheckContain(Searcher.Type, x => x.Type)
.Select(x => new Material2_View
{
ID = x.ID,
WarehouseId = x.WarehouseId,
WarehouseCode = x.WarehouseCode,
CompanyId = x.CompanyId,
CompanyCode = x.CompanyCode,
Code = x.Code,
Type = x.Type,
Name = x.Name,
Barcode = x.Barcode,
Barcode2 = x.Barcode2,
Barcode3 = x.Barcode3,
Barcode4 = x.Barcode4,
ClassA = x.ClassA,
ClassB = x.ClassB,
ClassC = x.ClassC,
Specification = x.Specification,
Brand = x.Brand,
Size = x.Size,
Color = x.Color,
PlaceOfOrigin = x.PlaceOfOrigin,
DaysToExpire = x.DaysToExpire,
ExpiringDays = x.ExpiringDays,
MinShelfLifeDays = x.MinShelfLifeDays,
CostPrice = x.CostPrice,
ListPrice = x.ListPrice,
NetPrice = x.NetPrice,
MasterUnit = x.MasterUnit,
AssistUnit = x.AssistUnit,
ConvertRate = x.ConvertRate,
ManufactureDate = x.ManufactureDate,
ReceiptDate = x.ReceiptDate,
Enable = x.Enable,
Deleted = x.Deleted,
UserDef1 = x.UserDef1,
UserDef2 = x.UserDef2,
UserDef3 = x.UserDef3,
UserDef4 = x.UserDef4,
UserDef5 = x.UserDef5,
UserDef6 = x.UserDef6,
UserDef7 = x.UserDef7,
UserDef8 = x.UserDef8,
ZoneCode = x.ZoneCode,
})
.OrderBy(x => x.ID);
return query;
}
}
public class Material2_View : Material2{
}
}