Shuxia Ning
2024-11-06 adf8dc1c7cae1b12f486dcdb3d7daf4a5a59ec52
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
namespace IStation.Dto
{
    /// <summary>
    /// 泵站调度
    /// </summary>
    public class ScheduleCalcInput : IValidatableObject
    {
        /// <summary>
        /// 目标流量(1输)
        /// </summary>
        public double TargetFlow1 { get; set; }
 
        /// <summary>
        /// 目标压力(1输)
        /// </summary>
        public double TargetPressure1 { get; set; }
 
        /// <summary>
        /// 目标流量(2输)
        /// </summary>
        public double TargetFlow2 { get; set; }
 
        /// <summary>
        /// 目标压力(2输)
        /// </summary>
        public double TargetPressure2 { get; set; }
          
 
        /// <summary>
        /// 验证
        /// </summary>
        public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
        {
            if (this.TargetFlow1 < 1)
            {
                yield return
                    new ValidationResult($"一输水增水量过低! tag:TotalFlow1 Value:{this.TargetFlow1}", new[] { nameof(this.TargetFlow1) });
            }
             
            if (this.TargetPressure1 < 0.01)
            {
                yield return
                    new ValidationResult($"一输水增压过低! tag:TotalPressure1 Value:{this.TargetPressure1}", new[] { nameof(this.TargetPressure1) });
            }
 
 
            if (this.TargetFlow2 < 1)
            {
                yield return
                    new ValidationResult($"二输水增水量过低! tag:TotalFlow2 Value:{this.TargetFlow2}", new[] { nameof(this.TargetFlow2) });
            }
 
            if (this.TargetPressure2 < 0.01)
            {
                yield return
                    new ValidationResult($"二输水增压过低! tag:TotalPressure2 Value:{this.TargetPressure2}", new[] { nameof(this.TargetPressure2) });
            }
 
        }
 
    }
 
 
 
}