ningshuxia
2022-10-31 0171d347fec140d31db39ab5d76d51eebac472c2
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace IStation.Application
{
    /// <summary>
    /// 
    /// </summary>
    public class MonitorAlarmPageRecordMobileDto1_1 
    {
        /// <summary>
        /// 
        /// </summary>
        public MonitorAlarmPageRecordMobileDto1_1() { }
 
        /// <summary>
        /// 
        /// </summary>
        public MonitorAlarmPageRecordMobileDto1_1
            (Model.MonitorPoint monitor, Model.Signal_SignalType signal,List<Model.AlarmLevel> alarmLevelList, Model.MonitorAlarmRecord rhs) 
        {
            this.ID = rhs.ID;
            this.MonitorPointName = monitor.Name;
            this.SignalName = signal?.Name;
            this.AlarmType = rhs.AlarmType;
            this.AlarmLevelName = alarmLevelList?.Find(x => x.Grade == rhs.AlarmLevel)?.Name;
            var enUnitName = signal?.GetEnUnitName();
            switch(rhs.AlarmType)
            {
                case Alarm.Type_Upper:this.ThresholdValue = rhs.ThresholdValue+" "+enUnitName; break;
                case Alarm.Type_Lower:this.ThresholdValue=rhs.ThresholdValue+" "+enUnitName; break;
                case Alarm.Type_Mutation:this.ThresholdValue=rhs.ThresholdValue + " s"; break;
                case Alarm.Type_Interrupted:this.ThresholdValue=rhs.ThresholdValue+" s"; break;
                case Alarm.Type_Lacked:this.ThresholdValue= rhs.ThresholdValue+" s"; break;
                case Alarm.Type_UnChanged:this.ThresholdValue=rhs.ThresholdValue+" s"; break;
                case Alarm.Type_UnReasonable: 
                    {
                        var reasonble = Model.MonitorAlarmConfigure.ReasonableSpace.ToModel(rhs.ThresholdValue);
                        this.ThresholdValue = $"[{reasonble.MinValue},{reasonble.MaxValue}] {enUnitName}";
                    }
                    break;
                default:break;
            }
            this.AlarmTime = rhs.AlarmTime;
            this.AlarmContent = rhs.AlarmContent;
            this.DataTime = rhs.DataTime;
            this.DataValue = rhs.DataValue;
            switch (rhs.HandleStatus)
            {
                case Model.Alarm.eHandleStatus.UnHandle:this.HandleStatus = "未处理";break;
                case Model.Alarm.eHandleStatus.Handle:this.HandleStatus = "已处理";break;
                case Model.Alarm.eHandleStatus.Shelve:this.HandleStatus = "搁置";break;
                case Model.Alarm.eHandleStatus.Shield:this.HandleStatus = "屏蔽";break;
                default:break;
            }
 
            if (signal.TryConvert(rhs.DataValue, out double dataValue))
            {
                this.DataValue = dataValue.ToString() + " " + enUnitName;
            }
            else
            {
                this.DataValue = rhs.DataValue + " " + enUnitName;
            } 
        }
 
        /// <summary>
        /// 标识
        /// </summary>    
        public long ID { get; set; }
 
        /// <summary>
        /// 测点名称
        /// </summary>
        public string MonitorPointName { get; set; }
 
        /// <summary>
        /// 信号名称
        /// </summary>
        public string SignalName { get; set; }
 
        /// <summary>
        /// 报警类型
        /// </summary>    
        public string AlarmType { get; set; }
 
        /// <summary>
        /// 报警等级名称
        /// </summary>
        public string AlarmLevelName { get; set; }
 
        /// <summary>
        /// 阀值
        /// </summary>    
        public string ThresholdValue { get; set; }
 
        /// <summary>
        /// 报警时间
        /// </summary>    
        public DateTime AlarmTime { get; set; }
 
        /// <summary>
        /// 报警内容
        /// </summary>    
        public string AlarmContent { get; set; }
 
        /// <summary>
        /// 数据时间
        /// </summary>    
        public DateTime? DataTime { get; set; }
 
        /// <summary>
        /// 数据值
        /// </summary>    
        public string DataValue { get; set; }
 
        /// <summary>
        /// 处理状态
        /// </summary>    
        public string HandleStatus { get; set; }
    }
}