2023-08-22 17:24:56 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using HT.Cloud.Code;
|
|
|
|
|
using HT.Cloud.Domain.ChartsManage;
|
|
|
|
|
using HT.Cloud.Service;
|
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
|
using HT.Cloud.Service.ChartsManage;
|
|
|
|
|
using HT.Cloud.Service.ReportManage;
|
|
|
|
|
using Serenity.Services;
|
|
|
|
|
|
|
|
|
|
namespace HT.Cloud.Web.Areas.ReportManage.Controllers
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 创 建:cdl
|
|
|
|
|
/// 日 期:2023-02-23 11:10
|
|
|
|
|
/// 描 述:历史趋势控制器类
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Area("PenMeiReportManage")]
|
|
|
|
|
public class PenMeiHistoryAlarmController : BaseController
|
|
|
|
|
{
|
|
|
|
|
public HistoryAlarmService _historyAlarmService { get;set;}
|
2023-09-07 17:21:02 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 绑定数据仓库的数据库ID
|
|
|
|
|
/// </summary>
|
2024-07-10 16:08:09 +08:00
|
|
|
|
private string systemDescription = GlobalContext.SystemConfig.SystemDescription;
|
2023-08-22 17:24:56 +08:00
|
|
|
|
[HttpGet]
|
|
|
|
|
public async Task<ActionResult> GetDriverGroupList()
|
|
|
|
|
{
|
|
|
|
|
var data = await _historyAlarmService.GetDriverGroupList();
|
|
|
|
|
return Content(data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
public async Task<ActionResult> GetAllSubsystemTag()
|
|
|
|
|
{
|
|
|
|
|
|
2024-07-10 16:08:09 +08:00
|
|
|
|
var data = await _historyAlarmService.GetAllSubsystemTag(systemDescription);
|
2023-08-22 17:24:56 +08:00
|
|
|
|
return Content(data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public async Task<ActionResult> GetSubsystemAllTag(ChartSubsysytemName chartSubsysytemName)
|
|
|
|
|
{
|
|
|
|
|
|
2024-07-10 16:08:09 +08:00
|
|
|
|
var data = await _historyAlarmService.GetSubsystemAllTag(chartSubsysytemName.SubsysytemName, systemDescription);
|
2023-08-22 17:24:56 +08:00
|
|
|
|
return Content(data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public async Task<ActionResult> GetAlarmRecord(Alarm_Params charts_Params)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
short TagID = short.Parse(charts_Params.TagID);
|
|
|
|
|
var StartTime = Gettime(charts_Params.StartTime);
|
|
|
|
|
var EndTime = Gettime(charts_Params.EndTime);
|
|
|
|
|
|
2024-07-10 16:08:09 +08:00
|
|
|
|
var data = await _historyAlarmService.GetAlarmRecord(TagID, StartTime, EndTime, systemDescription);
|
2023-08-22 17:24:56 +08:00
|
|
|
|
return Content(data);
|
|
|
|
|
}
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public async Task<ActionResult> GetAlarmRecordQuick(Alarm_Quick_Params alarm_Quick_Params)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var Alarmtype = alarm_Quick_Params.Alarmtype;
|
|
|
|
|
var StartTime = Gettime(alarm_Quick_Params.StartTime);
|
|
|
|
|
var EndTime = Gettime(alarm_Quick_Params.EndTime);
|
|
|
|
|
|
2024-07-10 16:08:09 +08:00
|
|
|
|
var data = await _historyAlarmService.GetAlarmRecordQuick(Alarmtype, StartTime, EndTime, systemDescription);
|
2023-08-22 17:24:56 +08:00
|
|
|
|
return Content(data);
|
|
|
|
|
}
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public async Task<ActionResult> GetAlarmRecordQuickDesc(Alarm_Quick_Desc_Params alarm_Quick_Desc_Params)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var hhour = alarm_Quick_Desc_Params.Hhour;
|
|
|
|
|
|
2024-07-10 16:08:09 +08:00
|
|
|
|
var data = await _historyAlarmService.GetAlarmRecordQuickDesc(hhour, systemDescription);
|
2023-08-22 17:24:56 +08:00
|
|
|
|
return Content(data);
|
|
|
|
|
}
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public async Task<ActionResult> GetAlarmSubSystem(SubSystem_Params subSystem_Params)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var AlarmName = subSystem_Params.AlarmName;
|
2024-07-10 16:08:09 +08:00
|
|
|
|
var data = await _historyAlarmService.GetAlarmSubSystem(AlarmName,systemDescription);
|
2023-08-22 17:24:56 +08:00
|
|
|
|
return Content(data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string Gettime(string longtime)
|
|
|
|
|
{
|
|
|
|
|
long jsTimeStamp = long.Parse(longtime);
|
|
|
|
|
System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1)); // 当地时区
|
|
|
|
|
DateTime dt = startTime.AddMilliseconds(jsTimeStamp);
|
|
|
|
|
return (dt.ToString("yyyy/MM/dd HH:mm:ss"));
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-06 21:26:55 +08:00
|
|
|
|
public string Gettime_(string longtime)
|
|
|
|
|
{
|
|
|
|
|
long jsTimeStamp = long.Parse(longtime);
|
|
|
|
|
System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1)); // 当地时区
|
|
|
|
|
DateTime dt = startTime.AddMilliseconds(jsTimeStamp);
|
|
|
|
|
return (dt.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public async Task<ActionResult> GetAlarmACC(Alarm_ACC_Params alarm_ACC_Params)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var StartTime = Gettime(alarm_ACC_Params.StartTime);
|
|
|
|
|
var EndTime = Gettime(alarm_ACC_Params.EndTime);
|
|
|
|
|
|
2024-07-10 16:08:09 +08:00
|
|
|
|
var data = await _historyAlarmService.GetAlarm_ACC(StartTime, EndTime, systemDescription);
|
2023-11-06 21:26:55 +08:00
|
|
|
|
return Content(data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public async Task<ActionResult> GetAlarmHistogram(Alarm_Histogram_Params alarm_Histogram_Params)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var StartTime = Gettime_(alarm_Histogram_Params.StartTime);
|
|
|
|
|
var EndTime = Gettime_(alarm_Histogram_Params.EndTime);
|
|
|
|
|
|
2024-07-10 16:08:09 +08:00
|
|
|
|
var data = await _historyAlarmService.GetAlarm_Histogram(StartTime, EndTime, systemDescription);
|
2023-11-06 21:26:55 +08:00
|
|
|
|
return Content(data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public async Task<ActionResult> GetAlarmPie(Alarm_Pie_Params alarm_Pie_Params)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var StartTime = Gettime(alarm_Pie_Params.StartTime);
|
|
|
|
|
var EndTime = Gettime(alarm_Pie_Params.EndTime);
|
|
|
|
|
|
2024-07-10 16:08:09 +08:00
|
|
|
|
var data = await _historyAlarmService.GetAlarm_Pie(StartTime, EndTime, systemDescription);
|
2023-11-06 21:26:55 +08:00
|
|
|
|
return Content(data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//public class SubAllTagReturn
|
|
|
|
|
//{
|
|
|
|
|
// //x.TagID, x.Description, x.Units
|
|
|
|
|
// public short TagID { get; set; }
|
|
|
|
|
// public string Description { get; set; }
|
|
|
|
|
// public string Units { get; set; }
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//public class SubsysytemNameList
|
|
|
|
|
//{
|
|
|
|
|
// public string Lable { get; set; }
|
|
|
|
|
// public string Value { get; set; }
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
public class ChartSubsysytemName
|
2023-08-22 17:24:56 +08:00
|
|
|
|
{
|
|
|
|
|
public string SubsysytemName { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//public class HDATETIMEVALUE
|
|
|
|
|
//{
|
|
|
|
|
// public String HDATETIME { get; set; }
|
|
|
|
|
// public decimal VALUE { get; set; }
|
|
|
|
|
//}
|
|
|
|
|
//public class ChartData
|
|
|
|
|
//{
|
|
|
|
|
// public decimal value { get; set; }
|
|
|
|
|
// public String name { get; set; }
|
|
|
|
|
//}
|
|
|
|
|
public class SubSystem_Params
|
|
|
|
|
{
|
|
|
|
|
public string AlarmName { get; set; }
|
|
|
|
|
}
|
|
|
|
|
public class Alarm_Params
|
|
|
|
|
{
|
|
|
|
|
public string TagID { get; set; }
|
|
|
|
|
public string StartTime { get; set; }
|
|
|
|
|
public string EndTime { get; set; }
|
|
|
|
|
}
|
|
|
|
|
public class Alarm_Quick_Params
|
|
|
|
|
{
|
|
|
|
|
public string Alarmtype { get; set; }
|
|
|
|
|
public string StartTime { get; set; }
|
|
|
|
|
public string EndTime { get; set; }
|
|
|
|
|
}
|
|
|
|
|
public class Alarm_Quick_Desc_Params
|
|
|
|
|
{
|
|
|
|
|
public string Hhour { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-06 21:26:55 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class Alarm_ACC_Params
|
|
|
|
|
{
|
|
|
|
|
public string StartTime { get; set; }
|
|
|
|
|
public string EndTime { get; set; }
|
|
|
|
|
}
|
|
|
|
|
public class Alarm_Histogram_Params
|
|
|
|
|
{
|
|
|
|
|
public string StartTime { get; set; }
|
|
|
|
|
public string EndTime { get; set; }
|
|
|
|
|
}
|
|
|
|
|
public class Alarm_Pie_Params
|
|
|
|
|
{
|
|
|
|
|
public string StartTime { get; set; }
|
|
|
|
|
public string EndTime { get; set; }
|
|
|
|
|
}
|
2023-08-22 17:24:56 +08:00
|
|
|
|
}
|
|
|
|
|
}
|