diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index b0ee10e1..23b33922 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -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.ORDERNO = order.BOOKINGNO; diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs index 7fe94a40..ffbdc5db 100644 --- a/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs @@ -17,10 +17,12 @@ using Myshipping.Application.Entity; using Myshipping.Application.Helper; using Myshipping.Core; using Myshipping.Core.Entity; +using Myshipping.Core.Helper; using Myshipping.Core.Service; using MySqlX.XDevAPI.Common; using Newtonsoft.Json; using Newtonsoft.Json.Linq; +using Npoi.Mapper; using NPOI.HPSF; using NPOI.SS.Formula.Functions; using NPOI.XSSF.Model; @@ -69,6 +71,8 @@ namespace Myshipping.Application private readonly SqlSugarRepository _bookingOrderContaCargoRepository; private readonly SqlSugarRepository _bookingStatusRepository; + private readonly SqlSugarRepository _djyUserMailAccountRepository; + private readonly IDjyWebsiteAccountConfigService _webAccountConfig; private readonly ISysCacheService _cache; private readonly ILogger _logger; @@ -96,6 +100,7 @@ namespace Myshipping.Application SqlSugarRepository bookingOrderContaRepository, SqlSugarRepository bookingOrderContaCargoRepository, SqlSugarRepository bookingStatusRepository, + SqlSugarRepository djyUserMailAccountRepository, IDjyWebsiteAccountConfigService webAccountConfig, ISysCacheService cache, ILogger logger) @@ -116,6 +121,7 @@ namespace Myshipping.Application _bookingOrderContaRepository = bookingOrderContaRepository; _bookingOrderContaCargoRepository = bookingOrderContaCargoRepository; _bookingStatusRepository = bookingStatusRepository; + _djyUserMailAccountRepository = djyUserMailAccountRepository; _webAccountConfig = webAccountConfig; _cache = cache; @@ -1774,6 +1780,48 @@ namespace Myshipping.Application { 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; } @@ -1857,7 +1905,7 @@ namespace Myshipping.Application } catch(Exception ex) { - throw Oops.Bah($"获取发送下货纸异常,{0}", ex.Message); + throw Oops.Bah($"发送下货纸异常,{0}", ex.Message); } return result;