后端:增加带排序的货架存量查询接口
This commit is contained in:
@ -15,6 +15,13 @@ namespace WCS.BLL.Services.IService
|
|||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<PageQueryResponse<MatDetailCurrentInfoModel>> GetMatDetailCurrentInfos(GetMatDetailCurrentInfosRequest request);
|
public Task<PageQueryResponse<MatDetailCurrentInfoModel>> GetMatDetailCurrentInfos(GetMatDetailCurrentInfosRequest request);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 带排序的货架存量列表
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public Task<PageQueryResponse<MatDetailCurrentInfoModel>> GetMatDetailCurrentInfosWithOrder(GetMatDetailCurrentInfosRequest request);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 导出货架存量数据
|
/// 导出货架存量数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -100,6 +100,85 @@ namespace WCS.BLL.Services.Service
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 带排序的货架存量列表(带排序功能)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<PageQueryResponse<MatDetailCurrentInfoModel>> GetMatDetailCurrentInfosWithOrder(GetMatDetailCurrentInfosRequest request)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var recordsQueryable = DbHelp.db.Queryable<MatDetailCurrentInfo>()
|
||||||
|
.LeftJoin<ShelfInfo>((mci, si) => mci.ShelfId == si.Id)
|
||||||
|
.LeftJoin<LocationInfo>((mci, si, li) => (si.TransStatus == TransStatusEnum.静止 && si.CurrentLocationId == li.Id)
|
||||||
|
|| (si.TransStatus == TransStatusEnum.运输中 && si.DestinationLocationId == li.Id))
|
||||||
|
.WhereIF(request.LocationAreaId != null && request.LocationAreaId != 0, (mci, si, li) => li.LocationAreaId == request.LocationAreaId)
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(request.LocationCode), (mci, si, li) => li.LocationCode.Contains(request.LocationCode))
|
||||||
|
.WhereIF(request.ShelfTypeId != null && request.ShelfTypeId != 0, (mci, si, li) => si.ShelfTypeId == request.ShelfTypeId)
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(request.ShelfCode), (mci, si, li) => si.ShelfCode.Contains(request.ShelfCode))
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(request.MatCode), (mci, si, li) => mci.MatCode.Contains(request.MatCode))
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(request.MatName), (mci, si, li) => mci.MatName.Contains(request.MatName))
|
||||||
|
.OrderBy((mci, si, li) => si.ShelfCode)
|
||||||
|
.OrderBy((mci, si, li) => mci.MatCode)
|
||||||
|
.Select((mci, si, li) => new MatDetailCurrentInfoModel()
|
||||||
|
{
|
||||||
|
Id = mci.Id,
|
||||||
|
ShelfId = mci.ShelfId,
|
||||||
|
ShelfCode = mci.ShelfCode,
|
||||||
|
ShelfType = mci.ShelfType,
|
||||||
|
|
||||||
|
LocationArea = li.LocationArea,
|
||||||
|
LocationCode = li.LocationCode,
|
||||||
|
|
||||||
|
MatCode = mci.MatCode,
|
||||||
|
MatName = mci.MatName,
|
||||||
|
MatBatch = mci.MatBatch,
|
||||||
|
MatSpec = mci.MatSpec,
|
||||||
|
MatUnit = mci.MatUnit,
|
||||||
|
MatCustomer = mci.MatCustomer,
|
||||||
|
MatQty = mci.MatQty,
|
||||||
|
MatSupplier = mci.MatSupplier,
|
||||||
|
|
||||||
|
StationCode = mci.StationCode,
|
||||||
|
ModifyUser = mci.ModifyUser,
|
||||||
|
ModifyTime = mci.ModifyTime
|
||||||
|
});
|
||||||
|
|
||||||
|
//分页
|
||||||
|
var totalCount = await recordsQueryable.CountAsync();
|
||||||
|
var records = await recordsQueryable
|
||||||
|
//.OrderByDescending(mci => mci.Id)
|
||||||
|
.Skip((request.PageNumber - 1) * request.PageSize).Take(request.PageSize)
|
||||||
|
.ToListAsync();
|
||||||
|
//生成序号
|
||||||
|
for (int i = 0; i < records.Count; i++)
|
||||||
|
{
|
||||||
|
records[i].RowNumber = (request.PageNumber - 1) * request.PageSize + i + 1;
|
||||||
|
}
|
||||||
|
return new PageQueryResponse<MatDetailCurrentInfoModel>()
|
||||||
|
{
|
||||||
|
Code = 200,
|
||||||
|
Message = $"success",
|
||||||
|
Data = new PageQueryResponseData<MatDetailCurrentInfoModel>()
|
||||||
|
{
|
||||||
|
TotalCount = totalCount,
|
||||||
|
MaxPage = request.PageSize == 0 ? 0 : (int)Math.Ceiling((decimal)totalCount / request.PageSize),
|
||||||
|
Count = records.Count,
|
||||||
|
Lists = records.ToList()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return new PageQueryResponse<MatDetailCurrentInfoModel>()
|
||||||
|
{
|
||||||
|
Code = 300,
|
||||||
|
Message = $"操作失败:{ex.Message}",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<PageQueryResponse<MatDetailCurrentInfoModel>> ExportMatDetailCurrentInfos(GetMatDetailCurrentInfosRequest request)
|
public async Task<PageQueryResponse<MatDetailCurrentInfoModel>> ExportMatDetailCurrentInfos(GetMatDetailCurrentInfosRequest request)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -32,6 +32,13 @@ namespace WCS.WebApi.Controllers
|
|||||||
return await _matDetailCurrentInfoService.GetMatDetailCurrentInfos(request);
|
return await _matDetailCurrentInfoService.GetMatDetailCurrentInfos(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Route("GetMatDetailCurrentInfosWithOrder")]
|
||||||
|
[HttpPost(Name = "GetMatDetailCurrentInfosWithOrder")]
|
||||||
|
public async Task<ResponseBase> GetMatDetailCurrentInfosWithOrder(GetMatDetailCurrentInfosRequest request)
|
||||||
|
{
|
||||||
|
return await _matDetailCurrentInfoService.GetMatDetailCurrentInfosWithOrder(request);
|
||||||
|
}
|
||||||
|
|
||||||
[Route("exportMatDetailCurrentInfos")]
|
[Route("exportMatDetailCurrentInfos")]
|
||||||
[HttpPost(Name = "exportMatDetailCurrentInfos")]
|
[HttpPost(Name = "exportMatDetailCurrentInfos")]
|
||||||
public async Task<IActionResult> ExportMatDetailCurrentInfos(GetMatDetailCurrentInfosRequest request)
|
public async Task<IActionResult> ExportMatDetailCurrentInfos(GetMatDetailCurrentInfosRequest request)
|
||||||
|
Reference in New Issue
Block a user