|
|
@ -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;
|
|
|
|