导出接口

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

@@ -1,16 +1,20 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using WMS.Web.Core;
using WMS.Web.Core.Dto;
using WMS.Web.Core.Dto.InStock;
using WMS.Web.Core.Dto.InStockTask;
using WMS.Web.Core.Help;
using WMS.Web.Core.Internal.Results;
using WMS.Web.Domain.Infrastructure;
using WMS.Web.Domain.IService;
using WMS.Web.Domain.IService.Public;
using WMS.Web.Domain.Options;
using WMS.Web.Domain.Values;
namespace WMS.Web.Api.Controllers
@@ -22,13 +26,21 @@ namespace WMS.Web.Api.Controllers
[ApiController]
public class InStockController : ControllerBase
{
private readonly QiniuOptions _option;
private readonly ILoginService _loginService;
private readonly IInStockService _inStockService;
private readonly IInStockRepositories _inStockRepositories;
public InStockController(ILoginService loginService, IInStockRepositories inStockRepositories, IInStockService inStockService)
private readonly IExportExcelService _exportExcelService;
public InStockController(IOptions<QiniuOptions> option,
ILoginService loginService,
IInStockRepositories inStockRepositories,
IInStockService inStockService,
IExportExcelService exportExcelService)
{
_option = option?.Value;
this._loginService = loginService;
this._inStockService = inStockService;
this._exportExcelService = exportExcelService;
this._inStockRepositories = inStockRepositories;
}
@@ -44,8 +56,31 @@ namespace WMS.Web.Api.Controllers
var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
if (loginInfo == null || loginInfo.UserInfo == null)
return ResultPagedList<InStockQueryResponse>.ReFailure(ResultCodes.Token_Invalid_Error);
var result= await _inStockRepositories.GetPagedList(dto);
return result;
var (list, count) = await _inStockRepositories.GetPagedList(dto);
return ResultPagedList<InStockQueryResponse>.ReSuccess(list, count);
}
/// <summary>
/// 导出
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost]
[Route("Export")]
public Task<Result<string>> Export([FromBody] InStockQueryRequest dto)
{
var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
if (loginInfo == null)
return Task.FromResult(Result<string>.ReFailure(ResultCodes.Token_Invalid_Error));
string fileName = FileDownLoadOrderType.InStock.GetRemark() + loginInfo.UserInfo.CompanyId + DateTime.Now.DateTimeToLongTimeStamp() + ".xlsx";
string res = _option.Url + fileName;
Task.Run(async () =>
{
await _exportExcelService.ExportList<InStockQueryResponse, InStockQueryRequest>(dto, fileName, loginInfo.UserInfo.StaffId, loginInfo.UserInfo.CompanyId, FileDownLoadOrderType.OutStock);
});
return Task.FromResult(Result<string>.ReSuccess(res));
}
/// <summary>

View File

