From 0fd4a678c2218c42d383e964a6b4aca975aa7b7a Mon Sep 17 00:00:00 2001
From: Shuxia Ning <NingShuxia0927@outlook.com>
Date: 星期一, 02 十二月 2024 14:32:51 +0800
Subject: [PATCH] 图表修改

---
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs |  425 +++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 298 insertions(+), 127 deletions(-)

diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs
index daca05e..cd581a0 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs
@@ -50,7 +50,6 @@
             _projectSite = projectSite;
             _hydroInfo = hydroInfo;
             _allWorkingCheckedListDict = allWorkingCheckedListDict;
-            //this.PageTitle.Caption = $"{_project.Name}\r\n姘村姏妯℃嫙";
         }
 
         /// <summary>
@@ -308,6 +307,7 @@
             Q3d,
             Property,
             List,
+            Set,
             Search,
             Monitor,
             Check,
@@ -351,6 +351,13 @@
                     }
                     break;
                 case eVisualSource.List:
+                    {
+                        _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code);
+                        this.barBtnSetMonitor.Enabled = visual != null;
+                        SetPropertyCtrl(visual);
+                    }
+                    break;
+                case eVisualSource.Set:
                     {
                         _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code);
                         this.barBtnSetMonitor.Enabled = visual != null;
@@ -522,6 +529,15 @@
                 return;
             }
             _visualListCtrl?.UpdateBindingData();
+            var calcuResult = GetCalcuResult();
+            if (calcuResult != null && calcuResult.Succeed)
+            {
+                _visualListCtrl.SetCalcuView();
+            }
+            else
+            {
+                _visualListCtrl.SetNormalView();
+            }
         }
 
         //鏋勪欢鏄庣粏
@@ -646,95 +662,116 @@
             //姘村簱
             this.barBtnSetReservoirList.ItemClick += delegate
             {
-                //var dlg = new HydroReservoirBulkSetListDlg();
-                //dlg.ShowDialog();
+                if (_hydroInfo == null)
+                {
+                    return;
+                }
+                var dlg = new SetHydroReservoirListDlg();
+                dlg.SetBindingData(_hydroInfo);
+                dlg.HydroClickInfoEvent += (visual) =>
+                {
+                    SelectVisual(visual, eVisualSource.Set);
+                };
+                dlg.HydroChangedInfoEvent += visuals =>
+                {
+                    SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                };
+                dlg.ShowDialog();
             };
             //姘存睜
             this.barBtnSetTankList.ItemClick += delegate
             {
-                //var dlg = new HydroTankBulkSetListDlg();
-                //dlg.ShowDialog();
+                if (_hydroInfo == null)
+                {
+                    return;
+                }
+                var dlg = new SetHydroTankListDlg();
+                dlg.SetBindingData(_hydroInfo);
+                dlg.HydroClickInfoEvent += (visual) =>
+                {
+                    SelectVisual(visual, eVisualSource.Set);
+                };
+                dlg.HydroChangedInfoEvent += visuals =>
+                {
+                    SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                };
+                dlg.ShowDialog();
             };
             //姘寸
             this.barBtnSetWaterboxList.ItemClick += delegate
             {
-                //if (_hydroInfo == null)
-                //{
-                //    return;
-                //}
-                //var dlg = new SetHydroWaterboxListDlg();
-                //dlg.SetBindingData(_hydroInfo);
-                //dlg.HydroClickEvent += async (obj) =>
-                //{
-                //    if (obj == null)
-                //    {
-                //        return;
-                //    }
-                //    _selectedParter = obj;
-                //    await _bimfaceCtrl?.ZoomAndSelectComponent(obj.Code);
-                //    ShowProperty();
-                //};
-                //dlg.HydroChangedEvent += (obj) =>
-                //{
-
-                //};
-                //dlg.ShowDialog();
+                if (_hydroInfo == null)
+                {
+                    return;
+                }
+                var dlg = new SetHydroWaterboxListDlg();
+                dlg.SetBindingData(_hydroInfo);
+                dlg.HydroClickInfoEvent += (visual) =>
+                {
+                    SelectVisual(visual, eVisualSource.Set);
+                };
+                dlg.HydroChangedInfoEvent += visuals =>
+                {
+                    SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                };
+                dlg.ShowDialog();
             };
             //杩炴帴鑺傜偣
             this.barBtnSetJunctionList.ItemClick += delegate
             {
-                //var dlg = new HydroJunctionBulkSetListDlg();
-                //dlg.ShowDialog();
+                if (_hydroInfo == null)
+                {
+                    return;
+                }
+                var dlg = new SetHydroJunctionListDlg();
+                dlg.SetBindingData(_hydroInfo);
+                dlg.HydroClickInfoEvent += (visual) =>
+                {
+                    SelectVisual(visual, eVisualSource.Set);
+                };
+                dlg.HydroChangedInfoEvent += visuals =>
+                {
+                    SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                };
+                dlg.ShowDialog();
             };
             //闂峰ご
             this.barBtnSetBluntheadList.ItemClick += delegate
             {
-                //if (_hydroInfo == null)
-                //{
-                //    return;
-                //}
-                //var dlg = new SetHydroBluntheadListDlg();
-                //dlg.SetBindingData(_hydroInfo);
-                //dlg.HydroClickEvent += async (obj) =>
-                //{
-                //    if (obj == null)
-                //    {
-                //        return;
-                //    }
-                //    _selectedParter = obj;
-                //    await _bimfaceCtrl?.ZoomAndSelectComponent(obj.Code);
-                //    ShowProperty();
-                //};
-                //dlg.HydroChangedEvent += (obj) =>
-                //{
-
-                //};
-                //dlg.ShowDialog();
+                if (_hydroInfo == null)
+                {
+                    return;
+                }
+                var dlg = new SetHydroBluntheadListDlg();
+                dlg.SetBindingData(_hydroInfo);
+                dlg.HydroClickInfoEvent += (visual) =>
+                {
+                    SelectVisual(visual, eVisualSource.Set);
+                };
+                dlg.HydroChangedInfoEvent += visuals =>
+                {
+                    SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                };
+                dlg.ShowDialog();
             };
             //寮ご
             this.barBtnSetElbowsList.ItemClick += delegate
             {
-                //if (_hydroInfo == null)
-                //{
-                //    return;
-                //}
-                //var dlg = new SetHydroElbowListDlg();
-                //dlg.SetBindingData(_hydroInfo);
-                //dlg.HydroClickEvent += async (obj) =>
-                //{
-                //    if (obj == null)
-                //    {
-                //        return;
-                //    }
-                //    _selectedParter = obj;
-                //    await _bimfaceCtrl?.ZoomAndSelectComponent(obj.Code);
-                //    ShowProperty();
-                //};
-                //dlg.HydroChangedEvent += (obj) =>
-                //{
-
-                //};
-                //dlg.ShowDialog();
+                if (_hydroInfo == null)
+                {
+                    return;
+                }
+                var dlg = new SetHydroElbowListDlg();
+                dlg.SetBindingData(_hydroInfo);
+                dlg.HydroClickInfoEvent += (visual) =>
+                {
+                    SelectVisual(visual, eVisualSource.Set);
+                };
+                dlg.HydroChangedInfoEvent += visuals =>
+                {
+                    SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                };
+                dlg.ShowDialog();
             };
             //涓夐��
             this.barBtnSetThreelinkList.ItemClick += delegate
