using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Opsoft.NetCore.O3App.Domain;
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.IServices;
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.Model;
using Opsoft.NetCore.O3App.Shared;
using Opsoft.NetCore.O3App.WebApi.Filters;
using Opsoft.NetCore.O3App.WebApi.Models;
using System.Threading.Tasks;
namespace Opsoft.NetCore.O3App.WebApi.Controllers.WMS
{
///
/// 外购入库、退料
///
[Authorize]
public class STKInStockController : BaseApiController
{
private readonly ISTKInStockService service;
public STKInStockController(IMapper mapper, ILogger logger, ISTKInStockService Service)
: base(mapper, logger)
{
service = Service;
}
///
/// 外购入库信息
///
///
///
[HttpPost]
[Idempotent]
public async Task> STKInStockSubmit([FromBody] InputBarCode request)
{
return await TryProcess(async input =>
{
RetMessage retMess = await service.STKInStockSubmit(request);
if (retMess == null || retMess.Status == 0)
{
throw new O3AppException(retMess.Message);
}
else
{
return retMess.Data["data"];
}
}, LoginInfo);
}
///
/// 外购退料信息
///
///
///
[HttpPost]
[Idempotent]
public async Task> PURRetStockSubmit([FromBody] InputBarCode request)
{
return await TryProcess(async input =>
{
RetMessage retMess = await service.PURRetStockSubmit(request);
if (retMess == null || retMess.Status == 0)
{
throw new O3AppException(retMess.Message);
}
else
{
return retMess.Data["data"];
}
}, LoginInfo);
}
}
}