From f107df56388e042b8041691a05c604122bf978e0 Mon Sep 17 00:00:00 2001 From: duheng <2784771470@qq.com> Date: 星期二, 03 十二月 2024 14:28:11 +0800 Subject: [PATCH] Merge branch 'master' of http://47.103.154.90:83/r/HStation/XHS.V1.0 --- WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/05-fourlink/HydroFourlinkMatchingViewModel.cs | 0 WinFrmUI/Yw.WinFrmUI.Hydro.Core/19-pump/05-state/HydroPumpListStateEditCtrl.cs | 88 + WinFrmUI/Yw.WinFrmUI.Hydro.Core/10-working/00-core/HydroWorkingExtensions.cs | 30 WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/02-feat/SimulationPumpFeatCtrl.Designer.cs | 171 ++ WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/10-hydrant/HydroHydrantMatchingViewModel.cs | 0 WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/01-tank/HydroTankMatchingViewModel.cs | 0 WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/08-pressmeter/HydroFlowmeterMatchingViewModel.cs | 0 WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/01-parallel/SimulationPumpParallelCtrl.cs | 2 WinFrmUI/Yw.WinFrmUI.Phart.Core/Yw.WinFrmUI.Phart.Core.csproj | 2 WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/11-pipe/HydroPipeMatchingViewModel.cs | 0 WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/15-exchanger/HydroExchangerMatchingViewModel.cs | 0 WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/14-valve/HydroValveMatchingViewModel.cs | 13 WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/02-blunthead/HydroBluntheadMatchingViewModel.cs | 0 WinFrmUI/Yw.WinFrmUI.Hydro.Core/19-pump/05-state/HydroPumpListStateEditCtrl.resx | 25 WinFrmUI/Yw.WinFrmUI.Hydro.Core/00-core/03-helper/HydroElbowTypeEnumHelper.cs | 44 WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/12-translation/HydroTranslationMatchingViewModel.cs | 0 WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/02-feat/SimulationPumpFeatDlg.Designer.cs | 19 WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/06-meter/HydroMeterMatchingViewModel.cs | 0 WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/02-feat/SimulationPumpFeatDlg.cs | 20 WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/01-parallel/SimulationPumpParallelDlg.Designer.cs | 30 WinFrmUI/Yw.WinFrmUI.Hydro.Core/10-working/02-visual/03-pump/SetHydroPumpWorkingDlg.resx | 123 + WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/16-compressor/HydroCompressorMatchingViewModel.cs | 0 WinFrmUI/Yw.WinFrmUI.Hydro.Core/10-working/02-visual/03-pump/SetHydroPumpWorkingDlg.Designer.cs | 177 ++ WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/03-elbow/HydroElbowMatchingViewModel.cs | 8 WinFrmUI/HStation.WinFrmUI.Xhs.Core/HStation.WinFrmUI.Xhs.Core.csproj.user | 3 WinFrmUI/Yw.WinFrmUI.Hydro.Core/10-working/02-visual/03-pump/SetHydroPumpWorkingDlg.cs | 90 + WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/07-flowmeter/HydroFlowmeterMatchingViewModel.cs | 0 WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs | 35 WinFrmUI/Yw.WinFrmUI.Hydro.Core/Yw.WinFrmUI.Hydro.Core.csproj | 3 WinFrmUI/Yw.WinFrmUI.Phart.Core/v3/02-pump/02-multi/01-parallel/PumpParallelChart.cs | 150 + WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/02-feat/SimulationPumpFeatCtrl.resx | 120 + /dev/null | 9 WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/04-threelink/HydroThreelinkMatchingViewModel.cs | 0 WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/00-core/HydroMatchingHelper.cs | 2227 +++++++++++++++++++++++++--------- WinFrmUI/Yw.WinFrmUI.Hydro.Core/00-core/03-helper/HydroValveTypeEnumHelper.cs | 52 WinFrmUI/Yw.WinFrmUI.Hydro.Core/19-pump/05-state/HydroPumpListItemStateViewModel.cs | 10 WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/12-pump/HydroPumpMatchingViewModel.cs | 20 WinFrmUI/Yw.WinFrmUI.Hydro.Core/19-pump/05-state/HydroPumpListStateEditCtrl.Designer.cs | 16 WinFrmUI/Yw.WinFrmUI.Phart.Core/v3/02-pump/01-single/02-operation/PumpOperationChart.cs | 245 +- WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/02-feat/SimulationPumpFeatCtrl.cs | 117 + 40 files changed, 3,002 insertions(+), 847 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 30329d5..5353bc2 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 @@ -2020,14 +2020,37 @@ #region 姘存车鍒楄〃 //鎬ц兘鏇茬嚎 - private void barBtnPumpCurve_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + private void PumpFeat() { + if (_hydroInfo == null) + { + return; + } + var pumps = _hydroInfo.Pumps; + if (pumps == null || pumps.Count < 1) + { + XtraMessageBox.Show("鏃犳按娉典俊鎭�"); + return; + } var dlg = new SimulationPumpFeatDlg(); + dlg.SaveEvent += async (list) => + { + pumps.ForEach(x => x.UpdateWorkingInfo(list)); + var visualVmListHelper = GetVisualVmListHelper(); + visualVmListHelper.UpdateProperty(pumps.Select(x => x as Yw.Model.HydroVisualInfo).ToList()); + SelectVisual(_visual, eVisualSource.None); + var gradingHelper = await GetGradingHelper(); + gradingHelper.Set(); + }; dlg.SetBindingData(_hydroInfo); dlg.ShowDialog(); } - #region 骞惰仈妯℃嫙 + //鎬ц兘鏇茬嚎 + private void barBtnPumpCurve_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + PumpFeat(); + } //骞惰仈妯℃嫙 private void PumpParallel() @@ -2057,14 +2080,12 @@ var visualVmListHelper = GetVisualVmListHelper(); visualVmListHelper.UpdateProperty(pumps.Select(x => x as Yw.Model.HydroVisualInfo).ToList()); SelectVisual(_visual, eVisualSource.None); - var calcuResultLabelHelper = await GetCalcuResultLabelHelper(); - calcuResultLabelHelper.Set(); + var gradingHelper = await GetGradingHelper(); + gradingHelper.Set(); }; dlg.SetBindingData(_hydroInfo); dlg.ShowDialog(); } - - //骞惰仈妯℃嫙 private void barBtnPumpParallel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) @@ -2072,8 +2093,6 @@ PumpParallel(); } - - #endregion #endregion diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/01-parallel/SimulationPumpParallelCtrl.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/01-parallel/SimulationPumpParallelCtrl.cs index b1399f2..9115df9 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/01-parallel/SimulationPumpParallelCtrl.cs +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/01-parallel/SimulationPumpParallelCtrl.cs @@ -59,7 +59,7 @@ //淇濆瓨 private void btnSave_Click(object sender, EventArgs e) { - var result = XtraMessageBox.Show("鏄惁灏嗙幇鏈夋按娉电姸鎬佹洿鏂版ā鍨嬶紵", "璇㈤棶", MessageBoxButtons.YesNo) == DialogResult.Yes; + var result = XtraMessageBox.Show("鏄惁浣跨敤鐜版湁姘存车鐘舵�佹洿鏂版ā鍨嬶紵", "璇㈤棶", MessageBoxButtons.YesNo) == DialogResult.Yes; if (!result) { return; diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/01-parallel/SimulationPumpParallelDlg.Designer.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/01-parallel/SimulationPumpParallelDlg.Designer.cs index 198c510..870180b 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/01-parallel/SimulationPumpParallelDlg.Designer.cs +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/01-parallel/SimulationPumpParallelDlg.Designer.cs @@ -29,11 +29,11 @@ private void InitializeComponent() { ribbon = new DevExpress.XtraBars.Ribbon.RibbonControl(); + barStaticStatus = new DevExpress.XtraBars.BarStaticItem(); ribbonPage1 = new DevExpress.XtraBars.Ribbon.RibbonPage(); ribbonPageGroup1 = new DevExpress.XtraBars.Ribbon.RibbonPageGroup(); - simulationPumpParallelCtrl1 = new SimulationPumpParallelCtrl(); ribbonStatusBar1 = new DevExpress.XtraBars.Ribbon.RibbonStatusBar(); - barStaticStatus = new DevExpress.XtraBars.BarStaticItem(); + simulationPumpParallelCtrl1 = new SimulationPumpParallelCtrl(); ((ISupportInitialize)ribbon).BeginInit(); SuspendLayout(); // @@ -50,6 +50,12 @@ ribbon.Size = new Size(1051, 32); ribbon.StatusBar = ribbonStatusBar1; // + // barStaticStatus + // + barStaticStatus.Alignment = DevExpress.XtraBars.BarItemLinkAlignment.Right; + barStaticStatus.Id = 1; + barStaticStatus.Name = "barStaticStatus"; + // // ribbonPage1 // ribbonPage1.Groups.AddRange(new DevExpress.XtraBars.Ribbon.RibbonPageGroup[] { ribbonPageGroup1 }); @@ -61,14 +67,6 @@ ribbonPageGroup1.Name = "ribbonPageGroup1"; ribbonPageGroup1.Text = "ribbonPageGroup1"; // - // simulationPumpParallelCtrl1 - // - simulationPumpParallelCtrl1.Dock = DockStyle.Fill; - simulationPumpParallelCtrl1.Location = new Point(0, 32); - simulationPumpParallelCtrl1.Name = "simulationPumpParallelCtrl1"; - simulationPumpParallelCtrl1.Size = new Size(1051, 603); - simulationPumpParallelCtrl1.TabIndex = 1; - // // ribbonStatusBar1 // ribbonStatusBar1.ItemLinks.Add(barStaticStatus); @@ -77,19 +75,21 @@ ribbonStatusBar1.Ribbon = ribbon; ribbonStatusBar1.Size = new Size(1051, 24); // - // barStaticStatus + // simulationPumpParallelCtrl1 // - barStaticStatus.Alignment = DevExpress.XtraBars.BarItemLinkAlignment.Right; - barStaticStatus.Id = 1; - barStaticStatus.Name = "barStaticStatus"; + simulationPumpParallelCtrl1.Dock = DockStyle.Fill; + simulationPumpParallelCtrl1.Location = new Point(0, 32); + simulationPumpParallelCtrl1.Name = "simulationPumpParallelCtrl1"; + simulationPumpParallelCtrl1.Size = new Size(1051, 579); + simulationPumpParallelCtrl1.TabIndex = 1; // // SimulationPumpParallelDlg // AutoScaleDimensions = new SizeF(7F, 14F); AutoScaleMode = AutoScaleMode.Font; ClientSize = new Size(1051, 635); - Controls.Add(ribbonStatusBar1); Controls.Add(simulationPumpParallelCtrl1); + Controls.Add(ribbonStatusBar1); Controls.Add(ribbon); FormBorderStyle = FormBorderStyle.SizableToolWindow; Name = "SimulationPumpParallelDlg"; diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/02-feat/SimulationPumpFeatCtrl.Designer.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/02-feat/SimulationPumpFeatCtrl.Designer.cs new file mode 100644 index 0000000..fdc9f10 --- /dev/null +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/02-feat/SimulationPumpFeatCtrl.Designer.cs @@ -0,0 +1,171 @@ +锘縩amespace HStation.WinFrmUI +{ + partial class SimulationPumpFeatCtrl + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + layoutControl1 = new DevExpress.XtraLayout.LayoutControl(); + panelControl1 = new PanelControl(); + pumpOperationChart1 = new Yw.WinFrmUI.Phart.PumpOperationChart(); + hydroPumpListStateEditCtrl1 = new HydroPumpListStateEditCtrl(); + Root = new DevExpress.XtraLayout.LayoutControlGroup(); + layoutControlGroup1 = new DevExpress.XtraLayout.LayoutControlGroup(); + layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem(); + splitterItem1 = new DevExpress.XtraLayout.SplitterItem(); + layoutControlItem3 = new DevExpress.XtraLayout.LayoutControlItem(); + ((ISupportInitialize)layoutControl1).BeginInit(); + layoutControl1.SuspendLayout(); + ((ISupportInitialize)panelControl1).BeginInit(); + panelControl1.SuspendLayout(); + ((ISupportInitialize)Root).BeginInit(); + ((ISupportInitialize)layoutControlGroup1).BeginInit(); + ((ISupportInitialize)layoutControlItem1).BeginInit(); + ((ISupportInitialize)splitterItem1).BeginInit(); + ((ISupportInitialize)layoutControlItem3).BeginInit(); + SuspendLayout(); + // + // layoutControl1 + // + layoutControl1.Controls.Add(panelControl1); + layoutControl1.Controls.Add(hydroPumpListStateEditCtrl1); + layoutControl1.Dock = DockStyle.Fill; + layoutControl1.Location = new Point(0, 0); + layoutControl1.Name = "layoutControl1"; + layoutControl1.OptionsCustomizationForm.DesignTimeCustomizationFormPositionAndSize = new Rectangle(1055, 304, 650, 400); + layoutControl1.Root = Root; + layoutControl1.Size = new Size(952, 597); + layoutControl1.TabIndex = 0; + layoutControl1.Text = "layoutControl1"; + // + // panelControl1 + // + panelControl1.BorderStyle = BorderStyles.Simple; + panelControl1.Controls.Add(pumpOperationChart1); + panelControl1.Location = new Point(229, 2); + panelControl1.Name = "panelControl1"; + panelControl1.Padding = new Padding(1); + panelControl1.Size = new Size(721, 593); + panelControl1.TabIndex = 7; + // + // pumpOperationChart1 + // + pumpOperationChart1.Dock = DockStyle.Fill; + pumpOperationChart1.LineNameVisible = true; + pumpOperationChart1.LineVisible = false; + pumpOperationChart1.Location = new Point(3, 3); + pumpOperationChart1.Margin = new Padding(2, 2, 2, 2); + pumpOperationChart1.Name = "pumpOperationChart1"; + pumpOperationChart1.Size = new Size(715, 587); + pumpOperationChart1.TabIndex = 0; + // + // hydroPumpListStateEditCtrl1 + // + hydroPumpListStateEditCtrl1.Location = new Point(2, 24); + hydroPumpListStateEditCtrl1.Name = "hydroPumpListStateEditCtrl1"; + hydroPumpListStateEditCtrl1.Size = new Size(213, 571); + hydroPumpListStateEditCtrl1.TabIndex = 4; + // + // Root + // + Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True; + Root.GroupBordersVisible = false; + Root.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] { layoutControlGroup1, splitterItem1, layoutControlItem3 }); + Root.Name = "Root"; + Root.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0); + Root.Size = new Size(952, 597); + Root.TextVisible = false; + // + // layoutControlGroup1 + // + layoutControlGroup1.GroupStyle = DevExpress.Utils.GroupStyle.Title; + layoutControlGroup1.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] { layoutControlItem1 }); + layoutControlGroup1.Location = new Point(0, 0); + layoutControlGroup1.Name = "layoutControlGroup1"; + layoutControlGroup1.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0); + layoutControlGroup1.Size = new Size(217, 597); + layoutControlGroup1.Text = "姘存车鍒楄〃"; + // + // layoutControlItem1 + // + layoutControlItem1.Control = hydroPumpListStateEditCtrl1; + layoutControlItem1.Location = new Point(0, 0); + layoutControlItem1.Name = "layoutControlItem1"; + layoutControlItem1.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0); + layoutControlItem1.Size = new Size(213, 571); + layoutControlItem1.TextSize = new Size(0, 0); + layoutControlItem1.TextVisible = false; + // + // splitterItem1 + // + splitterItem1.AllowHotTrack = true; + splitterItem1.Location = new Point(217, 0); + splitterItem1.Name = "splitterItem1"; + splitterItem1.Size = new Size(10, 597); + // + // layoutControlItem3 + // + layoutControlItem3.Control = panelControl1; + layoutControlItem3.Location = new Point(227, 0); + layoutControlItem3.Name = "layoutControlItem3"; + layoutControlItem3.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0); + layoutControlItem3.Size = new Size(725, 597); + layoutControlItem3.Spacing = new DevExpress.XtraLayout.Utils.Padding(2, 2, 2, 2); + layoutControlItem3.TextSize = new Size(0, 0); + layoutControlItem3.TextVisible = false; + // + // SimulationPumpFeatCtrl + // + AutoScaleDimensions = new SizeF(7F, 14F); + AutoScaleMode = AutoScaleMode.Font; + Controls.Add(layoutControl1); + Name = "SimulationPumpFeatCtrl"; + Size = new Size(952, 597); + ((ISupportInitialize)layoutControl1).EndInit(); + layoutControl1.ResumeLayout(false); + ((ISupportInitialize)panelControl1).EndInit(); + panelControl1.ResumeLayout(false); + ((ISupportInitialize)Root).EndInit(); + ((ISupportInitialize)layoutControlGroup1).EndInit(); + ((ISupportInitialize)layoutControlItem1).EndInit(); + ((ISupportInitialize)splitterItem1).EndInit(); + ((ISupportInitialize)layoutControlItem3).EndInit(); + ResumeLayout(false); + } + + #endregion + + private DevExpress.XtraLayout.LayoutControl layoutControl1; + private HydroPumpListStateEditCtrl hydroPumpListStateEditCtrl1; + private DevExpress.XtraLayout.LayoutControlGroup Root; + private DevExpress.XtraLayout.LayoutControlGroup layoutControlGroup1; + private DevExpress.XtraLayout.LayoutControlItem layoutControlItem1; + private DevExpress.XtraLayout.SplitterItem splitterItem1; + private PanelControl panelControl1; + private DevExpress.XtraLayout.LayoutControlItem layoutControlItem3; + private Yw.WinFrmUI.Phart.PumpOperationChart pumpOperationChart1; + } +} diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/02-feat/SimulationPumpFeatCtrl.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/02-feat/SimulationPumpFeatCtrl.cs new file mode 100644 index 0000000..2eeec34 --- /dev/null +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/02-feat/SimulationPumpFeatCtrl.cs @@ -0,0 +1,117 @@ +锘縰sing DevExpress.XtraEditors; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using Yw.Geometry; +using Yw.Pump; +using Yw.WinFrmUI.Phart; + +namespace HStation.WinFrmUI +{ + public partial class SimulationPumpFeatCtrl : DevExpress.XtraEditors.XtraUserControl + { + public SimulationPumpFeatCtrl() + { + InitializeComponent(); + this.layoutControl1.SetupLayoutControl(); + this.hydroPumpListStateEditCtrl1.SelectedChangedEvent += HydroPumpListStateEditCtrl1_SelectedChangedEvent; + } + + /// <summary> + /// 淇濆瓨浜嬩欢 + /// </summary> + public event Action<List<HydroWorkingPumpViewModel>> SaveEvent; + + /// <summary> + /// + /// </summary> + public void SetBindingData(Yw.Model.HydroModelInfo hydroInfo) + { + this.hydroPumpListStateEditCtrl1.SetBindingData(hydroInfo); + } + + + private void HydroPumpListStateEditCtrl1_SelectedChangedEvent(HydroPumpListItemStateViewModel obj) + { + var vm = CreateViewModel(obj); + this.pumpOperationChart1.SetBindingData(vm); + } + + //鍒涘缓 + private PumpOperationViewModel CreateViewModel(HydroPumpListItemStateViewModel state) + { + var vm = new PumpOperationViewModel(); + vm.Id = state.Code; + vm.Name = state.Name; + vm.RatedQ = state.Vmo.RatedQ.HasValue ? state.Vmo.RatedQ.Value : 0; + vm.RatedH = state.Vmo.RatedH.HasValue ? state.Vmo.RatedH.Value : 0; + vm.RatedP = state.Vmo.RatedP; + vm.RatedN = state.Vmo.RatedN.HasValue ? state.Vmo.RatedN.Value : 0; + vm.RatedHz = state.Vmo.RatedHz; + vm.CurrentHz = state.CurrentHz; + vm.CurrentN = Math.Round(state.CurrentHz / state.Vmo.RatedHz * vm.RatedN, 1); + vm.CurrentStatus = state.RunStatus; + + var curveqh = state.HydroInfo.Curves?.Find(x => x.Code == state.Vmo.CurveQH); + if (curveqh != null) + { + var qh_pts = curveqh.CurveData?.Select(x => new Yw.Geometry.Point2d(x.X, x.Y)).ToList(); + if (qh_pts != null && qh_pts.Count > 3) + { + vm.CurveQH = new CubicSpline2d(qh_pts); + var qh_current_pts = qh_pts.GetQHPointListByN(state.Vmo.RatedHz, state.CurrentHz); + vm.CurrentCurveQH = new CubicSpline2d(qh_current_pts); + } + } + + var curveqp = state.HydroInfo.Curves?.Find(x => x.Code == state.Vmo.CurveQP); + if (curveqp != null) + { + var qppts = curveqp.CurveData?.Select(x => new Yw.Geometry.Point2d(x.X, x.Y)).ToList(); + if (qppts != null && qppts.Count > 3) + { + vm.CurveQP = new CubicSpline2d(qppts); + var sqppts = qppts.GetQHPointListByN(state.Vmo.RatedHz, state.CurrentHz); + vm.CurrentCurveQP = new CubicSpline2d(sqppts); + } + } + + var curveqe = state.HydroInfo.Curves?.Find(x => x.Code == state.Vmo.CurveQE); + if (curveqe != null) + { + var qepts = curveqe.CurveData?.Select(x => new Yw.Geometry.Point2d(x.X, x.Y)).ToList(); + if (qepts != null && qepts.Count > 3) + { + vm.CurveQE = new CubicSpline2d(qepts); + var sqepts = qepts.GetQHPointListByN(state.Vmo.RatedHz, state.CurrentHz); + vm.CurrentCurveQE = new CubicSpline2d(sqepts); + } + } + + return vm; + } + + /// <summary> + /// 淇濆瓨 + /// </summary> + public void Save() + { + if (this.hydroPumpListStateEditCtrl1.HasChanged) + { + var result = XtraMessageBox.Show("鏄惁浣跨敤鐜版湁姘存车鐘舵�佹洿鏂版ā鍨嬶紵", "璇㈤棶", MessageBoxButtons.YesNo) == DialogResult.Yes; + if (result) + { + var allWorkingList = this.hydroPumpListStateEditCtrl1.GetWorkingList(); + this.SaveEvent?.Invoke(allWorkingList); + } + } + } + + } +} diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/02-feat/SimulationPumpFeatCtrl.resx b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/02-feat/SimulationPumpFeatCtrl.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/02-feat/SimulationPumpFeatCtrl.resx @@ -0,0 +1,120 @@ +锘�<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root> \ No newline at end of file diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/02-feat/SimulationPumpFeatDlg.Designer.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/02-feat/SimulationPumpFeatDlg.Designer.cs index 33be06f..58c452c 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/02-feat/SimulationPumpFeatDlg.Designer.cs +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/02-feat/SimulationPumpFeatDlg.Designer.cs @@ -31,7 +31,7 @@ ribbon = new DevExpress.XtraBars.Ribbon.RibbonControl(); ribbonPage1 = new DevExpress.XtraBars.Ribbon.RibbonPage(); ribbonPageGroup1 = new DevExpress.XtraBars.Ribbon.RibbonPageGroup(); - hydroPumpListStateGridCtrl1 = new HydroPumpListStateEditCtrl(); + simulationPumpFeatCtrl1 = new SimulationPumpFeatCtrl(); ((ISupportInitialize)ribbon).BeginInit(); SuspendLayout(); // @@ -58,20 +58,20 @@ ribbonPageGroup1.Name = "ribbonPageGroup1"; ribbonPageGroup1.Text = "ribbonPageGroup1"; // - // hydroPumpListStateGridCtrl1 + // simulationPumpFeatCtrl1 // - hydroPumpListStateGridCtrl1.Dock = DockStyle.Left; - hydroPumpListStateGridCtrl1.Location = new Point(0, 32); - hydroPumpListStateGridCtrl1.Name = "hydroPumpListStateGridCtrl1"; - hydroPumpListStateGridCtrl1.Size = new Size(295, 601); - hydroPumpListStateGridCtrl1.TabIndex = 1; + simulationPumpFeatCtrl1.Dock = DockStyle.Fill; + simulationPumpFeatCtrl1.Location = new Point(0, 32); + simulationPumpFeatCtrl1.Name = "simulationPumpFeatCtrl1"; + simulationPumpFeatCtrl1.Size = new Size(996, 601); + simulationPumpFeatCtrl1.TabIndex = 3; // // SimulationPumpFeatDlg // AutoScaleDimensions = new SizeF(7F, 14F); AutoScaleMode = AutoScaleMode.Font; ClientSize = new Size(996, 633); - Controls.Add(hydroPumpListStateGridCtrl1); + Controls.Add(simulationPumpFeatCtrl1); Controls.Add(ribbon); FormBorderStyle = FormBorderStyle.SizableToolWindow; Name = "SimulationPumpFeatDlg"; @@ -79,6 +79,7 @@ RibbonVisibility = DevExpress.XtraBars.Ribbon.RibbonVisibility.Hidden; StartPosition = FormStartPosition.CenterParent; Text = "骞惰仈妯℃嫙"; + FormClosing += SimulationPumpFeatDlg_FormClosing; ((ISupportInitialize)ribbon).EndInit(); ResumeLayout(false); PerformLayout(); @@ -89,6 +90,6 @@ private DevExpress.XtraBars.Ribbon.RibbonControl ribbon; private DevExpress.XtraBars.Ribbon.RibbonPage ribbonPage1; private DevExpress.XtraBars.Ribbon.RibbonPageGroup ribbonPageGroup1; - private HydroPumpListStateEditCtrl hydroPumpListStateGridCtrl1; + private SimulationPumpFeatCtrl simulationPumpFeatCtrl1; } } \ No newline at end of file diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/02-feat/SimulationPumpFeatDlg.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/02-feat/SimulationPumpFeatDlg.cs index 33342dc..5925698 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/02-feat/SimulationPumpFeatDlg.cs +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/02-feat/SimulationPumpFeatDlg.cs @@ -6,13 +6,31 @@ { InitializeComponent(); this.IconOptions.Icon = Yw.WinFrmUI.GlobalParas.AppIcon; + this.simulationPumpFeatCtrl1.SaveEvent += SimulationPumpFeatCtrl1_SaveEvent; } + /// <summary> + /// 淇濆瓨浜嬩欢 + /// </summary> + public event Action<List<HydroWorkingPumpViewModel>> SaveEvent; + + private void SimulationPumpFeatCtrl1_SaveEvent(List<HydroWorkingPumpViewModel> obj) + { + this.SaveEvent?.Invoke(obj); + } + + /// <summary> + /// 缁戝畾鏁版嵁 + /// </summary> public void SetBindingData(Yw.Model.HydroModelInfo hydroInfo) { - this.hydroPumpListStateGridCtrl1.SetBindingData(hydroInfo); + this.simulationPumpFeatCtrl1.SetBindingData(hydroInfo); } + private void SimulationPumpFeatDlg_FormClosing(object sender, FormClosingEventArgs e) + { + this.simulationPumpFeatCtrl1.Save(); + } } } \ No newline at end of file diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/HStation.WinFrmUI.Xhs.Core.csproj.user b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/HStation.WinFrmUI.Xhs.Core.csproj.user index 99d90ec..3a8aa4a 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/HStation.WinFrmUI.Xhs.Core.csproj.user +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/HStation.WinFrmUI.Xhs.Core.csproj.user @@ -199,6 +199,9 @@ <Compile Update="03-simulation\11-pump\01-parallel\SimulationPumpParallelCtrl.cs"> <SubType>UserControl</SubType> </Compile> + <Compile Update="03-simulation\11-pump\02-feat\SimulationPumpFeatCtrl.cs"> + <SubType>UserControl</SubType> + </Compile> <Compile Update="03-simulation\XhsProjectSimulationMgrPage.cs"> <SubType>UserControl</SubType> </Compile> diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/00-core/01-const/HydroElbow.cs b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/00-core/01-const/HydroElbow.cs deleted file mode 100644 index 3349296..0000000 --- a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/00-core/01-const/HydroElbow.cs +++ /dev/null @@ -1,25 +0,0 @@ -锘縩amespace Yw.WinFrmUI -{ - /// <summary> - /// 寮ご - /// </summary> - public class HydroElbow - { - /// <summary> - /// 鐭緞 - /// </summary> - public const string Short = "鐭緞"; - - /// <summary> - /// 涓緞 - /// </summary> - public const string Middle = "涓緞"; - - /// <summary> - /// 闀垮緞 - /// </summary> - public const string Long = "闀垮緞"; - - - } -} diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/00-core/03-helper/HydroElbowTypeEnumHelper.cs b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/00-core/03-helper/HydroElbowTypeEnumHelper.cs new file mode 100644 index 0000000..d238f06 --- /dev/null +++ b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/00-core/03-helper/HydroElbowTypeEnumHelper.cs @@ -0,0 +1,44 @@ +锘縩amespace Yw.WinFrmUI +{ + /// <summary> + /// 寮ご鏋氫妇杈呭姪绫� + /// </summary> + public class HydroElbowTypeEnumHelper + { + + //瀛楀吀 + private static readonly Dictionary<eElbowType, string> _dict = new Dictionary<eElbowType, string>() + { + { eElbowType.Short,"鐭緞"}, + { eElbowType.Middle,"涓緞"}, + { eElbowType.Long,"闀垮緞"} + }; + + /// <summary> + /// 鑾峰彇寮ご绫诲瀷 + /// </summary> + public static eElbowType? GetElbowType(string name) + { + if (_dict.ContainsValue(name)) + { + return _dict.First(x => x.Value == name).Key; + } + return default; + } + + /// <summary> + /// 鑾峰彇寮ご绫诲瀷鍚嶇О + /// </summary> + public static string GetElbowTypeName(eElbowType elbowType) + { + if (_dict.ContainsKey(elbowType)) + { + return _dict[elbowType]; + } + return default; + } + + + + } +} diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/00-core/03-helper/HydroValveTypeEnumHelper.cs b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/00-core/03-helper/HydroValveTypeEnumHelper.cs new file mode 100644 index 0000000..a7e6cb5 --- /dev/null +++ b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/00-core/03-helper/HydroValveTypeEnumHelper.cs @@ -0,0 +1,52 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Yw.WinFrmUI +{ + /// <summary> + /// 闃�闂ㄧ被鍨嬫灇涓捐緟鍔╃被 + /// </summary> + public class HydroValveTypeEnumHelper + { + //瀛楀吀 + private static readonly Dictionary<eValveType, string> _dict = new Dictionary<eValveType, string>() + { + { eValveType.PRV,Yw.Hydro.ValveType.PRV}, + { eValveType.PBV,Yw.Hydro.ValveType.PBV}, + { eValveType.PSV,Yw.Hydro.ValveType.PSV}, + { eValveType.FCV,Yw.Hydro.ValveType.FCV}, + { eValveType.TCV,Yw.Hydro.ValveType.TCV}, + { eValveType.GPV,Yw.Hydro.ValveType.GPV}, + { eValveType.CV,Yw.Hydro.ValveType.CV}, + }; + + /// <summary> + /// 鑾峰彇闃�闂ㄧ被鍨� + /// </summary> + public static eValveType? GetValveType(string name) + { + if (_dict.ContainsValue(name)) + { + return _dict.First(x => x.Value == name).Key; + } + return default; + } + + /// <summary> + /// 鑾峰彇闃�闂ㄧ被鍨嬬紪鐮� + /// </summary> + public static string GetValveTypeCode(eValveType valveType) + { + if (_dict.ContainsKey(valveType)) + { + return _dict[valveType]; + } + return default; + } + + + } +} diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/10-working/00-core/HydroWorkingExtensions.cs b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/10-working/00-core/HydroWorkingExtensions.cs index 2720f8b..4d50248 100644 --- a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/10-working/00-core/HydroWorkingExtensions.cs +++ b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/10-working/00-core/HydroWorkingExtensions.cs @@ -115,6 +115,36 @@ } + /// <summary> + /// 鏇存柊宸ュ喌淇℃伅 + /// </summary> + public static void UpdateWorkingInfo(this Yw.Model.HydroPumpInfo pumpInfo, HydroWorkingPumpViewModel pumpWorkingInfo) + { + if (pumpInfo == null) + { + return; + } + if (pumpWorkingInfo == null) + { + return; + } + pumpInfo.LinkStatus = pumpWorkingInfo.LinkStatus; + pumpInfo.SpeedRatio = pumpWorkingInfo.CurrentHz / pumpInfo.RatedHz; + } + + /// <summary> + /// 鏇存柊宸ュ喌淇℃伅 + /// </summary> + public static void UpdateWorkingInfo(this Yw.Model.HydroPumpInfo pumpInfo, List<HydroWorkingPumpViewModel> allWorkingList) + { + if (pumpInfo == null) + { + return; + } + var workingInfo = allWorkingList?.Find(x => x.Code == pumpInfo.Code); + pumpInfo.UpdateWorkingInfo(workingInfo); + } + } } diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/10-working/00-core/HydroWorkingViewModel.cs b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/10-working/00-core/HydroWorkingViewModel.cs deleted file mode 100644 index ad7f8b8..0000000 --- a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/10-working/00-core/HydroWorkingViewModel.cs +++ /dev/null @@ -1,9 +0,0 @@ -锘縩amespace Yw.WinFrmUI -{ - /// <summary> - /// - /// </summary> - public class HydroWorkingViewModel - { - } -} diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/10-working/02-visual/03-pump/SetHydroPumpWorkingDlg.Designer.cs b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/10-working/02-visual/03-pump/SetHydroPumpWorkingDlg.Designer.cs new file mode 100644 index 0000000..52bc6be --- /dev/null +++ b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/10-working/02-visual/03-pump/SetHydroPumpWorkingDlg.Designer.cs @@ -0,0 +1,177 @@ +锘縩amespace Yw.WinFrmUI +{ + partial class SetHydroPumpWorkingDlg + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + components = new Container(); + layoutControl1 = new DevExpress.XtraLayout.LayoutControl(); + generalOkAndCancelCtrl1 = new GeneralOkAndCancelCtrl(); + txtCurrentHz = new DevExpress.XtraEditors.TextEdit(); + imgCmbLinkStatus = new DevExpress.XtraEditors.ImageComboBoxEdit(); + Root = new DevExpress.XtraLayout.LayoutControlGroup(); + layoutControlItem10 = new DevExpress.XtraLayout.LayoutControlItem(); + layoutControlItem2 = new DevExpress.XtraLayout.LayoutControlItem(); + layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem(); + dxErrorProvider1 = new DevExpress.XtraEditors.DXErrorProvider.DXErrorProvider(components); + ((ISupportInitialize)layoutControl1).BeginInit(); + layoutControl1.SuspendLayout(); + ((ISupportInitialize)txtCurrentHz.Properties).BeginInit(); + ((ISupportInitialize)imgCmbLinkStatus.Properties).BeginInit(); + ((ISupportInitialize)Root).BeginInit(); + ((ISupportInitialize)layoutControlItem10).BeginInit(); + ((ISupportInitialize)layoutControlItem2).BeginInit(); + ((ISupportInitialize)layoutControlItem1).BeginInit(); + ((ISupportInitialize)dxErrorProvider1).BeginInit(); + SuspendLayout(); + // + // layoutControl1 + // + layoutControl1.Controls.Add(generalOkAndCancelCtrl1); + layoutControl1.Controls.Add(txtCurrentHz); + layoutControl1.Controls.Add(imgCmbLinkStatus); + layoutControl1.Dock = DockStyle.Fill; + layoutControl1.Location = new Point(0, 0); + layoutControl1.Name = "layoutControl1"; + layoutControl1.OptionsCustomizationForm.DesignTimeCustomizationFormPositionAndSize = new Rectangle(670, 266, 650, 400); + layoutControl1.Root = Root; + layoutControl1.Size = new Size(385, 74); + layoutControl1.TabIndex = 1; + layoutControl1.Text = "layoutControl1"; + // + // generalOkAndCancelCtrl1 + // + generalOkAndCancelCtrl1.ButtonCancelMaxSize = new Size(100, 26); + generalOkAndCancelCtrl1.ButtonCancelMinSize = new Size(100, 26); + generalOkAndCancelCtrl1.ButtonOkMaxSize = new Size(100, 26); + generalOkAndCancelCtrl1.ButtonOkMinSize = new Size(100, 26); + generalOkAndCancelCtrl1.Location = new Point(12, 36); + generalOkAndCancelCtrl1.Name = "generalOkAndCancelCtrl1"; + generalOkAndCancelCtrl1.Size = new Size(361, 26); + generalOkAndCancelCtrl1.TabIndex = 3; + // + // txtCurrentHz + // + txtCurrentHz.Location = new Point(258, 12); + txtCurrentHz.Name = "txtCurrentHz"; + txtCurrentHz.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.False; + txtCurrentHz.Properties.DisplayFormat.FormatString = "{0}hz"; + txtCurrentHz.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Custom; + txtCurrentHz.Properties.MaskSettings.Set("MaskManagerType", typeof(DevExpress.Data.Mask.NumericMaskManager)); + txtCurrentHz.Properties.MaskSettings.Set("MaskManagerSignature", "allowNull=False"); + txtCurrentHz.Properties.NullValuePrompt = "hz"; + txtCurrentHz.Size = new Size(115, 20); + txtCurrentHz.StyleController = layoutControl1; + txtCurrentHz.TabIndex = 2; + // + // imgCmbLinkStatus + // + imgCmbLinkStatus.Location = new Point(76, 12); + imgCmbLinkStatus.Name = "imgCmbLinkStatus"; + imgCmbLinkStatus.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo) }); + imgCmbLinkStatus.Size = new Size(114, 20); + imgCmbLinkStatus.StyleController = layoutControl1; + imgCmbLinkStatus.TabIndex = 0; + // + // Root + // + Root.AppearanceItemCaption.Options.UseTextOptions = true; + Root.AppearanceItemCaption.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far; + Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True; + Root.GroupBordersVisible = false; + Root.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] { layoutControlItem10, layoutControlItem2, layoutControlItem1 }); + Root.Name = "Root"; + Root.Size = new Size(385, 74); + Root.TextVisible = false; + // + // layoutControlItem10 + // + layoutControlItem10.Control = imgCmbLinkStatus; + layoutControlItem10.Location = new Point(0, 0); + layoutControlItem10.Name = "layoutControlItem10"; + layoutControlItem10.Size = new Size(182, 24); + layoutControlItem10.Text = "寮�鏈虹姸鎬�:"; + layoutControlItem10.TextSize = new Size(52, 14); + // + // layoutControlItem2 + // + layoutControlItem2.Control = generalOkAndCancelCtrl1; + layoutControlItem2.Location = new Point(0, 24); + layoutControlItem2.Name = "layoutControlItem2"; + layoutControlItem2.Size = new Size(365, 30); + layoutControlItem2.TextSize = new Size(0, 0); + layoutControlItem2.TextVisible = false; + // + // layoutControlItem1 + // + layoutControlItem1.Control = txtCurrentHz; + layoutControlItem1.Location = new Point(182, 0); + layoutControlItem1.Name = "layoutControlItem1"; + layoutControlItem1.Size = new Size(183, 24); + layoutControlItem1.Text = "璁惧畾棰戠巼:"; + layoutControlItem1.TextSize = new Size(52, 14); + // + // dxErrorProvider1 + // + dxErrorProvider1.ContainerControl = this; + // + // SetHydroPumpWorkingDlg + // + AutoScaleDimensions = new SizeF(7F, 14F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(385, 74); + Controls.Add(layoutControl1); + MaximizeBox = false; + Name = "SetHydroPumpWorkingDlg"; + StartPosition = FormStartPosition.CenterParent; + Text = "璁剧疆"; + ((ISupportInitialize)layoutControl1).EndInit(); + layoutControl1.ResumeLayout(false); + ((ISupportInitialize)txtCurrentHz.Properties).EndInit(); + ((ISupportInitialize)imgCmbLinkStatus.Properties).EndInit(); + ((ISupportInitialize)Root).EndInit(); + ((ISupportInitialize)layoutControlItem10).EndInit(); + ((ISupportInitialize)layoutControlItem2).EndInit(); + ((ISupportInitialize)layoutControlItem1).EndInit(); + ((ISupportInitialize)dxErrorProvider1).EndInit(); + ResumeLayout(false); + } + + #endregion + + private DevExpress.XtraLayout.LayoutControl layoutControl1; + private DevExpress.XtraLayout.LayoutControlGroup Root; + private DevExpress.XtraEditors.DXErrorProvider.DXErrorProvider dxErrorProvider1; + private DevExpress.XtraLayout.LayoutControlItem layoutControlItem8; + private DevExpress.XtraEditors.ImageComboBoxEdit imgCmbLinkStatus; + private DevExpress.XtraLayout.LayoutControlItem layoutControlItem10; + private DevExpress.XtraEditors.TextEdit txtCurrentHz; + private DevExpress.XtraLayout.LayoutControlItem layoutControlItem1; + private GeneralOkAndCancelCtrl generalOkAndCancelCtrl1; + private DevExpress.XtraLayout.LayoutControlItem layoutControlItem2; + } +} \ No newline at end of file diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/10-working/02-visual/03-pump/SetHydroPumpWorkingDlg.cs b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/10-working/02-visual/03-pump/SetHydroPumpWorkingDlg.cs new file mode 100644 index 0000000..84be983 --- /dev/null +++ b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/10-working/02-visual/03-pump/SetHydroPumpWorkingDlg.cs @@ -0,0 +1,90 @@ +锘縩amespace Yw.WinFrmUI +{ + public partial class SetHydroPumpWorkingDlg : DevExpress.XtraEditors.XtraForm + { + public SetHydroPumpWorkingDlg() + { + InitializeComponent(); + this.IconOptions.Icon = Yw.WinFrmUI.GlobalParas.AppIcon; + this.layoutControl1.SetupLayoutControl(); + this.generalOkAndCancelCtrl1.OkEvent += GeneralOkAndCancelCtrl1_OkEvent; + InitialLinkStatus(); + } + + /// <summary> + /// 閲嶈浇鏁版嵁浜嬩欢 + /// </summary> + public event Action<HydroWorkingPumpViewModel> ReloadDataEvent; + + private HydroWorkingPumpViewModel _working = null;//宸ュ喌 + + /// <summary> + /// 缁戝畾鏁版嵁 + /// </summary> + public void SetBindingData(Yw.Model.HydroPumpInfo visual) + { + if (visual == null) + { + return; + } + var working = new HydroWorkingPumpViewModel(visual); + SetBindingData(working); + } + + /// <summary> + /// 缁戝畾鏁版嵁 + /// </summary> + public void SetBindingData(HydroWorkingPumpViewModel working) + { + _working = working; + this.imgCmbLinkStatus.EditValue = working.LinkStatus; + this.txtCurrentHz.EditValue = working.CurrentHz; + } + + //鍒濆鍖栫娈电姸鎬� + private void InitialLinkStatus() + { + this.imgCmbLinkStatus.Properties.BeginUpdate(); + this.imgCmbLinkStatus.Properties.Items.Clear(); + this.imgCmbLinkStatus.Properties.Items.Add(HydroLinkStatusHelper.GetStatusName(Yw.Hydro.LinkStatus.Open), Yw.Hydro.LinkStatus.Open, -1); + this.imgCmbLinkStatus.Properties.Items.Add(HydroLinkStatusHelper.GetStatusName(Yw.Hydro.LinkStatus.Closed), Yw.Hydro.LinkStatus.Closed, -1); + this.imgCmbLinkStatus.Properties.EndUpdate(); + } + + //楠岃瘉 + private bool Valid() + { + this.dxErrorProvider1.ClearErrors(); + if (this.imgCmbLinkStatus.EditValue == null) + { + this.dxErrorProvider1.SetError(this.imgCmbLinkStatus, "蹇呴�夐」"); + return false; + } + if (this.txtCurrentHz.EditValue == null) + { + this.dxErrorProvider1.SetError(this.txtCurrentHz, "蹇呭~椤�"); + return false; + } + return true; + } + + //纭畾 + private void GeneralOkAndCancelCtrl1_OkEvent() + { + if (_working == null) + { + return; + } + if (!Valid()) + { + return; + } + _working.LinkStatus = this.imgCmbLinkStatus.EditValue.ToString(); + _working.CurrentHz = double.Parse(this.txtCurrentHz.EditValue.ToString()); + this.ReloadDataEvent?.Invoke(_working); + this.DialogResult = DialogResult.OK; + this.Close(); + } + + } +} \ No newline at end of file diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/10-working/02-visual/03-pump/SetHydroPumpWorkingDlg.resx b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/10-working/02-visual/03-pump/SetHydroPumpWorkingDlg.resx new file mode 100644 index 0000000..d438392 --- /dev/null +++ b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/10-working/02-visual/03-pump/SetHydroPumpWorkingDlg.resx @@ -0,0 +1,123 @@ +锘�<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <metadata name="dxErrorProvider1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> +</root> \ No newline at end of file diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/00-core/HydroMatchingHelper.cs b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/00-core/HydroMatchingHelper.cs index 1c5fb5a..017c199 100644 --- a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/00-core/HydroMatchingHelper.cs +++ b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/00-core/HydroMatchingHelper.cs @@ -1,4 +1,8 @@ -锘縰sing Yw.Model; +锘縰sing DevExpress.XtraSpreadsheet.Model.CopyOperation; +using System.Windows.Media.Imaging; +using Yw.DAL.Basic; +using Yw.EPAnet; +using Yw.Model; namespace Yw.WinFrmUI { @@ -651,82 +655,1116 @@ #region 搴旂敤 - ///// <summary> - ///// 搴旂敤璧勪骇鑷姩鍖归厤ViewModel - ///// </summary> - //public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, AssetsMatchingViewModel output) - //{ - // if (hydroInfo == null) - // { - // return false; - // } - // if (output == null) - // { - // return false; - // } + /// <summary> + /// 搴旂敤鑷姩鍖归厤ViewModel + /// </summary> + public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, HydroMatchingViewModel matchingInfo) + { + if (hydroInfo == null) + { + return false; + } + if (matchingInfo == null) + { + return false; + } - // bool result = false; + bool result = false; - // //姘存车 - // output.PumpMatchingList?.ForEach(x => - // { - // if (Apply(hydroInfo, x)) - // { - // result = true; - // } - // }); + #region 姘存睜 - // //闃�闂� - // output.ValveMatchingList?.ForEach(x => - // { - // if (Apply(hydroInfo, x)) - // { - // result = true; - // } - // }); + var allTanks = hydroInfo.GetAllTanks(); + if (allTanks != null && allTanks.Count > 0) + { + if (matchingInfo.Tanks != null && matchingInfo.Tanks.Count > 0) + { + allTanks.ForEach(x => + { + var matching = matchingInfo.Tanks.Find(t => t.Code == x.Code); + if (Apply(hydroInfo, x, matching)) + { + result = true; + } + }); + } - // //绠¢亾 - // output.PipeMatchingList?.ForEach(x => - // { - // if (Apply(hydroInfo, x)) - // { - // result = true; - // } - // }); + } - // //寮ご - // output.ElbowMatchingList?.ForEach(x => - // { - // if (Apply(hydroInfo, x)) - // { - // result = true; - // } - // }); + #endregion - // //涓夐�� - // output.ThreelinkMatchingList?.ForEach(x => - // { - // if (Apply(hydroInfo, x)) - // { - // result = true; - // } - // }); + #region 闂峰ご - // //鍥涢�� - // output.FourlinkMatchingList?.ForEach(x => - // { - // if (Apply(hydroInfo, x)) - // { - // result = true; - // } - // }); + if (hydroInfo.Bluntheads != null && hydroInfo.Bluntheads.Count > 0) + { + if (matchingInfo.Bluntheads != null && matchingInfo.Bluntheads.Count > 0) + { + hydroInfo.Bluntheads.ForEach(x => + { + var matching = matchingInfo.Bluntheads.Find(t => t.Code == x.Code); + if (Apply(hydroInfo, x, matching)) + { + result = true; + } + }); + } + } - // return result; - //} + #endregion + + #region 寮ご + + if (hydroInfo.Elbows != null && hydroInfo.Elbows.Count > 0) + { + if (matchingInfo.Elbows != null && matchingInfo.Elbows.Count > 0) + { + hydroInfo.Elbows.ForEach(x => + { + var matching = matchingInfo.Elbows.Find(t => t.Code == x.Code); + if (Apply(hydroInfo, x, matching)) + { + result = true; + } + }); + } + } + + #endregion + + #region 涓夐�� + + if (hydroInfo.Threelinks != null && hydroInfo.Threelinks.Count > 0) + { + if (matchingInfo.Threelinks != null && matchingInfo.Threelinks.Count > 0) + { + hydroInfo.Threelinks.ForEach(x => + { + var matching = matchingInfo.Threelinks.Find(t => t.Code == x.Code); + if (Apply(hydroInfo, x, matching)) + { + result = true; + } + }); + } + } + + #endregion + + #region 鍥涢�� + + if (hydroInfo.Fourlinks != null && hydroInfo.Fourlinks.Count > 0) + { + if (matchingInfo.Fourlinks != null && matchingInfo.Fourlinks.Count > 0) + { + hydroInfo.Fourlinks.ForEach(x => + { + var matching = matchingInfo.Fourlinks.Find(t => t.Code == x.Code); + if (Apply(hydroInfo, x, matching)) + { + result = true; + } + }); + } + } + + #endregion + + #region 鍠峰ご + + if (hydroInfo.Nozzles != null && hydroInfo.Nozzles.Count > 0) + { + if (matchingInfo.Nozzles != null && matchingInfo.Nozzles.Count > 0) + { + hydroInfo.Nozzles.ForEach(x => + { + var matching = matchingInfo.Nozzles.Find(t => t.Code == x.Code); + if (Apply(hydroInfo, x, matching)) + { + result = true; + } + }); + } + } + + #endregion + + #region 娑堢伀鏍� + + if (hydroInfo.Hydrants != null && hydroInfo.Hydrants.Count > 0) + { + if (matchingInfo.Hydrants != null && matchingInfo.Hydrants.Count > 0) + { + hydroInfo.Hydrants.ForEach(x => + { + var matching = matchingInfo.Hydrants.Find(t => t.Code == x.Code); + if (Apply(hydroInfo, x, matching)) + { + result = true; + } + }); + } + } + + #endregion + + #region 姘磋〃 + + if (hydroInfo.Meters != null && hydroInfo.Meters.Count > 0) + { + if (matchingInfo.Meters != null && matchingInfo.Meters.Count > 0) + { + hydroInfo.Meters.ForEach(x => + { + var matching = matchingInfo.Meters.Find(t => t.Code == x.Code); + if (Apply(hydroInfo, x, matching)) + { + result = true; + } + }); + } + } + + #endregion + + #region 娴侀噺璁� + + if (hydroInfo.Flowmeters != null && hydroInfo.Flowmeters.Count > 0) + { + if (matchingInfo.Flowmeters != null && matchingInfo.Flowmeters.Count > 0) + { + hydroInfo.Flowmeters.ForEach(x => + { + var matching = matchingInfo.Flowmeters.Find(t => t.Code == x.Code); + if (Apply(hydroInfo, x, matching)) + { + result = true; + } + }); + } + } + + #endregion + + #region 鍘嬪姏琛� + + if (hydroInfo.Pressmeters != null && hydroInfo.Pressmeters.Count > 0) + { + if (matchingInfo.Pressmeters != null && matchingInfo.Pressmeters.Count > 0) + { + hydroInfo.Pressmeters.ForEach(x => + { + var matching = matchingInfo.Pressmeters.Find(t => t.Code == x.Code); + if (Apply(hydroInfo, x, matching)) + { + result = true; + } + }); + } + } + + #endregion + + #region 绠¢亾 + + if (hydroInfo.Pipes != null && hydroInfo.Pipes.Count > 0) + { + if (matchingInfo.Pipes != null && matchingInfo.Pipes.Count > 0) + { + hydroInfo.Pipes.ForEach(x => + { + var matching = matchingInfo.Pipes.Find(t => t.Code == x.Code); + if (Apply(hydroInfo, x, matching)) + { + result = true; + } + }); + } + } + + #endregion + + #region 杩囨浮浠� + + if (hydroInfo.Translations != null && hydroInfo.Translations.Count > 0) + { + if (matchingInfo.Translations != null && matchingInfo.Translations.Count > 0) + { + hydroInfo.Translations.ForEach(x => + { + var matching = matchingInfo.Translations.Find(t => t.Code == x.Code); + if (Apply(hydroInfo, x, matching)) + { + result = true; + } + }); + } + } + + #endregion + + #region 闃�闂� + + if (hydroInfo.Valves != null && hydroInfo.Valves.Count > 0) + { + if (matchingInfo.Valves != null && matchingInfo.Valves.Count > 0) + { + hydroInfo.Valves.ForEach(x => + { + var matching = matchingInfo.Valves.Find(t => t.Code == x.Code); + if (Apply(hydroInfo, x, matching)) + { + result = true; + } + }); + } + } + + #endregion + + #region 鎹㈢儹鍣� + + if (hydroInfo.Exchangers != null && hydroInfo.Exchangers.Count > 0) + { + if (matchingInfo.Exchangers != null && matchingInfo.Exchangers.Count > 0) + { + hydroInfo.Exchangers.ForEach(x => + { + var matching = matchingInfo.Exchangers.Find(t => t.Code == x.Code); + if (Apply(hydroInfo, x, matching)) + { + result = true; + } + }); + } + } + + #endregion + + #region 绌哄帇鏈� + + if (hydroInfo.Compressors != null && hydroInfo.Compressors.Count > 0) + { + if (matchingInfo.Compressors != null && matchingInfo.Compressors.Count > 0) + { + hydroInfo.Compressors.ForEach(x => + { + var matching = matchingInfo.Compressors.Find(t => t.Code == x.Code); + if (Apply(hydroInfo, x, matching)) + { + result = true; + } + }); + } + } + + #endregion + + return result; + } #region 姘存睜 + /// <summary> + /// 搴旂敤 + /// </summary> + public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroTankInfo visual, HydroTankMatchingViewModel matching) + { + if (hydroInfo == null) + { + return false; + } + if (visual == null) + { + return false; + } + if (matching == null) + { + return false; + } + visual.Name = matching.Name; + visual.DbLocked = matching.DbLocked; + visual.DbId = matching.DbId; + visual.ModelType = matching.ModelType; + visual.MinLevel = matching.MinLevel; + visual.MaxLevel = matching.MaxLevel; + visual.DN = matching.DN; + visual.MinVol = matching.MinVol; + visual.OverFlow = matching.OverFlow; + bool result = false; + if (!visual.DbLocked) + { + if (!string.IsNullOrEmpty(matching.MatchingModelType)) + { + visual.ModelType = matching.MatchingModelType; + result = true; + } + if (!string.IsNullOrEmpty(matching.MatchingDbId)) + { + visual.DbId = matching.MatchingDbId; + result = true; + } + if (matching.MatchingMinLevel.HasValue) + { + visual.MinLevel = matching.MatchingMinLevel.Value; + result = true; + } + if (matching.MatchingMaxLevel.HasValue) + { + visual.MaxLevel = matching.MatchingMaxLevel.Value; + result = true; + } + if (matching.MatchingDN.HasValue) + { + visual.DN = matching.MatchingDN.Value; + result = true; + } + if (matching.MatchingMinVol.HasValue) + { + visual.MinVol = matching.MatchingMinVol.Value; + result = true; + } + if (matching.MatchingOverFlow.HasValue) + { + visual.OverFlow = matching.MatchingOverFlow.Value; + result = true; + } + if (!string.IsNullOrEmpty(matching.MatchingCurveDbId)) + { + var curvevol = hydroInfo.Curves?.Find(x => x.Code == visual.VolCurve); + if (curvevol == null) + { + curvevol = new Yw.Model.HydroCurveInfo(); + curvevol.Catalog = Yw.Hydro.ParterCatalog.Curve; + curvevol.Code = Yw.Untity.UniqueHelper.CreateFromFirst("curve", hydroInfo.GetAllParterCodes()); + curvevol.Name = "鍖归厤"; + curvevol.ModelType = string.Empty; + curvevol.DbLocked = false; + curvevol.DbId = matching.MatchingCurveDbId; + curvevol.CurveType = Yw.WinFrmUI.HydroCurve.TankVol; + curvevol.CurveData = matching.MatchingVolCurve?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); + if (hydroInfo.Curves == null) + { + hydroInfo.Curves = new List<Yw.Model.HydroCurveInfo>(); + } + hydroInfo.Curves.Add(curvevol); + visual.VolCurve = curvevol.Code; + result = true; + } + else + { + if (!curvevol.DbLocked) + { + curvevol.DbId = matching.MatchingCurveDbId; + curvevol.CurveData = matching.MatchingVolCurve?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); + result = true; + } + } + } + } + return result; + } + + #endregion + + #region 闂峰ご + + /// <summary> + /// 搴旂敤 + /// </summary> + public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroBluntheadInfo visual, HydroBluntheadMatchingViewModel matching) + { + if (hydroInfo == null) + { + return false; + } + if (visual == null) + { + return false; + } + if (matching == null) + { + return false; + } + visual.Name = matching.Name; + visual.DbLocked = matching.DbLocked; + visual.DbId = matching.DbId; + visual.ModelType = matching.ModelType; + visual.Caliber = matching.Caliber; + visual.Material = matching.Material; + visual.MinorLoss = matching.MinorLoss; + + bool result = false; + if (!visual.DbLocked) + { + if (!string.IsNullOrEmpty(matching.MatchingModelType)) + { + visual.ModelType = matching.MatchingModelType; + result = true; + } + if (!string.IsNullOrEmpty(matching.MatchingDbId)) + { + visual.DbId = matching.MatchingDbId; + result = true; + } + if (matching.MatchingCaliber.HasValue) + { + visual.Caliber = matching.MatchingCaliber.Value; + result = true; + } + if (!string.IsNullOrEmpty(matching.MatchingMaterial)) + { + visual.Material = matching.MatchingMaterial; + result = true; + } + if (matching.MatchingMinorLoss.HasValue) + { + visual.MinorLoss = matching.MatchingMinorLoss.Value; + result = true; + } + } + return result; + } + + #endregion + + #region 寮ご + + /// <summary> + /// 搴旂敤 + /// </summary> + public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroElbowInfo visual, HydroElbowMatchingViewModel matching) + { + if (hydroInfo == null) + { + return false; + } + if (visual == null) + { + return false; + } + if (matching == null) + { + return false; + } + visual.Name = matching.Name; + visual.DbLocked = matching.DbLocked; + visual.DbId = matching.DbId; + visual.ModelType = matching.ModelType; + visual.Caliber = matching.Caliber; + visual.Material = matching.Material; + visual.MinorLoss = matching.MinorLoss; + visual.BendingAngle = matching.BendingAngle; + if (matching.ElbowType.HasValue) + { + visual.ElbowType = HydroElbowTypeEnumHelper.GetElbowTypeName(matching.ElbowType.Value); + } + + bool result = false; + if (!visual.DbLocked) + { + if (!string.IsNullOrEmpty(matching.MatchingModelType)) + { + visual.ModelType = matching.MatchingModelType; + result = true; + } + if (!string.IsNullOrEmpty(matching.MatchingDbId)) + { + visual.DbId = matching.MatchingDbId; + result = true; + } + if (matching.MatchingCaliber.HasValue) + { + visual.Caliber = matching.MatchingCaliber.Value; + result = true; + } + if (!string.IsNullOrEmpty(matching.MatchingMaterial)) + { + visual.Material = matching.MatchingMaterial; + result = true; + } + if (matching.MatchingMinorLoss.HasValue) + { + visual.MinorLoss = matching.MatchingMinorLoss.Value; + result = true; + } + if (matching.MatchingBendingAngle.HasValue) + { + visual.BendingAngle = matching.MatchingBendingAngle.Value; + result = true; + } + if (matching.MatchingElbowType.HasValue) + { + visual.ElbowType = HydroElbowTypeEnumHelper.GetElbowTypeName(matching.MatchingElbowType.Value); + result = true; + } + } + return result; + } + + #endregion + + #region 涓夐�� + + /// <summary> + /// 搴旂敤 + /// </summary> + public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroThreelinkInfo visual, HydroThreelinkMatchingViewModel matching) + { + if (hydroInfo == null) + { + return false; + } + if (visual == null) + { + return false; + } + if (matching == null) + { + return false; + } + visual.Name = matching.Name; + visual.DbLocked = matching.DbLocked; + visual.DbId = matching.DbId; + visual.ModelType = matching.ModelType; + visual.Caliber = matching.Caliber; + visual.Material = matching.Material; + visual.MinorLoss = matching.MinorLoss; + visual.RunningThroughLoss = matching.RunningThroughLoss; + visual.BranchThroughLoss = matching.BranchThroughLoss; + + bool result = false; + if (!visual.DbLocked) + { + if (!string.IsNullOrEmpty(matching.MatchingModelType)) + { + visual.ModelType = matching.MatchingModelType; + result = true; + } + if (!string.IsNullOrEmpty(matching.MatchingDbId)) + { + visual.DbId = matching.MatchingDbId; + result = true; + } + if (matching.MatchingCaliber.HasValue) + { + visual.Caliber = matching.MatchingCaliber.Value; + result = true; + } + if (!string.IsNullOrEmpty(matching.MatchingMaterial)) + { + visual.Material = matching.MatchingMaterial; + result = true; + } + if (matching.MatchingMinorLoss.HasValue) + { + visual.MinorLoss = matching.MatchingMinorLoss.Value; + result = true; + } + if (matching.MatchingRunningThroughLoss.HasValue) + { + visual.RunningThroughLoss = matching.MatchingRunningThroughLoss.Value; + result = true; + } + if (matching.MatchingBranchThroughLoss.HasValue) + { + visual.BranchThroughLoss = matching.MatchingBranchThroughLoss.Value; + result = true; + } + } + return result; + } + + #endregion + + #region 鍥涢�� + + /// <summary> + /// 搴旂敤 + /// </summary> + public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroFourlinkInfo visual, HydroFourlinkMatchingViewModel matching) + { + if (hydroInfo == null) + { + return false; + } + if (visual == null) + { + return false; + } + if (matching == null) + { + return false; + } + visual.Name = matching.Name; + visual.DbLocked = matching.DbLocked; + visual.DbId = matching.DbId; + visual.ModelType = matching.ModelType; + visual.Caliber = matching.Caliber; + visual.Material = matching.Material; + visual.MinorLoss = matching.MinorLoss; + + bool result = false; + if (!visual.DbLocked) + { + if (!string.IsNullOrEmpty(matching.MatchingModelType)) + { + visual.ModelType = matching.MatchingModelType; + result = true; + } + if (!string.IsNullOrEmpty(matching.MatchingDbId)) + { + visual.DbId = matching.MatchingDbId; + result = true; + } + if (matching.MatchingCaliber.HasValue) + { + visual.Caliber = matching.MatchingCaliber.Value; + result = true; + } + if (!string.IsNullOrEmpty(matching.MatchingMaterial)) + { + visual.Material = matching.MatchingMaterial; + result = true; + } + if (matching.MatchingMinorLoss.HasValue) + { + visual.MinorLoss = matching.MatchingMinorLoss.Value; + result = true; + } + } + return result; + } + + #endregion + + #region 鍠峰ご + + /// <summary> + /// 搴旂敤 + /// </summary> + public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroNozzleInfo visual, HydroNozzleMatchingViewModel matching) + { + if (hydroInfo == null) + { + return false; + } + if (visual == null) + { + return false; + } + if (matching == null) + { + return false; + } + visual.Name = matching.Name; + visual.DbLocked = matching.DbLocked; + visual.DbId = matching.DbId; + visual.ModelType = matching.ModelType; + visual.Material = matching.Material; + visual.Caliber = matching.Caliber; + visual.MinorLoss = matching.MinorLoss; + visual.Coefficient = matching.Coefficient; + + bool result = false; + if (!visual.DbLocked) + { + if (!string.IsNullOrEmpty(matching.MatchingModelType)) + { + visual.ModelType = matching.MatchingModelType; + result = true; + } + if (!string.IsNullOrEmpty(matching.MatchingDbId)) + { + visual.DbId = matching.MatchingDbId; + result = true; + } + if (matching.MatchingCaliber.HasValue) + { + visual.Caliber = matching.MatchingCaliber.Value; + result = true; + } + if (!string.IsNullOrEmpty(matching.MatchingMaterial)) + { + visual.Material = matching.MatchingMaterial; + result = true; + } + if (matching.MatchingMinorLoss.HasValue) + { + visual.MinorLoss = matching.MatchingMinorLoss.Value; + result = true; + } + if (matching.MatchingCoefficient.HasValue) + { + visual.Coefficient = matching.MatchingCoefficient.Value; + result = true; + } + } + return result; + } + + #endregion + + #region 娑堢伀鏍� + + /// <summary> + /// 搴旂敤 + /// </summary> + public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroHydrantInfo visual, HydroHydrantMatchingViewModel matching) + { + if (hydroInfo == null) + { + return false; + } + if (visual == null) + { + return false; + } + if (matching == null) + { + return false; + } + visual.Name = matching.Name; + visual.DbLocked = matching.DbLocked; + visual.DbId = matching.DbId; + visual.ModelType = matching.ModelType; + visual.Material = matching.Material; + visual.Caliber = matching.Caliber; + visual.MinorLoss = matching.MinorLoss; + visual.Coefficient = matching.Coefficient; + + bool result = false; + if (!visual.DbLocked) + { + if (!string.IsNullOrEmpty(matching.MatchingModelType)) + { + visual.ModelType = matching.MatchingModelType; + result = true; + } + if (!string.IsNullOrEmpty(matching.MatchingDbId)) + { + visual.DbId = matching.MatchingDbId; + result = true; + } + if (matching.MatchingCaliber.HasValue) + { + visual.Caliber = matching.MatchingCaliber.Value; + result = true; + } + if (!string.IsNullOrEmpty(matching.MatchingMaterial)) + { + visual.Material = matching.MatchingMaterial; + result = true; + } + if (matching.MatchingMinorLoss.HasValue) + { + visual.MinorLoss = matching.MatchingMinorLoss.Value; + result = true; + } + if (matching.MatchingCoefficient.HasValue) + { + visual.Coefficient = matching.MatchingCoefficient.Value; + result = true; + } + } + return result; + } + + #endregion + + #region 姘磋〃 + + /// <summary> + /// 搴旂敤 + /// </summary> + public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroMeterInfo visual, HydroMeterMatchingViewModel matching) + { + if (hydroInfo == null) + { + return false; + } + if (visual == null) + { + return false; + } + if (matching == null) + { + return false; + } + visual.Name = matching.Name; + visual.DbLocked = matching.DbLocked; + visual.DbId = matching.DbId; + visual.ModelType = matching.ModelType; + visual.MinorLoss = matching.MinorLoss; + + bool result = false; + if (!visual.DbLocked) + { + if (!string.IsNullOrEmpty(matching.MatchingModelType)) + { + visual.ModelType = matching.MatchingModelType; + result = true; + } + if (!string.IsNullOrEmpty(matching.MatchingDbId)) + { + visual.DbId = matching.MatchingDbId; + result = true; + } + if (matching.MatchingMinorLoss.HasValue) + { + visual.MinorLoss = matching.MatchingMinorLoss.Value; + result = true; + } + } + return result; + } + + #endregion + + #region 娴侀噺璁� + + /// <summary> + /// 搴旂敤 + /// </summary> + public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroFlowmeterInfo visual, HydroFlowmeterMatchingViewModel matching) + { + if (hydroInfo == null) + { + return false; + } + if (visual == null) + { + return false; + } + if (matching == null) + { + return false; + } + visual.Name = matching.Name; + visual.DbLocked = matching.DbLocked; + visual.DbId = matching.DbId; + visual.ModelType = matching.ModelType; + visual.MinorLoss = matching.MinorLoss; + + bool result = false; + if (!visual.DbLocked) + { + if (!string.IsNullOrEmpty(matching.MatchingModelType)) + { + visual.ModelType = matching.MatchingModelType; + result = true; + } + if (!string.IsNullOrEmpty(matching.MatchingDbId)) + { + visual.DbId = matching.MatchingDbId; + result = true; + } + if (matching.MatchingMinorLoss.HasValue) + { + visual.MinorLoss = matching.MatchingMinorLoss.Value; + result = true; + } + } + return result; + } + + #endregion + + #region 鍘嬪姏琛� + + /// <summary> + /// 搴旂敤 + /// </summary> + public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroPressmeterInfo visual, HydroPressmeterMatchingViewModel matching) + { + if (hydroInfo == null) + { + return false; + } + if (visual == null) + { + return false; + } + if (matching == null) + { + return false; + } + visual.Name = matching.Name; + visual.DbLocked = matching.DbLocked; + visual.DbId = matching.DbId; + visual.ModelType = matching.ModelType; + visual.MinorLoss = matching.MinorLoss; + + bool result = false; + if (!visual.DbLocked) + { + if (!string.IsNullOrEmpty(matching.MatchingModelType)) + { + visual.ModelType = matching.MatchingModelType; + result = true; + } + if (!string.IsNullOrEmpty(matching.MatchingDbId)) + { + visual.DbId = matching.MatchingDbId; + result = true; + } + if (matching.MatchingMinorLoss.HasValue) + { + visual.MinorLoss = matching.MatchingMinorLoss.Value; + result = true; + } + } + return result; + } + + #endregion + + #region 绠¢亾 + + /// <summary> + /// 搴旂敤 + /// </summary> + public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroPipeInfo visual, HydroPipeMatchingViewModel matching) + { + if (hydroInfo == null) + { + return false; + } + if (visual == null) + { + return false; + } + if (matching == null) + { + return false; + } + + visual.Name = matching.Name; + visual.DbLocked = matching.DbLocked; + visual.DbId = matching.DbId; + visual.ModelType = matching.ModelType; + visual.Material = matching.Material; + visual.Diameter = matching.Diameter; + visual.Roughness = matching.Roughness; + visual.MinorLoss = matching.MinorLoss; + + bool result = false; + + if (!visual.DbLocked) + { + if (!string.IsNullOrEmpty(matching.MatchingModelType)) + { + visual.ModelType = matching.MatchingModelType; + result = true; + } + if (!string.IsNullOrEmpty(matching.MatchingDbId)) + { + visual.DbId = matching.MatchingDbId; + result = true; + } + if (!string.IsNullOrEmpty(matching.MatchingMaterial)) + { + visual.Material = matching.MatchingMaterial; + result = true; + } + if (matching.MatchingDiameter.HasValue) + { + visual.Diameter = matching.MatchingDiameter.Value; + result = true; + } + if (matching.MatchingRoughness.HasValue) + { + visual.Roughness = matching.MatchingRoughness.Value; + result = true; + } + if (matching.MatchingMinorLoss.HasValue) + { + visual.MinorLoss = matching.MatchingMinorLoss.Value; + result = true; + } + } + return result; + } + + #endregion + + #region 杩囨浮浠� + + /// <summary> + /// 搴旂敤 + /// </summary> + public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroTranslationInfo visual, HydroTranslationMatchingViewModel matching) + { + if (hydroInfo == null) + { + return false; + } + if (visual == null) + { + return false; + } + if (matching == null) + { + return false; + } + + visual.Name = matching.Name; + visual.DbLocked = matching.DbLocked; + visual.DbId = matching.DbId; + visual.ModelType = matching.ModelType; + visual.Material = matching.Material; + visual.Diameter = matching.Diameter; + visual.StartDiameter = matching.StartDiameter; + visual.EndDiameter = matching.EndDiameter; + visual.Roughness = matching.Roughness; + visual.MinorLoss = matching.MinorLoss; + + bool result = false; + + if (!visual.DbLocked) + { + if (!string.IsNullOrEmpty(matching.MatchingModelType)) + { + visual.ModelType = matching.MatchingModelType; + result = true; + } + if (!string.IsNullOrEmpty(matching.MatchingDbId)) + { + visual.DbId = matching.MatchingDbId; + result = true; + } + if (!string.IsNullOrEmpty(matching.MatchingMaterial)) + { + visual.Material = matching.MatchingMaterial; + result = true; + } + if (matching.MatchingDiameter.HasValue) + { + visual.Diameter = matching.MatchingDiameter.Value; + result = true; + } + if (matching.MatchingStartDiameter.HasValue) + { + visual.StartDiameter = matching.MatchingStartDiameter.Value; + result = true; + } + if (matching.MatchingEndDiameter.HasValue) + { + visual.EndDiameter = matching.MatchingEndDiameter.Value; + result = true; + } + if (matching.MatchingRoughness.HasValue) + { + visual.Roughness = matching.MatchingRoughness.Value; + result = true; + } + if (matching.MatchingMinorLoss.HasValue) + { + visual.MinorLoss = matching.MatchingMinorLoss.Value; + result = true; + } + } + return result; + } #endregion @@ -735,568 +1773,553 @@ /// <summary> /// 搴旂敤 /// </summary> - //public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, PumpMatchingViewModel matching) - //{ - // if (hydroInfo == null) - // { - // return false; - // } - // if (matching == null) - // { - // return false; - // } + public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroPumpInfo visual, HydroPumpMatchingViewModel matching) + { + if (hydroInfo == null) + { + return false; + } + if (visual == null) + { + return false; + } + if (matching == null) + { + return false; + } - // bool result = false; + visual.Name = matching.Name; + visual.DbLocked = matching.DbLocked; + visual.DbId = matching.DbId; + visual.ModelType = matching.ModelType; + visual.RatedQ = matching.RatedQ; + visual.RatedH = matching.RatedH; + visual.RatedP = matching.RatedP; + visual.RatedN = matching.RatedN; + visual.RatedHz = matching.RatedHz; + visual.SpeedRatio = matching.CurrentHz / visual.RatedHz; - // var pump = hydroInfo.Pumps?.Find(x => x.Code == matching.Code); - // if (pump != null) - // { - // pump.DbLocked = matching.DbLocked; - // pump.ModelType = matching.ModelType; - // pump.RatedP = matching.RatedP; - // pump.RatedQ = matching.RatedQ; - // pump.RatedH = matching.RatedH; - // pump.RatedN = matching.RatedN; - // pump.RatedHz = matching.RatedHz; - // pump.SpeedRatio = Math.Round(matching.CurrentHz / matching.RatedHz, 1); + bool result = false; + if (!visual.DbLocked) + { + if (!string.IsNullOrEmpty(matching.MatchingModelType)) + { + visual.ModelType = matching.MatchingModelType; + result = true; + } + if (!string.IsNullOrEmpty(matching.MatchingDbId)) + { + visual.DbId = matching.MatchingDbId; + result = true; + } + if (matching.MatchingRatedQ.HasValue) + { + visual.RatedQ = matching.MatchingRatedQ.Value; + result = true; + } + if (matching.MatchingRatedH.HasValue) + { + visual.RatedH = matching.MatchingRatedH.Value; + result = true; + } + if (matching.MatchingRatedP.HasValue) + { + visual.RatedP = matching.MatchingRatedP.Value; + result = true; + } + if (matching.MatchingRatedN.HasValue) + { + visual.RatedN = matching.MatchingRatedN.Value; + result = true; + } + if (matching.MatchingRatedHz.HasValue) + { + visual.RatedHz = matching.MatchingRatedHz.Value; + result = true; + } + if (matching.MatchingCurrentHz.HasValue) + { + visual.SpeedRatio = matching.MatchingCurrentHz.Value / visual.RatedHz; + result = true; + } - // if (!pump.DbLocked) - // { - // if (!string.IsNullOrEmpty(matching.MatchingModelType)) - // { - // pump.ModelType = matching.MatchingModelType; - // } - // if (!string.IsNullOrEmpty(matching.MatchingDbId)) - // { - // pump.DbId = matching.MatchingDbId; - // } - // if (matching.MatchingRatedP.HasValue) - // { - // pump.RatedP = matching.MatchingRatedP.Value; - // } - // if (matching.MatchingRatedQ.HasValue) - // { - // pump.RatedQ = matching.MatchingRatedQ.Value; - // } - // if (matching.MatchingRatedH.HasValue) - // { - // pump.RatedH = matching.MatchingRatedH.Value; - // } - // if (matching.MatchingRatedN.HasValue) - // { - // pump.RatedN = matching.MatchingRatedN.Value; - // } + if (!string.IsNullOrEmpty(matching.MatchingCurveDbId)) + { + //娴侀噺鎵▼鏇茬嚎 + var curveqh = hydroInfo.Curves?.Find(x => x.Code == visual.CurveQH); + if (curveqh == null) + { + curveqh = new Yw.Model.HydroCurveInfo(); + curveqh.Catalog = Yw.Hydro.ParterCatalog.Curve; + curveqh.Code = Yw.Untity.UniqueHelper.CreateFromFirst("curve", hydroInfo.GetAllParterCodes()); + curveqh.Name = "鍖归厤"; + curveqh.ModelType = string.Empty; + curveqh.DbLocked = false; + curveqh.DbId = matching.MatchingCurveDbId; + curveqh.CurveType = Yw.WinFrmUI.HydroCurve.PumpQH; + curveqh.CurveData = matching.MatchingCurveQH?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); + if (hydroInfo.Curves == null) + { + hydroInfo.Curves = new List<Yw.Model.HydroCurveInfo>(); + } + hydroInfo.Curves.Add(curveqh); + visual.CurveQH = curveqh.Code; + result = true; + } + else + { + if (!curveqh.DbLocked) + { + curveqh.DbId = matching.MatchingCurveDbId; + curveqh.CurveData = matching.MatchingCurveQH?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); + result = true; + } + } - // if (!string.IsNullOrEmpty(matching.MatchingCurveDbId)) - // { - // //娴侀噺鎵▼鏇茬嚎 - // var curveqh = hydroInfo.Curves?.Find(x => x.Code == pump.CurveQH); - // if (curveqh == null) - // { - // curveqh = new Yw.Model.HydroCurveInfo(); - // curveqh.Catalog = Yw.Hydro.ParterCatalog.Curve; - // curveqh.Code = Yw.Untity.UniqueHelper.CreateFromFirst("curve", hydroInfo.GetAllParterCodes()); - // curveqh.Name = "鍖归厤"; - // curveqh.ModelType = string.Empty; - // curveqh.DbLocked = false; - // curveqh.DbId = matching.MatchingCurveDbId; - // curveqh.CurveType = Yw.WinFrmUI.HydroCurve.PumpQH; - // curveqh.CurveData = matching.MatchingCurveQH?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); - // if (hydroInfo.Curves == null) - // { - // hydroInfo.Curves = new List<Yw.Model.HydroCurveInfo>(); - // } - // hydroInfo.Curves.Add(curveqh); - // pump.CurveQH = curveqh.Code; - // } - // else - // { - // if (!curveqh.DbLocked) - // { - // curveqh.DbId = matching.MatchingCurveDbId; - // curveqh.CurveData = matching.MatchingCurveQH?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); - // } - // } + //娴侀噺鍔熺巼鏇茬嚎 + var curveqp = hydroInfo.Curves?.Find(x => x.Code == visual.CurveQP); + if (curveqp == null) + { + curveqp = new Yw.Model.HydroCurveInfo(); + curveqp.Catalog = Yw.Hydro.ParterCatalog.Curve; + curveqp.Code = Yw.Untity.UniqueHelper.CreateFromFirst("curve", hydroInfo.GetAllParterCodes()); + curveqp.Name = "鍖归厤"; + curveqp.ModelType = string.Empty; + curveqp.DbLocked = false; + curveqp.DbId = matching.MatchingCurveDbId; + curveqp.CurveType = Yw.WinFrmUI.HydroCurve.PumpQP; + curveqp.CurveData = matching.MatchingCurveQP?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); + if (hydroInfo.Curves == null) + { + hydroInfo.Curves = new List<Yw.Model.HydroCurveInfo>(); + } + hydroInfo.Curves.Add(curveqp); + visual.CurveQP = curveqp.Code; + result = true; + } + else + { + if (!curveqp.DbLocked) + { + curveqp.DbId = matching.MatchingCurveDbId; + curveqp.CurveData = matching.MatchingCurveQP?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); + result = true; + } + } - // //娴侀噺鍔熺巼鏇茬嚎 - // var curveqp = hydroInfo.Curves?.Find(x => x.Code == pump.CurveQP); - // if (curveqp == null) - // { - // curveqp = new Yw.Model.HydroCurveInfo(); - // curveqp.Catalog = Yw.Hydro.ParterCatalog.Curve; - // curveqp.Code = Yw.Untity.UniqueHelper.CreateFromFirst("curve", hydroInfo.GetAllParterCodes()); - // curveqp.Name = "鍖归厤"; - // curveqp.ModelType = string.Empty; - // curveqp.DbLocked = false; - // curveqp.DbId = matching.MatchingCurveDbId; - // curveqp.CurveType = Yw.WinFrmUI.HydroCurve.PumpQP; - // curveqp.CurveData = matching.MatchingCurveQP?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); - // if (hydroInfo.Curves == null) - // { - // hydroInfo.Curves = new List<Yw.Model.HydroCurveInfo>(); - // } - // hydroInfo.Curves.Add(curveqp); - // pump.CurveQP = curveqp.Code; - // } - // else - // { - // if (!curveqp.DbLocked) - // { - // curveqp.DbId = matching.MatchingCurveDbId; - // curveqp.CurveData = matching.MatchingCurveQP?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); - // } - // } + //娴侀噺鏁堢巼鏇茬嚎 + var curveqe = hydroInfo.Curves?.Find(x => x.Code == visual.CurveQE); + if (curveqe == null) + { + curveqe = new Yw.Model.HydroCurveInfo(); + curveqe.Catalog = Yw.Hydro.ParterCatalog.Curve; + curveqe.Code = Yw.Untity.UniqueHelper.CreateFromFirst("curve", hydroInfo.GetAllParterCodes()); + curveqe.Name = "鍖归厤"; + curveqe.ModelType = string.Empty; + curveqe.DbLocked = false; + curveqe.DbId = matching.MatchingCurveDbId; + curveqe.CurveType = Yw.WinFrmUI.HydroCurve.PumpQE; + curveqe.CurveData = matching.MatchingCurveQE?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); + if (hydroInfo.Curves == null) + { + hydroInfo.Curves = new List<Yw.Model.HydroCurveInfo>(); + } + hydroInfo.Curves.Add(curveqe); + visual.CurveQE = curveqe.Code; + result = true; + } + else + { + if (!curveqe.DbLocked) + { + curveqe.DbId = matching.MatchingCurveDbId; + curveqe.CurveData = matching.MatchingCurveQE?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); + result = true; + } + } + } + } - // //娴侀噺鏁堢巼鏇茬嚎 - // var curveqe = hydroInfo.Curves?.Find(x => x.Code == pump.CurveQE); - // if (curveqe == null) - // { - // curveqe = new Yw.Model.HydroCurveInfo(); - // curveqe.Catalog = Yw.Hydro.ParterCatalog.Curve; - // curveqe.Code = Yw.Untity.UniqueHelper.CreateFromFirst("curve", hydroInfo.GetAllParterCodes()); - // curveqe.Name = "鍖归厤"; - // curveqe.ModelType = string.Empty; - // curveqe.DbLocked = false; - // curveqe.DbId = matching.MatchingCurveDbId; - // curveqe.CurveType = Yw.WinFrmUI.HydroCurve.PumpQE; - // curveqe.CurveData = matching.MatchingCurveQE?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); - // if (hydroInfo.Curves == null) - // { - // hydroInfo.Curves = new List<Yw.Model.HydroCurveInfo>(); - // } - // hydroInfo.Curves.Add(curveqe); - // pump.CurveQE = curveqe.Code; - // } - // else - // { - // if (!curveqe.DbLocked) - // { - // curveqe.DbId = matching.MatchingCurveDbId; - // curveqe.CurveData = matching.MatchingCurveQE?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); - // } - // } - - // } - - // result = true; - // } - // } - - // return result; - //} + return result; + } #endregion - ///// <summary> - ///// 搴旂敤闃�闂ㄨ嚜鍔ㄥ尮閰峍iewModel - ///// </summary> - //public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, ValveMatchingViewModel matching) - //{ - // if (hydroInfo == null) - // { - // return false; - // } - // if (matching == null) - // { - // return false; - // } + #region 闃�闂� - // bool result = false; + /// <summary> + /// 搴旂敤 + /// </summary> + public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroValveInfo visual, HydroValveMatchingViewModel matching) + { + if (hydroInfo == null) + { + return false; + } + if (visual == null) + { + return false; + } + if (matching == null) + { + return false; + } - // var valve = hydroInfo.Valves?.Find(x => x.Code == matching.Code); - // if (valve != null) - // { - // valve.DbLocked = matching.DbLocked; - // valve.ModelType = matching.ModelType; - // valve.Material = matching.Material; - // valve.Diameter = matching.Diameter; - // valve.MinorLoss = matching.MinorLoss; - // switch (matching.ValveType) - // { - // case HStation.Assets.eValveType.PBV: valve.ValveType = Yw.Hydro.ValveType.PBV; break; - // case HStation.Assets.eValveType.PRV: valve.ValveType = Yw.Hydro.ValveType.PRV; break; - // case HStation.Assets.eValveType.PSV: valve.ValveType = Yw.Hydro.ValveType.PSV; break; - // case HStation.Assets.eValveType.TCV: valve.ValveType = Yw.Hydro.ValveType.TCV; break; - // case HStation.Assets.eValveType.FCV: valve.ValveType = Yw.Hydro.ValveType.FCV; break; - // case HStation.Assets.eValveType.GPV: valve.ValveType = Yw.Hydro.ValveType.GPV; break; - // case HStation.Assets.eValveType.CV: valve.ValveType = Yw.Hydro.ValveType.CV; break; - // default: break; - // } - // valve.ValveSetting = matching.ValveSetting; + visual.Name = matching.Name; + visual.DbLocked = matching.DbLocked; + visual.DbId = matching.DbId; + visual.ModelType = matching.ModelType; + visual.Material = matching.Material; + visual.Diameter = matching.Diameter; + visual.MinorLoss = matching.MinorLoss; + visual.ValveType = HydroValveTypeEnumHelper.GetValveTypeCode(matching.ValveType); + visual.ValveSetting = matching.ValveSetting; - // if (!valve.DbLocked) - // { - // if (!string.IsNullOrEmpty(matching.MatchingDbId)) - // { - // valve.DbId = matching.MatchingDbId; - // } - // if (!string.IsNullOrEmpty(matching.MatchingModelType)) - // { - // valve.ModelType = matching.MatchingModelType; - // } - // if (!string.IsNullOrEmpty(matching.MatchingMaterial)) - // { - // valve.Material = matching.MatchingMaterial; - // } - // if (matching.MatchingDiameter.HasValue) - // { - // valve.Diameter = matching.MatchingDiameter.Value; - // } - // if (matching.MatchingMinorLoss.HasValue) - // { - // valve.MinorLoss = matching.MatchingMinorLoss.Value; - // } - // if (matching.MatchingValveType.HasValue) - // { - // switch (matching.MatchingValveType.Value) - // { - // case HStation.Assets.eValveType.PBV: valve.ValveType = Yw.Hydro.ValveType.PBV; break; - // case HStation.Assets.eValveType.PRV: valve.ValveType = Yw.Hydro.ValveType.PRV; break; - // case HStation.Assets.eValveType.PSV: valve.ValveType = Yw.Hydro.ValveType.PSV; break; - // case HStation.Assets.eValveType.TCV: valve.ValveType = Yw.Hydro.ValveType.TCV; break; - // case HStation.Assets.eValveType.FCV: valve.ValveType = Yw.Hydro.ValveType.FCV; break; - // case HStation.Assets.eValveType.GPV: valve.ValveType = Yw.Hydro.ValveType.GPV; break; - // case HStation.Assets.eValveType.CV: valve.ValveType = Yw.Hydro.ValveType.CV; break; - // default: break; - // } - // } - // switch (valve.ValveType) - // { - // case Yw.Hydro.ValveType.PSV: - // { - // if (!string.IsNullOrEmpty(matching.MatchingValveSetting)) - // { - // valve.ValveSetting = matching.MatchingValveSetting; - // } - // } - // break; - // case Yw.Hydro.ValveType.PBV: - // { - // if (!string.IsNullOrEmpty(matching.MatchingValveSetting)) - // { - // valve.ValveSetting = matching.MatchingValveSetting; - // } - // } - // break; - // case Yw.Hydro.ValveType.PRV: - // { - // if (!string.IsNullOrEmpty(matching.MatchingValveSetting)) - // { - // valve.ValveSetting = matching.MatchingValveSetting; - // } - // } - // break; - // case Yw.Hydro.ValveType.FCV: - // { - // if (!string.IsNullOrEmpty(matching.MatchingValveSetting)) - // { - // valve.ValveSetting = matching.MatchingValveSetting; - // } - // } - // break; - // case Yw.Hydro.ValveType.TCV: - // { - // if (!string.IsNullOrEmpty(matching.MatchingCurveDbId)) - // { - // //闃�闂ㄥ紑搴︽崯澶辩郴鏁版洸绾� - // var curveol = hydroInfo.Curves?.Find(x => x.Code == valve.ValveSetting); - // if (curveol == null) - // { - // curveol = new Yw.Model.HydroCurveInfo(); - // curveol.Catalog = Yw.Hydro.ParterCatalog.Curve; - // curveol.Code = Yw.Untity.UniqueHelper.CreateFromFirst("curve", hydroInfo.GetAllParterCodes()); - // curveol.Name = "鍖归厤"; - // curveol.ModelType = valve.ModelType; - // curveol.DbLocked = false; - // curveol.DbId = matching.MatchingCurveDbId; - // curveol.CurveType = Yw.WinFrmUI.HydroCurve.ValveOL; - // curveol.CurveData = matching.MatchingCurveOL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); - // if (hydroInfo.Curves == null) - // { - // hydroInfo.Curves = new List<Yw.Model.HydroCurveInfo>(); - // } - // hydroInfo.Curves.Add(curveol); - // valve.ValveSetting = curveol.Code; - // } - // else - // { - // if (!curveol.DbLocked) - // { - // curveol.DbId = matching.MatchingCurveDbId; - // curveol.CurveData = matching.MatchingCurveOL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); - // } - // } - // } - // } - // break; - // case Yw.Hydro.ValveType.GPV: - // { - // if (!string.IsNullOrEmpty(matching.MatchingCurveDbId)) - // { - // //闃�闂ㄥ紑搴︽崯澶辩郴鏁版洸绾� - // var curveql = hydroInfo.Curves?.Find(x => x.Code == valve.ValveSetting); - // if (curveql == null) - // { - // curveql = new Yw.Model.HydroCurveInfo(); - // curveql.Catalog = Yw.Hydro.ParterCatalog.Curve; - // curveql.Code = Yw.Untity.UniqueHelper.CreateFromFirst("curve", hydroInfo.GetAllParterCodes()); - // curveql.Name = "鍖归厤"; - // curveql.ModelType = valve.ModelType; - // curveql.DbLocked = false; - // curveql.DbId = matching.MatchingCurveDbId; - // curveql.CurveType = Yw.WinFrmUI.HydroCurve.ValveOL; - // curveql.CurveData = matching.MatchingCurveQL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); - // if (hydroInfo.Curves == null) - // { - // hydroInfo.Curves = new List<Yw.Model.HydroCurveInfo>(); - // } - // hydroInfo.Curves.Add(curveql); - // valve.ValveSetting = curveql.Code; - // } - // else - // { - // if (!curveql.DbLocked) - // { - // curveql.DbId = matching.MatchingCurveDbId; - // curveql.CurveData = matching.MatchingCurveQL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); - // } - // } - // } - // } - // break; - // case Yw.Hydro.ValveType.CV: - // { + bool result = false; - // } - // break; - // } + if (!visual.DbLocked) + { + if (!string.IsNullOrEmpty(matching.MatchingModelType)) + { + visual.ModelType = matching.MatchingModelType; + result = true; + } + if (!string.IsNullOrEmpty(matching.MatchingDbId)) + { + visual.DbId = matching.MatchingDbId; + result = true; + } + if (!string.IsNullOrEmpty(matching.MatchingMaterial)) + { + visual.Material = matching.MatchingMaterial; + result = true; + } + if (matching.MatchingDiameter.HasValue) + { + visual.Diameter = matching.MatchingDiameter.Value; + result = true; + } + if (matching.MatchingMinorLoss.HasValue) + { + visual.MinorLoss = matching.MatchingMinorLoss.Value; + result = true; + } + if (matching.MatchingValveType.HasValue) + { + visual.ValveType = HydroValveTypeEnumHelper.GetValveTypeCode(matching.MatchingValveType.Value); + result = true; + } + switch (visual.ValveType) + { + case Yw.Hydro.ValveType.PSV: + { + if (!string.IsNullOrEmpty(matching.MatchingValveSetting)) + { + visual.ValveSetting = matching.MatchingValveSetting; + result = true; + } + } + break; + case Yw.Hydro.ValveType.PBV: + { + if (!string.IsNullOrEmpty(matching.MatchingValveSetting)) + { + visual.ValveSetting = matching.MatchingValveSetting; + result = true; + } + } + break; + case Yw.Hydro.ValveType.PRV: + { + if (!string.IsNullOrEmpty(matching.MatchingValveSetting)) + { + visual.ValveSetting = matching.MatchingValveSetting; + result = true; + } + } + break; + case Yw.Hydro.ValveType.FCV: + { + if (!string.IsNullOrEmpty(matching.MatchingValveSetting)) + { + visual.ValveSetting = matching.MatchingValveSetting; + result = true; + } + } + break; + case Yw.Hydro.ValveType.TCV: + { + if (!string.IsNullOrEmpty(matching.MatchingCurveDbId)) + { + //闃�闂ㄥ紑搴︽崯澶辩郴鏁版洸绾� + var curveol = hydroInfo.Curves?.Find(x => x.Code == visual.ValveSetting); + if (curveol == null) + { + curveol = new Yw.Model.HydroCurveInfo(); + curveol.Catalog = Yw.Hydro.ParterCatalog.Curve; + curveol.Code = Yw.Untity.UniqueHelper.CreateFromFirst("curve", hydroInfo.GetAllParterCodes()); + curveol.Name = "鍖归厤"; + curveol.ModelType = visual.ModelType; + curveol.DbLocked = false; + curveol.DbId = matching.MatchingCurveDbId; + curveol.CurveType = Yw.WinFrmUI.HydroCurve.ValveOL; + curveol.CurveData = matching.MatchingCurveOL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); + if (hydroInfo.Curves == null) + { + hydroInfo.Curves = new List<Yw.Model.HydroCurveInfo>(); + } + hydroInfo.Curves.Add(curveol); + visual.ValveSetting = curveol.Code; + result = true; + } + else + { + if (!curveol.DbLocked) + { + curveol.DbId = matching.MatchingCurveDbId; + curveol.CurveData = matching.MatchingCurveOL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); + result = true; + } + } + } + } + break; + case Yw.Hydro.ValveType.GPV: + { + if (!string.IsNullOrEmpty(matching.MatchingCurveDbId)) + { + //闃�闂ㄥ紑搴︽崯澶辩郴鏁版洸绾� + var curveql = hydroInfo.Curves?.Find(x => x.Code == visual.ValveSetting); + if (curveql == null) + { + curveql = new Yw.Model.HydroCurveInfo(); + curveql.Catalog = Yw.Hydro.ParterCatalog.Curve; + curveql.Code = Yw.Untity.UniqueHelper.CreateFromFirst("curve", hydroInfo.GetAllParterCodes()); + curveql.Name = "鍖归厤"; + curveql.ModelType = visual.ModelType; + curveql.DbLocked = false; + curveql.DbId = matching.MatchingCurveDbId; + curveql.CurveType = Yw.WinFrmUI.HydroCurve.ValveOL; + curveql.CurveData = matching.MatchingCurveQL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); + if (hydroInfo.Curves == null) + { + hydroInfo.Curves = new List<Yw.Model.HydroCurveInfo>(); + } + hydroInfo.Curves.Add(curveql); + visual.ValveSetting = curveql.Code; + result = true; + } + else + { + if (!curveql.DbLocked) + { + curveql.DbId = matching.MatchingCurveDbId; + curveql.CurveData = matching.MatchingCurveQL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); + result = true; + } + } + } + } + break; + case Yw.Hydro.ValveType.CV: + { - // result = true; - // } - // } - // return result; - //} + } + break; + } + } + return result; + } - ///// <summary> - ///// 搴旂敤绠¢亾鑷姩鍖归厤ViewModel - ///// </summary> - //public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, PipeMatchingViewModel matching) - //{ - // if (hydroInfo == null) - // { - // return false; - // } - // if (matching == null) - // { - // return false; - // } + #endregion - // bool result = false; + #region 鎹㈢儹鍣� - // var pipe = hydroInfo.Pipes?.Find(x => x.Code == matching.Code); - // if (pipe != null) - // { - // pipe.DbLocked = matching.DbLocked; - // pipe.ModelType = matching.ModelType; - // pipe.Diameter = matching.Diameter; - // pipe.Material = matching.Material; - // pipe.Roughness = matching.Roughness; - // pipe.MinorLoss = matching.MinorLoss; + /// <summary> + /// 搴旂敤 + /// </summary> + public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroExchangerInfo visual, HydroExchangerMatchingViewModel matching) + { + if (hydroInfo == null) + { + return false; + } + if (visual == null) + { + return false; + } + if (matching == null) + { + return false; + } + visual.Name = matching.Name; + visual.DbLocked = matching.DbLocked; + visual.DbId = matching.DbId; + visual.ModelType = matching.ModelType; + visual.Material = matching.Material; + visual.Diameter = matching.Diameter; + visual.MinorLoss = matching.MinorLoss; - // if (!pipe.DbLocked) - // { - // if (!string.IsNullOrEmpty(matching.MatchingModelType)) - // { - // pipe.ModelType = matching.MatchingModelType; - // } - // if (!string.IsNullOrEmpty(matching.MatchingDbId)) - // { - // pipe.DbId = matching.MatchingDbId; - // } - // if (matching.MatchingDiameter.HasValue) - // { - // pipe.Diameter = matching.MatchingDiameter.Value; - // } - // if (!string.IsNullOrEmpty(matching.MatchingMaterial)) - // { - // pipe.Material = matching.MatchingMaterial; - // } - // if (matching.MatchingRoughness.HasValue) - // { - // pipe.Roughness = matching.MatchingRoughness.Value; - // } - // if (matching.MatchingMinorLoss.HasValue) - // { - // pipe.MinorLoss = matching.MatchingMinorLoss.Value; - // } + bool result = false; + if (!visual.DbLocked) + { + if (!string.IsNullOrEmpty(matching.MatchingModelType)) + { + visual.ModelType = matching.MatchingModelType; + result = true; + } + if (!string.IsNullOrEmpty(matching.MatchingDbId)) + { + visual.DbId = matching.MatchingDbId; + result = true; + } + if (!string.IsNullOrEmpty(matching.MatchingMaterial)) + { + visual.Material = matching.MatchingMaterial; + result = true; + } + if (matching.MatchingDiameter.HasValue) + { + visual.Diameter = matching.MatchingDiameter.Value; + result = true; + } + if (matching.MatchingMinorLoss.HasValue) + { + visual.MinorLoss = matching.MatchingMinorLoss.Value; + result = true; + } - // result = true; - // } - // } - // return result; - //} + if (!string.IsNullOrEmpty(matching.MatchingCurveDbId)) + { + var curvevql = hydroInfo.Curves?.Find(x => x.Code == visual.CurveQL); + if (curvevql == null) + { + curvevql = new Yw.Model.HydroCurveInfo(); + curvevql.Catalog = Yw.Hydro.ParterCatalog.Curve; + curvevql.Code = Yw.Untity.UniqueHelper.CreateFromFirst("curve", hydroInfo.GetAllParterCodes()); + curvevql.Name = "鍖归厤"; + curvevql.ModelType = string.Empty; + curvevql.DbLocked = false; + curvevql.DbId = matching.MatchingCurveDbId; + curvevql.CurveType = Yw.WinFrmUI.HydroCurve.ExchangerQL; + curvevql.CurveData = matching.MatchingCurveQL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); + if (hydroInfo.Curves == null) + { + hydroInfo.Curves = new List<Yw.Model.HydroCurveInfo>(); + } + hydroInfo.Curves.Add(curvevql); + visual.CurveQL = curvevql.Code; + result = true; + } + else + { + if (!curvevql.DbLocked) + { + curvevql.DbId = matching.MatchingCurveDbId; + curvevql.CurveData = matching.MatchingCurveQL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); + result = true; + } + } + } + } + return result; + } - ///// <summary> - ///// 搴旂敤寮ご鑷姩鍖归厤ViewModel - ///// </summary> - //public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, ElbowMatchingViewModel matching) - //{ - // if (hydroInfo == null) - // { - // return false; - // } - // if (matching == null) - // { - // return false; - // } + #endregion - // bool result = false; + #region 绌哄帇鏈� - // var elbow = hydroInfo.Elbows?.Find(x => x.Code == matching.Code); - // if (elbow != null) - // { - // elbow.DbLocked = matching.DbLocked; - // elbow.ModelType = matching.ModelType; - // elbow.Caliber = matching.Caliber; - // elbow.Material = matching.Material; - // elbow.MinorLoss = matching.MinorLoss; + /// <summary> + /// 搴旂敤 + /// </summary> + public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroCompressorInfo visual, HydroCompressorMatchingViewModel matching) + { + if (hydroInfo == null) + { + return false; + } + if (visual == null) + { + return false; + } + if (matching == null) + { + return false; + } + visual.Name = matching.Name; + visual.DbLocked = matching.DbLocked; + visual.DbId = matching.DbId; + visual.ModelType = matching.ModelType; + visual.Material = matching.Material; + visual.Diameter = matching.Diameter; + visual.MinorLoss = matching.MinorLoss; - // if (!elbow.DbLocked) - // { - // if (!string.IsNullOrEmpty(matching.MatchingModelType)) - // { - // elbow.ModelType = matching.MatchingModelType; - // } - // if (!string.IsNullOrEmpty(matching.MatchingDbId)) - // { - // elbow.DbId = matching.MatchingDbId; - // } - // if (matching.MatchingCaliber.HasValue) - // { - // elbow.Caliber = matching.MatchingCaliber.Value; - // } - // if (!string.IsNullOrEmpty(matching.MatchingMaterial)) - // { - // elbow.Material = matching.MatchingMaterial; - // } - // if (matching.MatchingMinorLoss.HasValue) - // { - // elbow.MinorLoss = matching.MatchingMinorLoss.Value; - // } + bool result = false; + if (!visual.DbLocked) + { + if (!string.IsNullOrEmpty(matching.MatchingModelType)) + { + visual.ModelType = matching.MatchingModelType; + result = true; + } + if (!string.IsNullOrEmpty(matching.MatchingDbId)) + { + visual.DbId = matching.MatchingDbId; + result = true; + } + if (!string.IsNullOrEmpty(matching.MatchingMaterial)) + { + visual.Material = matching.MatchingMaterial; + result = true; + } + if (matching.MatchingDiameter.HasValue) + { + visual.Diameter = matching.MatchingDiameter.Value; + result = true; + } + if (matching.MatchingMinorLoss.HasValue) + { + visual.MinorLoss = matching.MatchingMinorLoss.Value; + result = true; + } - // result = true; - // } - // } - // return result; - //} + if (!string.IsNullOrEmpty(matching.MatchingCurveDbId)) + { + var curvevql = hydroInfo.Curves?.Find(x => x.Code == visual.CurveQL); + if (curvevql == null) + { + curvevql = new Yw.Model.HydroCurveInfo(); + curvevql.Catalog = Yw.Hydro.ParterCatalog.Curve; + curvevql.Code = Yw.Untity.UniqueHelper.CreateFromFirst("curve", hydroInfo.GetAllParterCodes()); + curvevql.Name = "鍖归厤"; + curvevql.ModelType = string.Empty; + curvevql.DbLocked = false; + curvevql.DbId = matching.MatchingCurveDbId; + curvevql.CurveType = Yw.WinFrmUI.HydroCurve.CompressorQL; + curvevql.CurveData = matching.MatchingCurveQL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); + if (hydroInfo.Curves == null) + { + hydroInfo.Curves = new List<Yw.Model.HydroCurveInfo>(); + } + hydroInfo.Curves.Add(curvevql); + visual.CurveQL = curvevql.Code; + result = true; + } + else + { + if (!curvevql.DbLocked) + { + curvevql.DbId = matching.MatchingCurveDbId; + curvevql.CurveData = matching.MatchingCurveQL?.Select(x => new Yw.Model.Hydro.CurvePoint(x.X, x.Y)).ToList(); + result = true; + } + } + } + } + return result; + } - ///// <summary> - ///// 搴旂敤涓夐�氳嚜鍔ㄥ尮閰峍iewModel - ///// </summary> - //public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, ThreelinkMatchingViewModel matching) - //{ - // if (hydroInfo == null) - // { - // return false; - // } - // if (matching == null) - // { - // return false; - // } - - // bool result = false; - - // var threelink = hydroInfo.Threelinks?.Find(x => x.Code == matching.Code); - // if (threelink != null) - // { - // threelink.DbLocked = matching.DbLocked; - // threelink.ModelType = matching.ModelType; - // threelink.Caliber = matching.Caliber; - // threelink.Material = matching.Material; - // threelink.MinorLoss = matching.MinorLoss; - - // if (!threelink.DbLocked) - // { - // if (!string.IsNullOrEmpty(matching.MatchingModelType)) - // { - // threelink.ModelType = matching.MatchingModelType; - // } - // if (!string.IsNullOrEmpty(matching.MatchingDbId)) - // { - // threelink.DbId = matching.MatchingDbId; - // } - // if (matching.MatchingCaliber.HasValue) - // { - // threelink.Caliber = matching.MatchingCaliber.Value; - // } - // if (!string.IsNullOrEmpty(matching.MatchingMaterial)) - // { - // threelink.Material = matching.MatchingMaterial; - // } - // if (matching.MatchingMinorLoss.HasValue) - // { - // threelink.MinorLoss = matching.MatchingMinorLoss.Value; - // } - - // result = true; - // } - // } - // return result; - //} - - ///// <summary> - ///// 搴旂敤鍥涢�氳嚜鍔ㄥ尮閰峍iewModel - ///// </summary> - //public static bool Apply(Yw.Model.HydroModelInfo hydroInfo, FourlinkMatchingViewModel matching) - //{ - // if (hydroInfo == null) - // { - // return false; - // } - // if (matching == null) - // { - // return false; - // } - - // bool result = false; - - // var fourlink = hydroInfo.Fourlinks?.Find(x => x.Code == matching.Code); - // if (fourlink != null) - // { - // fourlink.DbLocked = matching.DbLocked; - // fourlink.ModelType = matching.ModelType; - // fourlink.Caliber = matching.Caliber; - // fourlink.Material = matching.Material; - // fourlink.MinorLoss = matching.MinorLoss; - - // if (!fourlink.DbLocked) - // { - // if (!string.IsNullOrEmpty(matching.MatchingModelType)) - // { - // fourlink.ModelType = matching.MatchingModelType; - // } - // if (!string.IsNullOrEmpty(matching.MatchingDbId)) - // { - // fourlink.DbId = matching.MatchingDbId; - // } - // if (matching.MatchingCaliber.HasValue) - // { - // fourlink.Caliber = matching.MatchingCaliber.Value; - // } - // if (!string.IsNullOrEmpty(matching.MatchingMaterial)) - // { - // fourlink.Material = matching.MatchingMaterial; - // } - // if (matching.MatchingMinorLoss.HasValue) - // { - // fourlink.MinorLoss = matching.MatchingMinorLoss.Value; - // } - - // result = true; - // } - // } - // return result; - //} + #endregion #endregion diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/16-tank/HydroTankMatchingViewModel.cs b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/01-tank/HydroTankMatchingViewModel.cs similarity index 100% rename from WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/16-tank/HydroTankMatchingViewModel.cs rename to WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/01-tank/HydroTankMatchingViewModel.cs diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/07-blunthead/HydroBluntheadMatchingViewModel.cs b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/02-blunthead/HydroBluntheadMatchingViewModel.cs similarity index 100% rename from WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/07-blunthead/HydroBluntheadMatchingViewModel.cs rename to WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/02-blunthead/HydroBluntheadMatchingViewModel.cs diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/04-elbow/HydroElbowMatchingViewModel.cs b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/03-elbow/HydroElbowMatchingViewModel.cs similarity index 90% rename from WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/04-elbow/HydroElbowMatchingViewModel.cs rename to WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/03-elbow/HydroElbowMatchingViewModel.cs index 6dc2ec7..8916b69 100644 --- a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/04-elbow/HydroElbowMatchingViewModel.cs +++ b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/03-elbow/HydroElbowMatchingViewModel.cs @@ -25,13 +25,7 @@ this.Caliber = rhs.Caliber; this.MinorLoss = rhs.MinorLoss; this.BendingAngle = rhs.BendingAngle.HasValue ? (int)rhs.BendingAngle.Value : null; - switch (rhs.ElbowType) - { - case HydroElbow.Short: this.ElbowType = eElbowType.Short; break; - case HydroElbow.Middle: this.ElbowType = eElbowType.Middle; break; - case HydroElbow.Long: this.ElbowType = eElbowType.Long; break; - default: break; - } + this.ElbowType = HydroElbowTypeEnumHelper.GetElbowType(rhs.ElbowType); } /// <summary> diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/05-threelink/HydroThreelinkMatchingViewModel.cs b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/04-threelink/HydroThreelinkMatchingViewModel.cs similarity index 100% rename from WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/05-threelink/HydroThreelinkMatchingViewModel.cs rename to WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/04-threelink/HydroThreelinkMatchingViewModel.cs diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/06-fourlink/HydroFourlinkMatchingViewModel.cs b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/05-fourlink/HydroFourlinkMatchingViewModel.cs similarity index 100% rename from WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/06-fourlink/HydroFourlinkMatchingViewModel.cs rename to WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/05-fourlink/HydroFourlinkMatchingViewModel.cs diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/10-meter/HydroMeterMatchingViewModel.cs b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/06-meter/HydroMeterMatchingViewModel.cs similarity index 100% rename from WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/10-meter/HydroMeterMatchingViewModel.cs rename to WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/06-meter/HydroMeterMatchingViewModel.cs diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/11-flowmeter/HydroFlowmeterMatchingViewModel.cs b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/07-flowmeter/HydroFlowmeterMatchingViewModel.cs similarity index 100% rename from WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/11-flowmeter/HydroFlowmeterMatchingViewModel.cs rename to WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/07-flowmeter/HydroFlowmeterMatchingViewModel.cs diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/12-pressmeter/HydroFlowmeterMatchingViewModel.cs b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/08-pressmeter/HydroFlowmeterMatchingViewModel.cs similarity index 100% rename from WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/12-pressmeter/HydroFlowmeterMatchingViewModel.cs rename to WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/08-pressmeter/HydroFlowmeterMatchingViewModel.cs diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/08-hydrant/HydroHydrantMatchingViewModel.cs b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/10-hydrant/HydroHydrantMatchingViewModel.cs similarity index 100% rename from WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/08-hydrant/HydroHydrantMatchingViewModel.cs rename to WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/10-hydrant/HydroHydrantMatchingViewModel.cs diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/03-pipe/HydroPipeMatchingViewModel.cs b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/11-pipe/HydroPipeMatchingViewModel.cs similarity index 100% rename from WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/03-pipe/HydroPipeMatchingViewModel.cs rename to WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/11-pipe/HydroPipeMatchingViewModel.cs diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/01-pump/HydroPumpMatchingViewModel.cs b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/12-pump/HydroPumpMatchingViewModel.cs similarity index 99% rename from WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/01-pump/HydroPumpMatchingViewModel.cs rename to WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/12-pump/HydroPumpMatchingViewModel.cs index 0281a06..a6b6e1f 100644 --- a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/01-pump/HydroPumpMatchingViewModel.cs +++ b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/12-pump/HydroPumpMatchingViewModel.cs @@ -84,11 +84,6 @@ public string CurveDbId { get; set; } /// <summary> - /// 棰濆畾鍔熺巼 - /// </summary> - public double RatedP { get; set; } - - /// <summary> /// 棰濆畾娴侀噺 /// </summary> public double? RatedQ { get; set; } @@ -97,6 +92,11 @@ /// 棰濆畾鎵▼ /// </summary> public double? RatedH { get; set; } + + /// <summary> + /// 棰濆畾鍔熺巼 + /// </summary> + public double RatedP { get; set; } /// <summary> /// 棰濆畾杞�� @@ -139,11 +139,6 @@ public string MatchingCurveDbId { get; set; } /// <summary> - /// 鍖归厤棰濆畾鍔熺巼 - /// </summary> - public double? MatchingRatedP { get; set; } - - /// <summary> /// 鍖归厤棰濆畾娴侀噺 /// </summary> public double? MatchingRatedQ { get; set; } @@ -154,6 +149,11 @@ public double? MatchingRatedH { get; set; } /// <summary> + /// 鍖归厤棰濆畾鍔熺巼 + /// </summary> + public double? MatchingRatedP { get; set; } + + /// <summary> /// 鍖归厤棰濆畾杞�� /// </summary> public double? MatchingRatedN { get; set; } diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/13-translation/HydroTranslationMatchingViewModel.cs b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/12-translation/HydroTranslationMatchingViewModel.cs similarity index 100% rename from WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/13-translation/HydroTranslationMatchingViewModel.cs rename to WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/12-translation/HydroTranslationMatchingViewModel.cs diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/02-valve/HydroValveMatchingViewModel.cs b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/14-valve/HydroValveMatchingViewModel.cs similarity index 85% rename from WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/02-valve/HydroValveMatchingViewModel.cs rename to WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/14-valve/HydroValveMatchingViewModel.cs index 3615956..668e786 100644 --- a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/02-valve/HydroValveMatchingViewModel.cs +++ b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/14-valve/HydroValveMatchingViewModel.cs @@ -25,17 +25,12 @@ this.Material = rhs.Material; this.Diameter = rhs.Diameter; this.MinorLoss = rhs.MinorLoss; - switch (rhs.ValveType) + var valveType = HydroValveTypeEnumHelper.GetValveType(rhs.ValveType); + if (!valveType.HasValue) { - case Yw.Hydro.ValveType.PRV: this.ValveType = eValveType.PRV; break; - case Yw.Hydro.ValveType.PSV: this.ValveType = eValveType.PSV; break; - case Yw.Hydro.ValveType.PBV: this.ValveType = eValveType.PBV; break; - case Yw.Hydro.ValveType.TCV: this.ValveType = eValveType.TCV; break; - case Yw.Hydro.ValveType.FCV: this.ValveType = eValveType.FCV; break; - case Yw.Hydro.ValveType.GPV: this.ValveType = eValveType.GPV; break; - case Yw.Hydro.ValveType.CV: this.ValveType = eValveType.CV; break; - default: break; + valveType = eValveType.GPV; } + this.ValveType = valveType.Value; this.ValveSetting = rhs.ValveSetting; } diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/14-exchanger/HydroExchangerMatchingViewModel.cs b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/15-exchanger/HydroExchangerMatchingViewModel.cs similarity index 100% rename from WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/14-exchanger/HydroExchangerMatchingViewModel.cs rename to WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/15-exchanger/HydroExchangerMatchingViewModel.cs diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/15-compressor/HydroCompressorMatchingViewModel.cs b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/16-compressor/HydroCompressorMatchingViewModel.cs similarity index 100% rename from WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/15-compressor/HydroCompressorMatchingViewModel.cs rename to WinFrmUI/Yw.WinFrmUI.Hydro.Core/14-matching/16-compressor/HydroCompressorMatchingViewModel.cs diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/19-pump/05-state/HydroPumpListItemStateViewModel.cs b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/19-pump/05-state/HydroPumpListItemStateViewModel.cs index c9b7edd..baaafad 100644 --- a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/19-pump/05-state/HydroPumpListItemStateViewModel.cs +++ b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/19-pump/05-state/HydroPumpListItemStateViewModel.cs @@ -20,7 +20,7 @@ /// <summary> /// /// </summary> - public HydroPumpListItemStateViewModel(Yw.Model.HydroPumpInfo rhs) + public HydroPumpListItemStateViewModel(Yw.Model.HydroPumpInfo rhs, Yw.Model.HydroModelInfo hydroInfo) { this.Code = rhs.Code; this.Name = rhs.Name; @@ -38,6 +38,7 @@ this.Description = rhs.Description; this.Vmo = rhs; + this.HydroInfo = hydroInfo; } /// <summary> @@ -80,5 +81,12 @@ /// vmo /// </summary> public Yw.Model.HydroPumpInfo Vmo { get; set; } + + /// <summary> + /// + /// </summary> + public Yw.Model.HydroModelInfo HydroInfo { get; set; } + + } } diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/19-pump/05-state/HydroPumpListStateEditCtrl.Designer.cs b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/19-pump/05-state/HydroPumpListStateEditCtrl.Designer.cs index 3282b73..662153d 100644 --- a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/19-pump/05-state/HydroPumpListStateEditCtrl.Designer.cs +++ b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/19-pump/05-state/HydroPumpListStateEditCtrl.Designer.cs @@ -29,6 +29,8 @@ private void InitializeComponent() { components = new Container(); + DevExpress.Utils.SimpleContextButton simpleContextButton1 = new DevExpress.Utils.SimpleContextButton(); + ComponentResourceManager resources = new ComponentResourceManager(typeof(HydroPumpListStateEditCtrl)); DevExpress.XtraEditors.TableLayout.ItemTemplateBase itemTemplateBase1 = new DevExpress.XtraEditors.TableLayout.ItemTemplateBase(); DevExpress.XtraEditors.TableLayout.TableColumnDefinition tableColumnDefinition1 = new DevExpress.XtraEditors.TableLayout.TableColumnDefinition(); DevExpress.XtraEditors.TableLayout.TableColumnDefinition tableColumnDefinition2 = new DevExpress.XtraEditors.TableLayout.TableColumnDefinition(); @@ -49,6 +51,14 @@ // // imageListBoxControl1 // + simpleContextButton1.AlignmentOptions.Panel = DevExpress.Utils.ContextItemPanel.Center; + simpleContextButton1.AlignmentOptions.Position = DevExpress.Utils.ContextItemPosition.Far; + simpleContextButton1.Id = new Guid("ee22239a-6899-40f3-bbe4-7a30d39c9f1d"); + simpleContextButton1.ImageOptionsCollection.ItemNormal.SvgImage = (DevExpress.Utils.Svg.SvgImage)resources.GetObject("resource.SvgImage"); + simpleContextButton1.ImageOptionsCollection.ItemNormal.SvgImageSize = new Size(24, 24); + simpleContextButton1.Name = "simpleContextButton1"; + simpleContextButton1.ToolTip = "璁剧疆"; + imageListBoxControl1.ContextButtons.Add(simpleContextButton1); imageListBoxControl1.DataSource = hydroPumpListItemStateViewModelBindingSource; imageListBoxControl1.Dock = DockStyle.Fill; imageListBoxControl1.ItemHeight = 34; @@ -60,7 +70,7 @@ tableColumnDefinition1.Length.Value = 40D; tableColumnDefinition2.Length.Value = 210D; tableColumnDefinition3.Length.Type = DevExpress.XtraEditors.TableLayout.TableDefinitionLengthType.Pixel; - tableColumnDefinition3.Length.Value = 66D; + tableColumnDefinition3.Length.Value = 80D; itemTemplateBase1.Columns.Add(tableColumnDefinition1); itemTemplateBase1.Columns.Add(tableColumnDefinition2); itemTemplateBase1.Columns.Add(tableColumnDefinition3); @@ -82,13 +92,15 @@ templatedItemElement3.ImageOptions.ImageAlignment = DevExpress.XtraEditors.TileItemContentAlignment.MiddleCenter; templatedItemElement3.ImageOptions.ImageScaleMode = DevExpress.XtraEditors.TileItemImageScaleMode.ZoomInside; templatedItemElement3.Text = "CurrentHz"; - templatedItemElement3.TextAlignment = DevExpress.XtraEditors.TileItemContentAlignment.MiddleCenter; + templatedItemElement3.TextAlignment = DevExpress.XtraEditors.TileItemContentAlignment.MiddleLeft; itemTemplateBase1.Elements.Add(templatedItemElement1); itemTemplateBase1.Elements.Add(templatedItemElement2); itemTemplateBase1.Elements.Add(templatedItemElement3); itemTemplateBase1.Name = "template1"; itemTemplateBase1.Rows.Add(tableRowDefinition1); imageListBoxControl1.Templates.Add(itemTemplateBase1); + imageListBoxControl1.SelectedValueChanged += imageListBoxControl1_SelectedValueChanged; + imageListBoxControl1.ContextButtonClick += imageListBoxControl1_ContextButtonClick; // // HydroPumpListStateEditCtrl // diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/19-pump/05-state/HydroPumpListStateEditCtrl.cs b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/19-pump/05-state/HydroPumpListStateEditCtrl.cs index 94f8932..31f27d0 100644 --- a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/19-pump/05-state/HydroPumpListStateEditCtrl.cs +++ b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/19-pump/05-state/HydroPumpListStateEditCtrl.cs @@ -19,22 +19,38 @@ InitializeComponent(); } - private BindingList<HydroPumpListItemStateViewModel> _allBindingList = null; + /// <summary> + /// 閫夋嫨鏀瑰彉浜嬩欢 + /// </summary> + public event Action<HydroPumpListItemStateViewModel> SelectedChangedEvent; + + private BindingList<HydroPumpListItemStateViewModel> _allBindingList = null;//鎵�鏈夌粦瀹氬垪琛� + + /// <summary> + /// 鏄惁鏈夋敼鍙� + /// </summary> + public bool HasChanged + { + get { return _hasChanged; } + } + private bool _hasChanged = false; + + /// <summary> /// 缁戝畾鏁版嵁 /// </summary> public void SetBindingData(Yw.Model.HydroModelInfo hydroInfo) { - SetBindingData(hydroInfo?.Pumps); + SetBindingData(hydroInfo?.Pumps, hydroInfo); } /// <summary> /// 缁戝畾鏁版嵁 /// </summary> - public void SetBindingData(List<Yw.Model.HydroPumpInfo> allPumpList) + public void SetBindingData(List<Yw.Model.HydroPumpInfo> allPumpList, Yw.Model.HydroModelInfo hydroInfo) { - var list = allPumpList?.Select(x => new HydroPumpListItemStateViewModel(x)).ToList(); + var list = allPumpList?.Select(x => new HydroPumpListItemStateViewModel(x, hydroInfo)).ToList(); SetBindingData(list); } @@ -49,6 +65,70 @@ this.hydroPumpListItemStateViewModelBindingSource.ResetBindings(false); } + /// <summary> + /// 鑾峰彇宸ュ喌鍒楄〃 + /// </summary> + public List<HydroWorkingPumpViewModel> GetWorkingList() + { + return _allBindingList?.Select(x => new HydroWorkingPumpViewModel() + { + Code = x.Code, + LinkStatus = x.RunStatus ? Yw.Hydro.PumpStatus.Open : Yw.Hydro.PumpStatus.Closed, + CurrentHz = x.CurrentHz + }).ToList(); + } + + // + private void imageListBoxControl1_ContextButtonClick(object sender, DevExpress.Utils.ContextItemClickEventArgs e) + { + var vm = e.DataItem as HydroPumpListItemStateViewModel; + if (vm == null) + { + return; + } + var working = new HydroWorkingPumpViewModel() + { + Code = vm.Code, + LinkStatus = vm.RunStatus ? Yw.Hydro.PumpStatus.Open : Yw.Hydro.PumpStatus.Closed, + CurrentHz = vm.CurrentHz + }; + var dlg = new SetHydroPumpWorkingDlg(); + dlg.ReloadDataEvent += (rhs) => + { + vm.RunStatus = rhs.LinkStatus == Yw.Hydro.PumpStatus.Open; + vm.CurrentHz = rhs.CurrentHz; + if (vm.RunStatus) + { + vm.Image = Yw.WinFrmUI.Hydro.Core.Properties.Resources.pump_run_32; + } + else + { + vm.Image = Yw.WinFrmUI.Hydro.Core.Properties.Resources.pump_shut_32; + + } + this.hydroPumpListItemStateViewModelBindingSource.ResetBindings(false); + _hasChanged = true; + }; + dlg.SetBindingData(working); + dlg.ShowDialog(); + } + + //閫夋嫨鏀瑰彉 + private void imageListBoxControl1_SelectedValueChanged(object sender, EventArgs e) + { + if (_allBindingList == null || _allBindingList.Count < 1) + { + return; + } + var item = this.imageListBoxControl1.SelectedItem; + var vm = item as HydroPumpListItemStateViewModel; + if (vm == null) + { + return; + } + this.SelectedChangedEvent?.Invoke(vm); + } + } } diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/19-pump/05-state/HydroPumpListStateEditCtrl.resx b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/19-pump/05-state/HydroPumpListStateEditCtrl.resx index 812d835..f35c6d0 100644 --- a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/19-pump/05-state/HydroPumpListStateEditCtrl.resx +++ b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/19-pump/05-state/HydroPumpListStateEditCtrl.resx @@ -120,4 +120,29 @@ <metadata name="hydroPumpListItemStateViewModelBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>17, 17</value> </metadata> + <assembly alias="DevExpress.Data.v23.2" name="DevExpress.Data.v23.2, Culture=neutral, PublicKeyToken=b88d1754d700e49a" /> + <data name="resource.SvgImage" type="DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v23.2" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value> + AAEAAAD/////AQAAAAAAAAAMAgAAAFlEZXZFeHByZXNzLkRhdGEudjIzLjIsIFZlcnNpb249MjMuMi40 + LjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjg4ZDE3NTRkNzAwZTQ5YQUBAAAAHURl + dkV4cHJlc3MuVXRpbHMuU3ZnLlN2Z0ltYWdlAQAAAAREYXRhBwICAAAACQMAAAAPAwAAAO4DAAAC77u/ + PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nVVRGLTgnPz4NCjxzdmcgeD0iMHB4IiB5PSIwcHgi + IHZpZXdCb3g9IjAgMCAzMiAzMiIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcv + MjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bWw6c3Bh + Y2U9InByZXNlcnZlIiBpZD0iTGF5ZXJfMSIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAg + MzIgMzIiPg0KICA8c3R5bGUgdHlwZT0idGV4dC9jc3MiPgoJLkJsYWNre2ZpbGw6IzcyNzI3Mjt9Cgku + WWVsbG93e2ZpbGw6I0ZGQjExNTt9CgkuQmx1ZXtmaWxsOiMxMTc3RDc7fQoJLkdyZWVue2ZpbGw6IzAz + OUMyMzt9CgkuUmVke2ZpbGw6I0QxMUMxQzt9CgkuV2hpdGV7ZmlsbDojRkZGRkZGO30KCS5zdDB7b3Bh + Y2l0eTowLjc1O30KCS5zdDF7b3BhY2l0eTowLjU7fQoJLnN0MntvcGFjaXR5OjAuMjU7fQo8L3N0eWxl + Pg0KICA8ZyBpZD0iUHJvcGVydGllcyI+DQogICAgPHBhdGggZD0iTTMwLDE4di00bC00LjQtMC43Yy0w + LjItMC44LTAuNS0xLjUtMC45LTIuMWwyLjYtMy42bC0yLjgtMi44bC0zLjYsMi42Yy0wLjctMC40LTEu + NC0wLjctMi4xLTAuOUwxOCwyaC00ICAgbC0wLjcsNC40Yy0wLjgsMC4yLTEuNSwwLjUtMi4xLDAuOUw3 + LjUsNC43TDQuNyw3LjVsMi42LDMuNmMtMC40LDAuNy0wLjcsMS40LTAuOSwyLjFMMiwxNHY0bDQuNCww + LjdjMC4yLDAuOCwwLjUsMS41LDAuOSwyLjEgICBsLTIuNiwzLjZsMi44LDIuOGwzLjYtMi42YzAuNyww + LjQsMS40LDAuNywyLjEsMC45TDE0LDMwaDRsMC43LTQuNGMwLjgtMC4yLDEuNS0wLjUsMi4xLTAuOWwz + LjYsMi42bDIuOC0yLjhsLTIuNi0zLjYgICBjMC40LTAuNywwLjctMS40LDAuOS0yLjFMMzAsMTh6IE0x + NiwyMGMtMi4yLDAtNC0xLjgtNC00YzAtMi4yLDEuOC00LDQtNHM0LDEuOCw0LDRDMjAsMTguMiwxOC4y + LDIwLDE2LDIweiIgY2xhc3M9IkJsdWUiIC8+DQogIDwvZz4NCjwvc3ZnPgs= +</value> + </data> </root> \ No newline at end of file diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/Yw.WinFrmUI.Hydro.Core.csproj b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/Yw.WinFrmUI.Hydro.Core.csproj index 2187414..df8e7bb 100644 --- a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/Yw.WinFrmUI.Hydro.Core.csproj +++ b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/Yw.WinFrmUI.Hydro.Core.csproj @@ -146,6 +146,9 @@ <Compile Update="06-visual\19-compressor\SetHydroCompressorListDlg.cs"> <SubType>Form</SubType> </Compile> + <Compile Update="10-working\02-visual\03-pump\SetHydroPumpWorkingDlg.cs"> + <SubType>Form</SubType> + </Compile> <Compile Update="10-working\02-visual\05-resistanse\SetHydroWorkingResistanceCtrl.cs"> <SubType>UserControl</SubType> </Compile> diff --git a/WinFrmUI/Yw.WinFrmUI.Phart.Core/Yw.WinFrmUI.Phart.Core.csproj b/WinFrmUI/Yw.WinFrmUI.Phart.Core/Yw.WinFrmUI.Phart.Core.csproj index 9d5a0b6..5e8f44b 100644 --- a/WinFrmUI/Yw.WinFrmUI.Phart.Core/Yw.WinFrmUI.Phart.Core.csproj +++ b/WinFrmUI/Yw.WinFrmUI.Phart.Core/Yw.WinFrmUI.Phart.Core.csproj @@ -51,7 +51,7 @@ <ItemGroup> <PackageReference Include="DevExpress.Win.Design" Version="23.2.4" /> <PackageReference Include="NPOI" Version="2.7.1" /> - <PackageReference Include="Yw.Pump.Core" Version="3.1.2" /> + <PackageReference Include="Yw.Pump.Core" Version="3.1.5" /> </ItemGroup> <ItemGroup> diff --git a/WinFrmUI/Yw.WinFrmUI.Phart.Core/v3/02-pump/01-single/02-operation/PumpOperationChart.cs b/WinFrmUI/Yw.WinFrmUI.Phart.Core/v3/02-pump/01-single/02-operation/PumpOperationChart.cs index 76bb27e..fcc43d7 100644 --- a/WinFrmUI/Yw.WinFrmUI.Phart.Core/v3/02-pump/01-single/02-operation/PumpOperationChart.cs +++ b/WinFrmUI/Yw.WinFrmUI.Phart.Core/v3/02-pump/01-single/02-operation/PumpOperationChart.cs @@ -255,74 +255,75 @@ return; } - start_head ??= _coordinate.DispMinH(); - - var equip_line_reated = Yw.Geometry.EquipCurveHelper.CalcEquipCurve(_operation_vm.CurveQH, _equip_pt, start_head.Value, out Yw.Geometry.Point2d sect_pt_rated); - if (equip_line_reated == null || sect_pt_rated == null) + start_head ??= _coordinate.DispMinH(); + var equip_line = Yw.Geometry.EquipCurveHelper.CalcEquipCurve(_operation_vm.CurveQH, _equip_pt, start_head.Value, out Yw.Geometry.Point2d sect_pt); + if (equip_line == null || sect_pt == null) return; - _equip_line = equip_line_reated; - _equip_sect_pt = sect_pt_rated; + _equip_line = equip_line; + _equip_sect_pt = sect_pt; - double flow_rated = 0, head_rated = 0; - double? eff_rated = null, power_rated = null; - flow_rated = sect_pt_rated.X; - head_rated = _operation_vm.CurveQH.GetPointY(flow_rated); + double flow = 0, head = 0; + double? eff = null, power = null; + flow = sect_pt.X; + head = _operation_vm.CurveQH.GetPointY(flow); if (_operation_vm.CurveQP != null) { - power_rated = _operation_vm.CurveQP.GetPointY(flow_rated); - eff_rated = PumpCalcHelper.CalculateE(flow_rated, head_rated, power_rated.Value); + power = _operation_vm.CurveQP.GetPointY(flow); + eff = PumpCalcHelper.CalculateE(flow, head, power.Value); } else if (_operation_vm.CurveQE != null) { - eff_rated = _operation_vm.CurveQE.GetPointY(flow_rated); - power_rated = PumpCalcHelper.CalculateP(flow_rated, head_rated, eff_rated.Value); + eff = _operation_vm.CurveQE.GetPointY(flow); + power = PumpCalcHelper.CalculateP(flow, head, eff.Value); } - - - var design_pt_list = new List<PumpDesignPointViewModel>(); - - var design_pt_rated = new PumpDesignPointViewModel(); - design_pt_rated.Id = _operation_vm.Id + "棰濆畾"; - design_pt_rated.Name = _operation_vm.Name+"(棰濆畾)"; - design_pt_rated.Q = flow_rated; - design_pt_rated.H = head_rated; - design_pt_rated.E = eff_rated; - design_pt_rated.P = power_rated; - design_pt_rated.Hz = _operation_vm.RatedHz; - design_pt_rated.N = _operation_vm.RatedN; - design_pt_list.Add(design_pt_rated); + + var design_pt_list = new List<PumpDesignPointViewModel> + { + new() { + Id = _operation_vm.Id + "棰濆畾", + Name = _operation_vm.Name + "(棰濆畾)", + Q = flow, + H = head, + E = eff, + P = power, + Hz = _operation_vm.RatedHz, + N = _operation_vm.RatedN + } + }; if (_operation_vm.CurrentStatus) { - var equip_line = Yw.Geometry.EquipCurveHelper.CalcEquipCurve(_operation_vm.CurrentCurveQH, _equip_pt, start_head.Value, out Yw.Geometry.Point2d sect_pt); - if (equip_line == null || sect_pt == null) + var current_equip_line = Yw.Geometry.EquipCurveHelper.CalcEquipCurve(_operation_vm.CurrentCurveQH, _equip_pt, start_head.Value, out Yw.Geometry.Point2d current_sect_pt); + if ( current_sect_pt == null) return; - double flow = 0, head = 0; - double? eff = null, power = null; - flow = sect_pt.X; - head = _operation_vm.CurrentCurveQH.GetPointY(flow); + double current_flow = 0, current_head = 0; + double? current_eff = null, current_power = null; + current_flow = current_sect_pt.X; + current_head = _operation_vm.CurrentCurveQH.GetPointY(current_flow); if (_operation_vm.CurrentCurveQP != null) { - power = _operation_vm.CurrentCurveQP.GetPointY(flow); - eff = PumpCalcHelper.CalculateE(flow, head, power.Value); + current_power = _operation_vm.CurrentCurveQP.GetPointY(current_flow); + current_eff = PumpCalcHelper.CalculateE(current_flow, current_head, current_power.Value); } else if (_operation_vm.CurrentCurveQE != null) { - eff = _operation_vm.CurrentCurveQE.GetPointY(flow); - power = PumpCalcHelper.CalculateP(flow, head, eff.Value); - } + current_eff = _operation_vm.CurrentCurveQE.GetPointY(current_flow); + current_power = PumpCalcHelper.CalculateP(current_flow, current_head, current_eff.Value); + } - var design_pt = new PumpDesignPointViewModel(); - design_pt.Id = _operation_vm.Id; - design_pt.Name = _operation_vm.Name; - design_pt.Q = flow; - design_pt.H = head; - design_pt.E = eff; - design_pt.P = power; - design_pt.Hz = _operation_vm.CurrentHz; - design_pt.N = _operation_vm.CurrentN; - design_pt_list.Add(design_pt); + design_pt_list.Add(new() + { + Id = _operation_vm.Id, + Name = _operation_vm.Name, + Q = current_flow, + H = current_head, + E = current_eff, + P = current_power, + Hz = _operation_vm.CurrentHz, + N = _operation_vm.CurrentN + }); + } this.DesignPointChangedEvent?.Invoke(design_pt_list); @@ -604,8 +605,8 @@ this.chartControl1.BeginInit(); this.chartControl1.Series.Clear(); - var annotationCount = this.chartControl1.AnnotationRepository.Count; - for (int i = annotationCount - 1; i > 0; i--) + var annotation_count = this.chartControl1.AnnotationRepository.Count; + for (int i = annotation_count - 1; i > 0; i--) { if (i == 0) break; @@ -616,10 +617,10 @@ if (_operation_vm!=null) { - CreateRatedLineSeries(_operation_vm); + CreateLineSeries(_operation_vm); if (_operation_vm.CurrentStatus) { - CreateWorkingLineSeries(_operation_vm); + CreateCurrentLineSeries(_operation_vm); } } @@ -659,68 +660,90 @@ if (_operation_vm == null) return; - Yw.Geometry.CubicSpline2d qh = null, qe = null, qp = null; + + x_flow ??= _equip_pt?.X ?? _max_flow *0.8; + if (x_flow < _operation_vm.CurrentCurveQH.MinX || x_flow > _operation_vm.CurrentCurveQH.MaxX) + return; + var query_pt_list = new List<PumpQueryPointViewModel>(); + + double flow = 0, head = 0; + double? eff = null, power = null; + + flow = x_flow.Value; + head = _operation_vm.CurveQH.GetPointY(flow); + if (_operation_vm.CurveQP != null) + { + power = _operation_vm.CurveQP.GetPointY(flow); + eff = PumpCalcHelper.CalculateE(flow, head, power.Value); + } + else if (_operation_vm.CurveQE != null) + { + eff = _operation_vm.CurveQE.GetPointY(flow); + power = PumpCalcHelper.CalculateP(flow, head, eff.Value); + } + + query_pt_list.Add(new PumpQueryPointViewModel + { + Id = _operation_vm.Id, + Name = _operation_vm.Name + "棰濆畾", + Q = flow, + H = head, + E = eff, + P = power, + Hz = _operation_vm.RatedHz, + N = _operation_vm.RatedN + }); if (_operation_vm.CurrentStatus) { - x_flow ??= _current_equip_sect_pt?.X ?? _operation_vm.CurrentCurveQH.MaxX / 3 * 2; - if (x_flow < _operation_vm.CurrentCurveQH.MinX || x_flow > _operation_vm.CurrentCurveQH.MaxX) - return; - - qh = _operation_vm.CurrentCurveQH; - qe = _operation_vm.CurrentCurveQE; - qp = _operation_vm.CurrentCurveQP; + flow = x_flow.Value; + head = _operation_vm.CurrentCurveQH.GetPointY(flow); + if (_operation_vm.CurrentCurveQP != null) + { + power = _operation_vm.CurrentCurveQP.GetPointY(flow); + eff = PumpCalcHelper.CalculateE(flow, head, power.Value); + } + else if (_operation_vm.CurrentCurveQE != null) + { + eff = _operation_vm.CurrentCurveQE.GetPointY(flow); + power = PumpCalcHelper.CalculateP(flow, head, eff.Value); + } + query_pt_list.Add(new PumpQueryPointViewModel() + { + Id = _operation_vm.Id, + Name = _operation_vm.Name, + Q = flow, + H = head, + E = eff, + P = power, + Hz = _operation_vm.CurrentHz, + N = _operation_vm.CurrentN + }); } - else - { - x_flow ??= _equip_sect_pt?.X ?? _operation_vm.CurveQH.MaxX / 3 * 2; - if (x_flow < _operation_vm.CurveQH.MinX || x_flow > _operation_vm.CurveQH.MaxX) - return; - qh = _operation_vm.CurveQH; - qe = _operation_vm.CurveQE; - qp = _operation_vm.CurveQP; - } - - _anno_txt_query_info.Visible = true; - - var work_pt = new PumpQueryPointViewModel(); - work_pt.Q = x_flow.Value; - work_pt.H = qh.GetPointY(x_flow.Value); var work_info_str_builder = new StringBuilder(); - work_info_str_builder.AppendLine($"娴侀噺:{work_pt.Q.ToString("N1")} "); - work_info_str_builder.AppendLine($"鎵▼:{work_pt.H.ToString("N1")} "); - if (qe != null) - { - if (qp != null) - { - work_pt.P = qp.GetPointY(work_pt.Q); - work_pt.E = PumpCalcHelper.CalculateE(work_pt.Q, work_pt.H, work_pt.P.Value); - } - else - { - work_pt.E = qe.GetPointY(work_pt.Q); - } - work_info_str_builder.AppendLine($"鏁堢巼:{work_pt.E.Value.ToString("N2")} "); - } - if (qp != null) - { - work_pt.P = qp.GetPointY(work_pt.Q); - work_info_str_builder.Append($"鍔熺巼:{work_pt.P.Value.ToString("N1")} "); - } + work_info_str_builder.AppendLine($"娴侀噺:{flow:N2} "); + work_info_str_builder.AppendLine($"鎵▼:{head:N2} "); + if (eff.HasValue) + work_info_str_builder.AppendLine($"鏁堢巼:{eff:N2} "); + if (power.HasValue) + work_info_str_builder.Append($"鍔熺巼:{power:N2}"); + + _query_flow_line.AxisValue = x_flow; + _query_flow_line.Title.Text = $"{x_flow:N1}"; _anno_txt_query_info.Text = work_info_str_builder.ToString(); _anno_txt_query_info.AutoSize = true; + _anno_txt_query_info.Visible = true; - _query_flow_line.AxisValue = x_flow; - _query_flow_line.Title.Text = x_flow.Value.ToString("N1"); + this.QueryPointChangedEvent?.Invoke(query_pt_list); } /// <summary> /// 鍒涘缓棰濆畾绾跨郴鍒� /// </summary> - private void CreateRatedLineSeries(PumpOperationViewModel vm) + private void CreateLineSeries(PumpOperationViewModel vm) { var series_qh = new DevExpress.XtraCharts.Series(); series_qh.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Numerical; @@ -728,8 +751,7 @@ series_qh.Name = _tag_qh + vm.Id.ToString() + "nr"; series_qh.ShowInLegend = false; series_qh.CrosshairEnabled = DefaultBoolean.False; - series_qh.Tag = vm.Id.ToString() + "nr"; - series_qh.ShowInLegend = true; + series_qh.Tag = vm.Id.ToString() + "nr"; series_qh.LegendTextPattern = vm.Name; @@ -857,7 +879,7 @@ /// <summary> /// 鍒涘缓宸ュ喌绾跨郴鍒� /// </summary> - private void CreateWorkingLineSeries(PumpOperationViewModel vm) + private void CreateCurrentLineSeries(PumpOperationViewModel vm) { var series_qh = new DevExpress.XtraCharts.Series(); series_qh.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Numerical; @@ -865,8 +887,7 @@ series_qh.Name = _tag_qh + vm.Id.ToString(); series_qh.ShowInLegend = false; series_qh.CrosshairEnabled = DefaultBoolean.False; - series_qh.Tag = vm.Id.ToString(); - series_qh.ShowInLegend = true; + series_qh.Tag = vm.Id.ToString(); series_qh.LegendTextPattern = vm.Name; @@ -1029,17 +1050,7 @@ _rightClickObj = null; } } - else if (e.Button == MouseButtons.Right) - { - if (hitInfo.InConstantLine) - { - this.popMenuLine.ShowPopup(MousePosition); - } - else - { - //this.popMenuChart.ShowPopup(MousePosition); - } - } + } private void chartControl1_MouseMove(object sender, MouseEventArgs e) @@ -1182,9 +1193,7 @@ /// 璁剧疆鏁堢巼鏇茬嚎鏄剧ず /// </summary> public void SetQeVisible(bool visible) - { - //if (!_initial_data) - // return; + { this.barCekCurveQEVisible.Checked = visible; } diff --git a/WinFrmUI/Yw.WinFrmUI.Phart.Core/v3/02-pump/02-multi/01-parallel/PumpParallelChart.cs b/WinFrmUI/Yw.WinFrmUI.Phart.Core/v3/02-pump/02-multi/01-parallel/PumpParallelChart.cs index bccc641..8ef5679 100644 --- a/WinFrmUI/Yw.WinFrmUI.Phart.Core/v3/02-pump/02-multi/01-parallel/PumpParallelChart.cs +++ b/WinFrmUI/Yw.WinFrmUI.Phart.Core/v3/02-pump/02-multi/01-parallel/PumpParallelChart.cs @@ -173,13 +173,13 @@ dxArgs.Cache.DrawLine(pen, new Point((int)c_pt_qh.Point.X, (int)c_pt_qh.Point.Y - 10), new Point((int)c_pt_qh.Point.X, (int)c_pt_qh.Point.Y + 10)); if (_qe_visible) { - var y_qe = _paralle_vm.CurrentCurveQE.GetPointY(_equip_sect_pt.X); + var y_qe = _paralle_vm.CurrentCurveQE.GetPointYUnlimited(_equip_sect_pt.X); var c_pt_qe = _diagram.DiagramToPoint(_equip_sect_pt.X, y_qe, _axis_x_flow, _axis_y_eff); dxArgs.Cache.DrawLine(pen, new Point((int)c_pt_qe.Point.X, (int)c_pt_qe.Point.Y - 10), new Point((int)c_pt_qe.Point.X, (int)c_pt_qe.Point.Y + 10)); } if (_qp_visible) { - var y_qp = _paralle_vm.CurrentCurveQP.GetPointY(_equip_sect_pt.X); + var y_qp = _paralle_vm.CurrentCurveQP.GetPointYUnlimited(_equip_sect_pt.X); var c_pt_qp = _diagram.DiagramToPoint(_equip_sect_pt.X, y_qp, _axis_x_flow, _axis_y_power); dxArgs.Cache.DrawLine(pen, new Point((int)c_pt_qp.Point.X, (int)c_pt_qp.Point.Y - 10), new Point((int)c_pt_qp.Point.X, (int)c_pt_qp.Point.Y + 10)); } @@ -214,7 +214,7 @@ { if (pt_list.Count == 1) { - var max_flow_head = vm.CurrentCurveQH.GetPointY(max_flow); + var max_flow_head = vm.CurrentCurveQH.GetPointYUnlimited(max_flow); pt_list.Add(new Yw.Geometry.Point2d(max_flow, max_flow_head)); } var pt_c_list = new List<PointF>(); @@ -239,7 +239,7 @@ { if (pt_list.Count == 1) { - var max_flow_eff = vm.CurrentCurveQE.GetPointY(max_flow); + var max_flow_eff = vm.CurrentCurveQE.GetPointYUnlimited(max_flow); pt_list.Add(new Yw.Geometry.Point2d(max_flow, max_flow_eff)); } var pt_c_list = new List<PointF>(); @@ -264,7 +264,7 @@ { if (pt_list.Count == 1) { - var max_flow_power = vm.CurrentCurveQP.GetPointY(max_flow); + var max_flow_power = vm.CurrentCurveQP.GetPointYUnlimited(max_flow); pt_list.Add(new Yw.Geometry.Point2d(max_flow, max_flow_power)); } var pt_c_list = new List<PointF>(); @@ -337,28 +337,30 @@ double flow = 0, head = 0; double? eff = null, power = null; flow = sect_pt.X; - head = vm.CurrentCurveQH.GetPointY(flow); + head = vm.CurrentCurveQH.GetPointYUnlimited(flow); if (vm.CurrentCurveQP != null) { - power = vm.CurrentCurveQP.GetPointY(flow); + power = vm.CurrentCurveQP.GetPointYUnlimited(flow); eff = PumpCalcHelper.CalculateE(flow, head, power.Value); } else if (vm.CurrentCurveQE != null) { - eff = vm.CurrentCurveQE.GetPointY(flow); + eff = vm.CurrentCurveQE.GetPointYUnlimited(flow); power = PumpCalcHelper.CalculateP(flow, head, eff.Value); } - - var design_pt = new PumpDesignPointViewModel(); - design_pt.Id = vm.Id; - design_pt.Q = flow; - design_pt.H = head; - design_pt.E = eff; - design_pt.P = power; - design_pt.Hz = vm.CurrentHz; - design_pt.N = vm.CurrentN; - design_pt_list.Add(design_pt); + + design_pt_list.Add(new PumpDesignPointViewModel + { + Id = vm.Id, + Name = vm.Name, + Q = flow, + H = head, + E = eff, + P = power, + Hz = vm.CurrentHz, + N = vm.CurrentN + }); } this.DesignPointChangedEvent?.Invoke(design_pt_list); @@ -379,14 +381,14 @@ /// 鏇存柊鍥捐〃 /// </summary>s public void UpdateChart(bool calc_coordinate = false) - { + { + CalcSeries(); + if (calc_coordinate || _coordinate == null) { //涓嶅己杩绠�,灏辩敤涓婃鏇存柊鐨勫潗鏍囩郴 CalcCoordinate(); } - - CalcSeries(); CalcChartAxis(); @@ -437,9 +439,13 @@ double _scaleMinH = 1, _scaleMaxH = 1; + foreach (var vm in _vm_list) { - var qh_pt_list = vm.CurrentCurveQH.GetPointList(); + var qh_pt_list = vm.CurveQH.GetPointList(); + if (vm.CurrentCurveQH != null) + qh_pt_list.AddRange(vm.CurrentCurveQH.GetPointList()); + var xxx = qh_pt_list.Select(x => x.X); var yyy = qh_pt_list.Select(x => x.Y); @@ -453,20 +459,56 @@ foreach (PumpParallelViewModel vm in _vm_list) { - if (vm.CurrentCurveQE == null) - continue; - var qe_pt_list = vm.CurrentCurveQE.GetPointList(); + var qe_pt_list = vm.CurveQE.GetPointList(); + if (vm.CurrentCurveQE != null) + qe_pt_list.AddRange(vm.CurrentCurveQE.GetPointList()); + var yyy = qe_pt_list.Select(x => x.Y); + _min_eff = Math.Max(_min_eff, yyy.Min()); _max_eff = Math.Max(_max_eff, yyy.Max()); } foreach (PumpParallelViewModel vm in _vm_list) { - if (vm.CurrentCurveQP == null) - continue; - var yyy = vm.CurrentCurveQP.GetPointList().Select(x => x.Y); + var qe_pt_list = vm.CurveQP.GetPointList(); + if (vm.CurrentCurveQP != null) + qe_pt_list.AddRange(vm.CurrentCurveQP.GetPointList()); + + var yyy = qe_pt_list.Select(x => x.Y); _min_power = Math.Min(_min_power, yyy.Min()); _max_power = Math.Max(_max_power, yyy.Max()); + } + + if (_paralle_vm != null) + { + { + var qh_pt_list = _paralle_vm.CurveQH.GetPointList(); + + var xxx = qh_pt_list.Select(x => x.X); + var yyy = qh_pt_list.Select(x => x.Y); + + _min_flow = Math.Min(_min_flow, xxx.Min()); + _max_flow = Math.Max(_max_flow, xxx.Max()); + + _min_head = Math.Min(_min_head, yyy.Min()); + _max_head = Math.Max(_max_head, yyy.Max()); + } + + if (_paralle_vm.CurveQE != null) + { + var qe_pt_list = _paralle_vm.CurveQE.GetPointList(); + var yyy = qe_pt_list.Select(x => x.Y); + _min_eff = Math.Max(_min_eff, yyy.Min()); + _max_eff = Math.Max(_max_eff, yyy.Max()); + } + + if (_paralle_vm.CurveQP != null) + { + var qp_pt_list = _paralle_vm.CurveQP.GetPointList(); + var yyy = qp_pt_list.Select(x => x.Y); + _min_power = Math.Min(_min_power, yyy.Min()); + _max_power = Math.Max(_max_power, yyy.Max()); + } } _coordinate = PumpCoordinate.CalcCoordinate(_min_flow, @@ -633,8 +675,12 @@ private void CalcParallelSeries(List<PumpParallelViewModel> list) { _paralle_vm = null; + this.barCekLineVisible.Enabled = false; if (list == null || !list.Any()) - return; + { + LineVisible = false; + return; + } var helper = new Yw.WinFrmUI.Phart.PumpParallelConnectionHelper(); foreach (var item in list) @@ -651,7 +697,8 @@ List<Yw.Geometry.Point2d> calc_pt_qp_list; var calc_staus = helper.CalculateParallel(out calc_pt_qh_list, out calc_pt_qe_list, out calc_pt_qp_list); if (!calc_staus || calc_pt_qh_list.Count < 4) - { + { + LineVisible = false; this.ParallelStatusChangedEvent?.Invoke(false, "骞惰仈澶辫触!"); return; } @@ -676,6 +723,8 @@ _paralle_vm.CurveQP = qp; CreateLineSeries(_paralle_vm); + this.barCekLineVisible.Enabled = true; + } /// <summary> @@ -683,8 +732,8 @@ /// </summary> private void CalcTextAnchorPoint() { - var x = this.chartControl1.Location.X + this.chartControl1.Width - (100); - var y = this.chartControl1.Location.Y + 100; + var x = this.chartControl1.Location.X + this.chartControl1.Width - (50); + var y = this.chartControl1.Location.Y; (_anno_txt_query_info.AnchorPoint as ChartAnchorPoint).X = x; (_anno_txt_query_info.AnchorPoint as ChartAnchorPoint).Y = y; @@ -717,7 +766,7 @@ var min_flow = _paralle_vm.CurveQH.MinX; var max_flow = _paralle_vm.CurveQH.MaxX; - x_flow ??= _equip_pt?.X ?? max_flow / 3 * 2; + x_flow ??= _equip_pt?.X ?? max_flow *0.8; if (x_flow < min_flow || x_flow > max_flow) return; @@ -725,16 +774,16 @@ double? paralle_eff = null, paralle_power = null; paralle_flow = x_flow.Value; - paralle_head = _paralle_vm.CurrentCurveQH.GetPointY(paralle_flow); + paralle_head = _paralle_vm.CurrentCurveQH.GetPointYUnlimited(paralle_flow); if (_paralle_vm.CurrentCurveQP != null) { - paralle_power = _paralle_vm.CurrentCurveQP.GetPointY(paralle_flow); + paralle_power = _paralle_vm.CurrentCurveQP.GetPointYUnlimited(paralle_flow); paralle_eff = PumpCalcHelper.CalculateE(paralle_flow, paralle_head, paralle_power.Value); } else if (_paralle_vm.CurrentCurveQE != null) { - paralle_eff = _paralle_vm.CurrentCurveQE.GetPointY(paralle_flow); + paralle_eff = _paralle_vm.CurrentCurveQE.GetPointYUnlimited(paralle_flow); paralle_power = PumpCalcHelper.CalculateP(paralle_flow, paralle_head, paralle_eff.Value); } @@ -748,24 +797,26 @@ flow = vm.CurrentCurveQH.GetPointsX(head).LastOrDefault(); if (vm.CurrentCurveQP != null) { - power = _paralle_vm.CurrentCurveQP.GetPointY(flow); + power = vm.CurrentCurveQP.GetPointYUnlimited(flow); eff = PumpCalcHelper.CalculateE(flow, head, power.Value); } else if (vm.CurrentCurveQE != null) { - eff = _paralle_vm.CurrentCurveQE.GetPointY(flow); + eff = vm.CurrentCurveQE.GetPointYUnlimited(flow); power = PumpCalcHelper.CalculateP(flow, head, eff.Value); } - - var pump_query_pt = new PumpQueryPointViewModel(); - pump_query_pt.Id = vm.Id; - pump_query_pt.Q = flow; - pump_query_pt.H = head; - pump_query_pt.E = eff; - pump_query_pt.P = power; - pump_query_pt.Hz = vm.CurrentHz; - pump_query_pt.N = vm.CurrentN; - query_pt_list.Add(pump_query_pt); + + query_pt_list.Add(new() + { + Id = vm.Id, + Name=vm.Name, + Q = flow, + H = head, + E = eff, + P = power, + Hz = vm.CurrentHz, + N = vm.CurrentN + }); } var work_info_str_builder = new StringBuilder(); @@ -797,8 +848,7 @@ series_qh.Name = _tag_qh + vm.Id.ToString(); series_qh.ShowInLegend = false; series_qh.CrosshairEnabled = DefaultBoolean.False; - series_qh.Tag = vm.Id.ToString(); - series_qh.ShowInLegend = true; + series_qh.Tag = vm.Id.ToString(); series_qh.LegendTextPattern = vm.Name; -- Gitblit v1.9.3