@@ -745,6 +782,14 @@
                 }
                 var dlg = new SetHydroThreelinkListDlg();
                 dlg.SetBindingData(_hydroInfo);
+                dlg.HydroClickInfoEvent += (visual) =>
+                {
+                    SelectVisual(visual, eVisualSource.Set);
+                };
+                dlg.HydroChangedInfoEvent += visuals =>
+                {
+                    SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                };
                 dlg.ShowDialog();
             };
             //鍥涢��
@@ -756,6 +801,14 @@
                 }
                 var dlg = new SetHydroFourlinkListDlg();
                 dlg.SetBindingData(_hydroInfo);
+                dlg.HydroClickInfoEvent += (visual) =>
+                {
+                    SelectVisual(visual, eVisualSource.Set);
+                };
+                dlg.HydroChangedInfoEvent += visuals =>
+                {
+                    SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                };
                 dlg.ShowDialog();
             };
             //姘磋〃
@@ -767,6 +820,14 @@
                 }
                 var dlg = new SetHydroMeterListDlg();
                 dlg.SetBindingData(_hydroInfo);
+                dlg.HydroClickInfoEvent += (visual) =>
+                {
+                    SelectVisual(visual, eVisualSource.Set);
+                };
+                dlg.HydroChangedInfoEvent += visuals =>
+                {
+                    SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                };
                 dlg.ShowDialog();
             };
             //娴侀噺璁�
@@ -778,6 +839,14 @@
                 }
                 var dlg = new SetHydroFlowmeterListDlg();
                 dlg.SetBindingData(_hydroInfo);
+                dlg.HydroClickInfoEvent += (visual) =>
+                {
+                    SelectVisual(visual, eVisualSource.Set);
+                };
+                dlg.HydroChangedInfoEvent += visuals =>
+                {
+                    SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                };
                 dlg.ShowDialog();
             };
             //鍘嬪姏琛�
@@ -789,6 +858,14 @@
                 }
                 var dlg = new SetHydroPressmeterListDlg();
                 dlg.SetBindingData(_hydroInfo);
