|
|
|
@ -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<ISqlSugarClient>();
|
|
|
|
|
user = _serviceProvider.GetRequiredService<IUser>();
|
|
|
|
|
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
|
|
|
|
|
_sysCacheService = _serviceProvider.GetRequiredService<ISysCacheService>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 保存
|
|
|
|
@ -50,6 +57,26 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
List<MappingCarrierRes> mapCarrierList = new List<MappingCarrierRes>();
|
|
|
|
|
|
|
|
|
|
var cacheRlt = _sysCacheService.GetAllCommonCodeFromCache<MappingCarrierRes>(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<BookingContractNoManage>().FirstAsync(t => t.Id == model.Id);
|
|
|
|
|