From 067131ed327a1ff98e7fb5857920cf6c8b8fdc1f Mon Sep 17 00:00:00 2001 From: zhangxiaofeng <1939543722@qq.com> Date: Thu, 16 May 2024 10:07:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E5=8F=AF=E7=94=A8=E7=9A=84?= =?UTF-8?q?=E8=88=B1=E4=BD=8D=E5=8F=8A=E7=AE=B1=E5=AD=90=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=B8=BA=E5=88=86=E9=A1=B5=E5=BD=A2=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/BookingSlot/BookingSlotService.cs | 30 +++++++++++++++---- .../BookingSlot/Dto/BookingGenerateDto.cs | 19 ++++++++++++ .../BookingSlot/IBookingSlotService.cs | 13 ++++++-- Myshipping.Core/Extension/InputBase.cs | 8 ++++- Myshipping.Core/Myshipping.Core.xml | 5 ++++ 5 files changed, 65 insertions(+), 10 deletions(-) diff --git a/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs b/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs index f846fa95..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,8 +1360,6 @@ namespace Myshipping.Application /// /// 分页查询订舱舱位 /// - /// - /// [HttpPost("/BookingSlot/page")] public async Task Page(BookingSlotBasePageInput input) { 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 @@ 排序方法,默认降序 + + + 分页参数-含总数 + + 查询排序