diff --git a/Myshipping.Application/Entity/BookingDeliveryRecordShipSchedule.cs b/Myshipping.Application/Entity/BookingDeliveryRecordShipSchedule.cs
new file mode 100644
index 00000000..28eb4378
--- /dev/null
+++ b/Myshipping.Application/Entity/BookingDeliveryRecordShipSchedule.cs
@@ -0,0 +1,54 @@
+using Myshipping.Core.Entity;
+using SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Myshipping.Application.Entity
+{
+ ///
+ /// 订舱递送记录表船期记录
+ ///
+ [SugarTable("booking_delivery_record_ship_schedule")]
+ [Description("订舱递送记录表船期记录")]
+ public class BookingDeliveryRecordShipSchedule : DBEntityTenant
+ {
+ ///
+ /// 主记录ID
+ ///
+ public long RECORD_ID { get; set; }
+
+ ///
+ /// 船期金额
+ ///
+ public Nullable SHIP_RATE_TOTAL_AMOUNT { get; set; }
+
+ ///
+ /// 船期币别
+ ///
+ public string SHIP_RATE_TOTAL_CURRENCY { get; set; }
+
+ ///
+ /// 船期PID
+ ///
+ public Nullable SHIP_RATE_PID { get; set; }
+
+ ///
+ /// 船期MD5
+ ///
+ public string SHIP_RATE_MD5 { get; set; }
+
+ ///
+ /// 价格ID(SPOT专用)对应单个船期
+ ///
+ public string PRICE_ID { get; set; }
+
+ ///
+ /// 船期JSON
+ ///
+ public string SHIP_JSON { get; set; }
+ }
+}
diff --git a/Myshipping.Application/Service/BookingOrder/BookingMSKSPOTAPIService.cs b/Myshipping.Application/Service/BookingOrder/BookingMSKSPOTAPIService.cs
index 0392e6e6..4aabc069 100644
--- a/Myshipping.Application/Service/BookingOrder/BookingMSKSPOTAPIService.cs
+++ b/Myshipping.Application/Service/BookingOrder/BookingMSKSPOTAPIService.cs
@@ -32,6 +32,8 @@ namespace Myshipping.Application.Service.BookingOrder
{
private readonly SqlSugarRepository _bookingDeliveryRecordRep;
private readonly SqlSugarRepository _bookingDeliveryRecordCtnRep;
+ private readonly SqlSugarRepository _bookingDeliveryRecordShipScheduleRep;
+
private readonly ISysCacheService _cache;
private readonly IDjyWebsiteAccountConfigService _webAccountConfig;
private readonly ILogger _logger;
@@ -47,6 +49,7 @@ namespace Myshipping.Application.Service.BookingOrder
IDjyWebsiteAccountConfigService webAccountConfig, SqlSugarRepository bookingDeliveryRecordRep,
ISysDataUserMenu sysDataUserMenuService,
IDjyTenantParamService djyTenantParamService,
+ SqlSugarRepository bookingDeliveryRecordShipScheduleRep,
SqlSugarRepository 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($"{pid}_{busiType}");
+ }
+
+ return null;
+ }
+
#region 发送马士基订舱请求
///
/// 发送马士基订舱请求
@@ -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(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(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();
+
+
entity.CreatedTime = nowDate;
entity.UpdatedTime = nowDate;
entity.CreatedUserId = UserManager.UserId;
diff --git a/Myshipping.Application/Service/BookingOrder/Dto/BookingDeliveryRecordPageDto.cs b/Myshipping.Application/Service/BookingOrder/Dto/BookingDeliveryRecordPageDto.cs
index 74417e0f..3177d3ed 100644
--- a/Myshipping.Application/Service/BookingOrder/Dto/BookingDeliveryRecordPageDto.cs
+++ b/Myshipping.Application/Service/BookingOrder/Dto/BookingDeliveryRecordPageDto.cs
@@ -449,5 +449,35 @@ namespace Myshipping.Application
/// 预计航行天数
///
public Nullable estSailingDays { get; set; }
+
+ //
+ /// 主键ID
+ ///
+ public Nullable PId { get; set; }
+
+ ///
+ /// 价格id, 可进一步通过API进行其他操作
+ ///
+ public string priceID { get; set; }
+
+ ///
+ /// 船期价格
+ ///
+ public Nullable ShipRateTotalAmount { get; set; }
+
+ ///
+ /// 船期币别
+ ///
+ public string ShipRateTotalCurrency { get; set; }
+
+ ///
+ /// 订舱通道类型 CON_API-合约API,SPOT_API-SPOT订舱,EDI-EDI订舱
+ ///
+ public string bookingChannelType { get; set; }
+
+ ///
+ /// 订舱通道类型 CON_API-合约API,SPOT_API-SPOT订舱,EDI-EDI订舱
+ ///
+ public string bookingChannelTypeName { get; set; }
}
}
diff --git a/Myshipping.Application/Service/BookingOrder/Dto/BookingEDIMapper.cs b/Myshipping.Application/Service/BookingOrder/Dto/BookingEDIMapper.cs
index 13459089..17139815 100644
--- a/Myshipping.Application/Service/BookingOrder/Dto/BookingEDIMapper.cs
+++ b/Myshipping.Application/Service/BookingOrder/Dto/BookingEDIMapper.cs
@@ -388,7 +388,13 @@ namespace Myshipping.Application
.Map(dest => dest.isRecvBKCancel, src => src.IS_RECV_BK_CANCEL)
.Map(dest => dest.LstRecvBKCancelDate, src => src.LST_RECV_BK_CANCEL_DATE)
.Map(dest => dest.bookingReference, src => src.BOOKING_REFERENCE)
- .Map(dest => dest.estSailingDays, src => src.EST_SAILING_DAYS);
+ .Map(dest => dest.estSailingDays, src => src.EST_SAILING_DAYS)
+ .Map(dest => dest.PId, src => src.SHIP_RATE_PID)
+ .Map(dest => dest.priceID, src => src.PRICE_ID)
+ .Map(dest => dest.ShipRateTotalAmount, src => src.SHIP_RATE_TOTAL_AMOUNT)
+ .Map(dest => dest.ShipRateTotalCurrency, src => src.SHIP_RATE_TOTAL_CURRENCY)
+ .Map(dest => dest.bookingChannelType, src => src.BOOKING_CHANNEL_TYPE)
+ .Map(dest => dest.bookingChannelTypeName, src => src.BOOKING_CHANNEL_TYPE_NAME);
}
}
}