diff --git a/Myshipping.Application/Enum/TaskBaseTypeEnum.cs b/Myshipping.Application/Enum/TaskBaseTypeEnum.cs
index e72453e1..11e933b8 100644
--- a/Myshipping.Application/Enum/TaskBaseTypeEnum.cs
+++ b/Myshipping.Application/Enum/TaskBaseTypeEnum.cs
@@ -166,5 +166,10 @@ namespace Myshipping.Application
///
[Description("目的港未返空箱")]
POD_GATEOUT_FULL,
+ ///
+ /// 重要提醒
+ ///
+ [Description("重要提醒")]
+ CAUTION_NOTICE
}
}
diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/Nomination/RollingNominationNoticeDto.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/Nomination/RollingNominationNoticeDto.cs
index 2caf852a..32f1a6aa 100644
--- a/Myshipping.Application/Service/TaskManagePlat/Dtos/Nomination/RollingNominationNoticeDto.cs
+++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/Nomination/RollingNominationNoticeDto.cs
@@ -30,5 +30,15 @@ namespace Myshipping.Application
/// 手工发送预甩邮件接收人
///
public string manualNoticeEmail { get; set; }
+
+ ///
+ /// 原船主键
+ ///
+ public string fromShipPKId { get; set; }
+
+ ///
+ /// 换船主键
+ ///
+ public string toShipPKId { get; set; }
}
}
diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/Nomination/TaskRollingNominationDto.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/Nomination/TaskRollingNominationDto.cs
index 07d0f1f0..5f5a3f85 100644
--- a/Myshipping.Application/Service/TaskManagePlat/Dtos/Nomination/TaskRollingNominationDto.cs
+++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/Nomination/TaskRollingNominationDto.cs
@@ -165,6 +165,11 @@ namespace Myshipping.Application
/// 分组KEY(有可能出现多个FROM多个TO的情况)
///
public int GroupIndx { get; set; }
+
+ ///
+ /// 主键
+ ///
+ public string pkId { get; set; }
}
diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageMapper.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageMapper.cs
index 378daf50..e144f1da 100644
--- a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageMapper.cs
+++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageMapper.cs
@@ -885,6 +885,7 @@ namespace Myshipping.Application
.Map(dest => dest.BATCH_TRANSFER, src => src.BatchTransfer)
.Map(dest => dest.GROUP_INDX, src => src.GroupIndx);
+
config.ForType()
.Map(dest => dest.NOM_STATUS_NOTE, src => src.Status)
.Map(dest => dest.BOOKED_BY, src => src.Bookedby)
@@ -923,7 +924,8 @@ namespace Myshipping.Application
.Map(dest => dest.VGMCutoffTime, src => src.VGM_CUTOFF_TIME)
.Map(dest => dest.CLPNCLCutDate, src => src.CLOSING_DATE)
.Map(dest => dest.BatchTransfer, src => src.BATCH_TRANSFER)
- .Map(dest => dest.GroupIndx, src => src.GROUP_INDX);
+ .Map(dest => dest.GroupIndx, src => src.GROUP_INDX)
+ .Map(dest => dest.pkId, src => src.PK_ID);
config.ForType()
diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManageRollingNominationService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManageRollingNominationService.cs
index b83ab3b8..2fc50d67 100644
--- a/Myshipping.Application/Service/TaskManagePlat/TaskManageRollingNominationService.cs
+++ b/Myshipping.Application/Service/TaskManagePlat/TaskManageRollingNominationService.cs
@@ -1046,7 +1046,7 @@ namespace Myshipping.Application
throw Oops.Bah(BookingErrorCode.BOOK115);
}
- if(string.IsNullOrWhiteSpace(printTemplate.CateCode) || !printTemplate.CateCode.Contains("rolling_nomination_notice_template"))
+ if (string.IsNullOrWhiteSpace(printTemplate.CateCode) || !printTemplate.CateCode.Contains("rolling_nomination_notice_template"))
{
throw Oops.Bah("模板类型分类错误,当前只支持预甩邮件通知");
}
@@ -1056,21 +1056,45 @@ namespace Myshipping.Application
var list = _taskRollingNominationDetailInfoRepository.AsQueryable().Filter(null, true)
.InnerJoin((detail, norm) => detail.NOM_ID == norm.PK_ID)
.Where((detail, norm) => norm.TASK_ID == model.taskId && detail.IsDeleted == false && norm.IsDeleted == false)
- .Select((detail, dispatch) => detail).ToList();
+ .Select((detail, norm) => detail).ToList();
+
+ var shipList = _taskRollingNominationShipInfoRepository.AsQueryable().Filter(null, true).Where(p => (p.PK_ID.Equals(model.fromShipPKId) || p.PK_ID.Equals(model.toShipPKId))
+ && p.IsDeleted == false).ToList();
+
+ var fromShipInfo = shipList.FirstOrDefault(p => p.PK_ID == model.fromShipPKId);
+
+ if (fromShipInfo == null)
+ throw Oops.Bah("当前预甩原船信息获取失败");
+
+ var toShipInfo = shipList.FirstOrDefault(p => p.PK_ID == model.toShipPKId);
+
+ if (fromShipInfo == null)
+ throw Oops.Bah("当前预甩换船信息获取失败");
+ BookingOrder bookingOrderEntity = null;
- //填写预甩详情到模板,并返回HTML
+ if (list.Any(p => p.BOOKING_ID.HasValue))
+ {
+ var bookingId = list.FirstOrDefault().BOOKING_ID.Value;
+ //读取订舱数据
+ bookingOrderEntity = _bookingOrderRepository.AsQueryable().Filter(null, true)
+ .First(a => a.Id == bookingId);
+ }
- //读取订舱数据
- var bookingOrderEntity = _bookingOrderRepository.AsQueryable().Filter(null, true)
- .First(a => a.Id == list.FirstOrDefault().BOOKING_ID.Value);
+ if (bookingOrderEntity == null)
+ throw Oops.Bah("当前预甩没有对应的订舱信息,请先生成订舱订单才能转发邮件");
SysUser opUserInfo = null;
if (!string.IsNullOrWhiteSpace(bookingOrderEntity.OPID) && Regex.IsMatch(bookingOrderEntity.OPID, "[0-9]+"))
+ {
opUserInfo = _sysUserRepository.AsQueryable().Filter(null, true).First(u => u.Id == long.Parse(bookingOrderEntity.OPID));
+ }
+
+ if (opUserInfo == null)
+ throw Oops.Bah("当前预甩对应的订舱信息未指定操作OP,不能转发邮件");
- html = GenerateTemplateHtml(printTemplate.FilePath, opUserInfo, UserManager.TENANT_NAME);
+ html = GenerateTemplateHtml(printTemplate.FilePath, fromShipInfo, toShipInfo, opUserInfo, UserManager.TENANT_NAME);
result.succ = true;
@@ -1086,6 +1110,7 @@ namespace Myshipping.Application
}
#endregion
+ #region 获取换船选择列表
///
/// 获取换船选择列表
///
@@ -1332,8 +1357,20 @@ namespace Myshipping.Application
return result;
}
+ #endregion
- private string GenerateTemplateHtml(string filePath, SysUser opUserInfo, string tenantName)
+ #region 通过邮件模板生成预甩邮件通知内容
+ ///
+ /// 通过邮件模板生成预甩邮件通知内容
+ ///
+ /// 文件路径
+ /// 原船详情
+ /// 换船详情
+ /// 操作OP详情
+ /// 租户名称
+ /// 返回生成后邮件正文
+ private string GenerateTemplateHtml(string filePath, TaskRollingNominationShipInfo fromShipInfo, TaskRollingNominationShipInfo toShipInfo,
+ SysUser opUserInfo, string tenantName)
{
string result = string.Empty;
@@ -1384,9 +1421,65 @@ namespace Myshipping.Application
{
baseHtml = baseHtml.Replace("#optel#", "");
}
+ //原船
+ if(fromShipInfo.ETD.HasValue && fromShipInfo.ETD.Value != DateTime.MinValue)
+ {
+ baseHtml = baseHtml.Replace("#ETD#", fromShipInfo.ETD.Value.ToString("yyyy-MM-dd"));
+ }
+ else
+ {
+ baseHtml = baseHtml.Replace("#ETD#", "");
+ }
+ //原船
+ if (!string.IsNullOrWhiteSpace(fromShipInfo.VESSEL) && !string.IsNullOrWhiteSpace(fromShipInfo.VOYNO))
+ {
+ baseHtml = baseHtml.Replace("#VesselVoyno#", $"{fromShipInfo.VESSEL} / {fromShipInfo.VOYNO}");
+ }
+ else
+ {
+ baseHtml = baseHtml.Replace("#VesselVoyno#", "");
+ }
+ //换船
+ if (toShipInfo.ETD.HasValue && toShipInfo.ETD.Value != DateTime.MinValue)
+ {
+ baseHtml = baseHtml.Replace("#newETD#", toShipInfo.ETD.Value.ToString("yyyy-MM-dd"));
+ }
+ else
+ {
+ baseHtml = baseHtml.Replace("#newETD#", "");
+ }
+ //换船
+ if (!string.IsNullOrWhiteSpace(toShipInfo.VESSEL) && !string.IsNullOrWhiteSpace(toShipInfo.VOYNO))
+ {
+ baseHtml = baseHtml.Replace("#newVesselVoyno#", $"{toShipInfo.VESSEL} / {toShipInfo.VOYNO}");
+ }
+ else
+ {
+ baseHtml = baseHtml.Replace("#newVesselVoyno#", "");
+ }
+ //换船
+ if (toShipInfo.SI_CUT_DATE.HasValue && toShipInfo.SI_CUT_DATE.Value != DateTime.MinValue)
+ {
+ baseHtml = baseHtml.Replace("#CutSingleTime#", toShipInfo.SI_CUT_DATE.Value.ToString("yyyy-MM-dd"));
+ }
+ else
+ {
+ baseHtml = baseHtml.Replace("#CutSingleTime#", "");
+ }
+ if (!string.IsNullOrWhiteSpace(tenantName))
+ {
+ baseHtml = baseHtml.Replace("#TenantCompanyName#", tenantName);
+ }
+ else
+ {
+ baseHtml = baseHtml.Replace("#TenantCompanyName#", "");
+ }
+
+ result = baseHtml;
return result;
}
+ #endregion
}
}