diff --git a/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs b/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs index 34f2e770..549ab7a3 100644 --- a/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs +++ b/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs @@ -1087,9 +1087,17 @@ namespace Myshipping.Application /// 查询可用的舱位及箱子 /// [HttpGet("/BookingSlot/getAvailableSlots")] - public async Task> GetAvailableSlots([FromQuery] BookingSlotBaseDto input) + public async Task> GetAvailableSlots([FromQuery] BookingSlotBaseDto input, [FromQuery] PageWithTotal pageInfo) { - return await GetAvailableSlots(input, null); + var result = await GetAvailableSlots(input, null, pageInfo); + SqlSugarPagedList pageResult = new() + { + PageIndex = pageInfo.PageNo, + PageSize = pageInfo.PageSize, + TotalCount = pageInfo.Total, + Items = result, + }; + return pageResult; } /// @@ -1097,9 +1105,12 @@ namespace Myshipping.Application /// /// 筛选条件1:舱位信息、箱型 /// 筛选条件2:舱位主键列表 + /// 筛选条件3:分页 /// 可用的舱位列表(含可用的箱子列表) [NonAction] - public async Task> GetAvailableSlots(BookingSlotBaseDto slotInput = null, List slotIdListInput = null) + public async Task> GetAvailableSlots(BookingSlotBaseDto slotInput = null, + List slotIdListInput = null, + PageWithTotal pageInfo = null) { slotInput ??= new(); slotIdListInput ??= new(); @@ -1113,6 +1124,7 @@ namespace Myshipping.Application // 1. 【舱位基础表】与【箱子表】做关联,并根据【舱位主键】、【箱型】做分组,统计出【总的箱量】,作为queryable1 var queryable1 = _repBase.Context.Queryable((bas, ctn) => bas.Id == ctn.SLOT_ID) .Where(bas => bas.IS_CANCELLATION == false) + .WhereIF(!string.IsNullOrEmpty(slotInput.SLOT_BOOKING_NO), bas => bas.SLOT_BOOKING_NO == slotInput.SLOT_BOOKING_NO) .WhereIF(!string.IsNullOrEmpty(slotInput.PORTLOAD), bas => bas.PORTLOAD.Contains(slotInput.PORTLOAD)) .WhereIF(!string.IsNullOrEmpty(slotInput.PORTDISCHARGE), bas => bas.PORTLOAD.Contains(slotInput.PORTLOAD)) .WhereIF(!string.IsNullOrEmpty(slotInput.VESSEL), bas => bas.VESSEL.Contains(slotInput.VESSEL)) @@ -1161,7 +1173,15 @@ namespace Myshipping.Application .Where(r => r.numResidue > 0); // 4. 执行ToList(),得到可用的【舱位主键】、【箱型】、【箱量】列表 - var canUselist = await queryable3.ToListAsync(); + RefAsync total = 0; + var canUselist = pageInfo == null + ? await queryable3.ToListAsync() + : await queryable3.ToPageListAsync(pageInfo.PageNo, pageInfo.PageSize, total); + + if (pageInfo != null) + { + pageInfo.Total = total; + } // 查询舱位列表 var baseIdList = canUselist.Select(c => c.id); @@ -1340,39 +1360,58 @@ namespace Myshipping.Application /// /// 分页查询订舱舱位 /// - /// - /// [HttpPost("/BookingSlot/page")] public async Task Page(BookingSlotBasePageInput input) { - var entities = await _repBase.AsQueryable() - .WhereIF(!string.IsNullOrEmpty(input.SLOT_BOOKING_NO), u => u.SLOT_BOOKING_NO.Contains(input.SLOT_BOOKING_NO)) - .WhereIF(input.STATUS == 1, u => !u.IS_CANCELLATION) - .WhereIF(input.STATUS == 2, u => u.IS_CANCELLATION) - .WhereIF(!string.IsNullOrEmpty(input.VESSEL), u => u.VESSEL.Contains(input.VESSEL)) - .WhereIF(!string.IsNullOrEmpty(input.VOYNO), u => u.VOYNO.Contains(input.VOYNO)) - .WhereIF(!string.IsNullOrEmpty(input.PORTLOAD), u => u.PORTLOAD.Contains(input.PORTLOAD)) - .WhereIF(!string.IsNullOrEmpty(input.PORTDISCHARGE), u => u.PORTDISCHARGE.Contains(input.PORTDISCHARGE)) - - .WhereIF(input.ETD_START.HasValue, u => u.ETD >= input.ETD_START.Value) - .WhereIF(input.ETD_END.HasValue, u => u.ETD < input.ETD_END.Value.AddDays(1)) - .WhereIF(input.ETA_START.HasValue, u => u.ETA >= input.ETA_START.Value) - .WhereIF(input.ETA_END.HasValue, u => u.ETA < input.ETA_END.Value.AddDays(1)) - .WhereIF(!string.IsNullOrEmpty(input.CreatedUserName), u => u.CreatedUserName.Contains(input.CreatedUserName)) - .WhereIF(!string.IsNullOrEmpty(input.UpdatedUserName), u => u.UpdatedUserName.Contains(input.UpdatedUserName)) - - .WhereIF(!string.IsNullOrEmpty(input.CARRIER), u => u.CARRIER.Contains(input.CARRIER)) - .WhereIF(!string.IsNullOrEmpty(input.CONTRACT_NO), u => u.CONTRACT_NO.Contains(input.CONTRACT_NO)) - .WhereIF(!string.IsNullOrEmpty(input.SI_RLT_STAT), u => u.SI_RLT_STAT == input.SI_RLT_STAT) - .WhereIF(!string.IsNullOrEmpty(input.VGM_RLT_STAT), u => u.VGM_RLT_STAT == input.VGM_RLT_STAT) - .WhereIF(!string.IsNullOrEmpty(input.CARRIAGE_TYPE), u => u.CARRIAGE_TYPE == input.CARRIAGE_TYPE) - .WhereIF(!string.IsNullOrEmpty(input.BOOKING_SLOT_TYPE), u => u.BOOKING_SLOT_TYPE == input.BOOKING_SLOT_TYPE) + if (!string.IsNullOrEmpty(input.WEEK_AT)) + { + input.WEEK_AT = "W" + input.WEEK_AT; + } + ISugarQueryable select = null; + string[] ctnCodeArr = null; + if (!string.IsNullOrEmpty(input.CTN_STAT)) + { + ctnCodeArr = input.CTN_STAT.Split(','); + select = _repBase.AsQueryable().InnerJoin((u, c) => u.Id == c.SLOT_ID); + } + else + { + select = _repBase.AsQueryable(); + } - .WhereIF(!string.IsNullOrEmpty(input.LANENAME), u => u.LANENAME.Contains(input.LANENAME)) - .WhereIF(!string.IsNullOrEmpty(input.CTN_STAT), u => u.CTN_STAT.Contains(input.CTN_STAT)) - .WhereIF(!string.IsNullOrEmpty(input.WEEK_AT), u => u.WEEK_AT.Contains(input.WEEK_AT)) - .OrderByDescending(u => u.CreatedTime) - .ToPagedListAsync(input.PageNo, input.PageSize); + select = select.WhereIF(!string.IsNullOrEmpty(input.SLOT_BOOKING_NO), u => u.SLOT_BOOKING_NO.Contains(input.SLOT_BOOKING_NO)) + .WhereIF(!string.IsNullOrEmpty(input.SLOT_BOOKING_NO), u => u.SLOT_BOOKING_NO.Contains(input.SLOT_BOOKING_NO)) + .WhereIF(input.STATUS == 1, u => !u.IS_CANCELLATION) + .WhereIF(input.STATUS == 2, u => u.IS_CANCELLATION) + .WhereIF(!string.IsNullOrEmpty(input.VESSEL), u => u.VESSEL.Contains(input.VESSEL)) + .WhereIF(!string.IsNullOrEmpty(input.VOYNO), u => u.VOYNO.Contains(input.VOYNO)) + .WhereIF(!string.IsNullOrEmpty(input.PORTLOAD), u => u.PORTLOAD.Contains(input.PORTLOAD)) + .WhereIF(!string.IsNullOrEmpty(input.PORTDISCHARGE), u => u.PORTDISCHARGE.Contains(input.PORTDISCHARGE)) + + .WhereIF(input.ETD_START.HasValue, u => u.ETD >= input.ETD_START.Value) + .WhereIF(input.ETD_END.HasValue, u => u.ETD < input.ETD_END.Value.AddDays(1)) + .WhereIF(input.ETA_START.HasValue, u => u.ETA >= input.ETA_START.Value) + .WhereIF(input.ETA_END.HasValue, u => u.ETA < input.ETA_END.Value.AddDays(1)) + .WhereIF(!string.IsNullOrEmpty(input.CreatedUserName), u => u.CreatedUserName.Contains(input.CreatedUserName)) + .WhereIF(!string.IsNullOrEmpty(input.UpdatedUserName), u => u.UpdatedUserName.Contains(input.UpdatedUserName)) + + .WhereIF(!string.IsNullOrEmpty(input.CARRIER), u => u.CARRIER.Contains(input.CARRIER)) + .WhereIF(!string.IsNullOrEmpty(input.CONTRACT_NO), u => u.CONTRACT_NO.Contains(input.CONTRACT_NO)) + .WhereIF(!string.IsNullOrEmpty(input.SI_RLT_STAT), u => u.SI_RLT_STAT == input.SI_RLT_STAT) + .WhereIF(!string.IsNullOrEmpty(input.VGM_RLT_STAT), u => u.VGM_RLT_STAT == input.VGM_RLT_STAT) + .WhereIF(!string.IsNullOrEmpty(input.CARRIAGE_TYPE), u => u.CARRIAGE_TYPE == input.CARRIAGE_TYPE) + .WhereIF(!string.IsNullOrEmpty(input.BOOKING_SLOT_TYPE), u => u.BOOKING_SLOT_TYPE == input.BOOKING_SLOT_TYPE) + + .WhereIF(!string.IsNullOrEmpty(input.LANENAME), u => u.LANENAME.Contains(input.LANENAME)) + .WhereIF(!string.IsNullOrEmpty(input.WEEK_AT), u => u.WEEK_AT == input.WEEK_AT); + + if (ctnCodeArr != null && ctnCodeArr.Length > 0) + { + var tempSelect = select as ISugarQueryable; + tempSelect.Where((u, c) => ctnCodeArr.Contains(c.CTNCODE)); + } + var entities = await select.OrderByDescending(u => u.CreatedTime) + .ToPagedListAsync(input.PageNo, input.PageSize); var result = entities.Adapt>(); diff --git a/Myshipping.Application/Service/BookingSlot/Dto/BookingGenerateDto.cs b/Myshipping.Application/Service/BookingSlot/Dto/BookingGenerateDto.cs index 42580ad8..6dd3f4f1 100644 --- a/Myshipping.Application/Service/BookingSlot/Dto/BookingGenerateDto.cs +++ b/Myshipping.Application/Service/BookingSlot/Dto/BookingGenerateDto.cs @@ -107,5 +107,24 @@ namespace Myshipping.Application /// 客服名称 /// public string CustServiceName { get; set; } + /// + /// 销售日期 + /// + public DateTime? SALE_TIME { get; set; } + + /// + /// 发货人 + /// + public string SHIPPER { get; set; } + + /// + /// 品名 + /// + public string GOODSNAME { get; set; } + + /// + /// 卖价 + /// + public decimal? SELLING_PRICE { get; set; } } } diff --git a/Myshipping.Application/Service/BookingSlot/IBookingSlotService.cs b/Myshipping.Application/Service/BookingSlot/IBookingSlotService.cs index 6495174c..b5278c81 100644 --- a/Myshipping.Application/Service/BookingSlot/IBookingSlotService.cs +++ b/Myshipping.Application/Service/BookingSlot/IBookingSlotService.cs @@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Mvc; using Myshipping.Application.Entity; using Myshipping.Application.Event; using Myshipping.Application.Service.BookingSlot.Dto; +using Myshipping.Core; using System.Collections.Generic; using System.Threading.Tasks; @@ -21,15 +22,21 @@ namespace Myshipping.Application Task ApiReceive(string jsonData, IFormFile file = null, IFormFile modifyFile = null); Task Detail(long id); - Task> GetAvailableSlots(BookingSlotBaseDto input); + /// + /// 查询可用的舱位及箱子 + /// + Task> GetAvailableSlots(BookingSlotBaseDto input, PageWithTotal pageInfo); /// /// 查询可用的舱位及箱子列表 /// /// 筛选条件1:舱位信息、箱型 /// 筛选条件2:舱位主键列表 + /// 筛选条件3:分页 /// 可用的舱位列表(含可用的箱子列表) - Task> GetAvailableSlots(BookingSlotBaseDto slotInput = null, List slotIdListInput = null); + Task> GetAvailableSlots(BookingSlotBaseDto slotInput = null, + List slotIdListInput = null, + PageWithTotal pageInfo = null); /// /// 检查指定订舱记录,是否可以引入舱位列表 @@ -113,7 +120,7 @@ namespace Myshipping.Application /// 租户ID /// 返回回执 - Task SearchBookingSlotWithOrderByNo(string slotBookingNo,long tenantId); + Task SearchBookingSlotWithOrderByNo(string slotBookingNo, long tenantId); /// /// 校验是否可以生成订舱订单 diff --git a/Myshipping.Core/Extension/InputBase.cs b/Myshipping.Core/Extension/InputBase.cs index 4bc90283..8a762797 100644 --- a/Myshipping.Core/Extension/InputBase.cs +++ b/Myshipping.Core/Extension/InputBase.cs @@ -65,7 +65,13 @@ public class PageInputBase public List MultiSort { get; set; } } - +/// +/// 分页参数-含总数 +/// +public class PageWithTotal : PageInputBase +{ + public virtual int Total { get; set; } +} /// /// 查询排序 /// diff --git a/Myshipping.Core/Myshipping.Core.xml b/Myshipping.Core/Myshipping.Core.xml index eb4578c6..87d016ef 100644 --- a/Myshipping.Core/Myshipping.Core.xml +++ b/Myshipping.Core/Myshipping.Core.xml @@ -6156,6 +6156,11 @@ 排序方法,默认降序 + + + 分页参数-含总数 + + 查询排序