diff --git a/Myshipping.Core/Myshipping.Core.xml b/Myshipping.Core/Myshipping.Core.xml index b567182e..cce0aa74 100644 --- a/Myshipping.Core/Myshipping.Core.xml +++ b/Myshipping.Core/Myshipping.Core.xml @@ -12491,7 +12491,7 @@ - + 下拉列表 diff --git a/Myshipping.Core/Service/DjyVesselInfo/DjyVesselInfoService.cs b/Myshipping.Core/Service/DjyVesselInfo/DjyVesselInfoService.cs index 92a1ce27..5be63d57 100644 --- a/Myshipping.Core/Service/DjyVesselInfo/DjyVesselInfoService.cs +++ b/Myshipping.Core/Service/DjyVesselInfo/DjyVesselInfoService.cs @@ -139,17 +139,19 @@ namespace Myshipping.Core.Service /// /// [HttpGet("/DjyVesselInfoService/GetList")] - public async Task GetList([FromQuery] string CarrierID, DateTime? ETD = null, string PortDischargeId = null, string KeyWord = "") + public async Task GetList([FromQuery] string CarrierID, DateTime? ETD = null, string PortDischargeId = null, string KeyWord = "", DateTime? etdStart = null, DateTime? etdEnd = null, string sortField = null, bool descSort = false) { //获取船名 List list = await _sysCacheService.GetAllCodeVessel(); - var tlist = await _rep.AsQueryable().Filter(null, true). + var query = _rep.AsQueryable().Filter(null, true). Where(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false && x.CARRIERID != null && x.CARRIERID != ""). WhereIF(!string.IsNullOrWhiteSpace(KeyWord), x => x.Vessel.StartsWith(KeyWord.ToUpper())). WhereIF(!string.IsNullOrEmpty(PortDischargeId), x => x.PortDischargeId == PortDischargeId). WhereIF(ETD != null, x => Convert.ToDateTime(x.ETD).ToString("yyyy-MM-dd") == Convert.ToDateTime(ETD).ToString("yyyy-MM-dd")).//船期关联船名 - WhereIF(ETD == null, x => x.ETD > DateTime.Now.AddDays(-7)).//领导需求当前日期7天之前 + WhereIF(ETD == null && etdStart == null && etdEnd == null, x => x.ETD > DateTime.Now.AddDays(-7)).//领导需求当前日期7天之前 + WhereIF(etdStart.HasValue, x => x.ETD >= etdStart). + WhereIF(etdEnd.HasValue, x => x.ETD <= etdEnd). WhereIF(!string.IsNullOrEmpty(CarrierID), x => x.CARRIERID == CarrierID || x.CARRIERID == null || x.CARRIERID == ""). Select(x => new { @@ -157,16 +159,22 @@ namespace Myshipping.Core.Service VoynoInside = x.VoynoInside, Vessel = x.Vessel, ETD = x.ETD == null ? "" : Convert.ToDateTime(x.ETD).ToString("yyyy-MM-dd"), - //日期和时间都要 ATD = x.ATD == null ? "" : Convert.ToDateTime(x.ATD).ToString("yyyy-MM-dd HH:mm:ss"), - PortDischargeId = x.PortDischargeId, PortDischarge = x.PortDischarge, ClosingDate = x.ClosingDate == null ? "" : Convert.ToDateTime(x.ClosingDate).ToString("yyyy-MM-dd HH:mm:ss"), CloseDocTime = x.CloseDocTime == null ? "" : Convert.ToDateTime(x.CloseDocTime).ToString("yyyy-MM-dd HH:mm:ss"), - }).Take(20). - ToListAsync(); + }); + + if (!string.IsNullOrEmpty(sortField)) + { + query = query.OrderBy(PageInputOrder.OrderBuilder(sortField, descSort)); + } + + var tlist=await query + .Take(20) + .ToListAsync(); if (_sysCacheService.GetAllTenantParam().Result.Where(x => x.TenantId == UserManager.TENANT_ID && x.ParaCode == "VESSEL_FROM_CONFIG_ONLY").Select(x => x.ItemCode).FirstOrDefault() == "YES" )