Shuxia Ning
2024-10-24 0711485ecb4fe66fbe820478d92eb9f04b77c042
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
129
130
131
using Yw.Model;
 
namespace Yw.WinFrmUI
{
    /// <summary>
    /// 管段属性视图
    /// </summary>
    public class HydroLinkPropertyViewModel : HydroParterPropertyViewModel, IHydroCalcuLinkResult
    {
        /// <summary>
        /// 
        /// </summary>
        public HydroLinkPropertyViewModel() : base() { }
 
        /// <summary>
        /// 
        /// </summary>
        public HydroLinkPropertyViewModel(Yw.Model.HydroLinkInfo rhs) : base(rhs)
        {
            this.StartCode = rhs.StartCode;
            this.UpdatePropStatus(nameof(this.StartCode), rhs, nameof(rhs.StartCode));
            this.EndCode = rhs.EndCode;
            this.UpdatePropStatus(nameof(this.EndCode), rhs, nameof(rhs.EndCode));
            this.LinkStatus = HydroLinkStatusHelper.GetStatusName(rhs.LinkStatus);
            this.UpdatePropStatus(nameof(this.LinkStatus), rhs, nameof(rhs.LinkStatus));
        }
 
        /// <summary>
        /// 上游节点
        /// </summary>
        [Category("基础信息")]
        [DisplayName("上游节点")]
        [PropertyOrder(11)]
        [IsHydroLinkCode]
        [ReadOnly(true)]
        [Browsable(true)]
        public string StartCode { get; set; }
 
        /// <summary>
        /// 下游节点
        /// </summary>
        [Category("基础信息")]
        [DisplayName("下游节点")]
        [PropertyOrder(12)]
        [IsHydroLinkCode]
        [ReadOnly(true)]
        [Browsable(true)]
        public string EndCode { get; set; }
 
        /// <summary>
        /// 管段状态
        /// </summary>
        [Category("数据")]
        [DisplayName("管段状态")]
        [PropertyOrder(13)]
        [Browsable(true)]
        public virtual string LinkStatus { get; set; }
 
        /// <summary>
        /// 流量
        /// </summary>
        [Category("计算结果")]
        [DisplayName("流量")]
        [PropertyOrder(10001)]
        [Browsable(true)]
        [DisplayUnit("m³/h")]
        [IsHydroCalcuPro(true)]
        [ShowEditor(false)]
        public virtual double? CalcuFlow { get; set; }
 
        /// <summary>
        /// 流速
        /// </summary>
        [Category("计算结果")]
        [DisplayName("流速")]
        [PropertyOrder(10002)]
        [Browsable(true)]
        [DisplayUnit("m/s")]
        [IsHydroCalcuPro(true)]
        [ShowEditor(false)]
        public virtual double? CalcuVelocity { get; set; }
 
        /// <summary>
        /// 水头损失
        /// </summary>
        [Category("计算结果")]
        [DisplayName("水头损失")]
        [PropertyOrder(10003)]
        [Browsable(true)]
        [DisplayUnit("m")]
        [IsHydroCalcuPro(true)]
        [ShowEditor(false)]
        public virtual double? CalcuHeadLoss { get; set; }
 
        /// <summary>
        /// 更新属性
        /// </summary>
        /// <param name="rhs"></param>
        /// <param name="allParterList"></param>
        public override void UpdateProperty(HydroParterInfo rhs, List<HydroParterInfo> allParterList)
        {
            base.UpdateProperty(rhs, allParterList);
            if (rhs is Yw.Model.HydroLinkInfo hydroLinkInfo)
            {
                this.StartCode = hydroLinkInfo.StartCode;
                this.UpdatePropStatus(nameof(this.StartCode), hydroLinkInfo, nameof(hydroLinkInfo.StartCode));
                this.EndCode = hydroLinkInfo.EndCode;
                this.UpdatePropStatus(nameof(this.EndCode), hydroLinkInfo, nameof(hydroLinkInfo.EndCode));
                this.LinkStatus = HydroLinkStatusHelper.GetStatusName(hydroLinkInfo.LinkStatus);
                this.UpdatePropStatus(nameof(this.LinkStatus), hydroLinkInfo, nameof(hydroLinkInfo.LinkStatus));
            }
        }
 
        /// <summary>
        /// 更新计算属性
        /// </summary>
        /// <param name="rhs"></param>
        public override void UpdateCalcuProperty(IHydroCalcuResult rhs)
        {
            base.UpdateCalcuProperty(rhs);
            if (rhs is IHydroCalcuLinkResult calcuLinkProperty)
            {
                this.CalcuFlow = calcuLinkProperty.CalcuFlow.HasValue ? Math.Round(calcuLinkProperty.CalcuFlow.Value, 1) : null;
                this.CalcuVelocity = calcuLinkProperty.CalcuVelocity.HasValue ? Math.Round(calcuLinkProperty.CalcuVelocity.Value, 2) : null;
                this.CalcuHeadLoss = calcuLinkProperty.CalcuHeadLoss.HasValue ? Math.Round(calcuLinkProperty.CalcuHeadLoss.Value, 2) : null;
            }
        }
 
 
    }
}