导出接口
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user