diff --git a/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingContractNo/BookingContractNoManageDto.cs b/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingContractNo/BookingContractNoManageDto.cs index 7c5ab4c4..80ee17b0 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingContractNo/BookingContractNoManageDto.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingContractNo/BookingContractNoManageDto.cs @@ -42,21 +42,41 @@ namespace DS.WMS.Core.Op.Dtos /// public string LaneCName { get; set; } + /// + /// 航线主键 + /// + public Nullable LaneId { get; set; } + /// /// 目的港代码 /// public string PodCode { get; set; } + /// + /// 目的港主键 + /// + public string PodId { get; set; } + + /// + /// 目的港名称 + /// + public string PodName { get; set; } + /// /// 船公司主键 /// - public long CarrierId { get; set; } + public Nullable CarrierId { get; set; } /// /// 船公司代码 /// public string CarrierCode { get; set; } + /// + /// 船公司 + /// + public string Carrier { get; set; } + /// /// 合约方公司全称 /// diff --git a/ds-wms-service/DS.WMS.Core/Op/Entity/BookingContractNo/BookingContractNoManage.cs b/ds-wms-service/DS.WMS.Core/Op/Entity/BookingContractNo/BookingContractNoManage.cs index 19b240bd..8e592ba3 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Entity/BookingContractNo/BookingContractNoManage.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Entity/BookingContractNo/BookingContractNoManage.cs @@ -42,20 +42,38 @@ namespace DS.WMS.Core.Op.Entity /// /// 航线中文 /// - [SqlSugar.SugarColumn(ColumnDescription = "航线中文", Length = 50, IsNullable = true)] + [SqlSugar.SugarColumn(ColumnDescription = "航线中文", Length = 60, IsNullable = true)] public string LaneCName { get; set; } + /// + /// 航线主键 + /// + [SqlSugar.SugarColumn(ColumnDescription = "航线主键", IsNullable = true)] + public Nullable LaneId { get; set; } + /// /// 目的港代码 /// [SqlSugar.SugarColumn(ColumnDescription = "目的港代码", Length = 20, IsNullable = true)] public string PodCode { get; set; } + /// + /// 目的港主键 + /// + [SqlSugar.SugarColumn(ColumnDescription = "目的港主键", IsNullable = true)] + public string PodId { get; set; } + + /// + /// 目的港名称 + /// + [SqlSugar.SugarColumn(ColumnDescription = "目的港名称", Length = 60, IsNullable = true)] + public string PodName { get; set; } + /// /// 船公司主键 /// [SqlSugar.SugarColumn(ColumnDescription = "船公司主键", IsNullable = true)] - public long CarrierId { get; set; } + public Nullable CarrierId { get; set; } /// /// 船公司代码 @@ -63,6 +81,12 @@ namespace DS.WMS.Core.Op.Entity [SqlSugar.SugarColumn(ColumnDescription = "船公司代码", Length = 20, IsNullable = true)] public string CarrierCode { get; set; } + /// + /// 船公司 + /// + [SqlSugar.SugarColumn(ColumnDescription = "船公司", Length = 100, IsNullable = true)] + public string Carrier { get; set; } + /// /// 合约方公司全称 /// diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/BookingContractNo/BookingContractNoManageService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/BookingContractNo/BookingContractNoManageService.cs index 5ed56bfc..08ceb02c 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/BookingContractNo/BookingContractNoManageService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/BookingContractNo/BookingContractNoManageService.cs @@ -16,6 +16,8 @@ using System.Threading.Tasks; using DS.Module.Core.Extensions; using Microsoft.Owin.Security.Provider; using Microsoft.AspNetCore.Identity; +using DS.WMS.Core.Sys.Interface; +using DS.WMS.Core.Map.Dtos; namespace DS.WMS.Core.Op.Method { @@ -25,15 +27,20 @@ namespace DS.WMS.Core.Op.Method private readonly ISqlSugarClient db; private readonly IUser user; private readonly ISaasDbService saasService; + private readonly ISysCacheService _sysCacheService; private static readonly NLog.Logger Logger = LogManager.GetCurrentClassLogger(); + //船公司基础映射模块 + const string CONST_MAPPING_CARRIER_MODULE = "CarrierBaseMapping"; + public BookingContractNoManageService(IServiceProvider serviceProvider) { _serviceProvider = serviceProvider; db = _serviceProvider.GetRequiredService(); user = _serviceProvider.GetRequiredService(); saasService = _serviceProvider.GetRequiredService(); + _sysCacheService = _serviceProvider.GetRequiredService(); } #region 保存 @@ -50,6 +57,26 @@ namespace DS.WMS.Core.Op.Method try { + List mapCarrierList = new List(); + + var cacheRlt = _sysCacheService.GetAllCommonCodeFromCache(Sys.Method.SysCacheKeyEnum.CommonMappingCarrier) + .GetAwaiter().GetResult(); + + if(cacheRlt.Succeeded) + { + mapCarrierList = cacheRlt.Data; + + if (model.CarrierId.HasValue && model.CarrierId.Value > 0) + { + var mapInfo = mapCarrierList.FirstOrDefault(a => a.Module == CONST_MAPPING_CARRIER_MODULE && a.LinkId == model.CarrierId.Value); + + if (mapInfo != null) + { + model.CarrierCode = mapInfo.MapCode; + } + } + } + if (model.Id > 0) { info = await tenantDb.Queryable().FirstAsync(t => t.Id == model.Id);