新增航线基础、航线和港口对应关系基础数据

修改订舱的规则校验,通过卸货港匹配航线信息。
booking_auth_dev
jianghaiqing 2 years ago
parent a3563c354c
commit b99e945c97

@ -19,6 +19,8 @@ using Furion.DistributedIDGenerator;
using Mapster;
using Furion.DataValidation;
using Newtonsoft.Json.Linq;
using Myshipping.Core.Service;
using Myshipping.Core.Entity;
namespace Myshipping.Application
{
@ -31,17 +33,20 @@ namespace Myshipping.Application
private readonly SqlSugarRepository<BookingOrder> _bookingOrderRepository;
private readonly SqlSugarRepository<BookingCtn> _bookingOrderContaRepository;
private readonly SqlSugarRepository<BookingCtnDetail> _bookingOrderContaCargoRepository;
private readonly ISysCacheService _cache;
/// <summary>
///
/// </summary>
public RulesEngineClientService(SqlSugarRepository<BookingOrder> bookingOrderRepository,
SqlSugarRepository<BookingCtn> bookingOrderContaRepository,
SqlSugarRepository<BookingCtnDetail> bookingOrderContaCargoRepository)
SqlSugarRepository<BookingCtnDetail> bookingOrderContaCargoRepository,
ISysCacheService cache)
{
_bookingOrderRepository = bookingOrderRepository;
_bookingOrderContaRepository = bookingOrderContaRepository;
_bookingOrderContaCargoRepository = bookingOrderContaCargoRepository;
_cache = cache;
}
#region 海运订舱请求规则引擎校验
@ -244,6 +249,27 @@ namespace Myshipping.Application
msgModel.Main.BusinessInfo = model.Adapt<RulesEngineOrderBookingMainBusinessInfo>();
//根据卸货港翻译航线信息
if(!string.IsNullOrWhiteSpace(model.PORTDISCHARGEID))
{
var laneList = _cache.GetAllRelaPortCarrierLane().GetAwaiter().GetResult();
var laneInfo = laneList
.FirstOrDefault(p => !string.IsNullOrWhiteSpace(model.CARRIER) && !string.IsNullOrWhiteSpace(p.CarrierCode) &&
p.CarrierCode.Equals(model.CARRIER, StringComparison.OrdinalIgnoreCase) && p.PortCode.Equals(model.PORTDISCHARGEID, StringComparison.OrdinalIgnoreCase));
if(laneInfo == null)
laneInfo = laneList.FirstOrDefault(p => string.IsNullOrWhiteSpace(p.CarrierCode) && p.PortCode.Equals(model.PORTDISCHARGEID, StringComparison.OrdinalIgnoreCase));
if (laneInfo != null)
{
var lineModel = _cache.GetAllCodeLane().GetAwaiter().GetResult().FirstOrDefault(t => t.Code.Equals(laneInfo.LaneCode, StringComparison.OrdinalIgnoreCase));
msgModel.Main.BusinessInfo.LaneCode = laneInfo.LaneCode;
msgModel.Main.BusinessInfo.LaneName = lineModel.CnName;
}
}
var contaList = await _bookingOrderContaRepository.AsQueryable().Where(x => x.BILLID == model.Id).ToListAsync();
if (contaList.Count > 0)

@ -90,6 +90,16 @@ public class CommonConst
/// </summary>
public const string CACHE_KEY_COMMON_DB_FRT = "CommonDbFrt";
/// <summary>
/// 航线
/// </summary>
public const string CACHE_KEY_COMMON_DB_LANE= "CommonDbLane";
/// <summary>
/// 航线与港口的的关系
/// </summary>
public const string CACHE_KEY_COMMON_DB_LANE_PORT = "CommonDbLanePort";
/// <summary>
/// 箱型映射
/// </summary>

