赖素文
authored
|
1
2
3
|
using System;using System.Collections.Generic;using Hh.Mes.Api.Controllers;using Hh.Mes.Common.Json;using Hh.Mes.Common.log;
using Hh.Mes.Service;using Hh.Mes.Service.ApiService;
using Microsoft.AspNetCore.Hosting;using Microsoft.AspNetCore.Http;using Microsoft.AspNetCore.Http.Headers;
|
赖素文
authored
|
4
5
|
using Microsoft.AspNetCore.Mvc;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
|
6
7
|
namespace Hh.Mes.Api.Controllers{
[Route("api/[controller]/[action]")]
[ApiController]
public class BulletinBoardController : BaseController
{
private readonly BulletinBoardService service;
private readonly BaseInfoCacheService baseInfo;
public BulletinBoardController(BulletinBoardService service, BaseInfoCacheService baseInfo, IHttpContextAccessor accessor)
{
this.service = service;
this.baseInfo = baseInfo;
this.context = accessor.HttpContext;
}
|
赖素文
authored
|
8
|
|
赖素文
authored
|
9
10
11
12
13
14
15
|
#region 故障报告
[HttpGet]
public string GetFaultReport(string yyyyMonth, string projectCode, string equipmentTypeCode)
{
var result = service.GetFaultReport(yyyyMonth, projectCode, equipmentTypeCode);
return Serialize(result);
}
|
赖素文
authored
|
16
|
|
赖素文
authored
|
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
/// <summary>
/// 故障报告-本周故障分析-具体每天故障分析
/// </summary>
/// <param name="startTime"></param>
/// <param name="endTime"></param>
/// <returns></returns>
[HttpGet]
public string GetEquipmentWeekDayFaultInfo(string startTime, string endTime, string projectCode)
{
var result = service.GetEquipmentWeekDayFaultInfo(startTime, endTime, projectCode);
return Serialize(result);
}
#endregion
#region 故障分析
/// <summary>
/// 故障統計分析
/// </summary>
/// <returns></returns>
[HttpGet]
public string FaultStatistics(string begin, string end, string projectCode)
{
var result = service.FaultStatistics(begin, end, projectCode, "");
return Serialize(result);
}
#endregion
#region 妥善率
/// <summary>
/// 妥善率趋势图
/// </summary>
[HttpGet]
|
|
52
|
public string GetProperRate(string startTime, string endTime, string yearOrdaySelectVal, string timeFlag, string projectCode, string equipmentTypeCode)
|
赖素文
authored
|
53
|
{
|
|
54
|
var result = service.GetProperRate(startTime, endTime, yearOrdaySelectVal, timeFlag, projectCode, equipmentTypeCode);
|
赖素文
authored
|
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
return Serialize(result);
}
#endregion
#region 故障月份对比
[HttpGet]
public string FailureMonthCompare(int year, int month, string projectCode, string equipmentTypeCode)
{
var result = service.GetFailureMonthCompare(year, month, projectCode, equipmentTypeCode);
return Serialize(result);
}
#endregion
|
|
69
|
#region 获取基础数据
|
赖素文
authored
|
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
[HttpGet]
public string GetBaseInfoByKeyExtend(string key, string falg)
{
return ExceptionsHelp.Instance.ExecuteT(() =>
{
var isRemore = falg == "1";
var result = baseInfo.GetOneBaseInfo(key, isRemore);
if (string.IsNullOrEmpty(result))
{
return "{\"code\":500,\"status\":false,\"message\":\"ok\",\"data\":null}";
}
return "{\"code\":200,\"status\":true,\"message\":\"ok\",\"data\":" + result + "}";
});
}
|
|
84
85
86
87
88
89
90
91
92
93
94
95
|
/// <summary>
/// 获取项目下的所有设备
/// </summary>
/// <param name="projectCode"></param>
/// <returns></returns>
[HttpGet]
public string GetEquipmentsByProject(string projectCode)
{
var result = service.GetEquipmentsByProject(projectCode);
return Serialize(result);
}
|
|
96
97
98
|
#endregion
#region 月每周故障次数、时间
|
|
99
100
|
[HttpGet]
public string FailureMonthWeekCountAndTime(string projectCode, DateTime currentDate)
|
|
101
|
{
|
|
102
|
var result = service.GetFailureMonthWeekCountAndTime(projectCode, currentDate);
|
|
103
104
105
|
return Serialize(result);
}
#endregion
|
赖素文
authored
|
106
|
|
|
107
|
#region 项目某设备某天每小时故障次数
|
|
108
109
|
[HttpGet]
public string FailureEveryHourCount(string projectCode, string equipmentCode, DateTime currentDate)
|
|
110
|
{
|
|
111
|
var result = service.GetFailureEveryHourCount(projectCode, equipmentCode, currentDate);
|
|
112
113
114
|
return Serialize(result);
}
#endregion
|
|
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
/// <summary>
/// 故障次数
/// </summary>
/// <param name="projectCode"></param>
/// <param name="startTime"></param>
/// <param name="endTime"></param>
/// <returns></returns>
[HttpGet]
public string FailureAlarmCount(string projectCode, DateTime startTime, DateTime endTime)
{
var result=service.GetFailureAlarmCount(projectCode, startTime, endTime);
return Serialize(result);
}
|
赖素文
authored
|
129
|
}}
|