@@ -1,15 +1,19 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using WMS.Web.Core;
using WMS.Web.Core.Dto;
using WMS.Web.Core.Dto.InStockTask;
using WMS.Web.Core.Help;
using WMS.Web.Core.Internal.Results;
using WMS.Web.Domain.Infrastructure;
using WMS.Web.Domain.IService;
using WMS.Web.Domain.IService.Public;
using WMS.Web.Domain.Options;
using WMS.Web.Domain.Values;
namespace WMS.Web.Api.Controllers
@@ -21,15 +25,22 @@ namespace WMS.Web.Api.Controllers
[ApiController]
public class InStockTaskController : ControllerBase
{
private readonly QiniuOptions _option;
private readonly IExportExcelService _exportExcelService;
private readonly ILoginService _loginService;
private readonly IInStockService _inStockService;
private readonly IInStockTaskService _inStockTaskService;
private readonly IInStockTaskRepositories _inStockTaskRepositories;
public InStockTaskController(ILoginService loginService,
public InStockTaskController(
IOptions<QiniuOptions> option,
IExportExcelService exportExcelService,
ILoginService loginService,
IInStockTaskService inStockTaskService,
IInStockTaskRepositories inStockTaskRepositories,
IInStockService inStockService)
{
this._option = option?.Value;
this._exportExcelService = exportExcelService;
this._loginService = loginService;
this._inStockService = inStockService;
this._inStockTaskService = inStockTaskService;
@@ -48,10 +59,34 @@ namespace WMS.Web.Api.Controllers
var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
if (loginInfo == null || loginInfo.UserInfo == null)
return ResultPagedList<InStockTaskQueryResponse>.ReFailure(ResultCodes.Token_Invalid_Error);
var result = await _inStockTaskRepositories.GetPagedList(dto);
return result;
var (list,total) = await _inStockTaskRepositories.GetPagedList(dto);
return ResultPagedList<InStockTaskQueryResponse>.ReSuccess(list, total);
}
/// <summary>
/// 导出
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost]
[Route("Export")]
public Task<Result<string>> Export([FromBody] InStockTaskQueryRequest dto)
{
var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
if (loginInfo == null)
return Task.FromResult(Result<string>.ReFailure(ResultCodes.Token_Invalid_Error));
string fileName = FileDownLoadOrderType.InStockTask.GetRemark() + loginInfo.UserInfo.CompanyId + DateTime.Now.DateTimeToLongTimeStamp() + ".xlsx";
string res = _option.Url + fileName;
Task.Run(async () =>
{
await _exportExcelService.ExportList<InStockTaskQueryResponse, InStockTaskQueryRequest>(dto, fileName, loginInfo.UserInfo.StaffId, loginInfo.UserInfo.CompanyId, FileDownLoadOrderType.OutStock);
});
return Task.FromResult(Result<string>.ReSuccess(res));
}
/// <summary>
/// 刷新
/// </summary>

View File

@@ -1,13 +1,18 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using WMS.Web.Core;
using WMS.Web.Core.Dto.Inventory;
using WMS.Web.Core.Help;
using WMS.Web.Core.Internal.Results;
using WMS.Web.Domain.Infrastructure;
using WMS.Web.Domain.IService;
using WMS.Web.Domain.IService.Public;
using WMS.Web.Domain.Options;
using WMS.Web.Domain.Values;
namespace WMS.Web.Api.Controllers
@@ -19,16 +24,22 @@ namespace WMS.Web.Api.Controllers
[ApiController]
public class InventoryController : ControllerBase
{
private readonly QiniuOptions _option;
private readonly IExportExcelService _exportExcelService;
private readonly ILoginService _loginService;
private readonly IInventoryDetailsRepositories _inventoryDetailsRepositories;
private readonly IInventoryInOutDetailsRepositories _inventoryInOutDetailsRepositories;
private readonly IBoxInventoryRepositories _boxInventoryRepositories;
public InventoryController(ILoginService loginService,
IOptions<QiniuOptions> option,
IExportExcelService exportExcelService,
IInventoryDetailsRepositories inventoryDetailsRepositories,
IInventoryInOutDetailsRepositories inventoryInOutDetailsRepositories,
IBoxInventoryRepositories boxInventoryRepositories)
{
_option = option?.Value;
this._exportExcelService = exportExcelService;
this._loginService = loginService;
this._inventoryDetailsRepositories = inventoryDetailsRepositories;
this._inventoryInOutDetailsRepositories = inventoryInOutDetailsRepositories;
@@ -47,8 +58,31 @@ namespace WMS.Web.Api.Controllers
var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
if (loginInfo == null || loginInfo.UserInfo == null)
return ResultPagedList<InventoryDetailsQueryResponse>.ReFailure(ResultCodes.Token_Invalid_Error);
var result = await _inventoryDetailsRepositories.GetPagedList(dto);
return result;
var (list, count) = await _inventoryDetailsRepositories.GetPagedList(dto);
return ResultPagedList<InventoryDetailsQueryResponse>.ReSuccess(list, count);
}
/// <summary>
/// 导出-即时库存明细
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost]
[Route("ExportInventory")]
public Task<Result<string>> ExportInventory([FromBody] InventoryDetailsQueryRequest dto)
{
var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
if (loginInfo == null)
return Task.FromResult(Result<string>.ReFailure(ResultCodes.Token_Invalid_Error));
string fileName = FileDownLoadOrderType.InventoryDetails.GetRemark() + loginInfo.UserInfo.CompanyId + DateTime.Now.DateTimeToLongTimeStamp() + ".xlsx";
string res = _option.Url + fileName;
Task.Run(async () =>
{
await _exportExcelService.ExportList<InventoryDetailsQueryResponse, InventoryDetailsQueryRequest>(dto, fileName, loginInfo.UserInfo.StaffId, loginInfo.UserInfo.CompanyId, FileDownLoadOrderType.OutStock);
});
return Task.FromResult(Result<string>.ReSuccess(res));
}
/// <summary>
@@ -63,8 +97,31 @@ namespace WMS.Web.Api.Controllers
var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
if (loginInfo == null || loginInfo.UserInfo == null)
return ResultPagedList<InventoryInOutDetailsQueryResponse>.ReFailure(ResultCodes.Token_Invalid_Error);
var result = await _inventoryInOutDetailsRepositories.GetPagedList(dto);
return result;
var (list, count) = await _inventoryInOutDetailsRepositories.GetPagedList(dto);
return ResultPagedList<InventoryInOutDetailsQueryResponse>.ReSuccess(list, count);
}
/// <summary>
/// 导出-物料收发明细
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost]
[Route("ExportInOrOut")]
public Task<Result<string>> ExportInOrOut([FromBody] InventoryInOutDetailsQueryRequest dto)
{
var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
if (loginInfo == null)
return Task.FromResult(Result<string>.ReFailure(ResultCodes.Token_Invalid_Error));
string fileName = FileDownLoadOrderType.InOrOutInventoryDetails.GetRemark() + loginInfo.UserInfo.CompanyId + DateTime.Now.DateTimeToLongTimeStamp() + ".xlsx";
string res = _option.Url + fileName;
Task.Run(async () =>
{
await _exportExcelService.ExportList<InventoryInOutDetailsQueryResponse, InventoryInOutDetailsQueryRequest>(dto, fileName, loginInfo.UserInfo.StaffId, loginInfo.UserInfo.CompanyId, FileDownLoadOrderType.OutStock);
});
return Task.FromResult(Result<string>.ReSuccess(res));
}
/// <summary>
@@ -79,10 +136,34 @@ namespace WMS.Web.Api.Controllers
var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
if (loginInfo == null || loginInfo.UserInfo == null)
return ResultPagedList<BoxInventoryQueryResponse>.ReFailure(ResultCodes.Token_Invalid_Error);
var result = await _boxInventoryRepositories.GetPagedList(dto);
return result;
var (list, count) = await _boxInventoryRepositories.GetPagedList(dto);
return ResultPagedList<BoxInventoryQueryResponse>.ReSuccess(list, count);
}
/// <summary>
/// 导出-箱库存明细
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost]
[Route("ExportBox")]
public Task<Result<string>> ExportBox([FromBody] BoxInventoryQueryRequest dto)
{
var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
if (loginInfo == null)
return Task.FromResult(Result<string>.ReFailure(ResultCodes.Token_Invalid_Error));
string fileName = FileDownLoadOrderType.BoxInventoryDetails.GetRemark() + loginInfo.UserInfo.CompanyId + DateTime.Now.DateTimeToLongTimeStamp() + ".xlsx";
string res = _option.Url + fileName;
Task.Run(async () =>
{
await _exportExcelService.ExportList<BoxInventoryQueryResponse, BoxInventoryQueryRequest>(dto, fileName, loginInfo.UserInfo.StaffId, loginInfo.UserInfo.CompanyId, FileDownLoadOrderType.OutStock);
});
return Task.FromResult(Result<string>.ReSuccess(res));
}
/// <summary>
/// 获取箱库存明细-根据箱号-pad
/// </summary>

