船名接口

optimize
hao 9 months ago
parent 1052ce0063
commit 3b9966178b

@ -12491,7 +12491,7 @@
<param name="dto"></param> <param name="dto"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Myshipping.Core.Service.DjyVesselInfoService.GetList(System.String,System.Nullable{System.DateTime},System.String,System.String)"> <member name="M:Myshipping.Core.Service.DjyVesselInfoService.GetList(System.String,System.Nullable{System.DateTime},System.String,System.String,System.Nullable{System.DateTime},System.Nullable{System.DateTime},System.String,System.Boolean)">
<summary> <summary>
下拉列表 下拉列表
</summary> </summary>

@ -139,17 +139,19 @@ namespace Myshipping.Core.Service
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpGet("/DjyVesselInfoService/GetList")] [HttpGet("/DjyVesselInfoService/GetList")]
public async Task<dynamic> GetList([FromQuery] string CarrierID, DateTime? ETD = null, string PortDischargeId = null, string KeyWord = "") public async Task<dynamic> 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<CodeVessel> list = await _sysCacheService.GetAllCodeVessel(); List<CodeVessel> 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 != ""). 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.IsNullOrWhiteSpace(KeyWord), x => x.Vessel.StartsWith(KeyWord.ToUpper())).
WhereIF(!string.IsNullOrEmpty(PortDischargeId), x => x.PortDischargeId == PortDischargeId). 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 => 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 == ""). WhereIF(!string.IsNullOrEmpty(CarrierID), x => x.CARRIERID == CarrierID || x.CARRIERID == null || x.CARRIERID == "").
Select(x => new Select(x => new
{ {
@ -157,16 +159,22 @@ namespace Myshipping.Core.Service
VoynoInside = x.VoynoInside, VoynoInside = x.VoynoInside,
Vessel = x.Vessel, Vessel = x.Vessel,
ETD = x.ETD == null ? "" : Convert.ToDateTime(x.ETD).ToString("yyyy-MM-dd"), 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"), ATD = x.ATD == null ? "" : Convert.ToDateTime(x.ATD).ToString("yyyy-MM-dd HH:mm:ss"),
PortDischargeId = x.PortDischargeId, PortDischargeId = x.PortDischargeId,
PortDischarge = x.PortDischarge, PortDischarge = x.PortDischarge,
ClosingDate = x.ClosingDate == null ? "" : Convert.ToDateTime(x.ClosingDate).ToString("yyyy-MM-dd HH:mm:ss"), 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"), 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" if (_sysCacheService.GetAllTenantParam().Result.Where(x => x.TenantId == UserManager.TENANT_ID && x.ParaCode == "VESSEL_FROM_CONFIG_ONLY").Select(x => x.ItemCode).FirstOrDefault() == "YES"
) )

Loading…
Cancel
Save