|
|
|
@ -63,6 +63,7 @@ namespace Myshipping.Application
|
|
|
|
|
private readonly IDjyCustomerService _djyCustomerService;
|
|
|
|
|
private readonly IBookingValueAddedService _bookingValueAddedService;
|
|
|
|
|
private readonly IBookingLabelService _bookingLabelService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const string CONST_BC_FILE_CODE = "bc";
|
|
|
|
|
const string CONST_BC_FILE_NAME = "Booking Confirmation";
|
|
|
|
@ -92,6 +93,7 @@ namespace Myshipping.Application
|
|
|
|
|
SqlSugarRepository<BookingSlotCompare> bookingSlotCompareRepository,
|
|
|
|
|
SqlSugarRepository<BookingOrderContact> bookingOrderContactRepository,
|
|
|
|
|
INamedServiceProvider<IBookingOrderService> namedBookingOrderServiceProvider,
|
|
|
|
|
|
|
|
|
|
IBookingValueAddedService bookingValueAddedService,
|
|
|
|
|
SqlSugarRepository<BookingOrder> repBookingOrder,
|
|
|
|
|
SqlSugarRepository<BookingLabelAllocation> repLabelAllocation,
|
|
|
|
@ -119,6 +121,8 @@ namespace Myshipping.Application
|
|
|
|
|
_repBookingOrder = repBookingOrder;
|
|
|
|
|
_repLabelAllocation = repLabelAllocation;
|
|
|
|
|
_bookingLabelService = bookingLabelService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 舱位
|
|
|
|
@ -722,6 +726,9 @@ namespace Myshipping.Application
|
|
|
|
|
TaskBCInfoDto bcSrcDto = model.Adapt<TaskBCInfoDto>();
|
|
|
|
|
TaskBCInfoDto bcTargetDto = dto.DataObj.Adapt<TaskBCInfoDto>();
|
|
|
|
|
|
|
|
|
|
//执行差异重要提醒
|
|
|
|
|
//await MeasureDiffCautionTask(bcSrcDto, bcTargetDto, model.Id);
|
|
|
|
|
|
|
|
|
|
//提取箱信息
|
|
|
|
|
var ctnList = _repCtn.AsQueryable().Filter(null, true)
|
|
|
|
|
.Where(x => x.IsDeleted == false && x.TenantId.Value == UserManager.TENANT_ID
|
|
|
|
@ -1971,19 +1978,20 @@ namespace Myshipping.Application
|
|
|
|
|
var selectNum = generateModel.CtnList.Sum(x => x.CTNNUM);
|
|
|
|
|
var allNum = await _repCtn.AsQueryable().Where(x => x.SLOT_ID == generateModel.SlotId).SumAsync(x => x.CTNNUM);
|
|
|
|
|
bkModel.IsSplit = selectNum != allNum;
|
|
|
|
|
if (bkModel.IsSplit == true)
|
|
|
|
|
if (bkModel.IsSplit)
|
|
|
|
|
{
|
|
|
|
|
var sql = _repBookingOrder.AsQueryable().Where(" MBLNO like @mblno+'_' ", new { mblno = custNo }).ToSqlString();
|
|
|
|
|
var currentOrder = await _repBookingOrder.AsQueryable().Where(" MBLNO like @mblno+'_' ", new { mblno = custNo })
|
|
|
|
|
var sql = _repBookingOrder.AsQueryable().Where(" MBLNO like @mblno ", new { mblno = custNo + '_' }).OrderByDescending(x => x.Id).Select(x => x.MBLNO).ToSqlString();
|
|
|
|
|
var currentMblno = await _repBookingOrder.AsQueryable().Where(" MBLNO like @mblno ", new { mblno = custNo + '_' })
|
|
|
|
|
.OrderByDescending(x => x.Id)
|
|
|
|
|
.Select(x => x.MBLNO)
|
|
|
|
|
.FirstAsync();
|
|
|
|
|
if (currentOrder == null)
|
|
|
|
|
if (currentMblno == null)
|
|
|
|
|
{
|
|
|
|
|
bkModel.MBLNO = custNo + "A";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var lastLetter = currentOrder.MBLNO.Substring(currentOrder.MBLNO.Length - 1, 1)[0];
|
|
|
|
|
var lastLetter = currentMblno.Substring(currentMblno.Length - 1, 1)[0];
|
|
|
|
|
var newMblno = custNo + LetterIndexUtil.GetNextLetter(lastLetter);
|
|
|
|
|
bkModel.MBLNO = newMblno;
|
|
|
|
|
}
|
|
|
|
@ -2275,6 +2283,113 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 估算差异重要提醒
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 估算差异重要提醒
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="bcSrcDto">原舱位详情</param>
|
|
|
|
|
/// <param name="bcTargetDto">新舱位详情</param>
|
|
|
|
|
/// <param name="slotId">舱位ID</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task MeasureDiffCautionTask(TaskBCInfoDto bcSrcDto, TaskBCInfoDto bcTargetDto, long slotId)
|
|
|
|
|
{
|
|
|
|
|
if (bcSrcDto.CarrierId.Equals("MSK", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
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 =>
|
|
|
|
|
{
|
|
|
|
|
await _publisher.PublishAsync(new ChannelEventSource("CautionNoticeTask:Add",
|
|
|
|
|
new CautionNoticeTaskDto
|
|
|
|
|
{
|
|
|
|
|
cautionNoticeType = CautionNoticeTaskEnum.WeekAt,
|
|
|
|
|
bookingId = ca.BOOKING_ID,
|
|
|
|
|
bookingSlotId = ca.BOOKING_SLOT_ID,
|
|
|
|
|
createTime = DateTime.Now,
|
|
|
|
|
origVal = srcWeek,
|
|
|
|
|
newVal = targetWeek,
|
|
|
|
|
tenentId = UserManager.TENANT_ID,
|
|
|
|
|
userId = UserManager.UserId,
|
|
|
|
|
userName = UserManager.Name,
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
await _publisher.PublishAsync(new ChannelEventSource("CautionNoticeTask:Add",
|
|
|
|
|
new CautionNoticeTaskDto
|
|
|
|
|
{
|
|
|
|
|
cautionNoticeType = CautionNoticeTaskEnum.WeekAt,
|
|
|
|
|
bookingSlotId = slotId,
|
|
|
|
|
createTime = DateTime.Now,
|
|
|
|
|
origVal = srcWeek,
|
|
|
|
|
newVal = targetWeek,
|
|
|
|
|
tenentId = UserManager.TENANT_ID,
|
|
|
|
|
userId = UserManager.UserId,
|
|
|
|
|
userName = UserManager.Name,
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string srcPriceCalcDate = bcSrcDto.PriceCalculationDate.HasValue ? bcSrcDto.PriceCalculationDate.Value.ToString("yyyy-MM-dd") : "";
|
|
|
|
|
string targePriceCalcDate = bcTargetDto.PriceCalculationDate.HasValue ? bcTargetDto.PriceCalculationDate.Value.ToString("yyyy-MM-dd") : "";
|
|
|
|
|
|
|
|
|
|
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 =>
|
|
|
|
|
{
|
|
|
|
|
await _publisher.PublishAsync(new ChannelEventSource("CautionNoticeTask:Add",
|
|
|
|
|
new CautionNoticeTaskDto
|
|
|
|
|
{
|
|
|
|
|
cautionNoticeType = CautionNoticeTaskEnum.PriceCalcDate,
|
|
|
|
|
bookingId = ca.BOOKING_ID,
|
|
|
|
|
bookingSlotId = ca.BOOKING_SLOT_ID,
|
|
|
|
|
createTime = DateTime.Now,
|
|
|
|
|
origVal = srcWeek,
|
|
|
|
|
newVal = targetWeek,
|
|
|
|
|
tenentId = UserManager.TENANT_ID,
|
|
|
|
|
userId = UserManager.UserId,
|
|
|
|
|
userName = UserManager.Name,
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
await _publisher.PublishAsync(new ChannelEventSource("CautionNoticeTask:Add",
|
|
|
|
|
new CautionNoticeTaskDto
|
|
|
|
|
{
|
|
|
|
|
cautionNoticeType = CautionNoticeTaskEnum.PriceCalcDate,
|
|
|
|
|
bookingSlotId = slotId,
|
|
|
|
|
createTime = DateTime.Now,
|
|
|
|
|
origVal = srcWeek,
|
|
|
|
|
newVal = targetWeek,
|
|
|
|
|
tenentId = UserManager.TENANT_ID,
|
|
|
|
|
userId = UserManager.UserId,
|
|
|
|
|
userName = UserManager.Name,
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|