zhangxiaofeng 8 months ago
commit 48a49fdb03

@ -56,5 +56,12 @@ namespace Myshipping.Application
[SugarColumn(ColumnName = "COMPARE_BATCHNO")]
[Description("比对批次号")]
public string COMPARE_BATCHNO { get; set; }
/// <summary>
/// 任务BC主键
/// </summary>
[SugarColumn(ColumnName = "BC_TASK_ID")]
[Description("任务BC主键")]
public string BC_TASK_ID { get; set; }
}
}

@ -1168,7 +1168,12 @@ namespace Myshipping.Application
throw Oops.Oh($"获取舱位变更比对结果错误,比对内容不存在");
}
return JSON.Deserialize<List<CompareResultDetailInfo>>(compareInfo.COMPARE_RLT);
if(!string.IsNullOrWhiteSpace(compareInfo.COMPARE_RLT))
{
return JSON.Deserialize<List<CompareResultDetailInfo>>(compareInfo.COMPARE_RLT);
}
return new List<CompareResultDetailInfo>();
}
#endregion
@ -1570,10 +1575,10 @@ namespace Myshipping.Application
/// <summary>
/// 批量发送邮件提醒(发送客户)
/// </summary>
/// <param name="ids">舱位主键组</param>
/// <param name="model">舱位批量发送邮件请求</param>
/// <returns></returns>
[HttpPost("/BookingSlot/SendEmail")]
public async Task<TaskManageOrderResultDto> SendEmail([FromBody]long[] ids)
public async Task<TaskManageOrderResultDto> SendEmail(BookingSlotSendEmailDto model)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();

