|
|
@ -19,6 +19,7 @@ using Myshipping.Application.Service.BookingLabel.Dto;
|
|
|
|
using Myshipping.Application.Service.BookingOrder.Dto;
|
|
|
|
using Myshipping.Application.Service.BookingOrder.Dto;
|
|
|
|
using Myshipping.Application.Service.BookingSlot.Dto;
|
|
|
|
using Myshipping.Application.Service.BookingSlot.Dto;
|
|
|
|
using Myshipping.Core;
|
|
|
|
using Myshipping.Core;
|
|
|
|
|
|
|
|
using Myshipping.Core.Entity;
|
|
|
|
using Myshipping.Core.Service;
|
|
|
|
using Myshipping.Core.Service;
|
|
|
|
using NPOI.XSSF.UserModel;
|
|
|
|
using NPOI.XSSF.UserModel;
|
|
|
|
using SqlSugar;
|
|
|
|
using SqlSugar;
|
|
|
@ -30,6 +31,7 @@ using System.IO;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Net.Http;
|
|
|
|
using System.Net.Http;
|
|
|
|
using System.Net.Http.Headers;
|
|
|
|
using System.Net.Http.Headers;
|
|
|
|
|
|
|
|
using System.Security.Cryptography;
|
|
|
|
using System.Text;
|
|
|
|
using System.Text;
|
|
|
|
using System.Threading;
|
|
|
|
using System.Threading;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using System.Threading.Tasks;
|
|
|
@ -57,6 +59,7 @@ namespace Myshipping.Application
|
|
|
|
private readonly SqlSugarRepository<BookingLogDetail> _repBookingLogDetail;
|
|
|
|
private readonly SqlSugarRepository<BookingLogDetail> _repBookingLogDetail;
|
|
|
|
private readonly SqlSugarRepository<BookingFile> _bookingfile;
|
|
|
|
private readonly SqlSugarRepository<BookingFile> _bookingfile;
|
|
|
|
private readonly SqlSugarRepository<BookingPrintTemplate> _repPrintTemplate;
|
|
|
|
private readonly SqlSugarRepository<BookingPrintTemplate> _repPrintTemplate;
|
|
|
|
|
|
|
|
private readonly SqlSugarRepository<SysUser> _sysUserRepository;
|
|
|
|
|
|
|
|
|
|
|
|
private readonly ILogger<BookingSlotService> _logger;
|
|
|
|
private readonly ILogger<BookingSlotService> _logger;
|
|
|
|
private readonly ISysCacheService _cache;
|
|
|
|
private readonly ISysCacheService _cache;
|
|
|
@ -101,6 +104,7 @@ namespace Myshipping.Application
|
|
|
|
SqlSugarRepository<BookingOrder> repBookingOrder,
|
|
|
|
SqlSugarRepository<BookingOrder> repBookingOrder,
|
|
|
|
SqlSugarRepository<BookingLabelAllocation> repLabelAllocation,
|
|
|
|
SqlSugarRepository<BookingLabelAllocation> repLabelAllocation,
|
|
|
|
IBookingLabelService bookingLabelService,
|
|
|
|
IBookingLabelService bookingLabelService,
|
|
|
|
|
|
|
|
SqlSugarRepository<SysUser> sysUserRepository,
|
|
|
|
SqlSugarRepository<BookingPrintTemplate> repPrintTemplate)
|
|
|
|
SqlSugarRepository<BookingPrintTemplate> repPrintTemplate)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_repBase = repBase;
|
|
|
|
_repBase = repBase;
|
|
|
@ -126,6 +130,8 @@ namespace Myshipping.Application
|
|
|
|
_repLabelAllocation = repLabelAllocation;
|
|
|
|
_repLabelAllocation = repLabelAllocation;
|
|
|
|
_bookingLabelService = bookingLabelService;
|
|
|
|
_bookingLabelService = bookingLabelService;
|
|
|
|
_repPrintTemplate = repPrintTemplate;
|
|
|
|
_repPrintTemplate = repPrintTemplate;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_sysUserRepository = sysUserRepository;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#region 舱位
|
|
|
|
#region 舱位
|
|
|
@ -3060,8 +3066,51 @@ namespace Myshipping.Application
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (bcSrcDto.CarrierId.Equals("MSK", StringComparison.OrdinalIgnoreCase))
|
|
|
|
if (bcSrcDto.CarrierId.Equals("MSK", StringComparison.OrdinalIgnoreCase))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var bookingList = _repAllocation.AsQueryable().Filter(null, true)
|
|
|
|
var bookingSlotAllocList = _repBase.AsQueryable().Filter(null, true)
|
|
|
|
.Where(x => x.BOOKING_SLOT_ID == slotId && x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToList();
|
|
|
|
.LeftJoin<BookingSlotAllocation>((slot,alloc)=> slot.Id == alloc.BOOKING_SLOT_ID)
|
|
|
|
|
|
|
|
.Where((slot, alloc) => slot.Id == slotId && slot.IsDeleted == false && slot.TenantId == UserManager.TENANT_ID && alloc.IsDeleted == false)
|
|
|
|
|
|
|
|
.Select((slot, alloc) => new { Slot = slot,Alloc = alloc }).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<BookingOrder> bookingOrderList = new List<BookingOrder>();
|
|
|
|
|
|
|
|
List<SysUser> userList = new List<SysUser>();
|
|
|
|
|
|
|
|
List<long> userIds = new List<long>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (bookingSlotAllocList.Any(t => t.Alloc != null))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var bookingNoList = bookingSlotAllocList.Select(a => a.Alloc.BOOKING_ID).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bookingOrderList = _repBookingOrder.AsQueryable().Filter(null, true)
|
|
|
|
|
|
|
|
.Where(x => bookingNoList.Contains(x.Id) && x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (bookingOrderList.Count > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
bookingOrderList.ForEach(bk =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(bk.OPID))
|
|
|
|
|
|
|
|
userIds.Add(long.Parse(bk.OPID));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(bk.SALEID))
|
|
|
|
|
|
|
|
userIds.Add(long.Parse(bk.SALEID));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(bk.CUSTSERVICEID))
|
|
|
|
|
|
|
|
userIds.Add(long.Parse(bk.CUSTSERVICEID));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
userIds.Add(bk.CreatedUserId.Value);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var slotInfo = bookingSlotAllocList.FirstOrDefault().Slot;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (slotInfo != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
userIds.Add(slotInfo.CreatedUserId.Value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
userIds = userIds.Distinct().ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
userList = _sysUserRepository.AsQueryable().Filter(null, true)
|
|
|
|
|
|
|
|
.Where(x => userIds.Contains(x.Id) && x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
string srcWeek = bcSrcDto.WeekAt ?? "";
|
|
|
|
string srcWeek = bcSrcDto.WeekAt ?? "";
|
|
|
|
string targetWeek = bcTargetDto.WeekAt ?? "";
|
|
|
|
string targetWeek = bcTargetDto.WeekAt ?? "";
|
|
|
@ -3069,40 +3118,74 @@ namespace Myshipping.Application
|
|
|
|
//如果计费周不一致需要推送推送任务台生成重要提醒
|
|
|
|
//如果计费周不一致需要推送推送任务台生成重要提醒
|
|
|
|
if (!srcWeek.Equals(targetWeek, StringComparison.OrdinalIgnoreCase))
|
|
|
|
if (!srcWeek.Equals(targetWeek, StringComparison.OrdinalIgnoreCase))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (bookingList.Count > 0)
|
|
|
|
if (bookingSlotAllocList.Count > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
bookingList.ForEach(async ca =>
|
|
|
|
bookingSlotAllocList.ForEach(async ca =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
await _publisher.PublishAsync(new ChannelEventSource("CautionNoticeTask:Add",
|
|
|
|
var bookingInfo = _repBookingOrder.AsQueryable().Filter(null, true).First(x => x.Id == ca.Alloc.BOOKING_ID && x.IsDeleted == false
|
|
|
|
new CautionNoticeTaskDto
|
|
|
|
&& x.TenantId == UserManager.TENANT_ID);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var notice = new CautionNoticeTaskDto
|
|
|
|
{
|
|
|
|
{
|
|
|
|
cautionNoticeType = CautionNoticeTaskEnum.WeekAt,
|
|
|
|
cautionNoticeType = CautionNoticeTaskEnum.WeekAt,
|
|
|
|
bookingId = ca.BOOKING_ID,
|
|
|
|
bookingId = ca.Alloc.BOOKING_ID,
|
|
|
|
bookingSlotId = ca.BOOKING_SLOT_ID,
|
|
|
|
bookingSlotId = ca.Slot.Id,
|
|
|
|
createTime = DateTime.Now,
|
|
|
|
createTime = DateTime.Now,
|
|
|
|
origVal = srcWeek,
|
|
|
|
origVal = srcWeek,
|
|
|
|
newVal = targetWeek,
|
|
|
|
newVal = targetWeek,
|
|
|
|
tenentId = UserManager.TENANT_ID,
|
|
|
|
tenentId = UserManager.TENANT_ID,
|
|
|
|
userId = UserManager.UserId,
|
|
|
|
userId = UserManager.UserId,
|
|
|
|
userName = UserManager.Name,
|
|
|
|
userName = UserManager.Name,
|
|
|
|
}));
|
|
|
|
mblNo = bcSrcDto.MBLNo,
|
|
|
|
|
|
|
|
notifyContent = $"mblno:{bcSrcDto.MBLNo} 计费周变更了 原:{srcWeek} 新:{targetWeek}",
|
|
|
|
|
|
|
|
notifyList = new List<CautionNoticeTaskNoitfyDto>()
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (bookingInfo != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(bookingInfo.OPID))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CreateContact(notice.notifyList, userList, long.Parse(bookingInfo.OPID), bcSrcDto.MBLNo, notice.cautionNoticeType);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(bookingInfo.SALEID))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CreateContact(notice.notifyList, userList, long.Parse(bookingInfo.SALEID), bcSrcDto.MBLNo, notice.cautionNoticeType);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(bookingInfo.CUSTSERVICEID))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CreateContact(notice.notifyList, userList, long.Parse(bookingInfo.CUSTSERVICEID), bcSrcDto.MBLNo, notice.cautionNoticeType);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await _publisher.PublishAsync(new ChannelEventSource("CautionNoticeTask:Add", notice));
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
await _publisher.PublishAsync(new ChannelEventSource("CautionNoticeTask:Add",
|
|
|
|
var notice = new CautionNoticeTaskDto
|
|
|
|
new CautionNoticeTaskDto
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
cautionNoticeType = CautionNoticeTaskEnum.WeekAt,
|
|
|
|
cautionNoticeType = CautionNoticeTaskEnum.WeekAt,
|
|
|
|
bookingSlotId = slotId,
|
|
|
|
bookingSlotId = slotInfo.Id,
|
|
|
|
createTime = DateTime.Now,
|
|
|
|
createTime = DateTime.Now,
|
|
|
|
origVal = srcWeek,
|
|
|
|
origVal = srcWeek,
|
|
|
|
newVal = targetWeek,
|
|
|
|
newVal = targetWeek,
|
|
|
|
tenentId = UserManager.TENANT_ID,
|
|
|
|
tenentId = UserManager.TENANT_ID,
|
|
|
|
userId = UserManager.UserId,
|
|
|
|
userId = UserManager.UserId,
|
|
|
|
userName = UserManager.Name,
|
|
|
|
userName = UserManager.Name,
|
|
|
|
}));
|
|
|
|
mblNo = bcSrcDto.MBLNo,
|
|
|
|
|
|
|
|
notifyContent = $"mblno:{bcSrcDto.MBLNo} 计费周变更了 原:{srcWeek} 新:{targetWeek}",
|
|
|
|
|
|
|
|
notifyList = new List<CautionNoticeTaskNoitfyDto>()
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (slotInfo != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CreateContact(notice.notifyList, userList, slotInfo.CreatedUserId.Value, bcSrcDto.MBLNo, notice.cautionNoticeType);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await _publisher.PublishAsync(new ChannelEventSource("CautionNoticeTask:Add", notice));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -3111,40 +3194,72 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
|
|
if (!srcPriceCalcDate.Equals(targePriceCalcDate, StringComparison.OrdinalIgnoreCase))
|
|
|
|
if (!srcPriceCalcDate.Equals(targePriceCalcDate, StringComparison.OrdinalIgnoreCase))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (bookingList.Count > 0)
|
|
|
|
if (bookingSlotAllocList.Count > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
bookingList.ForEach(async ca =>
|
|
|
|
bookingSlotAllocList.ForEach(async ca =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
await _publisher.PublishAsync(new ChannelEventSource("CautionNoticeTask:Add",
|
|
|
|
var bookingInfo = _repBookingOrder.AsQueryable().Filter(null, true).First(x => x.Id == ca.Alloc.BOOKING_ID && x.IsDeleted == false
|
|
|
|
new CautionNoticeTaskDto
|
|
|
|
&& x.TenantId == UserManager.TENANT_ID);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var notice = new CautionNoticeTaskDto
|
|
|
|
{
|
|
|
|
{
|
|
|
|
cautionNoticeType = CautionNoticeTaskEnum.PriceCalcDate,
|
|
|
|
cautionNoticeType = CautionNoticeTaskEnum.PriceCalcDate,
|
|
|
|
bookingId = ca.BOOKING_ID,
|
|
|
|
bookingId = ca.Alloc.BOOKING_ID,
|
|
|
|
bookingSlotId = ca.BOOKING_SLOT_ID,
|
|
|
|
bookingSlotId = ca.Slot.Id,
|
|
|
|
createTime = DateTime.Now,
|
|
|
|
createTime = DateTime.Now,
|
|
|
|
origVal = srcWeek,
|
|
|
|
origVal = srcWeek,
|
|
|
|
newVal = targetWeek,
|
|
|
|
newVal = targetWeek,
|
|
|
|
tenentId = UserManager.TENANT_ID,
|
|
|
|
tenentId = UserManager.TENANT_ID,
|
|
|
|
userId = UserManager.UserId,
|
|
|
|
userId = UserManager.UserId,
|
|
|
|
userName = UserManager.Name,
|
|
|
|
userName = UserManager.Name,
|
|
|
|
}));
|
|
|
|
mblNo = bcSrcDto.MBLNo,
|
|
|
|
|
|
|
|
notifyContent = $"mblno:{bcSrcDto.MBLNo} 计费日期变更了 原:{srcPriceCalcDate} 新:{targePriceCalcDate}",
|
|
|
|
|
|
|
|
notifyList = new List<CautionNoticeTaskNoitfyDto>()
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (bookingInfo != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(bookingInfo.OPID))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CreateContact(notice.notifyList, userList, long.Parse(bookingInfo.OPID), bcSrcDto.MBLNo, notice.cautionNoticeType);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(bookingInfo.SALEID))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CreateContact(notice.notifyList, userList, long.Parse(bookingInfo.SALEID), bcSrcDto.MBLNo, notice.cautionNoticeType);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(bookingInfo.CUSTSERVICEID))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CreateContact(notice.notifyList, userList, long.Parse(bookingInfo.CUSTSERVICEID), bcSrcDto.MBLNo, notice.cautionNoticeType);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await _publisher.PublishAsync(new ChannelEventSource("CautionNoticeTask:Add", notice));
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
await _publisher.PublishAsync(new ChannelEventSource("CautionNoticeTask:Add",
|
|
|
|
var notice = new CautionNoticeTaskDto
|
|
|
|
new CautionNoticeTaskDto
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
cautionNoticeType = CautionNoticeTaskEnum.PriceCalcDate,
|
|
|
|
cautionNoticeType = CautionNoticeTaskEnum.PriceCalcDate,
|
|
|
|
bookingSlotId = slotId,
|
|
|
|
bookingSlotId = slotInfo.Id,
|
|
|
|
createTime = DateTime.Now,
|
|
|
|
createTime = DateTime.Now,
|
|
|
|
origVal = srcWeek,
|
|
|
|
origVal = srcWeek,
|
|
|
|
newVal = targetWeek,
|
|
|
|
newVal = targetWeek,
|
|
|
|
tenentId = UserManager.TENANT_ID,
|
|
|
|
tenentId = UserManager.TENANT_ID,
|
|
|
|
userId = UserManager.UserId,
|
|
|
|
userId = UserManager.UserId,
|
|
|
|
userName = UserManager.Name,
|
|
|
|
userName = UserManager.Name,
|
|
|
|
}));
|
|
|
|
notifyList = new List<CautionNoticeTaskNoitfyDto>()
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (slotInfo != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CreateContact(notice.notifyList, userList, slotInfo.CreatedUserId.Value, bcSrcDto.MBLNo, notice.cautionNoticeType);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await _publisher.PublishAsync(new ChannelEventSource("CautionNoticeTask:Add", notice));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -3157,40 +3272,70 @@ namespace Myshipping.Application
|
|
|
|
//船名航次出现变化需要做重要提醒
|
|
|
|
//船名航次出现变化需要做重要提醒
|
|
|
|
if (!srcVessel.Equals(targetVessel, StringComparison.OrdinalIgnoreCase) || !srcVoyno.Equals(targetVoyno, StringComparison.OrdinalIgnoreCase))
|
|
|
|
if (!srcVessel.Equals(targetVessel, StringComparison.OrdinalIgnoreCase) || !srcVoyno.Equals(targetVoyno, StringComparison.OrdinalIgnoreCase))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (bookingList.Count > 0)
|
|
|
|
if (bookingSlotAllocList.Count > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
bookingList.ForEach(async ca =>
|
|
|
|
bookingSlotAllocList.ForEach(async ca =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
await _publisher.PublishAsync(new ChannelEventSource("CautionNoticeTask:Add",
|
|
|
|
var bookingInfo = _repBookingOrder.AsQueryable().Filter(null, true).First(x => x.Id == ca.Alloc.BOOKING_ID && x.IsDeleted == false
|
|
|
|
new CautionNoticeTaskDto
|
|
|
|
&& x.TenantId == UserManager.TENANT_ID);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var notice = new CautionNoticeTaskDto
|
|
|
|
{
|
|
|
|
{
|
|
|
|
cautionNoticeType = CautionNoticeTaskEnum.ChangeVesselVoyno,
|
|
|
|
cautionNoticeType = CautionNoticeTaskEnum.ChangeVesselVoyno,
|
|
|
|
bookingId = ca.BOOKING_ID,
|
|
|
|
bookingId = ca.Alloc.BOOKING_ID,
|
|
|
|
bookingSlotId = ca.BOOKING_SLOT_ID,
|
|
|
|
bookingSlotId = ca.Slot.Id,
|
|
|
|
createTime = DateTime.Now,
|
|
|
|
createTime = DateTime.Now,
|
|
|
|
origVal = $"{srcVessel}/{srcVoyno}",
|
|
|
|
origVal = srcWeek,
|
|
|
|
newVal = $"{targetVessel}/{targetVoyno}",
|
|
|
|
newVal = targetWeek,
|
|
|
|
tenentId = UserManager.TENANT_ID,
|
|
|
|
tenentId = UserManager.TENANT_ID,
|
|
|
|
userId = UserManager.UserId,
|
|
|
|
userId = UserManager.UserId,
|
|
|
|
userName = UserManager.Name,
|
|
|
|
userName = UserManager.Name,
|
|
|
|
}));
|
|
|
|
notifyList = new List<CautionNoticeTaskNoitfyDto>()
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (bookingInfo != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(bookingInfo.OPID))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CreateContact(notice.notifyList, userList, long.Parse(bookingInfo.OPID), bcSrcDto.MBLNo, notice.cautionNoticeType);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(bookingInfo.SALEID))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CreateContact(notice.notifyList, userList, long.Parse(bookingInfo.SALEID), bcSrcDto.MBLNo, notice.cautionNoticeType);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(bookingInfo.CUSTSERVICEID))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CreateContact(notice.notifyList, userList, long.Parse(bookingInfo.CUSTSERVICEID), bcSrcDto.MBLNo, notice.cautionNoticeType);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await _publisher.PublishAsync(new ChannelEventSource("CautionNoticeTask:Add", notice));
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
await _publisher.PublishAsync(new ChannelEventSource("CautionNoticeTask:Add",
|
|
|
|
var notice = new CautionNoticeTaskDto
|
|
|
|
new CautionNoticeTaskDto
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
cautionNoticeType = CautionNoticeTaskEnum.ChangeVesselVoyno,
|
|
|
|
cautionNoticeType = CautionNoticeTaskEnum.ChangeVesselVoyno,
|
|
|
|
bookingSlotId = slotId,
|
|
|
|
bookingSlotId = slotInfo.Id,
|
|
|
|
createTime = DateTime.Now,
|
|
|
|
createTime = DateTime.Now,
|
|
|
|
origVal = srcWeek,
|
|
|
|
origVal = srcWeek,
|
|
|
|
newVal = targetWeek,
|
|
|
|
newVal = targetWeek,
|
|
|
|
tenentId = UserManager.TENANT_ID,
|
|
|
|
tenentId = UserManager.TENANT_ID,
|
|
|
|
userId = UserManager.UserId,
|
|
|
|
userId = UserManager.UserId,
|
|
|
|
userName = UserManager.Name,
|
|
|
|
userName = UserManager.Name,
|
|
|
|
}));
|
|
|
|
notifyList = new List<CautionNoticeTaskNoitfyDto>()
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (slotInfo != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CreateContact(notice.notifyList, userList, slotInfo.CreatedUserId.Value, bcSrcDto.MBLNo, notice.cautionNoticeType);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await _publisher.PublishAsync(new ChannelEventSource("CautionNoticeTask:Add", notice));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -3202,41 +3347,200 @@ namespace Myshipping.Application
|
|
|
|
&& srcVessel.Equals("DIRECT_SHIP", StringComparison.OrdinalIgnoreCase)
|
|
|
|
&& srcVessel.Equals("DIRECT_SHIP", StringComparison.OrdinalIgnoreCase)
|
|
|
|
&& targetCarrierType.Equals("TRANSFER_SHIP", StringComparison.OrdinalIgnoreCase))
|
|
|
|
&& targetCarrierType.Equals("TRANSFER_SHIP", StringComparison.OrdinalIgnoreCase))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (bookingList.Count > 0)
|
|
|
|
if (bookingSlotAllocList.Count > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
bookingList.ForEach(async ca =>
|
|
|
|
bookingSlotAllocList.ForEach(async ca =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
await _publisher.PublishAsync(new ChannelEventSource("CautionNoticeTask:Add",
|
|
|
|
var bookingInfo = _repBookingOrder.AsQueryable().Filter(null, true).First(x => x.Id == ca.Alloc.BOOKING_ID && x.IsDeleted == false
|
|
|
|
new CautionNoticeTaskDto
|
|
|
|
&& x.TenantId == UserManager.TENANT_ID);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var notice = new CautionNoticeTaskDto
|
|
|
|
{
|
|
|
|
{
|
|
|
|
cautionNoticeType = CautionNoticeTaskEnum.ChangeTransfer,
|
|
|
|
cautionNoticeType = CautionNoticeTaskEnum.ChangeTransfer,
|
|
|
|
bookingId = ca.BOOKING_ID,
|
|
|
|
bookingId = ca.Alloc.BOOKING_ID,
|
|
|
|
bookingSlotId = ca.BOOKING_SLOT_ID,
|
|
|
|
bookingSlotId = ca.Slot.Id,
|
|
|
|
createTime = DateTime.Now,
|
|
|
|
createTime = DateTime.Now,
|
|
|
|
origVal = srcCarrierType,
|
|
|
|
origVal = srcWeek,
|
|
|
|
newVal = targetCarrierType,
|
|
|
|
newVal = targetWeek,
|
|
|
|
tenentId = UserManager.TENANT_ID,
|
|
|
|
tenentId = UserManager.TENANT_ID,
|
|
|
|
userId = UserManager.UserId,
|
|
|
|
userId = UserManager.UserId,
|
|
|
|
userName = UserManager.Name,
|
|
|
|
userName = UserManager.Name,
|
|
|
|
}));
|
|
|
|
notifyContent = $"mblno:{bcSrcDto.MBLNo} 直达变中转了",
|
|
|
|
|
|
|
|
notifyList = new List<CautionNoticeTaskNoitfyDto>()
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (bookingInfo != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(bookingInfo.OPID))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CreateContact(notice.notifyList, userList, long.Parse(bookingInfo.OPID), bcSrcDto.MBLNo, notice.cautionNoticeType);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(bookingInfo.SALEID))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CreateContact(notice.notifyList, userList, long.Parse(bookingInfo.SALEID), bcSrcDto.MBLNo, notice.cautionNoticeType);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(bookingInfo.CUSTSERVICEID))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CreateContact(notice.notifyList, userList, long.Parse(bookingInfo.CUSTSERVICEID), bcSrcDto.MBLNo, notice.cautionNoticeType);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await _publisher.PublishAsync(new ChannelEventSource("CautionNoticeTask:Add", notice));
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
await _publisher.PublishAsync(new ChannelEventSource("CautionNoticeTask:Add",
|
|
|
|
var notice = new CautionNoticeTaskDto
|
|
|
|
new CautionNoticeTaskDto
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
cautionNoticeType = CautionNoticeTaskEnum.ChangeTransfer,
|
|
|
|
cautionNoticeType = CautionNoticeTaskEnum.ChangeTransfer,
|
|
|
|
bookingSlotId = slotId,
|
|
|
|
bookingSlotId = slotInfo.Id,
|
|
|
|
createTime = DateTime.Now,
|
|
|
|
createTime = DateTime.Now,
|
|
|
|
origVal = srcCarrierType,
|
|
|
|
origVal = srcWeek,
|
|
|
|
newVal = targetCarrierType,
|
|
|
|
newVal = targetWeek,
|
|
|
|
tenentId = UserManager.TENANT_ID,
|
|
|
|
tenentId = UserManager.TENANT_ID,
|
|
|
|
userId = UserManager.UserId,
|
|
|
|
userId = UserManager.UserId,
|
|
|
|
userName = UserManager.Name,
|
|
|
|
userName = UserManager.Name,
|
|
|
|
}));
|
|
|
|
notifyContent = $"mblno:{bcSrcDto.MBLNo} 直达变中转了",
|
|
|
|
|
|
|
|
notifyList = new List<CautionNoticeTaskNoitfyDto>()
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (slotInfo != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CreateContact(notice.notifyList, userList, slotInfo.CreatedUserId.Value, bcSrcDto.MBLNo, notice.cautionNoticeType);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await _publisher.PublishAsync(new ChannelEventSource("CautionNoticeTask:Add", notice));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//如果新给的VGM截止时间,需要推送通知
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var notice = new CautionNoticeTaskDto
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
cautionNoticeType = CautionNoticeTaskEnum.CutDateAdvanced,
|
|
|
|
|
|
|
|
bookingId = ca.Alloc.BOOKING_ID,
|
|
|
|
|
|
|
|
bookingSlotId = ca.Slot.Id,
|
|
|
|
|
|
|
|
createTime = DateTime.Now,
|
|
|
|
|
|
|
|
origVal = srcWeek,
|
|
|
|
|
|
|
|
newVal = targetWeek,
|
|
|
|
|
|
|
|
tenentId = UserManager.TENANT_ID,
|
|
|
|
|
|
|
|
userId = UserManager.UserId,
|
|
|
|
|
|
|
|
userName = UserManager.Name,
|
|
|
|
|
|
|
|
notifyContent = $"VGM截止时间提前了,原:{srcVGMCut} 新:{targeVGMCut}",
|
|
|
|
|
|
|
|
notifyList = new List<CautionNoticeTaskNoitfyDto>()
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (bookingInfo != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(bookingInfo.OPID))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CreateContact(notice.notifyList, userList, long.Parse(bookingInfo.OPID), bcSrcDto.MBLNo, notice.cautionNoticeType);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(bookingInfo.SALEID))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CreateContact(notice.notifyList, userList, long.Parse(bookingInfo.SALEID), bcSrcDto.MBLNo, notice.cautionNoticeType);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(bookingInfo.CUSTSERVICEID))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CreateContact(notice.notifyList, userList, long.Parse(bookingInfo.CUSTSERVICEID), bcSrcDto.MBLNo, notice.cautionNoticeType);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await _publisher.PublishAsync(new ChannelEventSource("CautionNoticeTask:Add", notice));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var notice = new CautionNoticeTaskDto
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
cautionNoticeType = CautionNoticeTaskEnum.ChangeVesselVoyno,
|
|
|
|
|
|
|
|
bookingSlotId = slotInfo.Id,
|
|
|
|
|
|
|
|
createTime = DateTime.Now,
|
|
|
|
|
|
|
|
origVal = srcWeek,
|
|
|
|
|
|
|
|
newVal = targetWeek,
|
|
|
|
|
|
|
|
tenentId = UserManager.TENANT_ID,
|
|
|
|
|
|
|
|
userId = UserManager.UserId,
|
|
|
|
|
|
|
|
userName = UserManager.Name,
|
|
|
|
|
|
|
|
notifyList = new List<CautionNoticeTaskNoitfyDto>()
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (slotInfo != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CreateContact(notice.notifyList, userList, slotInfo.CreatedUserId.Value, bcSrcDto.MBLNo, notice.cautionNoticeType);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await _publisher.PublishAsync(new ChannelEventSource("CautionNoticeTask:Add", notice));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 生成联系人
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 生成联系人
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="notifyList">联系人列表</param>
|
|
|
|
|
|
|
|
/// <param name="userList">已检索用户详情列表</param>
|
|
|
|
|
|
|
|
/// <param name="contactId">联系用户ID</param>
|
|
|
|
|
|
|
|
/// <param name="mblNo">提单号</param>
|
|
|
|
|
|
|
|
/// <param name="cautionNoticeType">重要通知类型</param>
|
|
|
|
|
|
|
|
private void CreateContact(List<CautionNoticeTaskNoitfyDto> notifyList, List<SysUser> userList,long contactId,string mblNo, CautionNoticeTaskEnum cautionNoticeType)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!notifyList.Any(p => p.notifyUserId == contactId))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var userInfo = userList.FirstOrDefault(x => x.Id == contactId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (userInfo != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var contact = new CautionNoticeTaskNoitfyDto
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
notifyUserId = userInfo.Id,
|
|
|
|
|
|
|
|
notifyUserName = userInfo.Name,
|
|
|
|
|
|
|
|
notifyMethod = new CautionNoticeMethodEnum[] { CautionNoticeMethodEnum.Email, CautionNoticeMethodEnum.DingDing },
|
|
|
|
|
|
|
|
notifyMobile = userInfo.Phone?.Trim(),
|
|
|
|
|
|
|
|
notifyEmail = userInfo.Email?.Trim(),
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(userInfo.Phone))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.LogInformation($"MBLNO={mblNo} 比对舱位{cautionNoticeType.ToString()} 有变化,通知人{userInfo.Name}没有手机号");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
new EmailNoticeHelper().SendEmailNotice($"MBLNO={mblNo} 比对舱位{cautionNoticeType.ToString()} 有变化,通知人{userInfo.Name}没有手机号", $"MBLNO={mblNo} 比对舱位{cautionNoticeType.ToString()} 有变化,通知人{userInfo.Name}没有手机号", App.Configuration["EmailNoticeDefaultUser"].GetUserEmailList());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(userInfo.Email))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.LogInformation($"MBLNO={mblNo} 比对舱位{cautionNoticeType.ToString()} 有变化,通知人{userInfo.Name}没有邮箱");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
new EmailNoticeHelper().SendEmailNotice($"MBLNO={mblNo} 比对舱位{cautionNoticeType.ToString()} 有变化,通知人{userInfo.Name}没有邮箱", $"MBLNO={mblNo} 比对舱位{cautionNoticeType.ToString()} 有变化,通知人{userInfo.Name}没有邮箱", App.Configuration["EmailNoticeDefaultUser"].GetUserEmailList());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
notifyList.Add(contact);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|