lixiaojun
2024-12-23 b9c79f595e5ad4684d731f968bf120ff8c52dbd8
WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/05-function/SimulationFunctionCtrl.cs
@@ -3,6 +3,7 @@
using DevExpress.Utils.Extensions;
using DevExpress.Utils.Svg;
using DevExpress.XtraCharts;
using System.Collections.Concurrent;
using Yw.DAL.Basic;
using Yw.Vmo;
@@ -67,7 +68,7 @@
        private Dictionary<HydroWorkingVmo, bool> _allWorkingCheckedListDict = null;//所有工况选择列表字典
        private Dictionary<XhsSchemeVmo, Yw.Model.HydroModelInfo> _allSchemeHydroInfoDict = null;//所有方案水力信息列表
        private Dictionary<XhsSchemeVmo, Dictionary<HydroWorkingVmo, bool>> _allSchemeWorkingCheckedListDict = null;//所有方案工况选择列表字典
        private readonly object _locker = new();//锁定对象
        private ConcurrentDictionary<string, bool> _gettingHydroInfoDict = new ConcurrentDictionary<string, bool>();//获取水力信息字典
        /// <summary>
        /// 绑定数据
@@ -209,6 +210,10 @@
                    if (_hydroInfo == null)
                    {
                        hydroInfo = await GetHydroInfo(null);
                        if (hydroInfo == null)
                        {
                            return default;
                        }
                        if (_hydroInfo == null)
                        {
                            _hydroInfo = hydroInfo;
@@ -230,6 +235,10 @@
                if (!_allSchemeHydroInfoDict.ContainsKey(scheme))
                {
                    hydroInfo = await GetHydroInfo(scheme);
                    if (hydroInfo == null)
                    {
                        return default;
                    }
                    if (!_allSchemeHydroInfoDict.ContainsKey(scheme))
                    {
                        _allSchemeHydroInfoDict.Add(scheme, hydroInfo);
@@ -261,6 +270,18 @@
            {
                return default;
            }
            string key = $"{_project.ID}-{_projectSite.ID}-{scheme?.ID}";
            if (_gettingHydroInfoDict.TryGetValue(key, out bool getting))
            {
                if (getting)
                {
                    return default;
                }
            }
            if (!_gettingHydroInfoDict.TryAdd(key, true))
            {
                _gettingHydroInfoDict[key] = true;
            }
            HydroModelRelationVmo relation = null;
            if (scheme == null)
@@ -278,6 +299,7 @@
                return default;
            }
            var hydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(relation.ModelID);
            _gettingHydroInfoDict[key] = false;
            return hydroInfo;
        }
@@ -500,6 +522,10 @@
                elementWorking.Click += async (sender, e) =>
                {
                    var hydroInfo = await GetHydroInfo(null, true);
                    if (hydroInfo == null)
                    {
                        return;
                    }
                    this.ShowProjectSiteWorkingEvent?.Invoke(_project, _projectSite, null, hydroInfo, working, this.svgImg32[4]);
                };
                this.elementProjectSiteSimulation.Elements.Add(elementWorking);
@@ -550,6 +576,10 @@
                elementWorking.Click += async (sender, e) =>
                {
                    var hydroInfo = await GetHydroInfo(scheme, true);
                    if (hydroInfo == null)
                    {
                        return;
                    }
                    this.ShowProjectSiteWorkingEvent?.Invoke(_project, _projectSite, scheme, hydroInfo, working, this.svgImg32[4]);
                };
                elementScheme.Elements.Add(elementWorking);