using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using IStation.Unit;
|
using IStation.Model.Monitor;
|
|
namespace IStation.Model
|
{
|
public partial class SignalType
|
{
|
/// <summary>
|
/// 查询值设置
|
/// </summary>
|
public object GetValueSettings()
|
{
|
object obj = null;
|
switch (this.ValueType)
|
{
|
case eValueType.Numeric: break;
|
case eValueType.Enum: obj = GetEnumValueSettings(); break;
|
case eValueType.Array: break;
|
case eValueType.Integration: break;
|
default: break;
|
}
|
return obj;
|
}
|
|
/// <summary>
|
/// 查询枚举值设置
|
/// </summary>
|
public Dictionary<int, string> GetEnumValueSettings()
|
{
|
if (this.ValueType != eValueType.Enum)
|
return default;
|
return JsonHelper.Json2Object<Dictionary<int, string>>(this.ValueSettings);
|
}
|
|
/// <summary>
|
/// 转换为枚举值设置
|
/// </summary>
|
public static string ToEnumValueSettings(Dictionary<int, string> dict)
|
{
|
if (dict == null || dict.Count < 1)
|
return default;
|
return JsonHelper.Object2Json(dict);
|
}
|
|
/// <summary>
|
/// 查询英文单位名称
|
/// </summary>
|
public string GetEnUnitName()
|
{
|
return UnitHelper.GetEnUnitName(this.UnitType, this.UnitValue);
|
}
|
|
/// <summary>
|
/// 查询中文单位名称
|
/// </summary>
|
public string GetCnUnitName()
|
{
|
return UnitHelper.GetCnUnitName(this.UnitType, this.UnitValue);
|
}
|
|
|
|
}
|
}
|