View File

@@ -86,6 +86,13 @@
<param name="dto"></param>
<returns></returns>
</member>
<member name="M:WMS.Web.Api.Controllers.InStockController.Export(WMS.Web.Core.Dto.InStockQueryRequest)">
<summary>
导出
</summary>
<param name="dto"></param>
<returns></returns>
</member>
<member name="M:WMS.Web.Api.Controllers.InStockController.Shelf(WMS.Web.Core.Dto.InStock.PurchaseShelfRequest)">
<summary>
上架-采购订单
@@ -126,6 +133,13 @@
<param name="dto"></param>
<returns></returns>
</member>
<member name="M:WMS.Web.Api.Controllers.InStockTaskController.Export(WMS.Web.Core.Dto.InStockTaskQueryRequest)">
<summary>
导出
</summary>
<param name="dto"></param>
<returns></returns>
</member>
<member name="M:WMS.Web.Api.Controllers.InStockTaskController.Refresh(WMS.Web.Core.Dto.OperateRequest)">
<summary>
刷新
@@ -187,6 +201,13 @@
<param name="dto"></param>
<returns></returns>
</member>
<member name="M:WMS.Web.Api.Controllers.InventoryController.ExportInventory(WMS.Web.Core.Dto.Inventory.InventoryDetailsQueryRequest)">
<summary>
导出-即时库存明细
</summary>
<param name="dto"></param>
<returns></returns>
</member>
<member name="M:WMS.Web.Api.Controllers.InventoryController.GetPagedListInOut(WMS.Web.Core.Dto.Inventory.InventoryInOutDetailsQueryRequest)">
<summary>
列表-物料收发明细
@@ -194,6 +215,13 @@
<param name="dto"></param>
<returns></returns>
</member>
<member name="M:WMS.Web.Api.Controllers.InventoryController.ExportInOrOut(WMS.Web.Core.Dto.Inventory.InventoryInOutDetailsQueryRequest)">
<summary>
导出-物料收发明细
</summary>
<param name="dto"></param>
<returns></returns>
</member>
<member name="M:WMS.Web.Api.Controllers.InventoryController.GetPagedListBox(WMS.Web.Core.Dto.Inventory.BoxInventoryQueryRequest)">
<summary>
列表-箱库存明细
@@ -201,6 +229,13 @@
<param name="dto"></param>
<returns></returns>
</member>
<member name="M:WMS.Web.Api.Controllers.InventoryController.ExportBox(WMS.Web.Core.Dto.Inventory.BoxInventoryQueryRequest)">
<summary>
导出-箱库存明细
</summary>
<param name="dto"></param>
<returns></returns>
</member>
<member name="M:WMS.Web.Api.Controllers.InventoryController.GetBoxInventoryDetails(System.String)">
<summary>
获取箱库存明细-根据箱号-pad

