lixiaojun
2024-10-12 dd4fa076e58b00f46118928bbdaf38f7593544b4
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
using DevExpress.CodeParser;
 
namespace Yw.WinFrmUI
{
    /// <summary>
    /// 
    /// </summary>
    public static class HydroParterInfoUpdateExtensions
    {
        /// <summary>
        /// 更新属性
        /// </summary>
        /// <param name="rhs"></param>
        /// <param name="allPaterList"></param>
        /// <param name="propertyViewModel"></param>
        public static void UpdateProperty(this Yw.Model.HydroParterInfo rhs, List<Yw.Model.HydroParterInfo> allPaterList, HydroParterPropertyViewModel propertyViewModel)
        {
            if (rhs == null)
            {
                return;
            }
            if (propertyViewModel == null)
            {
                return;
            }
            rhs.ID = propertyViewModel.ID;
            rhs.Catalog = HydroParterCatalogHelper.GetCatalogCode(propertyViewModel.Catalog);
            rhs.Name = propertyViewModel.Name;
            rhs.Code = propertyViewModel.Code;
            rhs.ModelType = propertyViewModel.ModelType;
            rhs.DbId = propertyViewModel.DbId;
            rhs.DbLocked = propertyViewModel.DbLocked;
            rhs.Flags = Yw.Untity.FlagsHelper.ToList(propertyViewModel.Flags);
            rhs.Description = propertyViewModel.Description;
 
            //节点
            if (rhs is Yw.Model.HydroNodeInfo hydroNodeInfo)
            {
                if (propertyViewModel is HydroNodePropertyViewModel hydroNodePropertyViewModel)
                {
                    hydroNodeInfo.Quality = hydroNodePropertyViewModel.Quality;
                    hydroNodeInfo.UpdatePropStatus(nameof(hydroNodeInfo.Quality), hydroNodePropertyViewModel, nameof(hydroNodePropertyViewModel.Quality));
                }
            }
            //水源
            if (rhs is Yw.Model.HydroSourceInfo hydroSourceInfo)
            {
                if (propertyViewModel is HydroSourcePropertyViewModel hydroSourcePropertyViewModel)
                {
 
                }
            }
            //水库
            if (rhs is Yw.Model.HydroReservoirInfo hydroReservoirInfo)
            {
                if (propertyViewModel is HydroReservoirPropertyViewModel hydroReservoirPropertyViewModel)
                {
                    hydroReservoirInfo.PoolElev = hydroReservoirPropertyViewModel.PoolElev;
                    hydroReservoirInfo.UpdatePropStatus(nameof(hydroReservoirInfo.PoolElev), hydroReservoirPropertyViewModel, nameof(hydroReservoirPropertyViewModel.PoolElev));
                    hydroReservoirInfo.Head = hydroReservoirPropertyViewModel.Head;
                    hydroReservoirInfo.UpdatePropStatus(nameof(hydroReservoirInfo.Head), hydroReservoirPropertyViewModel, nameof(hydroReservoirPropertyViewModel.Head));
                    hydroReservoirInfo.HeadPattern = hydroReservoirPropertyViewModel.HeadPattern;
                    hydroReservoirInfo.UpdatePropStatus(nameof(hydroReservoirInfo.HeadPattern), hydroReservoirPropertyViewModel, nameof(hydroReservoirPropertyViewModel.HeadPattern));
                }
            }
            //水池
            if (rhs is Yw.Model.HydroTankInfo hydroTankInfo)
            {
                if (propertyViewModel is HydroTankPropertyViewModel hydroTankPropertyViewModel)
                {
                    hydroTankInfo.PoolElev = hydroTankPropertyViewModel.PoolElev;
                    hydroTankInfo.UpdatePropStatus(nameof(hydroTankInfo.PoolElev), hydroTankPropertyViewModel, nameof(hydroTankPropertyViewModel.PoolElev));
                    hydroTankInfo.InitLevel = hydroTankPropertyViewModel.InitLevel;
                    hydroTankInfo.UpdatePropStatus(nameof(hydroTankInfo.InitLevel), hydroTankPropertyViewModel, nameof(hydroTankPropertyViewModel.InitLevel));
                    hydroTankInfo.MinLevel = hydroTankPropertyViewModel.MinLevel;
                    hydroTankInfo.UpdatePropStatus(nameof(hydroTankInfo.MinLevel), hydroTankPropertyViewModel, nameof(hydroTankPropertyViewModel.MinLevel));
                    hydroTankInfo.MaxLevel = hydroTankPropertyViewModel.MaxLevel;
                    hydroTankInfo.UpdatePropStatus(nameof(hydroTankInfo.MaxLevel), hydroTankPropertyViewModel, nameof(hydroTankPropertyViewModel.MaxLevel));
                    hydroTankInfo.Diameter = hydroTankPropertyViewModel.Diameter;
                    hydroTankInfo.UpdatePropStatus(nameof(hydroTankInfo.Diameter), hydroTankPropertyViewModel, nameof(hydroTankPropertyViewModel.Diameter));
                    hydroTankInfo.MinVol = hydroTankPropertyViewModel.MinVol;
                    hydroTankInfo.UpdatePropStatus(nameof(hydroTankInfo.MinVol), hydroTankPropertyViewModel, nameof(hydroTankPropertyViewModel.MinVol));
                    hydroTankInfo.VolCurve = hydroTankPropertyViewModel.VolCurve;
                    hydroTankInfo.UpdatePropStatus(nameof(hydroTankInfo.VolCurve), hydroTankPropertyViewModel, nameof(hydroTankPropertyViewModel.VolCurve));
                    hydroTankInfo.OverFlow = hydroTankPropertyViewModel.OverFlow;
                    hydroTankInfo.UpdatePropStatus(nameof(hydroTankInfo.OverFlow), hydroTankPropertyViewModel, nameof(hydroTankPropertyViewModel.OverFlow));
                }
            }
            //水箱
            if (rhs is Yw.Model.HydroWaterboxInfo hydroWaterboxInfo)
            {
                if (propertyViewModel is HydroWaterboxPropertyViewModel hydroWaterboxPropertyViewModel)
                {
 
                }
            }
            //连接节点
            if (rhs is Yw.Model.HydroJunctionInfo hydroJunctionInfo)
            {
                if (propertyViewModel is HydroJunctionPropertyViewModel hydroJunctionPropertyViewModel)
                {
                    hydroJunctionInfo.Elev = hydroJunctionPropertyViewModel.Elev;
                    hydroJunctionInfo.UpdatePropStatus(nameof(hydroJunctionInfo.Elev), hydroJunctionPropertyViewModel, nameof(hydroJunctionPropertyViewModel.Elev));
                    hydroJunctionInfo.Demand = hydroJunctionPropertyViewModel.Demand;
                    hydroJunctionInfo.UpdatePropStatus(nameof(hydroJunctionInfo.Demand), hydroJunctionPropertyViewModel, nameof(hydroJunctionPropertyViewModel.Demand));
                    hydroJunctionInfo.DemandPattern = hydroJunctionPropertyViewModel.DemandPattern;
                    hydroJunctionInfo.UpdatePropStatus(nameof(hydroJunctionInfo.DemandPattern), hydroJunctionPropertyViewModel, nameof(hydroJunctionPropertyViewModel.DemandPattern));
                }
            }
            //扩散器
            if (rhs is Yw.Model.HydroEmitterInfo hydroEmitterInfo)
            {
                if (propertyViewModel is HydroEmitterPropertyViewModel hydroEmitterPropertyViewModel)
                {
                    hydroEmitterInfo.Coefficient = hydroEmitterPropertyViewModel.Coefficient;
                    hydroEmitterInfo.UpdatePropStatus(nameof(hydroEmitterInfo.Coefficient), hydroEmitterPropertyViewModel, nameof(hydroEmitterPropertyViewModel.Coefficient));
                }
            }
            //喷嘴
            if (rhs is Yw.Model.HydroNozzleInfo hydroNozzleInfo)
            {
                if (propertyViewModel is HydroNozzlePropertyViewModel hydroNozzlePropertyViewModel)
                {
 
                }
            }
            //消火栓
            if (rhs is Yw.Model.HydroHydrantInfo hydroHydrantInfo)
            {
                if (propertyViewModel is HydroHydrantPropertyViewModel hydroHydrantPropertyViewModel)
                {
 
                }
            }
            //连接件
            if (rhs is Yw.Model.HydroConnectInfo hydroConnectInfo)
            {
                if (propertyViewModel is HydroConnectPropertyViewModel hydroConnectPropertyViewModel)
                {
                    hydroConnectInfo.Material = hydroConnectPropertyViewModel.Material;
                    hydroConnectInfo.UpdatePropStatus(nameof(hydroConnectInfo.Material), hydroConnectPropertyViewModel, nameof(hydroConnectPropertyViewModel.Material));
                    hydroConnectInfo.Caliber = hydroConnectPropertyViewModel.Caliber;
                    hydroConnectInfo.UpdatePropStatus(nameof(hydroConnectInfo.Caliber), hydroConnectPropertyViewModel, nameof(hydroConnectPropertyViewModel.Caliber));
                    hydroConnectInfo.MinorLoss = hydroConnectPropertyViewModel.MinorLoss;
                    hydroConnectInfo.UpdatePropStatus(nameof(hydroConnectInfo.MinorLoss), hydroConnectPropertyViewModel, nameof(hydroConnectPropertyViewModel.MinorLoss));
                }
            }
            //闷头
            if (rhs is Yw.Model.HydroBluntheadInfo hydroBluntheadInfo)
            {
                if (propertyViewModel is HydroBluntheadPropertyViewModel hydroBluntheadPropertyViewModel)
                {
 
                }
            }
            //弯头
            if (rhs is Yw.Model.HydroElbowInfo hydroElbowInfo)
            {
                if (propertyViewModel is HydroElbowPropertyViewModel hydroElbowPropertyViewModel)
                {
 
                }
            }
            //三通
            if (rhs is Yw.Model.HydroThreelinkInfo hydroThreelinkInfo)
            {
                if (propertyViewModel is HydroThreelinkPropertyViewModel hydroThreelinkPropertyViewModel)
                {
 
                }
            }
            //四通
            if (rhs is Yw.Model.HydroFourlinkInfo hydroFourlinkInfo)
            {
                if (propertyViewModel is HydroFourlinkPropertyViewModel hydroFourlinkPropertyViewModel)
                {
 
                }
            }
            //水表
            if (rhs is Yw.Model.HydroMeterInfo hydroMeterInfo)
            {
                if (propertyViewModel is HydroMeterPropertyViewModel hydroMeterPropertyViewModel)
                {
 
                }
            }
            //流量计
            if (rhs is Yw.Model.HydroFlowmeterInfo hydroFlowmeterInfo)
            {
                if (propertyViewModel is HydroFlowmeterPropertyViewModel hydroFlowmeterPropertyViewModel)
                {
 
                }
            }
            //压力表
            if (rhs is Yw.Model.HydroPressmeterInfo hydroPressmeterInfo)
            {
                if (propertyViewModel is HydroPressmeterPropertyViewModel hydroPressmeterPropertyViewModel)
                {
 
                }
            }
 
            //管段
            if (rhs is Yw.Model.HydroLinkInfo hydroLinkInfo)
            {
                if (propertyViewModel is HydroLinkPropertyViewModel hydroLinkPropertyViewModel)
                {
                    hydroLinkInfo.StartCode = hydroLinkPropertyViewModel.StartCode;
                    hydroLinkInfo.UpdatePropStatus(nameof(hydroLinkInfo.StartCode), hydroLinkPropertyViewModel, nameof(hydroLinkPropertyViewModel.StartCode));
                    hydroLinkInfo.EndCode = hydroLinkPropertyViewModel.EndCode;
                    hydroLinkInfo.UpdatePropStatus(nameof(hydroLinkInfo.EndCode), hydroLinkPropertyViewModel, nameof(hydroLinkPropertyViewModel.EndCode));
                    hydroLinkInfo.LinkStatus = HydroLinkStatusHelper.GetStatusCode(hydroLinkPropertyViewModel.LinkStatus);
                    hydroLinkInfo.UpdatePropStatus(nameof(hydroLinkInfo.LinkStatus), hydroLinkPropertyViewModel, nameof(hydroLinkPropertyViewModel.LinkStatus));
                }
            }
            //管道
            if (rhs is Yw.Model.HydroPipeInfo hydroPipeInfo)
            {
                if (propertyViewModel is HydroPipePropertyViewModel hydroPipePropertyViewModel)
                {
                    hydroPipeInfo.Diameter = hydroPipePropertyViewModel.Diameter;
                    hydroPipeInfo.UpdatePropStatus(nameof(hydroPipeInfo.Diameter), hydroPipePropertyViewModel, nameof(hydroPipePropertyViewModel.Diameter));
                    hydroPipeInfo.Length = hydroPipePropertyViewModel.Length;
                    hydroPipeInfo.UpdatePropStatus(nameof(hydroPipeInfo.Length), hydroPipePropertyViewModel, nameof(hydroPipePropertyViewModel.Length));
                    hydroPipeInfo.Roughness = hydroPipePropertyViewModel.Roughness;
                    hydroPipeInfo.UpdatePropStatus(nameof(hydroPipeInfo.Roughness), hydroPipePropertyViewModel, nameof(hydroPipePropertyViewModel.Roughness));
                    hydroPipeInfo.MinorLoss = hydroPipePropertyViewModel.MinorLoss;
                    hydroPipeInfo.UpdatePropStatus(nameof(hydroPipeInfo.MinorLoss), hydroPipePropertyViewModel, nameof(hydroPipePropertyViewModel.MinorLoss));
                }
            }
            //过渡件
            if (rhs is Yw.Model.HydroTranslationInfo hydroTranslationInfo)
            {
                if (propertyViewModel is HydroTranslationPropertyViewModel hydroTranslationPropertyViewModel)
                {
 
                }
            }
            //换热器
            if (rhs is Yw.Model.HydroExchangerInfo hydroExchangerInfo)
            {
                if (propertyViewModel is HydroExchangerPropertyViewModel hydroExchangerPropertyViewModel)
                {
 
                }
            }
            //水泵
            if (rhs is Yw.Model.HydroPumpInfo hydroPumpInfo)
            {
                if (propertyViewModel is HydroPumpPropertyViewModel hydroPumpPropertyViewModel)
                {
                    hydroPumpInfo.RatedP = hydroPumpPropertyViewModel.RatedP;
                    hydroPumpInfo.UpdatePropStatus(nameof(hydroPumpInfo.RatedP), hydroPumpPropertyViewModel, nameof(hydroPumpPropertyViewModel.RatedP));
                    hydroPumpInfo.RatedQ = hydroPumpPropertyViewModel.RatedQ;
                    hydroPumpInfo.UpdatePropStatus(nameof(hydroPumpInfo.RatedQ), hydroPumpPropertyViewModel, nameof(hydroPumpPropertyViewModel.RatedQ));
                    hydroPumpInfo.RatedH = hydroPumpPropertyViewModel.RatedH;
                    hydroPumpInfo.UpdatePropStatus(nameof(hydroPumpInfo.RatedH), hydroPumpPropertyViewModel, nameof(hydroPumpPropertyViewModel.RatedH));
                    hydroPumpInfo.RatedN = hydroPumpPropertyViewModel.RatedN;
                    hydroPumpInfo.UpdatePropStatus(nameof(hydroPumpInfo.RatedN), hydroPumpPropertyViewModel, nameof(hydroPumpPropertyViewModel.RatedN));
                    hydroPumpInfo.CurveQH = hydroPumpPropertyViewModel.CurveQH;
                    hydroPumpInfo.UpdatePropStatus(nameof(hydroPumpInfo.CurveQH), hydroPumpPropertyViewModel, nameof(hydroPumpPropertyViewModel.CurveQH));
                    hydroPumpInfo.CurveQP = hydroPumpPropertyViewModel.CurveQP;
                    hydroPumpInfo.UpdatePropStatus(nameof(hydroPumpInfo.CurveQP), hydroPumpPropertyViewModel, nameof(hydroPumpPropertyViewModel.CurveQP));
                    hydroPumpInfo.CurveQE = hydroPumpPropertyViewModel.CurveQE;
                    hydroPumpInfo.UpdatePropStatus(nameof(hydroPumpInfo.CurveQE), hydroPumpPropertyViewModel, nameof(hydroPumpPropertyViewModel.CurveQE));
                    hydroPumpInfo.SpeedRatio = hydroPumpPropertyViewModel.SpeedRatio;
                    hydroPumpInfo.UpdatePropStatus(nameof(hydroPumpInfo.SpeedRatio), hydroPumpPropertyViewModel, nameof(hydroPumpPropertyViewModel.SpeedRatio));
                    hydroPumpInfo.SpeedRatioPattern = hydroPumpPropertyViewModel.SpeedRatioPattern;
                    hydroPumpInfo.UpdatePropStatus(nameof(hydroPumpInfo.SpeedRatioPattern), hydroPumpPropertyViewModel, nameof(hydroPumpPropertyViewModel.SpeedRatioPattern));
                    hydroPumpInfo.Price = hydroPumpPropertyViewModel.Price;
                    hydroPumpInfo.UpdatePropStatus(nameof(hydroPumpInfo.Price), hydroPumpPropertyViewModel, nameof(hydroPumpPropertyViewModel.Price));
                    hydroPumpInfo.PricePattern = hydroPumpPropertyViewModel.PricePattern;
                    hydroPumpInfo.UpdatePropStatus(nameof(hydroPumpInfo.PricePattern), hydroPumpPropertyViewModel, nameof(hydroPumpPropertyViewModel.PricePattern));
                }
            }
            //阀门
            if (rhs is Yw.Model.HydroValveInfo hydroValveInfo)
            {
                if (propertyViewModel is HydroValvePropertyViewModel hydroValvePropertyViewModel)
                {
                    hydroValveInfo.Diameter = hydroValvePropertyViewModel.Diameter;
                    hydroValveInfo.UpdatePropStatus(nameof(hydroValveInfo.Diameter), hydroValvePropertyViewModel, nameof(hydroValvePropertyViewModel.Diameter));
                    hydroValveInfo.MinorLoss = hydroValvePropertyViewModel.MinorLoss;
                    hydroValveInfo.UpdatePropStatus(nameof(hydroValveInfo.MinorLoss), hydroValvePropertyViewModel, nameof(hydroValvePropertyViewModel.MinorLoss));
                    hydroValveInfo.ValveType = hydroValvePropertyViewModel.ValveType;
                    hydroValveInfo.UpdatePropStatus(nameof(hydroValveInfo.ValveType), hydroValvePropertyViewModel, nameof(hydroValvePropertyViewModel.ValveType));
                    hydroValveInfo.ValveSetting = hydroValvePropertyViewModel.ValveSetting;
                    hydroValveInfo.UpdatePropStatus(nameof(hydroValveInfo.ValveSetting), hydroValvePropertyViewModel, nameof(hydroValvePropertyViewModel.ValveSetting));
                }
            }
 
        }
    }
}