From 0f99d4d12f2eae29bbe343f4b3131f2faeccda5d Mon Sep 17 00:00:00 2001 From: Shuxia Ning <NingShuxia0927@outlook.com> Date: 星期二, 14 一月 2025 17:31:20 +0800 Subject: [PATCH] 泵曲线修改 --- WinFrmUI/HStation.WinFrmUI.PhartRelation.Core/03-valve/03-import/01-excel/ValveChartExcelImportCtrl.cs | 68 +++++++++++++++++++++++++++++++-- 1 files changed, 63 insertions(+), 5 deletions(-) diff --git a/WinFrmUI/HStation.WinFrmUI.PhartRelation.Core/03-valve/03-import/01-excel/ValveChartExcelImportCtrl.cs b/WinFrmUI/HStation.WinFrmUI.PhartRelation.Core/03-valve/03-import/01-excel/ValveChartExcelImportCtrl.cs index 16910e9..c60d711 100644 --- a/WinFrmUI/HStation.WinFrmUI.PhartRelation.Core/03-valve/03-import/01-excel/ValveChartExcelImportCtrl.cs +++ b/WinFrmUI/HStation.WinFrmUI.PhartRelation.Core/03-valve/03-import/01-excel/ValveChartExcelImportCtrl.cs @@ -1,4 +1,8 @@ -锘縩amespace HStation.WinFrmUI +锘縰sing HStation.PhartRelation; +using Yw.Ahart; +using Yw.WinFrmUI.Phart; + +namespace HStation.WinFrmUI { public partial class ValveChartExcelImportCtrl : DevExpress.XtraEditors.XtraUserControl { @@ -7,14 +11,34 @@ InitializeComponent(); } - - private Yw.Ahart.eCurveType _curve_type; /// <summary> /// 缁戝畾鏁版嵁 /// </summary> - public void SetBindingData(string file_path, Yw.Ahart.eCurveType curve_type) + public void SetBindingData(string file_path) { + var err_msg = Yw.WinFrmUI.PhartExcelHelper.ParseValveExcel(file_path, out List<(Yw.Ahart.eCurveType CurveType, List<Yw.Geometry.Point2d> DefPointList, int Opening)> list); + if (!string.IsNullOrEmpty(err_msg)) + { + XtraMessageBox.Show(err_msg); + return; + } + var vm_list = new List<Yw.WinFrmUI.Phart.ValveEditChartViewModel>(); + for (int i = 0; i < list.Count; i++) + { + var item = list[i]; + var vm = new Yw.WinFrmUI.Phart.ValveEditChartViewModel(); + vm.Id = Guid.NewGuid().ToString(); + vm.Name = item.CurveType == Yw.Ahart.eCurveType.OL ? "榛樿" : $"{item.Opening}%"; + vm.CurveType = item.CurveType; + vm.FeatType = Yw.Ahart.eFeatType.Cubic; + vm.DefPointList = item.DefPointList; + vm.FitPointList = item.DefPointList.GetPointList(vm.FeatType, 50); + vm.Opening = item.Opening; + vm_list.Add(vm); + } + vm_list[0].IsUpdate = true; + this.valveChartExcelEditCtrl1.SetBindingData(vm_list); } @@ -23,8 +47,42 @@ /// </summary> public Yw.Vmo.PhartDiagramExGraphListVmo Get() { + if (!this.valveChartExcelEditCtrl1.Get(out List<ValveEditChartViewModel> vm_list)) + return default; + if (vm_list == null || !vm_list.Any()) + return default; + + var vmo = new Yw.Vmo.PhartDiagramExGraphListVmo(); + vmo.DiagramType = (int)HStation.PhartRelation.eDiagramType.Feat; + vmo.GraphList = new List<Yw.Vmo.PhartGraphVmo>(); + foreach (var vm in vm_list) + { + var ds_stirng = vm.DefPointList.ToDbString(vm.CurveType, vm.FeatType); + if (string.IsNullOrEmpty(ds_stirng)) + return default; + var geometry_paras = new Yw.WinFrmUI.Phart.CurveGeometryParasViewModel(); + geometry_paras.DefinePoints = vm.DefPointList; - return null; + string graph_paras = string.Empty; + if (vm.CurveType == eCurveType.QL) + { + graph_paras = new QLGraphParasViewModel() + { + Opening = vm.Opening + }.ToJson(); + } + + var graph = new Yw.Vmo.PhartGraphVmo(); + graph.Name = vm.Name; + graph.GraphType = (int)vm.CurveType; + graph.GeometryParas = geometry_paras.ToJson(); + graph.GeometryStyle = (int)HStation.PhartRelation.eGeometryStyle.FeatCurve; + graph.GeometryInfo = ds_stirng; + graph.GraphParas = graph_paras; + vmo.GraphList.Add(graph); + } + + return vmo; } -- Gitblit v1.9.3