@ -21,20 +21,21 @@ namespace Myshipping.Application
.Map(dest => dest.BookingSlotTypeName, src => src.BOOKING_SLOT_TYPE_NAME)
.Map(dest => dest.Vessel, src => src.VESSEL)
.Map(dest => dest.VoyNo, src => src.VOYNO)
.Map(dest => dest.VGMSubmissionCutDate, src => src.VGM_SUBMISSION_CUT_DATE)
.Map(dest => dest.VGMSubmissionCutDate, src => src.VGM_SUBMISSION_CUT_DATE.HasValue ? src.VGM_SUBMISSION_CUT_DATE.Value.ToString("yyyy-MM-dd HH:mm:ss") : "")
.Map(dest => dest.WeekAt, src => src.WEEK_AT)
.Map(dest => dest.CarriageType, src => src.CARRIAGE_TYPE)
.Map(dest => dest.CarriageTypeName, src => src.CARRIAGE_TYPE_NAME)
.Map(dest => dest.ContractNo, src => src.CONTRACT_NO)
.Map(dest => dest.CtnStat, src => src.CTN_STAT)
.Map(dest => dest.CYCutoffTime, src => src.CY_CUT_DATE)
.Map(dest => dest.CYCutoffTime, src => src.CY_CUT_DATE.HasValue? src.CY_CUT_DATE.Value.ToString("yyyy-MM-dd HH:mm:ss"):"")
.Map(dest => dest.DetensionFreeDays, src => src.DETENSION_FREE_DAYS)
.Map(dest => dest.ETD, src => src.ETD)
.Map(dest => dest.ETA, src => src.ETA)
.Map(dest => dest.ETD, src => src.ETD.HasValue ? src.ETD.Value.ToString("yyyy-MM-dd HH:mm:ss") : "")
.Map(dest => dest.ETA, src => src.ETA.HasValue ? src.ETA.Value.ToString("yyyy-MM-dd HH:mm:ss") : "")
.Map(dest => dest.LaneCode, src => src.LANECODE)
.Map(dest => dest.LaneName, src => src.LANENAME)
.Map(dest => dest.ManifestCutDate, src => src.MANIFEST_CUT_DATE)
.Map(dest => dest.MDGFCutDate, src => src.MDGF_CUT_DATE)
.Map(dest => dest.ManifestCutDate, src => src.MANIFEST_CUT_DATE.HasValue ? src.CY_CUT_DATE.Value.ToString("yyyy-MM-dd HH:mm:ss") : "")
.Map(dest => dest.MDGFCutDate, src => src.MDGF_CUT_DATE.HasValue ? src.MDGF_CUT_DATE.Value.ToString("yyyy-MM-dd HH:mm:ss") : "")
.Map(dest => dest.SICutDate, src => src.SI_CUT_DATE.HasValue ? src.SI_CUT_DATE.Value.ToString("yyyy-MM-dd HH:mm:ss") : "")
.Map(dest => dest.PlaceDelivery, src => src.PLACEDELIVERY)
.Map(dest => dest.PlaceReceipt, src => src.PLACERECEIPT)
.Map(dest => dest.PortDischarge, src => src.PORTDISCHARGE)
@ -50,20 +51,21 @@ namespace Myshipping.Application
.Map(dest => dest.BookingSlotTypeName, src => src.BOOKING_SLOT_TYPE_NAME)
.Map(dest => dest.Vessel, src => src.VESSEL)
.Map(dest => dest.VoyNo, src => src.VOYNO)
.Map(dest => dest.VGMSubmissionCutDate, src => src.VGM_SUBMISSION_CUT_DATE)
.Map(dest => dest.VGMSubmissionCutDate, src => src.VGM_SUBMISSION_CUT_DATE.HasValue ? src.VGM_SUBMISSION_CUT_DATE.Value.ToString("yyyy-MM-dd HH:mm:ss") : "")
.Map(dest => dest.WeekAt, src => src.WEEK_AT)
.Map(dest => dest.CarriageType, src => src.CARRIAGE_TYPE)
.Map(dest => dest.CarriageTypeName, src => src.CARRIAGE_TYPE_NAME)
.Map(dest => dest.ContractNo, src => src.CONTRACT_NO)
.Map(dest => dest.CtnStat, src => src.CTN_STAT)
.Map(dest => dest.CYCutoffTime, src => src.CY_CUT_DATE)
.Map(dest => dest.CYCutoffTime, src => src.CY_CUT_DATE.HasValue ? src.CY_CUT_DATE.Value.ToString("yyyy-MM-dd HH:mm:ss") : "")
.Map(dest => dest.DetensionFreeDays, src => src.DETENSION_FREE_DAYS)
.Map(dest => dest.ETD, src => src.ETD)
.Map(dest => dest.ETA, src => src.ETA)
.Map(dest => dest.ETD, src => src.ETD.HasValue ? src.ETD.Value.ToString("yyyy-MM-dd HH:mm:ss") : "")
.Map(dest => dest.ETA, src => src.ETA.HasValue ? src.ETA.Value.ToString("yyyy-MM-dd HH:mm:ss") : "")
.Map(dest => dest.LaneCode, src => src.LANECODE)
.Map(dest => dest.LaneName, src => src.LANENAME)
.Map(dest => dest.ManifestCutDate, src => src.MANIFEST_CUT_DATE)
.Map(dest => dest.MDGFCutDate, src => src.MDGF_CUT_DATE)
.Map(dest => dest.ManifestCutDate, src => src.MANIFEST_CUT_DATE.HasValue ? src.MANIFEST_CUT_DATE.Value.ToString("yyyy-MM-dd HH:mm:ss") : "")
.Map(dest => dest.MDGFCutDate, src => src.MDGF_CUT_DATE.HasValue ? src.MDGF_CUT_DATE.Value.ToString("yyyy-MM-dd HH:mm:ss") : "")
.Map(dest => dest.SICutDate, src => src.SI_CUT_DATE.HasValue ? src.SI_CUT_DATE.Value.ToString("yyyy-MM-dd HH:mm:ss") : "")
.Map(dest => dest.PlaceDelivery, src => src.PLACEDELIVERY)
.Map(dest => dest.PlaceReceipt, src => src.PLACERECEIPT)
.Map(dest => dest.PortDischarge, src => src.PORTDISCHARGE)

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
public class BookingSlotSendEmailDto
{
/// <summary>
/// 舱位主键组
/// </summary>
public List<long> ids { get; set; }
/// <summary>
/// 是否默认使用用户个人邮箱发送
/// </summary>
public bool usePersonalEmailSend { get; set; } = false;
}
}

@ -118,15 +118,15 @@ namespace Myshipping.Application
/// 校验是否可以生成订舱订单
/// </summary>
/// <param name="id">舱位主键</param>
/// <returns></returns>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> ValidateCreateBookingOrder(long id);
/// <summary>
/// 批量发送邮件提醒(发送客户)
/// </summary>
/// <param name="ids">舱位主键组</param>
/// <returns></returns>
Task<TaskManageOrderResultDto> SendEmail(long[] ids);
/// <param name="model">舱位批量发送邮件请求</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> SendEmail(BookingSlotSendEmailDto model);
}
}

@ -115,6 +115,11 @@ namespace Myshipping.Application
/// 是否直接发送邮件给订舱联系人
/// </summary>
public bool IsDirectSend { get; set; } = false;
/// <summary>
/// 是否默认使用用户个人邮箱发送 false-使用公共邮箱 true-使用个人邮箱
/// </summary>
public bool usePersonalEmailSend { get; set; } = false;
}
public class CustomerContact

@ -89,32 +89,32 @@ namespace Myshipping.Application
/// <summary>
/// 截关时间
/// </summary>
public Nullable<DateTime> ClosingDate { get; set; }
public string ClosingDate { get; set; }
/// <summary>
/// 截VGM时间
/// </summary>
public Nullable<DateTime> VGMCutoffTime { get; set; }
public string VGMCutoffTime { get; set; }
/// <summary>
/// ETA(预计到港时间)
/// </summary>
public Nullable<DateTime> ETA { get; set; }
public string ETA { get; set; }
/// <summary>
/// ETD(预计离港时间)
/// </summary>
public Nullable<DateTime> ETD { get; set; }
public string ETD { get; set; }
/// <summary>
/// 目的港ETA
/// </summary>
public Nullable<DateTime> PODETA { get; set; }
public string PODETA { get; set; }
/// <summary>
/// 截单时间
/// </summary>
public Nullable<DateTime> CutSingleTime { get; set; }
public string CutSingleTime { get; set; }
/// <summary>
/// 卸货港
@ -209,7 +209,7 @@ namespace Myshipping.Application
/// <summary>
/// 截港时间
/// </summary>
public Nullable<DateTime> CYCutoffTime { get; set; }
public string CYCutoffTime { get; set; }
/// <summary>
/// 状态 TEMP-暂存 SUCC-已对应 ERROR-异常
@ -224,7 +224,7 @@ namespace Myshipping.Application
/// <summary>
/// 最后对应时间,最后关联到订舱日期
/// </summary>
public Nullable<DateTime> LastToBookingDate { get; set; }
public string LastToBookingDate { get; set; }
/// <summary>
/// 来源邮箱
@ -314,22 +314,22 @@ namespace Myshipping.Application
/// <summary>
/// 样单截止日期
/// </summary>
public Nullable<DateTime> SICutDate { get; set; }
public string SICutDate { get; set; }
/// <summary>
/// VGM截止日期
/// </summary>
public Nullable<DateTime> VGMSubmissionCutDate { get; set; }
public string VGMSubmissionCutDate { get; set; }
/// <summary>
/// 舱单截止时间
/// </summary>
public Nullable<DateTime> ManifestCutDate { get; set; }
public string ManifestCutDate { get; set; }
/// <summary>
/// MDGF提交截止时间
/// </summary>
public Nullable<DateTime> MDGFCutDate { get; set; }
public string MDGFCutDate { get; set; }
/// <summary>
/// 中转港1
@ -355,12 +355,12 @@ namespace Myshipping.Application
/// <summary>
/// 二程ETD
/// </summary>
public Nullable<DateTime> SecondETD { get; set; }
public string SecondETD { get; set; }
/// <summary>
/// 二程ETA
/// </summary>
public Nullable<DateTime> SecondETA { get; set; }
public string SecondETA { get; set; }
/// <summary>
/// 订舱确认时间

