lixiaojun
2024-12-22 6551843c49431dacf67ea26e1ea21bf887a5246c
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
namespace Yw.WinFrmUI
{
    /// <summary>
    /// 监测值拓展
    /// </summary>
    public static class HydroMonitorValueExtensions
    {
 
        /// <summary>
        /// 更新监测值列表
        /// </summary>
        public static void UpdateMonitorValue(this List<HydroMonitorValueViewModel> allMonitorValueList, string monitorInfo)
        {
            if (allMonitorValueList == null || allMonitorValueList.Count < 1)
            {
                return;
            }
            if (string.IsNullOrEmpty(monitorInfo))
            {
                return;
            }
            var allWorkingMonitorList = JsonHelper.Json2Object<List<HydroWorkingMonitorViewModel>>(monitorInfo);
            if (allWorkingMonitorList == null || allWorkingMonitorList.Count < 1)
            {
                return;
            }
            allMonitorValueList.UpdateMonitorValue(allWorkingMonitorList);
        }
 
        /// <summary>
        /// 更新监测值列表
        /// </summary>
        public static void UpdateMonitorValue(this List<HydroMonitorValueViewModel> allMonitorValueList, List<HydroWorkingMonitorViewModel> allWorkingMonitorList)
        {
            if (allMonitorValueList == null || allMonitorValueList.Count < 1)
            {
                return;
            }
            if (allWorkingMonitorList == null || allWorkingMonitorList.Count < 1)
            {
                return;
            }
            foreach (var monitorValue in allMonitorValueList)
            {
                var workingMonitor = allWorkingMonitorList.Find(x => x.Relation == monitorValue.Vmo.Relation && x.PropName == monitorValue.Vmo.PropName);
                if (workingMonitor != null)
                {
                    monitorValue.PropValue = workingMonitor.PropValue;
                }
            }
        }
 
 
 
    }
}