From 6e1306ab578ed1ad79fc33b0bb7e496b897bf4a4 Mon Sep 17 00:00:00 2001 From: lixiaojun <1287241240@qq.com> Date: 星期一, 20 一月 2025 10:48:03 +0800 Subject: [PATCH] 冲突处理 --- WinFrmUI/Yw.WinFrmUI.Phart.Core/03-valve/02-edit/ValveChartExcelEditCtrl.cs | 137 +++++++++++++++++++-------------------------- 1 files changed, 58 insertions(+), 79 deletions(-) diff --git a/WinFrmUI/Yw.WinFrmUI.Phart.Core/03-valve/02-edit/ValveChartExcelEditCtrl.cs b/WinFrmUI/Yw.WinFrmUI.Phart.Core/03-valve/02-edit/ValveChartExcelEditCtrl.cs index a7e5245..907d8ee 100644 --- a/WinFrmUI/Yw.WinFrmUI.Phart.Core/03-valve/02-edit/ValveChartExcelEditCtrl.cs +++ b/WinFrmUI/Yw.WinFrmUI.Phart.Core/03-valve/02-edit/ValveChartExcelEditCtrl.cs @@ -1,4 +1,5 @@ 锘縰sing NetTaste; +using Yw.Ahart; namespace Yw.WinFrmUI.Phart { @@ -10,8 +11,7 @@ this.gridView1.SetDefaultEditView(); this.gridView1.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder; - - + this.repImgCmbFeatType.Items.Add("绌胯繃鐐�", Yw.Ahart.eFeatType.Through, -1); this.repImgCmbFeatType.Items.Add("浜屾鎷熷悎", Yw.Ahart.eFeatType.Quadratic, -1); this.repImgCmbFeatType.Items.Add("涓夋鎷熷悎", Yw.Ahart.eFeatType.Cubic, -1); @@ -28,6 +28,7 @@ this.gridView1.FocusedRowHandle = index; }; + this.Enabled = false; } private Yw.Ahart.eCurveType _edit_curve_type = Ahart.eCurveType.QL; @@ -65,6 +66,8 @@ this.repImgCmbCurveType.EndInit(); this.barImgCmbCurveType.EditValue = _edit_curve_type; + + this.Enabled = true; } @@ -160,45 +163,12 @@ e.Cancel = true; } var feat_type = (Yw.Ahart.eFeatType)e.NewValue; - switch (feat_type) + var bol = PhartVerifyHelper.VerifyCount(feat_type, vm.DefPointList.Count); + if (!bol) { - case Ahart.eFeatType.Cubic: - { - if (vm.DefPointList.Count < 4) - { - TipFormHelper.ShowInfo("鐐规暟灏戜簬4涓偣"); - e.Cancel = true; - } - } - break; - case Ahart.eFeatType.Through: - { - if (vm.DefPointList.Count < 1) - { - TipFormHelper.ShowInfo("鐐规暟灏戜簬1涓偣"); - e.Cancel = true; - } - } - break; - case Ahart.eFeatType.Quadratic: - { - if (vm.DefPointList.Count < 3) - { - TipFormHelper.ShowInfo("鐐规暟灏戜簬3涓偣"); - e.Cancel = true; - } - } - break; - case Ahart.eFeatType.Quartic: - { - if (vm.DefPointList.Count < 5) - { - TipFormHelper.ShowInfo("鐐规暟灏戜簬5涓偣"); - e.Cancel = true; - } - } - break; + e.Cancel = true; } + } //鎷熷悎绫诲瀷 @@ -263,51 +233,60 @@ var row = this.gridView1.GetCurrentViewModel(def_pt_list); if (row == null) return; - var count = vm.DefPointList.Count - 1; - switch (vm.FeatType) - { - case Ahart.eFeatType.Cubic: - { - if (count < 4) - { - TipFormHelper.ShowInfo("鐐规暟灏戜簬4涓偣"); - return; - } - } - break; - case Ahart.eFeatType.Through: - { - if (count < 1) - { - TipFormHelper.ShowInfo("鐐规暟灏戜簬1涓偣"); - return; - } - } - break; - case Ahart.eFeatType.Quadratic: - { - if (count < 3) - { - TipFormHelper.ShowInfo("鐐规暟灏戜簬3涓偣"); - return; - } - } - break; - case Ahart.eFeatType.Quartic: - { - if (count < 5) - { - TipFormHelper.ShowInfo("鐐规暟灏戜簬5涓偣"); - return; - } - } - break; - } + var count = def_pt_list.Count - 1; + var bol = PhartVerifyHelper.VerifyCount(vm.FeatType, count); + if (!bol) + return; def_pt_list.Remove(row); this.bindingSource1.ResetBindings(false); SetChart(); } + //绮樿创鏉胯鐩� + private void barBtnPastePlateCovering_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + var vm = _vm_list?.Find(x => x.IsUpdate); + if (vm == null) + { + this.valveEditChart1.Clear(); + return; + } + List<Yw.Geometry.Point2d> def_pt_list = vm.DefPointList; + var row = this.gridView1.GetCurrentViewModel(def_pt_list); + if (row == null) + return; + + if (!ClipboardCurveTextUIHelper.CopyDouble(out List<List<double?>> list)) + return; + if (list == null || list.Count < 1) + return; + if (list.Count != 2) + { + TipFormHelper.ShowError("鏁版嵁涓嶅畬鏁�"); + return; + } + var cell_count = list.Count; + var min_row_count = list.Min(x => x.Count); + var pt_list = new List<Yw.Geometry.Point2d>(min_row_count); + for (int i = 0; i < min_row_count; i++) + { + var x = list[0][i]; + var y = list[1][i]; + if (x.HasValue && y.HasValue) + { + pt_list.Add(new Geometry.Point2d(x.Value, y.Value)); + } + } + + var bol = PhartVerifyHelper.VerifyCount(vm.FeatType, pt_list.Count); + if (!bol) + return; + def_pt_list.Clear(); + def_pt_list.AddRange(pt_list); + this.bindingSource1.ResetBindings(false); + SetChart(); + } + private void SetChart() { if (_vm_list == null || !_vm_list.Any()) -- Gitblit v1.9.3