diff --git a/Myshipping.Application/Enum/CautionNoticeTaskEnum.cs b/Myshipping.Application/Enum/CautionNoticeTaskEnum.cs index 5eb03d94..1dd7276f 100644 --- a/Myshipping.Application/Enum/CautionNoticeTaskEnum.cs +++ b/Myshipping.Application/Enum/CautionNoticeTaskEnum.cs @@ -13,14 +13,14 @@ namespace Myshipping.Application public enum CautionNoticeTaskEnum { /// - /// 计费周差异 + /// 计费周变更 /// - [Description("计费周差异")] + [Description("计费周变更")] WeekAt, /// - /// 计费日期差异 + /// 计费日期变更 /// - [Description("计费日期差异")] + [Description("计费日期变更")] PriceCalcDate, /// /// 直达转为中转 @@ -28,9 +28,9 @@ namespace Myshipping.Application [Description("直达转为中转")] ChangeTransfer, /// - /// 船名航次变化 + /// 船名航次变更 /// - [Description("船名航次变化")] + [Description("船名航次变更")] ChangeVesselVoyno, /// /// VGM截止时间提前 diff --git a/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs b/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs index 651429e5..b652aa7a 100644 --- a/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs +++ b/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs @@ -3159,6 +3159,111 @@ namespace Myshipping.Application CreateTask(CautionNoticeTaskEnum.PriceCalcDate, bcSrcDto, userList, null, slotInfo, srcPriceDate, targetPriceDate, $"提单号:{bcSrcDto.MBLNo} 计费日期变更了 原:{srcPriceDate} 新:{targetPriceDate}"); } } + + string srcVesselVoyno = $"{bcSrcDto.Vessel}/{bcSrcDto.VoyNo}"; + string targetVesselVoyno = $"{bcTargetDto.Vessel}/{bcTargetDto.VoyNo}"; + + if (!srcVesselVoyno.Equals(targetVesselVoyno, StringComparison.OrdinalIgnoreCase)) + { + if (bookingSlotAllocList.Count > 0) + { + bookingSlotAllocList.ForEach(async ca => + { + var bookingInfo = _repBookingOrder.AsQueryable().Filter(null, true).First(x => x.Id == ca.Alloc.BOOKING_ID && x.IsDeleted == false + && x.TenantId == UserManager.TENANT_ID); + + CreateTask(CautionNoticeTaskEnum.ChangeVesselVoyno, bcSrcDto, userList, bookingInfo, slotInfo, srcVesselVoyno, targetVesselVoyno, $"提单号:{bcSrcDto.MBLNo} 船名航次变更了 原:{srcVesselVoyno} 新:{targetVesselVoyno}"); + }); + } + + if (slotInfo != null && !userIds.Any(p => p == slotInfo.CreatedUserId.Value)) + { + CreateTask(CautionNoticeTaskEnum.ChangeVesselVoyno, bcSrcDto, userList, null, slotInfo, srcVesselVoyno, targetVesselVoyno, $"提单号:{bcSrcDto.MBLNo} 船名航次变更了 原:{srcVesselVoyno} 新:{targetVesselVoyno}"); + } + } + + + string srcCarrierType = bcSrcDto.CarriageType ?? ""; + string targetCarrierType = bcTargetDto.CarriageType ?? ""; + + //如果原来是直航现在变成了中转需要做重要提醒 + if (!srcCarrierType.Equals(targetCarrierType, StringComparison.OrdinalIgnoreCase) + && srcCarrierType.Equals("DIRECT_SHIP", StringComparison.OrdinalIgnoreCase) + && targetCarrierType.Equals("TRANSFER_SHIP", StringComparison.OrdinalIgnoreCase)) + { + if (bookingSlotAllocList.Count > 0) + { + bookingSlotAllocList.ForEach(async ca => + { + var bookingInfo = _repBookingOrder.AsQueryable().Filter(null, true).First(x => x.Id == ca.Alloc.BOOKING_ID && x.IsDeleted == false + && x.TenantId == UserManager.TENANT_ID); + + CreateTask(CautionNoticeTaskEnum.ChangeTransfer, bcSrcDto, userList, bookingInfo, slotInfo, "直达", "中转", $"提单号:{bcSrcDto.MBLNo} 直达变成中转了"); + }); + } + + if (slotInfo != null && !userIds.Any(p => p == slotInfo.CreatedUserId.Value)) + { + CreateTask(CautionNoticeTaskEnum.ChangeTransfer, bcSrcDto, userList, null, slotInfo, "直达", "中转", $"提单号:{bcSrcDto.MBLNo} 直达变成中转了"); + } + } + + string srcVGMCut = bcSrcDto.VGMSubmissionCutDate; + string targeVGMCut = bcTargetDto.VGMSubmissionCutDate; + + if (!string.IsNullOrWhiteSpace(srcVGMCut) && !string.IsNullOrWhiteSpace(targeVGMCut) && !srcVGMCut.Equals(targeVGMCut)) + { + DateTime srcVGMCutDate = DateTime.Parse(srcVGMCut); + DateTime targeVGMCutDate = DateTime.Parse(targeVGMCut); + + if (srcVGMCutDate > targeVGMCutDate) + { + if (bookingSlotAllocList.Count > 0) + { + bookingSlotAllocList.ForEach(async ca => + { + var bookingInfo = _repBookingOrder.AsQueryable().Filter(null, true).First(x => x.Id == ca.Alloc.BOOKING_ID && x.IsDeleted == false + && x.TenantId == UserManager.TENANT_ID); + + CreateTask(CautionNoticeTaskEnum.VGMCutDateAdvanced, bcSrcDto, userList, bookingInfo, slotInfo, srcVGMCut, targeVGMCut, $"提单号:{bcSrcDto.MBLNo} VGM截单时间提前了 原:{srcVGMCut} 新:{targeVGMCut}"); + }); + } + + if (slotInfo != null && !userIds.Any(p => p == slotInfo.CreatedUserId.Value)) + { + CreateTask(CautionNoticeTaskEnum.VGMCutDateAdvanced, bcSrcDto, userList, null, slotInfo, srcVGMCut, targeVGMCut, $"提单号:{bcSrcDto.MBLNo} VGM截单时间提前了 原:{srcVGMCut} 新:{targeVGMCut}"); + } + } + } + + string srcSICut = bcSrcDto.SICutDate; + string targeSICut = bcTargetDto.SICutDate; + + if (!string.IsNullOrWhiteSpace(srcSICut) && !string.IsNullOrWhiteSpace(targeSICut) && !srcSICut.Equals(targeSICut)) + { + DateTime srcSICutDate = DateTime.Parse(srcSICut); + DateTime targeSICutDate = DateTime.Parse(targeSICut); + + //如果新给的SI截止时间,需要推送通知 + if (srcSICutDate > targeSICutDate) + { + if (bookingSlotAllocList.Count > 0) + { + bookingSlotAllocList.ForEach(async ca => + { + var bookingInfo = _repBookingOrder.AsQueryable().Filter(null, true).First(x => x.Id == ca.Alloc.BOOKING_ID && x.IsDeleted == false + && x.TenantId == UserManager.TENANT_ID); + + CreateTask(CautionNoticeTaskEnum.SICutDateAdvanced, bcSrcDto, userList, bookingInfo, slotInfo, srcSICut, targeSICut, $"提单号:{bcSrcDto.MBLNo} 样单截止时间提前了 原:{srcSICut} 新:{targeSICut}"); + }); + } + + if (slotInfo != null && !userIds.Any(p => p == slotInfo.CreatedUserId.Value)) + { + CreateTask(CautionNoticeTaskEnum.SICutDateAdvanced, bcSrcDto, userList, null, slotInfo, srcSICut, targeSICut, $"提单号:{bcSrcDto.MBLNo} 样单截止时间提前了 原:{srcSICut} 新:{targeSICut}"); + } + } + } } } catch (Exception ex) @@ -3246,9 +3351,11 @@ namespace Myshipping.Application messageInfo.Main.CarrierId = dto.carrier; messageInfo.Main.CustomerId = dto.customerId; messageInfo.Main.CustomerName = dto.customerName; + messageInfo.Main.MBlNo = dto.mblNo; + messageInfo.Main.ETD = dto.etd; - messageInfo.Main.TaskTitle = $"重要提醒-{dto.cautionNoticeType.GetDescription()} {dto.vessel}/{dto.voyno} {dto.etd} BLNo:{dto.mblNo}"; - messageInfo.Main.TaskDesp = $"重要提醒-{dto.cautionNoticeType.GetDescription()} {dto.vessel}/{dto.voyno} {dto.etd} BLNo:{dto.mblNo}"; + messageInfo.Main.TaskTitle = $"重要提醒-{dto.cautionNoticeType.GetDescription()} BLNo:{dto.mblNo} {dto.vessel}/{dto.voyno} {(dto.etd.HasValue? dto.etd.Value.ToString("yyyy-MM-dd"):"")} "; + messageInfo.Main.TaskDesp = $"重要提醒-{dto.cautionNoticeType.GetDescription()} BLNo:{dto.mblNo} {dto.vessel}/{dto.voyno} {(dto.etd.HasValue ? dto.etd.Value.ToString("yyyy-MM-dd") : "")}"; messageInfo.Main.CautionNoticeInfo = new TaskManageOrderCautionNoticeInfo { @@ -3355,13 +3462,22 @@ namespace Myshipping.Application sourceBusiTypeName = "舱位管理", vessel = bcSrcDto.Vessel, voyno = bcSrcDto.VoyNo, - etd = bcSrcDto.ETD, tenentName = UserManager.TENANT_NAME, notifyContent = notifyContent, notifyList = new List() }; + if(!string.IsNullOrWhiteSpace(bcSrcDto.ETD)) + { + DateTime etd = DateTime.MinValue; + + if(DateTime.TryParse(bcSrcDto.ETD,out etd)) + { + notice.etd = etd; + } + } + if (bookingInfo != null) { notice.bookingId = bookingInfo.Id; diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/CautionNoitce/CautionNoticeTaskDto.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/CautionNoitce/CautionNoticeTaskDto.cs index 68352561..dbb362ae 100644 --- a/Myshipping.Application/Service/TaskManagePlat/Dtos/CautionNoitce/CautionNoticeTaskDto.cs +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/CautionNoitce/CautionNoticeTaskDto.cs @@ -106,7 +106,7 @@ namespace Myshipping.Application /// /// ETD /// - public string etd { get; set; } + public Nullable etd { get; set; } /// /// 委托客户ID