lixiaojun
2024-12-30 c22cc4c60e9ff156fc25b39a5c024cc758df354b
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
using Yw.Hydro;
using Yw.Vmo;
 
namespace HStation.WinFrmUI
{
    /// <summary>
    /// 监测点辅助类
    /// </summary>
    public class SimulationMonitorHelper
    {
        /// <summary>
        /// 
        /// </summary>
        public SimulationMonitorHelper(SimulationVisualListHelper visualListHelper)
        {
            _visualListHelper = visualListHelper;
        }
 
        private readonly SimulationVisualListHelper _visualListHelper = null;//可见构件列表辅助类
        private List<HydroMonitorVmo> _allMonitorList = null;//所有监测点列表
 
        /// <summary>
        /// 获取
        /// </summary>
        public async Task<List<HydroMonitorVmo>> GetAll()
        {
            if (_allMonitorList == null)
            {
                _allMonitorList = await BLLFactory<Yw.BLL.HydroMonitor>.Instance.GetByModelID(_visualListHelper.HydroInfo.ID);
                if (_allMonitorList == null)
                {
                    _allMonitorList = new List<HydroMonitorVmo>();
                }
            }
            return _allMonitorList;
        }
 
        /// <summary>
        /// 获取对接列表
        /// </summary>
        public async Task<List<HydroMonitorVmo>> GetDockingList()
        {
            var all = await GetAll();
            return all?.Where(x => x.SourceType == Yw.Hydro.eSourceType.Docking).ToList();
        }
 
        /// <summary>
        /// 获取分析列表
        /// </summary>
        public async Task<List<HydroMonitorVmo>> GetAnalyseList()
        {
            var all = await GetAll();
            return all?.Where(x => x.SourceType == Yw.Hydro.eSourceType.Analyse).ToList();
        }
 
        /// <summary>
        /// 更新
        /// </summary>
        public async Task<List<HydroMonitorVmo>> Update(string code)
        {
            var all = await GetAll();
            all.RemoveAll(x => x.Parter == code);
            var monitorList = await BLLFactory<Yw.BLL.HydroMonitor>.Instance.GetByParter(_visualListHelper.HydroInfo.ID, code);
            if (monitorList != null && monitorList.Count > 0)
            {
                all.AddRange(monitorList);
            }
            return monitorList;
        }
 
        /// <summary>
        /// 更新对接
        /// </summary>
        public async Task<List<HydroMonitorVmo>> UpdateDocking(string code)
        {
            var all = await GetAll();
            all.RemoveAll(x => x.Parter == code && x.SourceType == Yw.Hydro.eSourceType.Docking);
            var monitorList = await BLLFactory<Yw.BLL.HydroMonitor>.Instance.GetBySourceType(_visualListHelper.HydroInfo.ID, code, Yw.Hydro.eSourceType.Docking);
            if (monitorList != null && monitorList.Count > 0)
            {
                all.AddRange(monitorList);
            }
            return monitorList;
        }
 
        /// <summary>
        /// 更新
        /// </summary>
        public async Task Update(string code, eSourceType sourceType, List<HydroMonitorVmo> monitorList)
        {
            var all = await GetAll();
            all.RemoveAll(x => x.Parter == code && x.SourceType == sourceType);
            if (monitorList != null && monitorList.Count > 0)
            {
                all.AddRange(monitorList);
            }
        }
 
        /// <summary>
        /// 更新分析
        /// </summary>
        public async Task<List<HydroMonitorVmo>> UpdateAnalyse(string code)
        {
            var all = await GetAll();
            all.RemoveAll(x => x.Parter == code && x.SourceType == Yw.Hydro.eSourceType.Analyse);
            var monitorList = await BLLFactory<Yw.BLL.HydroMonitor>.Instance.GetBySourceType(_visualListHelper.HydroInfo.ID, code, Yw.Hydro.eSourceType.Analyse);
            if (monitorList != null && monitorList.Count > 0)
            {
                all.AddRange(monitorList);
            }
            return monitorList;
        }
 
 
 
 
    }
}