View File

@@ -4110,6 +4110,21 @@
盘点
</summary>
</member>
<member name="F:WMS.Web.Domain.Values.FileDownLoadOrderType.InventoryDetails">
<summary>
即时库存明细
</summary>
</member>
<member name="F:WMS.Web.Domain.Values.FileDownLoadOrderType.InOrOutInventoryDetails">
<summary>
物料收发明细
</summary>
</member>
<member name="F:WMS.Web.Domain.Values.FileDownLoadOrderType.BoxInventoryDetails">
<summary>
箱库存明细
</summary>
</member>
<member name="T:WMS.Web.Domain.Values.InstockStatus">
<summary>
入库状态

View File

@@ -18,7 +18,7 @@ namespace WMS.Web.Domain.Infrastructure
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
Task<ResultPagedList<BoxInventoryQueryResponse>> GetPagedList(BoxInventoryQueryRequest dto);
Task<(List<BoxInventoryQueryResponse> list,int total)> GetPagedList(BoxInventoryQueryRequest dto);
/// <summary>
/// 明细集合-根据箱号

View File

@@ -18,7 +18,7 @@ namespace WMS.Web.Domain.Infrastructure
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
Task<ResultPagedList<InStockQueryResponse>> GetPagedList(InStockQueryRequest dto);
Task<(List<InStockQueryResponse> list,int total)> GetPagedList(InStockQueryRequest dto);
/// <summary>
/// 添加

View File

@@ -20,7 +20,7 @@ namespace WMS.Web.Domain.Infrastructure
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
Task<ResultPagedList<InStockTaskQueryResponse>> GetPagedList(InStockTaskQueryRequest dto);
Task<(List<InStockTaskQueryResponse> list, int total)> GetPagedList(InStockTaskQueryRequest dto);
/// <summary>
/// 详情

View File

@@ -18,7 +18,7 @@ namespace WMS.Web.Domain.Infrastructure
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
Task<ResultPagedList<InventoryDetailsQueryResponse>> GetPagedList(InventoryDetailsQueryRequest dto);
Task<(List<InventoryDetailsQueryResponse> list,int total)> GetPagedList(InventoryDetailsQueryRequest dto);
/// <summary>
/// 批量添加

View File

