ningshuxia
2023-02-07 d027501182b03a0c036af712a2b7f31d55144562
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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);
        }
 
 
 
    }
}