108 lines
5.5 KiB
C#
108 lines
5.5 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using HHWMS.Web.Models;
|
|
using WalkingTec.Mvvm.Core;
|
|
using WalkingTec.Mvvm.Core.Extensions;
|
|
|
|
namespace HHWMS.Web
|
|
{
|
|
public partial class ShipmentHeaderListVM : BasePagedListVM<ShipmentHeader_View, ShipmentHeaderSearcher>
|
|
{
|
|
public List<ComboSelectListItem> ShipTypes { get; set; }
|
|
protected override void InitVM()
|
|
{
|
|
var vm = Wtm.CreateVM<ShipmentHeaderVM>();
|
|
ShipTypes = vm.ShipTypes;
|
|
}
|
|
protected override List<GridAction> InitGridAction()
|
|
{
|
|
return new List<GridAction>
|
|
{
|
|
// 暂时不需要“获取ERP发货通知单”,按钮先注释掉
|
|
//this.MakeAction("ShipmentHeader", "GetShipmentDetails", "获取ERP发货通知单", "",
|
|
// GridActionParameterTypesEnum.NoId, "shipment")
|
|
// .SetSize(500, 260),
|
|
this.MakeAction("ShipmentHeader", "Allocate", "分配/下发", "",
|
|
GridActionParameterTypesEnum.SingleId, "shipment")
|
|
.SetSize(1250, 820)
|
|
.SetBindVisiableColName(nameof(ShipmentHeader_View.CanAllocateErp)),
|
|
this.MakeAction("ShipmentHeader", "StartOut", Localizer["ShipmentHeader.StartOut"], "",
|
|
GridActionParameterTypesEnum.SingleId, "shipment")
|
|
.SetBindVisiableColName(nameof(ShipmentHeader_View.CanStartLegacyOut)),
|
|
this.MakeStandardAction("ShipmentHeader", GridActionStandardTypesEnum.Create, Localizer["Sys.Create"],"shipment", dialogWidth: 800),
|
|
this.MakeStandardAction("ShipmentHeader", GridActionStandardTypesEnum.Edit, Localizer["Sys.Edit"], "shipment", dialogWidth: 800),
|
|
this.MakeStandardAction("ShipmentHeader", GridActionStandardTypesEnum.Delete, Localizer["Sys.Delete"], "shipment", dialogWidth: 800),
|
|
this.MakeStandardAction("ShipmentHeader", GridActionStandardTypesEnum.Details, Localizer["Sys.Details"], "shipment", dialogWidth: 800),
|
|
this.MakeStandardAction("ShipmentHeader", GridActionStandardTypesEnum.BatchEdit, Localizer["Sys.BatchEdit"], "shipment", dialogWidth: 800),
|
|
this.MakeStandardAction("ShipmentHeader", GridActionStandardTypesEnum.BatchDelete, Localizer["Sys.BatchDelete"], "shipment", dialogWidth: 800),
|
|
this.MakeStandardAction("ShipmentHeader", GridActionStandardTypesEnum.Import, Localizer["Sys.Import"], "shipment", dialogWidth: 800),
|
|
this.MakeStandardAction("ShipmentHeader", GridActionStandardTypesEnum.ExportExcel, Localizer["Sys.Export"], "shipment"),
|
|
};
|
|
}
|
|
|
|
protected override IEnumerable<IGridColumn<ShipmentHeader_View>> InitGridHeader()
|
|
{
|
|
InitVM();
|
|
return new List<GridColumn<ShipmentHeader_View>>{
|
|
//this.MakeGridHeader(x => x.SourceCode),
|
|
this.MakeGridHeader(x => x.Code),
|
|
this.MakeGridHeader(x => x.SourceCode),
|
|
this.MakeGridHeader(x => x.BillType)
|
|
.SetFormat((a, b) =>
|
|
{
|
|
var data = ShipTypes.FirstOrDefault(x => x.Value.ToString() == a.BillType);
|
|
return data?.Text ?? a.BillType;
|
|
}),
|
|
//this.MakeGridHeader(x => x.CompanyCode),
|
|
//this.MakeGridHeader(x => x.SupplierCode),
|
|
//this.MakeGridHeader(x => x.TotalQty),
|
|
//this.MakeGridHeader(x => x.TotalLines),
|
|
this.MakeGridHeader(x => x.FirstStatus),
|
|
//this.MakeGridHeader(x => x.LastStatus),
|
|
this.MakeGridHeader(x => x.Remark),
|
|
this.MakeGridHeader(x => x.CanAllocateErp).SetHide(),
|
|
this.MakeGridHeader(x => x.CanStartLegacyOut).SetHide(),
|
|
this.MakeGridHeaderAction(width: 360)
|
|
};
|
|
}
|
|
|
|
public override IOrderedQueryable<ShipmentHeader_View> GetSearchQuery()
|
|
{
|
|
var erpHeaderIds = DC.Set<ShipmentDetail>()
|
|
.Where(x => x.DLsID.HasValue)
|
|
.Select(x => x.HeaderId);
|
|
var query = DC.Set<ShipmentHeader>()
|
|
.CheckContain(Searcher.SourceCode, x => x.SourceCode)
|
|
.CheckContain(Searcher.Code, x => x.Code)
|
|
.CheckContain(Searcher.BillType, x => x.BillType)
|
|
.CheckEqual(Searcher.FirstStatus, x => x.FirstStatus)
|
|
.CheckContain(Searcher.Remark, x => x.Remark)
|
|
.Select(x => new ShipmentHeader_View
|
|
{
|
|
ID = x.ID,
|
|
SourceCode = x.SourceCode,
|
|
Code = x.Code,
|
|
BillType = x.BillType,
|
|
CompanyCode = x.CompanyCode,
|
|
SupplierCode = x.SupplierCode,
|
|
TotalQty = x.TotalQty,
|
|
TotalLines = x.TotalLines,
|
|
FirstStatus = x.FirstStatus,
|
|
LastStatus = x.LastStatus,
|
|
Remark = x.Remark,
|
|
CanAllocateErp = erpHeaderIds.Contains(x.ID) ? "true" : "false",
|
|
CanStartLegacyOut = erpHeaderIds.Contains(x.ID) ? "false" : "true",
|
|
})
|
|
.OrderByDescending(x => x.ID);
|
|
return query;
|
|
}
|
|
}
|
|
|
|
public class ShipmentHeader_View : ShipmentHeader
|
|
{
|
|
public string CanAllocateErp { get; set; }
|
|
|
|
public string CanStartLegacyOut { get; set; }
|
|
}
|
|
}
|