MaterialDistributeLoadHeaderController.cs 4.16 KB
using Hh.Mes.Common.Json;
using Hh.Mes.Common.Request;
using Hh.Mes.POJO.Entity;
using Hh.Mes.Service;
using Hh.Mes.Service.Distribution;
using Hh.Mes.Service.SystemAuth;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Threading.Tasks;
using WebMvc.Aop;

namespace WebMvc.Areas.wo.Controllers
{
    #region 装料数据

    /// <summary>
    /// 装料数据
    /// </summary>
    [Area("distribution")]
    public class MaterialDistributeLoadHeaderController : BaseController
    {
        private readonly MaterialDistributeLoadHeaderService weldingService;

        public MaterialDistributeLoadHeaderController(IAuth authUtil, MaterialDistributeLoadHeaderService service) : base(authUtil)
        {
            weldingService = service;
            weldingService.sysWebUser = authUtil.GetCurrentUser().User;
        }

        #region 视图功能
        /// <summary>
        /// 焊接工单页面
        /// </summary>
        /// <returns></returns>

        public IActionResult Index()
        {
            return View();
        }
        #endregion

        #region 获取数据
        /// <summary>
        /// 加载及分页查询
        /// </summary>
        /// <param name="pageRequest">表单请求信息</param>
        /// <param name="entity">请求条件实例</param>
        /// <returns></returns>
        [HttpPost]
        public string Load(PageReq pageRequest, bus_material_distribute_load_header entity)
        {
            return Serialize(weldingService.Load(pageRequest, entity));
        }


        /// <summary>
        /// 加载及分页查询
        /// </summary>
        /// <param name="pageRequest">表单请求信息</param>
        /// <param name="entity">请求条件实例</param>
        /// <returns></returns>
        [HttpPost]
        public string LoadDesc(PageReq pageRequest, bus_material_distribute_load_detail entity)
        {
            return Serialize(weldingService.LoadDesc(pageRequest, entity));
        }


        
        #endregion

        #region 提交数据
        /// <summary>
        /// 新增数据
        /// </summary>
        [HttpPost]
        [ServiceFilter(typeof(OperLogFilter))]
        public string Ins(bus_material_distribute_load_header entity)
        {
            return JsonHelper.Instance.Serialize(weldingService.Ins(entity));
        }

        /// <summary>
        /// 修改数据
        /// </summary>
        [HttpPost]
        [ServiceFilter(typeof(OperLogFilter))]
        public string Upd(bus_material_distribute_load_header entity)
        {

            return JsonHelper.Instance.Serialize(weldingService.Upd(entity));
        }

        [HttpPost]
        [ServiceFilter(typeof(OperLogFilter))]
        public string DelByIds(Guid[] ids)
        {
            return JsonHelper.Instance.Serialize(weldingService.DelByIds(ids));
        }


        /// <summary>
        /// 新增明细数据
        /// </summary>
        [HttpPost]
        [ServiceFilter(typeof(OperLogFilter))]
        public string InsDesc(bus_material_distribute_load_detail entity)
        {
            return JsonHelper.Instance.Serialize(weldingService.InsDesc(entity));
        }

        /// <summary>
        /// 修改明细数据
        /// </summary>
        [HttpPost]
        [ServiceFilter(typeof(OperLogFilter))]
        public string UpdDesc(bus_material_distribute_load_detail entity)
        {
            return JsonHelper.Instance.Serialize(weldingService.UpdDesc(entity));
        }

        [HttpPost]
        [ServiceFilter(typeof(OperLogFilter))]
        public string DelByIdsDesc(int[] ids)
        {
            return JsonHelper.Instance.Serialize(weldingService.DelByIdsDesc(ids));
        }
        #endregion

        #region 导出数据
        /// <summary>
        /// 导出数据
        /// </summary>
        /// <param name="entity">请求条件实例</param>
        /// <returns></returns>
        [HttpPost]
        public async Task<string> Export(bus_material_distribute_load_header entity)
        {
            return JsonHelper.Instance.Serialize(await weldingService.Export(entity));
        }
        #endregion

        #region 自定义方法


        #endregion

    }

    #endregion
}