jianghaiqing 6 months ago
commit 92c1aa9d01

@ -1087,9 +1087,17 @@ namespace Myshipping.Application
/// 查询可用的舱位及箱子 /// 查询可用的舱位及箱子
/// </summary> /// </summary>
[HttpGet("/BookingSlot/getAvailableSlots")] [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> /// <summary>
@ -1097,9 +1105,12 @@ namespace Myshipping.Application
/// </summary> /// </summary>
/// <param name="slotInput">筛选条件1舱位信息、箱型</param> /// <param name="slotInput">筛选条件1舱位信息、箱型</param>
/// <param name="slotIdListInput">筛选条件2舱位主键列表</param> /// <param name="slotIdListInput">筛选条件2舱位主键列表</param>
/// <param name="pageInfo">筛选条件3分页</param>
/// <returns>可用的舱位列表(含可用的箱子列表)</returns> /// <returns>可用的舱位列表(含可用的箱子列表)</returns>
[NonAction] [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(); slotInput ??= new();
slotIdListInput ??= new(); slotIdListInput ??= new();
@ -1113,6 +1124,7 @@ namespace Myshipping.Application
// 1. 【舱位基础表】与【箱子表】做关联并根据【舱位主键】、【箱型】做分组统计出【总的箱量】作为queryable1 // 1. 【舱位基础表】与【箱子表】做关联并根据【舱位主键】、【箱型】做分组统计出【总的箱量】作为queryable1
var queryable1 = _repBase.Context.Queryable<BookingSlotBase, BookingSlotCtn>((bas, ctn) => bas.Id == ctn.SLOT_ID) var queryable1 = _repBase.Context.Queryable<BookingSlotBase, BookingSlotCtn>((bas, ctn) => bas.Id == ctn.SLOT_ID)
.Where(bas => bas.IS_CANCELLATION == false) .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.PORTLOAD), bas => bas.PORTLOAD.Contains(slotInput.PORTLOAD))
.WhereIF(!string.IsNullOrEmpty(slotInput.PORTDISCHARGE), 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)) .WhereIF(!string.IsNullOrEmpty(slotInput.VESSEL), bas => bas.VESSEL.Contains(slotInput.VESSEL))
@ -1161,7 +1173,15 @@ namespace Myshipping.Application
.Where(r => r.numResidue > 0); .Where(r => r.numResidue > 0);
// 4. 执行ToList(),得到可用的【舱位主键】、【箱型】、【箱量】列表 // 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); var baseIdList = canUselist.Select(c => c.id);
@ -1340,12 +1360,26 @@ namespace Myshipping.Application
/// <summary> /// <summary>
/// 分页查询订舱舱位 /// 分页查询订舱舱位
/// </summary> /// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("/BookingSlot/page")] [HttpPost("/BookingSlot/page")]
public async Task<dynamic> Page(BookingSlotBasePageInput input) public async Task<dynamic> Page(BookingSlotBasePageInput input)
{ {
var entities = await _repBase.AsQueryable() if (!string.IsNullOrEmpty(input.WEEK_AT))
{
input.WEEK_AT = "W" + input.WEEK_AT;
}
ISugarQueryable<BookingSlotBase> select = null;
string[] ctnCodeArr = null;
if (!string.IsNullOrEmpty(input.CTN_STAT))
{
ctnCodeArr = input.CTN_STAT.Split(',');
select = _repBase.AsQueryable().InnerJoin<BookingSlotCtn>((u, c) => u.Id == c.SLOT_ID);
}
else
{
select = _repBase.AsQueryable();
}
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(!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 == 1, u => !u.IS_CANCELLATION)
.WhereIF(input.STATUS == 2, u => u.IS_CANCELLATION) .WhereIF(input.STATUS == 2, u => u.IS_CANCELLATION)
@ -1369,9 +1403,14 @@ namespace Myshipping.Application
.WhereIF(!string.IsNullOrEmpty(input.BOOKING_SLOT_TYPE), u => u.BOOKING_SLOT_TYPE == input.BOOKING_SLOT_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.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 == input.WEEK_AT);
.WhereIF(!string.IsNullOrEmpty(input.WEEK_AT), u => u.WEEK_AT.Contains(input.WEEK_AT))
.OrderByDescending(u => u.CreatedTime) if (ctnCodeArr != null && ctnCodeArr.Length > 0)
{
var tempSelect = select as ISugarQueryable<BookingSlotBase, BookingSlotCtn>;
tempSelect.Where((u, c) => ctnCodeArr.Contains(c.CTNCODE));
}
var entities = await select.OrderByDescending(u => u.CreatedTime)
.ToPagedListAsync(input.PageNo, input.PageSize); .ToPagedListAsync(input.PageNo, input.PageSize);
var result = entities.Adapt<SqlSugarPagedList<BookingSlotBaseListOutput>>(); var result = entities.Adapt<SqlSugarPagedList<BookingSlotBaseListOutput>>();

@ -107,5 +107,24 @@ namespace Myshipping.Application
/// 客服名称 /// 客服名称
/// </summary> /// </summary>
public string CustServiceName { get; set; } 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.Entity;
using Myshipping.Application.Event; using Myshipping.Application.Event;
using Myshipping.Application.Service.BookingSlot.Dto; using Myshipping.Application.Service.BookingSlot.Dto;
using Myshipping.Core;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -21,15 +22,21 @@ namespace Myshipping.Application
Task<TaskManageOrderResultDto> ApiReceive(string jsonData, IFormFile file = null, IFormFile modifyFile = null); Task<TaskManageOrderResultDto> ApiReceive(string jsonData, IFormFile file = null, IFormFile modifyFile = null);
Task<BookingSlotBaseSaveOutput> Detail(long id); Task<BookingSlotBaseSaveOutput> Detail(long id);
Task<List<BookingSlotBaseWithCtnDto>> GetAvailableSlots(BookingSlotBaseDto input); /// <summary>
/// 查询可用的舱位及箱子
/// </summary>
Task<SqlSugarPagedList<BookingSlotBaseWithCtnDto>> GetAvailableSlots(BookingSlotBaseDto input, PageWithTotal pageInfo);
/// <summary> /// <summary>
/// 查询可用的舱位及箱子列表 /// 查询可用的舱位及箱子列表
/// </summary> /// </summary>
/// <param name="slotInput">筛选条件1舱位信息、箱型</param> /// <param name="slotInput">筛选条件1舱位信息、箱型</param>
/// <param name="slotIdListInput">筛选条件2舱位主键列表</param> /// <param name="slotIdListInput">筛选条件2舱位主键列表</param>
/// <param name="pageInfo">筛选条件3分页</param>
/// <returns>可用的舱位列表(含可用的箱子列表)</returns> /// <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> /// <summary>
/// 检查指定订舱记录,是否可以引入舱位列表 /// 检查指定订舱记录,是否可以引入舱位列表

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

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

Loading…
Cancel
Save