@@ -18,7 +18,7 @@ namespace WMS.Web.Domain.Infrastructure
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
Task<ResultPagedList<InventoryInOutDetailsQueryResponse>> GetPagedList(InventoryInOutDetailsQueryRequest dto);
Task<(List<InventoryInOutDetailsQueryResponse> list,int total)> GetPagedList(InventoryInOutDetailsQueryRequest dto);
/// <summary>
/// 批量添加

View File

@@ -45,5 +45,20 @@ namespace WMS.Web.Domain.Values
/// </summary>
[EnumRemark("盘点单")]
TakeStock = 7,
/// <summary>
/// 即时库存明细
/// </summary>
[EnumRemark("即时库存明细")]
InventoryDetails = 8,
/// <summary>
/// 物料收发明细
/// </summary>
[EnumRemark("物料收发明细")]
InOrOutInventoryDetails = 9,
/// <summary>
/// 箱库存明细
/// </summary>
[EnumRemark("箱库存明细")]
BoxInventoryDetails = 10,
}
}

View File

@@ -19,7 +19,7 @@ namespace WMS.Web.Repositories
/// <summary>
/// 箱库存-仓储
/// </summary>
public class BoxInventoryRepositories: IBoxInventoryRepositories
public class BoxInventoryRepositories: IAllFielRepositories<BoxInventoryQueryRequest>, IBoxInventoryRepositories
{
private readonly IMapper _mapper;
private readonly IServiceProvider _serviceProvider;
@@ -52,12 +52,12 @@ namespace WMS.Web.Repositories
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
public async Task<ResultPagedList<BoxInventoryQueryResponse>> GetPagedList(BoxInventoryQueryRequest dto)
public async Task<(List<BoxInventoryQueryResponse> list, int total)> GetPagedList(BoxInventoryQueryRequest dto)
{
//1.获取物料集合和组织集合
var materials_result = await _erpService.BillQueryForMaterial();
if (!materials_result.IsSuccess)
return ResultPagedList<BoxInventoryQueryResponse>.ReFailure(materials_result);
return (new List<BoxInventoryQueryResponse>(), 0);
var materials = materials_result.Data.ToList();
//物料集合;模糊查询后的物料集合
@@ -80,10 +80,7 @@ namespace WMS.Web.Repositories
if (dto.SubStockId.HasValue)
query = query.Where(w => w.order.SubStockId == dto.SubStockId.Value);
var response = new ResultPagedList<BoxInventoryQueryResponse>();
int total = await query.CountAsync();
response.TotalCount = total;
var list = await query.Select(s => new BoxInventoryQueryResponse()
{
Id = s.order.Id,
@@ -96,9 +93,7 @@ namespace WMS.Web.Repositories
SubStock = _singleDataService.GetSingleData(SingleAction.SubStocks, _loginRepositories.CompanyId, s.order.SubStockId),
Qty = s.detail.Qty,
}).OrderByDescending(x => x.Id).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync();
response.Data = list;
return response;
return (list,total);
}
/// <summary>
@@ -236,5 +231,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(BoxInventoryQueryRequest dto, int companyId)
{
return await GetPagedList(dto);
}
}
}

View File

@@ -2,7 +2,9 @@
using System;
using System.Collections.Generic;
using System.Text;
using WMS.Web.Core.Dto;
using WMS.Web.Core.Dto.ChangeBoxRecord;
using WMS.Web.Core.Dto.Inventory;
using WMS.Web.Core.Dto.MoveBoxRecord;
using WMS.Web.Core.Dto.OutStock;
using WMS.Web.Core.Dto.OutStockTask;
@@ -48,6 +50,12 @@ namespace Microsoft.Extensions.DependencyInjection
services.AddTransient<IAllFielRepositories<OutStockQueryRequest>, OutStockRepositories>();
services.AddTransient<IAllFielRepositories<MoveBoxRecordQueryRequest>, MoveBoxRecordRepositories>();
services.AddTransient<IAllFielRepositories<ChangeBoxRecordQueryRequest>, ChangeBoxRecordRepositories>();
services.AddTransient<IAllFielRepositories<InStockQueryRequest>, InStockRepositories>();
services.AddTransient<IAllFielRepositories<InStockTaskQueryRequest>, InStockTaskRepositories>();
services.AddTransient<IAllFielRepositories<InventoryDetailsQueryRequest>, InventoryDetailsRepositories>();
services.AddTransient<IAllFielRepositories<InventoryInOutDetailsQueryRequest>, InventoryInOutDetailsRepositories>();
services.AddTransient<IAllFielRepositories<BoxInventoryQueryRequest>, BoxInventoryRepositories>();
#endregion

