修改EDI增加付费方式EDI映射调取

optimize
jianghaiqing 2 years ago
parent 5c246fa570
commit d4344d36a0

@ -2856,6 +2856,25 @@ namespace Myshipping.Application
} }
} }
//ESL、PIL、WY、YML、YT 需要付费方式映射EDI代码
if (ediRouteEnum == EDIRouteEnum.ESL || ediRouteEnum == EDIRouteEnum.PIL || ediRouteEnum == EDIRouteEnum.WY
|| ediRouteEnum == EDIRouteEnum.YML || ediRouteEnum == EDIRouteEnum.YT)
{
//付费方式映射
var ediFrtList = _cache.GetAllMappingFrt().GetAwaiter().GetResult()
.Where(t => t.Module.Equals(CONST_MAPPING_MODULE, StringComparison.OrdinalIgnoreCase)).ToList();
if (!string.IsNullOrWhiteSpace(order.BLFRT))
{
var currFrtInfo = ediFrtList.FirstOrDefault(t => t.Code.Equals(order.BLFRT, StringComparison.OrdinalIgnoreCase));
if (currFrtInfo == null)
throw Oops.Bah($"付费方式{order.YARDID}的EDI代码未找到");
primaryModel.BLFRTEDICODE = currFrtInfo.MapCode?.Trim();
}
}
primaryModel.CARRIEREDICODE = ediSOSICfg.MapCode; primaryModel.CARRIEREDICODE = ediSOSICfg.MapCode;
primaryModel.ORDERNO = order.BOOKINGNO; primaryModel.ORDERNO = order.BOOKINGNO;

@ -17,10 +17,12 @@ using Myshipping.Application.Entity;
using Myshipping.Application.Helper; using Myshipping.Application.Helper;
using Myshipping.Core; using Myshipping.Core;
using Myshipping.Core.Entity; using Myshipping.Core.Entity;
using Myshipping.Core.Helper;
using Myshipping.Core.Service; using Myshipping.Core.Service;
using MySqlX.XDevAPI.Common; using MySqlX.XDevAPI.Common;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using Npoi.Mapper;
using NPOI.HPSF; using NPOI.HPSF;
using NPOI.SS.Formula.Functions; using NPOI.SS.Formula.Functions;
using NPOI.XSSF.Model; using NPOI.XSSF.Model;
@ -69,6 +71,8 @@ namespace Myshipping.Application
private readonly SqlSugarRepository<BookingCtnDetail> _bookingOrderContaCargoRepository; private readonly SqlSugarRepository<BookingCtnDetail> _bookingOrderContaCargoRepository;
private readonly SqlSugarRepository<BookingStatus> _bookingStatusRepository; private readonly SqlSugarRepository<BookingStatus> _bookingStatusRepository;
private readonly SqlSugarRepository<DjyUserMailAccount> _djyUserMailAccountRepository;
private readonly IDjyWebsiteAccountConfigService _webAccountConfig; private readonly IDjyWebsiteAccountConfigService _webAccountConfig;
private readonly ISysCacheService _cache; private readonly ISysCacheService _cache;
private readonly ILogger<BookingOrderService> _logger; private readonly ILogger<BookingOrderService> _logger;
@ -96,6 +100,7 @@ namespace Myshipping.Application
SqlSugarRepository<BookingCtn> bookingOrderContaRepository, SqlSugarRepository<BookingCtn> bookingOrderContaRepository,
SqlSugarRepository<BookingCtnDetail> bookingOrderContaCargoRepository, SqlSugarRepository<BookingCtnDetail> bookingOrderContaCargoRepository,
SqlSugarRepository<BookingStatus> bookingStatusRepository, SqlSugarRepository<BookingStatus> bookingStatusRepository,
SqlSugarRepository<DjyUserMailAccount> djyUserMailAccountRepository,
IDjyWebsiteAccountConfigService webAccountConfig, IDjyWebsiteAccountConfigService webAccountConfig,
ISysCacheService cache, ISysCacheService cache,
ILogger<BookingOrderService> logger) ILogger<BookingOrderService> logger)
@ -116,6 +121,7 @@ namespace Myshipping.Application
_bookingOrderContaRepository = bookingOrderContaRepository; _bookingOrderContaRepository = bookingOrderContaRepository;
_bookingOrderContaCargoRepository = bookingOrderContaCargoRepository; _bookingOrderContaCargoRepository = bookingOrderContaCargoRepository;
_bookingStatusRepository = bookingStatusRepository; _bookingStatusRepository = bookingStatusRepository;
_djyUserMailAccountRepository = djyUserMailAccountRepository;
_webAccountConfig = webAccountConfig; _webAccountConfig = webAccountConfig;
_cache = cache; _cache = cache;
@ -1774,6 +1780,48 @@ namespace Myshipping.Application
{ {
TaskManageOrderResultDto result = new TaskManageOrderResultDto(); TaskManageOrderResultDto result = new TaskManageOrderResultDto();
try
{
var taskInfo = _taskBaseInfoRepository.AsQueryable().First(t => t.PK_ID == taskPKId);
if (taskInfo == null)
Oops.Oh($"任务信息获取失败");
if (taskInfo.TASK_TYPE != TaskBusiTypeEnum.TELEX_NOTICE.ToString() || taskInfo.TASK_TYPE != TaskBusiTypeEnum.SEAWAYBILL_DOWN.ToString())
Oops.Oh($"当前任务类型不是{TaskBusiTypeEnum.TELEX_NOTICE.GetDescription()}、{TaskBusiTypeEnum.SEAWAYBILL_DOWN.GetDescription()},不能转发邮件");
if (string.IsNullOrWhiteSpace(taskInfo.BOOK_ORDER_NO))
Oops.Oh($"任务信息的订舱主键不存在");
var orderInfo = _bookingOrderRepository.AsQueryable()
.First(t => t.Id == long.Parse(taskInfo.BOOK_ORDER_NO));
if (orderInfo == null)
Oops.Oh($"订舱信息获取失败");
var userMail = _djyUserMailAccountRepository.AsQueryable().First(x => x.CreatedUserId == orderInfo.CreatedUserId);
if (userMail == null || string.IsNullOrWhiteSpace(userMail.SmtpServer) || userMail.SmtpPort == 0)
{
Oops.Oh($"发件邮箱未配置,或者配置不完整");
}
string emailSubject = string.Empty;
string emailBody = string.Empty;
var sendResult = await MailSendHelper.SendMail(userMail, emailSubject, emailBody, toMail);
if (!sendResult.Key)
{
Oops.Oh(sendResult.Value);
}
}
catch(Exception ex)
{
throw Oops.Bah($"获取发送下货纸异常,{0}", ex.Message);
}
return result; return result;
} }
@ -1857,7 +1905,7 @@ namespace Myshipping.Application
} }
catch(Exception ex) catch(Exception ex)
{ {
throw Oops.Bah($"获取发送下货纸异常,{0}", ex.Message); throw Oops.Bah($"发送下货纸异常,{0}", ex.Message);
} }
return result; return result;

Loading…
Cancel
Save