| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 显示项目信息事件 |
| | | /// 显示项目站信息事件 |
| | | /// </summary> |
| | | public event Action<SvgImage> ShowProjectInfoEvent; |
| | | public event Action<XhsProjectVmo, XhsProjectSiteVmo, Yw.Model.HydroModelInfo, SvgImage> ShowProjectSiteInfoEvent; |
| | | /// <summary> |
| | | /// 显示项目模拟事件 |
| | | /// 显示项目站模拟事件 |
| | | /// </summary> |
| | | public event Action<SvgImage> ShowProjectSimulationEvent; |
| | | public event Action<XhsProjectVmo, XhsProjectSiteVmo, Yw.Model.HydroModelInfo, Dictionary<HydroWorkingVmo, bool>, SvgImage> ShowProjectSiteSimulationEvent; |
| | | /// <summary> |
| | | /// 创建项目方案事件 |
| | | /// 显示项目站工况事件 |
| | | /// </summary> |
| | | public event Action<SvgImage> CreateProjectSchemeEvent; |
| | | public event Action<XhsProjectVmo, XhsProjectSiteVmo, Yw.Model.HydroModelInfo, HydroWorkingVmo, SvgImage> ShowProjectSiteWorkingEvent; |
| | | /// <summary> |
| | | /// 显示项目方案事件 |
| | | /// 项目站工况选择改变事件 |
| | | /// </summary> |
| | | public event Action<XhsSchemeVmo, SvgImage> ShowProjectSchemeEvent; |
| | | public event Action<XhsProjectVmo, XhsProjectSiteVmo, Yw.Model.HydroModelInfo, HydroWorkingVmo, bool> ProjectSiteWorkingCheckedEvent; |
| | | /// <summary> |
| | | /// 显示项目站方案事件 |
| | | /// </summary> |
| | | public event Action<XhsProjectVmo, XhsProjectSiteVmo, XhsSchemeVmo, Yw.Model.HydroModelInfo, Dictionary<HydroWorkingVmo, bool>, SvgImage> ShowProjectSiteSchemeEvent; |
| | | /// <summary> |
| | | /// 显示项目站方案工况事件 |
| | | /// </summary> |
| | | public event Action<XhsProjectVmo, XhsProjectSiteVmo, XhsSchemeVmo, Yw.Model.HydroModelInfo, HydroWorkingVmo, SvgImage> ShowProjectSiteSchemeWorkingEvent; |
| | | /// <summary> |
| | | /// 项目站方案工况选择工况事件 |
| | | /// </summary> |
| | | public event Action<XhsSchemeVmo, HydroWorkingVmo, bool> ProjectSiteSchemeWorkingCheckedEvent; |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 创建项目站方案事件 |
| | | /// </summary> |
| | | public event Action<XhsProjectVmo, XhsProjectSiteVmo, Yw.Model.HydroModelInfo, SvgImage> CreateProjectSiteSchemeEvent; |
| | | |
| | | /// <summary> |
| | | /// 比对项目工况事件 |
| | | /// </summary> |
| | | public event Action<SvgImage> CompareProjectWorkingEvent; |
| | | /// <summary> |
| | | /// 显示项目工况事件 |
| | | /// </summary> |
| | | public event Action<HydroWorkingVmo, SvgImage> ShowProjectWorkingEvent; |
| | | |
| | | |
| | | private XhsProjectVmo _project = null;//项目 |
| | | private XhsProjectSiteVmo _projectSite = null;//项目站 |
| | | private List<HydroWorkingVmo> _allWorkingList = null;//所有工况列表 |
| | | private Dictionary<XhsSchemeVmo, List<HydroWorkingVmo>> _allSchemeWorkingDict = null;//所有方案工况字典 |
| | | private Yw.Model.HydroModelInfo _hydroInfo = null;//模型信息 |
| | | private Dictionary<HydroWorkingVmo, bool> _allWorkingCheckedListDict = null;//所有工况选择列表字典 |
| | | private Dictionary<XhsSchemeVmo, Yw.Model.HydroModelInfo> _allSchemeHydroInfoDict = null;//所有方案水力信息列表 |
| | | private Dictionary<XhsSchemeVmo, Dictionary<HydroWorkingVmo, bool>> _allSchemeWorkingCheckedListDict = null;//所有方案工况选择列表字典 |
| | | |
| | | /// <summary> |
| | | /// 绑定数据 |
| | | /// </summary> |
| | | public void SetBindingData |
| | | ( |
| | | XhsProjectVmo project, |
| | | XhsProjectSiteVmo projectSite, |
| | | List<HydroWorkingVmo> allWorkingList, |
| | | Dictionary<XhsSchemeVmo, List<HydroWorkingVmo>> allSchemeWorkingDict |
| | | ) |
| | | public async Task SetBindingData(XhsProjectVmo project) |
| | | { |
| | | _project = project; |
| | | _projectSite = projectSite; |
| | | _allWorkingList = allWorkingList; |
| | | _allSchemeWorkingDict = allSchemeWorkingDict; |
| | | _allWorkingList?.ForEach(x => AppendWorking(x)); |
| | | _allSchemeWorkingDict?.ForEach(x => |
| | | if (project == null) |
| | | { |
| | | AppendScheme(x.Key); |
| | | x.Value?.ForEach(y => AppendSchemeWorking(x.Key, y)); |
| | | }); |
| | | return; |
| | | } |
| | | _project = project; |
| | | var overlay = this.ShowOverlay(); |
| | | _projectSite = await BLLFactory<HStation.BLL.XhsProjectSite>.Instance.GetDefaultByProjectID(_project.ID); |
| | | var relation = await BLLFactory<Yw.BLL.HydroModelRelation>.Instance |
| | | .GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsProjectSite, _projectSite.ID, HStation.Xhs.Purpose.Simulation); |
| | | if (relation == null) |
| | | { |
| | | return; |
| | | } |
| | | var allWorkingList = await BLLFactory<Yw.BLL.HydroWorking>.Instance.GetByModelID(relation.ModelID); |
| | | if (allWorkingList != null && allWorkingList.Count > 0) |
| | | { |
| | | _allWorkingCheckedListDict = new Dictionary<HydroWorkingVmo, bool>(); |
| | | foreach (var working in allWorkingList) |
| | | { |
| | | _allWorkingCheckedListDict.Add(working, false); |
| | | AppendWorking(working); |
| | | } |
| | | } |
| | | var allSchemeList = await BLLFactory<HStation.BLL.XhsScheme>.Instance.GetBySiteID(_projectSite.ID); |
| | | if (allSchemeList != null && allSchemeList.Count > 0) |
| | | { |
| | | _allSchemeWorkingCheckedListDict = new Dictionary<XhsSchemeVmo, Dictionary<HydroWorkingVmo, bool>>(); |
| | | foreach (var scheme in allSchemeList) |
| | | { |
| | | AppendScheme(scheme); |
| | | var schemeRelation = await BLLFactory<Yw.BLL.HydroModelRelation>.Instance |
| | | .GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsScheme, scheme.ID, HStation.Xhs.Purpose.Simulation); |
| | | if (schemeRelation != null) |
| | | { |
| | | var allSchemeWorkingList = await BLLFactory<Yw.BLL.HydroWorking>.Instance.GetByModelID(schemeRelation.ModelID); |
| | | if (allSchemeWorkingList != null && allSchemeWorkingList.Count > 0) |
| | | { |
| | | _allSchemeWorkingCheckedListDict.Add(scheme, new Dictionary<HydroWorkingVmo, bool>()); |
| | | foreach (var schemeWorking in allSchemeWorkingList) |
| | | { |
| | | _allSchemeWorkingCheckedListDict[scheme].Add(schemeWorking, false); |
| | | AppendSchemeWorking(scheme, schemeWorking); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | overlay.Close(); |
| | | } |
| | | |
| | | #region 获取水力信息 |
| | | |
| | | /// <summary> |
| | | /// 获取水力信息 |
| | | /// UseCache 是否使用缓存 |
| | | /// </summary> |
| | | public async Task<Yw.Model.HydroModelInfo> GetHydroInfo(bool useCache) |
| | | { |
| | | if (!useCache) |
| | | { |
| | | _hydroInfo = await GetHydroInfo(); |
| | | if (_hydroInfo == null) |
| | | { |
| | | return null; |
| | | } |
| | | } |
| | | if (_hydroInfo == null) |
| | | { |
| | | _hydroInfo = await GetHydroInfo(); |
| | | } |
| | | return _hydroInfo; |
| | | } |
| | | |
| | | //获取水力信息 |
| | | private async Task<Yw.Model.HydroModelInfo> GetHydroInfo() |
| | | { |
| | | if (_project == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_projectSite == null) |
| | | { |
| | | return default; |
| | | } |
| | | var relation = await BLLFactory<Yw.BLL.HydroModelRelation>.Instance |
| | | .GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsProjectSite, _projectSite.ID, HStation.Xhs.Purpose.Simulation); |
| | | if (relation == null) |
| | | { |
| | | return null; |
| | | } |
| | | var hydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(relation.ModelID); |
| | | return hydroInfo; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 获取方案水力信息 |
| | | |
| | | /// <summary> |
| | | /// 获取方案水力信息 |
| | | /// UseCache 是否使用缓存 |
| | | /// </summary> |
| | | public async Task<Yw.Model.HydroModelInfo> GetSchemeHydroInfo(XhsSchemeVmo scheme, bool useCache) |
| | | { |
| | | if (_project == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_projectSite == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (scheme == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (!useCache) |
| | | { |
| | | var hydroInfo = await GetSchemeHydroInfo(scheme); |
| | | if (hydroInfo == null) |
| | | { |
| | | return null; |
| | | } |
| | | if (_allSchemeHydroInfoDict == null) |
| | | { |
| | | _allSchemeHydroInfoDict = new Dictionary<XhsSchemeVmo, Yw.Model.HydroModelInfo>(); |
| | | } |
| | | if (_allSchemeHydroInfoDict.ContainsKey(scheme)) |
| | | { |
| | | _allSchemeHydroInfoDict[scheme] = hydroInfo; |
| | | } |
| | | else |
| | | { |
| | | _allSchemeHydroInfoDict.Add(scheme, hydroInfo); |
| | | } |
| | | return hydroInfo; |
| | | } |
| | | if (_allSchemeHydroInfoDict == null) |
| | | { |
| | | _allSchemeHydroInfoDict = new Dictionary<XhsSchemeVmo, Yw.Model.HydroModelInfo>(); |
| | | } |
| | | if (!_allSchemeHydroInfoDict.ContainsKey(scheme)) |
| | | { |
| | | var hydroInfo = await GetSchemeHydroInfo(scheme); |
| | | _allSchemeHydroInfoDict.Add(scheme, hydroInfo); |
| | | return hydroInfo; |
| | | } |
| | | return _allSchemeHydroInfoDict[scheme]; |
| | | } |
| | | |
| | | //获取方案水力信息 |
| | | private async Task<Yw.Model.HydroModelInfo> GetSchemeHydroInfo(XhsSchemeVmo scheme) |
| | | { |
| | | if (_project == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_projectSite == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (scheme == null) |
| | | { |
| | | return default; |
| | | } |
| | | var relation = await BLLFactory<Yw.BLL.HydroModelRelation>.Instance |
| | | .GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsScheme, scheme.ID, HStation.Xhs.Purpose.Simulation); |
| | | if (relation == null) |
| | | { |
| | | return default; |
| | | } |
| | | var hydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(relation.ModelID); |
| | | return hydroInfo; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | /// <summary> |
| | | /// 添加工况 |
| | | /// </summary> |
| | | public void AppendWorking(Yw.Vmo.HydroWorkingVmo working) |
| | | { |
| | | if (_project == null) |
| | | { |
| | | return; |
| | | } |
| | | if (_projectSite == null) |
| | | { |
| | | return; |
| | | } |
| | | if (working == null) |
| | | { |
| | | return; |
| | | } |
| | | this.elementSimulation.Style = DevExpress.XtraBars.Navigation.ElementStyle.Group; |
| | | this.elementProjectSiteSimulation.Style = DevExpress.XtraBars.Navigation.ElementStyle.Group; |
| | | var ckEdit = new CheckEdit(); |
| | | ckEdit.Properties.AutoWidth = true; |
| | | ckEdit.Properties.Caption = string.Empty; |
| | | ckEdit.CheckedChanged += async (sender, e) => |
| | | { |
| | | if (_allWorkingCheckedListDict == null) |
| | | { |
| | | _allWorkingCheckedListDict = new Dictionary<HydroWorkingVmo, bool>(); |
| | | } |
| | | if (_allWorkingCheckedListDict.ContainsKey(working)) |
| | | { |
| | | _allWorkingCheckedListDict[working] = ckEdit.Checked; |
| | | } |
| | | else |
| | | { |
| | | _allWorkingCheckedListDict.Add(working, ckEdit.Checked); |
| | | } |
| | | var hydroInfo = await GetHydroInfo(true); |
| | | this.ProjectSiteWorkingCheckedEvent?.Invoke(_project, _projectSite, hydroInfo, working, ckEdit.Checked); |
| | | }; |
| | | this.accordionControl1.Controls.Add(ckEdit); |
| | | var elementWorking = new DevExpress.XtraBars.Navigation.AccordionControlElement(); |
| | | elementWorking.HeaderControl = ckEdit; |
| | | elementWorking.Style = DevExpress.XtraBars.Navigation.ElementStyle.Item; |
| | | elementWorking.Text = working.Name; |
| | | elementWorking.Tag = working; |
| | | elementWorking.Click += (sender, e) => this.ShowProjectWorkingEvent?.Invoke(working, svgImg32[4]); |
| | | this.elementSimulation.Elements.Add(elementWorking); |
| | | elementWorking.Click += async (sender, e) => |
| | | { |
| | | var hydroInfo = await GetHydroInfo(true); |
| | | this.ShowProjectSiteWorkingEvent?.Invoke(_project, _projectSite, hydroInfo, working, this.svgImg32[4]); |
| | | }; |
| | | this.elementProjectSiteSimulation.Elements.Add(elementWorking); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | elementScheme.Style = DevExpress.XtraBars.Navigation.ElementStyle.Item; |
| | | elementScheme.ImageOptions.ImageIndex = 3; |
| | | elementScheme.Tag = scheme; |
| | | elementScheme.Click += (sender, e) => this.ShowProjectSchemeEvent?.Invoke(scheme, svgImg32[3]); |
| | | elementScheme.Click += async (sender, e) => |
| | | { |
| | | if (_project == null) |
| | | { |
| | | return; |
| | | } |
| | | if (_projectSite == null) |
| | | { |
| | | return; |
| | | } |
| | | var hydroInfo = await GetSchemeHydroInfo(scheme); |
| | | if (hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | Dictionary<HydroWorkingVmo, bool> dict = null; |
| | | if (_allSchemeWorkingCheckedListDict != null) |
| | | { |
| | | if (_allSchemeWorkingCheckedListDict.ContainsKey(scheme)) |
| | | { |
| | | dict = _allSchemeWorkingCheckedListDict[scheme]; |
| | | } |
| | | } |
| | | this.ShowProjectSiteSchemeEvent?.Invoke(_project, _projectSite, scheme, hydroInfo, dict, this.svgImg32[3]); |
| | | }; |
| | | this.elementSchemeList.Elements.Add(elementScheme); |
| | | } |
| | | |
| | |
| | | /// </summary> |
| | | public void AppendSchemeWorking(XhsSchemeVmo scheme, Yw.Vmo.HydroWorkingVmo working) |
| | | { |
| | | if (_project == null) |
| | | { |
| | | return; |
| | | } |
| | | if (_projectSite == null) |
| | | { |
| | | return; |
| | | } |
| | | if (scheme == null) |
| | | { |
| | | return; |
| | |
| | | var ckEdit = new CheckEdit(); |
| | | ckEdit.Properties.AutoWidth = true; |
| | | ckEdit.Properties.Caption = string.Empty; |
| | | ckEdit.CheckedChanged += (sender, e) => |
| | | { |
| | | this.ProjectSiteSchemeWorkingCheckedEvent?.Invoke(scheme, working, ckEdit.Checked); |
| | | }; |
| | | this.accordionControl1.Controls.Add(ckEdit); |
| | | var elementWorking = new DevExpress.XtraBars.Navigation.AccordionControlElement(); |
| | | elementWorking.HeaderControl = ckEdit; |
| | | elementWorking.Style = DevExpress.XtraBars.Navigation.ElementStyle.Item; |
| | | elementWorking.Text = working.Name; |
| | | elementWorking.Tag = working; |
| | | elementWorking.Click += (sender, e) => this.ShowProjectWorkingEvent?.Invoke(working, svgImg32[4]); |
| | | elementWorking.Click += async (sender, e) => |
| | | { |
| | | var hydroInfo = await GetSchemeHydroInfo(scheme, true); |
| | | this.ShowProjectSiteSchemeWorkingEvent?.Invoke(_project, _projectSite, scheme, hydroInfo, working, this.svgImg32[4]); |
| | | }; |
| | | elementScheme.Elements.Add(elementWorking); |
| | | } |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | //项目概况 |
| | | private void elementInfo_Click(object sender, EventArgs e) |
| | | //项目站概况 |
| | | private async void elementProjectSiteInfo_Click(object sender, EventArgs e) |
| | | { |
| | | this.ShowProjectInfoEvent?.Invoke(this.svgImg32[0]); |
| | | if (_project == null) |
| | | { |
| | | return; |
| | | } |
| | | if (_projectSite == null) |
| | | { |
| | | return; |
| | | } |
| | | var hydroInfo = await GetHydroInfo(true); |
| | | if (hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | this.ShowProjectSiteInfoEvent?.Invoke(_project, _projectSite, hydroInfo, this.svgImg32[0]); |
| | | } |
| | | |
| | | //水力模拟 |
| | | private void elementSimulation_Click(object sender, EventArgs e) |
| | | //项目站水力模拟 |
| | | private async void elementProjectSiteSimulation_Click(object sender, EventArgs e) |
| | | { |
| | | this.ShowProjectSimulationEvent?.Invoke(this.svgImg32[1]); |
| | | if (_project == null) |
| | | { |
| | | return; |
| | | } |
| | | if (_projectSite == null) |
| | | { |
| | | return; |
| | | } |
| | | var hydroInfo = await GetHydroInfo(true); |
| | | if (hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | this.ShowProjectSiteSimulationEvent?.Invoke(_project, _projectSite, hydroInfo, _allWorkingCheckedListDict, this.svgImg32[1]); |
| | | } |
| | | |
| | | //创建方案 |
| | | private void btnCreateScheme_Click(object sender, EventArgs e) |
| | | //创建项目站方案 |
| | | private async void btnCreateProjectSiteScheme_Click(object sender, EventArgs e) |
| | | { |
| | | this.CreateProjectSchemeEvent?.Invoke(this.svgImg32[3]); |
| | | if (_project == null) |
| | | { |
| | | return; |
| | | } |
| | | if (_projectSite == null) |
| | | { |
| | | return; |
| | | } |
| | | var hydroInfo = await GetHydroInfo(true); |
| | | if (hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | this.CreateProjectSiteSchemeEvent?.Invoke(_project, _projectSite, hydroInfo, this.svgImg32[3]); |
| | | } |
| | | |
| | | //工况对比 |