From 00e3cbc958fd3c0f77ae172a714620d551074d31 Mon Sep 17 00:00:00 2001 From: zhangxiaofeng <1939543722@qq.com> Date: Thu, 23 May 2024 11:15:52 +0800 Subject: [PATCH] =?UTF-8?q?=E8=88=B1=E4=BD=8D=E4=BD=9C=E5=BA=9F=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/BookingSlot/BookingSlotService.cs | 65 ++++++++++--------- 1 file changed, 35 insertions(+), 30 deletions(-) diff --git a/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs b/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs index 3cecbd47..dd82cfc0 100644 --- a/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs +++ b/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs @@ -1643,40 +1643,45 @@ namespace Myshipping.Application #region 舱位 [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); - if (slot == null) + var idArr = Ids.Split(','); + foreach (var idStr in idArr) { - throw Oops.Oh("舱位信息不存在"); - } - await _repBase.UpdateAsync(x => x.Id == id, x => new BookingSlotBase() - { - IsDeleted = true, - UpdatedTime = DateTime.Now, - UpdatedUserId = UserManager.UserId, - UpdatedUserName = UserManager.Name - }); + var id = Convert.ToInt64(idStr); - await _repCtn.UpdateAsync(x => x.SLOT_ID == id, x => new BookingSlotCtn() - { - IsDeleted = true, - UpdatedTime = DateTime.Now, - UpdatedUserId = UserManager.UserId, - UpdatedUserName = UserManager.Name - }); + var slot = await _repBase.FirstOrDefaultAsync(x => x.Id == id); + if (slot == null) + { + throw Oops.Oh("舱位信息不存在"); + } + 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 - { - 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 - })); + await _repCtn.UpdateAsync(x => x.SLOT_ID == id, x => new BookingSlotCtn() + { + IsDeleted = true, + UpdatedTime = DateTime.Now, + UpdatedUserId = UserManager.UserId, + UpdatedUserName = UserManager.Name + }); + await _publisher.PublishAsync(new ChannelEventSource("BookingSlotStock:Update", new BookingSlotStockUpdateModel + { + 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 + })); + } } ///