143 lines
4.4 KiB
C#
143 lines
4.4 KiB
C#
![]() |
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;
|
|||
|
using HT.Cloud.Domain.DevicesManage;
|
|||
|
|
|||
|
namespace HT.Cloud.Web.Areas.ChartsManage.Controllers
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// 创 建:cdl
|
|||
|
/// 日 期:2023-02-23 11:10
|
|||
|
/// 描 述:历史趋势控制器类
|
|||
|
/// </summary>
|
|||
|
[Area("DataStatisticalManage")]
|
|||
|
//[HandlerLogin(needLogin: false)]
|
|||
|
//[HandlerAuthorize(needAuth: false)]
|
|||
|
public class StatisticalSettingController : BaseController
|
|||
|
{
|
|||
|
public HistoryTechChartsService _historyTechChartsService { get;set;}
|
|||
|
/// <summary>
|
|||
|
/// 绑定数据仓库的数据库ID
|
|||
|
/// </summary>
|
|||
|
private string systemDescription = GlobalContext.SystemConfig.SystemDescription;
|
|||
|
[HttpPost]
|
|||
|
public async Task<ActionResult> GetAllTagList(ChartTagType chartTagType)
|
|||
|
{
|
|||
|
|
|||
|
var data = await _historyTechChartsService.GetAllTagList(systemDescription, chartTagType.ChartTagTypeName);
|
|||
|
return Content(data);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
public async Task<ActionResult> GetDriverGroupList()
|
|||
|
{
|
|||
|
var data = await _historyTechChartsService.GetDriverGroupList();
|
|||
|
return Content(data);
|
|||
|
}
|
|||
|
[HttpPost]
|
|||
|
public async Task<ActionResult> GetGroupSubsystemTag(ChartGroupDescription chartGroupDescription)
|
|||
|
{
|
|||
|
|
|||
|
var data = await _historyTechChartsService.GetGroupSubsystemTag(chartGroupDescription.GroupDescription);
|
|||
|
return Content(data);
|
|||
|
}
|
|||
|
[HttpGet]
|
|||
|
public async Task<ActionResult> GetAllSubsystemTag()
|
|||
|
{
|
|||
|
|
|||
|
var data = await _historyTechChartsService.GetAllSubsystemTag();
|
|||
|
return Content(data);
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
public async Task<ActionResult> GetSubsystemAllTag(ChartSubsysytemName chartSubsysytemName)
|
|||
|
{
|
|||
|
var data = await _historyTechChartsService.GetSubsystemAllTag(chartSubsysytemName.SubsysytemName, chartSubsysytemName.GroupDescription);
|
|||
|
return Content(data);
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
public async Task<ActionResult> GetChartsTagValue(Charts_Params charts_Params)
|
|||
|
{
|
|||
|
var Table = charts_Params.Table;
|
|||
|
var TagName = charts_Params.TagName;
|
|||
|
var StartTime = Gettime(charts_Params.StartTime);
|
|||
|
var EndTime = Gettime(charts_Params.EndTime);
|
|||
|
var Interval =int.Parse(charts_Params.Interval);
|
|||
|
|
|||
|
var data = await _historyTechChartsService.GetChartsTagValue(Table,TagName, StartTime, EndTime, Interval);
|
|||
|
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"));
|
|||
|
}
|
|||
|
|
|||
|
public class ChartTagType
|
|||
|
{
|
|||
|
public string ChartTagTypeName { get;set; }
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
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
|
|||
|
{
|
|||
|
public string GroupDescription { get; set; }
|
|||
|
public string SubsysytemName { get; set; }
|
|||
|
|
|||
|
}
|
|||
|
public class ChartGroupDescription
|
|||
|
{
|
|||
|
public string GroupDescription { 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 Charts_Params
|
|||
|
{
|
|||
|
public string Table { get; set; }
|
|||
|
public string TagName { get; set; }
|
|||
|
public string StartTime { get; set; }
|
|||
|
public string EndTime { get; set; }
|
|||
|
public string Interval { get; set; }
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|