From ab65b0ac21e7fabfd8548538142d9a1b66a2ad3d Mon Sep 17 00:00:00 2001
From: duheng <2784771470@qq.com>
Date: 星期五, 20 十二月 2024 13:14:49 +0800
Subject: [PATCH] Merge branch 'master' of http://47.103.154.90:83/r/HStation/XHS.V1.0

---
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/01-property/SimulationPropertyCtrl.cs |  274 +++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 227 insertions(+), 47 deletions(-)

diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/01-property/SimulationPropertyCtrl.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/01-property/SimulationPropertyCtrl.cs
index 669f7cb..9b9d012 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/01-property/SimulationPropertyCtrl.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/01-property/SimulationPropertyCtrl.cs
@@ -1,4 +1,5 @@
-锘縰sing HStation.WinFrmUI.PhartRelation;
+锘縰sing DevExpress.Utils.MVVM;
+using HStation.WinFrmUI.PhartRelation;
 using HStation.WinFrmUI.Xhs;
 using Yw.Model;
 
@@ -62,6 +63,15 @@
         #region 灞炴�ц祴鍊�
 
         /// <summary>
+        /// 鍏佽缂栬緫
+        /// </summary>
+        public bool AllowEdit
+        {
+            get { return this.hydroVisualPropertyCtrl1.AllowEdit; }
+            set { this.hydroVisualPropertyCtrl1.AllowEdit = value; }
+        }
+
+        /// <summary>
         /// 閫夋嫨瀵硅薄
         /// </summary>
         public HydroVisualViewModel SelectedObject
@@ -104,7 +114,7 @@
             this.hydroVisualPropertyCtrl1.UpdateRows();
         }
 
-        #endregion 灞炴�ф洿鏂�
+        #endregion
 
         #region 浜嬩欢瀹炵幇
 