@ -0,0 +1,40 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Core.Entity
{
[SugarTable("CodeLine")]
[Description("航线")]
public class CodeLane : CommonDbEntity
{
/// <summary>
/// 航线代码
/// </summary>
public string Code { get; set; }
/// <summary>
/// 航线类型 SEA-海运
/// </summary>
public string LaneType { get; set; }
/// <summary>
/// 航线英文名称
/// </summary>
public string EnName { get; set; }
/// <summary>
/// 航线中文名称
/// </summary>
public string CnName { get; set; }
/// <summary>
/// 描述
/// </summary>
public string Description { get; set; }
}
}

@ -0,0 +1,40 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Core.Entity
{
[SugarTable("RelaPortCarrierLine")]
[Description("航线与港口的的关系表")]
public class RelaPortCarrierLane : CommonDbEntity
{
/// <summary>
/// 航线代码
/// </summary>
public string LaneCode { get; set; }
/// <summary>
/// 船司代码
/// </summary>
public string CarrierCode { get; set; }
/// <summary>
/// 港口代码
/// </summary>
public string PortCode { get; set; }
/// <summary>
/// 模块(公用时为空字符串)
/// </summary>
public string Module { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Remark { get; set; }
}
}

@ -89,6 +89,12 @@ namespace Myshipping.Core.Job
//系统参数
await App.GetService<ISysConfigService>().CacheData();
//航线
await App.GetService<ICommonDBService>().GetAllLane(true);
//航线与港口的的关系
await App.GetService<ICommonDBService>().GetAllRelaPortCarrierLane(true);
Log.Information($"缓存公共库完成 {DateTime.Now}");
}
}

@ -627,6 +627,16 @@
付费方式
</summary>
</member>
<member name="F:Myshipping.Core.CommonConst.CACHE_KEY_COMMON_DB_LANE">
<summary>
航线
</summary>
</member>
<member name="F:Myshipping.Core.CommonConst.CACHE_KEY_COMMON_DB_LANE_PORT">
<summary>
航线与港口的的关系
</summary>
</member>
<member name="F:Myshipping.Core.CommonConst.CACHE_KEY_COMMON_DB_MAPPING_CTN">
<summary>
箱型映射
@ -1062,6 +1072,31 @@
排序
</summary>
</member>
<member name="P:Myshipping.Core.Entity.CodeLane.Code">
<summary>
航线代码
</summary>
</member>
<member name="P:Myshipping.Core.Entity.CodeLane.LaneType">
<summary>
航线类型 SEA-海运
</summary>
</member>
<member name="P:Myshipping.Core.Entity.CodeLane.EnName">
<summary>
航线英文名称
</summary>
</member>
<member name="P:Myshipping.Core.Entity.CodeLane.CnName">
<summary>
航线中文名称
</summary>
</member>
<member name="P:Myshipping.Core.Entity.CodeLane.Description">
<summary>
描述
</summary>
</member>
<member name="P:Myshipping.Core.Entity.CodePackage.Code">
<summary>
代码
@ -1472,6 +1507,31 @@
描述
</summary>
</member>
<member name="P:Myshipping.Core.Entity.RelaPortCarrierLane.LaneCode">
<summary>
航线代码
</summary>
</member>
<member name="P:Myshipping.Core.Entity.RelaPortCarrierLane.CarrierCode">
<summary>
船司代码
</summary>
</member>
<member name="P:Myshipping.Core.Entity.RelaPortCarrierLane.PortCode">
<summary>
港口代码
</summary>
</member>
<member name="P:Myshipping.Core.Entity.RelaPortCarrierLane.Module">
<summary>
模块(公用时为空字符串)
</summary>
</member>
<member name="P:Myshipping.Core.Entity.RelaPortCarrierLane.Remark">
<summary>
备注
</summary>
</member>
<member name="T:Myshipping.Core.Entity.DBEntityTenant">
<summary>
自定义租户基类实体
@ -5844,6 +5904,18 @@
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.ISysCacheService.GetAllCodeLane">
<summary>
获取公共库 航线
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.ISysCacheService.GetAllRelaPortCarrierLane">
<summary>
设置公共库 航线与港口的的关系表
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.ISysCacheService.GetAllMappingCtn">
<summary>
获取公共库 箱型映射
@ -6024,6 +6096,18 @@
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.ISysCacheService.SetAllCodeLane(System.Collections.Generic.List{Myshipping.Core.Entity.CodeLane})">
<summary>
设置公共库 航线
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.ISysCacheService.SetAllRelaPortCarrierLane(System.Collections.Generic.List{Myshipping.Core.Entity.RelaPortCarrierLane})">
<summary>
设置公共库 航线与港口的的关系表
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.ISysCacheService.GetAllTenantParam">
<summary>
获取租户参数
@ -6310,6 +6394,18 @@
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.SysCacheService.GetAllCodeLane">
<summary>
获取公共库 航线
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.SysCacheService.GetAllRelaPortCarrierLane">
<summary>
设置公共库 航线与港口的的关系表
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.SysCacheService.GetAllMappingCtn">
<summary>
获取公共库 箱型映射
@ -6400,6 +6496,18 @@
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.SysCacheService.SetAllCodeLane(System.Collections.Generic.List{Myshipping.Core.Entity.CodeLane})">
<summary>
设置公共库 航线
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.SysCacheService.SetAllRelaPortCarrierLane(System.Collections.Generic.List{Myshipping.Core.Entity.RelaPortCarrierLane})">
<summary>
设置公共库 航线与港口的的关系表
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.SysCacheService.SetAllMappingCtn(System.Collections.Generic.List{Myshipping.Core.Entity.MappingCtn})">
<summary>
设置公共库 箱型映射
@ -7252,6 +7360,13 @@
获取模块信息
</summary>
</member>
<member name="M:Myshipping.Core.Service.CommonDBService.GetAllLane(System.Boolean)">
<summary>
获取航线信息
</summary>
<param name="flag"></param>
<returns></returns>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.CodeCarrierDto.Code">
<summary>
代码
@ -7961,6 +8076,18 @@
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.ICommonDBService.GetAllLane(System.Boolean)">
<summary>
航线
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.ICommonDBService.GetAllRelaPortCarrierLane(System.Boolean)">
<summary>
航线与港口的的关系
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.ICommonDBService.GetAllMappingFrt(System.Boolean)">
<summary>
付费方式映射