+                dlg.HydroClickInfoEvent += (visual) =>
+                {
+                    SelectVisual(visual, eVisualSource.Set);
+                };
+                dlg.HydroChangedInfoEvent += visuals =>
+                {
+                    SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                };
                 dlg.ShowDialog();
             };
             //绠¢亾
@@ -800,6 +877,33 @@
                 }
                 var dlg = new SetHydroPipeListDlg();
                 dlg.SetBindingData(_hydroInfo);
+                dlg.HydroClickInfoEvent += (visual) =>
+                {
+                    SelectVisual(visual, eVisualSource.Set);
+                };
+                dlg.HydroChangedInfoEvent += visuals =>
+                {
+                    SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                };
+                dlg.ShowDialog();
+            };
+            //杩囨浮浠�
+            this.barBtnSetTranslationList.ItemClick += delegate
+            {
+                if (_hydroInfo == null)
+                {
+                    return;
+                }
+                var dlg = new SetHydroTranslationListDlg();
+                dlg.SetBindingData(_hydroInfo);
+                dlg.HydroClickInfoEvent += (visual) =>
+                {
+                    SelectVisual(visual, eVisualSource.Set);
+                };
+                dlg.HydroChangedInfoEvent += visuals =>
+                {
+                    SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                };
                 dlg.ShowDialog();
             };
             //姘存车
@@ -811,6 +915,14 @@
                 }
                 var dlg = new SetHydroPumpListDlg();
                 dlg.SetBindingData(_hydroInfo);
+                dlg.HydroClickInfoEvent += (visual) =>
+                {
+                    SelectVisual(visual, eVisualSource.Set);
+                };
+                dlg.HydroChangedInfoEvent += visuals =>
+                {
+                    SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                };
                 dlg.ShowDialog();
             };
             //闃�闂�
@@ -822,6 +934,52 @@
                 }
                 var dlg = new SetHydroValveListDlg();
                 dlg.SetBindingData(_hydroInfo);
+                dlg.HydroClickInfoEvent += (visual) =>
+                {
+                    SelectVisual(visual, eVisualSource.Set);
+                };
+                dlg.HydroChangedInfoEvent += visuals =>
+                {
+                    SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                };
+                dlg.ShowDialog();
+            };
+            //鎹㈢儹鍣�
+            this.barBtnSetExchangerList.ItemClick += delegate
+            {
+                if (_hydroInfo == null)
+                {
+                    return;
+                }
+                var dlg = new SetHydroExchangerListDlg();
+                dlg.SetBindingData(_hydroInfo);
+                dlg.HydroClickInfoEvent += (visual) =>
+                {
+                    SelectVisual(visual, eVisualSource.Set);
+                };
+                dlg.HydroChangedInfoEvent += visuals =>
+                {
+                    SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                };
+                dlg.ShowDialog();
+            };
+            //鎹㈢儹鍣�
+            this.barBtnSetCompressorList.ItemClick += delegate
+            {
+                if (_hydroInfo == null)
+                {
+                    return;
+                }
+                var dlg = new SetHydroCompressorListDlg();
+                dlg.SetBindingData(_hydroInfo);
+                dlg.HydroClickInfoEvent += (visual) =>
+                {
+                    SelectVisual(visual, eVisualSource.Set);
+                };
+                dlg.HydroChangedInfoEvent += visuals =>
+                {
+                    SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                };
                 dlg.ShowDialog();
             };
         }
@@ -991,6 +1149,26 @@
                 this.barBtnSetTranslationList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always;
             }
 
+            //姘存车
+            if (_hydroInfo.Pumps == null || _hydroInfo.Pumps.Count < 1)
+            {
+                this.barBtnSetPumpList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
+            }
+            else
+            {
+                this.barBtnSetPumpList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always;
+            }
+
+            //闃�闂�
+            if (_hydroInfo.Valves == null || _hydroInfo.Valves.Count < 1)
+            {
+                this.barBtnSetValveList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
+            }
+            else
+            {
+                this.barBtnSetValveList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always;
+            }
+
             //鎹㈢儹鍣�
             if (_hydroInfo.Exchangers == null || _hydroInfo.Exchangers.Count < 1)
             {
@@ -1011,25 +1189,6 @@
                 this.barBtnSetCompressorList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always;
             }
 
-            //姘存车
-            if (_hydroInfo.Pumps == null || _hydroInfo.Pumps.Count < 1)
-            {
-                this.barBtnSetPumpList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
-            }
-            else
-            {
-                this.barBtnSetPumpList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always;
-            }
-
-            //闃�闂�
-            if (_hydroInfo.Valves == null || _hydroInfo.Valves.Count < 1)
-            {
-                this.barBtnSetValveList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
-            }
-            else
-            {
-                this.barBtnSetValveList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always;
-            }
 
         }
 