@@ -120,13 +130,15 @@
                 case Yw.Hydro.ParterCatalog.Tank:
                     {
                         var tankViewModel = vm as HydroTankViewModel;
-                        var input = HydroMatchingHelper.Create(tankViewModel.Vmo, tankViewModel.HydroInfo);
+                        var input = HydroMatchingHelper.Create(tankViewModel);
                         var dlg = new SimulationTankSingleMatchingDlg();
                         dlg.ReloadDataEvent += (output) =>
                         {
-                            HydroMatchingHelper.Apply(tankViewModel.HydroInfo, tankViewModel.Vmo, output);
-                            tankViewModel.UpdateProperty();
+                            HydroMatchingHelper.Apply(tankViewModel, output);
                             this.hydroVisualPropertyCtrl1.UpdateRows();
+                            this.PropertyValueChangedEvent?.Invoke(vm.Vmo);
+                            this.MarkPropertyValueChangedEvent?.Invoke(vm.Vmo);
+                            this.GradingPropertyValueChangedEvent?.Invoke(vm.Vmo);
                         };
                         dlg.SetBindingData(input);
                         dlg.ShowDialog();
@@ -135,13 +147,15 @@
                 case Yw.Hydro.ParterCatalog.Waterbox:
                     {
                         var tankViewModel = vm as HydroTankViewModel;
-                        var input = HydroMatchingHelper.Create(tankViewModel.Vmo, tankViewModel.HydroInfo);
+                        var input = HydroMatchingHelper.Create(tankViewModel);
                         var dlg = new SimulationTankSingleMatchingDlg();
                         dlg.ReloadDataEvent += (output) =>
                         {
-                            HydroMatchingHelper.Apply(tankViewModel.HydroInfo, tankViewModel.Vmo, output);
-                            tankViewModel.UpdateProperty();
+                            HydroMatchingHelper.Apply(tankViewModel, output);
                             this.hydroVisualPropertyCtrl1.UpdateRows();
+                            this.PropertyValueChangedEvent?.Invoke(vm.Vmo);
+                            this.MarkPropertyValueChangedEvent?.Invoke(vm.Vmo);
+                            this.GradingPropertyValueChangedEvent?.Invoke(vm.Vmo);
                         };
                         dlg.SetBindingData(input);
                         dlg.ShowDialog();
@@ -149,19 +163,33 @@
                     break;
                 case Yw.Hydro.ParterCatalog.Blunthead:
                     {
-
+                        var bluntheadViewModel = vm as HydroBluntheadViewModel;
+                        var input = HydroMatchingHelper.Create(bluntheadViewModel);
+                        var dlg = new SimulationBluntheadSingleMatchingDlg();
+                        dlg.ReloadDataEvent += (output) =>
+                        {
+                            HydroMatchingHelper.Apply(bluntheadViewModel, output);
+                            this.hydroVisualPropertyCtrl1.UpdateRows();
+                            this.PropertyValueChangedEvent?.Invoke(vm.Vmo);
+                            this.MarkPropertyValueChangedEvent?.Invoke(vm.Vmo);
+                            this.GradingPropertyValueChangedEvent?.Invoke(vm.Vmo);
+                        };
+                        dlg.SetBindingData(input);
+                        dlg.ShowDialog();
                     }
                     break;
                 case Yw.Hydro.ParterCatalog.Elbow:
                     {
                         var elbowViewModel = vm as HydroElbowViewModel;
-                        var input = HydroMatchingHelper.Create(elbowViewModel.Vmo, elbowViewModel.HydroInfo);
+                        var input = HydroMatchingHelper.Create(elbowViewModel);
                         var dlg = new SimulationElbowSingleMatchingDlg();
                         dlg.ReloadDataEvent += (output) =>
                         {
-                            HydroMatchingHelper.Apply(elbowViewModel.HydroInfo, elbowViewModel.Vmo, output);
-                            elbowViewModel.UpdateProperty();
+                            HydroMatchingHelper.Apply(elbowViewModel, output);
                             this.hydroVisualPropertyCtrl1.UpdateRows();
+                            this.PropertyValueChangedEvent?.Invoke(vm.Vmo);
+                            this.MarkPropertyValueChangedEvent?.Invoke(vm.Vmo);
+                            this.GradingPropertyValueChangedEvent?.Invoke(vm.Vmo);
                         };
                         dlg.SetBindingData(input);
                         dlg.ShowDialog();
@@ -169,42 +197,137 @@
                     break;
                 case Yw.Hydro.ParterCatalog.Threelink:
                     {
-
+                        var threelinkViewModel = vm as HydroThreelinkViewModel;
+                        var input = HydroMatchingHelper.Create(threelinkViewModel);
+                        var dlg = new SimulationThreelinkSingleMatchingDlg();
+                        dlg.ReloadDataEvent += (output) =>
+                        {
+                            HydroMatchingHelper.Apply(threelinkViewModel, output);
+                            this.hydroVisualPropertyCtrl1.UpdateRows();
+                            this.PropertyValueChangedEvent?.Invoke(vm.Vmo);
+                            this.MarkPropertyValueChangedEvent?.Invoke(vm.Vmo);
+                            this.GradingPropertyValueChangedEvent?.Invoke(vm.Vmo);
+                        };
+                        dlg.SetBindingData(input);
+                        dlg.ShowDialog();
                     }
                     break;
                 case Yw.Hydro.ParterCatalog.Fourlink:
                     {
-
+                        var fourlinkViewModel = vm as HydroFourlinkViewModel;
+                        var input = HydroMatchingHelper.Create(fourlinkViewModel);
+                        var dlg = new SimulationFourlinkSingleMatchingDlg();
+                        dlg.ReloadDataEvent += (output) =>
+                        {
+                            HydroMatchingHelper.Apply(fourlinkViewModel, output);
+                            this.hydroVisualPropertyCtrl1.UpdateRows();
+                            this.PropertyValueChangedEvent?.Invoke(vm.Vmo);
+                            this.MarkPropertyValueChangedEvent?.Invoke(vm.Vmo);
+                            this.GradingPropertyValueChangedEvent?.Invoke(vm.Vmo);
+                        };
+                        dlg.SetBindingData(input);
+                        dlg.ShowDialog();
                     }
                     break;
                 case Yw.Hydro.ParterCatalog.Meter:
                     {
-
+                        var meterViewModel = vm as HydroMeterViewModel;
+                        var input = HydroMatchingHelper.Create(meterViewModel);
+                        var dlg = new AssetsMeterSingleMatchingDlg();
+                        dlg.ReloadDataEvent += (output) =>
+                        {
+                            HydroMatchingHelper.Apply(meterViewModel, output);
+                            this.hydroVisualPropertyCtrl1.UpdateRows();
+                            this.PropertyValueChangedEvent?.Invoke(vm.Vmo);
+                            this.MarkPropertyValueChangedEvent?.Invoke(vm.Vmo);
+                            this.GradingPropertyValueChangedEvent?.Invoke(vm.Vmo);
+                        };
+                        dlg.SetBindingData(input);
+                        dlg.ShowDialog();
                     }
                     break;
                 case Yw.Hydro.ParterCatalog.Flowmeter:
                     {
-
+                        var flowmeterViewModel = vm as HydroFlowmeterViewModel;
+                        var input = HydroMatchingHelper.Create(flowmeterViewModel);
+                        var dlg = new AssetsFlowmeterSingleMatchingDlg();
+                        dlg.ReloadDataEvent += (output) =>
+                        {
+                            HydroMatchingHelper.Apply(flowmeterViewModel, output);
+                            this.hydroVisualPropertyCtrl1.UpdateRows();
+                            this.PropertyValueChangedEvent?.Invoke(vm.Vmo);
+                            this.MarkPropertyValueChangedEvent?.Invoke(vm.Vmo);
+                            this.GradingPropertyValueChangedEvent?.Invoke(vm.Vmo);
+                        };
+                        dlg.SetBindingData(input);
+                        dlg.ShowDialog();
                     }
                     break;
                 case Yw.Hydro.ParterCatalog.Pressmeter:
                     {
-
+                        var pressmeterViewModel = vm as HydroPressmeterViewModel;
+                        var input = HydroMatchingHelper.Create(pressmeterViewModel);
+                        var dlg = new AssetsPressmeterSingleMatchingDlg();
+                        dlg.ReloadDataEvent += (output) =>
+                        {
+                            HydroMatchingHelper.Apply(pressmeterViewModel, output);
+                            this.hydroVisualPropertyCtrl1.UpdateRows();
+                            this.PropertyValueChangedEvent?.Invoke(vm.Vmo);
+                            this.MarkPropertyValueChangedEvent?.Invoke(vm.Vmo);
+                            this.GradingPropertyValueChangedEvent?.Invoke(vm.Vmo);
+                        };
+                        dlg.SetBindingData(input);
+                        dlg.ShowDialog();
                     }
                     break;
                 case Yw.Hydro.ParterCatalog.Nozzle:
                     {
-
+                        var nozzleViewModel = vm as HydroNozzleViewModel;
+                        var input = HydroMatchingHelper.Create(nozzleViewModel);
+                        var dlg = new SimulationSprinklerSingleMatchingDlg();
+                        dlg.ReloadDataEvent += (output) =>
+                        {
+                            HydroMatchingHelper.Apply(nozzleViewModel, output);
+                            this.hydroVisualPropertyCtrl1.UpdateRows();
+                            this.PropertyValueChangedEvent?.Invoke(vm.Vmo);
+                            this.MarkPropertyValueChangedEvent?.Invoke(vm.Vmo);
+                            this.GradingPropertyValueChangedEvent?.Invoke(vm.Vmo);
+                        };
+                        dlg.SetBindingData(input);
+                        dlg.ShowDialog();
                     }
                     break;
                 case Yw.Hydro.ParterCatalog.Hydrant:
                     {
-
+                        var hydrantViewModel = vm as HydroHydrantViewModel;
+                        var input = HydroMatchingHelper.Create(hydrantViewModel);
+                        var dlg = new SimulationHydrantSingleMatchingDlg();
+                        dlg.ReloadDataEvent += (output) =>
+                        {
+                            HydroMatchingHelper.Apply(hydrantViewModel, output);
+                            this.hydroVisualPropertyCtrl1.UpdateRows();
+                            this.PropertyValueChangedEvent?.Invoke(vm.Vmo);
+                            this.MarkPropertyValueChangedEvent?.Invoke(vm.Vmo);
+                            this.GradingPropertyValueChangedEvent?.Invoke(vm.Vmo);
+                        };
+                        dlg.SetBindingData(input);
+                        dlg.ShowDialog();
                     }
                     break;
                 case Yw.Hydro.ParterCatalog.Pipe:
                     {
-
+                        var pipeViewModel = vm as HydroPipeViewModel;
+                        var input = HydroMatchingHelper.Create(pipeViewModel);
+                        var dlg = new SimulationPipeSingleMatchingDlg();
+                        dlg.ReloadDataEvent += (output) =>
+                        {
+                            HydroMatchingHelper.Apply(pipeViewModel, output);
+                            this.hydroVisualPropertyCtrl1.UpdateRows();
+                            this.PropertyValueChangedEvent?.Invoke(vm.Vmo);
+                            this.MarkPropertyValueChangedEvent?.Invoke(vm.Vmo);
+                            this.GradingPropertyValueChangedEvent?.Invoke(vm.Vmo);
+                        };
+                        dlg.ShowDialog();
                     }
                     break;
                 case Yw.Hydro.ParterCatalog.Pump:
@@ -214,9 +337,11 @@
                         var dlg = new SimulationPumpSingleMatchingDlg();
                         dlg.ReloadDataEvent += (output) =>
                         {
-                            HydroMatchingHelper.Apply(pumpViewModel.HydroInfo, pumpViewModel.Vmo, output);
-                            pumpViewModel.UpdateProperty();
+                            HydroMatchingHelper.Apply(pumpViewModel, output);
                             this.hydroVisualPropertyCtrl1.UpdateRows();
+                            this.PropertyValueChangedEvent?.Invoke(vm.Vmo);
+                            this.MarkPropertyValueChangedEvent?.Invoke(vm.Vmo);
+                            this.GradingPropertyValueChangedEvent?.Invoke(vm.Vmo);
                         };
                         dlg.SetBindingData(input);
                         dlg.ShowDialog();
@@ -224,17 +349,53 @@
                     break;
                 case Yw.Hydro.ParterCatalog.Valve:
                     {
-
+                        var valveViewModel = vm as HydroValveViewModel;
+                        var input = HydroMatchingHelper.Create(valveViewModel);
+                        var dlg = new SimulationValveSingleMatchingDlg();
+                        dlg.ReloadDataEvent += (output) =>
+                        {
+                            HydroMatchingHelper.Apply(valveViewModel, output);
+                            this.hydroVisualPropertyCtrl1.UpdateRows();
+                            this.PropertyValueChangedEvent?.Invoke(vm.Vmo);
+                            this.MarkPropertyValueChangedEvent?.Invoke(vm.Vmo);
+                            this.GradingPropertyValueChangedEvent?.Invoke(vm.Vmo);
+                        };
+                        dlg.SetBindingData(input);
+                        dlg.ShowDialog();
                     }
                     break;
                 case Yw.Hydro.ParterCatalog.Exchanger:
                     {
-
+                        var exchangerViewModel = vm as HydroExchangerViewModel;
+                        var input = HydroMatchingHelper.Create(exchangerViewModel);
+                        var dlg = new AssetsExchangerSingleMatchingDlg();
+                        dlg.ReloadDataEvent += (output) =>
+                        {
+                            HydroMatchingHelper.Apply(exchangerViewModel, output);
+                            this.hydroVisualPropertyCtrl1.UpdateRows();
+                            this.PropertyValueChangedEvent?.Invoke(vm.Vmo);
+                            this.MarkPropertyValueChangedEvent?.Invoke(vm.Vmo);
+                            this.GradingPropertyValueChangedEvent?.Invoke(vm.Vmo);
+                        };
+                        dlg.SetBindingData(input);
+                        dlg.ShowDialog();
                     }
                     break;
                 case Yw.Hydro.ParterCatalog.Compressor:
                     {
-
+                        var compressorViewModel = vm as HydroCompressorViewModel;
+                        var input = HydroMatchingHelper.Create(compressorViewModel);
+                        var dlg = new AssetsCompressorSingleMatchingDlg();
+                        dlg.ReloadDataEvent += (output) =>
+                        {
+                            HydroMatchingHelper.Apply(compressorViewModel, output);
+                            this.hydroVisualPropertyCtrl1.UpdateRows();
+                            this.PropertyValueChangedEvent?.Invoke(vm.Vmo);
+                            this.MarkPropertyValueChangedEvent?.Invoke(vm.Vmo);
+                            this.GradingPropertyValueChangedEvent?.Invoke(vm.Vmo);
+                        };
+                        dlg.SetBindingData(input);
+                        dlg.ShowDialog();
                     }
                     break;
                 default: break;
@@ -253,46 +414,63 @@
             {
                 case HydroCurve.Tank:
                     {
+                        if (long.TryParse(vm.DbId, out long longDbId))
+                        {
+                            var tankViewModel = vm as HydroTankViewModel;
+                            var dlg = new TankChartShowDlg();
+                            dlg.SetBingingData(longDbId);
+                            dlg.ShowDialog();
+                        }
 
                     }
                     break;
                 case HydroCurve.Pump:
                     {
-                        //var pumpInfo = vm.HydroInfo.Pumps?.Find(x => x.Code == vm.Code);
-                        //if (pumpInfo == null)
-                        //{
-                        //    break;
-                        //}
-                        //var input = AssetsMatchingParasHelper.Create(vm.HydroInfo, pumpInfo, null);
-                        //var dlg = new SinglePumpAnalyDlg();
-                        //dlg.SetBindindData(input);
-                        //dlg.ReloadDataEvent += (output) =>
-                        //{
-                        //    var bol = AssetsMatchingParasHelper.Apply(vm.HydroInfo, output);
-                        //    if (bol)
-                        //    {
-                        //        vm.UpdateProperty();
-                        //        this.hydroVisualPropertyCtrl1.UpdateRows();
-                        //    }
-                        //    return bol;
-                        //};
-                        //dlg.ShowDialog();
-                        //return true;
+                        var pumpViewModel = vm as HydroPumpViewModel;
+                        var dlg = new SimulationSinglePumpFeatDlg();
+                        dlg.SaveEvent += (working) =>
+                        {
+                            pumpViewModel.Vmo.LinkStatus = working.LinkStatus;
+                            pumpViewModel.Vmo.SpeedRatio = working.CurrentHz / pumpViewModel.Vmo.RatedHz;
+                            pumpViewModel.UpdateProperty();
+                            this.hydroVisualPropertyCtrl1.UpdateRows();
+                        };
+                        dlg.SetBindingData(pumpViewModel);
+                        dlg.ShowDialog();
                     }
                     break;
                 case HydroCurve.Valve:
                     {
-
+                        if (long.TryParse(vm.DbId, out long longDbId))
+                        {
+                            var valveViewModel = vm as HydroValveViewModel;
+                            var dlg = new ValveChartShowDlg();
+                            dlg.SetBingingData(longDbId);
+                            dlg.ShowDialog();
+                        }
                     }
                     break;
                 case HydroCurve.Exchanger:
                     {
+                        if (long.TryParse(vm.DbId, out long longDbId))
+                        {
+                            var exchangerViewModel = vm as HydroExchangerViewModel;
+                            var dlg = new AssetsExchangerCurveQLViewDlg();
+                            dlg.SetBindingData(longDbId);
+                            dlg.ShowDialog();
+                        }
 
                     }
                     break;
                 case HydroCurve.Compressor:
                     {
-
+                        if (long.TryParse(vm.DbId, out long longDbId))
+                        {
+                            var compressorViewModel = vm as HydroCompressorViewModel;
+                            var dlg = new AssetsCompressorCurveQLViewDlg();
+                            dlg.SetBindingData(longDbId);
+                            dlg.ShowDialog();
+                        }
                     }
                     break;
                 default: break;
@@ -348,5 +526,7 @@
         }
 
         #endregion
+
+
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3