|
|
|
@ -32,6 +32,8 @@ namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
|
{
|
|
|
|
|
private readonly SqlSugarRepository<BookingDeliveryRecord> _bookingDeliveryRecordRep;
|
|
|
|
|
private readonly SqlSugarRepository<BookingDeliveryRecordCtn> _bookingDeliveryRecordCtnRep;
|
|
|
|
|
private readonly SqlSugarRepository<BookingDeliveryRecordShipSchedule> _bookingDeliveryRecordShipScheduleRep;
|
|
|
|
|
|
|
|
|
|
private readonly ISysCacheService _cache;
|
|
|
|
|
private readonly IDjyWebsiteAccountConfigService _webAccountConfig;
|
|
|
|
|
private readonly ILogger<BookingMSKSPOTAPIService> _logger;
|
|
|
|
@ -47,6 +49,7 @@ namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
|
IDjyWebsiteAccountConfigService webAccountConfig, SqlSugarRepository<BookingDeliveryRecord> bookingDeliveryRecordRep,
|
|
|
|
|
ISysDataUserMenu sysDataUserMenuService,
|
|
|
|
|
IDjyTenantParamService djyTenantParamService,
|
|
|
|
|
SqlSugarRepository<BookingDeliveryRecordShipSchedule> bookingDeliveryRecordShipScheduleRep,
|
|
|
|
|
SqlSugarRepository<BookingDeliveryRecordCtn> bookingDeliveryRecordCtnRep)
|
|
|
|
|
{
|
|
|
|
|
_logger = logger;
|
|
|
|
@ -56,6 +59,7 @@ namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
|
_bookingDeliveryRecordCtnRep = bookingDeliveryRecordCtnRep;
|
|
|
|
|
_sysDataUserMenuService = sysDataUserMenuService;
|
|
|
|
|
_djyTenantParamService = djyTenantParamService;
|
|
|
|
|
_bookingDeliveryRecordShipScheduleRep = bookingDeliveryRecordShipScheduleRep;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 检索始发地、目的港口信息
|
|
|
|
@ -518,6 +522,16 @@ namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
private MSKAPISPOTSearchScheduleRateResultDataDto GetCacheShipSailingSchedule(long pid, string busiType = "MSKSPOT")
|
|
|
|
|
{
|
|
|
|
|
if (_cache.Exists($"{pid}_{busiType}"))
|
|
|
|
|
{
|
|
|
|
|
return _cache.Get<MSKAPISPOTSearchScheduleRateResultDataDto>($"{pid}_{busiType}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 发送马士基订舱请求
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 发送马士基订舱请求
|
|
|
|
@ -1126,6 +1140,19 @@ namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
|
}).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MSKAPISPOTSearchScheduleRateResultDataDto selectedShipSchedule = null;
|
|
|
|
|
|
|
|
|
|
if (model.PId > 0)
|
|
|
|
|
{
|
|
|
|
|
var shipScheduleRecord = await _bookingDeliveryRecordShipScheduleRep.AsQueryable()
|
|
|
|
|
.FirstAsync(a => a.SHIP_RATE_PID != null && a.SHIP_RATE_PID.Value == model.PId);
|
|
|
|
|
|
|
|
|
|
if (shipScheduleRecord != null)
|
|
|
|
|
{
|
|
|
|
|
selectedShipSchedule = JSON.Deserialize<MSKAPISPOTSearchScheduleRateResultDataDto>(shipScheduleRecord.SHIP_JSON);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return model;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
@ -1158,6 +1185,26 @@ namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation($"获取请求马士基API订舱报文,JSON={JSON.Serialize(model)}");
|
|
|
|
|
|
|
|
|
|
MSKAPISPOTSearchScheduleRateResultDataDto selectedShipSchedule = null;
|
|
|
|
|
|
|
|
|
|
if (model.PId > 0)
|
|
|
|
|
{
|
|
|
|
|
var shipScheduleRecord = await _bookingDeliveryRecordShipScheduleRep.AsQueryable()
|
|
|
|
|
.FirstAsync(a => a.SHIP_RATE_PID != null && a.SHIP_RATE_PID.Value == model.PId);
|
|
|
|
|
|
|
|
|
|
if (shipScheduleRecord == null)
|
|
|
|
|
{
|
|
|
|
|
selectedShipSchedule = GetCacheShipSailingSchedule(model.PId);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
selectedShipSchedule = JSON.Deserialize<MSKAPISPOTSearchScheduleRateResultDataDto>(shipScheduleRecord.SHIP_JSON);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (selectedShipSchedule == null)
|
|
|
|
|
throw Oops.Oh("船期数据校验失败,请重新查询船期信息");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (model.ctns != null && model.ctns.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
ctnStat = string.Join(",", model.ctns.GroupBy(a => a.ctnName)
|
|
|
|
@ -1287,6 +1334,8 @@ namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
|
{
|
|
|
|
|
BookingDeliveryRecord entity = model.Adapt<BookingDeliveryRecord>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
entity.CreatedTime = nowDate;
|
|
|
|
|
entity.UpdatedTime = nowDate;
|
|
|
|
|
entity.CreatedUserId = UserManager.UserId;
|
|
|
|
|