From cf47327db865978f56430a486391a84e988274d9 Mon Sep 17 00:00:00 2001 From: zhangxiaofeng <1939543722@qq.com> Date: Tue, 21 May 2024 14:56:58 +0800 Subject: [PATCH] =?UTF-8?q?=E8=88=B1=E4=BD=8D=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Myshipping.Application/Entity/BookingOrder.cs | 2 +- .../Event/BookingSlotStockSubscriber.cs | 7 +++++++ .../Service/BookingOrder/BookingOrderService.cs | 2 +- .../Service/BookingOrder/Dto/BookingOrderDto.cs | 2 +- .../Service/BookingSlot/BookingSlotService.cs | 11 ++++++----- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Myshipping.Application/Entity/BookingOrder.cs b/Myshipping.Application/Entity/BookingOrder.cs index c172e6f6..4ad8c9ee 100644 --- a/Myshipping.Application/Entity/BookingOrder.cs +++ b/Myshipping.Application/Entity/BookingOrder.cs @@ -1056,7 +1056,7 @@ namespace Myshipping.Application.Entity /// /// 是否为舱位拆票后生成的订舱 /// - public bool? IsSplit { get; set; } + public bool IsSplit { get; set; } /// /// 分单操作ID diff --git a/Myshipping.Application/Event/BookingSlotStockSubscriber.cs b/Myshipping.Application/Event/BookingSlotStockSubscriber.cs index b6d85122..5c5b3384 100644 --- a/Myshipping.Application/Event/BookingSlotStockSubscriber.cs +++ b/Myshipping.Application/Event/BookingSlotStockSubscriber.cs @@ -150,6 +150,13 @@ namespace Myshipping.Application.Event { // 已使用舱位数 stockObj.USE_NUM = lstAllocKeyList.DistinctBy(x => x.BOOKING_SLOT_ID).Count(); + //// 这里要判断使用的箱子与舱位原有的箱子的数量是否一致,在一致的情况下,舱位才算被使用 + //foreach (var item in lstAllocKeyList) + //{ + + //} + //await _repAllocCtn.AsQueryable().Filter(null, true).Where(x => !x.IsDeleted) + // 订舱引用表主键列表 var lstAllocIdList = lstAllocKeyList.Select(x => x.Id).ToList(); diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index ab89e6f8..ce016f51 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -1545,7 +1545,7 @@ namespace Myshipping.Application //陈冠宇提订舱编号不允许重复 if (!string.IsNullOrWhiteSpace(input.CUSTNO)) { - var et = await _rep.AsQueryable().Filter(null, true).AnyAsync(x => x.IsDeleted == false && x.CUSTNO == input.CUSTNO && x.TenantId == UserManager.TENANT_ID && x.ParentId == 0 && x.Id != input.Id); + var et = await _rep.AsQueryable().Filter(null, true).AnyAsync(x => x.IsDeleted == false && x.IsSplit == false && x.CUSTNO == input.CUSTNO && x.TenantId == UserManager.TENANT_ID && x.ParentId == 0 && x.Id != input.Id); if (et) { throw Oops.Bah("当前订舱编号已存在,请勿重复录入!"); diff --git a/Myshipping.Application/Service/BookingOrder/Dto/BookingOrderDto.cs b/Myshipping.Application/Service/BookingOrder/Dto/BookingOrderDto.cs index 1b2c7fd1..7f3aede8 100644 --- a/Myshipping.Application/Service/BookingOrder/Dto/BookingOrderDto.cs +++ b/Myshipping.Application/Service/BookingOrder/Dto/BookingOrderDto.cs @@ -861,7 +861,7 @@ namespace Myshipping.Application /// /// 是否为舱位拆票后生成的订舱 /// - public bool? IsSplit { get; set; } + public bool IsSplit { get; set; } /// /// 分单操作ID diff --git a/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs b/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs index 9151578d..173e5d8d 100644 --- a/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs +++ b/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs @@ -1971,19 +1971,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; }