@ -97,6 +97,18 @@ public interface ISysCacheService
/// <returns></returns>
Task<List<CodeFrt>> GetAllCodeFrt();
/// <summary>
/// 获取公共库 航线
/// </summary>
/// <returns></returns>
Task<List<CodeLane>> GetAllCodeLane();
/// <summary>
/// 设置公共库 航线与港口的的关系表
/// </summary>
/// <returns></returns>
Task<List<RelaPortCarrierLane>> GetAllRelaPortCarrierLane();
/// <summary>
/// 获取公共库 箱型映射
/// </summary>
@ -273,6 +285,19 @@ public interface ISysCacheService
/// </summary>
/// <returns></returns>
Task SetAllCodeIssueType(List<CodeIssueType> list);
/// <summary>
/// 设置公共库 航线
/// </summary>
/// <returns></returns>
Task SetAllCodeLane(List<CodeLane> list);
/// <summary>
/// 设置公共库 航线与港口的的关系表
/// </summary>
/// <returns></returns>
Task SetAllRelaPortCarrierLane(List<RelaPortCarrierLane> list);
#endregion
#region DJY

@ -387,6 +387,24 @@ public class SysCacheService : ISysCacheService, IDynamicApiController, ISinglet
return _cache.GetAsync<List<CodeFrt>>(CommonConst.CACHE_KEY_COMMON_DB_FRT);
}
/// <summary>
/// 获取公共库 航线
/// </summary>
/// <returns></returns>
public Task<List<CodeLane>> GetAllCodeLane()
{
return _cache.GetAsync<List<CodeLane>>(CommonConst.CACHE_KEY_COMMON_DB_LANE);
}
/// <summary>
/// 设置公共库 航线与港口的的关系表
/// </summary>
/// <returns></returns>
public Task<List<RelaPortCarrierLane>> GetAllRelaPortCarrierLane()
{
return _cache.GetAsync<List<RelaPortCarrierLane>>(CommonConst.CACHE_KEY_COMMON_DB_LANE_PORT);
}
/// <summary>
/// 获取公共库 箱型映射
/// </summary>
@ -526,6 +544,25 @@ public class SysCacheService : ISysCacheService, IDynamicApiController, ISinglet
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_FRT, list);
}
/// <summary>
/// 设置公共库 航线
/// </summary>
/// <returns></returns>
public Task SetAllCodeLane(List<CodeLane> list)
{
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_LANE, list);
}
/// <summary>
/// 设置公共库 航线与港口的的关系表
/// </summary>
/// <returns></returns>
public Task SetAllRelaPortCarrierLane(List<RelaPortCarrierLane> list)
{
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_LANE_PORT, list);
}
/// <summary>
/// 设置公共库 箱型映射
/// </summary>

