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; }