lixiaojun
2023-10-11 1d86ecdc56c4395c5abaffa45e53e957054b348b
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
namespace IStation.Application
{
    /// <summary>
    /// 
    /// </summary>
    public class MonitorFullLogicalTreeDto : Yw.Application.LogicalTreeDto
    {
        /// <summary>
        /// 
        /// </summary>
        public MonitorFullLogicalTreeDto() { }
 
        /// <summary>
        /// 
        /// </summary>
        public MonitorFullLogicalTreeDto(Model.AirpSite rhs)
        {
            this.Id = $"{IStation.DataType.AirpSite}_{rhs.ID}";
            this.ParentId = string.Empty;
            this.LogicalName = rhs.Name;
            this.LogicalType = DataType.AirpSite;
            this.LogicalID = rhs.ID;
            this.LogicalModel = null;
            this.SortCode = rhs.SortCode;
            this.Description = rhs.Description;
            this.Children = new List<LogicalTreeDto>();
        }
 
        /// <summary>
        /// 
        /// </summary>
        public MonitorFullLogicalTreeDto(Yw.Model.MonitorPointGroup rhs)
        {
            this.Id = $"{Yw.Monitor.DataType.MonitorPointGroup}_{rhs.ID}";
            this.ParentId = $"{Yw.Monitor.DataType.MonitorPointGroup}_{rhs.ParentIds.LastOrDefault()}";
            this.LogicalName = rhs.Name;
            this.LogicalType = Yw.Monitor.DataType.MonitorPointGroup;
            this.LogicalID = rhs.ID;
            this.LogicalModel = null;
            this.SortCode = rhs.SortCode;
            this.Description = rhs.Description;
            this.Children = new List<LogicalTreeDto>();
        }
 
        /// <summary>
        /// 
        /// </summary>
        public MonitorFullLogicalTreeDto(Yw.Model.MonitorPointGroup rhs, List<Yw.Model.MonitorPoint_Signal_SignalType> monitorList)
        {
            this.Id = $"{Yw.Monitor.DataType.MonitorPointGroup}_{rhs.ID}";
            this.ParentId = $"{Yw.Monitor.DataType.MonitorPointGroup}_{rhs.ParentIds.LastOrDefault()}";
            this.LogicalName = rhs.Name;
            this.LogicalType = Yw.Monitor.DataType.MonitorPointGroup;
            this.LogicalID = rhs.ID;
            this.LogicalModel = null;
            this.SortCode = rhs.SortCode;
            this.Description = rhs.Description;
            this.Children = new List<LogicalTreeDto>();
 
            if (monitorList != null && monitorList.Count > 0)
            {
                foreach (var monitor in monitorList)
                {
                    var child = new MonitorFullLogicalTreeDto(monitor);
                    child.ParentId = this.Id;
                    this.Children.Add(child);
                }
            }
        }
 
        /// <summary>
        /// 
        /// </summary>
        public MonitorFullLogicalTreeDto(Yw.Model.MonitorPoint_Signal_SignalType rhs)
        {
            if (rhs.SignalList.Count == 1)
            {
                var signal = rhs.SignalList[0];
                this.Id = $"{Yw.Monitor.DataType.Signal}_{signal.ID}";
                this.ParentId = $"{Yw.Monitor.DataType.MonitorPointGroup}_{rhs.GroupID}";
                this.LogicalName = rhs.Name;
                this.LogicalType = Yw.Monitor.DataType.Signal;
                this.LogicalID = signal.ID;
                this.LogicalModel = null;
                this.SortCode = rhs.SortCode;
                this.Description = rhs.Description;
                this.Children = new List<LogicalTreeDto>();
            }
            else
            {
                this.Id = $"{Yw.Monitor.DataType.MonitorPoint}_{rhs.ID}";
                this.ParentId = $"{Yw.Monitor.DataType.MonitorPointGroup}_{rhs.GroupID}";
                this.LogicalName = rhs.Name;
                this.LogicalType = Yw.Monitor.DataType.MonitorPoint;
                this.LogicalID = rhs.ID;
                this.LogicalModel = null;
                this.SortCode = rhs.SortCode;
                this.Description = rhs.Description;
                this.Children = new List<LogicalTreeDto>();
 
                foreach (var signal in rhs.SignalList)
                {
                    var child = new MonitorFullLogicalTreeDto(signal);
                    child.ParentId = this.Id;
                    this.Children.Add(child);
                }
            }
 
        }
 
        /// <summary>
        /// 
        /// </summary>
        public MonitorFullLogicalTreeDto(Yw.Model.Signal_SignalType rhs)
        {
            this.Id = $"{Yw.Monitor.DataType.Signal}_{rhs.ID}";
            this.ParentId = $"{Yw.Monitor.DataType.MonitorPoint}_{rhs.MonitorPointID}";
            this.LogicalName = rhs.Name;
            this.LogicalType = Yw.Monitor.DataType.Signal;
            this.LogicalID = rhs.ID;
            this.LogicalModel = null;
            this.SortCode = rhs.SortCode;
            this.Description = rhs.Description;
            this.Children = new List<LogicalTreeDto>();
        }
 
    }
}