订舱删除时,删除已引入的舱位的关联关系

master
zhangxiaofeng 7 months ago
parent 2af1ea9d62
commit eb5030560d

@ -2306,6 +2306,10 @@ namespace Myshipping.Application
{ {
continue; continue;
} }
// 通过租户参数判断这一票的租户是否启用了舱位引入功能
var isCancelAllocationSlot = tenantParamList.FirstOrDefault(x => x.TenantId == order.TenantId && x.ParaCode == TenantParamCode.ENABLE_SLOT_ABILITY)?.ItemCode;
var mblno = order.MBLNO; var mblno = order.MBLNO;
// 将待删除的订舱单id存放到Cache中。目的使用SendBookingOrder()推送订舱单数据前通过Cache判断是否正在走删除逻辑来决定是否推送(如果是正在处理删除逻辑的数据,则不推送) // 将待删除的订舱单id存放到Cache中。目的使用SendBookingOrder()推送订舱单数据前通过Cache判断是否正在走删除逻辑来决定是否推送(如果是正在处理删除逻辑的数据,则不推送)
@ -2349,6 +2353,12 @@ namespace Myshipping.Application
// 取消订阅运踪 // 取消订阅运踪
waitUnsubscribeBilltrace.Add(new BillTraceUnsubscribeList(Id.ToString(), mblno)); waitUnsubscribeBilltrace.Add(new BillTraceUnsubscribeList(Id.ToString(), mblno));
if (isCancelAllocationSlot == "YES")
{
// 取消关联舱位
await CancelAllocationSlot(Id);
}
// 记录日志 // 记录日志
var newOrder = order.Adapt<BookingOrder>(); var newOrder = order.Adapt<BookingOrder>();
newOrder.IsDeleted = true; newOrder.IsDeleted = true;
@ -2379,6 +2389,12 @@ namespace Myshipping.Application
// 取消订阅运踪 // 取消订阅运踪
waitUnsubscribeBilltrace.Add(new BillTraceUnsubscribeList(Id.ToString(), mblno)); waitUnsubscribeBilltrace.Add(new BillTraceUnsubscribeList(Id.ToString(), mblno));
if (isCancelAllocationSlot == "YES")
{
// 取消关联舱位
await CancelAllocationSlot(Id);
}
// 记录日志 // 记录日志
var newOrder = order.Adapt<BookingOrder>(); var newOrder = order.Adapt<BookingOrder>();
newOrder.IsDeleted = true; newOrder.IsDeleted = true;
@ -11866,9 +11882,21 @@ namespace Myshipping.Application
[HttpPost("/BookingOrder/CancelAllocationSlot")] [HttpPost("/BookingOrder/CancelAllocationSlot")]
public async Task CancelAllocationSlot(long id) public async Task CancelAllocationSlot(long id)
{ {
var slotList = await _repSlotAllocation.AsQueryable().Where(a => a.BOOKING_ID == id).ToListAsync(); var slotList = await _repSlotAllocation.AsQueryable().Where(a => a.BOOKING_ID == id).Select(x => new
var slotIdList = slotList.Select(s => s.Id); {
x.Id,
x.BOOKING_SLOT_TYPE,
x.CARRIERID,
x.CONTRACT_NO,
x.VESSEL,
x.VOYNO,
x.PLACERECEIPT,
x.PLACEDELIVERY
}).ToListAsync();
if (slotList.Count > 0)
{
var slotIdList = slotList.Select(s => s.Id);
await _repSlotAllocation.Context.Updateable<BookingSlotAllocation>() await _repSlotAllocation.Context.Updateable<BookingSlotAllocation>()
.SetColumns(a => a.IsDeleted == true) .SetColumns(a => a.IsDeleted == true)
.SetColumns(a => a.UpdatedTime == DateTime.Now) .SetColumns(a => a.UpdatedTime == DateTime.Now)
@ -11900,6 +11928,7 @@ namespace Myshipping.Application
})); }));
} }
} }
}
#endregion #endregion
#region 客户订舱系统代码独有的逻辑——2024年2月27日迁移自客户订舱系统 #region 客户订舱系统代码独有的逻辑——2024年2月27日迁移自客户订舱系统

Loading…
Cancel
Save