|
|
|
@ -2296,7 +2296,7 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
var tenantParamList = await _cache.GetAllTenantParam();
|
|
|
|
|
var isAskDs = tenantParamList.FirstOrDefault(x => x.TenantId == UserManager.TENANT_ID && x.ParaCode == TenantParamCode.ASK_DS_BEFORE_DELETE_BOOKING_ORDER);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var ar in arr)
|
|
|
|
|
{
|
|
|
|
|
long Id = Convert.ToInt64(ar);
|
|
|
|
@ -2306,6 +2306,10 @@ namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 通过租户参数判断这一票的租户是否启用了舱位引入功能
|
|
|
|
|
var isCancelAllocationSlot = tenantParamList.FirstOrDefault(x => x.TenantId == order.TenantId && x.ParaCode == TenantParamCode.ENABLE_SLOT_ABILITY)?.ItemCode;
|
|
|
|
|
|
|
|
|
|
var mblno = order.MBLNO;
|
|
|
|
|
|
|
|
|
|
// 将待删除的订舱单id存放到Cache中。目的:使用SendBookingOrder()推送订舱单数据前通过Cache判断是否正在走删除逻辑,来决定是否推送(如果是正在处理删除逻辑的数据,则不推送)
|
|
|
|
@ -2349,6 +2353,12 @@ namespace Myshipping.Application
|
|
|
|
|
// 取消订阅运踪
|
|
|
|
|
waitUnsubscribeBilltrace.Add(new BillTraceUnsubscribeList(Id.ToString(), mblno));
|
|
|
|
|
|
|
|
|
|
if (isCancelAllocationSlot == "YES")
|
|
|
|
|
{
|
|
|
|
|
// 取消关联舱位
|
|
|
|
|
await CancelAllocationSlot(Id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 记录日志
|
|
|
|
|
var newOrder = order.Adapt<BookingOrder>();
|
|
|
|
|
newOrder.IsDeleted = true;
|
|
|
|
@ -2379,6 +2389,12 @@ namespace Myshipping.Application
|
|
|
|
|
// 取消订阅运踪
|
|
|
|
|
waitUnsubscribeBilltrace.Add(new BillTraceUnsubscribeList(Id.ToString(), mblno));
|
|
|
|
|
|
|
|
|
|
if (isCancelAllocationSlot == "YES")
|
|
|
|
|
{
|
|
|
|
|
// 取消关联舱位
|
|
|
|
|
await CancelAllocationSlot(Id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 记录日志
|
|
|
|
|
var newOrder = order.Adapt<BookingOrder>();
|
|
|
|
|
newOrder.IsDeleted = true;
|
|
|
|
@ -11866,10 +11882,22 @@ namespace Myshipping.Application
|
|
|
|
|
[HttpPost("/BookingOrder/CancelAllocationSlot")]
|
|
|
|
|
public async Task CancelAllocationSlot(long id)
|
|
|
|
|
{
|
|
|
|
|
var slotList = await _repSlotAllocation.AsQueryable().Where(a => a.BOOKING_ID == id).ToListAsync();
|
|
|
|
|
var slotIdList = slotList.Select(s => s.Id);
|
|
|
|
|
var slotList = await _repSlotAllocation.AsQueryable().Where(a => a.BOOKING_ID == id).Select(x => new
|
|
|
|
|
{
|
|
|
|
|
x.Id,
|
|
|
|
|
x.BOOKING_SLOT_TYPE,
|
|
|
|
|
x.CARRIERID,
|
|
|
|
|
x.CONTRACT_NO,
|
|
|
|
|
x.VESSEL,
|
|
|
|
|
x.VOYNO,
|
|
|
|
|
x.PLACERECEIPT,
|
|
|
|
|
x.PLACEDELIVERY
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
|
|
await _repSlotAllocation.Context.Updateable<BookingSlotAllocation>()
|
|
|
|
|
if (slotList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
var slotIdList = slotList.Select(s => s.Id);
|
|
|
|
|
await _repSlotAllocation.Context.Updateable<BookingSlotAllocation>()
|
|
|
|
|
.SetColumns(a => a.IsDeleted == true)
|
|
|
|
|
.SetColumns(a => a.UpdatedTime == DateTime.Now)
|
|
|
|
|
.SetColumns(a => a.UpdatedUserId == UserManager.UserId)
|
|
|
|
@ -11877,27 +11905,28 @@ namespace Myshipping.Application
|
|
|
|
|
.Where(a => slotIdList.Contains(a.Id))
|
|
|
|
|
.ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
await _repSlotAllocationCtn.Context.Updateable<BookingSlotAllocationCtn>()
|
|
|
|
|
.SetColumns(a => a.IsDeleted == true)
|
|
|
|
|
.SetColumns(a => a.UpdatedTime == DateTime.Now)
|
|
|
|
|
.SetColumns(a => a.UpdatedUserId == UserManager.UserId)
|
|
|
|
|
.SetColumns(a => a.UpdatedUserName == UserManager.Name)
|
|
|
|
|
.Where(a => slotIdList.Contains(a.SLOT_ALLOC_ID))
|
|
|
|
|
.ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
// 更新库存
|
|
|
|
|
foreach (var item in slotList)
|
|
|
|
|
{
|
|
|
|
|
await _publisher.PublishAsync(new ChannelEventSource("BookingSlotStock:Update", new Event.BookingSlotStockUpdateModel
|
|
|
|
|
{
|
|
|
|
|
BOOKING_SLOT_TYPE = item.BOOKING_SLOT_TYPE,
|
|
|
|
|
CARRIERID = item.CARRIERID,
|
|
|
|
|
CONTRACT_NO = item.CONTRACT_NO,
|
|
|
|
|
VESSEL = item.VESSEL,
|
|
|
|
|
VOYNO = item.VOYNO,
|
|
|
|
|
PLACERECEIPT = item.PLACERECEIPT,
|
|
|
|
|
PLACEDELIVERY = item.PLACEDELIVERY
|
|
|
|
|
}));
|
|
|
|
|
await _repSlotAllocationCtn.Context.Updateable<BookingSlotAllocationCtn>()
|
|
|
|
|
.SetColumns(a => a.IsDeleted == true)
|
|
|
|
|
.SetColumns(a => a.UpdatedTime == DateTime.Now)
|
|
|
|
|
.SetColumns(a => a.UpdatedUserId == UserManager.UserId)
|
|
|
|
|
.SetColumns(a => a.UpdatedUserName == UserManager.Name)
|
|
|
|
|
.Where(a => slotIdList.Contains(a.SLOT_ALLOC_ID))
|
|
|
|
|
.ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
// 更新库存
|
|
|
|
|
foreach (var item in slotList)
|
|
|
|
|
{
|
|
|
|
|
await _publisher.PublishAsync(new ChannelEventSource("BookingSlotStock:Update", new Event.BookingSlotStockUpdateModel
|
|
|
|
|
{
|
|
|
|
|
BOOKING_SLOT_TYPE = item.BOOKING_SLOT_TYPE,
|
|
|
|
|
CARRIERID = item.CARRIERID,
|
|
|
|
|
CONTRACT_NO = item.CONTRACT_NO,
|
|
|
|
|
VESSEL = item.VESSEL,
|
|
|
|
|
VOYNO = item.VOYNO,
|
|
|
|
|
PLACERECEIPT = item.PLACERECEIPT,
|
|
|
|
|
PLACEDELIVERY = item.PLACEDELIVERY
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|