lixiaojun
2024-03-27 56b519c5ee0ee0615400c7df8d455f9766fa600b
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
namespace Yw.Dto
{
    /// <summary>
    /// 
    /// </summary>
    public class PumpCurveExpressToolInput : IValidatableObject
    {
        /// <summary>
        /// 流量扬程拟合类型
        /// </summary>
        public eFitType FitTypeQH { get; set; }
 
        /// <summary>
        /// 流量功率拟合类型
        /// </summary>
        public eFitType FitTypeQP { get; set; }
 
        /// <summary>
        /// 流量效率拟合类型
        /// </summary>
        public eFitType FitTypeQE { get; set; }
 
        /// <summary>
        /// 流量扬程点数量
        /// </summary>
        public int? PointNumberQH { get; set; }
 
        /// <summary>
        /// 流量功率点数量
        /// </summary>
        public int? PointNumberQP { get; set; }
 
        /// <summary>
        /// 流量效率点数量
        /// </summary>
        public int? PointNumberQE { get; set; }
 
        /// <summary>
        /// 定义点列表
        /// </summary>
        public List<PumpCurvePointToolDto> DefinePoints { get; set; }
 
 
        /// <summary>
        /// 
        /// </summary>
        public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
        {
            if (this.DefinePoints == null || this.DefinePoints.Count < 4)
            {
                yield return new ValidationResult("DefinePoints 数量不足,至少4个点", new string[] { nameof(DefinePoints) });
            }
 
            var fitPowQH = FitHelper.GetFitPow(this.FitTypeQH);
            if (this.DefinePoints.Count < fitPowQH + 1)
            {
                yield return new ValidationResult($"DefinePoints 数量不足,至少{fitPowQH + 1}个点", new string[] { nameof(DefinePoints) });
            }
 
            if (this.PointNumberQH.HasValue)
            {
                if (this.PointNumberQH.Value < 6)
                {
                    yield return new ValidationResult($"PointNumberQH 不能小于6", new string[] { nameof(PointNumberQH) });
                }
            }
 
            var fitPowQP = FitHelper.GetFitPow(this.FitTypeQP);
            if (this.DefinePoints.Count < fitPowQP + 1)
            {
                yield return new ValidationResult($"DefinePoints 数量不足,至少{fitPowQP + 1}个点", new string[] { nameof(DefinePoints) });
            }
            if (this.PointNumberQP.HasValue)
            {
                if (this.PointNumberQP.Value < 6)
                {
                    yield return new ValidationResult($"PointNumberQP 不能小于6", new string[] { nameof(PointNumberQP) });
                }
            }
 
            var fitPowQE = FitHelper.GetFitPow(this.FitTypeQE);
            if (this.DefinePoints.Count < fitPowQE + 1)
            {
                yield return new ValidationResult($"DefinePoints 数量不足,至少{fitPowQE + 1}个点", new string[] { nameof(DefinePoints) });
            }
            if (this.PointNumberQE.HasValue)
            {
                if (this.PointNumberQE.Value < 6)
                {
                    yield return new ValidationResult($"PointNumberQE 不能小于6", new string[] { nameof(PointNumberQE) });
                }
            }
 
 
 
 
 
        }
 
 
    }
}