|
|
|
@ -12,6 +12,7 @@ using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Furion.FriendlyException;
|
|
|
|
|
using NPOI.POIFS.Storage;
|
|
|
|
|
|
|
|
|
|
namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
@ -27,23 +28,27 @@ namespace Myshipping.Application
|
|
|
|
|
private readonly SqlSugarRepository<TaskRouteChangeAdvisoryInfo> _taskRouteChangeAdvisoryInfoRepository;
|
|
|
|
|
private readonly SqlSugarRepository<TaskRouteChangeAdvisoryDetailInfo> _taskRouteChangeAdvisoryDetailInfoRepository;
|
|
|
|
|
private readonly SqlSugarRepository<DjyUserMailAccount> _djyUserMailAccount;
|
|
|
|
|
private readonly SqlSugarRepository<BookingOrder> _bookingOrderRepository;
|
|
|
|
|
|
|
|
|
|
public RouteChangeAdvisoryService(ISysCacheService cache, ILogger<TaskCautionNoticeService> logger,
|
|
|
|
|
SqlSugarRepository<TaskBaseInfo> taskBaseRepository,
|
|
|
|
|
SqlSugarRepository<TaskRouteChangeAdvisoryInfo> taskRouteChangeAdvisoryInfoRepository,
|
|
|
|
|
SqlSugarRepository<TaskRouteChangeAdvisoryDetailInfo> taskRouteChangeAdvisoryDetailInfoRepository,
|
|
|
|
|
SqlSugarRepository<DjyUserMailAccount> djyUserMailAccount)
|
|
|
|
|
SqlSugarRepository<DjyUserMailAccount> djyUserMailAccount,
|
|
|
|
|
SqlSugarRepository<BookingOrder> bookingOrderRepository)
|
|
|
|
|
{
|
|
|
|
|
_cache = cache;
|
|
|
|
|
_logger = logger;
|
|
|
|
|
|
|
|
|
|
_taskBaseRepository = taskBaseRepository;
|
|
|
|
|
_taskRouteChangeAdvisoryInfoRepository = taskRouteChangeAdvisoryInfoRepository;
|
|
|
|
|
_taskRouteChangeAdvisoryDetailInfoRepository = _taskRouteChangeAdvisoryDetailInfoRepository;
|
|
|
|
|
_taskRouteChangeAdvisoryDetailInfoRepository = taskRouteChangeAdvisoryDetailInfoRepository;
|
|
|
|
|
_djyUserMailAccount = djyUserMailAccount;
|
|
|
|
|
_bookingOrderRepository = bookingOrderRepository;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 获取船舶相关截止时间的通知详情
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取船舶相关截止时间的通知详情
|
|
|
|
|
/// </summary>
|
|
|
|
@ -63,6 +68,8 @@ namespace Myshipping.Application
|
|
|
|
|
if (advisoryInfo == null)
|
|
|
|
|
throw Oops.Oh($"船舶相关截止时间的通知主键{taskPkId}无法获取业务信息");
|
|
|
|
|
|
|
|
|
|
var detailList = _taskRouteChangeAdvisoryDetailInfoRepository.AsQueryable()
|
|
|
|
|
.Where(a => a.P_ID == advisoryInfo.PK_ID).ToList();
|
|
|
|
|
|
|
|
|
|
dto = new TaskRouteChangeAdvisoryShowDto
|
|
|
|
|
{
|
|
|
|
@ -70,12 +77,85 @@ namespace Myshipping.Application
|
|
|
|
|
TaskPKId = advisoryInfo.TASK_ID,
|
|
|
|
|
CarrierId = advisoryInfo.CARRIER,
|
|
|
|
|
CreateTime = advisoryInfo.CreatedTime,
|
|
|
|
|
AdvisoryTitle = advisoryInfo.EMAIL_SUBJECT,
|
|
|
|
|
CYCutDate = advisoryInfo.CY_CUT_DATE,
|
|
|
|
|
ETA = advisoryInfo.ETA,
|
|
|
|
|
ETD = advisoryInfo.ETD,
|
|
|
|
|
MDGFCutDate = advisoryInfo.MDGF_CUT_DATE,
|
|
|
|
|
origETD = advisoryInfo.ORIG_ETD,
|
|
|
|
|
RouteCode = advisoryInfo.ROUTE_CODE,
|
|
|
|
|
SICutDate = advisoryInfo.SI_CUT_DATE,
|
|
|
|
|
Vessel = advisoryInfo.VESSEL,
|
|
|
|
|
Voyno = advisoryInfo.VOYNO,
|
|
|
|
|
VGMCutDate = advisoryInfo.VGM_CUTOFF_TIME,
|
|
|
|
|
Week = advisoryInfo.WEEK,
|
|
|
|
|
TerminalShiftCutDate = advisoryInfo.TM_SHIFT_CUT_DATE,
|
|
|
|
|
LoadPort = advisoryInfo.READ_PORTLOAD,
|
|
|
|
|
LoadPortId = advisoryInfo.PORTLOADID,
|
|
|
|
|
LoadPortName = advisoryInfo.PORTLOAD,
|
|
|
|
|
BuisList = new List<TaskRouteChangeAdvisoryBusiShowDto>()
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if(detailList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
var queryList = detailList.Where(a => a.BOOKING_ID.HasValue).Select(a => a.BOOKING_ID.Value).ToList();
|
|
|
|
|
|
|
|
|
|
if(queryList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
//查询整船的订舱订单列表
|
|
|
|
|
var bookList = _bookingOrderRepository.AsQueryable().Where(a => queryList.Contains(a.Id) && a.IsDeleted == false).ToList();
|
|
|
|
|
|
|
|
|
|
dto.BuisList = detailList.Select(p => {
|
|
|
|
|
|
|
|
|
|
TaskRouteChangeAdvisoryBusiShowDto detail = new TaskRouteChangeAdvisoryBusiShowDto {
|
|
|
|
|
PKId = p.PK_ID,
|
|
|
|
|
LstTransferUserDate = p.LST_TRANSFER_USER_DATE,
|
|
|
|
|
IsTransferUser = p.IS_TRANSFER_USER,
|
|
|
|
|
LstTransferNote = p.LST_TRANSFER_NOTES,
|
|
|
|
|
BookingId = p.BOOKING_ID.Value,
|
|
|
|
|
IsEnable = true
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var bookInfo = bookList.FirstOrDefault(x => x.Id == p.BOOKING_ID.Value);
|
|
|
|
|
|
|
|
|
|
if (bookInfo != null)
|
|
|
|
|
{
|
|
|
|
|
detail.CustomerName = bookInfo.CUSTOMERNAME;
|
|
|
|
|
detail.MBlNo = bookInfo.MBLNO;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//如果对应的订舱已被作废,只能标记不可发送
|
|
|
|
|
detail.IsEnable = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return detail;
|
|
|
|
|
}).ToList();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
dto.BuisList = detailList.Select(p => {
|
|
|
|
|
|
|
|
|
|
TaskRouteChangeAdvisoryBusiShowDto detail = new TaskRouteChangeAdvisoryBusiShowDto
|
|
|
|
|
{
|
|
|
|
|
PKId = p.PK_ID,
|
|
|
|
|
LstTransferUserDate = p.LST_TRANSFER_USER_DATE,
|
|
|
|
|
IsTransferUser = p.IS_TRANSFER_USER,
|
|
|
|
|
LstTransferNote = p.LST_TRANSFER_NOTES,
|
|
|
|
|
BookingId = p.BOOKING_ID.Value,
|
|
|
|
|
IsEnable = false
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return detail;
|
|
|
|
|
}).ToList();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return dto;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 自动转发船舶相关截止时间的通知
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 自动转发船舶相关截止时间的通知
|
|
|
|
|
/// </summary>
|
|
|
|
@ -97,7 +177,9 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 检索同一航次对应的订舱订单(并对应记录)
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 检索同一航次对应的订舱订单(并对应记录)
|
|
|
|
|
/// </summary>
|
|
|
|
@ -119,5 +201,6 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|