|
|
|
@ -33,9 +33,13 @@ namespace Myshipping.Core.Service
|
|
|
|
|
/// <param name="KeyWord"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet("/DjyVesselInfoService/GetListPage")]
|
|
|
|
|
public async Task<dynamic> GetListPage([FromQuery] string KeyWord) {
|
|
|
|
|
public async Task<dynamic> GetListPage([FromQuery] string KeyWord)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
return await _rep.AsQueryable().WhereIF(!string.IsNullOrWhiteSpace(KeyWord), x => x.Vessel.Contains(KeyWord)).ToListAsync();
|
|
|
|
|
return await _rep.AsQueryable().WhereIF(!string.IsNullOrWhiteSpace(KeyWord), x => x.Vessel.Contains(KeyWord)
|
|
|
|
|
|| x.CARRIER.Contains(KeyWord) || x.Voyno.Contains(KeyWord) || x.PortLoading.Contains(KeyWord) || x.PortTransit.Contains(KeyWord) ||
|
|
|
|
|
x.PortDischarge.Contains(KeyWord) || x.VoynoInside.Contains(KeyWord)
|
|
|
|
|
).ToListAsync();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -59,7 +63,7 @@ namespace Myshipping.Core.Service
|
|
|
|
|
/// <param name="dto"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("/DjyVesselInfoService/AddOrUpdate")]
|
|
|
|
|
public async Task<long> AddOrUpdate(DjyVesselInfo dto)
|
|
|
|
|
public async Task<long> AddOrUpdate(DjyVesselInfoDto dto)
|
|
|
|
|
{
|
|
|
|
|
if (dto == null)
|
|
|
|
|
{
|
|
|
|
@ -67,11 +71,15 @@ namespace Myshipping.Core.Service
|
|
|
|
|
}
|
|
|
|
|
if (dto.Id == 0)
|
|
|
|
|
{
|
|
|
|
|
await _rep.InsertAsync(dto);
|
|
|
|
|
var entity = dto.Adapt<DjyVesselInfo>();
|
|
|
|
|
|
|
|
|
|
await _rep.InsertAsync(entity);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
await _rep.AsUpdateable(dto).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
|
|
|
|
var entity = dto.Adapt<DjyVesselInfo>();
|
|
|
|
|
|
|
|
|
|
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
return dto.Id;
|
|
|
|
|
}
|
|
|
|
@ -82,31 +90,33 @@ namespace Myshipping.Core.Service
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet("/DjyVesselInfoService/GetList")]
|
|
|
|
|
public async Task<dynamic> GetList([FromQuery] string KeyWord, string CarrierID)
|
|
|
|
|
public async Task<dynamic> GetList([FromQuery] string CarrierID, string KeyWord = "")
|
|
|
|
|
{
|
|
|
|
|
//获取船名
|
|
|
|
|
List<CodeVessel> list = await _sysCacheService.GetAllCodeVessel();
|
|
|
|
|
|
|
|
|
|
var tlist = await _rep.AsQueryable().Where(x => x.Vessel.Contains(KeyWord) && x.CARRIERID == CarrierID&&x.ETD>DateTime.Now.AddDays(-7)).
|
|
|
|
|
Select(x=> new {
|
|
|
|
|
Voyno =x.Voyno,
|
|
|
|
|
VoynoInside =x.VoynoInside,
|
|
|
|
|
var tlist = await _rep.AsQueryable().WhereIF(!string.IsNullOrWhiteSpace(KeyWord), x => x.Vessel.Contains(KeyWord)).
|
|
|
|
|
Where(x=> x.CARRIERID == CarrierID && x.ETD > DateTime.Now.AddDays(-7)).
|
|
|
|
|
Select(x => new
|
|
|
|
|
{
|
|
|
|
|
Voyno = x.Voyno,
|
|
|
|
|
VoynoInside = x.VoynoInside,
|
|
|
|
|
Vessel = x.Vessel,
|
|
|
|
|
ETD =x.ETD,
|
|
|
|
|
ETD = x.ETD,
|
|
|
|
|
ATD = x.ATD,
|
|
|
|
|
}).Take(20).
|
|
|
|
|
ToListAsync();
|
|
|
|
|
|
|
|
|
|
if (tlist.Count() == 0)
|
|
|
|
|
{
|
|
|
|
|
return list.Where(x => x.Name.Contains(KeyWord)).Select(x => new
|
|
|
|
|
return list.WhereIF(!string.IsNullOrWhiteSpace(KeyWord), x => x.Name.Contains(KeyWord)).Select(x => new
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
Voyno = "",
|
|
|
|
|
VoynoInside="",
|
|
|
|
|
VoynoInside = "",
|
|
|
|
|
Vessel = x.Name,
|
|
|
|
|
ETD = "",
|
|
|
|
|
ATD="",
|
|
|
|
|
ATD = "",
|
|
|
|
|
}).Take(20).ToList();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|