diff --git a/Myshipping.Application/Entity/TaskManagePlat/TaskBCInfo.cs b/Myshipping.Application/Entity/TaskManagePlat/TaskBCInfo.cs index 250ca383..595c8270 100644 --- a/Myshipping.Application/Entity/TaskManagePlat/TaskBCInfo.cs +++ b/Myshipping.Application/Entity/TaskManagePlat/TaskBCInfo.cs @@ -391,5 +391,10 @@ namespace Myshipping.Application /// 处理时间 /// public Nullable PROCESS_DATE { get; set; } + + /// + /// 计费日期 + /// + public Nullable PRICE_CALCULATION_DATE { get; set; } } } diff --git a/Myshipping.Application/Entity/TaskManagePlat/TaskCautionNoticeDetailInfo.cs b/Myshipping.Application/Entity/TaskManagePlat/TaskCautionNoticeDetailInfo.cs new file mode 100644 index 00000000..128382f9 --- /dev/null +++ b/Myshipping.Application/Entity/TaskManagePlat/TaskCautionNoticeDetailInfo.cs @@ -0,0 +1,64 @@ +using Myshipping.Application.Entity; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application +{ + /// + /// 重要任务提醒明细 + /// + [SugarTable("task_caution_notice_detail")] + [Description("重要任务提醒明细")] + public class TaskCautionNoticeDetailInfo : TaskManageDbEntity + { + /// + /// 任务提醒主键 + /// + public string P_ID { get; set; } + + /// + /// 通知人ID + /// + public string NOTIFY_USER_ID { get; set; } + + /// + /// 被通知人名称 + /// + public string NOTIFY_USER_NAME { get; set; } + + /// + /// 被通知方式 + /// + public string NOTIFY_METHOD { get; set; } + + /// + /// 被通知人手机 + /// + public string NOTIFY_MOBILE { get; set; } + + /// + /// 被通知人邮箱 + /// + public string NOTIFY_EMAIL { get; set; } + + /// + /// 状态 + /// + public string STATUS { get; set; } + + /// + /// 状态名称 + /// + public string STATUS_NAME { get; set; } + + /// + /// 重试次数 + /// + public int RETRY_NUM { get; set; } + } +} diff --git a/Myshipping.Application/Entity/TaskManagePlat/TaskCautionNoticeInfo.cs b/Myshipping.Application/Entity/TaskManagePlat/TaskCautionNoticeInfo.cs new file mode 100644 index 00000000..3d9551aa --- /dev/null +++ b/Myshipping.Application/Entity/TaskManagePlat/TaskCautionNoticeInfo.cs @@ -0,0 +1,94 @@ +using Myshipping.Application.Entity; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application +{ + /// + /// 重要任务提醒 + /// + [SugarTable("task_caution_notice")] + [Description("重要任务提醒")] + public class TaskCautionNoticeInfo : TaskManageDbEntity + { + /// + /// 任务主键 + /// + public string TASK_ID { get; set; } + + /// + /// 来源系统 + /// + public string SOURCE_SYSTEM { get; set; } + + /// + /// 来源业务类型 + /// + public string SOURCE_BUSI_TYPE { get; set; } + + /// + /// 来源业务类型名称 + /// + public string SOURCE_BUSI_TYPENAME { get; set; } + + /// + /// 通知内容 + /// + public string NOTIFY_CONTENT { get; set; } + + /// + /// 提单号 + /// + public string MBL_NO { get; set; } + + /// + /// 船公司 + /// + public string CARRIER { get; set; } + + /// + /// 是否计费周差异 1-是 0-否 + /// + public bool IS_WEEK_DIFF { get; set; } + + /// + /// 是否计费日差异 1-是 0-否 + /// + public bool IS_PRICE_DATE_DIFF { get; set; } + + /// + /// 是否转为中转 1-是 0-否 + /// + public bool IS_TRANSFER { get; set; } + + /// + /// 是否船名变化 1-是 0-否 + /// + public bool IS_VESSEL_CHANGE { get; set; } + + /// + /// 是否截止时间提前 1-是 0-否 + /// + public bool IS_CUT_DATE_ADVANCED { get; set; } + + /// + /// 订舱ID + /// + public Nullable BOOKING_ID { get; set; } + + /// + /// 舱位ID + /// + public Nullable BOOKING_SLOT_ID { get; set; } + + /// + /// 任务ID + /// + public string SOURCE_TASK_ID { get; set; } + } +} diff --git a/Myshipping.Application/Enum/CautionNoticeTaskEnum.cs b/Myshipping.Application/Enum/CautionNoticeTaskEnum.cs index 9c93a18b..3e3dbf92 100644 --- a/Myshipping.Application/Enum/CautionNoticeTaskEnum.cs +++ b/Myshipping.Application/Enum/CautionNoticeTaskEnum.cs @@ -21,10 +21,25 @@ namespace Myshipping.Application /// 计费日期差异 /// [Description("计费日期差异")] - PriceCalcDate + PriceCalcDate, + /// + /// 直达转为中转 + /// + [Description("直达转为中转")] + ChangeTransfer, + /// + /// 船名航次变化 + /// + [Description("船名航次变化")] + ChangeVesselVoyno, + /// + /// 截止时间提前 + /// + [Description("截止时间提前")] + CutDateAdvanced } - public enum CautionNoticeTypeEnum + public enum CautionNoticeMethodEnum { /// /// 钉钉消息 @@ -37,4 +52,23 @@ namespace Myshipping.Application [Description("邮件提醒")] Email } + + public enum TaskCautionNoticeStatusEnum + { + /// + /// 暂存 + /// + [Description("暂存")] + TEMP, + /// + /// 消息发送成功 + /// + [Description("消息发送成功")] + SUCC, + /// + /// 消息发送失败 + /// + [Description("消息发送失败")] + FAILURE + } } diff --git a/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs b/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs index 43a5088e..12b1cf70 100644 --- a/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs +++ b/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs @@ -2560,15 +2560,15 @@ namespace Myshipping.Application { if (bcSrcDto.CarrierId.Equals("MSK", StringComparison.OrdinalIgnoreCase)) { + var bookingList = _repAllocation.AsQueryable().Filter(null, true) + .Where(x => x.BOOKING_SLOT_ID == slotId && x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToList(); + string srcWeek = bcSrcDto.WeekAt ?? ""; string targetWeek = bcTargetDto.WeekAt ?? ""; //如果计费周不一致需要推送推送任务台生成重要提醒 if (!srcWeek.Equals(targetWeek, StringComparison.OrdinalIgnoreCase)) { - var bookingList = _repAllocation.AsQueryable().Filter(null, true) - .Where(x => x.BOOKING_SLOT_ID == slotId && x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToList(); - if (bookingList.Count > 0) { bookingList.ForEach(async ca => @@ -2611,9 +2611,6 @@ namespace Myshipping.Application if (!srcPriceCalcDate.Equals(targePriceCalcDate, StringComparison.OrdinalIgnoreCase)) { - var bookingList = _repAllocation.AsQueryable().Filter(null, true) - .Where(x => x.BOOKING_SLOT_ID == slotId && x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToList(); - if (bookingList.Count > 0) { bookingList.ForEach(async ca => @@ -2650,6 +2647,97 @@ namespace Myshipping.Application })); } } + + string srcVessel = bcSrcDto.Vessel ?? ""; + string targetVessel = bcTargetDto.Vessel ?? ""; + + string srcVoyno = bcSrcDto.VoyNo ?? ""; + string targetVoyno = bcTargetDto.VoyNo ?? ""; + + //船名航次出现变化需要做重要提醒 + if (!srcVessel.Equals(targetVessel, StringComparison.OrdinalIgnoreCase) || !srcVoyno.Equals(targetVoyno, StringComparison.OrdinalIgnoreCase)) + { + if (bookingList.Count > 0) + { + bookingList.ForEach(async ca => + { + await _publisher.PublishAsync(new ChannelEventSource("CautionNoticeTask:Add", + new CautionNoticeTaskDto + { + cautionNoticeType = CautionNoticeTaskEnum.ChangeVesselVoyno, + bookingId = ca.BOOKING_ID, + bookingSlotId = ca.BOOKING_SLOT_ID, + createTime = DateTime.Now, + origVal = $"{srcVessel}/{srcVoyno}", + newVal = $"{targetVessel}/{targetVoyno}", + tenentId = UserManager.TENANT_ID, + userId = UserManager.UserId, + userName = UserManager.Name, + })); + + }); + } + else + { + await _publisher.PublishAsync(new ChannelEventSource("CautionNoticeTask:Add", + new CautionNoticeTaskDto + { + cautionNoticeType = CautionNoticeTaskEnum.ChangeVesselVoyno, + bookingSlotId = slotId, + createTime = DateTime.Now, + origVal = srcWeek, + newVal = targetWeek, + tenentId = UserManager.TENANT_ID, + userId = UserManager.UserId, + userName = UserManager.Name, + })); + } + } + + string srcCarrierType = bcSrcDto.CarriageType ?? ""; + string targetCarrierType = bcTargetDto.CarriageType ?? ""; + + //如果原来是直航现在变成了中转需要做重要提醒 + if (!srcVessel.Equals(targetVessel, StringComparison.OrdinalIgnoreCase) + && srcVessel.Equals("DIRECT_SHIP", StringComparison.OrdinalIgnoreCase) + && targetCarrierType.Equals("TRANSFER_SHIP", StringComparison.OrdinalIgnoreCase)) + { + if (bookingList.Count > 0) + { + bookingList.ForEach(async ca => + { + await _publisher.PublishAsync(new ChannelEventSource("CautionNoticeTask:Add", + new CautionNoticeTaskDto + { + cautionNoticeType = CautionNoticeTaskEnum.ChangeTransfer, + bookingId = ca.BOOKING_ID, + bookingSlotId = ca.BOOKING_SLOT_ID, + createTime = DateTime.Now, + origVal = srcCarrierType, + newVal = targetCarrierType, + tenentId = UserManager.TENANT_ID, + userId = UserManager.UserId, + userName = UserManager.Name, + })); + + }); + } + else + { + await _publisher.PublishAsync(new ChannelEventSource("CautionNoticeTask:Add", + new CautionNoticeTaskDto + { + cautionNoticeType = CautionNoticeTaskEnum.ChangeTransfer, + bookingSlotId = slotId, + createTime = DateTime.Now, + origVal = srcCarrierType, + newVal = targetCarrierType, + tenentId = UserManager.TENANT_ID, + userId = UserManager.UserId, + userName = UserManager.Name, + })); + } + } } } #endregion diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/CautionNoitce/TaskManageOrderCautionNoticeInfo.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/CautionNoitce/TaskManageOrderCautionNoticeInfo.cs index 047f76a3..bf17afa1 100644 --- a/Myshipping.Application/Service/TaskManagePlat/Dtos/CautionNoitce/TaskManageOrderCautionNoticeInfo.cs +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/CautionNoitce/TaskManageOrderCautionNoticeInfo.cs @@ -6,6 +6,9 @@ using System.Threading.Tasks; namespace Myshipping.Application { + /// + /// 重要提醒任务 + /// public class TaskManageOrderCautionNoticeInfo { /// @@ -43,6 +46,36 @@ namespace Myshipping.Application /// public string NewVal { get; set; } + /// + /// 提单号 + /// + public string MBlNo { get; set; } + + /// + /// 船公司 + /// + public string Carrier { get; set; } + + /// + /// 来源系统 + /// + public string SourceSystem { get; set; } + + /// + /// 来源业务类型 + /// + public string SourceBusiType { get; set; } + + /// + /// 来源业务类型名称 + /// + public string SourceBusiTypeName { get; set; } + + /// + /// 通知内容 + /// + public string NotifyContent { get; set; } + /// /// 消息列表 /// @@ -57,16 +90,26 @@ namespace Myshipping.Application /// /// 重要提醒消息类型 /// - public CautionNoticeTypeEnum CautionNoticeType { get; set; } + public CautionNoticeMethodEnum CautionNoticeType { get; set; } /// /// 用户ID /// public string UserId { get; set; } + /// + /// 用户名称 + /// + public string UserName { get; set; } + /// /// 用户手机号 /// public string Mobile { get; set; } + + /// + /// 用户邮箱 + /// + public string Email { get; set; } } } diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageMapper.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageMapper.cs index e144f1da..88ac7396 100644 --- a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageMapper.cs +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageMapper.cs @@ -817,7 +817,8 @@ namespace Myshipping.Application .Map(dest => dest.SECOND_ETD, src => src.SecondETD) .Map(dest => dest.SECOND_ETA, src => src.SecondETA) .Map(dest => dest.BOOKING_COMFIRM_DATE, src => src.BookingConfirmDate) - .Map(dest => dest.BATCH_NO, src => src.BatchNo); + .Map(dest => dest.BATCH_NO, src => src.BatchNo) + .Map(dest => dest.PRICE_CALCULATION_DATE, src => src.PriceCalculationDate); config.ForType() .Map(dest => dest.CtnCode, src => src.CTNCODE) @@ -1143,6 +1144,21 @@ namespace Myshipping.Application .Map(dest => dest.HSCode, src => src.HSCODE) .Map(dest => dest.Description, src => src.DESCRIPTION) .Map(dest => dest.KindPKGS, src => src.KINDPKGS); + + config.ForType() + .Map(dest => dest.MBL_NO, src => src.MBlNo) + .Map(dest => dest.CARRIER, src => src.Carrier) + .Map(dest => dest.BOOKING_ID, src => src.BookingId) + .Map(dest => dest.BOOKING_SLOT_ID, src => src.BookingSlotId) + .Map(dest => dest.SOURCE_TASK_ID, src => src.TaskPKId) + .Map(dest => dest.NOTIFY_CONTENT, src => src.NotifyContent); + + config.ForType() + .Map(dest => dest.NOTIFY_USER_ID, src => src.UserId) + .Map(dest => dest.NOTIFY_USER_NAME, src => src.UserName) + .Map(dest => dest.NOTIFY_EMAIL, src => src.Email) + .Map(dest => dest.NOTIFY_MOBILE, src => src.Mobile); + } } } diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderBCInfo.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderBCInfo.cs index 2aa4d7e4..b2b07b10 100644 --- a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderBCInfo.cs +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderBCInfo.cs @@ -346,5 +346,10 @@ namespace Myshipping.Application /// 批次号 /// public string BatchNo { get; set; } + + /// + /// 计费时间 + /// + public Nullable PriceCalculationDate { get; set; } } } diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderMessageMainInfo.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderMessageMainInfo.cs index e6c5a9ba..58e60d67 100644 --- a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderMessageMainInfo.cs +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderMessageMainInfo.cs @@ -234,5 +234,10 @@ namespace Myshipping.Application /// 格式单 /// public TaskManageOrderDraftInfo DraftInfo { get; set; } -} + + /// + /// 重要通知 + /// + public TaskManageOrderCautionNoticeInfo CautionNoticeInfo { get; set; } + } } diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs index 4af8f556..1a11c807 100644 --- a/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs @@ -115,6 +115,8 @@ namespace Myshipping.Application private readonly SqlSugarRepository _taskPODDischargeGateoutFullInfoRepository; private readonly SqlSugarRepository _taskPODDischargeGateoutFullDetailInfoRepository; + private readonly SqlSugarRepository _taskCautionNoticeInfoRepository; + private readonly SqlSugarRepository _taskCautionNoticeDetailInfoRepository; private readonly IDjyWebsiteAccountConfigService _webAccountConfig; private readonly ISysCacheService _cache; @@ -176,6 +178,8 @@ namespace Myshipping.Application SqlSugarRepository taskDraftInfoRepository, SqlSugarRepository taskPODDischargeGateoutFullInfoRepository, SqlSugarRepository taskPODDischargeGateoutFullDetailInfoRepository, + SqlSugarRepository taskCautionNoticeInfoRepository, + SqlSugarRepository taskCautionNoticeDetailInfoRepository, INamedServiceProvider namedBookingOrderServiceProvider, IDjyWebsiteAccountConfigService webAccountConfig, ISysCacheService cache, @@ -239,6 +243,9 @@ namespace Myshipping.Application _taskPODDischargeGateoutFullDetailInfoRepository = taskPODDischargeGateoutFullDetailInfoRepository; _namedBookingMSKAPIServiceProvider = namedBookingMSKAPIServiceProvider; + + _taskCautionNoticeInfoRepository = taskCautionNoticeInfoRepository; + _taskCautionNoticeDetailInfoRepository = taskCautionNoticeDetailInfoRepository; } #region 创建任务 @@ -1400,6 +1407,69 @@ namespace Myshipping.Application } #endregion + #region 重要提醒 + if (info.Main.TaskType == TaskBaseTypeEnum.CAUTION_NOTICE) + { + TaskCautionNoticeInfo taskCautionNoticeInfo = info.Main.CautionNoticeInfo.Adapt(); + + taskCautionNoticeInfo.PK_ID = IDGen.NextID().ToString(); + taskCautionNoticeInfo.TASK_ID = taskInfo.PK_ID; + + taskCautionNoticeInfo.CreatedTime = taskInfo.CreatedTime; + taskCautionNoticeInfo.UpdatedTime = taskInfo.CreatedTime; + + taskCautionNoticeInfo.CreatedUserId = taskInfo.CreatedUserId; + taskCautionNoticeInfo.CreatedUserName = taskInfo.CreatedUserName; + taskCautionNoticeInfo.TenantId = taskInfo.TenantId; + taskCautionNoticeInfo.TenantName = taskInfo.TenantName; + + if (info.Main.CautionNoticeInfo.CautionNoticeType == CautionNoticeTaskEnum.WeekAt) + { + taskCautionNoticeInfo.IS_WEEK_DIFF = true; + } + else if (info.Main.CautionNoticeInfo.CautionNoticeType == CautionNoticeTaskEnum.PriceCalcDate) + { + taskCautionNoticeInfo.IS_PRICE_DATE_DIFF = true; + } + else if (info.Main.CautionNoticeInfo.CautionNoticeType == CautionNoticeTaskEnum.ChangeVesselVoyno) + { + taskCautionNoticeInfo.IS_VESSEL_CHANGE = true; + } + else if (info.Main.CautionNoticeInfo.CautionNoticeType == CautionNoticeTaskEnum.ChangeTransfer) + { + taskCautionNoticeInfo.IS_TRANSFER = true; + } + else if (info.Main.CautionNoticeInfo.CautionNoticeType == CautionNoticeTaskEnum.CutDateAdvanced) + { + taskCautionNoticeInfo.IS_CUT_DATE_ADVANCED = true; + } + + await _taskCautionNoticeInfoRepository.InsertAsync(taskCautionNoticeInfo); + + //异步写入集装箱 + info.Main.CautionNoticeInfo.NoticeList.ForEach(async notice => + { + var noticeInfo = notice.Adapt(); + + noticeInfo.PK_ID = IDGen.NextID().ToString(); + noticeInfo.P_ID = taskCautionNoticeInfo.PK_ID; + + noticeInfo.CreatedTime = taskInfo.CreatedTime; + noticeInfo.UpdatedTime = taskInfo.CreatedTime; + + noticeInfo.CreatedUserId = taskInfo.CreatedUserId; + noticeInfo.CreatedUserName = taskInfo.CreatedUserName; + noticeInfo.TenantId = taskInfo.TenantId; + noticeInfo.TenantName = taskInfo.TenantName; + + noticeInfo.STATUS = TaskCautionNoticeStatusEnum.TEMP.ToString(); + noticeInfo.STATUS_NAME = TaskCautionNoticeStatusEnum.TEMP.GetDescription(); + + await _taskCautionNoticeDetailInfoRepository.InsertAsync(noticeInfo); + }); + } + #endregion + if (info.Main.SerialMsgInfo != null) { var storeInfo = new TaskStoreMsgInfo diff --git a/Myshipping.Core/Myshipping.Core.csproj b/Myshipping.Core/Myshipping.Core.csproj index 803534aa..f0475cbe 100644 --- a/Myshipping.Core/Myshipping.Core.csproj +++ b/Myshipping.Core/Myshipping.Core.csproj @@ -57,7 +57,7 @@ - +