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.Collections.Generic;
using System.Threading.Tasks;
namespace Opsoft.NetCore.O3App.WebApi.Controllers.WMS
{
///
/// 简单生产领料,退料,入库
///
[Authorize]
public class SimpleProductionController : BaseApiController
{
private readonly ISimpleProductionService _service;
public SimpleProductionController(IMapper mapper, ILogger logger, ISimpleProductionService service) : base(mapper, logger)
{
_service = service;
}
///
/// 简单生产领料
///
///
///
[HttpPost]
[Idempotent]
public async Task>> SimplePickMtrl([FromBody] InputBarCode request)
{
return await TryProcess(async input =>
{
RetMessage retMsg = await _service.SimplePickMtrlSubmit(request);
if (retMsg == null || retMsg.Status == 0)
{
throw new O3AppException(retMsg.Message);
}
else
{
return retMsg.Data;
}
}, LoginInfo);
}
///
/// 简单生产退料
///
///
///
[HttpPost]
[Idempotent]
public async Task> SimpleReturnMtrl([FromBody] InputBarCode request)
{
return await TryProcess(async input =>
{
RetMessage retMsg = await _service.SimpleReturnMtrlSubmit(request);
if (retMsg == null || retMsg.Status == 0)
{
throw new O3AppException(retMsg.Message);
}
else
{
return retMsg.Data["data"];
}
}, LoginInfo);
}
///
/// 简单生产入库
///
///
///
[HttpPost]
[Idempotent]
public async Task> SimpleInStock([FromBody] InputBarCode request)
{
return await TryProcess(async input =>
{
RetMessage retMsg = await _service.SimpleInStockSubmit(request);
if (retMsg == null || retMsg.Status == 0)
{
throw new O3AppException(retMsg.Message);
}
else
{
return retMsg.Data["data"];
}
}, LoginInfo);
}
///
/// 简单生产退库
///
///
///
[HttpPost]
[Idempotent]
public async Task> SimpleOutStock([FromBody] InputBarCode request)
{
return await TryProcess(async input =>
{
RetMessage retMsg = await _service.SimpleOutStockSubmit(request);
if (retMsg == null || retMsg.Status == 0)
{
throw new O3AppException(retMsg.Message);
}
else
{
return retMsg.Data["data"];
}
}, LoginInfo);
}
}
}