| | |
| | | using Yw.Hydro; |
| | | using static Yw.WinFrmUI.Q3d.EpanetEnum; |
| | | |
| | | namespace HStation.WinFrmUI |
| | | { |
| | |
| | | public SimulationMonitorValueHelper |
| | | ( |
| | | SimulationVisualListHelper visualListHelper, |
| | | SimulationMonitorHelper monitorHelper, |
| | | SimulationCalcuResultHelper calcuResultHelper |
| | | SimulationMonitorHelper monitorHelper |
| | | ) |
| | | { |
| | | _visualListHelper = visualListHelper; |
| | | _monitorHelper = monitorHelper; |
| | | _calcuResultHelper = calcuResultHelper; |
| | | _calcuResultHelper.InitialEvent += async () => await Update(); |
| | | } |
| | | |
| | | private readonly SimulationVisualListHelper _visualListHelper = null;//可见列表辅助类 |
| | | private readonly SimulationMonitorHelper _monitorHelper = null;//监测点辅助类 |
| | | private readonly SimulationCalcuResultHelper _calcuResultHelper = null;//计算结果辅助类 |
| | | private List<HydroMonitorValueViewModel> _allList = null;//所有监测值列表 |
| | | |
| | | /// <summary> |
| | |
| | | if (allVisualDict.ContainsKey(monitor.Parter)) |
| | | { |
| | | var visual = allVisualDict[monitor.Parter]; |
| | | double? propValue = null; |
| | | var calcuVisualResult = _calcuResultHelper.GetVisual(monitor.Parter); |
| | | if (calcuVisualResult != null) |
| | | { |
| | | propValue = calcuVisualResult.GetCalcuValue(monitor.PropName); |
| | | } |
| | | var vm = new HydroMonitorValueViewModel(monitor, visual, propValue); |
| | | var vm = new HydroMonitorValueViewModel(monitor, visual, null); |
| | | _allList.Add(vm); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取对接列表 |
| | | /// </summary> |
| | | public async Task<List<HydroMonitorValueViewModel>> GetDockingList() |
| | | { |
| | | var all = await GetAll(); |
| | | return all.Where(x => x.Vmo.SourceType == eSourceType.Docking).ToList(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取分析列表 |
| | | /// </summary> |
| | | public async Task<List<HydroMonitorValueViewModel>> GetAnalyseList() |
| | | { |
| | | var all = await GetAll(); |
| | | return all.Where(x => x.Vmo.SourceType == eSourceType.Analyse).ToList(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 更新 |
| | | /// </summary> |
| | | public async Task Update() |
| | | public async Task Update(string code, List<HydroMonitorValueViewModel> valueList) |
| | | { |
| | | var all = await GetAll(); |
| | | foreach (var item in all) |
| | | { |
| | | if (!item.PropValue.HasValue) |
| | | { |
| | | var calcuVisualResult = _calcuResultHelper.GetVisual(item.Vmo.Parter); |
| | | if (calcuVisualResult != null) |
| | | { |
| | | var propValue = calcuVisualResult.GetCalcuValue(item.Vmo.PropName); |
| | | if (propValue.HasValue) |
| | | { |
| | | item.PropValue = item.Vmo.GetPropValue(propValue.Value); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 更新 |
| | | /// </summary> |
| | | public async Task Update(string code, eSourceType sourceType, List<HydroMonitorValueViewModel> valueList) |
| | | { |
| | | var all = await GetAll(); |
| | | all.RemoveAll(x => x.Vmo.Parter == code && x.Vmo.SourceType == sourceType); |
| | | all.RemoveAll(x => x.Vmo.Parter == code); |
| | | if (valueList != null && valueList.Count > 0) |
| | | { |
| | | all.AddRange(valueList); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 重置 |
| | | /// </summary> |
| | | public async Task Reset(List<HydroWorkingMonitorViewModel> allWorkingMonitorList) |
| | | { |
| | | var all = await GetAll(); |
| | | all.UpdateMonitorValue(allWorkingMonitorList); |
| | | } |
| | | |
| | | /// <summary> |