|
|
|
@ -150,15 +150,22 @@ namespace Myshipping.Core.Service
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet("/DjyVesselInfoService/GetList")]
|
|
|
|
|
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, int limit = 20)
|
|
|
|
|
public async Task<dynamic> GetList([FromQuery] string CarrierID,
|
|
|
|
|
DateTime? ETD = null,
|
|
|
|
|
string PortDischargeId = null,
|
|
|
|
|
string PortLoadingId = null,
|
|
|
|
|
string KeyWord = "",
|
|
|
|
|
DateTime? etdStart = null,
|
|
|
|
|
DateTime? etdEnd = null,
|
|
|
|
|
string sortField = null,
|
|
|
|
|
bool descSort = false,
|
|
|
|
|
int limit = 20)
|
|
|
|
|
{
|
|
|
|
|
//获取船名
|
|
|
|
|
List<CodeVessel> list = await _sysCacheService.GetAllCodeVessel();
|
|
|
|
|
|
|
|
|
|
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(!string.IsNullOrEmpty(PortLoadingId), x => x.PortLoadingId == PortLoadingId).
|
|
|
|
|
WhereIF(ETD != null, x => Convert.ToDateTime(x.ETD).ToString("yyyy-MM-dd") == Convert.ToDateTime(ETD).ToString("yyyy-MM-dd")).//船期关联船名
|
|
|
|
|
WhereIF(ETD == null && etdStart == null && etdEnd == null, x => x.ETD > DateTime.Now.AddDays(-7)).//领导需求当前日期7天之前
|
|
|
|
|
WhereIF(etdStart.HasValue, x => x.ETD >= etdStart).
|
|
|
|
@ -183,6 +190,7 @@ namespace Myshipping.Core.Service
|
|
|
|
|
query = query.OrderBy(PageInputOrder.OrderBuilder(sortField, descSort));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var tlist = await query
|
|
|
|
|
.Take(limit)
|
|
|
|
|
.ToListAsync();
|
|
|
|
@ -193,26 +201,55 @@ namespace Myshipping.Core.Service
|
|
|
|
|
return tlist;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var ves = tlist.Select(x => x.Vessel).ToList();
|
|
|
|
|
var all = list.WhereIF(!string.IsNullOrWhiteSpace(KeyWord), x => x.Name.StartsWith(KeyWord.ToUpper())).
|
|
|
|
|
Select(x => new
|
|
|
|
|
List<CodeVessel> commonList = await _sysCacheService.GetAllCodeVessel();
|
|
|
|
|
if (string.IsNullOrEmpty(KeyWord))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
Voyno = "",
|
|
|
|
|
VoynoInside = "",
|
|
|
|
|
Vessel = x.Name,
|
|
|
|
|
ETD = "",
|
|
|
|
|
ATD = "",
|
|
|
|
|
PortDischargeId = "",
|
|
|
|
|
PortDischarge = ""
|
|
|
|
|
}).Take(limit).ToList();
|
|
|
|
|
foreach (var item in ves)
|
|
|
|
|
foreach (var item in commonList)
|
|
|
|
|
{
|
|
|
|
|
if (tlist.Count >= 10)
|
|
|
|
|
{
|
|
|
|
|
return tlist;
|
|
|
|
|
}
|
|
|
|
|
if (tlist.Any(x => x.Vessel == item.Name))
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
tlist.Add(new
|
|
|
|
|
{
|
|
|
|
|
Voyno = "",
|
|
|
|
|
VoynoInside = "",
|
|
|
|
|
Vessel = item.Name,
|
|
|
|
|
ETD = "",
|
|
|
|
|
ATD = "",
|
|
|
|
|
PortDischargeId = "",
|
|
|
|
|
PortDischarge = "",
|
|
|
|
|
ClosingDate = "",
|
|
|
|
|
CloseDocTime = ""
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
return tlist;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
all.RemoveAll(x => x.Vessel.StartsWith(item));
|
|
|
|
|
commonList = commonList.Where(x => x.Name.StartsWith(KeyWord.ToUpper())).ToList();
|
|
|
|
|
foreach (var item in tlist)
|
|
|
|
|
{
|
|
|
|
|
commonList.RemoveAll(x => x.Name == item.Vessel);
|
|
|
|
|
}
|
|
|
|
|
var temp = commonList.Select(x => new
|
|
|
|
|
{
|
|
|
|
|
Voyno = "",
|
|
|
|
|
VoynoInside = "",
|
|
|
|
|
Vessel = x.Name,
|
|
|
|
|
ETD = "",
|
|
|
|
|
ATD = "",
|
|
|
|
|
PortDischargeId = "",
|
|
|
|
|
PortDischarge = "",
|
|
|
|
|
ClosingDate = "",
|
|
|
|
|
CloseDocTime = ""
|
|
|
|
|
});
|
|
|
|
|
return tlist.Union(temp);
|
|
|
|
|
}
|
|
|
|
|
return tlist.Union<dynamic>(all);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|