using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using WMS.Web.Core.Dto.Inventory;
using WMS.Web.Core.Internal.Results;
using WMS.Web.Domain.Infrastructure;
using WMS.Web.Domain.IService.Public;
using WMS.Web.Domain.Values;
namespace WMS.Web.Api.Controllers
{
///
/// 即时库存相关-接口
///
[Route("api/[controller]")]
[ApiController]
public class InventoryController : ControllerBase
{
private readonly ILoginService _loginService;
private readonly IInventoryDetailsRepositories _inventoryDetailsRepositories;
private readonly IInventoryInOutDetailsRepositories _inventoryInOutDetailsRepositories;
private readonly IBoxInventoryRepositories _boxInventoryRepositories;
public InventoryController(ILoginService loginService,
IInventoryDetailsRepositories inventoryDetailsRepositories,
IInventoryInOutDetailsRepositories inventoryInOutDetailsRepositories,
IBoxInventoryRepositories boxInventoryRepositories)
{
this._loginService = loginService;
this._inventoryDetailsRepositories = inventoryDetailsRepositories;
this._inventoryInOutDetailsRepositories = inventoryInOutDetailsRepositories;
this._boxInventoryRepositories = boxInventoryRepositories;
}
///
/// 列表-即时库存
///
///
///
[HttpPost]
[Route("GetList")]
public async Task> GetPagedList([FromBody] InventoryDetailsQueryRequest dto)
{
var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
if (loginInfo == null || loginInfo.UserInfo == null)
return ResultPagedList.ReFailure(ResultCodes.Token_Invalid_Error);
var result = await _inventoryDetailsRepositories.GetPagedList(dto);
return result;
}
///
/// 列表-物料收发明细
///
///
///
[HttpPost]
[Route("GetListInOut")]
public async Task> GetPagedListInOut([FromBody] InventoryInOutDetailsQueryRequest dto)
{
var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
if (loginInfo == null || loginInfo.UserInfo == null)
return ResultPagedList.ReFailure(ResultCodes.Token_Invalid_Error);
var result = await _inventoryInOutDetailsRepositories.GetPagedList(dto);
return result;
}
///
/// 列表-箱库存明细
///
///
///
[HttpPost]
[Route("GetListBox")]
public async Task> GetPagedListBox([FromBody] BoxInventoryQueryRequest dto)
{
var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
if (loginInfo == null || loginInfo.UserInfo == null)
return ResultPagedList.ReFailure(ResultCodes.Token_Invalid_Error);
var result = await _boxInventoryRepositories.GetPagedList(dto);
return result;
}
}
}