ningshuxia
2024-06-24 5d674c809bf51b77ddd31a365bcfcfe12b35c556
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.ComponentModel.DataAnnotations;
 
namespace IStation.Win
{
    /// <summary>
    /// 模型调度验证
    /// </summary>
    public class ModelScheduleValidViewModel
    {
        [Display(Name = "时间")]
        public DateTime Time { get; set; } 
         
        [Display(Name = "值类型")] 
        public eValueType ValueType { get; set; }
          
        [Display(Name = "模型标识")] 
        public string ModelId { get; set; }
         
        [Display(Name = "Scada标识")] 
        public string ScadaId { get; set; }
           
        [Display(Name = "模型值")] 
        public double? ModeValue { get; set; }
         
        [Display(Name = "Scada值")] 
        public double? ScadaValue { get; set; }
         
        [Display(Name = "差值")] 
        public double? DifferenceValue { get; set; }
 
 
        public void Round()
        {
            if (this.ModeValue.HasValue)
                if (this.ValueType == eValueType.Head)
                {
 
                    this.ModeValue = Math.Round(this.ModeValue.Value, 5);
                }
                else
                {
                    this.ModeValue = Math.Round(this.ModeValue.Value, 2);
                }
 
            if (this.ScadaValue.HasValue)
                if (this.ValueType == eValueType.Head)
                {
 
                    this.ScadaValue = Math.Round(this.ScadaValue.Value, 5);
                }
                else
                {
                    this.ScadaValue = Math.Round(this.ScadaValue.Value, 2);
                }
 
            if (this.DifferenceValue.HasValue)
                if (this.ValueType == eValueType.Head)
                {
 
                    this.DifferenceValue = Math.Round(this.DifferenceValue.Value, 6);
                }
                else
                {
                    this.DifferenceValue = Math.Round(this.DifferenceValue.Value, 1);
                }
        }
    }
}