View File

@@ -20,7 +20,7 @@ namespace WMS.Web.Repositories
/// <summary>
/// wms入库单-仓储
/// </summary>
public class InStockRepositories: IInStockRepositories
public class InStockRepositories: IAllFielRepositories<InStockQueryRequest>, IInStockRepositories
{
private readonly IMapper _mapper;
private readonly IServiceProvider _serviceProvider;
@@ -53,24 +53,24 @@ namespace WMS.Web.Repositories
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
public async Task<ResultPagedList<InStockQueryResponse>> GetPagedList(InStockQueryRequest dto)
public async Task<(List<InStockQueryResponse> list, int total)> GetPagedList(InStockQueryRequest dto)
{
//1.获取物料集合和组织集合和供应商的集合
var materials_result = await _erpService.BillQueryForMaterial();
if (!materials_result.IsSuccess)
return ResultPagedList<InStockQueryResponse>.ReFailure(materials_result);
return (new List<InStockQueryResponse>(), 0);
var materials = materials_result.Data.ToList();
//组织集合
var orgs_result = await _erpService.BillQueryForOrg();
if (!orgs_result.IsSuccess)
return ResultPagedList<InStockQueryResponse>.ReFailure(orgs_result);
return (new List<InStockQueryResponse>(), 0);
var orgs = orgs_result.Data.ToList();
//供应商集合
var suppliers_result = await _erpService.BillQueryForSupplier();
if (!suppliers_result.IsSuccess)
return ResultPagedList<InStockQueryResponse>.ReFailure(suppliers_result);
return (new List<InStockQueryResponse>(), 0);
var suppliers = suppliers_result.Data.ToList();
//物料集合;模糊查询后的物料集合
@@ -109,10 +109,8 @@ namespace WMS.Web.Repositories
if (dto.CreateEndDate != null)
query = query.Where(w => w.order.CreateTime <= dto.CreateEndDate.Value);
var response = new ResultPagedList<InStockQueryResponse>();
int total = await query.CountAsync();
response.TotalCount = total;
var list = await query.Select(s => new InStockQueryResponse()
{
Id=s.order.Id,
@@ -132,8 +130,7 @@ namespace WMS.Web.Repositories
SuccessSync=s.order.SuccessSync
}).OrderByDescending(x => x.Id).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync();
response.Data = list;
return response;
return (list, total);
}
/// <summary>
@@ -170,5 +167,16 @@ namespace WMS.Web.Repositories
}
}
/// <summary>
/// 导出
/// </summary>
/// <param name="dto"></param>
/// <param name="companyId"></param>
/// <returns></returns>
public async Task<(object obj, int total)> GetListField(InStockQueryRequest dto, int companyId)
{
return await GetPagedList(dto);
}
}
}

View File

