IShipmentController.cs 1.3 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 IShipmentController : ControllerBase
    {
        private readonly IShipmentApp _app;

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

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