新版推送
This commit is contained in:
119
HT.Cloud.Service/SystemSecurity/RealTimeIOState.cs
Normal file
119
HT.Cloud.Service/SystemSecurity/RealTimeIOState.cs
Normal file
@ -0,0 +1,119 @@
|
||||
using MiniExcelLibs;
|
||||
using Serenity.Services;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HT.Cloud.Domain.ReportManage;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Data;
|
||||
using HT.Cloud.Code;
|
||||
using HT.Cloud.Domain.ChartsManage;
|
||||
using HT.Cloud.Domain.DevicesManage;
|
||||
using Quartz;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace HT.Cloud.Service.SystemSecurity
|
||||
{
|
||||
public class RealTimeIOState : BaseService<RTMainPageEntity>, IDenpendency
|
||||
{
|
||||
/// <summary>
|
||||
/// 绑定数据仓库的数据库ID
|
||||
/// </summary>
|
||||
private string dataDBNumber = GlobalContext.SystemConfig.DataDBNumber;
|
||||
|
||||
public RealTimeIOState(ISqlSugarClient context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<string> GetRtData()
|
||||
{
|
||||
//var groupName = _context.AsTenant().QueryableWithAttr<MetaGroupEntity>().Where(x => x.GroupDescription == systemName).First().GroupName;
|
||||
//var driverId = _context.AsTenant().QueryableWithAttr<MetaGroupEntity>().Where(x => x.GroupDescription == systemName).First().DriverID;
|
||||
//var driverName = _context.AsTenant().QueryableWithAttr<MetaDriverEntity>().Where(x => x.DriverID == driverId).First().DriverName;
|
||||
//var list = _context.AsTenant().GetConnection(dataDBNumber).Ado.SqlQuery<RTMainPageEntity>($"SELECT * FROM HT_{driverName}_{groupName}_MAINPAGE");
|
||||
|
||||
var remoteRtDataServer = " http://localhost:5276/TestIOApi/";
|
||||
|
||||
var responseStr = RemoteHttpRequest.HttpGet(remoteRtDataServer);
|
||||
|
||||
|
||||
|
||||
JObject valueJson = JObject.Parse(responseStr);
|
||||
|
||||
return valueJson.ToString(0);
|
||||
|
||||
//var srcTagRtValues = new List<SrcTagRtValue>();
|
||||
//var dt = new Dictionary<string, string>();
|
||||
//foreach (var src in list)
|
||||
//{
|
||||
// string elementIndex = src.ElementIndex.ToString();
|
||||
// string Description = src.Description.ToString();
|
||||
// string TagName = src.TagName.ToString();
|
||||
// string srcValue = valueJson[TagName].ToString();
|
||||
// string hSig = src.Hsig.ToString();
|
||||
// string Value = "";
|
||||
// if (hSig == "SS")
|
||||
// {
|
||||
// if (srcValue == "True")
|
||||
// Value = "开启";
|
||||
// else
|
||||
// Value = "停止";
|
||||
// }
|
||||
// else if (hSig == "OC")
|
||||
// {
|
||||
// if (srcValue == "True")
|
||||
// Value = "开";
|
||||
// else
|
||||
// Value = "关";
|
||||
// }
|
||||
// else if (hSig == "VP")
|
||||
// {
|
||||
// Value = Convert.ToDouble(srcValue).ToString("f2");
|
||||
// }
|
||||
// else if (hSig == "PE")
|
||||
// {
|
||||
// Value = srcValue + "%";
|
||||
// }
|
||||
// else if (hSig == "YN")
|
||||
// {
|
||||
// if (srcValue == "True")
|
||||
// Value = "是";
|
||||
// else
|
||||
// Value = "否";
|
||||
// }
|
||||
// else if (hSig == "AM")
|
||||
// {
|
||||
// if (srcValue == "True")
|
||||
// Value = "自动";
|
||||
// else
|
||||
// Value = "手动";
|
||||
// }
|
||||
// dt.Add(elementIndex, Value);
|
||||
//}
|
||||
//return dt.ToJson();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class ChartDataFormat
|
||||
{
|
||||
public string TagName { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string Value { get; set; }
|
||||
public string RtTime { get; set; }
|
||||
}
|
||||
|
||||
public class SrcTagRtValue
|
||||
{
|
||||
public string TagName { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string Value { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user