diff --git a/WCS.BLL/Services/IService/IMatDetailCurrentInfoService.cs b/WCS.BLL/Services/IService/IMatDetailCurrentInfoService.cs
index 2fb416d..6d2fb04 100644
--- a/WCS.BLL/Services/IService/IMatDetailCurrentInfoService.cs
+++ b/WCS.BLL/Services/IService/IMatDetailCurrentInfoService.cs
@@ -15,6 +15,13 @@ namespace WCS.BLL.Services.IService
///
///
public Task> GetMatDetailCurrentInfos(GetMatDetailCurrentInfosRequest request);
+
+ ///
+ /// 带排序的货架存量列表
+ ///
+ ///
+ ///
+ public Task> GetMatDetailCurrentInfosWithOrder(GetMatDetailCurrentInfosRequest request);
///
/// 导出货架存量数据
///
diff --git a/WCS.BLL/Services/Service/MatDetailCurrentInfoService.cs b/WCS.BLL/Services/Service/MatDetailCurrentInfoService.cs
index f38c2b9..212a3aa 100644
--- a/WCS.BLL/Services/Service/MatDetailCurrentInfoService.cs
+++ b/WCS.BLL/Services/Service/MatDetailCurrentInfoService.cs
@@ -100,6 +100,85 @@ namespace WCS.BLL.Services.Service
}
}
+ ///
+ /// 带排序的货架存量列表(带排序功能)
+ ///
+ ///
+ ///
+ public async Task> GetMatDetailCurrentInfosWithOrder(GetMatDetailCurrentInfosRequest request)
+ {
+ try
+ {
+ var recordsQueryable = DbHelp.db.Queryable()
+ .LeftJoin((mci, si) => mci.ShelfId == si.Id)
+ .LeftJoin((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()
+ {
+ Code = 200,
+ Message = $"success",
+ Data = new PageQueryResponseData()
+ {
+ 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()
+ {
+ Code = 300,
+ Message = $"操作失败:{ex.Message}",
+ };
+ }
+ }
+
public async Task> ExportMatDetailCurrentInfos(GetMatDetailCurrentInfosRequest request)
{
try
diff --git a/WCS.WebApi/Controllers/MatDetailCurrenInfoController.cs b/WCS.WebApi/Controllers/MatDetailCurrenInfoController.cs
index a82c825..6243953 100644
--- a/WCS.WebApi/Controllers/MatDetailCurrenInfoController.cs
+++ b/WCS.WebApi/Controllers/MatDetailCurrenInfoController.cs
@@ -32,6 +32,13 @@ namespace WCS.WebApi.Controllers
return await _matDetailCurrentInfoService.GetMatDetailCurrentInfos(request);
}
+ [Route("GetMatDetailCurrentInfosWithOrder")]
+ [HttpPost(Name = "GetMatDetailCurrentInfosWithOrder")]
+ public async Task GetMatDetailCurrentInfosWithOrder(GetMatDetailCurrentInfosRequest request)
+ {
+ return await _matDetailCurrentInfoService.GetMatDetailCurrentInfosWithOrder(request);
+ }
+
[Route("exportMatDetailCurrentInfos")]
[HttpPost(Name = "exportMatDetailCurrentInfos")]
public async Task ExportMatDetailCurrentInfos(GetMatDetailCurrentInfosRequest request)