@@ -1851,7 +2010,6 @@
                 return;
             }
             var netWork = Yw.Hydro.ParseHelper.ToNetwork(_hydroInfo);
-            var json = JsonHelper.Object2Json(netWork);
             var result = netWork.ToInpString();
             File.WriteAllText(fileName, result);
             TipFormHelper.ShowSucceed("瀵煎嚭鎴愬姛");
@@ -1860,6 +2018,12 @@
         #endregion
 
         #region 姘存车鍒楄〃
+
+        //鎬ц兘鏇茬嚎
+        private void barBtnPumpCurve_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+
+        }
 
         #region 骞惰仈妯℃嫙
 
@@ -1912,26 +2076,26 @@
 
             }
 
-            var dlg = new PumpParallelAnalyDlg();
-            dlg.SetBindingData(vmList);
-            dlg.ReloadDataEvent += (list) =>
-            {
-                list?.ForEach(x =>
-                {
-                    var pump = pumps.Find(t => t.Code == x.Code);
-                    if (pump != null)
-                    {
-                        pump.LinkStatus = x.RunStatus ? Yw.Hydro.PumpStatus.Open : Yw.Hydro.PumpStatus.Closed;
-                        pump.SpeedRatio = x.CurrentHz / pump.RatedHz;
-                    }
-                });
-                var codes = list?.Select(x => x.Code).ToList();
-                //UpdateVisualViewModelProperty(codes);
-                //ShowSelectedProperty();
-                UpdateVisualListCtrl();
-                return true;
-            };
-            dlg.ShowDialog();
+            //var dlg = new PumpParallelAnalyDlg();
+            //dlg.SetBindingData(vmList);
+            //dlg.ReloadDataEvent += (list) =>
+            //{
+            //    list?.ForEach(x =>
+            //    {
+            //        var pump = pumps.Find(t => t.Code == x.Code);
+            //        if (pump != null)
+            //        {
+            //            pump.LinkStatus = x.RunStatus ? Yw.Hydro.PumpStatus.Open : Yw.Hydro.PumpStatus.Closed;
+            //            pump.SpeedRatio = x.CurrentHz / pump.RatedHz;
+            //        }
+            //    });
+            //    var codes = list?.Select(x => x.Code).ToList();
+            //    //UpdateVisualViewModelProperty(codes);
+            //    //ShowSelectedProperty();
+            //    UpdateVisualListCtrl();
+            //    return true;
+            //};
+            //dlg.ShowDialog();
         }
 
         //骞惰仈妯℃嫙
@@ -2013,6 +2177,12 @@
 
                 var visualVmListHelper = GetVisualVmListHelper();
                 visualVmListHelper.UpdateCalcuProperty(calcuResult);
+
+                #endregion
+
+                #region 鏋勪欢鏄庣粏
+
+                UpdateVisualListCtrl();
 
                 #endregion
 
@@ -2230,23 +2400,23 @@
 
             }
 
-            var dlg = new PumpParallelAnalyDlg();
-            dlg.SetBindingData(vmList);
-            dlg.ReloadDataEvent += (list) =>
-            {
-                list?.ForEach(x =>
-                {
-                    var pump = _hydroInfo.Pumps?.Find(t => t.Code == x.Code);
-                    if (pump != null)
-                    {
-                        pump.LinkStatus = x.RunStatus ? Yw.Hydro.PumpStatus.Open : Yw.Hydro.PumpStatus.Closed;
-                        pump.SpeedRatio = Math.Round(x.CurrentHz / pump.RatedHz, 1);
-                    }
-                });
-                //ShowSelectedProperty();
-                return true;
-            };
-            dlg.ShowDialog();
+            //var dlg = new PumpParallelAnalyDlg();
+            //dlg.SetBindingData(vmList);
+            //dlg.ReloadDataEvent += (list) =>
+            //{
+            //    list?.ForEach(x =>
+            //    {
+            //        var pump = _hydroInfo.Pumps?.Find(t => t.Code == x.Code);
+            //        if (pump != null)
+            //        {
+            //            pump.LinkStatus = x.RunStatus ? Yw.Hydro.PumpStatus.Open : Yw.Hydro.PumpStatus.Closed;
+            //            pump.SpeedRatio = Math.Round(x.CurrentHz / pump.RatedHz, 1);
+            //        }
+            //    });
+            //    //ShowSelectedProperty();
+            //    return true;
+            //};
+            //dlg.ShowDialog();
         }
 
         //鑳芥晥鍒嗘瀽
@@ -2383,5 +2553,6 @@
 
 
 
+
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3