UpstreamController.cs 2.23 KB
using Hh.Mes.POJO.ApiEntity;
using Hh.Mes.POJO.EnumEntitys;
using Hh.Mes.POJO.Response;
using Hh.Mes.Service;
using Hh.Mes.Service.ApiService;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;

namespace Hh.Mes.Api.Controllers
{
    /// <summary>
    /// 上游系统接口
    /// ps:新增方法需要在SystemVariable 注册 APIList、EnumLog 新增枚举 ,方便接口日志定位查询
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class UpstreamController : BaseController
    {
        private readonly UpstreamService service;

        //private readonly UserAuthSession sysUserApi;

        public UpstreamController(UpstreamService service,IHttpContextAccessor accessor)
        {
            this.service = service;
            context = accessor.HttpContext;

            //this.sysUserApi = base.GetUser(context);
            //this.service.sysUserApi = sysUserApi;
        }

        /// <summary>
        /// 设备基础信息 HH_001
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        [HttpPost]
        [ActionName("Mes/V1/SendEquipment")]
        public string SendEquipment(List<EquipmentEntity> entity)
        {
            return Serialize(service.SendEquipment(entity));
        }

      

        ///// <summary>
        ///// 人员信息 MOM_HH_003
        ///// http://127.0.0.1:10008/api/Upstream/Mes/V1/SendUser
        ///// </summary>
        //[HttpPost]
        //[ActionName("Mes/V1/SendUser")]
        //public string SendUser(SysUserEntity requestData)
        //{
        //    return Serialize(service.SendUser(requestData));
        //}

        ///// <summary>
        ///// ANDON报警
        ///// </summary>
        //[HttpPost]
        //[ActionName("Mes/V1/AndonUpMom")]
        //public string AndonUpMom(AndonUpMomEntity andonUpMomEntity)
        //{
        //    return Serialize(service.AndonUpMom(andonUpMomEntity));
        //}

        /// <summary>
        /// 获取MOM请求Token
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public string GetMomToken()
        {
            return Serialize(service.GetMomToken());
        }
    }
}