@ -80,8 +80,9 @@ namespace Myshipping.Application
/// 发送邮件
/// </summary>
/// <param name="taskPKId">BC任务主键</param>
/// <param name="usePersonalEmailSend">是否默认使用用户个人邮箱发送</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> SendEmail(string taskPKId);
Task<TaskManageOrderResultDto> SendEmail(string taskPKId, bool usePersonalEmailSend = false);
/// <summary>
/// 获取当前比对结果

@ -35,8 +35,9 @@ namespace Myshipping.Application
/// 发送邮件
/// </summary>
/// <param name="taskPKId">DRAFT任务主键</param>
/// <param name="usePersonalEmailSend">是否使用个人邮箱发送</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> SendEmail(string taskPKId);
Task<TaskManageOrderResultDto> SendEmail(string taskPKId,bool usePersonalEmailSend = false);
/// <summary>
/// 重新处理DRAFT任务

@ -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}");
@ -1615,21 +1634,40 @@ namespace Myshipping.Application
{
emailTitle = $"【变更】Booking Amendment : {taskBCInfo.MBL_NO}";
}
//读取邮件模板并填充数据
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,8 +1700,16 @@ namespace Myshipping.Application
_logger.LogInformation($"推送邮件完成,结果:{JSON.Serialize(emailRlt)}");
result.succ = true;
result.msg = "成功";
if(emailRlt.succ)
{
result.succ = true;
result.msg = "成功";
}
else
{
result.succ = false;
result.msg = emailRlt.msg;
}
}
catch (Exception ex)
{
@ -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,10 +1997,120 @@ 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();
if (noreplyTr != null)
@ -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,32 +2404,81 @@ 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));
var slotInfo = await server.SearchBookingSlotWithOrderByNo(mblNo);
if (slotInfo == null)
throw Oops.Oh($"提单号{mblNo}未提取有效的舱位信息");
//首先检索关联舱位
if (!taskBCInfo.BOOKING_SLOT_ID.HasValue)
{
//var server = _namedBookingSlotServiceProvider.GetService<ITransient>(nameof(BookingSlotService));
var slotInfo = await server.SearchBookingSlotWithOrderByNo(mblNo);
if (slotInfo == null)
throw Oops.Oh($"提单号{mblNo}未提取有效的舱位信息");
taskBCInfo.BOOKING_SLOT_ID = slotInfo.BookingSlotId;
taskBCInfo.UpdatedUserId = UserManager.UserId;
taskBCInfo.UpdatedUserName = UserManager.Name;
if (slotInfo.HasBookingOrder && !taskBCInfo.BOOKING_ORDER_ID.HasValue)
{
taskBCInfo.BOOKING_ORDER_ID = slotInfo.BookingOrderList.FirstOrDefault();
taskBCInfo.BOOKING_SLOT_ID = slotInfo.BookingSlotId;
taskBCInfo.UpdatedUserId = UserManager.UserId;
taskBCInfo.UpdatedUserName = UserManager.Name;
//更新任务BC
await _taskBCInfoRepository.AsUpdateable(taskBCInfo).UpdateColumns(it => new
{
it.BOOKING_SLOT_ID,
it.BOOKING_ORDER_ID,
it.UpdatedTime,
it.UpdatedUserId,
it.UpdatedUserName
//更新任务BC
await _taskBCInfoRepository.AsUpdateable(taskBCInfo).UpdateColumns(it => new
}).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)
{
it.BOOKING_SLOT_ID,
it.UpdatedTime,
it.UpdatedUserId,
it.UpdatedUserName
var slotInfo = await server.SearchBookingSlotWithOrderByNo(mblNo);
}).ExecuteCommandAsync();
if (slotInfo == null)
throw Oops.Oh($"提单号{mblNo}未提取有效的舱位信息");
_logger.LogInformation($"提单号{mblNo} 提取到舱位ID,更新完成");
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();

@ -207,9 +207,10 @@ namespace Myshipping.Application
/// 发送邮件
/// </summary>
/// <param name="taskPKId">DRAFT任务主键</param>
/// <param name="usePersonalEmailSend">是否使用个人邮箱发送</param>
/// <returns>返回回执</returns>
[HttpGet("/TaskManageDRAFT/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($"DRAFT任务主键不能为空");
@ -225,7 +226,7 @@ namespace Myshipping.Application
if (draft == null)
throw Oops.Oh($"任务主键{taskPKId}无法获取DRAFT业务信息");
return await GenerateSendEmail(draft);
return await GenerateSendEmail(draft, usePersonalEmailSend);
}
#endregion
@ -235,7 +236,7 @@ namespace Myshipping.Application
/// </summary>
/// <param name="taskDraftInfo">DRAFT任务详情</param>
/// <returns>返回回执</returns>
private async Task<TaskManageOrderResultDto> GenerateSendEmail(TaskDraftInfo taskDraftInfo)
private async Task<TaskManageOrderResultDto> GenerateSendEmail(TaskDraftInfo taskDraftInfo, bool usePersonalEmailSend = false)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();

@ -133,7 +133,7 @@
"GetDraftCompareUrl": "http://localhost:5110/api/TaskDraftCompare/DraftCompareResult",
"DraftReadUrl": "http://localhost:5110/api/TaskDraftCompare/ExcuteDraftFileRead",
"EmailTemplateFilePath": "\\EmailTemplate",
"BCCompareUrl": "http://60.209.125.238:35210/api/TaskBookingAmendmentParser/ExcuteBookingAmendmentCompare",
"BCCompareUrl": "http://localhost:5110/api/TaskBookingAmendmentParser/ExcuteBookingAmendmentCompare",
"MSKAPIDjyUserKey": "wu",
"MSKAPIDjyUserSecret": "123456",
"MSKAPIOPEnvironment": "TEST"

@ -24,31 +24,31 @@
<td>
<table class="base-table" border="1" cellpadding="8" cellspacing="0" width="100%" align="center" style="border-collapse: collapse;border-color: #ebeef5">
<tr>
<td class="billno-label" width="15%">提单号:</td>
<td class="billno-label" width="30%">提单号:</td>
<td class="billno-val" width="160">TEST123456</td>
</tr>
<tr>
<td class="takebillno-label" width="15%">提箱提单号:</td>
<td class="takebillno-label" width="30%">提箱提单号:</td>
<td class="takebillno-val" width="160">TEST123456</td>
</tr>
<tr>
<td class="pol-label" width="15%">POL:</td>
<td class="pol-label" width="30%">POL:</td>
<td class="pol-val" width="160">Qingdao,Shandong,China</td>
</tr>
<tr>
<td class="pod-label" width="15%">POD:</td>
<td class="pod-label" width="30%">POD:</td>
<td class="pod-val" width="160">Fremantle,Western Australia,Australia</td>
</tr>
<tr>
<td class="ctn-label" width="15%">箱型箱量:</td>
<td class="ctn-label" width="30%">箱型箱量:</td>
<td class="ctn-val" width="160">40OH*1</td>
</tr>
<tr class="modify-tr"></tr>
</table>
</td>
</tr>
<tr class="email-noreply">
<td>
<p class="dynamic-val"></p>
<p class="notice1-val">请您按照更新的ETD在免箱期内用箱以免产生超期箱使费谢谢</p>
<p class="notice2-val">请不要回复此邮箱(自动发送邮箱无人处理邮件),如有疑问,请联系#opname#(邮箱#opemail#,电话#optel#),谢谢!</p>
<p class="notice3-val">货物到港后,贵司保证目的港收货人及时提取货物。因货物提取不及时/弃货产生的滞箱费、堆存费、港口费、货物处理费等概由贵司或者目的港收货人承担。如果我司对外承担了上述费用,则贵司应当无条件支付给我司,如果因此给我司造成了经济损失,则贵司还应当赔偿我司所有经济损失,包括但不限于律师费、诉讼费等等。一旦此票提箱出运就视为同意此条款,谢谢配合!</p>

Loading…
Cancel
Save