| | |
| | | using DevExpress.XtraMap; |
| | | using HStation.WinFrmUI.PhartRelation; |
| | | using Mapster; |
| | | using NPOI.OpenXmlFormats.Dml; |
| | | using NPOI.SS.Formula.Functions; |
| | | using System.Diagnostics; |
| | | using Yw.EPAnet; |
| | |
| | | /// 新增工况事件 |
| | | /// </summary> |
| | | public event Action<HydroWorkingVmo> AppendWorkingEvent; |
| | | /// <summary> |
| | | /// 保存模型事件 |
| | | /// </summary> |
| | | public event Func<Yw.Model.HydroModelInfo, Task<Yw.Model.HydroModelInfo>> SaveModelEvent; |
| | | /// <summary> |
| | | /// 刷新模型事件 |
| | | /// </summary> |
| | | public event Func<Task<Yw.Model.HydroModelInfo>> RefreshModelEvent; |
| | | /// <summary> |
| | | /// 更新方案事件 |
| | | /// </summary> |
| | | public event Action<XhsSchemeVmo> UpdateSchemeEvent; |
| | | /// <summary> |
| | | /// 移除方案事件 |
| | | /// </summary> |
| | | public event Action<XhsSchemeVmo> RemoveSchemeEvent; |
| | | |
| | | |
| | | |
| | | private HStation.Vmo.XhsProjectVmo _project = null;//项目 |
| | | private HStation.Vmo.XhsProjectSiteVmo _projectSite = null;//项目站 |
| | |
| | | _scheme = scheme; |
| | | _hydroInfo = hydroInfo; |
| | | _allWorkingCheckedListDict = allWorkingCheckedListDict; |
| | | ResetMonitorValue(); |
| | | if (_scheme == null) |
| | | { |
| | | this.ribPageGroupForScheme.Visible = false; |
| | | this.PageTitle.Caption = $"水力模拟"; |
| | | } |
| | | else |
| | | { |
| | | this.ribPageGroupForScheme.Visible = true; |
| | | this.PageTitle.Caption = $"水力方案\r\n{_scheme.Name}"; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | } |
| | | } |
| | | |
| | | //选择构件 |
| | | private void SelectVisual(string code, eVisualSource source) |
| | | { |
| | | var visual = GetVisual(code); |
| | | SelectVisual(visual, source); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 构件明细 |
| | |
| | | _visualListHelper.InitialData(_hydroInfo); |
| | | } |
| | | return _visualListHelper; |
| | | } |
| | | |
| | | //重置可见列表 |
| | | private void ResetVisualList() |
| | | { |
| | | var helper = GetVisualListHelper(); |
| | | helper.InitialData(_hydroInfo); |
| | | } |
| | | |
| | | //获取可见构件 |
| | | private Yw.Model.HydroVisualInfo GetVisual(string code) |
| | | { |
| | | var helper = GetVisualListHelper(); |
| | | var visual = helper.GetVisual(code); |
| | | return visual; |
| | | } |
| | | |
| | | //获取可见列表 |
| | | private List<Yw.Model.HydroVisualInfo> GetVisualList() |
| | | { |
| | | var helper = GetVisualListHelper(); |
| | | return helper.GetVisualList(); |
| | | } |
| | | |
| | | //获取水源列表 |
| | | private List<Yw.Model.HydroSourceInfo> GetSourceList() |
| | | { |
| | | var helper = GetVisualListHelper(); |
| | | return helper.GetSourceList(); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | { |
| | | return; |
| | | } |
| | | Stopwatch sw = new Stopwatch(); |
| | | sw.Start(); |
| | | |
| | | |
| | | var id = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.Save(_hydroInfo); |
| | | |
| | | //耗时巨大的代码 |
| | | |
| | | sw.Stop(); |
| | | TimeSpan ts2 = sw.Elapsed; |
| | | Console.WriteLine("Stopwatch总共花费{0}ms.", ts2.TotalMilliseconds); |
| | | if (id < 1) |
| | | if (this.SaveModelEvent == null) |
| | | { |
| | | return; |
| | | } |
| | | var hydroInfo = await this.SaveModelEvent.Invoke(_hydroInfo); |
| | | if (hydroInfo == null) |
| | | { |
| | | TipFormHelper.ShowError("保存失败!"); |
| | | return; |
| | | } |
| | | _hydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(id); |
| | | _hydroInfo = hydroInfo; |
| | | |
| | | TipFormHelper.ShowSucceed("保存成功!"); |
| | | |
| | | |
| | | //Stopwatch sw = new Stopwatch(); |
| | | //sw.Start(); |
| | | //耗时巨大的代码 |
| | | //sw.Stop(); |
| | | //TimeSpan ts2 = sw.Elapsed; |
| | | //Console.WriteLine("Stopwatch总共花费{0}ms.", ts2.TotalMilliseconds); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | //刷新 |
| | | private async void barBtnRefresh_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (this.RefreshModelEvent == null) |
| | | { |
| | | return; |
| | | } |
| | | if (XtraMessageBox.Show("刷新后将丢失当前水力信息更改,是否继续刷新?", "询问", MessageBoxButtons.YesNo) == DialogResult.Yes) |
| | | { |
| | | if (_project == null) |
| | | { |
| | | return; |
| | | } |
| | | if (_projectSite == null) |
| | | { |
| | | return; |
| | | } |
| | | var hydroRelation = await BLLFactory<Yw.BLL.HydroModelRelation>.Instance |
| | | .GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsProjectSite, _projectSite.ID, HStation.Xhs.Purpose.Simulation); |
| | | Stopwatch sw = new Stopwatch(); |
| | | sw.Start(); |
| | | _hydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(hydroRelation.ModelID); |
| | | sw.Stop(); |
| | | TimeSpan ts2 = sw.Elapsed; |
| | | Console.WriteLine("Stopwatch总共花费{0}ms.", ts2.TotalMilliseconds); |
| | | _visual = null; |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(null); |
| | | //ShowSelectedProperty(); |
| | | TipFormHelper.ShowSucceed("数据已刷新"); |
| | | |
| | | var visualListHelper = GetVisualListHelper(); |
| | | visualListHelper.InitialData(_hydroInfo); |
| | | var hydroInfo = await this.RefreshModelEvent.Invoke(); |
| | | if (hydroInfo == null) |
| | | { |
| | | TipFormHelper.ShowError("刷新失败!"); |
| | | return; |
| | | } |
| | | _hydroInfo = hydroInfo; |
| | | SelectVisual(visual: null, eVisualSource.None); |
| | | |
| | | ResetVisualList(); |
| | | TipFormHelper.ShowSucceed("刷新成功!"); |
| | | } |
| | | } |
| | | |
| | |
| | | _monitorValueHelper = new SimulationMonitorValueHelper(visualListHelper, monitorHelper); |
| | | } |
| | | return _monitorValueHelper; |
| | | } |
| | | |
| | | //重置 |
| | | private void ResetMonitorValue() |
| | | { |
| | | var allWorkingList = GetWorkingList(); |
| | | var working = allWorkingList?.Last(x => !string.IsNullOrEmpty(x.MonitorInfo)); |
| | | if (working != null) |
| | | { |
| | | var helper = GetMonitorValueHelper(); |
| | | helper.Reset(working.MonitorInfo); |
| | | } |
| | | |
| | | } |
| | | |
| | | #endregion |
| | |
| | | return _workingCheckedListHelper; |
| | | } |
| | | |
| | | //获取工况列表 |
| | | private List<HydroWorkingVmo> GetWorkingList() |
| | | { |
| | | var helper = GetWorkingCheckedListHelper(); |
| | | return helper.GetWorkingList(); |
| | | } |
| | | |
| | | //更新工况选择列表 |
| | | public void UpdateWorkingCheckedList(HydroWorkingVmo working) |
| | | { |
| | |
| | | return; |
| | | } |
| | | var dlg = new SimulationSingleWorkingEnergyDlg(); |
| | | dlg.SetBindingData(workingHelper.HydroInfo, workingHelper.CalcuResult); |
| | | dlg.SetBindingData(workingHelper.Working, workingHelper.HydroInfo, workingHelper.CalcuResult); |
| | | dlg.ShowDialog(); |
| | | } |
| | | else |
| | | { |
| | | |
| | | var dlg = new SimulationMultiWorkingEnergyDlg(); |
| | | dlg.SetBindingData(_hydroInfo, allCheckedWorkingList); |
| | | dlg.ShowDialog(); |
| | |
| | | { |
| | | if (_visual == null) |
| | | { |
| | | TipFormHelper.ShowWarn("请选择构件后重试!"); |
| | | return; |
| | | var sources = GetSourceList(); |
| | | if (sources != null) |
| | | { |
| | | if (sources.Count == 1) |
| | | { |
| | | SelectVisual(sources[0], eVisualSource.None); |
| | | } |
| | | else |
| | | { |
| | | var source = sources.FirstOrDefault(x => x.Flags.Contains(HStation.Xhs.Flags.进口)); |
| | | if (source != null) |
| | | { |
| | | SelectVisual(source, eVisualSource.None); |
| | | } |
| | | } |
| | | } |
| | | if (_visual == null) |
| | | { |
| | | TipFormHelper.ShowWarn("请选择构件后重试!"); |
| | | return; |
| | | } |
| | | } |
| | | HydroVisualInfo visual = _visual; |
| | | if (_visual is HydroLinkInfo linkInfo) |
| | |
| | | return; |
| | | } |
| | | var dlg = new HydroSingleWorkingLossCurveDlg(); |
| | | dlg.HydroClickEvent += (code) => |
| | | { |
| | | SelectVisual(code, eVisualSource.None); |
| | | }; |
| | | dlg.SetBindingData(workingHelper.HydroInfo, workingHelper.CalcuResult, visual); |
| | | dlg.ShowDialog(); |
| | | } |
| | | else |
| | | { |
| | | var dlg = new HydroMultiWorkingLossCurveDlg(); |
| | | dlg.HydroClickEvent += (code) => |
| | | { |
| | | SelectVisual(code, eVisualSource.None); |
| | | }; |
| | | dlg.SetBindingData(_hydroInfo, allCheckedWorkingList, visual); |
| | | dlg.ShowDialog(); |
| | | } |
| | |
| | | { |
| | | if (_visual == null) |
| | | { |
| | | TipFormHelper.ShowWarn("请选择构件后重试!"); |
| | | return; |
| | | var sources = GetSourceList(); |
| | | if (sources != null) |
| | | { |
| | | if (sources.Count == 1) |
| | | { |
| | | SelectVisual(sources[0], eVisualSource.None); |
| | | } |
| | | else |
| | | { |
| | | var source = sources.FirstOrDefault(x => x.Flags.Contains(HStation.Xhs.Flags.进口)); |
| | | if (source != null) |
| | | { |
| | | SelectVisual(source, eVisualSource.None); |
| | | } |
| | | } |
| | | } |
| | | if (_visual == null) |
| | | { |
| | | TipFormHelper.ShowWarn("请选择构件后重试!"); |
| | | return; |
| | | } |
| | | } |
| | | HydroVisualInfo visual = _visual; |
| | | if (_visual is HydroLinkInfo linkInfo) |