舱位作废接口

master
zhangxiaofeng 6 months ago
parent dc4283ad88
commit 00e3cbc958

@ -1643,40 +1643,45 @@ namespace Myshipping.Application
#region 舱位 #region 舱位
[HttpPost("/BookingSlot/delete")] [HttpPost("/BookingSlot/delete")]
public async Task Delete([FromQuery] long id) public async Task Delete([FromQuery] string Ids)
{ {
var slot = await _repBase.FirstOrDefaultAsync(x => x.Id == id); var idArr = Ids.Split(',');
if (slot == null) foreach (var idStr in idArr)
{ {
throw Oops.Oh("舱位信息不存在"); var id = Convert.ToInt64(idStr);
}
await _repBase.UpdateAsync(x => x.Id == id, x => new BookingSlotBase()
{
IsDeleted = true,
UpdatedTime = DateTime.Now,
UpdatedUserId = UserManager.UserId,
UpdatedUserName = UserManager.Name
});
await _repCtn.UpdateAsync(x => x.SLOT_ID == id, x => new BookingSlotCtn() var slot = await _repBase.FirstOrDefaultAsync(x => x.Id == id);
{ if (slot == null)
IsDeleted = true, {
UpdatedTime = DateTime.Now, throw Oops.Oh("舱位信息不存在");
UpdatedUserId = UserManager.UserId, }
UpdatedUserName = UserManager.Name await _repBase.UpdateAsync(x => x.Id == id, x => new BookingSlotBase()
}); {
IsDeleted = true,
UpdatedTime = DateTime.Now,
UpdatedUserId = UserManager.UserId,
UpdatedUserName = UserManager.Name
});
await _publisher.PublishAsync(new ChannelEventSource("BookingSlotStock:Update", new BookingSlotStockUpdateModel await _repCtn.UpdateAsync(x => x.SLOT_ID == id, x => new BookingSlotCtn()
{ {
BOOKING_SLOT_TYPE = slot.BOOKING_SLOT_TYPE, IsDeleted = true,
CARRIERID = slot.CARRIERID, UpdatedTime = DateTime.Now,
CONTRACT_NO = slot.CONTRACT_NO, UpdatedUserId = UserManager.UserId,
VESSEL = slot.VESSEL, UpdatedUserName = UserManager.Name
VOYNO = slot.VOYNO, });
PORTLOADID = slot.PORTLOADID, await _publisher.PublishAsync(new ChannelEventSource("BookingSlotStock:Update", new BookingSlotStockUpdateModel
PORTDISCHARGEID = slot.PORTDISCHARGEID, {
TenantId = UserManager.TENANT_ID BOOKING_SLOT_TYPE = slot.BOOKING_SLOT_TYPE,
})); CARRIERID = slot.CARRIERID,
CONTRACT_NO = slot.CONTRACT_NO,
VESSEL = slot.VESSEL,
VOYNO = slot.VOYNO,
PORTLOADID = slot.PORTLOADID,
PORTDISCHARGEID = slot.PORTDISCHARGEID,
TenantId = UserManager.TENANT_ID
}));
}
} }
/// <summary> /// <summary>

Loading…
Cancel
Save