DashboardController.cs 2.93 KB
using Hh.Mes.Common.log;
using Hh.Mes.POJO.Response;
using Hh.Mes.Service.ApiService;
using Hh.Mes.Service.Equipment;
using Hh.Mes.Service.SystemAuth;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using System;

namespace WebMvc.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    [EnableCors("cors")]
    public class DashboardController : BaseController
    {
        private readonly DashboardService _dashboardService;

        public DashboardController(IAuth authUtil, DashboardService dashboardService) : base(authUtil)
        {
            _dashboardService = dashboardService;
        }

        #region 故障报告
        [HttpGet]
        public string GetFaultReport(string yyyyMonth, string projectCode, string equipmentTypeCode)
        {
            var result = _dashboardService.GetFaultReport(yyyyMonth, projectCode, equipmentTypeCode);
            return Serialize(result);
        }


        /// <summary>
        /// 故障报告-本周故障分析-具体每天故障分析
        /// </summary>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <returns></returns>
        [HttpGet]
        public string GetEquipmentWeekDayFaultInfo(string startTime, string endTime, string projectCode)
        {
            var result = _dashboardService.GetEquipmentWeekDayFaultInfo(startTime, endTime, projectCode);
            return Serialize(result);

        }

        #endregion

        #region 故障分析
        /// <summary>
        /// 故障統計分析
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public string FaultStatistics(string begin, string end, string projectCode, string equipmentTypeCode)
        {
            var result = _dashboardService.FaultStatistics(begin, end, projectCode, equipmentTypeCode);
            return Serialize(result);
        }
        #endregion

        #region 妥善率
        /// <summary>
        /// 妥善率趋势图
        /// </summary>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <param name="yearOrdaySelectVal"></param>
        /// <param name="timeFlag"></param>
        /// <returns></returns>
        [HttpGet]
        public string GetProperRate(string startTime, string endTime, string yearOrdaySelectVal, string timeFlag, string projecCode, string equipmentTypeCode)
        {
            var result = _dashboardService.GetProperRate(startTime, endTime, yearOrdaySelectVal, timeFlag, projecCode, equipmentTypeCode);
            return Serialize(result);
        }

        #endregion

        #region 故障月份对比
        public string FailureMonthCompare(int year, int month, string projectCode, string equipmentTypeCode)
        {
            var result = _dashboardService.GetFailureMonthCompare(year, month, projectCode, equipmentTypeCode);
            return Serialize(result);
        }
        #endregion
    }
}