查询可用的舱位及箱子接口调整为分页形式

master
zhangxiaofeng 6 months ago
parent f9bbf203d9
commit 067131ed32

@ -1087,9 +1087,17 @@ namespace Myshipping.Application
/// 查询可用的舱位及箱子
/// </summary>
[HttpGet("/BookingSlot/getAvailableSlots")]
public async Task<List<BookingSlotBaseWithCtnDto>> GetAvailableSlots([FromQuery] BookingSlotBaseDto input)
public async Task<SqlSugarPagedList<BookingSlotBaseWithCtnDto>> GetAvailableSlots([FromQuery] BookingSlotBaseDto input, [FromQuery] PageWithTotal pageInfo)
{
return await GetAvailableSlots(input, null);
var result = await GetAvailableSlots(input, null, pageInfo);
SqlSugarPagedList<BookingSlotBaseWithCtnDto> pageResult = new()
{
PageIndex = pageInfo.PageNo,
PageSize = pageInfo.PageSize,
TotalCount = pageInfo.Total,
Items = result,
};
return pageResult;
}
/// <summary>
@ -1097,9 +1105,12 @@ namespace Myshipping.Application
/// </summary>
/// <param name="slotInput">筛选条件1舱位信息、箱型</param>
/// <param name="slotIdListInput">筛选条件2舱位主键列表</param>
/// <param name="pageInfo">筛选条件3分页</param>
/// <returns>可用的舱位列表(含可用的箱子列表)</returns>
[NonAction]
public async Task<List<BookingSlotBaseWithCtnDto>> GetAvailableSlots(BookingSlotBaseDto slotInput = null, List<long> slotIdListInput = null)
public async Task<List<BookingSlotBaseWithCtnDto>> GetAvailableSlots(BookingSlotBaseDto slotInput = null,
List<long> slotIdListInput = null,
PageWithTotal pageInfo = null)
{
slotInput ??= new();
slotIdListInput ??= new();
@ -1113,6 +1124,7 @@ namespace Myshipping.Application
// 1. 【舱位基础表】与【箱子表】做关联并根据【舱位主键】、【箱型】做分组统计出【总的箱量】作为queryable1
var queryable1 = _repBase.Context.Queryable<BookingSlotBase, BookingSlotCtn>((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<int> 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
/// <summary>
/// 分页查询订舱舱位
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("/BookingSlot/page")]
public async Task<dynamic> Page(BookingSlotBasePageInput input)
{

@ -107,5 +107,24 @@ namespace Myshipping.Application
/// 客服名称
/// </summary>
public string CustServiceName { get; set; }
/// <summary>
/// 销售日期
/// </summary>
public DateTime? SALE_TIME { get; set; }
/// <summary>
/// 发货人
/// </summary>
public string SHIPPER { get; set; }
/// <summary>
/// 品名
/// </summary>
public string GOODSNAME { get; set; }
/// <summary>
/// 卖价
/// </summary>
public decimal? SELLING_PRICE { get; set; }
}
}

@ -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<TaskManageOrderResultDto> ApiReceive(string jsonData, IFormFile file = null, IFormFile modifyFile = null);
Task<BookingSlotBaseSaveOutput> Detail(long id);
Task<List<BookingSlotBaseWithCtnDto>> GetAvailableSlots(BookingSlotBaseDto input);
/// <summary>
/// 查询可用的舱位及箱子
/// </summary>
Task<SqlSugarPagedList<BookingSlotBaseWithCtnDto>> GetAvailableSlots(BookingSlotBaseDto input, PageWithTotal pageInfo);
/// <summary>
/// 查询可用的舱位及箱子列表
/// </summary>
/// <param name="slotInput">筛选条件1舱位信息、箱型</param>
/// <param name="slotIdListInput">筛选条件2舱位主键列表</param>
/// <param name="pageInfo">筛选条件3分页</param>
/// <returns>可用的舱位列表(含可用的箱子列表)</returns>
Task<List<BookingSlotBaseWithCtnDto>> GetAvailableSlots(BookingSlotBaseDto slotInput = null, List<long> slotIdListInput = null);
Task<List<BookingSlotBaseWithCtnDto>> GetAvailableSlots(BookingSlotBaseDto slotInput = null,
List<long> slotIdListInput = null,
PageWithTotal pageInfo = null);
/// <summary>
/// 检查指定订舱记录,是否可以引入舱位列表
@ -113,7 +120,7 @@ namespace Myshipping.Application
/// <param name="tenantId">租户ID</param>
/// <returns>返回回执</returns>
Task<BookingSlotWithOrderDto> SearchBookingSlotWithOrderByNo(string slotBookingNo,long tenantId);
Task<BookingSlotWithOrderDto> SearchBookingSlotWithOrderByNo(string slotBookingNo, long tenantId);
/// <summary>
/// 校验是否可以生成订舱订单

@ -65,7 +65,13 @@ public class PageInputBase
public List<QuerySortModel> MultiSort { get; set; }
}
/// <summary>
/// 分页参数-含总数
/// </summary>
public class PageWithTotal : PageInputBase
{
public virtual int Total { get; set; }
}
/// <summary>
/// 查询排序
/// </summary>

@ -6156,6 +6156,11 @@
排序方法,默认降序
</summary>
</member>
<member name="T:Myshipping.Core.PageWithTotal">
<summary>
分页参数-含总数
</summary>
</member>
<member name="T:Myshipping.Core.QuerySortModel">
<summary>
查询排序

Loading…
Cancel
Save