IReceiptController.cs 1.72 KB
using System;
using System.Collections.Generic;
using Infrastructure;
using Microsoft.AspNetCore.Mvc;
using WebApp;
using WebRepository;

namespace WebMvc.Areas.Api.Controllers
{
    /// <summary>
    /// 入库单下发接口
    /// </summary>
    [Route("api/[controller]")]
    [ApiController]
    public class IReceiptController : ControllerBase
    {
        private readonly IReceiptApp _app;

        /// <summary>
        /// 控制器构造函数
        /// </summary>
        /// <param name="unitWork">注入工作单元</param>
        /// <param name="auth">注入授权信息</param>
        /// <param name="context">EF上下文</param>
        public IReceiptController(IUnitWork unitWork, IAuth auth, BaseDBContext context, IRepository<ReceiptHeader> repository)
        {
            _app = new IReceiptApp(unitWork, auth, context, repository);
        }

        /// <summary>
        /// 入库单下发接口
        /// </summary>
        /// <param name="receipts">入库单信息</param>
        /// <returns></returns>
        [HttpPost("InsertReceipt")]
        [ServiceFilter(typeof(InterfaceLogFilter))]
        public string InsertReceipt([FromBody]IReceiptModel receipts)
        {
            return JsonHelper.Instance.Serialize(_app.InsertReceipt(receipts));
        }

        /// <summary>
        /// 更改库存检验状态接口
        /// </summary>
        /// <param name="receipts">更改信息</param>
        /// <returns></returns>
        [HttpPost("UpInvinspect")]
        [ServiceFilter(typeof(InterfaceLogFilter))]
        public string UpInvinspect([FromBody] InspectionResultRequest UpInvinspect)
        {
            return JsonHelper.Instance.Serialize(_app.UpInvinspect(UpInvinspect));
        }
    }
}