Files
GX.O3.WMS/APP.O3/WebApi/Controllers/WMS/SimpleProductionController.cs
T

118 lines
4.0 KiB
C#
Executable File

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
{
/// <summary>
/// 简单生产领料,退料,入库
/// </summary>
[Authorize]
public class SimpleProductionController : BaseApiController<SimpleProductionController>
{
private readonly ISimpleProductionService _service;
public SimpleProductionController(IMapper mapper, ILogger<SimpleProductionController> logger, ISimpleProductionService service) : base(mapper, logger)
{
_service = service;
}
/// <summary>
/// 简单生产领料
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost]
[Idempotent]
public async Task<BaseResponse<Dictionary<string, object>>> SimplePickMtrl([FromBody] InputBarCode<BD_BARCODERS2> 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);
}
/// <summary>
/// 简单生产退料
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost]
[Idempotent]
public async Task<BaseResponse<object>> SimpleReturnMtrl([FromBody] InputBarCode<BD_BARCODERS2> 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);
}
/// <summary>
/// 简单生产入库
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost]
[Idempotent]
public async Task<BaseResponse<object>> SimpleInStock([FromBody] InputBarCode<BD_BARCODERS2> 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);
}
/// <summary>
/// 简单生产退库
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost]
[Idempotent]
public async Task<BaseResponse<object>> SimpleOutStock([FromBody] InputBarCode<BD_BARCODERS2> 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);
}
}
}