98 lines
4.2 KiB
C#
98 lines
4.2 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 ProcessConfigListVM : BasePagedListVM<ProcessConfig_View, ProcessConfigSearcher>
|
|
{
|
|
public List<ComboSelectListItem> AllZones { get; set; }
|
|
public List<ComboSelectListItem> AllOutPorts { get; set; }
|
|
|
|
protected override void InitVM()
|
|
{
|
|
var vm = Wtm.CreateVM<ProcessConfigVM>();
|
|
AllZones = vm.AllZones;
|
|
AllOutPorts = vm.AllOutPorts;
|
|
}
|
|
|
|
protected override List<GridAction> InitGridAction()
|
|
{
|
|
return new List<GridAction>
|
|
{
|
|
this.MakeStandardAction("ProcessConfig", GridActionStandardTypesEnum.Create, Localizer["Sys.Create"],"configs", dialogWidth: 800),
|
|
this.MakeStandardAction("ProcessConfig", GridActionStandardTypesEnum.Edit, Localizer["Sys.Edit"], "configs", dialogWidth: 800),
|
|
this.MakeStandardAction("ProcessConfig", GridActionStandardTypesEnum.Delete, Localizer["Sys.Delete"], "configs", dialogWidth: 800),
|
|
this.MakeStandardAction("ProcessConfig", GridActionStandardTypesEnum.Details, Localizer["Sys.Details"], "configs", dialogWidth: 800),
|
|
this.MakeStandardAction("ProcessConfig", GridActionStandardTypesEnum.BatchEdit, Localizer["Sys.BatchEdit"], "configs", dialogWidth: 800),
|
|
this.MakeStandardAction("ProcessConfig", GridActionStandardTypesEnum.BatchDelete, Localizer["Sys.BatchDelete"], "configs", dialogWidth: 800),
|
|
this.MakeStandardAction("ProcessConfig", GridActionStandardTypesEnum.Import, Localizer["Sys.Import"], "configs", dialogWidth: 800),
|
|
this.MakeStandardAction("ProcessConfig", GridActionStandardTypesEnum.ExportExcel, Localizer["Sys.Export"], "configs"),
|
|
};
|
|
}
|
|
|
|
|
|
protected override IEnumerable<IGridColumn<ProcessConfig_View>> InitGridHeader()
|
|
{
|
|
InitVM();
|
|
return new List<GridColumn<ProcessConfig_View>>{
|
|
this.MakeGridHeader(x => x.Code),
|
|
this.MakeGridHeader(x => x.Name),
|
|
this.MakeGridHeader(x => x.Zone)
|
|
.SetFormat((a, b) =>
|
|
{
|
|
var data = AllZones.FirstOrDefault(x => x.Value.ToString() == a.Zone);
|
|
return data?.Text ?? a.Zone;
|
|
}),
|
|
this.MakeGridHeader(x => x.Port)
|
|
.SetFormat((a, b) =>
|
|
{
|
|
var data = AllOutPorts.FirstOrDefault(x => x.Value.ToString() == a.Port);
|
|
return data?.Text ?? a.Port;
|
|
}),
|
|
this.MakeGridHeader(x => x.Spare1).SetHide(),
|
|
this.MakeGridHeader(x => x.Spare2).SetHide(),
|
|
this.MakeGridHeader(x => x.Spare3).SetHide(),
|
|
this.MakeGridHeaderAction(width: 200)
|
|
};
|
|
}
|
|
|
|
public override IOrderedQueryable<ProcessConfig_View> GetSearchQuery()
|
|
{
|
|
var query = DC.Set<ProcessConfig>()
|
|
.CheckContain(Searcher.Code, x=>x.Code)
|
|
.CheckContain(Searcher.Name, x=>x.Name)
|
|
.CheckContain(Searcher.Zone, x=>x.Zone)
|
|
.CheckContain(Searcher.Port, x=>x.Port)
|
|
.CheckContain(Searcher.Spare1, x=>x.Spare1)
|
|
.CheckContain(Searcher.Spare2, x=>x.Spare2)
|
|
.CheckContain(Searcher.Spare3, x=>x.Spare3)
|
|
.Select(x => new ProcessConfig_View
|
|
{
|
|
ID = x.ID,
|
|
Code = x.Code,
|
|
Name = x.Name,
|
|
Zone = x.Zone,
|
|
Port = x.Port,
|
|
Spare1 = x.Spare1,
|
|
Spare2 = x.Spare2,
|
|
Spare3 = x.Spare3,
|
|
})
|
|
.OrderBy(x => x.ID);
|
|
return query;
|
|
}
|
|
|
|
}
|
|
|
|
public class ProcessConfig_View : ProcessConfig{
|
|
|
|
}
|
|
}
|