|
|
@ -920,181 +920,6 @@ namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 马士基API订舱台账
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 马士基API订舱台账
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="QuerySearch">查询条件</param>
|
|
|
|
|
|
|
|
/// <returns>返回台账列表</returns>
|
|
|
|
|
|
|
|
[HttpPost("/BookingMSKSPOTAPI/GetPage")]
|
|
|
|
|
|
|
|
public async Task<SqlSugarPagedList<BookingDeliveryRecordPageDto>> GetPageAsync([FromBody] QueryBookingDeliveryRecordDto QuerySearch)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//制单日期
|
|
|
|
|
|
|
|
DateTime createBegin = DateTime.MinValue;
|
|
|
|
|
|
|
|
DateTime createEnd = DateTime.MinValue;
|
|
|
|
|
|
|
|
//更新日期
|
|
|
|
|
|
|
|
DateTime updateBegin = DateTime.MinValue;
|
|
|
|
|
|
|
|
DateTime updateEnd = DateTime.MinValue;
|
|
|
|
|
|
|
|
//预计离港日期
|
|
|
|
|
|
|
|
DateTime edepartureBegin = DateTime.MinValue;
|
|
|
|
|
|
|
|
DateTime edepartureEnd = DateTime.MinValue;
|
|
|
|
|
|
|
|
//ETD日期
|
|
|
|
|
|
|
|
DateTime etdBegin = DateTime.MinValue;
|
|
|
|
|
|
|
|
DateTime etdEnd = DateTime.MinValue;
|
|
|
|
|
|
|
|
//ETA时间
|
|
|
|
|
|
|
|
DateTime etaBegin = DateTime.MinValue;
|
|
|
|
|
|
|
|
DateTime etaEnd = DateTime.MinValue;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//定时
|
|
|
|
|
|
|
|
DateTime jobBegin = DateTime.MinValue;
|
|
|
|
|
|
|
|
DateTime jobEnd = DateTime.MinValue;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 查询条件
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//制单日期
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(QuerySearch.CreateBegin))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!DateTime.TryParse(QuerySearch.CreateBegin, out createBegin))
|
|
|
|
|
|
|
|
throw Oops.Oh($"创建起始日期格式错误,{QuerySearch.CreateBegin}");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(QuerySearch.CreateEnd))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!DateTime.TryParse(QuerySearch.CreateEnd, out createEnd))
|
|
|
|
|
|
|
|
throw Oops.Oh($"创建结束日期格式错误,{QuerySearch.CreateEnd}");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
createEnd = createEnd.AddDays(1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//更新日期
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(QuerySearch.UpdateBegin))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!DateTime.TryParse(QuerySearch.UpdateBegin, out updateBegin))
|
|
|
|
|
|
|
|
throw Oops.Oh($"更新起始日期开始格式错误,{QuerySearch.UpdateBegin}");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(QuerySearch.UpdateEnd))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!DateTime.TryParse(QuerySearch.UpdateEnd, out updateEnd))
|
|
|
|
|
|
|
|
throw Oops.Oh($"更新结束日期格式错误,{QuerySearch.UpdateEnd}");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
updateEnd = updateEnd.AddDays(1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//预计离港日期
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(QuerySearch.EDepartureBegin))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!DateTime.TryParse(QuerySearch.EDepartureBegin, out edepartureBegin))
|
|
|
|
|
|
|
|
throw Oops.Oh($"预计离港日期起始格式错误,{QuerySearch.EDepartureBegin}");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(QuerySearch.EDepartureEnd))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!DateTime.TryParse(QuerySearch.EDepartureEnd, out edepartureEnd))
|
|
|
|
|
|
|
|
throw Oops.Oh($"预计离港日期结束格式错误,{QuerySearch.EDepartureEnd}");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
edepartureEnd = edepartureEnd.AddDays(1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//ETD
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(QuerySearch.ETDBegin))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!DateTime.TryParse(QuerySearch.ETDBegin, out etdBegin))
|
|
|
|
|
|
|
|
throw Oops.Oh($"ETD起始日期格式错误,{QuerySearch.ETDBegin}");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(QuerySearch.ETDEnd))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!DateTime.TryParse(QuerySearch.ETDEnd, out etdEnd))
|
|
|
|
|
|
|
|
throw Oops.Oh($"ETD结束日期格式错误,{QuerySearch.ETDEnd}");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
etdEnd = etdEnd.AddDays(1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//ETA
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(QuerySearch.ETDBegin))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!DateTime.TryParse(QuerySearch.ETDBegin, out etaBegin))
|
|
|
|
|
|
|
|
throw Oops.Oh($"ETA起始日期格式错误,{QuerySearch.ETDBegin}");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(QuerySearch.ETAEnd))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!DateTime.TryParse(QuerySearch.ETAEnd, out etaEnd))
|
|
|
|
|
|
|
|
throw Oops.Oh($"ETA结束日期格式错误,{QuerySearch.ETAEnd}");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
etaEnd = etaEnd.AddDays(1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//定时
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(QuerySearch.JOBBegin))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!DateTime.TryParse(QuerySearch.JOBBegin, out jobBegin))
|
|
|
|
|
|
|
|
throw Oops.Oh($"返场起始日期格式错误,{QuerySearch.JOBBegin}");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(QuerySearch.JOBEnd))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!DateTime.TryParse(QuerySearch.JOBEnd, out jobEnd))
|
|
|
|
|
|
|
|
throw Oops.Oh($"返场结束日期格式错误,{QuerySearch.JOBEnd}");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
jobEnd = jobEnd.AddDays(1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string entityOrderCol = "CreatedTime";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//这里因为返回给前端的台账数据是DTO,所以这里排序时候需要转换成Entity对应的字段
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(QuerySearch.SortField))
|
|
|
|
|
|
|
|
entityOrderCol = MapsterExtHelper.GetAdaptProperty<BookingDeliveryRecordDto, BookingDeliveryRecord>(QuerySearch.SortField);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//菜单375504048771141=我的任务台账
|
|
|
|
|
|
|
|
List<long> userlist = await _sysDataUserMenuService.GetDataScopeList(MenuConst.MenuMSKApi);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool isAdmin = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (userlist == null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
isAdmin = true;
|
|
|
|
|
|
|
|
userlist = new List<long>();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (userlist != null && userlist.Count > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
userlist.Add(UserManager.UserId);
|
|
|
|
|
|
|
|
userlist = userlist.Distinct().ToList();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("任务台账权限范围 {list}", userlist);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var entities = await _bookingDeliveryRecordRep.AsQueryable()
|
|
|
|
|
|
|
|
.Where(t => isAdmin || userlist.Contains(t.CreatedUserId.Value))
|
|
|
|
|
|
|
|
.WhereIF(createBegin != DateTime.MinValue, t => t.CreatedTime.HasValue && t.CreatedTime.Value >= createBegin)
|
|
|
|
|
|
|
|
.WhereIF(createEnd != DateTime.MinValue, t => t.CreatedTime.HasValue && t.CreatedTime.Value < createEnd)
|
|
|
|
|
|
|
|
.WhereIF(updateBegin != DateTime.MinValue, t => t.UpdatedTime.HasValue && t.UpdatedTime.Value >= updateBegin)
|
|
|
|
|
|
|
|
.WhereIF(updateEnd != DateTime.MinValue, t => t.UpdatedTime.HasValue && t.UpdatedTime.Value < updateEnd)
|
|
|
|
|
|
|
|
.WhereIF(edepartureBegin != DateTime.MinValue, t => t.EARLIEST_DEPARTURE_DATE.HasValue && t.EARLIEST_DEPARTURE_DATE.Value >= edepartureBegin)
|
|
|
|
|
|
|
|
.WhereIF(edepartureEnd != DateTime.MinValue, t => t.EARLIEST_DEPARTURE_DATE.HasValue && t.EARLIEST_DEPARTURE_DATE.Value < edepartureEnd)
|
|
|
|
|
|
|
|
.WhereIF(etdBegin != DateTime.MinValue, t => t.ETD.HasValue && t.ETD.Value >= etdBegin)
|
|
|
|
|
|
|
|
.WhereIF(etdEnd != DateTime.MinValue, t => t.ETD.HasValue && t.ETA.Value < etdEnd)
|
|
|
|
|
|
|
|
.WhereIF(etaBegin != DateTime.MinValue, t => t.ETA.HasValue && t.ETA.Value >= etaBegin)
|
|
|
|
|
|
|
|
.WhereIF(etaEnd != DateTime.MinValue, t => t.ETA.HasValue && t.ETA.Value < etaEnd)
|
|
|
|
|
|
|
|
.WhereIF(jobBegin != DateTime.MinValue, t => t.JOB_TIME.HasValue && t.JOB_TIME.Value >= jobBegin)
|
|
|
|
|
|
|
|
.WhereIF(jobEnd != DateTime.MinValue, t => t.JOB_TIME.HasValue && t.JOB_TIME.Value < jobEnd)
|
|
|
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.PriceReference), t => t.PRICE_REFERENCE.Contains(QuerySearch.PriceReference))
|
|
|
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.BookedByCompanyName), t => t.BOOKEDBY_COMPANY_NAME.Contains(QuerySearch.BookedByCompanyName))
|
|
|
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.BookedByCompanyPartyCode), t => t.BOOKEDBY_COMPANY_PARTYCODE.Contains(QuerySearch.BookedByCompanyPartyCode))
|
|
|
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.PriceOwnerCompanyName), t => t.PRICE_OWNER_COMPANY_NAME.Contains(QuerySearch.PriceOwnerCompanyName))
|
|
|
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.PriceOwnerCompanyPartyCode), t => t.PRICE_OWNER_COMPANY_PARTYCODE.Contains(QuerySearch.PriceOwnerCompanyPartyCode))
|
|
|
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.PlaceReceiptCity), t => t.PLACERECEIPT_CITY.Contains(QuerySearch.PlaceReceiptCity) || t.PLACERECEIPT_UNLOC_CODE.Contains(QuerySearch.PlaceReceiptCity))
|
|
|
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.PlaceDeliveryCity), t => t.PLACEDELIVERY_CITY.Contains(QuerySearch.PlaceDeliveryCity) || t.PLACEDELIVERY_UNLOC_CODE.Contains(QuerySearch.PlaceDeliveryCity))
|
|
|
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.BookingReference), t => t.BOOKING_REFERENCE.Contains(QuerySearch.BookingReference))
|
|
|
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.BookingCreator), t => t.CreatedUserName.Contains(QuerySearch.BookingCreator) || t.UpdatedUserName.Contains(QuerySearch.BookingCreator))
|
|
|
|
|
|
|
|
.OrderBy(entityOrderCol + (QuerySearch.descSort ? " desc " : " asc "))
|
|
|
|
|
|
|
|
.ToPagedListAsync(QuerySearch.PageNo, QuerySearch.PageSize);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return entities.Adapt<SqlSugarPagedList<BookingDeliveryRecordPageDto>>();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 获取马士基API订舱详情
|
|
|
|
#region 获取马士基API订舱详情
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 获取马士基API订舱详情
|
|
|
|
/// 获取马士基API订舱详情
|
|
|
|