@ -44,6 +44,8 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
private readonly SqlSugarRepository<CodeIssueType> _codeIssueTypeRep;
private readonly SqlSugarRepository<CommonModule> _commonModuleRep;
private readonly ILogger<CommonDBService> _logger;
private readonly SqlSugarRepository<CodeLane> _codeLaneRep;
private readonly SqlSugarRepository<RelaPortCarrierLane> _relaPortCarrierLaneRep;
public CommonDBService(SqlSugarRepository<CodeCarrier> codeCarrierRep,
SqlSugarRepository<CodeVessel> codeVesselRep,
SqlSugarRepository<CodeForwarder> codeForwarderRep,
@ -66,7 +68,9 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
SqlSugarRepository<CodeIssueType> codeIssueTypeRep,
SqlSugarRepository<CommonModule> commonModuleRep,
ILogger<CommonDBService> logger,
ISysCacheService sysCacheService)
ISysCacheService sysCacheService,
SqlSugarRepository<CodeLane> codeLaneRep,
SqlSugarRepository<RelaPortCarrierLane> relaPortCarrierLaneRep)
{
_codeCarrierRep = codeCarrierRep;
_codeVesselRep = codeVesselRep;
@ -91,7 +95,8 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
_codeIssueTypeRep = codeIssueTypeRep;
_commonModuleRep = commonModuleRep;
_logger = logger;
_codeLaneRep = codeLaneRep;
_relaPortCarrierLaneRep = relaPortCarrierLaneRep;
}
#endregion
@ -1257,6 +1262,52 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
}
/// <summary>
/// 获取航线信息
/// </summary>
/// <param name="flag"></param>
/// <returns></returns>
[NonAction]
public async Task GetAllLane(bool flag = false)
{
if (flag)
{
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_LANE))
{
var list = await _codeLaneRep.ToListAsync();
await _sysCacheService.SetAllCodeLane(list);
}
}
else
{
var list = await _codeLaneRep.ToListAsync();
await _sysCacheService.SetAllCodeLane(list);
}
}
[NonAction]
public async Task GetAllRelaPortCarrierLane(bool flag = false)
{
if (flag)
{
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_LANE_PORT))
{
var list = await _relaPortCarrierLaneRep.ToListAsync();
await _sysCacheService.SetAllRelaPortCarrierLane(list);
}
}
else
{
var list = await _relaPortCarrierLaneRep.ToListAsync();
await _sysCacheService.SetAllRelaPortCarrierLane(list);
}
}
[NonAction]
public async Task GetAllMappingCtn(bool flag = false)
{

@ -92,6 +92,18 @@ public interface ICommonDBService
/// <returns></returns>
Task GetAllFrt(bool flag);
/// <summary>
/// 航线
/// </summary>
/// <returns></returns>
Task GetAllLane(bool flag);
/// <summary>
/// 航线与港口的的关系
/// </summary>
/// <returns></returns>
Task GetAllRelaPortCarrierLane(bool flag);
/// <summary>
/// 付费方式映射
/// </summary>

Loading…
Cancel
Save