|
|
|
@ -13,6 +13,7 @@ using Microsoft.Extensions.Logging;
|
|
|
|
|
using Myshipping.Application.ConfigOption;
|
|
|
|
|
using Myshipping.Application.Entity;
|
|
|
|
|
using Myshipping.Application.Enum;
|
|
|
|
|
using Myshipping.Application.Service.BookingOrder;
|
|
|
|
|
using Myshipping.Application.Service.BookingSlot.Dto;
|
|
|
|
|
using Myshipping.Core;
|
|
|
|
|
using Myshipping.Core.Entity;
|
|
|
|
@ -21,6 +22,7 @@ using Newtonsoft.Json;
|
|
|
|
|
using Npoi.Mapper;
|
|
|
|
|
using NPOI.HPSF;
|
|
|
|
|
using NPOI.SS.Formula.Functions;
|
|
|
|
|
using NPOI.Util;
|
|
|
|
|
using NPOI.XWPF.UserModel;
|
|
|
|
|
using Org.BouncyCastle.Asn1.Tsp;
|
|
|
|
|
using RabbitMQ.Client;
|
|
|
|
@ -47,7 +49,7 @@ namespace Myshipping.Application
|
|
|
|
|
/// BC任务
|
|
|
|
|
/// </summary>
|
|
|
|
|
[ApiDescriptionSettings("Application", Name = "TaskManageBC", Order = 10)]
|
|
|
|
|
public class TaskManageBCService: ITaskManageBCService, IDynamicApiController
|
|
|
|
|
public class TaskManageBCService: ITaskManageBCService, IDynamicApiController, ITransient
|
|
|
|
|
{
|
|
|
|
|
private readonly ISysCacheService _cache;
|
|
|
|
|
private readonly ILogger<TaskManageBCService> _logger;
|
|
|
|
@ -75,6 +77,7 @@ namespace Myshipping.Application
|
|
|
|
|
private readonly IBookingSlotService _bookingSlotService;
|
|
|
|
|
private readonly IBookingValueAddedService _bookingValueAddedService;
|
|
|
|
|
private readonly IDjyCustomerService _djyCustomerService;
|
|
|
|
|
private readonly INamedServiceProvider<IBookingMSKAPIService> _namedBookingMSKAPIServiceProvider;
|
|
|
|
|
|
|
|
|
|
private readonly INamedServiceProvider<IBookingSlotService> _namedBookingSlotServiceProvider;
|
|
|
|
|
|
|
|
|
@ -98,6 +101,7 @@ namespace Myshipping.Application
|
|
|
|
|
IDjyCustomerService djyCustomerService,
|
|
|
|
|
IBookingSlotService bookingSlotService, ISysCacheService cache, IBookingValueAddedService bookingValueAddedService,
|
|
|
|
|
INamedServiceProvider<IBookingSlotService> namedBookingSlotServiceProvider,
|
|
|
|
|
INamedServiceProvider<IBookingMSKAPIService> namedBookingMSKAPIServiceProvider,
|
|
|
|
|
SqlSugarRepository<BookingSlotBase> bookingSlotBaseRepository,
|
|
|
|
|
SqlSugarRepository<BookingSlotCtn> bookingSlotBaseCtnRepository,
|
|
|
|
|
SqlSugarRepository<BookingSlotAllocation> bookingSlotAllocationRepository,
|
|
|
|
@ -127,6 +131,8 @@ namespace Myshipping.Application
|
|
|
|
|
_bookingSlotBaseCtnRepository = bookingSlotBaseCtnRepository;
|
|
|
|
|
_bookingSlotAllocationRepository = bookingSlotAllocationRepository;
|
|
|
|
|
_bookingSlotAllocationCtnRepository = bookingSlotAllocationCtnRepository;
|
|
|
|
|
_namedBookingMSKAPIServiceProvider = namedBookingMSKAPIServiceProvider;
|
|
|
|
|
_namedBookingSlotServiceProvider = namedBookingSlotServiceProvider;
|
|
|
|
|
|
|
|
|
|
_logger = logger;
|
|
|
|
|
}
|
|
|
|
@ -308,7 +314,7 @@ namespace Myshipping.Application
|
|
|
|
|
Dictionary<string, List<BookingOrder>> toDoListDict = new Dictionary<string, List<BookingOrder>>();
|
|
|
|
|
//获取所有待处理的BC任务
|
|
|
|
|
var taskList = await _taskBCInfoRepository.AsQueryable().InnerJoin<TaskBaseInfo>((a,b)=>a.TASK_ID == b.PK_ID)
|
|
|
|
|
.Where((a, b)=> !a.BOOKING_ORDER_ID.HasValue && b.STATUS == TaskStatusEnum.Create.ToString())
|
|
|
|
|
.Where((a, b)=> !a.BOOKING_ORDER_ID.HasValue && b.STATUS == TaskStatusEnum.Create.ToString() && b.TASK_BASE_TYPE == TaskBaseTypeEnum.BC.ToString())
|
|
|
|
|
.Select((a,b)=>new { BC = a,TSK = b }).ToListAsync();
|
|
|
|
|
|
|
|
|
|
if (taskList.Count > 0)
|
|
|
|
@ -834,7 +840,7 @@ namespace Myshipping.Application
|
|
|
|
|
if (currBCOrder != null && model.IsDirectSend)
|
|
|
|
|
{
|
|
|
|
|
//异步推送邮件
|
|
|
|
|
var mailRlt = await GenerateSendEmail(currBCOrder);
|
|
|
|
|
var mailRlt = await GenerateSendEmail(currBCOrder, bcTaskInfo, model.usePersonalEmailSend);
|
|
|
|
|
|
|
|
|
|
if (!mailRlt.succ)
|
|
|
|
|
{
|
|
|
|
@ -961,7 +967,7 @@ namespace Myshipping.Application
|
|
|
|
|
if (currBCOrder != null && model.IsDirectSend)
|
|
|
|
|
{
|
|
|
|
|
//异步推送邮件
|
|
|
|
|
var mailRlt = await GenerateSendEmail(currBCOrder);
|
|
|
|
|
var mailRlt = await GenerateSendEmail(currBCOrder, bcTaskInfo, model.usePersonalEmailSend);
|
|
|
|
|
|
|
|
|
|
if (!mailRlt.succ)
|
|
|
|
|
{
|
|
|
|
@ -1518,8 +1524,10 @@ namespace Myshipping.Application
|
|
|
|
|
/// 生成并推送邮件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="taskBCInfo">BC任务详情</param>
|
|
|
|
|
/// <param name="bcTaskInfo">主任务详情</param>
|
|
|
|
|
/// <param name="usePersonalEmailSend">是否默认使用用户个人邮箱发送</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
private async Task<TaskManageOrderResultDto> GenerateSendEmail(TaskBCInfo taskBCInfo)
|
|
|
|
|
private async Task<TaskManageOrderResultDto> GenerateSendEmail(TaskBCInfo taskBCInfo, TaskBaseInfo bcTaskInfo, bool usePersonalEmailSend = false)
|
|
|
|
|
{
|
|
|
|
|
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
|
|
|
|
|
|
|
|
|
@ -1592,12 +1600,23 @@ namespace Myshipping.Application
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//提取当前公共邮箱的配置
|
|
|
|
|
var publicMailAccount = _djyUserMailAccount.FirstOrDefault(x => x.CreatedUserId == UserManager.UserId
|
|
|
|
|
DjyUserMailAccount publicMailAccount = null;
|
|
|
|
|
|
|
|
|
|
if(usePersonalEmailSend)
|
|
|
|
|
{
|
|
|
|
|
publicMailAccount = _djyUserMailAccount.FirstOrDefault(x => x.CreatedUserId == UserManager.UserId
|
|
|
|
|
&& x.SmtpPort > 0 && x.SmtpServer != null && x.SmtpServer != "");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//这个是公共邮箱配置
|
|
|
|
|
publicMailAccount = _djyUserMailAccount.FirstOrDefault(x => x.TenantId == UserManager.TENANT_ID && x.ShowName == "PublicSend"
|
|
|
|
|
&& x.SmtpPort > 0 && x.SmtpServer != null && x.SmtpServer != "");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (publicMailAccount == null)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Oh($"提取公共邮箱配置失败,请在用户邮箱账号管理增加配置显示名为BCNotice");
|
|
|
|
|
throw Oops.Oh($"提取公共邮箱配置失败,请在用户邮箱账号管理增加配置显示名为PublicSend或者配置个人邮箱");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation($"提取当前公共邮箱的配置完成,id={publicMailAccount.Id}");
|
|
|
|
@ -1617,19 +1636,38 @@ namespace Myshipping.Application
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//读取邮件模板并填充数据
|
|
|
|
|
string emailHtml = GenerateSendEmailHtml(taskBCInfo, opUserInfo,UserManager.TENANT_NAME).GetAwaiter().GetResult();
|
|
|
|
|
string emailHtml = string.Empty;
|
|
|
|
|
|
|
|
|
|
if (taskBCInfo.BUSI_TYPE == "BookingAmendment")
|
|
|
|
|
{
|
|
|
|
|
emailHtml = GenerateSendEmailHtmlAmendment(taskBCInfo, opUserInfo, UserManager.TENANT_NAME).GetAwaiter().GetResult();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
emailHtml = GenerateSendEmailHtml(taskBCInfo, opUserInfo, UserManager.TENANT_NAME).GetAwaiter().GetResult();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation($"生成邮件BODY,结果:{emailHtml}");
|
|
|
|
|
|
|
|
|
|
var fileInfo = _bookingFileRepository.AsQueryable().Where(a => a.BookingId == bookingOrderEntity.Id && a.TypeCode.Contains("bc_notice"))
|
|
|
|
|
TaskFileInfo fileInfo = null;
|
|
|
|
|
|
|
|
|
|
if (bcTaskInfo.TASK_BASE_TYPE == TaskBaseTypeEnum.BC.ToString())
|
|
|
|
|
{
|
|
|
|
|
fileInfo = _taskFileRepository.AsQueryable().Where(a => a.TASK_PKID == taskBCInfo.TASK_ID && a.FILE_CATEGORY.Contains("BC_NOTICE"))
|
|
|
|
|
.OrderByDescending(a => a.CreatedTime).First();
|
|
|
|
|
}
|
|
|
|
|
else if (bcTaskInfo.TASK_BASE_TYPE == TaskBaseTypeEnum.BC_MODIFY.ToString())
|
|
|
|
|
{
|
|
|
|
|
fileInfo = _taskFileRepository.AsQueryable().Where(a => a.TASK_PKID == taskBCInfo.TASK_ID && a.FILE_CATEGORY.Contains("BC_MODIFY_NOTICE"))
|
|
|
|
|
.OrderByDescending(a => a.CreatedTime).First();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fileInfo == null)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Oh($"提取订舱的Booking Confirmation Notice文件失败,不能发送邮件");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation($"获取订舱附件地址,结果:{fileInfo.FilePath}");
|
|
|
|
|
_logger.LogInformation($"获取订舱附件地址,结果:{fileInfo.FILE_PATH}");
|
|
|
|
|
|
|
|
|
|
var opt = App.GetOptions<BookingAttachOptions>();
|
|
|
|
|
var dirAbs = opt.basePath;
|
|
|
|
@ -1638,7 +1676,7 @@ namespace Myshipping.Application
|
|
|
|
|
dirAbs = App.WebHostEnvironment.WebRootPath;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
filePath = Path.Combine(dirAbs, fileInfo.FilePath);
|
|
|
|
|
filePath = Path.Combine(dirAbs, fileInfo.FILE_PATH);
|
|
|
|
|
|
|
|
|
|
EmailApiUserDefinedDto emailApiUserDefinedDto = new EmailApiUserDefinedDto
|
|
|
|
|
{
|
|
|
|
@ -1662,9 +1700,17 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation($"推送邮件完成,结果:{JSON.Serialize(emailRlt)}");
|
|
|
|
|
|
|
|
|
|
if(emailRlt.succ)
|
|
|
|
|
{
|
|
|
|
|
result.succ = true;
|
|
|
|
|
result.msg = "成功";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result.succ = false;
|
|
|
|
|
result.msg = emailRlt.msg;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation($"推送邮件失败,异常:{ex.Message}");
|
|
|
|
@ -1864,6 +1910,11 @@ namespace Myshipping.Application
|
|
|
|
|
if (string.IsNullOrWhiteSpace(baseHtml))
|
|
|
|
|
throw Oops.Oh($"读取邮件模板失败");
|
|
|
|
|
|
|
|
|
|
List<CompareResultDetailInfo> compareList = GetCompareResult(taskBCInfo.TASK_ID).GetAwaiter().GetResult();
|
|
|
|
|
|
|
|
|
|
if (compareList == null || compareList.Count == 0)
|
|
|
|
|
throw Oops.Oh($"读取变更数据失败,没有差异数据");
|
|
|
|
|
|
|
|
|
|
if (opUserInfo != null && !string.IsNullOrWhiteSpace(opUserInfo.Name))
|
|
|
|
|
{
|
|
|
|
|
baseHtml = baseHtml.Replace("#opname#", opUserInfo.Name);
|
|
|
|
@ -1932,6 +1983,7 @@ namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
|
baseTd.InnerHtml = taskBCInfo.CTN_STAT;
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
|
else if (baseTd.Attributes["class"].Value == "etd-val")
|
|
|
|
|
{
|
|
|
|
|
if (taskBCInfo.ETD.HasValue)
|
|
|
|
@ -1945,8 +1997,118 @@ namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
|
baseTd.InnerHtml = taskBCInfo.ETA.Value.ToString("yyyy-MM-dd");
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool isOnlyChangeOne = false;
|
|
|
|
|
|
|
|
|
|
List<string> nameList = new List<string>();
|
|
|
|
|
//船名
|
|
|
|
|
if (compareList.Any(x => x.FieldCode.Equals("vessel", StringComparison.OrdinalIgnoreCase)))
|
|
|
|
|
{
|
|
|
|
|
var name = compareList.FirstOrDefault(x => x.FieldCode.Equals("vessel", StringComparison.OrdinalIgnoreCase)).TargetVal;
|
|
|
|
|
|
|
|
|
|
baseTable.AppendChild(HtmlNode.CreateNode("<tr><td class=\"ctn-label\" width=\"30%\">船名 变更为:</td><td class=\"pod-val\" width=\"160\">" + name + "</td></tr>"));
|
|
|
|
|
|
|
|
|
|
nameList.Add("船名");
|
|
|
|
|
}
|
|
|
|
|
//航次号
|
|
|
|
|
if (compareList.Any(x => x.FieldCode.Equals("voyNo", StringComparison.OrdinalIgnoreCase)))
|
|
|
|
|
{
|
|
|
|
|
var name = compareList.FirstOrDefault(x => x.FieldCode.Equals("voyNo", StringComparison.OrdinalIgnoreCase)).TargetVal;
|
|
|
|
|
|
|
|
|
|
baseTable.AppendChild(HtmlNode.CreateNode("<tr><td class=\"ctn-label\" width=\"30%\">航次号 变更为:</td><td class=\"pod-val\" width=\"160\">" + name + "</td></tr>"));
|
|
|
|
|
|
|
|
|
|
nameList.Add("航次号");
|
|
|
|
|
}
|
|
|
|
|
//ETD
|
|
|
|
|
if (compareList.Any(x => x.FieldCode.Equals("ETD", StringComparison.OrdinalIgnoreCase)))
|
|
|
|
|
{
|
|
|
|
|
var name = compareList.FirstOrDefault(x => x.FieldCode.Equals("ETD", StringComparison.OrdinalIgnoreCase)).TargetVal;
|
|
|
|
|
|
|
|
|
|
baseTable.AppendChild(HtmlNode.CreateNode("<tr><td class=\"ctn-label\" width=\"30%\">ETD 变更为:</td><td class=\"pod-val\" width=\"160\">" + name + "</td></tr>"));
|
|
|
|
|
|
|
|
|
|
nameList.Add("ETD");
|
|
|
|
|
}
|
|
|
|
|
//ETA
|
|
|
|
|
if (compareList.Any(x => x.FieldCode.Equals("ETA", StringComparison.OrdinalIgnoreCase)))
|
|
|
|
|
{
|
|
|
|
|
var name = compareList.FirstOrDefault(x => x.FieldCode.Equals("ETA", StringComparison.OrdinalIgnoreCase)).TargetVal;
|
|
|
|
|
|
|
|
|
|
baseTable.AppendChild(HtmlNode.CreateNode("<tr><td class=\"ctn-label\" width=\"30%\">ETA 变更为:</td><td class=\"pod-val\" width=\"160\">" + name + "</td></tr>"));
|
|
|
|
|
|
|
|
|
|
nameList.Add("ETA");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//SICutDate 样单截止日期
|
|
|
|
|
if (compareList.Any(x => x.FieldCode.Equals("SICutDate", StringComparison.OrdinalIgnoreCase)))
|
|
|
|
|
{
|
|
|
|
|
var name = compareList.FirstOrDefault(x => x.FieldCode.Equals("SICutDate", StringComparison.OrdinalIgnoreCase)).TargetVal;
|
|
|
|
|
|
|
|
|
|
baseTable.AppendChild(HtmlNode.CreateNode("<tr><td class=\"ctn-label\" width=\"30%\">样单截止日期 变更为:</td><td class=\"pod-val\" width=\"160\">" + name + "</td></tr>"));
|
|
|
|
|
|
|
|
|
|
nameList.Add("样单截止日期");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//CYCutoffTime 截港时间
|
|
|
|
|
if (compareList.Any(x => x.FieldCode.Equals("CYCutoffTime", StringComparison.OrdinalIgnoreCase)))
|
|
|
|
|
{
|
|
|
|
|
var name = compareList.FirstOrDefault(x => x.FieldCode.Equals("CYCutoffTime", StringComparison.OrdinalIgnoreCase)).TargetVal;
|
|
|
|
|
|
|
|
|
|
baseTable.AppendChild(HtmlNode.CreateNode("<tr><td class=\"ctn-label\" width=\"30%\">截港时间 变更为:</td><td class=\"pod-val\" width=\"160\">" + name + "</td></tr>"));
|
|
|
|
|
|
|
|
|
|
nameList.Add("截港时间");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//ManifestCutDate 舱单截止时间
|
|
|
|
|
if (compareList.Any(x => x.FieldCode.Equals("ManifestCutDate", StringComparison.OrdinalIgnoreCase)))
|
|
|
|
|
{
|
|
|
|
|
var name = compareList.FirstOrDefault(x => x.FieldCode.Equals("ManifestCutDate", StringComparison.OrdinalIgnoreCase)).TargetVal;
|
|
|
|
|
|
|
|
|
|
baseTable.AppendChild(HtmlNode.CreateNode("<tr><td class=\"ctn-label\" width=\"30%\">舱单截止时间 变更为:</td><td class=\"pod-val\" width=\"160\">" + name + "</td></tr>"));
|
|
|
|
|
|
|
|
|
|
nameList.Add("舱单截止时间");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//VGMCutoffTime MDGF提交截止时间
|
|
|
|
|
if (compareList.Any(x => x.FieldCode.Equals("VGMCutoffTime", StringComparison.OrdinalIgnoreCase)))
|
|
|
|
|
{
|
|
|
|
|
var name = compareList.FirstOrDefault(x => x.FieldCode.Equals("VGMCutoffTime", StringComparison.OrdinalIgnoreCase)).TargetVal;
|
|
|
|
|
|
|
|
|
|
baseTable.AppendChild(HtmlNode.CreateNode("<tr><td class=\"ctn-label\" width=\"30%\">截VGM时间 变更为:</td><td class=\"pod-val\" width=\"160\">" + name + "</td></tr>"));
|
|
|
|
|
|
|
|
|
|
nameList.Add("截VGM时间");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//MDGFCutDate MDGF提交截止时间
|
|
|
|
|
if (compareList.Any(x => x.FieldCode.Equals("MDGFCutDate", StringComparison.OrdinalIgnoreCase)))
|
|
|
|
|
{
|
|
|
|
|
var name = compareList.FirstOrDefault(x => x.FieldCode.Equals("MDGFCutDate", StringComparison.OrdinalIgnoreCase)).TargetVal;
|
|
|
|
|
|
|
|
|
|
baseTable.AppendChild(HtmlNode.CreateNode("<tr><td class=\"ctn-label\" width=\"30%\">MDGF提交截止时间 变更为:</td><td class=\"pod-val\" width=\"160\">" + name + "</td></tr>"));
|
|
|
|
|
|
|
|
|
|
nameList.Add("MDGF提交截止时间");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//PlaceReceipt 收货地
|
|
|
|
|
if (compareList.Any(x => x.FieldCode.Equals("PlaceReceipt", StringComparison.OrdinalIgnoreCase)))
|
|
|
|
|
{
|
|
|
|
|
var name = compareList.FirstOrDefault(x => x.FieldCode.Equals("PlaceReceipt", StringComparison.OrdinalIgnoreCase)).TargetVal;
|
|
|
|
|
|
|
|
|
|
baseTable.AppendChild(HtmlNode.CreateNode("<tr><td class=\"ctn-label\" width=\"20%\">收货地 变更为:</td><td class=\"pod-val\" width=\"160\">" + name + "</td></tr>"));
|
|
|
|
|
|
|
|
|
|
nameList.Add("收货地");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//PlaceDelivery 交货地
|
|
|
|
|
if (compareList.Any(x => x.FieldCode.Equals("PlaceDelivery", StringComparison.OrdinalIgnoreCase)))
|
|
|
|
|
{
|
|
|
|
|
var name = compareList.FirstOrDefault(x => x.FieldCode.Equals("PlaceDelivery", StringComparison.OrdinalIgnoreCase)).TargetVal;
|
|
|
|
|
|
|
|
|
|
baseTable.AppendChild(HtmlNode.CreateNode("<tr><td class=\"ctn-label\" width=\"20%\">交货地 变更为:</td><td class=\"pod-val\" width=\"160\">" + name + "</td></tr>"));
|
|
|
|
|
|
|
|
|
|
nameList.Add("交货地");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var noreplyTr = html.DocumentNode.SelectNodes("//tr[@class='email-noreply']").FirstOrDefault();
|
|
|
|
@ -1965,6 +2127,13 @@ namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
|
baseP.InnerHtml = tenantName;
|
|
|
|
|
}
|
|
|
|
|
else if(baseP.Attributes["class"].Value == "dynamic-val")
|
|
|
|
|
{
|
|
|
|
|
if (nameList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
baseP.InnerHtml = $"请注意{(string.Join("、", nameList.ToArray()))} 变更,请您按相关的更新安排操作,谢谢!";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2028,7 +2197,7 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
emailList.Add(emailApiUserDefinedDto);
|
|
|
|
|
|
|
|
|
|
string strJoin = System.IO.File.ReadAllText(filePath);
|
|
|
|
|
//string strJoin = System.IO.File.ReadAllText(filePath);
|
|
|
|
|
|
|
|
|
|
DateTime bDate = DateTime.Now;
|
|
|
|
|
|
|
|
|
@ -2047,7 +2216,7 @@ namespace Myshipping.Application
|
|
|
|
|
TimeSpan ts = eDate.Subtract(bDate);
|
|
|
|
|
var timeDiff = ts.TotalMilliseconds;
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation($"邮件上传完成 上传文件大小:{heByte.Length} 用时:{timeDiff}ms.,{strJoin}");
|
|
|
|
|
_logger.LogInformation($"邮件上传完成 上传文件大小:{heByte.Length} 用时:{timeDiff}ms.,");
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation($"发送邮件返回:{JSON.Serialize(res)}");
|
|
|
|
|
|
|
|
|
@ -2075,9 +2244,10 @@ namespace Myshipping.Application
|
|
|
|
|
/// 发送邮件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="taskPKId">BC任务主键</param>
|
|
|
|
|
/// <param name="usePersonalEmailSend">是否默认使用用户个人邮箱发送</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
[HttpGet("/TaskManageBC/SendEmail")]
|
|
|
|
|
public async Task<TaskManageOrderResultDto> SendEmail(string taskPKId)
|
|
|
|
|
public async Task<TaskManageOrderResultDto> SendEmail(string taskPKId, bool usePersonalEmailSend = false)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrWhiteSpace(taskPKId))
|
|
|
|
|
throw Oops.Oh($"BC任务主键不能为空");
|
|
|
|
@ -2093,7 +2263,7 @@ namespace Myshipping.Application
|
|
|
|
|
if (bcOrder == null)
|
|
|
|
|
throw Oops.Oh($"任务主键{taskPKId}无法获取BC业务信息");
|
|
|
|
|
|
|
|
|
|
return await GenerateSendEmail(bcOrder);
|
|
|
|
|
return await GenerateSendEmail(bcOrder, bcTaskInfo);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
@ -2234,12 +2404,14 @@ namespace Myshipping.Application
|
|
|
|
|
if (taskBCInfo == null)
|
|
|
|
|
throw Oops.Oh($"BC任务主键{taskPkId}无法获取业务信息");
|
|
|
|
|
|
|
|
|
|
if (taskBCInfo.BOOKING_SLOT_ID.HasValue)
|
|
|
|
|
throw Oops.Oh($"当前BC任务已有匹配的舱位");
|
|
|
|
|
|
|
|
|
|
string mblNo = taskBCInfo.MBL_NO.ToUpper().Trim();
|
|
|
|
|
|
|
|
|
|
var server = _namedBookingSlotServiceProvider.GetService<ITransient>(nameof(BookingSlotService));
|
|
|
|
|
|
|
|
|
|
//首先检索关联舱位
|
|
|
|
|
if (!taskBCInfo.BOOKING_SLOT_ID.HasValue)
|
|
|
|
|
{
|
|
|
|
|
//var server = _namedBookingSlotServiceProvider.GetService<ITransient>(nameof(BookingSlotService));
|
|
|
|
|
var slotInfo = await server.SearchBookingSlotWithOrderByNo(mblNo);
|
|
|
|
|
|
|
|
|
|
if (slotInfo == null)
|
|
|
|
@ -2249,17 +2421,64 @@ namespace Myshipping.Application
|
|
|
|
|
taskBCInfo.UpdatedUserId = UserManager.UserId;
|
|
|
|
|
taskBCInfo.UpdatedUserName = UserManager.Name;
|
|
|
|
|
|
|
|
|
|
if (slotInfo.HasBookingOrder && !taskBCInfo.BOOKING_ORDER_ID.HasValue)
|
|
|
|
|
{
|
|
|
|
|
taskBCInfo.BOOKING_ORDER_ID = slotInfo.BookingOrderList.FirstOrDefault();
|
|
|
|
|
|
|
|
|
|
//更新任务BC
|
|
|
|
|
await _taskBCInfoRepository.AsUpdateable(taskBCInfo).UpdateColumns(it => new
|
|
|
|
|
{
|
|
|
|
|
it.BOOKING_SLOT_ID,
|
|
|
|
|
it.BOOKING_ORDER_ID,
|
|
|
|
|
it.UpdatedTime,
|
|
|
|
|
it.UpdatedUserId,
|
|
|
|
|
it.UpdatedUserName
|
|
|
|
|
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//更新任务BC
|
|
|
|
|
await _taskBCInfoRepository.AsUpdateable(taskBCInfo).UpdateColumns(it => new
|
|
|
|
|
{
|
|
|
|
|
it.BOOKING_SLOT_ID,
|
|
|
|
|
it.UpdatedTime,
|
|
|
|
|
it.UpdatedUserId,
|
|
|
|
|
it.UpdatedUserName
|
|
|
|
|
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation($"提单号{mblNo} 提取到舱位ID,更新完成");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//对应订舱订单
|
|
|
|
|
if (!taskBCInfo.BOOKING_ORDER_ID.HasValue)
|
|
|
|
|
{
|
|
|
|
|
var slotInfo = await server.SearchBookingSlotWithOrderByNo(mblNo);
|
|
|
|
|
|
|
|
|
|
if (slotInfo == null)
|
|
|
|
|
throw Oops.Oh($"提单号{mblNo}未提取有效的舱位信息");
|
|
|
|
|
|
|
|
|
|
if (slotInfo.HasBookingOrder && !taskBCInfo.BOOKING_ORDER_ID.HasValue)
|
|
|
|
|
{
|
|
|
|
|
taskBCInfo.BOOKING_ORDER_ID = slotInfo.BookingOrderList.FirstOrDefault();
|
|
|
|
|
taskBCInfo.UpdatedUserId = UserManager.UserId;
|
|
|
|
|
taskBCInfo.UpdatedUserName = UserManager.Name;
|
|
|
|
|
|
|
|
|
|
//更新任务BC
|
|
|
|
|
await _taskBCInfoRepository.AsUpdateable(taskBCInfo).UpdateColumns(it => new
|
|
|
|
|
{
|
|
|
|
|
it.BOOKING_ORDER_ID,
|
|
|
|
|
it.UpdatedTime,
|
|
|
|
|
it.UpdatedUserId,
|
|
|
|
|
it.UpdatedUserName
|
|
|
|
|
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation($"提单号{mblNo} 提取到订舱订单ID,更新完成");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//取消舱位
|
|
|
|
|
if (taskBCInfo.BUSI_TYPE == TaskBusiTypeEnum.CANCELLATION.ToString())
|
|
|
|
@ -2280,6 +2499,13 @@ namespace Myshipping.Application
|
|
|
|
|
var pushRlt = await server.ApiReceive(JSON.Serialize(slotModel));
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation($"提单号{mblNo} 推送舱位取消,结果={JSON.Serialize(pushRlt)}");
|
|
|
|
|
|
|
|
|
|
var service = _namedBookingMSKAPIServiceProvider
|
|
|
|
|
.GetService<ITransient>(nameof(BookingMSKAPIService));
|
|
|
|
|
|
|
|
|
|
var synRlt = await service.SyncBCInfo(taskBCInfo.MBL_NO, taskBCInfo.TenantId.Value, "Cancellation");
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation($"入库完BC,自动推送状态到API订舱列表 mblno={taskBCInfo.MBL_NO} synRlt={JSON.Serialize(synRlt)}");
|
|
|
|
|
}
|
|
|
|
|
else if (taskBCInfo.BUSI_TYPE == TaskBusiTypeEnum.BC_MODIFY.ToString())
|
|
|
|
|
{
|
|
|
|
@ -2317,7 +2543,7 @@ namespace Myshipping.Application
|
|
|
|
|
TRANSFER_PORT_2 = taskBCInfo.TRANSFER_PORT_2,
|
|
|
|
|
CtnList = new List<BookingSlotCtnSaveInput>()
|
|
|
|
|
},
|
|
|
|
|
OpType = "add"
|
|
|
|
|
OpType = "update"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var ctnList = _taskBCCTNInfoRepository.AsQueryable().Where(a => a.P_ID == taskBCInfo.PK_ID).ToList();
|
|
|
|
|