lixiaojun
2024-12-23 b9c79f595e5ad4684d731f968bf120ff8c52dbd8
WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/01-property/SimulationPropertyCtrl.cs
@@ -63,6 +63,15 @@
        #region 属性赋值
        /// <summary>
        /// 允许编辑
        /// </summary>
        public bool AllowEdit
        {
            get { return this.hydroVisualPropertyCtrl1.AllowEdit; }
            set { this.hydroVisualPropertyCtrl1.AllowEdit = value; }
        }
        /// <summary>
        /// 选择对象
        /// </summary>
        public HydroVisualViewModel SelectedObject
@@ -122,11 +131,14 @@
                    {
                        var tankViewModel = vm as HydroTankViewModel;
                        var input = HydroMatchingHelper.Create(tankViewModel);
                        var dlg = new SimulationTankSingleMatchingDlg();
                        var dlg = new AssetsTankSingleMatchingDlg();
                        dlg.ReloadDataEvent += (output) =>
                        {
                            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();
@@ -137,11 +149,14 @@
                    {
                        var tankViewModel = vm as HydroTankViewModel;
                        var input = HydroMatchingHelper.Create(tankViewModel);
                        var dlg = new SimulationTankSingleMatchingDlg();
                        var dlg = new AssetsTankSingleMatchingDlg();
                        dlg.ReloadDataEvent += (output) =>
                        {
                            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();
@@ -150,6 +165,19 @@
                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;
@@ -162,6 +190,9 @@
                        {
                            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();
@@ -170,36 +201,127 @@
                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;
@@ -212,6 +334,9 @@
                        {
                            HydroMatchingHelper.Apply(pipeViewModel, output);
                            this.hydroVisualPropertyCtrl1.UpdateRows();
                            this.PropertyValueChangedEvent?.Invoke(vm.Vmo);
                            this.MarkPropertyValueChangedEvent?.Invoke(vm.Vmo);
                            this.GradingPropertyValueChangedEvent?.Invoke(vm.Vmo);
                        };
                        dlg.ShowDialog();
                    }
@@ -226,6 +351,9 @@
                        {
                            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();
@@ -234,16 +362,55 @@
                case Yw.Hydro.ParterCatalog.Valve:
                    {
                        var valveViewModel = vm as HydroValveViewModel;
                        var input = HydroMatchingHelper.Create(valveViewModel);
                        var dlg = new AssetsValveSingleMatchingDlg();
                        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;
@@ -262,28 +429,65 @@
            {
                case HydroCurve.Tank:
                    {
                        if (long.TryParse(vm.DbId, out long longDbId))
                        {
                            var tankViewModel = vm as HydroTankViewModel;
                            var dlg = new AssetsTankCurveVOLViewDlg();
                            dlg.SetBindingData(longDbId);
                            dlg.ShowDialog();
                        }
                    }
                    break;
                case HydroCurve.Pump:
                    {
                        var pumpViewModel = vm as HydroPumpViewModel;
                        //var dlg = new PumpChartShowDlg();
                        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 AssetsValveCurveViewDlg();
                            dlg.SetBindingData(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;