cloudflight
2023-12-16 ee714f35348c909d5843093fa80bd82d2bbf0184
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
using Hydro.CommonBase;
using Newtonsoft.Json;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
 
namespace Hydro.ConfigModel
{
    public class LogicPoint
    {
        public static string selectColumn = "Id, Name, LogicType, ExpressionType, IndicatorType, ModelObjectID, Sort, ParentId, Expression, ExtJson";
        public static List<string> Columns
        {
            get
            {
                return selectColumn.Split(',').Select(item => item.Trim()).ToList();
            }
            set {
                selectColumn = string.Concat(value, ',');
            }
        }
        [DisplayName("编号")]
        [Category("1、基本信息")]
        public int Id { get; set; }
        [DisplayName("名称")]
        [Category("1、基本信息")]
        public string Name { get; set; }
        [DisplayName("类型")]
        [Category("1、基本信息")]
        public string LogicType { get; set; }
        [DisplayName("值类型")]
        [Category("2、计算参数")]
        public string ExpressionType { get; set; }
 
        private string _fullAddress;
        [Browsable(false)]
        public string FullAddress => _fullAddress ?? (_fullAddress = ExpressionType == "3389" ? LogicType : $"{LogicType}:{ExpressionType}");
        [Browsable(false)]
        public string ExpressionToShow
        {
            get
            {
                if (ExpressionType == null) return null;
                if (ExpressionType.IndexOf("接口") >= 0 )
                {
                    return ExpressionType + " " + Expression;
                }
                else if (ExpressionType.IndexOf("基准值") >= 0 || ExpressionType.IndexOf("计算值") >= 0 || ExpressionType.IndexOf("变化值") >= 0 || ExpressionType.IndexOf("初始计算值") >= 0)
                {
                    return ExpressionType + " " + Expression;
                }
                else if (ExpressionType.IndexOf("值") >= 0 || ExpressionType.IndexOf("系数") >= 0)
                {
                    return ExpressionType;
                }
                else
                {
                    return $"{ExpressionType} " + (ExpressionType == "∈" ? $"[{Expression}] ▲{accurary}" : (ExpressionType == "最小" || ExpressionType == "最大" ? $"| 容许范围[{Expression}]" : Expression)); 
                }               
            }
        }
        [DisplayName("监测类型")]
        [Category("1、基本信息")]
        public string IndicatorType { get; set; }
        [DisplayName("模型编号或内容")]
        [Category("2、计算参数")]
        public string ModelObjectID { get; set; }
        [DisplayName("排序")]
        [Category("4、其他")]
        public int Sort { get; set; }
        [DisplayName("父节点编号")]
        [Category("4、其他")]
        public int ParentId { get; set; }
        [DisplayName("值")]
        [Category("2、计算参数")]
        public string Expression { get; set; }
        [Browsable(false)]
        public string ExtJson { get; set; } = "";
 
        private HostExt _ext;
        [Browsable(false)]
        public HostExt Ext
        {
            get
            {
                if (_ext == null)
                {
                    try
                    {
                        _ext = JsonConvert.DeserializeObject<HostExt>(ExtJson);
                        if (_ext == null) _ext = new HostExt();
                        return _ext;
                    }
                    catch
                    {
                        return (_ext=new HostExt());
                    }
                    
                }
                else
                    return _ext;// ?? 
            }
            
        }
        
        [Browsable(false)]
        public byte[] VPN { get; set; } = null;
        [DisplayName("结果")]
        [Category("2、计算参数")]
        public string Result { get; set; } = null;
 
        public dict di = null;
 
        public string objListString = null;
 
        public string Text_change = null;
 
        [DisplayName("对象名称")]
        [Category("1、基本信息")]
        public string ObjectType
        {
            get { return this.Ext.ObjectType; }
            set { this.Ext.ObjectType = value; }
        }
        [DisplayName("精度")]
        [Category("2、计算参数")]
        public string accurary
        {
            get { return this.Ext.accurary; }
            set { this.Ext.accurary = value; }
        }
        [DisplayName("子方案名称")]
        [Category("3、子方案")]
        public string childSolution
        {
            get { return this.Ext.childSolution; }
            set { this.Ext.childSolution = value; }
        }
        [DisplayName("子方案键")]
        [Category("3、子方案")]
        public string childTag
        {
            get { return this.Ext.childTag; }
            set { this.Ext.childTag = value; }
        }
        [DisplayName("子方案传输")]
        [Category("3、子方案")]
        public string childType
        {
            get { return this.Ext.childType; }
            set { this.Ext.childType = value; }
        }
        [DisplayName("子搜索精度")]
        [Category("3、子方案")]
        public string SaveAcc
        {
            get { return this.Ext.SaveAcc; }
            set { this.Ext.SaveAcc = value; }
        }
        [DisplayName("是否存储")]
        [Category("3、子方案")]
        public string isSave
        {
            get { return this.Ext.isSave; }
            set { this.Ext.isSave = value; }
        }
        [DisplayName("存储键值")]
        [Category("3、子方案")]
        public string SaveRange
        {
            get { return this.Ext.SaveRange; }
            set { this.Ext.SaveRange = value; }
        }
 
        [DisplayName("是否内存存储")]
        [Category("3、子方案")]
        public string isMemSave
        {
            get { return this.Ext.isMemSave; }
            set { this.Ext.isMemSave = value; }
        }
        [DisplayName("内存存储范围")]
        [Category("3、子方案")]
        public string MemSaveRange
        {
            get { return this.Ext.MemSaveRange; }
            set { this.Ext.MemSaveRange = value; }
        }
        [DisplayName("内存存储精度")]
        [Category("3、子方案")]
        public string MemSaveAcc
        {
            get { return this.Ext.MemSaveAcc; }
            set { this.Ext.MemSaveAcc = value; }
        }
        [DisplayName("内存存储次序")]
        [Category("3、子方案")]
        public string MemSaveIndex
        {
            get { return this.Ext.MemSaveIndex; }
            set { this.Ext.MemSaveIndex = value; }
        }
        [DisplayName("启用")]
        [Category("1、基本信息")]
        public bool Enable
        {
            get { return this.Ext.Enable; }
            set { this.Ext.Enable = value; }
        }
 
        [DisplayName("可见性")]
        [Category("1、基本信息")]
        public bool Visible
        {
            get { return this.Ext.Visible; }
            set { this.Ext.Visible = value; }
        }
 
    }
}