|
|
@ -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,39 +1360,58 @@ 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))
|
|
|
|
.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)
|
|
|
|
input.WEEK_AT = "W" + input.WEEK_AT;
|
|
|
|
.WhereIF(input.STATUS == 2, u => u.IS_CANCELLATION)
|
|
|
|
}
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.VESSEL), u => u.VESSEL.Contains(input.VESSEL))
|
|
|
|
ISugarQueryable<BookingSlotBase> select = null;
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.VOYNO), u => u.VOYNO.Contains(input.VOYNO))
|
|
|
|
string[] ctnCodeArr = null;
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.PORTLOAD), u => u.PORTLOAD.Contains(input.PORTLOAD))
|
|
|
|
if (!string.IsNullOrEmpty(input.CTN_STAT))
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.PORTDISCHARGE), u => u.PORTDISCHARGE.Contains(input.PORTDISCHARGE))
|
|
|
|
{
|
|
|
|
|
|
|
|
ctnCodeArr = input.CTN_STAT.Split(',');
|
|
|
|
.WhereIF(input.ETD_START.HasValue, u => u.ETD >= input.ETD_START.Value)
|
|
|
|
select = _repBase.AsQueryable().InnerJoin<BookingSlotCtn>((u, c) => u.Id == c.SLOT_ID);
|
|
|
|
.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)
|
|
|
|
else
|
|
|
|
.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))
|
|
|
|
select = _repBase.AsQueryable();
|
|
|
|
.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))
|
|
|
|
select = select.WhereIF(!string.IsNullOrEmpty(input.SLOT_BOOKING_NO), u => u.SLOT_BOOKING_NO.Contains(input.SLOT_BOOKING_NO))
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.CTN_STAT), u => u.CTN_STAT.Contains(input.CTN_STAT))
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.SLOT_BOOKING_NO), u => u.SLOT_BOOKING_NO.Contains(input.SLOT_BOOKING_NO))
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.WEEK_AT), u => u.WEEK_AT.Contains(input.WEEK_AT))
|
|
|
|
.WhereIF(input.STATUS == 1, u => !u.IS_CANCELLATION)
|
|
|
|
.OrderByDescending(u => u.CreatedTime)
|
|
|
|
.WhereIF(input.STATUS == 2, u => u.IS_CANCELLATION)
|
|
|
|
.ToPagedListAsync(input.PageNo, input.PageSize);
|
|
|
|
.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<BookingSlotBase, BookingSlotCtn>;
|
|
|
|
|
|
|
|
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<SqlSugarPagedList<BookingSlotBaseListOutput>>();
|
|
|
|
var result = entities.Adapt<SqlSugarPagedList<BookingSlotBaseListOutput>>();
|
|
|
|
|
|
|
|
|
|
|
|