|
|
|
@ -334,5 +334,119 @@ namespace Myshipping.Application
|
|
|
|
|
var result = new FileStreamResult(new FileStream(fileFullPath, FileMode.Open), "application/octet-stream") { FileDownloadName = fileName };
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 检索订舱信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="query">检索条件</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
[HttpPost("/TaskManageBC/QueryBookingOrderList")]
|
|
|
|
|
public async Task<TaskManageOrderResultDto> QueryBookingOrderList([FromBody] BookingOrderBCQuery query)
|
|
|
|
|
{
|
|
|
|
|
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
bool isAvailable = false;
|
|
|
|
|
|
|
|
|
|
var queryWhere = _bookingOrderRepository.AsQueryable();
|
|
|
|
|
|
|
|
|
|
#region 查询条件
|
|
|
|
|
if (query.beginETD.HasValue || query.endETD.HasValue)
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
起始结束时间间隔不能超过7天
|
|
|
|
|
*/
|
|
|
|
|
DateTime beginDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
|
|
|
|
|
DateTime endDate = beginDate;
|
|
|
|
|
|
|
|
|
|
if (query.beginETD.HasValue)
|
|
|
|
|
beginDate = query.beginETD.Value;
|
|
|
|
|
|
|
|
|
|
if (query.endETD.HasValue)
|
|
|
|
|
endDate = query.endETD.Value;
|
|
|
|
|
|
|
|
|
|
if (endDate > beginDate.AddDays(7))
|
|
|
|
|
throw Oops.Oh($"船期的日期范围不能超过7天");
|
|
|
|
|
|
|
|
|
|
endDate = endDate.AddDays(1);
|
|
|
|
|
|
|
|
|
|
queryWhere = queryWhere.Where(a => a.ETD >= beginDate && a.ETD < endDate);
|
|
|
|
|
|
|
|
|
|
isAvailable = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (query.beginCreated.HasValue || query.endCreated.HasValue)
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
起始结束时间间隔不能超过7天
|
|
|
|
|
*/
|
|
|
|
|
DateTime beginDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
|
|
|
|
|
DateTime endDate = beginDate;
|
|
|
|
|
|
|
|
|
|
if (query.beginCreated.HasValue)
|
|
|
|
|
beginDate = query.beginCreated.Value;
|
|
|
|
|
|
|
|
|
|
if (query.endCreated.HasValue)
|
|
|
|
|
endDate = query.endCreated.Value;
|
|
|
|
|
|
|
|
|
|
if (endDate > beginDate.AddDays(7))
|
|
|
|
|
throw Oops.Oh($"制单的日期范围不能超过7天");
|
|
|
|
|
|
|
|
|
|
endDate = endDate.AddDays(1);
|
|
|
|
|
|
|
|
|
|
queryWhere = queryWhere.Where(a => a.CreatedTime >= beginDate && a.CreatedTime < endDate);
|
|
|
|
|
|
|
|
|
|
isAvailable = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(query.mblNo))
|
|
|
|
|
{
|
|
|
|
|
queryWhere = queryWhere.Where(a => a.MBLNO.Contains(query.mblNo));
|
|
|
|
|
|
|
|
|
|
isAvailable = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(query.custNo))
|
|
|
|
|
{
|
|
|
|
|
queryWhere = queryWhere.Where(a => a.CUSTNO.Contains(query.custNo));
|
|
|
|
|
|
|
|
|
|
isAvailable = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(query.vessel))
|
|
|
|
|
{
|
|
|
|
|
queryWhere = queryWhere.Where(a => a.VESSEL.Contains(query.vessel));
|
|
|
|
|
|
|
|
|
|
isAvailable = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(query.voyno))
|
|
|
|
|
{
|
|
|
|
|
queryWhere = queryWhere.Where(a => a.VOYNO.Contains(query.voyno));
|
|
|
|
|
|
|
|
|
|
isAvailable = true;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
if (!isAvailable)
|
|
|
|
|
throw Oops.Oh($"查询条件不能为空");
|
|
|
|
|
|
|
|
|
|
var list = await queryWhere.OrderBy(a => a.CreatedTime)
|
|
|
|
|
.Take(query.topNum).ToListAsync();
|
|
|
|
|
|
|
|
|
|
var bkList = list.Adapt<List<BookingOrderBCTaskDto>>();
|
|
|
|
|
|
|
|
|
|
result.succ = true;
|
|
|
|
|
result.ext = bkList;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
result.succ = false;
|
|
|
|
|
result.msg = $"查询失败,原因:{ex.Message}";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|