|
|
|
@ -15,6 +15,8 @@ using Furion.DynamicApiController;
|
|
|
|
|
using Furion.DependencyInjection;
|
|
|
|
|
using Myshipping.Core.Service;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using Myshipping.Application.Helper;
|
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
|
|
|
|
|
|
namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
|
{
|
|
|
|
@ -663,5 +665,189 @@ namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 马士基API订舱台账
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 马士基API订舱台账
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="QuerySearch">查询条件</param>
|
|
|
|
|
/// <returns>返回台账列表</returns>
|
|
|
|
|
public async Task<SqlSugarPagedList<BookingDeliveryRecordPageDto>> GetPageAsync([FromBody] QueryBookingDeliveryRecordDto QuerySearch)
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
List<string> contaList = new List<string>();
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(QuerySearch.ContaNo))
|
|
|
|
|
{
|
|
|
|
|
if (Regex.IsMatch(QuerySearch.ContaNo, "(\\t|\\n\\r|\\n)"))
|
|
|
|
|
{
|
|
|
|
|
contaList = Regex.Replace(QuerySearch.ContaNo, "(\\t |\\n\\r |\\n)", "#").Split(new char[] { '#' }).Select(t => t?.Trim()).ToList();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
contaList.Add(QuerySearch.ContaNo.Trim());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//制单日期
|
|
|
|
|
DateTime createBegin = DateTime.MinValue;
|
|
|
|
|
DateTime createEnd = DateTime.MinValue;
|
|
|
|
|
//派车日期
|
|
|
|
|
DateTime truckDateBegin = DateTime.MinValue;
|
|
|
|
|
DateTime truckDateEnd = DateTime.MinValue;
|
|
|
|
|
//截单日期
|
|
|
|
|
DateTime closeDateBegin = DateTime.MinValue;
|
|
|
|
|
DateTime closeDateEnd = DateTime.MinValue;
|
|
|
|
|
//提货日期
|
|
|
|
|
DateTime pickUpTimeBegin = DateTime.MinValue;
|
|
|
|
|
DateTime pickUpTimeEnd = DateTime.MinValue;
|
|
|
|
|
//返场时间
|
|
|
|
|
DateTime returnTimeBegin = DateTime.MinValue;
|
|
|
|
|
DateTime returnTimeEnd = DateTime.MinValue;
|
|
|
|
|
//要求到达时间
|
|
|
|
|
DateTime needArriveTimeBegin = DateTime.MinValue;
|
|
|
|
|
DateTime needArriveTimeEnd = 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.TruckTimeBegin))
|
|
|
|
|
{
|
|
|
|
|
if (!DateTime.TryParse(QuerySearch.TruckTimeBegin, out truckDateBegin))
|
|
|
|
|
throw Oops.Oh($"派车起始日期格式错误,{QuerySearch.TruckTimeBegin}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(QuerySearch.TruckTimeEnd))
|
|
|
|
|
{
|
|
|
|
|
if (!DateTime.TryParse(QuerySearch.TruckTimeEnd, out truckDateEnd))
|
|
|
|
|
throw Oops.Oh($"派车结束日期格式错误,{QuerySearch.TruckTimeEnd}");
|
|
|
|
|
|
|
|
|
|
truckDateEnd = truckDateEnd.AddDays(1);
|
|
|
|
|
}
|
|
|
|
|
//截单日期
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(QuerySearch.ClosingTimeBegin))
|
|
|
|
|
{
|
|
|
|
|
if (!DateTime.TryParse(QuerySearch.ClosingTimeBegin, out closeDateBegin))
|
|
|
|
|
throw Oops.Oh($"截单起始日期格式错误,{QuerySearch.ClosingTimeBegin}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(QuerySearch.ClosingTimeEnd))
|
|
|
|
|
{
|
|
|
|
|
if (!DateTime.TryParse(QuerySearch.ClosingTimeEnd, out closeDateEnd))
|
|
|
|
|
throw Oops.Oh($"截单结束日期格式错误,{QuerySearch.ClosingTimeEnd}");
|
|
|
|
|
|
|
|
|
|
closeDateEnd = closeDateEnd.AddDays(1);
|
|
|
|
|
}
|
|
|
|
|
//提货日期
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(QuerySearch.PickUpTimeBegin))
|
|
|
|
|
{
|
|
|
|
|
if (!DateTime.TryParse(QuerySearch.PickUpTimeBegin, out pickUpTimeBegin))
|
|
|
|
|
throw Oops.Oh($"提货起始日期格式错误,{QuerySearch.PickUpTimeBegin}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(QuerySearch.PickUpTimeEnd))
|
|
|
|
|
{
|
|
|
|
|
if (!DateTime.TryParse(QuerySearch.ClosingTimeEnd, out pickUpTimeEnd))
|
|
|
|
|
throw Oops.Oh($"提货结束日期格式错误,{QuerySearch.PickUpTimeEnd}");
|
|
|
|
|
|
|
|
|
|
pickUpTimeEnd = pickUpTimeEnd.AddDays(1);
|
|
|
|
|
}
|
|
|
|
|
//返场时间
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(QuerySearch.ReturnTimeBegin))
|
|
|
|
|
{
|
|
|
|
|
if (!DateTime.TryParse(QuerySearch.ReturnTimeBegin, out returnTimeBegin))
|
|
|
|
|
throw Oops.Oh($"返场起始日期格式错误,{QuerySearch.ReturnTimeBegin}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(QuerySearch.ReturnTimeEnd))
|
|
|
|
|
{
|
|
|
|
|
if (!DateTime.TryParse(QuerySearch.ReturnTimeEnd, out returnTimeEnd))
|
|
|
|
|
throw Oops.Oh($"返场结束日期格式错误,{QuerySearch.ReturnTimeEnd}");
|
|
|
|
|
|
|
|
|
|
returnTimeEnd = returnTimeEnd.AddDays(1);
|
|
|
|
|
}
|
|
|
|
|
//要求到达时间
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(QuerySearch.NeedArriveTimeBegin))
|
|
|
|
|
{
|
|
|
|
|
if (!DateTime.TryParse(QuerySearch.NeedArriveTimeBegin, out needArriveTimeBegin))
|
|
|
|
|
throw Oops.Oh($"返场起始日期格式错误,{QuerySearch.NeedArriveTimeBegin}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(QuerySearch.NeedArriveTimeEnd))
|
|
|
|
|
{
|
|
|
|
|
if (!DateTime.TryParse(QuerySearch.NeedArriveTimeEnd, out needArriveTimeEnd))
|
|
|
|
|
throw Oops.Oh($"返场结束日期格式错误,{QuerySearch.NeedArriveTimeEnd}");
|
|
|
|
|
|
|
|
|
|
needArriveTimeEnd = needArriveTimeEnd.AddDays(1);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
string entityOrderCol = "CreatedTime";
|
|
|
|
|
|
|
|
|
|
//这里因为返回给前端的台账数据是DTO,所以这里排序时候需要转换成Entity对应的字段
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(QuerySearch.SortField))
|
|
|
|
|
entityOrderCol = MapsterExtHelper.GetAdaptProperty<BookingTruckDto, BookingTruck>(QuerySearch.SortField);
|
|
|
|
|
|
|
|
|
|
var entities = await _bookingTruckRepository.AsQueryable()
|
|
|
|
|
.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(truckDateBegin != DateTime.MinValue, t => t.TruckTime.HasValue && t.TruckTime.Value >= truckDateBegin)
|
|
|
|
|
.WhereIF(truckDateEnd != DateTime.MinValue, t => t.TruckTime.HasValue && t.TruckTime.Value < truckDateEnd)
|
|
|
|
|
.WhereIF(closeDateBegin != DateTime.MinValue, t => t.ClosingTime.HasValue && t.ClosingTime.Value >= closeDateBegin)
|
|
|
|
|
.WhereIF(closeDateEnd != DateTime.MinValue, t => t.ClosingTime.HasValue && t.ClosingTime.Value < closeDateEnd)
|
|
|
|
|
.WhereIF(pickUpTimeBegin != DateTime.MinValue, t => t.PickUpTime.HasValue && t.PickUpTime.Value >= pickUpTimeBegin)
|
|
|
|
|
.WhereIF(pickUpTimeEnd != DateTime.MinValue, t => t.PickUpTime.HasValue && t.PickUpTime.Value < pickUpTimeEnd)
|
|
|
|
|
.WhereIF(returnTimeBegin != DateTime.MinValue, t => t.ReturnTime.HasValue && t.ReturnTime.Value >= returnTimeBegin)
|
|
|
|
|
.WhereIF(returnTimeEnd != DateTime.MinValue, t => t.ReturnTime.HasValue && t.ReturnTime.Value < returnTimeEnd)
|
|
|
|
|
.WhereIF(needArriveTimeBegin != DateTime.MinValue, t => t.NeedArriveTime.HasValue && t.NeedArriveTime.Value >= needArriveTimeBegin)
|
|
|
|
|
.WhereIF(needArriveTimeEnd != DateTime.MinValue, t => t.NeedArriveTime.HasValue && t.NeedArriveTime.Value < needArriveTimeEnd)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.Yard), t => t.YARDID.Contains(QuerySearch.Yard) || t.YARD.Contains(QuerySearch.Yard))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.InYard), t => t.InYardID.Contains(QuerySearch.Yard) || t.InYard.Contains(QuerySearch.Yard))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.Status), t => t.Status == QuerySearch.Status)
|
|
|
|
|
.OrderBy(entityOrderCol + (QuerySearch.descSort ? " asc " : " desc "))
|
|
|
|
|
.ToPagedListAsync(QuerySearch.PageNo, QuerySearch.PageSize);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return entities.Adapt<SqlSugarPagedList<BookingTruckPageDto>>();
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 获取马士基API订舱详情
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取马士基API订舱详情
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="id">马士基API订舱ID</param>
|
|
|
|
|
/// <returns>返回详情</returns>
|
|
|
|
|
public async Task<BookingDeliveryRecordDto> GetInfo(long id)
|
|
|
|
|
{
|
|
|
|
|
BookingDeliveryRecordDto model = null;
|
|
|
|
|
|
|
|
|
|
var entity = await _bookingDeliveryRecordRep.AsQueryable()
|
|
|
|
|
.FirstAsync(a => a.Id == id);
|
|
|
|
|
|
|
|
|
|
if(entity == null)
|
|
|
|
|
throw Oops.Oh($"获取马士基API订舱详情失败,不存在或已作废");
|
|
|
|
|
|
|
|
|
|
model = entity.Adapt<BookingDeliveryRecordDto>();
|
|
|
|
|
|
|
|
|
|
return model;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|