@@ -25,7 +25,7 @@ namespace WMS.Web.Repositories
/// <summary>
/// 入库任务表-仓储
/// </summary>
public class InStockTaskRepositories : IInStockTaskRepositories
public class InStockTaskRepositories : IAllFielRepositories<InStockTaskQueryRequest>, IInStockTaskRepositories
{
private readonly IMapper _mapper;
private readonly IServiceProvider _serviceProvider;
@@ -58,23 +58,23 @@ namespace WMS.Web.Repositories
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
public async Task<ResultPagedList<InStockTaskQueryResponse>> GetPagedList(InStockTaskQueryRequest dto)
public async Task<(List<InStockTaskQueryResponse> list, int total)> GetPagedList(InStockTaskQueryRequest dto)
{
//1.获取物料集合和组织集合
var materials_result = await _erpService.BillQueryForMaterial();
if (!materials_result.IsSuccess)
return ResultPagedList<InStockTaskQueryResponse>.ReFailure(materials_result);
return (new List<InStockTaskQueryResponse>(), 0);
var materials = materials_result.Data.ToList();
//组织集合
var orgs_result = await _erpService.BillQueryForOrg();
if (!orgs_result.IsSuccess)
return ResultPagedList<InStockTaskQueryResponse>.ReFailure(orgs_result);
return (new List<InStockTaskQueryResponse>(), 0);
var orgs = orgs_result.Data.ToList();
//供应商集合
var suppliers_result = await _erpService.BillQueryForSupplier();
if (!suppliers_result.IsSuccess)
return ResultPagedList<InStockTaskQueryResponse>.ReFailure(suppliers_result);
return (new List<InStockTaskQueryResponse>(), 0);
var suppliers = suppliers_result.Data.ToList();
//物料集合;模糊查询后的物料集合
@@ -117,10 +117,8 @@ namespace WMS.Web.Repositories
if (dto.CreateEndDate != null)
query = query.Where(w => w.order.ShelfTime <= dto.CreateEndDate.Value);
var response = new ResultPagedList<InStockTaskQueryResponse>();
int total = await query.CountAsync();
response.TotalCount = total;
int total = await query.CountAsync();
var list =await query.Select(s => new InStockTaskQueryResponse()
{
Id = s.order.Id,
@@ -145,9 +143,8 @@ namespace WMS.Web.Repositories
ShelfTime = s.order.ShelfTime.HasValue ? s.order.ShelfTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
CreateTime = s.order.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"),
}).OrderByDescending(x => x.Id).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync();
response.Data = list;
return response;
return (list,total);
}
/// <summary>
@@ -498,5 +495,16 @@ namespace WMS.Web.Repositories
return null;
}
}
/// <summary>
/// 导出
/// </summary>
/// <param name="dto"></param>
/// <param name="companyId"></param>
/// <returns></returns>
public async Task<(object obj, int total)> GetListField(InStockTaskQueryRequest dto, int companyId)
{
return await GetPagedList(dto);
}
}
}

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);
}
}
}

View File

@@ -20,7 +20,7 @@ namespace WMS.Web.Repositories
/// <summary>
/// 物料收发明细-仓储
/// </summary>
public class InventoryInOutDetailsRepositories: IInventoryInOutDetailsRepositories
public class InventoryInOutDetailsRepositories : IAllFielRepositories<InventoryInOutDetailsQueryRequest>, IInventoryInOutDetailsRepositories
{
private readonly IMapper _mapper;
private readonly IServiceProvider _serviceProvider;
@@ -52,12 +52,12 @@ namespace WMS.Web.Repositories
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
public async Task<ResultPagedList<InventoryInOutDetailsQueryResponse>> GetPagedList(InventoryInOutDetailsQueryRequest dto)
public async Task<(List<InventoryInOutDetailsQueryResponse> list, int total)> GetPagedList(InventoryInOutDetailsQueryRequest dto)
{
//1.获取物料集合和组织集合
var materials_result = await _erpService.BillQueryForMaterial();
if (!materials_result.IsSuccess)
return ResultPagedList<InventoryInOutDetailsQueryResponse>.ReFailure(materials_result);
return (new List<InventoryInOutDetailsQueryResponse>(), 0);
var materials = materials_result.Data.ToList();
//物料集合;模糊查询后的物料集合
@@ -85,10 +85,8 @@ namespace WMS.Web.Repositories
if (dto.CreateEndDate != null)
query = query.Where(w => w.CreateTime <= dto.CreateEndDate.Value);
var response = new ResultPagedList<InventoryInOutDetailsQueryResponse>();
int total = await query.CountAsync();
response.TotalCount = total;
var list = await query.Select(s => new InventoryInOutDetailsQueryResponse()
{
Id = s.Id,
@@ -104,8 +102,7 @@ namespace WMS.Web.Repositories
CreateTime = s.CreateTime
}).OrderByDescending(x => x.Id).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync();
response.Data = list;
return response;
return (list,total);
}
/// <summary>
@@ -137,5 +134,16 @@ namespace WMS.Web.Repositories
return false;
}
}
/// <summary>
/// 导出
/// </summary>
/// <param name="dto"></param>
/// <param name="companyId"></param>
/// <returns></returns>
public async Task<(object obj, int total)> GetListField(InventoryInOutDetailsQueryRequest dto, int companyId)
{
return await GetPagedList(dto);
}
}
}