导出接口

This commit is contained in:
tongfei
2023-11-15 15:02:19 +08:00
parent 9840fb93fb
commit 2cbc496e1f
17 changed files with 327 additions and 64 deletions

View File

@@ -19,7 +19,7 @@ namespace WMS.Web.Repositories
/// <summary>
/// 库存相关-仓储
/// </summary>
public class InventoryDetailsRepositories: IInventoryDetailsRepositories
public class InventoryDetailsRepositories: IAllFielRepositories<InventoryDetailsQueryRequest>, IInventoryDetailsRepositories
{
private readonly IMapper _mapper;
private readonly IServiceProvider _serviceProvider;
@@ -51,12 +51,12 @@ namespace WMS.Web.Repositories
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
public async Task<ResultPagedList<InventoryDetailsQueryResponse>> GetPagedList(InventoryDetailsQueryRequest dto)
public async Task<(List<InventoryDetailsQueryResponse> list,int total)> GetPagedList(InventoryDetailsQueryRequest dto)
{
//1.获取物料集合和组织集合
var materials_result = await _erpService.BillQueryForMaterial();
if (!materials_result.IsSuccess)
return ResultPagedList<InventoryDetailsQueryResponse>.ReFailure(materials_result);
return (new List<InventoryDetailsQueryResponse>(), 0);
var materials = materials_result.Data.ToList();
//物料集合;模糊查询后的物料集合
@@ -80,9 +80,8 @@ namespace WMS.Web.Repositories
if (dto.Qty.HasValue)
query = query.Where(w => w.Qty == dto.Qty);
var response = new ResultPagedList<InventoryDetailsQueryResponse>();
int total = await query.CountAsync();
response.TotalCount = total;
int total = await query.CountAsync();
var list = await query.Select(s => new InventoryDetailsQueryResponse()
{
@@ -96,8 +95,7 @@ namespace WMS.Web.Repositories
Unit = _erpBasicDataExtendService.GetMaterialUnitName(materials, s.MaterialId),
}).OrderByDescending(x => x.Id).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync();
response.Data = list;
return response;
return (list,total);
}
/// <summary>
@@ -159,5 +157,16 @@ namespace WMS.Web.Repositories
return true;
}
}
/// <summary>
/// 导出
/// </summary>
/// <param name="dto"></param>
/// <param name="companyId"></param>
/// <returns></returns>
public async Task<(object obj, int total)> GetListField(InventoryDetailsQueryRequest dto, int companyId)
{
return await GetPagedList(dto);
}
}
}