| | |
| | | global using Yw.EPAnet; |
| | | using DevExpress.CodeParser; |
| | | using DevExpress.Mvvm.Native; |
| | | using DevExpress.Office.Utils; |
| | | using DevExpress.Utils.Extensions; |
| | |
| | | using DevExpress.XtraRichEdit.Layout; |
| | | using DevExpress.XtraSpreadsheet.Commands; |
| | | using HStation.WinFrmUI.PhartRelation; |
| | | using NPOI.SS.Formula.Functions; |
| | | using System.Diagnostics; |
| | | using System.Windows.Media; |
| | | using System.Windows.Media.Media3D; |
| | | using Yw.Hydro; |
| | | using Yw.Model; |
| | | using Yw.Pump; |
| | | using Yw.Vmo; |
| | | using Yw.WinFrmUI.Bimface; |
| | |
| | | { |
| | | return; |
| | | } |
| | | ApplyGrading(); |
| | | }; |
| | | _bimfaceCtrl.HydroMouseLeftClickEvent += (obj) => |
| | | {//鼠标左键点击事件 |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 可见列表 |
| | | |
| | | //所有可视字典 |
| | | private Dictionary<string, HydroVisualInfo> _allVisualDict = null; |
| | | |
| | | //获取可视字典 |
| | | private Dictionary<string, HydroVisualInfo> GetVisualDict() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_allVisualDict == null) |
| | | { |
| | | _allVisualDict = new Dictionary<string, HydroVisualInfo>(); |
| | | var allVisualList = _hydroInfo.GetAllVisuals(); |
| | | allVisualList?.ForEach(x => _allVisualDict.Add(x.Code, x)); |
| | | } |
| | | return _allVisualDict; |
| | | } |
| | | |
| | | //获取可视列表 |
| | | private List<HydroVisualInfo> GetVisualList() |
| | | { |
| | | var allVisualDict = GetVisualDict(); |
| | | return allVisualDict?.Values.ToList(); |
| | | } |
| | | |
| | | //获取节点列表 |
| | | private List<HydroNodeInfo> GetNodeList() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | return _hydroInfo.GetAllNodes(); |
| | | } |
| | | |
| | | //获取管段列表 |
| | | private List<HydroLinkInfo> GetLinkList() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | return _hydroInfo.GetAllLinks(); |
| | | } |
| | | |
| | | //获取可视构件 |
| | | private HydroVisualInfo GetVisual(string code) |
| | | { |
| | | var allVisualDict = GetVisualDict(); |
| | | if (allVisualDict == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (allVisualDict.ContainsKey(code)) |
| | | { |
| | | return allVisualDict[code]; |
| | | } |
| | | return default; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 计算结果 |
| | | |
| | | //计算结果 |
| | | private HydroCalcuResult _calcuResult = null; |
| | | |
| | | //获取计算结果 |
| | | private HydroCalcuResult GetCalcuResult(string calcuMode, bool needCalcuAgain = false) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (needCalcuAgain) |
| | | { |
| | | _calcuResult = _hydroInfo.Calcu(calcuMode); |
| | | } |
| | | if (_calcuResult == null) |
| | | { |
| | | _calcuResult = _hydroInfo.Calcu(calcuMode); |
| | | } |
| | | return _calcuResult; |
| | | } |
| | | |
| | | //获取可视组件计算结果列表 |
| | | private List<HydroCalcuVisualResult> GetCalcuVisualResultList(string calcuMode, bool needCalcuAgain = false) |
| | | { |
| | | var calcuResult = GetCalcuResult(calcuMode, needCalcuAgain); |
| | | if (calcuResult == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (!calcuResult.Succeed) |
| | | { |
| | | return default; |
| | | } |
| | | return calcuResult.GetVisualList(); |
| | | } |
| | | |
| | | //获取节点计算结果列表 |
| | | private List<HydroCalcuNodeResult> GetCalcuNodeResultList(string calcuMode, bool needCalcuAgain = false) |
| | | { |
| | | var calcuResult = GetCalcuResult(calcuMode, needCalcuAgain); |
| | | if (calcuResult == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (!calcuResult.Succeed) |
| | | { |
| | | return default; |
| | | } |
| | | return calcuResult.NodeList; |
| | | } |
| | | |
| | | //获取管段计算结果列表 |
| | | private List<HydroCalcuLinkResult> GetCalcuLinkResultList(string calcuMode, bool needCalcuAgain = false) |
| | | { |
| | | var calcuResult = GetCalcuResult(calcuMode, needCalcuAgain); |
| | | if (calcuResult == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (!calcuResult.Succeed) |
| | | { |
| | | return default; |
| | | } |
| | | return calcuResult.LinkList; |
| | | } |
| | | |
| | | //所有可见计算字典 |
| | | private Dictionary<string, HydroCalcuVisualResult> _allCalcuVisualDict = null; |
| | | |
| | | //获取可见计算字典 |
| | | private Dictionary<string, HydroCalcuVisualResult> GetCalcuVisualDict(string calcuMode, bool needCalcuAgain = false) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | var allCalcuVisualResultList = GetCalcuVisualResultList(calcuMode, needCalcuAgain); |
| | | if (needCalcuAgain) |
| | | { |
| | | _allCalcuVisualDict = new Dictionary<string, HydroCalcuVisualResult>(); |
| | | allCalcuVisualResultList?.ForEach(x => _allCalcuVisualDict.Add(x.Code, x)); |
| | | } |
| | | if (_allCalcuVisualDict == null) |
| | | { |
| | | _allCalcuVisualDict = new Dictionary<string, HydroCalcuVisualResult>(); |
| | | allCalcuVisualResultList?.ForEach(x => _allCalcuVisualDict.Add(x.Code, x)); |
| | | } |
| | | return _allCalcuVisualDict; |
| | | } |
| | | |
| | | //获取可见计算结果 |
| | | private HydroCalcuVisualResult GetCalcuVisualResult(string code, string calcuMode = Yw.EPAnet.CalcuMode.MinorLoss, bool needCalcuAgain = false) |
| | | { |
| | | var allCalcuVisualDict = GetCalcuVisualDict(calcuMode, needCalcuAgain); |
| | | if (allCalcuVisualDict == null || allCalcuVisualDict.Count < 1) |
| | | { |
| | | return default; |
| | | } |
| | | if (allCalcuVisualDict.ContainsKey(code)) |
| | | { |
| | | return allCalcuVisualDict[code]; |
| | | } |
| | | return default; |
| | | } |
| | | |
| | | //获取可见计算结果 |
| | | private HydroCalcuVisualResult GetCalcuVisualResult(Yw.Model.HydroVisualInfo visual, string calcuMode = Yw.EPAnet.CalcuMode.MinorLoss, bool needCalcuAgain = false) |
| | | { |
| | | return GetCalcuVisualResult(visual?.Code, calcuMode, needCalcuAgain); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 可见视图列表 |
| | | |
| | | //所有可见视图字典 |
| | | private Dictionary<string, HydroVisualViewModel> _allVisualViewModelDict = null; |
| | | |
| | | //获取可见视图字典 |
| | | private Dictionary<string, HydroVisualViewModel> GetVisualViewModelDict() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_allVisualViewModelDict == null) |
| | | { |
| | | _allVisualViewModelDict = new Dictionary<string, HydroVisualViewModel>(); |
| | | var allVisualDict = GetVisualDict(); |
| | | if (allVisualDict != null && allVisualDict.Count > 0) |
| | | { |
| | | foreach (var visualKeyValue in allVisualDict) |
| | | { |
| | | var vm = HydroVisualViewModelBuilder.CreateVisualViewModel(visualKeyValue.Value, _hydroInfo); |
| | | var calcuVisualResult = GetCalcuVisualResult(visualKeyValue.Key); |
| | | if (calcuVisualResult != null) |
| | | { |
| | | vm.UpdateCalcuProperty(calcuVisualResult); |
| | | } |
| | | _allVisualViewModelDict.Add(visualKeyValue.Key, vm); |
| | | } |
| | | } |
| | | } |
| | | return _allVisualViewModelDict; |
| | | } |
| | | |
| | | //获取可见视图列表 |
| | | private List<HydroVisualViewModel> GetVisualViewModelList() |
| | | { |
| | | var allVisualViewModelDict = GetVisualViewModelDict(); |
| | | return allVisualViewModelDict?.Values.ToList(); |
| | | } |
| | | |
| | | //更新可见视图属性 |
| | | private void UpdateVisualViewModelProperty() |
| | | { |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | allVisualViewModelList?.ForEach(x => x.UpdateProperty()); |
| | | } |
| | | |
| | | //更新可见视图属性 |
| | | private void UpdateVisualViewModelProperty(string code) |
| | | { |
| | | var allVisualViewModelDict = GetVisualViewModelDict(); |
| | | if (allVisualViewModelDict != null && allVisualViewModelDict.Count > 0) |
| | | { |
| | | if (allVisualViewModelDict.ContainsKey(code)) |
| | | { |
| | | allVisualViewModelDict[code].UpdateProperty(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //更新可见视图属性 |
| | | private void UpdateVisualViewModelProperty(List<string> codes) |
| | | { |
| | | codes?.ForEach(x => UpdateVisualViewModelProperty(x)); |
| | | } |
| | | |
| | | //更新可见视图属性 |
| | | private void UpdateVisualViewModelProperty(List<HydroVisualInfo> visualList) |
| | | { |
| | | visualList?.ForEach(x => UpdateVisualViewModelProperty(x.Code)); |
| | | } |
| | | |
| | | //更新可见视图计算属性 |
| | | private void UpdateVisualViewModelCalcuProperty() |
| | | { |
| | | var allVisualViewModelDict = GetVisualViewModelDict(); |
| | | if (allVisualViewModelDict != null && allVisualViewModelDict.Count > 0) |
| | | { |
| | | foreach (var visualViewModelKeyValue in allVisualViewModelDict) |
| | | { |
| | | var calcuVisualResult = GetCalcuVisualResult(visualViewModelKeyValue.Key); |
| | | if (calcuVisualResult != null) |
| | | { |
| | | visualViewModelKeyValue.Value.UpdateCalcuProperty(calcuVisualResult); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | //获取可见视图 |
| | | private HydroVisualViewModel GetVisualViewModel(string code) |
| | | { |
| | | if (string.IsNullOrEmpty(code)) |
| | | { |
| | | return default; |
| | | } |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | return allVisualViewModelList?.Find(x => x.Code == code); |
| | | } |
| | | |
| | | //获取可见视图 |
| | | private HydroVisualViewModel GetVisualViewModel(Yw.Model.HydroVisualInfo visual) |
| | | { |
| | | return GetVisualViewModel(visual?.Code); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 选择构件 |
| | | |
| | | //选择构件 |
| | | private Yw.Model.HydroVisualInfo _selectedVisual = null; |
| | | |
| | | //选择构件 |
| | | private Yw.Model.HydroVisualInfo SelectedVisual |
| | | { |
| | | get { return _selectedVisual; } |
| | | set |
| | | { |
| | | |
| | | _selectedVisual = value; |
| | | this.barBtnSetMonitor.Enabled = _selectedVisual != null; |
| | | } |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #region 属性控件 |
| | | |
| | | //属性控件 |
| | |
| | | { |
| | | _propertyCtrl = new XhsProjectSimulationPropertyCtrl(); |
| | | _propertyCtrl.Dock = DockStyle.Fill; |
| | | _propertyCtrl.InitialData(() => _hydroInfo, () => GetCalcuResultList()); |
| | | _propertyCtrl.BlinkLinkParterEvent += async (code, linkCode) => |
| | | { //强调连接组件 |
| | | if (string.IsNullOrEmpty(code)) |
| | | _propertyCtrl.HydroViewEvent += (visual) => |
| | | { |
| | | if (visual == null) |
| | | { |
| | | return; |
| | | } |
| | | if (string.IsNullOrEmpty(linkCode)) |
| | | { |
| | | return; |
| | | } |
| | | _bimfaceCtrl?.ZoomToComponent(visual.Code); |
| | | }; |
| | | _propertyCtrl.BlinkLinkNodeEvent += async (link, linkNodeCode) => |
| | | { //强调连接节点 |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allVisualList = _hydroInfo.GetAllVisuals(); |
| | | if (allVisualList == null || allVisualList.Count < 1) |
| | | if (link == null) |
| | | { |
| | | return; |
| | | } |
| | | var linkParter = allVisualList.Find(x => x.Code == linkCode); |
| | | if (linkParter == null) |
| | | if (string.IsNullOrEmpty(linkNodeCode)) |
| | | { |
| | | return; |
| | | } |
| | | var linkNode = GetVisual(linkNodeCode); |
| | | if (linkNode == null) |
| | | { |
| | | return; |
| | | } |
| | | var blinkCodes = new List<string>(); |
| | | if (linkParter.GetType() == typeof(Yw.Model.HydroJunctionInfo)) |
| | | if (linkNode.GetType() == typeof(HydroJunctionInfo)) |
| | | { |
| | | var allLinkList = _hydroInfo.GetAllLinks(); |
| | | var allLinkList = GetLinkList(); |
| | | if (allLinkList == null || allLinkList.Count < 1) |
| | | { |
| | | return; |
| | | } |
| | | var linkList = allLinkList.Where(x => (x.StartCode == linkParter.Code || x.EndCode == linkParter.Code) && x.Code != code).ToList(); |
| | | var linkList = allLinkList.Where(x => (x.StartCode == linkNodeCode || x.EndCode == linkNodeCode) && x.Code != linkNodeCode).ToList(); |
| | | if (linkList == null || linkList.Count < 1) |
| | | { |
| | | return; |
| | |
| | | } |
| | | else |
| | | { |
| | | blinkCodes.Add(linkCode); |
| | | blinkCodes.Add(linkNodeCode); |
| | | } |
| | | |
| | | await _bimfaceCtrl?.ClearBlinkComponents(); |
| | | await _bimfaceCtrl?.SetBlinkComponents(blinkCodes); |
| | | await Task.Delay(5000); |
| | | await _bimfaceCtrl?.ClearBlinkComponents(); |
| | | }; |
| | | |
| | | _propertyCtrl.ViewParterEvent += (parter) => |
| | | _propertyCtrl.PropertyValueChangedEvent += (visual) => |
| | | { |
| | | if (parter == null) |
| | | { |
| | | return; |
| | | } |
| | | _bimfaceCtrl?.ZoomToComponent(parter.Code); |
| | | }; |
| | | _propertyCtrl.PropertyValueChangedEvent += (parter) => |
| | | { |
| | | if (parter == null) |
| | | if (visual == null) |
| | | { |
| | | return; |
| | | } |
| | | UpdateVisualListCtrl(); |
| | | AutoApplyGrading(); |
| | | //ApplyGradingResultList(visual); |
| | | }; |
| | | _propertyCtrl.MarkPropertyValueChangedEvent += (parter) => |
| | | _propertyCtrl.MarkPropertyValueChangedEvent += (visual) => |
| | | { |
| | | //标注属性发生改变 |
| | | //判断当前是否有标注展示,若有则更新标注,最好是更新单个标注 |
| | | //UpdateMark(visual); |
| | | }; |
| | | _propertyCtrl.GradingPropertyValueChangedEvent += (parter) => |
| | | { |
| | | //分级属性发生改变 |
| | | //判断当前是否有分级展示,若有则更新分级,最好是更新单个分级 |
| | | }; |
| | | _propertyCtrl.FlowDirectionPropertyValueChangedEvent += async (parter) => |
| | | _propertyCtrl.FlowEffectPropertyValueChangedEvent += (visual) => |
| | | { |
| | | //流向属性发生改变 |
| | | //判断流向是否加载,如果加载则更新流向,最好是更新单个流向 |
| | | UpdateFlowEffect(parter); |
| | | //await _bimfaceCtrl?.UnloadFlowEffectById(parter.Code); |
| | | //UpdateFlowEffect(visual); |
| | | }; |
| | | |
| | | } |
| | |
| | | _propertyCtrl?.UpdateRows(); |
| | | } |
| | | |
| | | //设置属性控件 |
| | | private void SetPropertyCtrl(Yw.Model.HydroVisualInfo visual) |
| | | { |
| | | if (visual == null) |
| | | { |
| | | |
| | | } |
| | | } |
| | | |
| | | //更新属性控件 |
| | | private void UpdatePropertyCtrl() |
| | | { |
| | | _propertyCtrl?.UpdateRows(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | #region 自动匹配 |
| | | |
| | |
| | | } |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | var matchingListCtrl = GetMatchingListCtrl(); |
| | | var input = AssetsMatchingParasHelper.Create(_hydroInfo, GetCalcuResultList()); |
| | | var input = AssetsMatchingParasHelper.Create(_hydroInfo, GetCalcuVisualResultList(Yw.EPAnet.CalcuMode.MinorLoss, false)); |
| | | matchingListCtrl.SetBindingData(input); |
| | | this.controlContainerBottom.Controls.Add(matchingListCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | #region 保存信息 |
| | | |
| | | //保存 |
| | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | #region 批量配置 |
| | | |
| | |
| | | { |
| | | return; |
| | | } |
| | | var allCalcuResultList = GetCalcuResultList(); |
| | | var allCalcuResultList = GetCalcuVisualResultList(Yw.EPAnet.CalcuMode.MinorLoss, false); |
| | | var vmList = new List<XhsSinglePumpViewModel>(); |
| | | foreach (var pump in _hydroInfo.Pumps) |
| | | { |
| | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | #region 构件查询 |
| | | |
| | |
| | | |
| | | #region 模型标注 |
| | | |
| | | #region 标注设置 |
| | | |
| | | //所有标注设置列表 |
| | | private List<HydroMarkSetViewModel> _allMarkSetList = null; |
| | | |
| | | //获取标注设置列表 |
| | | private List<HydroMarkSetViewModel> GetMarkSetList() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_allMarkSetList == null) |
| | | { |
| | | _allMarkSetList = new List<HydroMarkSetViewModel>(); |
| | | if (_hydroInfo.Waterboxs != null && _hydroInfo.Waterboxs.Count > 0) |
| | | { |
| | | _allMarkSetList.Add(new HydroMarkSetViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Waterbox, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetName(Yw.Hydro.ParterCatalog.Waterbox), |
| | | MarkType = (int)eWaterboxMarkType.None |
| | | }); |
| | | } |
| | | if (_hydroInfo.Pumps != null && _hydroInfo.Pumps.Count > 0) |
| | | { |
| | | _allMarkSetList.Add(new HydroMarkSetViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Pump, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetName(Yw.Hydro.ParterCatalog.Pump), |
| | | MarkType = (int)eWaterboxMarkType.None |
| | | }); |
| | | } |
| | | if (_hydroInfo.Valves != null && _hydroInfo.Valves.Count > 0) |
| | | { |
| | | _allMarkSetList.Add(new HydroMarkSetViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Valve, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetName(Yw.Hydro.ParterCatalog.Valve), |
| | | MarkType = (int)eWaterboxMarkType.None |
| | | }); |
| | | } |
| | | if (_hydroInfo.Pipes != null && _hydroInfo.Pipes.Count > 0) |
| | | { |
| | | _allMarkSetList.Add(new HydroMarkSetViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Pipe, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetName(Yw.Hydro.ParterCatalog.Pipe), |
| | | MarkType = (int)eWaterboxMarkType.None |
| | | }); |
| | | } |
| | | if (_hydroInfo.Nozzles != null && _hydroInfo.Nozzles.Count > 0) |
| | | { |
| | | _allMarkSetList.Add(new HydroMarkSetViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Nozzle, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetName(Yw.Hydro.ParterCatalog.Nozzle), |
| | | MarkType = (int)eWaterboxMarkType.None |
| | | }); |
| | | } |
| | | _allMarkSetList = HydroMarkHelper.GetSetList(_hydroInfo); |
| | | } |
| | | return _allMarkSetList; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 标注结果 |
| | | |
| | | //所有标注结果列表 |
| | | private List<HydroMarkResultViewModel> _allMarkResultList = null; |
| | | |
| | | //获取标注结果列表 |
| | | private List<HydroMarkResultViewModel> GetMarkResultList() |
| | | //UseCache 是否使用缓存 |
| | | private List<HydroMarkResultViewModel> GetMarkResultList(bool useCache = true) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | _allMarkResultList = new List<HydroMarkResultViewModel>(); |
| | | var allMarkSetList = GetMarkSetList(); |
| | | foreach (var markSet in allMarkSetList) |
| | | if (!useCache) |
| | | { |
| | | switch (markSet.Code) |
| | | { |
| | | case Yw.Hydro.ParterCatalog.Waterbox: |
| | | { |
| | | if (_hydroInfo.Waterboxs != null && _hydroInfo.Waterboxs.Count > 0) |
| | | { |
| | | switch ((eWaterboxMarkType)markSet.MarkType) |
| | | { |
| | | case eWaterboxMarkType.None: |
| | | { |
| | | |
| | | } |
| | | break; |
| | | case eWaterboxMarkType.PoolElev: |
| | | { |
| | | _hydroInfo.Waterboxs.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"池底标高:{Math.Round(t.PoolElev, 4)}m" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | case eWaterboxMarkType.InitLevel: |
| | | { |
| | | _hydroInfo.Waterboxs.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"初始水位:{Math.Round(t.InitLevel, 4)}m" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | case eWaterboxMarkType.MinLevel: |
| | | { |
| | | _hydroInfo.Waterboxs.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"最小水位:{Math.Round(t.MinLevel, 4)}m" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | case eWaterboxMarkType.MaxLevel: |
| | | { |
| | | _hydroInfo.Waterboxs.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"最高水位:{Math.Round(t.MaxLevel, 4)}m" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | case eWaterboxMarkType.DN: |
| | | { |
| | | _hydroInfo.Waterboxs.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"直径:{Math.Round(t.DN, 4)}m" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | case eWaterboxMarkType.MinVol: |
| | | { |
| | | _hydroInfo.Waterboxs.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"最小容积:{Math.Round(t.MinVol, 1)}m" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterCatalog.Pump: |
| | | { |
| | | if (_hydroInfo.Pumps != null && _hydroInfo.Pumps.Count > 0) |
| | | { |
| | | switch ((ePumpMarkType)markSet.MarkType) |
| | | { |
| | | case ePumpMarkType.None: |
| | | { |
| | | |
| | | } |
| | | break; |
| | | case ePumpMarkType.PumpStatus: |
| | | { |
| | | _hydroInfo.Pumps.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"开机状态:{Yw.WinFrmUI.HydroLinkStatusHelper.GetStatusName(t.LinkStatus)}" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | case ePumpMarkType.RatedP: |
| | | { |
| | | _hydroInfo.Pumps.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"额定功率:{t.RatedP}kW" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | case ePumpMarkType.RatedQ: |
| | | { |
| | | _hydroInfo.Pumps.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"额定流量:{t.RatedQ}m³/h" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | case ePumpMarkType.RatedH: |
| | | { |
| | | _hydroInfo.Pumps.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"额定扬程:{t.RatedH}m" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | case ePumpMarkType.RatedN: |
| | | { |
| | | _hydroInfo.Pumps.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"额定转速:{t.RatedN}r/min" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | case ePumpMarkType.RatedHz: |
| | | { |
| | | _hydroInfo.Pumps.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"额定频率:{t.RatedHz}" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | case ePumpMarkType.CurrentN: |
| | | { |
| | | _hydroInfo.Pumps.ForEach(t => |
| | | { |
| | | if (t.RatedN.HasValue) |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"设定转速:{Math.Round(t.RatedN.Value * t.SpeedRatio, 1)}r/min" |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | break; |
| | | case ePumpMarkType.CurrentHz: |
| | | { |
| | | _hydroInfo.Pumps.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"设定频率:{Math.Round(t.RatedHz * t.SpeedRatio, 1)}hz" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterCatalog.Valve: |
| | | { |
| | | if (_hydroInfo.Valves != null && _hydroInfo.Valves.Count > 0) |
| | | { |
| | | switch ((eValveMarkType)markSet.MarkType) |
| | | { |
| | | case eValveMarkType.None: |
| | | { |
| | | |
| | | } |
| | | break; |
| | | case eValveMarkType.ValveStatus: |
| | | { |
| | | _hydroInfo.Valves.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"阀门状态:{HydroLinkStatusHelper.GetStatusName(t.LinkStatus)}" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | case eValveMarkType.ValveType: |
| | | { |
| | | _hydroInfo.Valves.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"阀门类型:{HydroValveTypeHelper.GetTypeName(t.ValveType)}" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | case eValveMarkType.Diameter: |
| | | { |
| | | _hydroInfo.Valves.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"直径:{t.Diameter}mm" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | case eValveMarkType.MinorLoss: |
| | | { |
| | | _hydroInfo.Valves.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"局阻系数:{t.MinorLoss}" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterCatalog.Pipe: |
| | | { |
| | | if (_hydroInfo.Pipes != null && _hydroInfo.Pipes.Count > 0) |
| | | { |
| | | switch ((ePipeMarkType)markSet.MarkType) |
| | | { |
| | | case ePipeMarkType.None: |
| | | { |
| | | |
| | | } |
| | | break; |
| | | case ePipeMarkType.PipeStatus: |
| | | { |
| | | _hydroInfo.Pipes.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"状态:{Yw.WinFrmUI.HydroLinkStatusHelper.GetStatusName(t.LinkStatus)}" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | case ePipeMarkType.Diameter: |
| | | { |
| | | _hydroInfo.Pipes.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"直径:{t.Diameter}mm" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | case ePipeMarkType.Length: |
| | | { |
| | | _hydroInfo.Pipes.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"长度:{t.Length}m" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | case ePipeMarkType.Roughness: |
| | | { |
| | | _hydroInfo.Pipes.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"粗糙系数:{t.Roughness}" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | case ePipeMarkType.MinorLoss: |
| | | { |
| | | _hydroInfo.Pipes.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"局阻系数:{t.MinorLoss}" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterCatalog.Nozzle: |
| | | { |
| | | if (_hydroInfo.Nozzles != null && _hydroInfo.Nozzles.Count > 0) |
| | | { |
| | | switch ((eNozzleMarkType)markSet.MarkType) |
| | | { |
| | | case eNozzleMarkType.None: |
| | | { |
| | | |
| | | } |
| | | break; |
| | | case eNozzleMarkType.Elev: |
| | | { |
| | | _hydroInfo.Nozzles.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"标高:{Math.Round(t.Elev, 4)}m" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | case eNozzleMarkType.Demand: |
| | | { |
| | | _hydroInfo.Nozzles.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"需水量:{t.Demand}m³/h" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | case eNozzleMarkType.Coefficient: |
| | | { |
| | | _hydroInfo.Nozzles.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"喷射系数:{t.Coefficient}" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | var allSetList = GetMarkSetList(); |
| | | _allMarkResultList = HydroMarkHelper.GetResultList(_hydroInfo, allSetList); |
| | | } |
| | | if (_allMarkResultList == null) |
| | | { |
| | | var allSetList = GetMarkSetList(); |
| | | _allMarkResultList = HydroMarkHelper.GetResultList(_hydroInfo, allSetList); |
| | | } |
| | | return _allMarkResultList; |
| | | } |
| | | |
| | | //应用标注结果列表 |
| | | private async Task ApplyMarkResultList() |
| | | { |
| | | var allMarkResultList = GetMarkResultList(); |
| | | var leadLabels = allMarkResultList?.Select(x => new LogicMarkLeadLabel(x.Code, x.Text, 100000)).ToList(); |
| | | await _bimfaceCtrl?.SetLogicMarkLeadLabels(leadLabels); |
| | | TipFormHelper.ShowSucceed("标注信息已设置"); |
| | | } |
| | | #endregion |
| | | |
| | | //清除标注结果列表 |
| | | private async Task ClearMarkResultList() |
| | | #region 标注显示 |
| | | |
| | | //标注是否显示 |
| | | private bool _isMarkVisible = false; |
| | | |
| | | //更新标注 |
| | | private async void UpdateMark(Yw.Model.HydroVisualInfo visual) |
| | | { |
| | | if (_allMarkResultList == null || _allMarkResultList.Count < 1) |
| | | var allSetList = GetMarkSetList(); |
| | | var result = HydroMarkHelper.GetResult(visual, allSetList); |
| | | if (result == null) |
| | | { |
| | | TipFormHelper.ShowWarn("尚未设置标注信息"); |
| | | return; |
| | | } |
| | | _allMarkResultList = null; |
| | | await _bimfaceCtrl?.ClearLogicMarkLeadLabels(); |
| | | TipFormHelper.ShowSucceed("标注信息已清除"); |
| | | var allResultList = GetMarkResultList(true); |
| | | allResultList.Remove(x => x.Code == visual.Code); |
| | | allResultList.Add(result); |
| | | if (_isMarkVisible) |
| | | { |
| | | var leadLabel = new LogicMarkLeadLabel() { Id = result.Code, Text = result.Text, Distance = null }; |
| | | await _bimfaceCtrl?.UpdateLogicMarkLeadLabel(leadLabel); |
| | | } |
| | | } |
| | | |
| | | //更新标注列表 |
| | | private void UpdateMarkList(List<Yw.Model.HydroVisualInfo> visuals) |
| | | { |
| | | if (visuals == null || visuals.Count < 1) |
| | | { |
| | | visuals.ForEach(x => UpdateMark(x)); |
| | | } |
| | | } |
| | | |
| | | //应用标注列表 |
| | | //UseCache 是否使用缓存 |
| | | private async void ApplyMarkList(bool useCache = true) |
| | | { |
| | | if (_isMarkVisible) |
| | | { |
| | | var allResultList = GetMarkResultList(useCache); |
| | | var leadLabels = allResultList?.Select(x => new LogicMarkLeadLabel(x.Code, x.Text, null)).ToList(); |
| | | await _bimfaceCtrl?.SetLogicMarkLeadLabels(leadLabels); |
| | | } |
| | | else |
| | | { |
| | | await _bimfaceCtrl?.ClearLogicMarkLeadLabels(); |
| | | } |
| | | } |
| | | |
| | | //显示标注设置窗体 |
| | | private void ShowMarkSetDlg() |
| | | private void ShowSetMarkDlg() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | |
| | | var allMarkSetList = GetMarkSetList(); |
| | | var dlg = new SetHydroMarkDlg(); |
| | | dlg.SetBindingData(allMarkSetList); |
| | | dlg.ReloadDataEvent += async (list) => |
| | | dlg.ReloadDataEvent += (list) => |
| | | { |
| | | _allMarkSetList = list; |
| | | await ApplyMarkResultList(); |
| | | ApplyMarkList(false); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | |
| | | //设置标注 |
| | | private void barBtnSetMark_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowMarkSetDlg(); |
| | | ShowSetMarkDlg(); |
| | | } |
| | | |
| | | //清除标注 |
| | | private async void barBtnClearMark_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | await ClearMarkResultList(); |
| | | } |
| | | |
| | | |
| | | #region 标注显示 |
| | | |
| | | //是否显示 |
| | | private void barCkMark_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | |
| | | _isMarkVisible = this.barCkMark.Checked; |
| | | ApplyMarkList(true); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | |
| | | #region 颜色配置 |
| | | |
| | | //所有分级列表 |
| | | //所有颜色分级配置列表 |
| | | private List<HydroGradingVmo> _allGradingList = null; |
| | | |
| | | //获取分级列表 |
| | | //获取颜色分级配置列表 |
| | | private async Task<List<HydroGradingVmo>> GetGradingList() |
| | | { |
| | | if (_hydroInfo == null) |
| | |
| | | } |
| | | if (_allGradingList == null) |
| | | { |
| | | _allGradingList = await BLLFactory<Yw.BLL.HydroGrading>.Instance.GetByModelID(_hydroInfo.ID); |
| | | if (_allGradingList == null || _allGradingList.Count < 1) |
| | | { |
| | | var config = Yw.Settings.HydroParasHelper.Hydro.Grading; |
| | | if (config != null && config.Items != null && config.Items.Count > 0) |
| | | { |
| | | _allGradingList = new List<HydroGradingVmo>(); |
| | | config.Items.ForEach(x => |
| | | { |
| | | var vmo = new HydroGradingVmo() |
| | | { |
| | | ModelID = _hydroInfo.ID, |
| | | Catalog = x.Catalog, |
| | | PropName = x.PropName, |
| | | SetValue = x.SetValue, |
| | | MinValue = x.MinValue, |
| | | MaxValue = x.MaxValue, |
| | | Color = x.Color, |
| | | SortCode = config.Items.IndexOf(x) |
| | | }; |
| | | _allGradingList.Add(vmo); |
| | | }); |
| | | } |
| | | } |
| | | _allGradingList = await HydroGradingHelper.GetGradingList(_hydroInfo); |
| | | } |
| | | return _allGradingList; |
| | | } |
| | | |
| | | //显示配置颜色分级窗体 |
| | | private async void ShowSetGradingDlg() |
| | | //显示颜色分级窗体 |
| | | private async void ShowGradingDlg() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | |
| | | dlg.ReloadDataEvent += (list) => |
| | | { |
| | | _allGradingList = list; |
| | | ApplyGradingResultList(false); |
| | | }; |
| | | dlg.ApplyDataEvent += (catalog, propName) => |
| | | { |
| | | ApplyGrading(catalog, propName); |
| | | UpdateGradingApplyList(catalog, propName); |
| | | ApplyGradingResultList(false); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | |
| | | //配置颜色分级 |
| | | private void barBtnGradingSet_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowSetGradingDlg(); |
| | | ShowGradingDlg(); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | //获取颜色分级应用列表 |
| | | private List<HydroGradingApplyViewModel> GetGradingApplyList() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_allGradingApplyList == null) |
| | | { |
| | | _allGradingApplyList = new List<HydroGradingApplyViewModel>(); |
| | | |
| | | if (_hydroInfo.Pumps != null && _hydroInfo.Pumps.Count > 0) |
| | | { |
| | | _allGradingApplyList.Add(new HydroGradingApplyViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Pump, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetName(Yw.Hydro.ParterCatalog.Pump), |
| | | PropName = Yw.Hydro.ParterProp.LinkStatus |
| | | }); |
| | | } |
| | | if (_hydroInfo.Valves != null && _hydroInfo.Valves.Count > 0) |
| | | { |
| | | _allGradingApplyList.Add(new HydroGradingApplyViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Valve, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetName(Yw.Hydro.ParterCatalog.Valve), |
| | | PropName = Yw.Hydro.ParterProp.LinkStatus |
| | | }); |
| | | } |
| | | if (_hydroInfo.Pipes != null && _hydroInfo.Pipes.Count > 0) |
| | | { |
| | | _allGradingApplyList.Add(new HydroGradingApplyViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Pipe, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetName(Yw.Hydro.ParterCatalog.Pipe), |
| | | PropName = HydroVisualCalcuProp.CalcuFlow |
| | | }); |
| | | } |
| | | _allGradingApplyList = HydroGradingHelper.GetApplyList(_hydroInfo); |
| | | } |
| | | return _allGradingApplyList; |
| | | } |
| | | |
| | | //获取颜色分级应用结果列表 |
| | | private async Task<List<HydroGradingApplyResultViewModel>> GetGradingApplyResultList() |
| | | //更新颜色分级应用列表 |
| | | private void UpdateGradingApplyList(string catalog, string propName) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | //所有分级列表 |
| | | var allGradingList = await GetGradingList(); |
| | | if (allGradingList == null || allGradingList.Count < 1) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | //所有分级应用列表 |
| | | var allGradingApplyList = GetGradingApplyList(); |
| | | if (allGradingApplyList == null || allGradingApplyList.Count < 1) |
| | | { |
| | | return default; |
| | | return; |
| | | } |
| | | |
| | | //所有计算结果列表 |
| | | var allCalcuResultList = GetCalcuResultList(); |
| | | |
| | | //所有应用结果列表 |
| | | var allGradingApplyResultList = new List<HydroGradingApplyResultViewModel>(); |
| | | allGradingApplyList.ForEach(x => |
| | | { |
| | | var allCatalogGradingList = allGradingList.Where(t => t.Catalog == x.Code).ToList(); |
| | | if (allCatalogGradingList != null || allCatalogGradingList.Count > 0) |
| | | { |
| | | switch (x.Code) |
| | | { |
| | | case Yw.Hydro.ParterCatalog.Pump: |
| | | { |
| | | if (_hydroInfo.Pumps != null && _hydroInfo.Pumps.Count > 0) |
| | | { |
| | | foreach (var pump in _hydroInfo.Pumps) |
| | | { |
| | | switch (x.PropName) |
| | | { |
| | | case Yw.Hydro.ParterProp.LinkStatus: |
| | | { |
| | | var gradingList = allCatalogGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.LinkStatus).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var grading = gradingList.Meet(pump.LinkStatus); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pump.Code, |
| | | Color = grading.Color |
| | | }; |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case HydroVisualCalcuProp.CalcuFlow: |
| | | { |
| | | var gradingList = allCatalogGradingList.Where(x => x.PropName == HydroVisualCalcuProp.CalcuFlow).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pump.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuFlow.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuFlow.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pump.Code, |
| | | Color = grading.Color |
| | | }; |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case HydroVisualCalcuProp.CalcuVelocity: |
| | | { |
| | | var gradingList = allCatalogGradingList.Where(x => x.PropName == HydroVisualCalcuProp.CalcuVelocity).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pump.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuVelocity.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuVelocity.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pump.Code, |
| | | Color = grading.Color |
| | | }; |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case HydroVisualCalcuProp.CalcuHeadLoss: |
| | | { |
| | | var gradingList = allCatalogGradingList.Where(x => x.PropName == HydroVisualCalcuProp.CalcuHeadLoss).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pump.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuHeadLoss.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuHeadLoss.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pump.Code, |
| | | Color = grading.Color |
| | | }; |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterCatalog.Valve: |
| | | { |
| | | if (_hydroInfo.Valves != null && _hydroInfo.Valves.Count > 0) |
| | | { |
| | | foreach (var valve in _hydroInfo.Valves) |
| | | { |
| | | switch (x.PropName) |
| | | { |
| | | case Yw.Hydro.ParterProp.LinkStatus: |
| | | { |
| | | var gradingList = allCatalogGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.LinkStatus).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var grading = gradingList.Meet(valve.LinkStatus); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = valve.Code, |
| | | Color = grading.Color |
| | | }; |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case HydroVisualCalcuProp.CalcuFlow: |
| | | { |
| | | var gradingList = allCatalogGradingList.Where(x => x.PropName == HydroVisualCalcuProp.CalcuFlow).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == valve.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuFlow.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuFlow.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = valve.Code, |
| | | Color = grading.Color |
| | | }; |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case HydroVisualCalcuProp.CalcuVelocity: |
| | | { |
| | | var gradingList = allCatalogGradingList.Where(x => x.PropName == HydroVisualCalcuProp.CalcuVelocity).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == valve.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuVelocity.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuVelocity.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = valve.Code, |
| | | Color = grading.Color |
| | | }; |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case HydroVisualCalcuProp.CalcuHeadLoss: |
| | | { |
| | | var gradingList = allCatalogGradingList.Where(x => x.PropName == HydroVisualCalcuProp.CalcuHeadLoss).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == valve.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuHeadLoss.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuHeadLoss.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = valve.Code, |
| | | Color = grading.Color |
| | | }; |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterCatalog.Pipe: |
| | | { |
| | | if (_hydroInfo.Pipes != null && _hydroInfo.Pipes.Count > 0) |
| | | { |
| | | foreach (var pipe in _hydroInfo.Pipes) |
| | | { |
| | | switch (x.PropName) |
| | | { |
| | | case HydroVisualCalcuProp.CalcuFlow: |
| | | { |
| | | var gradingList = allCatalogGradingList.Where(x => x.PropName == HydroVisualCalcuProp.CalcuFlow).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pipe.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuFlow.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuFlow.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pipe.Code, |
| | | Color = grading.Color |
| | | }; |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case HydroVisualCalcuProp.CalcuVelocity: |
| | | { |
| | | var gradingList = allCatalogGradingList.Where(x => x.PropName == HydroVisualCalcuProp.CalcuVelocity).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pipe.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuVelocity.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuVelocity.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pipe.Code, |
| | | Color = grading.Color |
| | | }; |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case HydroVisualCalcuProp.CalcuHeadLoss: |
| | | { |
| | | var gradingList = allCatalogGradingList.Where(x => x.PropName == HydroVisualCalcuProp.CalcuHeadLoss).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pipe.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuHeadLoss.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuHeadLoss.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pipe.Code, |
| | | Color = grading.Color |
| | | }; |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | } |
| | | }); |
| | | |
| | | return allGradingApplyResultList; |
| | | } |
| | | |
| | | //获取颜色分级应用结果列表 |
| | | private async Task<List<HydroGradingApplyResultViewModel>> GetGradingApplyResultList(string catalog, string propName) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | //所有分级列表 |
| | | var allGradingList = await GetGradingList(); |
| | | if (allGradingList == null || allGradingList.Count < 1) |
| | | { |
| | | return default; |
| | | } |
| | | var currentGradingList = allGradingList.Where(x => x.Catalog == catalog).ToList(); |
| | | if (currentGradingList.Count < 1) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | //所有分级应用列表 |
| | | var allGradingApplyList = GetGradingApplyList(); |
| | | if (allGradingApplyList == null || allGradingApplyList.Count < 1) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | //当前分级应用 |
| | | var gradingApply = allGradingApplyList.Find(x => x.Code == catalog); |
| | | if (gradingApply == null) |
| | | { |
| | | return default; |
| | | } |
| | | gradingApply.PropName = propName; |
| | | |
| | | //所有计算结果 |
| | | var allCalcuResultList = GetCalcuResultList(); |
| | | |
| | | //应用结果列表 |
| | | var gradingApplyResultList = new List<HydroGradingApplyResultViewModel>(); |
| | | |
| | | switch (catalog) |
| | | { |
| | | case Yw.Hydro.ParterCatalog.Pump: |
| | | { |
| | | if (_hydroInfo.Pumps != null && _hydroInfo.Pumps.Count > 0) |
| | | { |
| | | foreach (var pump in _hydroInfo.Pumps) |
| | | { |
| | | switch (propName) |
| | | { |
| | | case Yw.Hydro.ParterProp.LinkStatus: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.LinkStatus).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var grading = gradingList.Meet(pump.LinkStatus); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pump.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case HydroVisualCalcuProp.CalcuFlow: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == HydroVisualCalcuProp.CalcuFlow).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pump.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuFlow.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuFlow.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pump.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case HydroVisualCalcuProp.CalcuVelocity: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == HydroVisualCalcuProp.CalcuVelocity).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pump.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuVelocity.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuVelocity.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pump.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case HydroVisualCalcuProp.CalcuHeadLoss: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == HydroVisualCalcuProp.CalcuHeadLoss).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pump.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuHeadLoss.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuHeadLoss.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pump.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterCatalog.Valve: |
| | | { |
| | | if (_hydroInfo.Valves != null && _hydroInfo.Valves.Count > 0) |
| | | { |
| | | foreach (var valve in _hydroInfo.Valves) |
| | | { |
| | | switch (propName) |
| | | { |
| | | case Yw.Hydro.ParterProp.LinkStatus: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.LinkStatus).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var grading = gradingList.Meet(valve.LinkStatus); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = valve.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case HydroVisualCalcuProp.CalcuFlow: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == HydroVisualCalcuProp.CalcuFlow).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == valve.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuFlow.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuFlow.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = valve.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case HydroVisualCalcuProp.CalcuVelocity: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == HydroVisualCalcuProp.CalcuVelocity).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == valve.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuVelocity.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuVelocity.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = valve.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case HydroVisualCalcuProp.CalcuHeadLoss: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == HydroVisualCalcuProp.CalcuHeadLoss).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == valve.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuHeadLoss.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuHeadLoss.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = valve.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterCatalog.Pipe: |
| | | { |
| | | if (_hydroInfo.Pipes != null && _hydroInfo.Pipes.Count > 0) |
| | | { |
| | | foreach (var pipe in _hydroInfo.Pipes) |
| | | { |
| | | switch (propName) |
| | | { |
| | | case HydroVisualCalcuProp.CalcuFlow: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == HydroVisualCalcuProp.CalcuFlow).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pipe.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuFlow.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuFlow.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pipe.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case HydroVisualCalcuProp.CalcuVelocity: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == HydroVisualCalcuProp.CalcuVelocity).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pipe.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuVelocity.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuVelocity.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pipe.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case HydroVisualCalcuProp.CalcuHeadLoss: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == HydroVisualCalcuProp.CalcuHeadLoss).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pipe.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuHeadLoss.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuHeadLoss.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pipe.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | |
| | | return gradingApplyResultList; |
| | | } |
| | | |
| | | //颜色分级是否应用了 |
| | | private bool _isGradingApply = false; |
| | | //颜色分级应用编码列表 |
| | | private List<string> _allGradingApplyCodeList = null; |
| | | |
| | | //应用颜色分级 |
| | | private async void ApplyGrading() |
| | | { |
| | | if (_hydroInfo == null) |
| | | var apply = allGradingApplyList.Find(x => x.Catalog == catalog); |
| | | if (apply == null) |
| | | { |
| | | return; |
| | | } |
| | | _isGradingApply = true; |
| | | var allGradingApplyResultList = await GetGradingApplyResultList(); |
| | | if (allGradingApplyResultList == null || allGradingApplyResultList.Count < 1) |
| | | { |
| | | CancelApplyGrading(); |
| | | return; |
| | | } |
| | | var objGroupList = allGradingApplyResultList.GroupBy(x => x.Color).ToList(); |
| | | objGroupList.ForEach(async x => |
| | | { |
| | | await _bimfaceCtrl?.OverrideComponentsColor(x.Select(t => t.Code).Distinct().ToList(), x.Key, 1); |
| | | }); |
| | | _allGradingApplyCodeList = allGradingApplyResultList.Select(x => x.Code).Distinct().ToList(); |
| | | apply.PropName = propName; |
| | | } |
| | | |
| | | //应用颜色分级 |
| | | private async void ApplyGrading(string catalog, string propName) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | _isGradingApply = true; |
| | | var allGradingApplyResultList = await GetGradingApplyResultList(catalog, propName); |
| | | if (allGradingApplyResultList == null || allGradingApplyResultList.Count < 1) |
| | | { |
| | | return; |
| | | } |
| | | var objGroupList = allGradingApplyResultList.GroupBy(x => x.Color).ToList(); |
| | | objGroupList.ForEach(async x => |
| | | { |
| | | await _bimfaceCtrl?.OverrideComponentsColor(x.Select(t => t.Code).Distinct().ToList(), x.Key, 1); |
| | | }); |
| | | var codeList = allGradingApplyResultList.Select(x => x.Code); |
| | | if (_allGradingApplyCodeList == null) |
| | | { |
| | | _allGradingApplyCodeList = new List<string>(); |
| | | } |
| | | _allGradingApplyCodeList.AddRange(codeList); |
| | | _allGradingApplyCodeList = _allGradingApplyCodeList.Distinct().ToList(); |
| | | } |
| | | |
| | | //自动应用颜色分级 |
| | | private void AutoApplyGrading() |
| | | { |
| | | if (!_isGradingApply) |
| | | { |
| | | return; |
| | | } |
| | | ApplyGrading(); |
| | | } |
| | | |
| | | //取消应用颜色分级 |
| | | private async void CancelApplyGrading() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | _isGradingApply = false; |
| | | if (_allGradingApplyCodeList != null && _allGradingApplyCodeList.Count > 0) |
| | | { |
| | | await _bimfaceCtrl?.RestoreComponentsColor(_allGradingApplyCodeList); |
| | | } |
| | | } |
| | | |
| | | //显示应用颜色分级窗体 |
| | | private void ShowApplyGradingDlg() |
| | | //显示颜色分级应用窗体 |
| | | private void ShowGradingApplyDlg() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | |
| | | dlg.ReloadDataEvent += (obj) => |
| | | { |
| | | _allGradingApplyList = obj; |
| | | ApplyGrading(); |
| | | ApplyGradingResultList(false); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | |
| | | //应用颜色分级 |
| | | private void barBtnGradingApply_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowApplyGradingDlg(); |
| | | ShowGradingApplyDlg(); |
| | | } |
| | | |
| | | //取消应用分级 |
| | | private void batBtnCancelGradingApply_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | #endregion |
| | | |
| | | #region 应用结果 |
| | | |
| | | //所有颜色分级结果列表 |
| | | private List<HydroGradingResultViewModel> _allGradingResultList = null; |
| | | |
| | | //获取颜色分级结果列表 |
| | | //UseCache是否使用缓存 |
| | | private async Task<List<HydroGradingResultViewModel>> GetGradingResultList(bool useCache = true) |
| | | { |
| | | CancelApplyGrading(); |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | var allGradingList = await GetGradingList(); |
| | | var allGradingApplyList = GetGradingApplyList(); |
| | | var allCalcuResultList = GetCalcuVisualResultList(Yw.EPAnet.CalcuMode.MinorLoss, false); |
| | | if (!useCache) |
| | | { |
| | | _allGradingResultList = HydroGradingHelper.GetResultList(_hydroInfo, allGradingList, allGradingApplyList, allCalcuResultList); |
| | | } |
| | | if (_allGradingResultList == null) |
| | | { |
| | | _allGradingResultList = HydroGradingHelper.GetResultList(_hydroInfo, allGradingList, allGradingApplyList, allCalcuResultList); |
| | | } |
| | | return _allGradingResultList; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 结果展示 |
| | | |
| | | //颜色分级是否显示 |
| | | private bool _isGradingVisible = false; |
| | | |
| | | //应用颜色分级结果列表 |
| | | //UseCache是否使用缓存 |
| | | private async void ApplyGradingResultList(bool useCache = true) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allGradingResultList = await GetGradingResultList(useCache); |
| | | if (allGradingResultList == null || allGradingResultList.Count < 1) |
| | | { |
| | | return; |
| | | } |
| | | if (_isGradingVisible) |
| | | { |
| | | var groupList = allGradingResultList.GroupBy(x => x.Color).ToList(); |
| | | groupList.ForEach(async x => await _bimfaceCtrl?.OverrideComponentsColor(x.Select(t => t.Code).Distinct().ToList(), x.Key, 1)); |
| | | } |
| | | else |
| | | { |
| | | var codes = allGradingResultList.Select(x => x.Code).Distinct().ToList(); |
| | | await _bimfaceCtrl?.RestoreComponentsColor(codes); |
| | | } |
| | | } |
| | | |
| | | //应用颜色分级结果列表 |
| | | private async void ApplyGradingResultList(Yw.Model.HydroVisualInfo visual) |
| | | { |
| | | if (visual == null) |
| | | { |
| | | return; |
| | | } |
| | | var allGradingList = await GetGradingList(); |
| | | var allGradingApplyList = GetGradingApplyList(); |
| | | var allGradingResultList = await GetGradingResultList(true); |
| | | var allCalcuResultList = GetCalcuVisualResultList(Yw.EPAnet.CalcuMode.MinorLoss, false); |
| | | var oldResult = allGradingResultList?.Find(x => x.Code == visual.Code); |
| | | if (oldResult != null) |
| | | { |
| | | allGradingResultList.Remove(oldResult); |
| | | } |
| | | var newResult = HydroGradingHelper.GetResult(visual, allGradingList, allGradingApplyList, allCalcuResultList); |
| | | if (newResult != null) |
| | | { |
| | | allGradingResultList.Add(newResult); |
| | | } |
| | | if (_isGradingVisible) |
| | | { |
| | | if (newResult == null) |
| | | { |
| | | if (oldResult != null) |
| | | { |
| | | await _bimfaceCtrl?.RestoreComponentsColor(oldResult.Code); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | await _bimfaceCtrl?.OverrideComponentsColor(newResult.Code, newResult.Color, 1); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //应用颜色分级结果列表 |
| | | private void ApplyGradingResultList(List<Yw.Model.HydroVisualInfo> visualList) |
| | | { |
| | | if (visualList == null || visualList.Count < 1) |
| | | { |
| | | return; |
| | | } |
| | | visualList.ForEach(x => ApplyGradingResultList(x)); |
| | | } |
| | | |
| | | //颜色分级展示 |
| | | private void barCkGrading_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | _isGradingVisible = this.barCkGrading.Checked; |
| | | ApplyGradingResultList(true); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | |
| | | #region 水流动画 |
| | | |
| | | //所有流向列表 |
| | | //水流动画是否可见 |
| | | private bool _isFlowEffectVisible = false; |
| | | |
| | | //所有水流动画列表 |
| | | private List<LogicFlowEffect> _allFlowEffectList = null; |
| | | |
| | | //获取流向列表 |
| | |
| | | if (_allFlowEffectList == null) |
| | | { |
| | | _allFlowEffectList = new List<LogicFlowEffect>(); |
| | | var allCalcuResultList = GetCalcuResultList(); |
| | | var allCalcuResultList = GetCalcuVisualResultList(Yw.EPAnet.CalcuMode.MinorLoss, false); |
| | | if (_hydroInfo.Pipes != null && _hydroInfo.Pipes.Count > 0) |
| | | { |
| | | foreach (var parter in _hydroInfo.Pipes) |
| | |
| | | return _allFlowEffectList; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 加载水流动画 |
| | | /// </summary> |
| | | //加载水流动画 |
| | | private async void LoadFlowEffect() |
| | | { |
| | | if (_allFlowEffectList != null) |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | |
| | | await _bimfaceCtrl?.LoadFlowEffect(allFlowEffectList); |
| | | } |
| | | |
| | | //卸载流向 |
| | | //卸载水流动画 |
| | | private async void UnloadFlowEffect() |
| | | { |
| | | if (_allFlowEffectList == null) |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | _allFlowEffectList = null; |
| | | await _bimfaceCtrl?.UnloadFlowEffect(); |
| | | } |
| | | |
| | | //更新水流动画 |
| | | private async void UpdateFlowEffect(Yw.Model.HydroParterInfo parter) |
| | | //设置水力动画 |
| | | private void SetFlowEffect() |
| | | { |
| | | if (_allFlowEffectList == null) |
| | | if (_isFlowEffectVisible) |
| | | { |
| | | LoadFlowEffect(); |
| | | } |
| | | else |
| | | { |
| | | UnloadFlowEffect(); |
| | | } |
| | | } |
| | | |
| | | //更新水流动画 |
| | | private async void UpdateFlowEffect(Yw.Model.HydroVisualInfo visual) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var visual = parter as Yw.Model.HydroVisualInfo; |
| | | if (visual == null) |
| | | { |
| | | return; |
| | | } |
| | | var flowEffect = _allFlowEffectList.Find(x => x.Id == parter.Code); |
| | | var allFlowEffectList = GetFlowEffectList(); |
| | | var flowEffect = _allFlowEffectList?.Find(x => x.Id == visual.Code); |
| | | if (flowEffect == null) |
| | | { |
| | | return; |
| | |
| | | flowEffect.SpeedY = -0.1; |
| | | } |
| | | |
| | | var allCalcuResultList = GetCalcuResultList(); |
| | | var allCalcuResultList = GetCalcuVisualResultList(Yw.EPAnet.CalcuMode.MinorLoss, false); |
| | | var calcuResult = allCalcuResultList?.Find(x => x.Code == visual.Code) as HydroCalcuLinkResult; |
| | | if (calcuResult != null) |
| | | { |
| | |
| | | flowEffect.SpeedX = -flowEffect.SpeedX; |
| | | } |
| | | } |
| | | await _bimfaceCtrl?.UpdateFlowEffect(flowEffect); |
| | | if (_isFlowEffectVisible) |
| | | { |
| | | await _bimfaceCtrl?.UpdateFlowEffect(flowEffect); |
| | | } |
| | | } |
| | | |
| | | //加载流向 |
| | | private void barBtnLoadFlowDirection_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | LoadFlowEffect(); |
| | | } |
| | | |
| | | //卸载流向 |
| | | private void barBtnUnloadFlowDirection_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | UnloadFlowEffect(); |
| | | } |
| | | |
| | | //水流动画是否可见 |
| | | private void barCkFlowEffect_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | |
| | | _isFlowEffectVisible = this.barCkFlowEffect.Checked; |
| | | SetFlowEffect(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 选择构件 |
| | | |
| | | //选择构件 |
| | | private Yw.Model.HydroVisualInfo _selectedVisual = null; |
| | | |
| | | //选择构件 |
| | | private Yw.Model.HydroVisualInfo SelectedVisual |
| | | { |
| | | get { return _selectedVisual; } |
| | | set |
| | | { |
| | | _selectedVisual = value; |
| | | if (_selectedVisual == null) |
| | | { |
| | | this.barBtnSetMonitor.Enabled = false; |
| | | } |
| | | else |
| | | { |
| | | this.barBtnSetMonitor.Enabled = true; |
| | | } |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 构件明细 |
| | | |
| | | #region 构件列表 |
| | | |
| | | //所有构件视图列表 |
| | | private List<HydroVisualViewModel> _allVisualViewModelList = null; |
| | | |
| | | //获取构件视图列表 |
| | | private List<HydroVisualViewModel> GetVisualViewModelList() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_allVisualViewModelList == null) |
| | | { |
| | | _allVisualViewModelList = new List<HydroVisualViewModel>(); |
| | | var allVisualList = _hydroInfo.GetAllVisuals(); |
| | | if (allVisualList != null && allVisualList.Count > 0) |
| | | { |
| | | var allCalcuResultList = GetCalcuResultList(); |
| | | allVisualList.ForEach(x => |
| | | { |
| | | var vm = HydroVisualViewModelBuilder.CreateVisualViewModel(x, _hydroInfo); |
| | | var calcuResult = allCalcuResultList?.Find(x => x.Code == x.Code); |
| | | if (calcuResult != null) |
| | | { |
| | | vm.UpdateCalcuProperty(calcuResult); |
| | | } |
| | | _allVisualViewModelList.Add(vm); |
| | | }); |
| | | } |
| | | } |
| | | return _allVisualViewModelList; |
| | | } |
| | | |
| | | //更新可见视图属性 |
| | | private void UpdateVisualViewModelProperty() |
| | | { |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | if (allVisualViewModelList != null && allVisualViewModelList.Count > 0) |
| | | { |
| | | allVisualViewModelList.ForEach(x => |
| | | { |
| | | x.UpdateProperty(); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | //更新可见视图属性 |
| | | private void UpdateVisualViewModelProperty(List<string> codes) |
| | | { |
| | | if (codes == null || codes.Count < 1) |
| | | { |
| | | return; |
| | | } |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | if (allVisualViewModelList != null && allVisualViewModelList.Count > 0) |
| | | { |
| | | allVisualViewModelList.ForEach(x => |
| | | { |
| | | if (codes.Contains(x.Code)) |
| | | { |
| | | x.UpdateProperty(); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | |
| | | //更新可见视图属性 |
| | | private void UpdateVisualViewModelProperty(List<Yw.Model.HydroVisualInfo> visualList) |
| | | { |
| | | if (visualList == null || visualList.Count < 1) |
| | | { |
| | | return; |
| | | } |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | if (allVisualViewModelList != null && allVisualViewModelList.Count > 0) |
| | | { |
| | | allVisualViewModelList.ForEach(x => |
| | | { |
| | | if (visualList.Exists(t => t.Code == x.Code)) |
| | | { |
| | | x.UpdateProperty(); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | |
| | | //更新可见视图计算属性 |
| | | private void UpdateVisualViewModelCalcuProperty() |
| | | { |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | if (allVisualViewModelList != null && allVisualViewModelList.Count > 0) |
| | | { |
| | | var allCalcuResultList = GetCalcuResultList(); |
| | | if (allCalcuResultList != null && allCalcuResultList.Count > 0) |
| | | { |
| | | allVisualViewModelList.ForEach(x => |
| | | { |
| | | var calcuResult = allCalcuResultList.Find(t => t.Code == x.Code); |
| | | if (calcuResult != null) |
| | | { |
| | | x.UpdateCalcuProperty(calcuResult); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //获取构件视图 |
| | | private HydroVisualViewModel GetVisualViewModel(string code) |
| | | { |
| | | if (string.IsNullOrEmpty(code)) |
| | | { |
| | | return default; |
| | | } |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | return allVisualViewModelList?.Find(x => x.Code == code); |
| | | } |
| | | |
| | | //获取可见视图 |
| | | private HydroVisualViewModel GetVisualViewModel(Yw.Model.HydroVisualInfo visual) |
| | | { |
| | | if (visual == null) |
| | | { |
| | | return default; |
| | | } |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | return allVisualViewModelList?.Find(x => x.Code == visual.Code); |
| | | } |
| | | |
| | | |
| | | |
| | | #endregion |
| | | |
| | |
| | | }; |
| | | _visualListCtrl.HydroChangedInfoEvent += (visualList) => |
| | | { |
| | | UpdateMarkList(visualList); |
| | | UpdateSelectedProperty(); |
| | | AutoApplyGrading(); |
| | | ApplyGradingResultList(); |
| | | }; |
| | | } |
| | | return _visualListCtrl; |
| | |
| | | var visualListCtrl = GetVisualListCtrl(); |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | visualListCtrl.SetBindingData(allVisualViewModelList); |
| | | var allCalcuResultList = GetCalcuResultList(); |
| | | var allCalcuResultList = GetCalcuVisualResultList(Yw.EPAnet.CalcuMode.MinorLoss, false); |
| | | if (allCalcuResultList == null || allCalcuResultList.Count < 1) |
| | | { |
| | | visualListCtrl.SetNormalView(); |
| | |
| | | { |
| | | ShowVisualListCtrl(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 模拟检查 |
| | | |
| | | #region 检查结果 |
| | | |
| | | //检查结果缓存 |
| | |
| | | this.docPnlBottom.Height = 350; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | //检查 |
| | | private void barBtnCheck_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowCheckCtrl(true); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 计算失败 |
| | | |
| | | //计算失败控件 |
| | | private HydroCalcuFailedCtrl _calcuFailedCtrl = null; |
| | | |
| | | //获取计算失败控件 |
| | | private HydroCalcuFailedCtrl GetCalcuFailedCtrl() |
| | | { |
| | | if (_calcuFailedCtrl == null) |
| | | { |
| | | _calcuFailedCtrl = new HydroCalcuFailedCtrl(); |
| | | _calcuFailedCtrl.Dock = DockStyle.Fill; |
| | | } |
| | | return _calcuFailedCtrl; |
| | | } |
| | | |
| | | //显示计算失败控件 |
| | | private void ShowCalcuFailedCtrl(HydroCalcuResult calcuResult) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (calcuResult == null) |
| | | { |
| | | return; |
| | | } |
| | | if (calcuResult.Succeed) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | var calcuFailedCtrl = GetCalcuFailedCtrl(); |
| | | calcuFailedCtrl.SetBindingData(calcuResult.FailedList); |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | this.controlContainerBottom.Controls.Add(calcuFailedCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "计算失败原因"; |
| | | this.docPnlBottom.Height = 350; |
| | | } |
| | | |
| | | //显示计算失败控件 |
| | | private void ShowCalcuFailedCtrl() |
| | | { |
| | | ShowCalcuFailedCtrl(_calcuResult); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 管网修复 |
| | | |
| | | //修复管网 |
| | | private void Repair() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var checkResult = GetCheckResult(true); |
| | | if (checkResult == null) |
| | | { |
| | | return; |
| | | } |
| | | if (!checkResult.Succeed) |
| | | { |
| | | ShowCheckCtrl(false); |
| | | TipFormHelper.ShowWarn("检查失败导致无法进行试算,停止管网修复!"); |
| | | return; |
| | | } |
| | | var calcuResult = _hydroInfo.Calcu(Yw.EPAnet.CalcuMode.Simple); |
| | | if (calcuResult == null) |
| | | { |
| | | return; |
| | | } |
| | | if (!calcuResult.Succeed) |
| | | { |
| | | ShowCalcuFailedCtrl(calcuResult); |
| | | TipFormHelper.ShowWarn("试算失败,停止管网修复!"); |
| | | return; |
| | | } |
| | | var allLinks = _hydroInfo.GetAllLinks(); |
| | | if (allLinks != null && allLinks.Count < 1) |
| | | { |
| | | TipFormHelper.ShowError("模型中未包含管段信息,停止管网修复!"); |
| | | return; |
| | | } |
| | | int count = 0; |
| | | foreach (var link in allLinks) |
| | | { |
| | | var calcuLink = calcuResult.LinkList?.Find(x => x.Code == link.Code); |
| | | if (calcuLink == null) |
| | | { |
| | | continue; |
| | | } |
| | | if (!calcuLink.CalcuFlow.HasValue) |
| | | { |
| | | continue; |
| | | } |
| | | if (calcuLink.CalcuFlow.Value < 0) |
| | | { |
| | | var tempCode = link.StartCode; |
| | | link.StartCode = link.EndCode; |
| | | link.EndCode = tempCode; |
| | | count++; |
| | | } |
| | | } |
| | | UpdateVisualViewModelProperty(); |
| | | UpdateVisualListCtrl(); |
| | | UpdateSelectedProperty(); |
| | | TipFormHelper.ShowSucceed($"修复完成,共修复管段({count})个!"); |
| | | } |
| | | |
| | | //管网修复 |
| | | private void barBtnRepair_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | Repair(); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //并联 |
| | | //并联分析 |
| | | private void barBtnParallel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ParallelAnalysis(); |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 模拟计算 |
| | | #region 工况计算 |
| | | |
| | | //所有工况元组列表 |
| | | private Tuple<HydroWorkingVmo, HydroCheckResult, HydroCalcuResult> _allWorkingTupleList = null; |
| | | |
| | | |
| | | private Yw.EPAnet.CalcuResult _calcuResult = null;//计算结果 |
| | | |
| | | |
| | | |
| | | |
| | | #region 工况 |
| | | |
| | | private List<Tuple<HydroWorkingVmo, HydroCheckResult, HydroCalcuResult>> _allWorkingTupleList = new List<Tuple<HydroWorkingVmo, HydroCheckResult, HydroCalcuResult>>(); |
| | | |
| | | //显示工况计算窗体 |
| | | private void ShowWorkingCalcuDlg() |
| | | { |
| | | var dlg = new SetHydroWorkingInfoDlg(); |
| | | dlg.HydroViewEvent += async (parter) => |
| | | var dlg = new SetHydroWorkingDlg(); |
| | | dlg.HydroViewEvent += async (visual) => |
| | | { |
| | | _selectedVisual = parter as Yw.Model.HydroVisualInfo; |
| | | _selectedVisual = visual; |
| | | if (_selectedVisual != null) |
| | | { |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(new List<string>() { _selectedVisual.Code }); |
| | | } |
| | | ShowSelectedProperty(); |
| | | }; |
| | | dlg.HydroCalcuEvent += async (hydroInfo, workingInfo) => |
| | | dlg.HydroCalcuEvent += async (working) => |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | _hydroInfo.UpdateWorkingInfo(workingInfo); |
| | | var vmo = new HydroWorkingVmo(); |
| | | vmo.ModelID = _hydroInfo.ID; |
| | | vmo.Name = working.Name; |
| | | vmo.WorkingInfo = JsonHelper.Object2Json(working.WorkingInfo); |
| | | vmo.MonitorInfo = JsonHelper.Object2Json(working.MonitorInfo); |
| | | vmo.SortCode = _allWorkingList.Count < 1 ? 1 : _allWorkingList.Max(x => x.SortCode) + 1; |
| | | vmo.Description = working.Description; |
| | | vmo.ID = await BLLFactory<Yw.BLL.HydroWorking>.Instance.Insert(vmo); |
| | | if (vmo.ID < 1) |
| | | { |
| | | TipFormHelper.ShowError("创建工况失败,计算取消!"); |
| | | return; |
| | | } |
| | | _allWorkingList.Add(vmo); |
| | | |
| | | _hydroInfo.UpdateWorkingInfo(working.WorkingInfo); |
| | | //校验 |
| | | _checkResult = _hydroInfo.Check(); |
| | | if (!_checkResult.Succeed) |
| | | { |
| | | _allWorkingTupleList.Add(new Tuple<HydroWorkingVmo, HydroCheckResult, HydroCalcuResult>(vmo, _checkResult, null)); |
| | | ShowCheckCtrl(); |
| | | TipFormHelper.ShowWarn("校验失败,请检查后重试"); |
| | | return; |
| | |
| | | |
| | | |
| | | //await Task.Delay(5000); |
| | | _calcuResult = _hydroInfo.Calcu(Yw.EPAnet.CalcuMode.MinorLoss); |
| | | |
| | | var netWork = Yw.Hydro.ParseHelper.ToNetwork(_hydroInfo); |
| | | _calcuResult = netWork.CalcuMinorLoss(); |
| | | |
| | | WaitFormHelper.HideWaitForm(); |
| | | if (_calcuResult.Succeed) |
| | | { |
| | | GetCalcuResultList(false); |
| | | _allWorkingTupleList.Add(new Tuple<HydroWorkingVmo, HydroCheckResult, HydroCalcuResult>(vmo, _checkResult, _calcuResult)); |
| | | UpdateVisualViewModelProperty(); |
| | | UpdateVisualViewModelCalcuProperty(); |
| | | UpdateVisualListCtrl(); |
| | | UpdateSelectedProperty(); |
| | | await _bimfaceCtrl?.SetLogicCalcuCustomLabels(_calcuResult); |
| | | await _bimfaceCtrl?.SetLogicCalcuCustomLabelsCalcuResult(_calcuResult); |
| | | TipFormHelper.ShowSucceed("计算成功!"); |
| | | var codes = _hydroInfo.Pumps.Select(x => x.Code).ToList(); |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(codes); |
| | |
| | | ShowCalcuFailedCtrl(); |
| | | TipFormHelper.ShowError("计算失败!"); |
| | | } |
| | | AutoApplyGrading(); |
| | | ApplyGradingResultList(false); |
| | | UpdateVisualListCtrl(); |
| | | ShowSelectedProperty(); |
| | | }; |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.SetBindingData(_hydroInfo, _allWorkingList, _allMonitorValueList); |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 计算失败 |
| | | |
| | | //计算失败控件 |
| | | private HydroCalcuFailedCtrl _calcuFailedCtrl = null; |
| | | |
| | | //获取计算失败控件 |
| | | private HydroCalcuFailedCtrl GetCalcuFailedCtrl() |
| | | { |
| | | if (_calcuFailedCtrl == null) |
| | | { |
| | | _calcuFailedCtrl = new HydroCalcuFailedCtrl(); |
| | | _calcuFailedCtrl.Dock = DockStyle.Fill; |
| | | } |
| | | return _calcuFailedCtrl; |
| | | } |
| | | |
| | | //显示计算失败控件 |
| | | private void ShowCalcuFailedCtrl() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (_calcuResult == null) |
| | | { |
| | | return; |
| | | } |
| | | if (_calcuResult.Succeed) |
| | | { |
| | | return; |
| | | } |
| | | var calcuFailedCtrl = GetCalcuFailedCtrl(); |
| | | calcuFailedCtrl.SetBindingData(_calcuResult.FailedList); |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | this.controlContainerBottom.Controls.Add(calcuFailedCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "计算失败原因"; |
| | | this.docPnlBottom.Height = 350; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 计算结果 |
| | | |
| | | //所有计算结果列表 |
| | | private List<HydroCalcuVisualResult> _allCalcuResultList = null; |
| | | |
| | | //获取计算结果 |
| | | //true 使用缓存,false 不使用缓存 |
| | | private List<HydroCalcuVisualResult> GetCalcuResultList(bool isCache = true) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_calcuResult == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (!_calcuResult.Succeed) |
| | | { |
| | | return default; |
| | | } |
| | | if (isCache) |
| | | { |
| | | return _allCalcuResultList; |
| | | } |
| | | |
| | | _allCalcuResultList = new List<HydroCalcuVisualResult>(); |
| | | |
| | | //节点 |
| | | var allNodeList = _hydroInfo.GetAllNodes(); |
| | | if (allNodeList != null && allNodeList.Count > 0) |
| | | { |
| | | foreach (var node in allNodeList) |
| | | { |
| | | var calcuNode = _calcuResult.NodeList?.Find(x => x.Id == node.Code); |
| | | if (calcuNode != null) |
| | | { |
| | | var calcuResult = new HydroCalcuNodeResult() |
| | | { |
| | | Code = node.Code, |
| | | CalcuPress = calcuNode.Press, |
| | | CalcuHead = calcuNode.Head, |
| | | CalcuDemand = calcuNode.Demand |
| | | }; |
| | | _allCalcuResultList.Add(calcuResult); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //管段 |
| | | var allLinkList = _hydroInfo.GetAllLinks(); |
| | | if (allLinkList != null && allLinkList.Count > 0) |
| | | { |
| | | foreach (var link in allLinkList) |
| | | { |
| | | var calcuLink = _calcuResult.LinkList?.Find(x => x.Id == link.Code); |
| | | if (calcuLink != null) |
| | | { |
| | | var calcuResult = new HydroCalcuLinkResult() |
| | | { |
| | | Code = link.Code, |
| | | CalcuFlow = calcuLink.Flow, |
| | | CalcuVelocity = calcuLink.Velocity, |
| | | CalcuHeadLoss = calcuLink.Headloss |
| | | }; |
| | | _allCalcuResultList.Add(calcuResult); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //流量计 |
| | | var allFlowmeterList = _hydroInfo.Flowmeters; |
| | | if (allFlowmeterList != null && allFlowmeterList.Count > 0) |
| | | { |
| | | foreach (var flowmeter in allFlowmeterList) |
| | | { |
| | | var calcuFlowmeterResult = _allCalcuResultList.Find(x => x.Code == flowmeter.Code) as HydroCalcuNodeResult; |
| | | if (calcuFlowmeterResult != null) |
| | | { |
| | | var calcuFlowmeterNewResult = new HydroCalcuFlowmeterResult(calcuFlowmeterResult); |
| | | var calcuFlowmeterLinkResultList = new List<HydroCalcuLinkResult>(); |
| | | var flowmeterLinkList = allLinkList?.Where(x => x.StartCode == flowmeter.Code || x.EndCode == flowmeter.Code).ToList(); |
| | | if (flowmeterLinkList != null && flowmeterLinkList.Count > 0) |
| | | { |
| | | foreach (var flowmeterLink in flowmeterLinkList) |
| | | { |
| | | var calcuFlowmeterLinkResult = _allCalcuResultList.Find(x => x.Code == flowmeterLink.Code) as HydroCalcuLinkResult; |
| | | if (calcuFlowmeterLinkResult != null) |
| | | { |
| | | calcuFlowmeterLinkResultList.Add(calcuFlowmeterLinkResult); |
| | | } |
| | | } |
| | | } |
| | | if (calcuFlowmeterLinkResultList.Exists(x => x.CalcuFlow.HasValue)) |
| | | { |
| | | calcuFlowmeterNewResult.CalcuQ = calcuFlowmeterLinkResultList.Where(x => x.CalcuFlow.HasValue).Average(x => x.CalcuFlow.Value); |
| | | } |
| | | _allCalcuResultList.Remove(calcuFlowmeterResult); |
| | | _allCalcuResultList.Add(calcuFlowmeterNewResult); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //压力表 |
| | | var allPressmeterList = _hydroInfo.Pressmeters; |
| | | if (allPressmeterList != null && allPressmeterList.Count > 0) |
| | | { |
| | | foreach (var pressmeter in allPressmeterList) |
| | | { |
| | | var calcuPressmeterResult = _allCalcuResultList.Find(x => x.Code == pressmeter.Code) as HydroCalcuNodeResult; |
| | | if (calcuPressmeterResult != null) |
| | | { |
| | | var calcuPressmeterNewResult = new HydroCalcuPressmeterResult(calcuPressmeterResult); |
| | | calcuPressmeterNewResult.CalcuPr = calcuPressmeterResult.CalcuPress; |
| | | _allCalcuResultList.Remove(calcuPressmeterResult); |
| | | _allCalcuResultList.Add(calcuPressmeterNewResult); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //水泵 |
| | | var allPumpList = _hydroInfo.Pumps; |
| | | if (allPumpList != null && allPumpList.Count > 0) |
| | | { |
| | | foreach (var pump in allPumpList) |
| | | { |
| | | var calcuPumpResult = _allCalcuResultList.Find(x => x.Code == pump.Code) as HydroCalcuLinkResult; |
| | | if (calcuPumpResult != null) |
| | | { |
| | | var calcuPumpNewResult = new HydroCalcuPumpResult(calcuPumpResult); |
| | | calcuPumpNewResult.CalcuQ = calcuPumpResult.CalcuFlow; |
| | | if (calcuPumpNewResult.CalcuQ.HasValue) |
| | | { |
| | | var calcuNodeStartResult = _allCalcuResultList.Find(x => x.Code == pump.StartCode) as HydroCalcuNodeResult; |
| | | var calcuNodeEndResult = _allCalcuResultList.Find(x => x.Code == pump.EndCode) as HydroCalcuNodeResult; |
| | | if (calcuNodeStartResult != null && calcuNodeEndResult != null) |
| | | { |
| | | if (calcuNodeStartResult.CalcuPress.HasValue && calcuNodeEndResult.CalcuPress.HasValue) |
| | | { |
| | | calcuPumpNewResult.CalcuH = Math.Abs(calcuNodeStartResult.CalcuPress.Value - calcuNodeEndResult.CalcuPress.Value); |
| | | } |
| | | if (pump.LinkStatus == Yw.Hydro.PumpStatus.Open && pump.RatedN.HasValue) |
| | | { |
| | | var curveqp = _hydroInfo.Curves?.Find(x => x.Code == pump.CurveQP); |
| | | if (curveqp != null) |
| | | { |
| | | if (curveqp.CurveData != null && curveqp.CurveData.Count > 3) |
| | | { |
| | | var point2dList = curveqp.CurveData.Select(x => new Yw.Geometry.Point2d(x.X, x.Y)).ToList(); |
| | | var point2dSimularList = point2dList.GetQPPointListByN(pump.RatedN.Value, pump.RatedN.Value * pump.SpeedRatio); |
| | | var pumpCurveQp = new Yw.Pump.CurveQP(eFeatType.Cubic, point2dSimularList); |
| | | calcuPumpNewResult.CalcuP = pumpCurveQp.FeatCurve.GetPointY(calcuPumpNewResult.CalcuQ.Value); |
| | | } |
| | | } |
| | | } |
| | | if (calcuPumpNewResult.CalcuH.HasValue && calcuPumpNewResult.CalcuP.HasValue) |
| | | { |
| | | calcuPumpNewResult.CalcuE = Yw.Pump.CalculationHelper.CalcuE(calcuPumpNewResult.CalcuQ.Value, calcuPumpNewResult.CalcuH.Value, calcuPumpNewResult.CalcuP.Value); |
| | | } |
| | | } |
| | | } |
| | | _allCalcuResultList.Remove(calcuPumpResult); |
| | | _allCalcuResultList.Add(calcuPumpNewResult); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return _allCalcuResultList; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | //水力计算 |
| | | private void barBtnHydroCalcu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 当前工况 |
| | | |
| | | //当前工况 |
| | | private Yw.Vmo.HydroWorkingVmo _currentWorking = null; |
| | | |
| | | //初始化当前工况 |
| | | private void InitialCurrentWorking(List<HydroWorkingVmo> allWorkingList) |
| | | { |
| | | this.repositoryItemImageComboBox1.Items.BeginUpdate(); |
| | | this.repositoryItemImageComboBox1.Items.Clear(); |
| | | if (allWorkingList != null && allWorkingList.Count > 0) |
| | | { |
| | | allWorkingList.ForEach(x => this.repositoryItemImageComboBox1.Items.Add(x.Name, x, -1)); |
| | | this.barEditCurrentWorking.EditValue = allWorkingList.Last(); |
| | | } |
| | | this.repositoryItemImageComboBox1.Items.EndUpdate(); |
| | | } |
| | | |
| | | //增加当前工况 |
| | | private void AppendCurrentWorking(HydroWorkingVmo working) |
| | | { |
| | | this.repositoryItemImageComboBox1.Items.BeginUpdate(); |
| | | this.repositoryItemImageComboBox1.Items.Add(working.Name, working, -1); |
| | | this.repositoryItemImageComboBox1.Items.EndUpdate(); |
| | | this.barEditCurrentWorking.EditValue = working; |
| | | } |
| | | |
| | | //设置当前工况 |
| | | private void SetCurrentWorking(HydroWorkingVmo working) |
| | | { |
| | | _currentWorking = working; |
| | | } |
| | | |
| | | //当前工况发生改变 |
| | | private void barEditCurrentWorking_EditValueChanged(object sender, EventArgs e) |
| | | { |
| | | var working = this.barEditCurrentWorking.EditValue as HydroWorkingVmo; |
| | | SetCurrentWorking(working); |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #region 工况列表 |
| | | |
| | | //所有工况列表 |
| | | private List<HydroWorkingVmo> _allWorkingList = null; |
| | | |
| | | //初始化工况列表 |
| | | private async void InitialWorkingList() |
| | | { |
| | | _allWorkingList = await BLLFactory<Yw.BLL.HydroWorking>.Instance.GetByModelID(_hydroInfo.ID); |
| | | if (_allWorkingList == null) |
| | | { |
| | | _allWorkingList = new List<HydroWorkingVmo>(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | ////获取属性控件 |
| | | //private XhsProjectSimulationPropertyCtrl GetPropertyCtrl() |
| | | //{ |
| | | // if (_propertyCtrl == null) |
| | | // { |
| | | // _propertyCtrl = new XhsProjectSimulationPropertyCtrl(); |
| | | // _propertyCtrl.Dock = DockStyle.Fill; |
| | | // _propertyCtrl.HydroViewEvent += (visual) => |
| | | // { |
| | | // if (visual == null) |
| | | // { |
| | | // return; |
| | | // } |
| | | // _bimfaceCtrl?.ZoomToComponent(visual.Code); |
| | | // }; |
| | | // _propertyCtrl.BlinkLinkNodeEvent += async (link, linkNodeCode) => |
| | | // { //强调连接节点 |
| | | // if (_hydroInfo == null) |
| | | // { |
| | | // return; |
| | | // } |
| | | // if (link == null) |
| | | // { |
| | | // return; |
| | | // } |
| | | // if (string.IsNullOrEmpty(linkNodeCode)) |
| | | // { |
| | | // return; |
| | | // } |
| | | // var linkNode = GetVisual(linkNodeCode); |
| | | // if (linkNode == null) |
| | | // { |
| | | // return; |
| | | // } |
| | | // var blinkCodes = new List<string>(); |
| | | // if (linkNode.GetType() == typeof(HydroJunctionInfo)) |
| | | // { |
| | | // var allLinkList = GetLinkList(); |
| | | // if (allLinkList == null || allLinkList.Count < 1) |
| | | // { |
| | | // return; |
| | | // } |
| | | // var linkList = allLinkList.Where(x => (x.StartCode == linkNodeCode || x.EndCode == linkNodeCode) && x.Code != linkNodeCode).ToList(); |
| | | // if (linkList == null || linkList.Count < 1) |
| | | // { |
| | | // return; |
| | | // } |
| | | // blinkCodes.AddRange(linkList.Select(x => x.Code)); |
| | | // } |
| | | // else |
| | | // { |
| | | // blinkCodes.Add(linkNodeCode); |
| | | // } |
| | | |
| | | // await _bimfaceCtrl?.ClearBlinkComponents(); |
| | | // await _bimfaceCtrl?.SetBlinkComponents(blinkCodes); |
| | | // await Task.Delay(5000); |
| | | // await _bimfaceCtrl?.ClearBlinkComponents(); |
| | | // }; |
| | | // _propertyCtrl.PropertyValueChangedEvent += (visual) => |
| | | // { |
| | | // if (visual == null) |
| | | // { |
| | | // return; |
| | | // } |
| | | // UpdateVisualListCtrl(); |
| | | // //ApplyGradingResultList(visual); |
| | | // }; |
| | | // _propertyCtrl.MarkPropertyValueChangedEvent += (visual) => |
| | | // { |
| | | // //标注属性发生改变 |
| | | // //判断当前是否有标注展示,若有则更新标注,最好是更新单个标注 |
| | | // //UpdateMark(visual); |
| | | // }; |
| | | // _propertyCtrl.GradingPropertyValueChangedEvent += (parter) => |
| | | // { |
| | | // //分级属性发生改变 |
| | | // //判断当前是否有分级展示,若有则更新分级,最好是更新单个分级 |
| | | // }; |
| | | // _propertyCtrl.FlowEffectPropertyValueChangedEvent += (visual) => |
| | | // { |
| | | // //流向属性发生改变 |
| | | // //判断流向是否加载,如果加载则更新流向,最好是更新单个流向 |
| | | // //UpdateFlowEffect(visual); |
| | | // }; |
| | | |
| | | // } |
| | | // return _propertyCtrl; |
| | | //} |
| | | |
| | | ////属性控件是否可见 |
| | | //private bool IsPropertyCtrlVisible |
| | | //{ |
| | | // get |
| | | // { |
| | | // if (this.docPnlRight.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible) |
| | | // { |
| | | // if (this.controlContainerRight.Controls.Count > 0) |
| | | // { |
| | | // if (this.controlContainerRight.Controls[0] is XhsProjectSimulationPropertyCtrl) |
| | | // { |
| | | // return true; |
| | | // } |
| | | // } |
| | | // } |
| | | // return false; |
| | | // } |
| | | //} |
| | | |
| | | ////显示属性控件 |
| | | //private void ShowPropertyCtrl() |
| | | //{ |
| | | // if (IsPropertyCtrlVisible) |
| | | // { |
| | | // return; |
| | | // } |
| | | // var propertyCtrl = GetPropertyCtrl(); |
| | | // this.controlContainerRight.Controls.Clear(); |
| | | // this.controlContainerRight.Controls.Add(propertyCtrl); |
| | | // this.docPnlRight.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | // this.docPnlRight.Text = "属性"; |
| | | // this.docPnlRight.Width = 300; |
| | | //} |
| | | |
| | | private void barBtnWorkingList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 工况控件 |
| | | |
| | | //工况控件 |
| | | private HydroWorkingTreeCtrl _workingCtrl = null; |
| | | |
| | | //获取工况控件 |
| | | private HydroWorkingTreeCtrl GetWorkingCtrl() |
| | | { |
| | | if (_workingCtrl == null) |
| | | { |
| | | _workingCtrl = new HydroWorkingTreeCtrl(); |
| | | _workingCtrl.Dock = DockStyle.Fill; |
| | | } |
| | | return _workingCtrl; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |