469 lines
16 KiB
C#
469 lines
16 KiB
C#
using Newtonsoft.Json.Linq;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace FrontendWebApi.Models
|
|
{
|
|
//public class HistoryClass
|
|
//{
|
|
// public string main_system_guid { get; set; }
|
|
// public string main_name { get; set; }
|
|
// public string sub_system_guid { get; set; }
|
|
// public string sub_name { get; set; }
|
|
// public string building_guid { get; set; }
|
|
// public string building_name { get; set; }
|
|
// public string device_item_guid { get; set; }
|
|
// public string item_name { get; set; }
|
|
|
|
//}
|
|
//public class History_Sub_device
|
|
//{
|
|
// public string building_guid { get; set; }
|
|
// public string sub_system_guid { get; set; }
|
|
// public string device_guid { get; set; }
|
|
// public string full_name { get; set; }
|
|
//}
|
|
// public class History_Main_system
|
|
// {
|
|
// public string main_system_guid { get; set; }
|
|
// public string full_name { get; set; }
|
|
// public List<History_Sub_system> History_Sub_systems { get; set; }
|
|
// }
|
|
// public class History_Sub_system
|
|
// {
|
|
// public string sub_system_guid { get; set; }
|
|
// public string full_name { get; set; }
|
|
// public List<History_Build> History_Builds { get; set; }
|
|
//}
|
|
// public class History_Build
|
|
// {
|
|
// public string building_guid { get; set; }
|
|
// public string full_name { get; set; }
|
|
// public List<History_Device> History_Devices { get; set; }
|
|
// }
|
|
// public class History_Device
|
|
// {
|
|
// public string device_guid { get; set; }
|
|
// public string full_name { get; set; }
|
|
// public List<History_Deviceitem> History_Deviceitems { get; set; }
|
|
// }
|
|
// public class History_Deviceitem
|
|
// {
|
|
// public string device_item_guid { get; set; }
|
|
// public string full_name { get; set; }
|
|
// }
|
|
public class HistoryDBMainSub
|
|
{
|
|
public string main_system_tag { get; set; }
|
|
public string main_name { get; set; }
|
|
public string sub_system_tag { get; set; }
|
|
public string sub_name { get; set; }
|
|
public string building_name { get; set; }
|
|
public string device_building_tag { get; set; }
|
|
public string device_number { get; set; }
|
|
public string device_full_name { get; set; }
|
|
public string device_serial_tag { get; set; }
|
|
public string device_normal_color { get; set; }
|
|
public string device_close_color { get; set; }
|
|
public string device_error_color { get; set; }
|
|
public string device_normal_point_name { get; set; }
|
|
public string device_close_point_name { get; set; }
|
|
public string device_error_point_name { get; set; }
|
|
public string device_normal_text { get; set; }
|
|
public string device_close_text { get; set; }
|
|
public string device_error_text { get; set; }
|
|
public string device_normal_point_value { get; set; }
|
|
public string device_close_point_value { get; set; }
|
|
public string device_error_point_value { get; set; }
|
|
public string device_item_name { get; set; }
|
|
public string device_item_points { get; set; }
|
|
public string device_item_unit { get; set; }
|
|
public byte device_item_is_show { get; set; }
|
|
public byte device_item_is_show_hsitory { get; set; }
|
|
public byte device_item_is_show_riserDiagram { get; set; }
|
|
public byte device_item_is_controll { get; set; }
|
|
public byte device_item_is_bool { get; set; }
|
|
public byte device_item_is_link { get; set; }
|
|
public string device_normal_flashing { get; set; }
|
|
public string device_close_flashing { get; set; }
|
|
public string device_error_flashing { get; set; }
|
|
public string AuthCode { get; set; }
|
|
}
|
|
|
|
public class HistoryFind
|
|
{
|
|
public string building_tag { get; set; }
|
|
public string device_number { get; set; }
|
|
}
|
|
public class BuildingFloorRawData
|
|
{
|
|
public string building_tag { get; set; }
|
|
public string building_name { get; set; }
|
|
public string floor_guid { get; set; }
|
|
public string floor_name { get; set; }
|
|
}
|
|
|
|
public class History_MainSubBuildFloor
|
|
{
|
|
public List<History_Build> history_Builds { get; set; }
|
|
public List<History_Main_system> history_Main_Systems { get; set; }
|
|
}
|
|
|
|
public class History_Build
|
|
{
|
|
public string building_tag { get; set; }
|
|
public string full_name { get; set; }
|
|
public List<History_Floor> history_Floors { get; set; }
|
|
}
|
|
public class History_Floor
|
|
{
|
|
public string floor_guid { get; set; }
|
|
public string full_name { get; set; }
|
|
}
|
|
public class History_Main_system
|
|
{
|
|
public string main_system_tag { get; set; }
|
|
public string full_name { get; set; }
|
|
public List<History_Sub_system> History_Sub_systems { get; set; }
|
|
}
|
|
public class History_Sub_system
|
|
{
|
|
public byte is_show_history { get; set; }
|
|
public string sub_system_tag { get; set; }
|
|
public string full_name { get; set; }
|
|
public string device_normal_color { get; set; }
|
|
public string device_close_color { get; set; }
|
|
public string device_error_color { get; set; }
|
|
public List<Device> device { get; set; }
|
|
public string device_normal_flashing { get; set; }
|
|
public string device_close_flashing { get; set; }
|
|
public string device_error_flashing { get; set; }
|
|
public string device_normal_text { get; set; }
|
|
public string device_close_text { get; set; }
|
|
public string device_error_text { get; set; }
|
|
public string device_normal_point_name { get; set; }
|
|
public string device_close_point_name { get; set; }
|
|
public string device_error_point_name { get; set; }
|
|
public string device_normal_point_value { get; set; }
|
|
public string device_close_point_value { get; set; }
|
|
public string device_error_point_value { get; set; }
|
|
|
|
public string auth_code { get; set; }
|
|
}
|
|
public class History_PostDevice
|
|
{
|
|
public List<string> SelectSub { get; set; }
|
|
public List<string> SelectBuildings { get; set; }
|
|
public List<string> SelectFloors { get; set; }
|
|
public string Device_name { get; set; }
|
|
}
|
|
|
|
public class History_GetDevice
|
|
{
|
|
public string device_guid { get; set; }
|
|
public string building_name { get; set; }
|
|
public string main_name { get; set; }
|
|
public string sub_name { get; set; }
|
|
public string device_name { get; set; }
|
|
public string device_number { get; set; }
|
|
}
|
|
|
|
public class History_GetItem
|
|
{
|
|
public string building { get; set; }
|
|
public string device_number { get; set; }
|
|
public string device_name { get; set; }
|
|
public string main_name { get; set; }
|
|
public string sub_name { get; set; }
|
|
public string device_guid { get; set; }
|
|
}
|
|
public class itemlist
|
|
{
|
|
//public History_GetItem postDevice { get; set; }
|
|
public List<History_GetItem> select_data { get; set; }
|
|
}
|
|
|
|
public class History_PostItem
|
|
{
|
|
public string building_name { get; set; }
|
|
public string device_number { get; set; }
|
|
public string device_name { get; set; }
|
|
public string item_name { get; set; }
|
|
public string points { get; set; }
|
|
public string unit { get; set; }
|
|
}
|
|
|
|
public class PostRealTimeCombination
|
|
{
|
|
public string account { get; set; }
|
|
public string building_tag { get; set; }
|
|
}
|
|
|
|
public class RealTimeCombinationRawData
|
|
{
|
|
public string Combination_guid { get; set; }
|
|
public string Combination_full_name { get; set; }
|
|
public string Device_guid { get; set; }
|
|
public string Device_number { get; set; }
|
|
public string Device_full_name { get; set; }
|
|
public string Building_full_name { get; set; }
|
|
public string Main_system_full_name { get; set; }
|
|
public string Sub_system_full_name { get; set; }
|
|
}
|
|
|
|
public class RealTimeCombination
|
|
{
|
|
public string Combination_guid { get; set; }
|
|
public string Combination_full_name { get; set; }
|
|
public string Building_guid { get; set; }
|
|
public string Userinfo_guid { get; set; }
|
|
public List<RealTimeCombinationDetail> Details { get; set; }
|
|
}
|
|
|
|
public class RealTimeCombinationDetail
|
|
{
|
|
public string Combination_guid { get; set; }
|
|
public string Device_guid { get; set; }
|
|
public string Device_number { get; set; }
|
|
public string Device_full_name { get; set; }
|
|
public string Building_full_name { get; set; }
|
|
public string Main_system_full_name { get; set; }
|
|
public string Sub_system_full_name { get; set; }
|
|
}
|
|
|
|
public class PostEditRealTimeCombination
|
|
{
|
|
public string Combination_guid { get; set; }
|
|
public string Full_name { get; set; }
|
|
}
|
|
|
|
public class PostSaveRealTimeCombination
|
|
{
|
|
public string Building_tag { get; set; }
|
|
public string Combination_guid { get; set; }
|
|
public byte Save_type { get; set; }
|
|
public string Full_name { get; set; }
|
|
public List<RealTimeCombinationDetail> Details { get; set; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// post 方式取得[歷史資料查詢]的過濾條件控制面板
|
|
/// </summary>
|
|
public class PostHistoryFilterPanel
|
|
{
|
|
public string Account { get; set; }
|
|
public string Building_guid { get; set; }
|
|
}
|
|
|
|
public class PostHistoryRawDataFilter
|
|
{
|
|
public string Start_timestamp { get; set; }
|
|
public string End_timestamp { get; set; }
|
|
public List<HistoryItem> HistoryItems { get; set; }
|
|
}
|
|
public class HistoryItem
|
|
{
|
|
public string Device_number_point { get; set; }
|
|
public string Device_number { get; set; }
|
|
public string Unit { get; set; }
|
|
}
|
|
public class GetHistoryBuildingDevice
|
|
{
|
|
public string building_tag { get; set; }
|
|
public string building_name { get; set; }
|
|
public string device_guid { get; set; }
|
|
|
|
public string device_number { get; set; }
|
|
public string device_name { get; set; }
|
|
|
|
}
|
|
public class HistoryBuildingDevice
|
|
{
|
|
private string _building_tag;
|
|
|
|
public string building_tag
|
|
{
|
|
get { return _building_tag; }
|
|
set { _building_tag = value.Replace("$3", ""); }
|
|
}
|
|
public string building_name { get; set; }
|
|
public List<HistoryDevice> device_list { get; set; }
|
|
|
|
}
|
|
public class HistoryDevice
|
|
{
|
|
public string device_guid { get; set; }
|
|
|
|
public string device_number { get; set; }
|
|
public string device_name { get; set; }
|
|
}
|
|
public class PostHistoryDataFilter
|
|
{
|
|
public int Type { get; set; }
|
|
|
|
public List<string> Building_tag_list { get; set; }
|
|
public string Start_date { get; set; }
|
|
public string End_date { get; set; }
|
|
public string Start_time { get; set; }
|
|
public string End_time { get; set; }
|
|
public List<string> Device_list { get; set; }
|
|
public List<string> Points { get; set; }
|
|
public int PageNumber { get; set; }
|
|
}
|
|
public class PageResultT<T>
|
|
{
|
|
public IEnumerable<T> Items { get; set; }
|
|
public int PageNumber { get; set; }
|
|
public int PageSize { get; set; }
|
|
public int TotalItems { get; set; }
|
|
public int TotalPages => (int)Math.Ceiling((double)TotalItems / PageSize);
|
|
public double ElapsedTime { get; set; }
|
|
|
|
}
|
|
public class HistoryFavorite
|
|
{
|
|
public string favorite_guid { get; set; }
|
|
public int deleted { get; set; }
|
|
|
|
public string favorite_name { get; set; }
|
|
public string userinfo_guid { get; set; }
|
|
|
|
public int type { get; set; }
|
|
public string device_name_tag { get; set; }
|
|
|
|
public List<string> device_list { get; set; } = new List<string>();
|
|
public List<string> Points { get; set; } = new List<string>();
|
|
|
|
public string created_at { get; set; }
|
|
|
|
public string updated_at { get; set; }
|
|
|
|
}
|
|
public class HistoryFavoriteDetail
|
|
{
|
|
public string favorite_guid { get; set; }
|
|
public string key { get; set; }
|
|
|
|
public string value { get; set; }
|
|
|
|
}
|
|
|
|
public class DeviceItemInfo
|
|
{
|
|
public string Building_name { get; set; }
|
|
public string Main_system_name { get; set; }
|
|
public string Sub_system_name { get; set; }
|
|
public string Device_building_tag { get; set; }
|
|
|
|
public string Device_number { get; set; }
|
|
public string Device_name { get; set; }
|
|
public string Item_name { get; set; }
|
|
public string Points { get; set; }
|
|
public string Unit { get; set; }
|
|
}
|
|
|
|
public class HistoryRawData : DeviceItemInfo
|
|
{
|
|
private string _Value;
|
|
public string Value
|
|
{
|
|
get { return _Value; }
|
|
set
|
|
{
|
|
_Value = StringHelper.TruncateDecimal(value);
|
|
}
|
|
}
|
|
public string Timestamp { get; set; }
|
|
}
|
|
|
|
public class HistoryExport
|
|
{
|
|
private string _value;
|
|
public string deviceName { get; set; }
|
|
public string value
|
|
{
|
|
get { return _value; }
|
|
set
|
|
{
|
|
_value = StringHelper.TruncateDecimal(value);
|
|
}
|
|
}
|
|
public DateTime timestamp { get; set; }
|
|
public DateTime starttime { get; set; }
|
|
public DateTime? endtime { get; set; }
|
|
public string dateType { get; set; }
|
|
public string type { get; set; }
|
|
public string building_tag { get; set; }
|
|
public string device_number { get; set; }
|
|
}
|
|
public static class StringHelper
|
|
{
|
|
// 截取小數點後兩位數字
|
|
public static string TruncateDecimal(string input)
|
|
{
|
|
// 如果是科學記號先做解析,再截取
|
|
if (double.TryParse(input, out double number))
|
|
{
|
|
return number.ToString("F2");
|
|
}
|
|
else
|
|
{
|
|
return string.Empty;
|
|
}
|
|
}
|
|
}
|
|
|
|
public class History_Building
|
|
{
|
|
public string building_tag { get; set; }
|
|
public string building_name { get; set; }
|
|
public List<History_Main_system> history_Main_Systems { get; set; }
|
|
}
|
|
|
|
public class DeviceNumberPoint
|
|
{
|
|
private string _FullDeviceNumberPoint;
|
|
public string DeviceNumber { get; set; }
|
|
public string Point { get; set; }
|
|
public string FullDeviceNumberPoint
|
|
{
|
|
get { return _FullDeviceNumberPoint; }
|
|
set { _FullDeviceNumberPoint = value.Replace("$3", ""); }
|
|
}
|
|
}
|
|
|
|
public class BuildStation
|
|
{
|
|
public string system_value { get; set; }
|
|
public string system_key { get; set; }
|
|
}
|
|
|
|
public class Device_item : Actor
|
|
{
|
|
public int id { get; set; }
|
|
public string device_item_guid { get; set; }
|
|
public string device_area_tag { get; set; }
|
|
public string device_building_tag { get; set; }
|
|
public string device_system_tag { get; set; }
|
|
public string device_name_tag { get; set; }
|
|
public string full_name { get; set; }
|
|
public string points { get; set; }
|
|
public string unit { get; set; }
|
|
public byte is_show { get; set; }
|
|
public byte is_show_riserDiagram { get; set; }
|
|
public byte is_controll { get; set; }
|
|
public byte is_bool { get; set; }
|
|
public byte is_link { get; set; }
|
|
public int is_show_history { get; set; }
|
|
}
|
|
|
|
public class JsonDevice
|
|
{
|
|
public DeviceNumberPoint deviceNumberPoint { get; set; }
|
|
public JObject json { get; set; }
|
|
public string building_tag { get; set; }
|
|
}
|
|
}
|