using DevExpress.Spreadsheet; using StackExchange.Profiling.Internal; using Yw.Ahart; using Yw.Geometry; using Yw.Pump; using Yw.WinFrmUI.Phart; namespace HStation.WinFrmUI { /// /// 待整理 抽象到底层 /// public partial class PumpChartViewCtrl : DevExpress.XtraEditors.XtraUserControl { public PumpChartViewCtrl() { InitializeComponent(); this.barCekEqulEffVisible.Checked = true; this.barCekPowerVisible.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; this.barCekEqVisible.Checked = true; this.barCekEqVisible.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; this.pumpViewChart1.AnnotationChangedEvent += PumpViewChart1_AnnotationChangedEvent; } private Yw.Vmo.PhartDiagramExGraphListVmo _vmo = null; private List _vm_list = null; private string _coordinate = null; private bool _power_visible = true; private bool _eff_visible = true; private bool _equal_eff_visible = true; private bool _split_panel = true; private double _nr; /// /// 绑定数据 /// public void SetBindingData(Yw.Vmo.PhartDiagramExGraphListVmo vmo, double nr) { _vmo = vmo; _nr = nr; _vm_list = null; _coordinate = null; if (vmo == null) { ClearBindingData(); return; } var vm_list = new List(); if (vmo.GraphList == null || !vmo.GraphList.Any()) { ClearBindingData(); return; } _coordinate = vmo.DispParas; foreach (var graph in vmo.GraphList) { bool is_default = false; double hz = 50; double n = nr; double eff = -1; var curve_type = (Yw.Ahart.eCurveType)graph.GraphType; switch (curve_type) { case Yw.Ahart.eCurveType.QH: { var paras = PhartGraphHelper.GetGraphParas(curve_type, graph.GraphParas); hz = paras.Hz; n = paras.N; if (hz == 50) is_default = true; } break; case Yw.Ahart.eCurveType.QP: { var paras = PhartGraphHelper.GetGraphParas(curve_type, graph.GraphParas); hz = paras.Hz; n = paras.N; if (hz == 50) is_default = true; } break; case Yw.Ahart.eCurveType.QE: { var paras = PhartGraphHelper.GetGraphParas(curve_type, graph.GraphParas); hz = paras.Hz; n = paras.N; if (hz == 50) is_default = true; } break; case Yw.Ahart.eCurveType.EqualE: { var paras = PhartGraphHelper.GetGraphParas(curve_type, graph.GraphParas); eff = paras.Eff; } break; } var feat_curve = PhartGraphHelper.GetPerformCurve(curve_type, graph.GeometryInfo); var geometry_paras = PhartGraphHelper.GetGeometryParas(curve_type, graph.GeometryParas); var annotation_list = PhartGraphHelper.GetAnnotationParasList(curve_type, graph.AnnotationParas); if (curve_type == eCurveType.QE) annotation_list = null; var vm = new Yw.WinFrmUI.Phart.PumpViewChartViewModel(); vm.Id = graph.ID.ToString(); vm.DbId = graph.ID; vm.Hz = hz; vm.N = n; vm.Eff = eff; vm.AnnotationList = annotation_list; vm.CurveType = feat_curve.CurveType; vm.FeatType = feat_curve.FeatType; vm.DefPointList = geometry_paras?.DefinePoints; vm.FitPointList = feat_curve.FeatCurve.GetPointList(100); if (vm.CurveType == eCurveType.EqualE) vm.FitPointList = feat_curve.FeatCurve.GetPointList(10); vm.IsDefault = is_default; vm.GraphParas = graph.GraphParas; vm_list.Add(vm); } _vm_list = vm_list; var list = _vm_list.Select(x => x.Hz).OrderByDescending(x => x).ToList(); list = list.Distinct().ToList(); this.repImgCmbCurveSel.BeginInit(); this.repImgCmbCurveSel.Items.Clear(); this.repImgCmbCurveSel.Items.Add($"无", null, -1); foreach (var hz in list) { this.repImgCmbCurveSel.Items.Add($"{hz}hz", hz, -1); } this.repImgCmbCurveSel.EndInit(); this.barImgCmbChartSel.EditValue = null; SetColor(_vm_list); SetBindingData(_vm_list, _coordinate, _split_panel, _eff_visible, _power_visible, _equal_eff_visible); } /// /// /// private void SetColor(List vm_list) { if (vm_list == null || !vm_list.Any()) return; var group = vm_list.GroupBy(x => x.Hz); if (group.Count() > 1) { for (int i = 0; i < group.Count(); i++) { var color = Yw.WinFrmUI.PhartColorHelper.Get(i); var item = group.ElementAt(i); foreach (var vm in item) { vm.Color = color; if (vm.CurveType == eCurveType.EqualE) vm.Color = Color.DarkGreen; } } } else { var item = group.ElementAt(0); foreach (var vm in item) { switch (vm.CurveType) { case Yw.Ahart.eCurveType.QH: vm.Color = Yw.WinFrmUI.Phart.PumpChartDisplay.CurveColorQH; break; case Yw.Ahart.eCurveType.QP: vm.Color = Yw.WinFrmUI.Phart.PumpChartDisplay.CurveColorQP; break; case Yw.Ahart.eCurveType.QE: vm.Color = Yw.WinFrmUI.Phart.PumpChartDisplay.CurveColorQE; break; case Yw.Ahart.eCurveType.EqualE: vm.Color = Color.DarkGreen; break; } } } } /// /// 绑定数据 /// private void SetBindingData(List vm_list, string coordinate, bool split_panel, bool eff_visible, bool power_visible, bool equal_eff_visible) { if (IsInvalidData()) { ClearBindingData(); return; } var list = new List(); foreach (var item in vm_list) { if (!eff_visible) { if (item.CurveType == eCurveType.QE) { continue; }; } if (!power_visible) { if (item.CurveType == eCurveType.QP) { continue; }; } if (!equal_eff_visible) { if (item.CurveType == eCurveType.EqualE) { continue; }; } list.Add(item); } this.pumpViewChart1.SetBindingData(list, coordinate, split_panel, eff_visible, power_visible, equal_eff_visible); } //是否是无效数据 private bool IsInvalidData() { if (_vm_list == null || !_vm_list.Any()) { TipFormHelper.ShowInfo("无数据"); return true; } if (!_vm_list.Exists(x => x.CurveType == Yw.Ahart.eCurveType.QH)) { TipFormHelper.ShowInfo("无数据"); return true; } return false; } /// /// 清空绑定数据 /// public void ClearBindingData() { this.pumpViewChart1.Clear(); } private void SetEquip() { if (_vmo == null) return; if (_vm_list == null || !_vm_list.Any()) return; if (this.barTxtStartHead.EditValue == null) return; if (this.barTxtPipeHead.EditValue == null) return; if (this.barTxtPipeQ.EditValue == null) return; var qh50 = _vm_list.Find(x => x.Hz == 50 && x.CurveType == Yw.Ahart.eCurveType.QH); if (qh50 == null) return; var start_head = Convert.ToDouble(this.barTxtStartHead.EditValue); var pipe_head = Convert.ToDouble(this.barTxtPipeHead.EditValue); var pipe_flow = Convert.ToDouble(this.barTxtPipeQ.EditValue); var equip_pt = new Yw.Geometry.Point2d(pipe_flow, pipe_head); var equip_pt_list = Yw.Pump.PerformParabolaHelper.GetEquipCurvePointListByQH(qh50.FitPointList, equip_pt, start_head, 30, true, out Yw.Geometry.Point2d sect_pt); if (equip_pt_list == null || sect_pt == null) { XtraMessageBox.Show("计算失败,设计点不合理!"); return; } var pump_sect_pt = new Yw.WinFrmUI.Phart.PumpSectPointViewModel(); pump_sect_pt.Q = sect_pt.X; pump_sect_pt.H = sect_pt.Y; var qe50 = _vm_list.Find(x => x.Hz == 50 && x.CurveType == Yw.Ahart.eCurveType.QE); if (qe50 != null) { pump_sect_pt.E = qe50?.FitPointList?.GetInterPointsY(sect_pt.X)?.FirstOrDefault(); } var qp50 = _vm_list.Find(x => x.Hz == 50 && x.CurveType == Yw.Ahart.eCurveType.QP); if (qp50 != null) { pump_sect_pt.P = qp50?.FitPointList?.GetInterPointsY(sect_pt.X)?.FirstOrDefault(); } this.pumpViewChart1.SetEquip(equip_pt_list, pump_sect_pt); } private void PumpViewChart1_AnnotationChangedEvent((long DbId, string Tag, double X, double Y) info) { Update(info); } private void barImgCmbChartSel_EditValueChanged(object sender, EventArgs e) { if (this.barImgCmbChartSel.EditValue == null) { this.pumpViewChart1.LineVisible = false; return; } var hz = Convert.ToDouble(this.barImgCmbChartSel.EditValue); _vm_list.ForEach(x => x.IsSelect = false); foreach (var vm in _vm_list) { if (vm.Hz != hz) continue; switch (vm.CurveType) { case Yw.Ahart.eCurveType.QH: { vm.IsSelect = true; } break; case Yw.Ahart.eCurveType.QP: { vm.IsSelect = true; } break; case Yw.Ahart.eCurveType.QE: { vm.IsSelect = true; } break; } } SetBindingData(_vm_list, _coordinate, _split_panel, _eff_visible, _power_visible, _equal_eff_visible); this.pumpViewChart1.SetAxisXValue(); this.pumpViewChart1.LineVisible = true; } private void barCekLineVisible_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { // this.pumpViewChart1.LineVisible=this.barCekLineVisible.Checked; } private void barCekEffVisible_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { _eff_visible = this.barCekEffVisible.Checked; SetBindingData(_vm_list, _coordinate, _split_panel, _eff_visible, _power_visible, _equal_eff_visible); } private void barCekPowerVisible_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { _power_visible = this.barCekPowerVisible.Checked; SetBindingData(_vm_list, _coordinate, _split_panel, _eff_visible, _power_visible, _equal_eff_visible); } private void barCekSplitPanel_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { _split_panel = this.barCekSplitPanel.Checked; SetBindingData(_vm_list, _coordinate, _split_panel, _eff_visible, _power_visible, _equal_eff_visible); } private void barCekEqVisible_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (this.barCekEqVisible.Checked) { SetEquip(); } else { this.pumpViewChart1.SetEquip(null, null); } } private void barCekEqulEffVisible_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { _equal_eff_visible = this.barCekEqulEffVisible.Checked; SetBindingData(_vm_list, _coordinate, _split_panel, _eff_visible, _power_visible, _equal_eff_visible); } private void barBtnEqClear_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { this.barTxtStartHead.EditValue = 0; this.barTxtPipeQ.EditValue = null; this.barTxtPipeHead.EditValue = null; this.pumpViewChart1.SetEquip(null, null); } private void barBtnSetEqPt_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { SetEquip(); } private void barBtnAddVariableSpeedByN_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { AddByN(); } private void barBtnAddVariableSpeedByHz_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { AddByHz(); } private void barBtnAddVariableSpeedByPoint_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { AddByPoint(); } private void barBtnAddEqualEffByEff_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { AddByEff(); } private void barBtnDeleteVariableSpeed_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (IsInvalidData()) { return; } if (!_vm_list.Exists(x => x.Hz != 50)) { TipFormHelper.ShowInfo("无变速线"); return; } var list = _vm_list.Where(x => x.Hz != 50).Select(x => (x.Hz, x.N)).ToList(); var dlg = new DeleteVariableSpeedDlg(); dlg.SetBindingData(list); dlg.ReloadDataEvent += (del_list) => { var del_info_list = _vm_list.Where(x => del_list.Contains(x.Hz)).Select(x => (x.DbId, x.Hz)).ToList(); Delete(del_info_list); return true; }; dlg.ShowDialog(); } private void barBtnDeleteEqualEff_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (IsInvalidData()) { return; } if (!_vm_list.Exists(x => x.CurveType == eCurveType.EqualE)) { TipFormHelper.ShowInfo("无等效线"); return; } var _vm_eff_list = _vm_list.Where(x => x.CurveType == eCurveType.EqualE).ToList(); var list = _vm_eff_list.Select(x => x.Eff).ToList(); var dlg = new DeleteEqualEDlg(); dlg.SetBindingData(list); dlg.ReloadDataEvent += (del_list) => { var del_info_list = _vm_eff_list.Where(x => del_list.Contains(x.Eff)).Select(x => (x.DbId, x.Eff)).ToList(); Delete(del_info_list); return true; }; dlg.ShowDialog(); } private void AddByN() { if (IsInvalidData()) return; var qh50 = _vm_list.Find(x => x.Hz == 50 && x.CurveType == Yw.Ahart.eCurveType.QH); if (qh50 == null) return; var qe50 = _vm_list.Find(x => x.Hz == 50 && x.CurveType == Yw.Ahart.eCurveType.QE); var qp50 = _vm_list.Find(x => x.Hz == 50 && x.CurveType == Yw.Ahart.eCurveType.QP); var dlg = new Yw.WinFrmUI.Phart.SetValueDlg(); dlg.SetBindingData(_nr); dlg.VerifyValueChanged += (speed) => { var hz = Math.Round(speed / _nr * 50, 1); if (hz > 50 || hz < 10) { return false; } if (_vm_list.Exists(x => x.N == speed)) { TipFormHelper.ShowWarn("转速已存在"); return false; } hz = Math.Round(hz, 1); var pt_qh_list = qh50.FitPointList.GetQHPointListByN(50, hz); var pt_qe_list = qe50?.FitPointList?.GetQEPointListByN(50, hz); var pt_qp_list = qp50?.FitPointList?.GetQPPointListByN(50, hz); Insert(hz, speed, pt_qh_list, pt_qe_list, pt_qp_list); return true; }; dlg.ShowDialog(); } private void AddByHz() { if (IsInvalidData()) return; var qh50 = _vm_list.Find(x => x.Hz == 50 && x.CurveType == Yw.Ahart.eCurveType.QH); if (qh50 == null) return; var qe50 = _vm_list.Find(x => x.Hz == 50 && x.CurveType == Yw.Ahart.eCurveType.QE); var qp50 = _vm_list.Find(x => x.Hz == 50 && x.CurveType == Yw.Ahart.eCurveType.QP); var dlg = new Yw.WinFrmUI.Phart.SetValueDlg(); dlg.VerifyValueChanged += (hz) => { if (hz > 50 || hz < 10) { return false; } if (_vm_list.Exists(x => x.Hz == hz)) { TipFormHelper.ShowWarn("频率已存在"); return false; } var speed = Math.Round(hz / 50 * _nr); speed = Math.Round(speed, 1); var pt_qh_list = qh50.FitPointList.GetQHPointListByN(50, hz); var pt_qe_list = qe50?.FitPointList?.GetQEPointListByN(50, hz); var pt_qp_list = qp50?.FitPointList?.GetQPPointListByN(50, hz); Insert(hz, speed, pt_qh_list, pt_qe_list, pt_qp_list); return true; }; dlg.ShowDialog(); } private void AddByPoint() { if (IsInvalidData()) return; var qh50 = _vm_list.Find(x => x.Hz == 50 && x.CurveType == Yw.Ahart.eCurveType.QH); if (qh50 == null) return; var qe50 = _vm_list.Find(x => x.Hz == 50 && x.CurveType == Yw.Ahart.eCurveType.QE); var qp50 = _vm_list.Find(x => x.Hz == 50 && x.CurveType == Yw.Ahart.eCurveType.QP); var dlg = new Yw.WinFrmUI.Phart.SetPointDlg(); dlg.SetBindingData(); dlg.VerifyValueChanged += (x, y) => { var pt = new Yw.Geometry.Point2d(x, y); var curve = new Yw.Pump.CurveQH(qh50.FeatType, qh50.DefPointList); var sect_pt = Yw.Pump.PerformParabolaHelper.GetQHSectPoint(curve, pt); if (sect_pt == null || sect_pt.IsZeroPoint()) return false; var speed = sect_pt.Y.CalculateSimuByH(_nr, pt.Y); var hz = Math.Round(speed / _nr * 50, 1); if (hz > 50 || hz < 20) { return false; } speed = Math.Round(speed, 1); if (_vm_list.Exists(x => x.N == speed)) { TipFormHelper.ShowWarn("转速已存在"); return false; } var pt_qh_list = qh50.FitPointList.GetQHPointListByN(50, hz); var pt_qe_list = qe50?.FitPointList?.GetQEPointListByN(50, hz); var pt_qp_list = qp50?.FitPointList?.GetQPPointListByN(50, hz); Insert(hz, speed, pt_qh_list, pt_qe_list, pt_qp_list); return true; }; dlg.ShowDialog(); } private void AddByEff() { if (IsInvalidData()) return; var qh50 = _vm_list.Find(x => x.Hz == 50 && x.CurveType == Yw.Ahart.eCurveType.QH); if (qh50 == null) return; var qe50 = _vm_list.Find(x => x.Hz == 50 && x.CurveType == Yw.Ahart.eCurveType.QE); if (qe50 == null) return; var dlg = new SetEffDlg(); dlg.SetBindingData(); dlg.VerifyValueChanged += (eff_double_list) => { double max_hz = 50; double min_hz = 30; max_hz = Math.Max(max_hz, _vm_list.Max(x => x.Hz)); min_hz = Math.Min(min_hz, _vm_list.Min(x => x.Hz)); var qh = new Yw.Pump.CurveQH(qh50.FeatType, qh50.DefPointList); var qe = new Yw.Pump.CurveQE(qe50.FeatType, qe50.DefPointList); foreach (var eff in eff_double_list) { if (_vm_list.Exists(x => x.Eff == eff)) { continue; } var eff_list = EqualParaCurveEListHelper.CalcEqualParaCurveE(qh, qe, max_hz, min_hz, eff); if (eff_list != null && eff_list.Any()) { foreach (var item in eff_list) { Insert(item.Eff, item.Tension, item.IsClosed, item.IsUShaped, item.DefinePoints); } } } return true; }; dlg.ShowDialog(); } private async void Insert(double hz, double speed, List pt_qh_list, List pt_qe_list, List pt_qp_list) { var list = new List(); var graph_qh = new Yw.Vmo.PhartGraphVmo() { Name = "扬程线", GraphType = (int)Yw.Ahart.eCurveType.QH, GraphParas = new QHGraphParasViewModel() { Hz = hz, N = speed, }.ToJson(), GeometryParas = new Yw.WinFrmUI.Phart.CurveGeometryParasViewModel { DefinePoints = pt_qh_list }.ToJson(), GeometryStyle = (int)HStation.PhartRelation.eGeometryStyle.FeatCurve, GeometryInfo = pt_qh_list.ToDbString(Yw.Ahart.eCurveType.QH, Yw.Ahart.eFeatType.Cubic), AnnotationParas = new List() { new () { X = pt_qh_list.Last().X, Y = pt_qh_list.Last().Y, Text = $"{speed}rpm({hz}hz)", Aligment = eTextAligment.Right } }.ToJson() }; list.Add(graph_qh); if (pt_qe_list != null && pt_qe_list.Any()) { var graph_qe = new Yw.Vmo.PhartGraphVmo() { Name = "效率线", GraphType = (int)Yw.Ahart.eCurveType.QE, GraphParas = new QEGraphParasViewModel() { Hz = hz, N = speed, }.ToJson(), GeometryParas = new Yw.WinFrmUI.Phart.CurveGeometryParasViewModel { DefinePoints = pt_qe_list }.ToJson(), GeometryStyle = (int)HStation.PhartRelation.eGeometryStyle.FeatCurve, GeometryInfo = pt_qe_list.ToDbString(Yw.Ahart.eCurveType.QE, Yw.Ahart.eFeatType.Cubic), AnnotationParas = new List() { new () { X = pt_qe_list.Last().X, Y = pt_qe_list.Last().Y, Text = $"{speed}rpm({hz}hz)", Aligment = eTextAligment.Right } }.ToJson() }; list.Add(graph_qe); } if (pt_qp_list != null && pt_qp_list.Any()) { var graph_qp = new Yw.Vmo.PhartGraphVmo() { Name = "功率线", GraphType = (int)Yw.Ahart.eCurveType.QP, GraphParas = new QPGraphParasViewModel() { Hz = hz, N = speed, }.ToJson(), GeometryParas = new Yw.WinFrmUI.Phart.CurveGeometryParasViewModel { DefinePoints = pt_qp_list }.ToJson(), GeometryStyle = (int)HStation.PhartRelation.eGeometryStyle.FeatCurve, GeometryInfo = pt_qp_list.ToDbString(Yw.Ahart.eCurveType.QP, Yw.Ahart.eFeatType.Cubic), AnnotationParas = new List() { new () { X = pt_qp_list.Last().X, Y = pt_qp_list.Last().Y, Text = $"{speed}rpm({hz}hz)", Aligment = eTextAligment.Right } }.ToJson() }; list.Add(graph_qp); } list.ForEach(x => x.DiagramID = _vmo.ID); var bol = await new Yw.BLL.PhartGraph().Inserts(list); if (!bol) { TipFormHelper.ShowWarn("添加失败!"); return; } var newVmo = await new Yw.BLL.PhartDiagramExtensions().GetByID(_vmo.ID); if (newVmo == null) { TipFormHelper.ShowWarn("获取失败!"); return; } SetBindingData(newVmo, _nr); SetEquip(); } private async void Insert(double eff, double tension, bool is_closed, bool is_u, List pt_equal_e_list) { if (tension <= 0) { tension = 0.5; } var list = new List(); var graph_equal_e = new Yw.Vmo.PhartGraphVmo() { Name = "扬程线", GraphType = (int)Yw.Ahart.eCurveType.EqualE, GraphParas = new EqualEGraphParasViewModel() { Eff = eff, Tension = tension, IsClosed = is_closed, }.ToJson(), GeometryParas = new Yw.WinFrmUI.Phart.CurveGeometryParasViewModel { DefinePoints = pt_equal_e_list }.ToJson(), GeometryStyle = (int)HStation.PhartRelation.eGeometryStyle.FeatCurve, GeometryInfo = pt_equal_e_list.ToDbString(Yw.Ahart.eCurveType.EqualE, Yw.Ahart.eFeatType.Cubic), }; var annotation_list = new List(); annotation_list.Add(new() { X = pt_equal_e_list.Last().X, Y = pt_equal_e_list.Last().Y, Text = $"{eff}%", Aligment = eTextAligment.Right }); if (is_u) { var first = pt_equal_e_list.First(); annotation_list.Add(new() { X = first.X, Y = first.Y, Text = $"{eff}%", Aligment = eTextAligment.Right }); } graph_equal_e.AnnotationParas = annotation_list.ToJson(); list.Add(graph_equal_e); list.ForEach(x => x.DiagramID = _vmo.ID); var bol = await new Yw.BLL.PhartGraph().Inserts(list); if (!bol) { TipFormHelper.ShowWarn("添加失败!"); return; } var newVmo = await new Yw.BLL.PhartDiagramExtensions().GetByID(_vmo.ID); if (newVmo == null) { TipFormHelper.ShowWarn("获取失败!"); return; } SetBindingData(newVmo, _nr); SetEquip(); } private async void Update((long DbId, string Tag, double X, double Y) info) { var bll = new Yw.BLL.PhartGraph(); var vm = _vm_list.Find(x => x.DbId == info.DbId); if (vm == null) return; var annotation = vm.AnnotationList.Find(x => x.Tag == info.Tag); if (annotation == null) return; annotation.X = info.X; annotation.Y = info.Y; var paras = vm.AnnotationList.ToJson(); var bol = await bll.UpdateAnnotationParas(info.DbId, paras); if (!bol) { TipFormHelper.ShowError($"{annotation.Text}更新失败!"); return; } //var newVmo = await new Yw.BLL.PhartDiagramExtensions().GetByID(_vmo.ID); //if (newVmo == null) //{ // TipFormHelper.ShowWarn("获取失败!"); // return; //} //SetBindingData(newVmo, _nr); //SetEquip(); } private async void Delete(List<(long Id, double Basis)> graph_ids) { if (graph_ids == null || !graph_ids.Any()) { return; } var bll = new Yw.BLL.PhartGraph(); var err_hz_list = new List(); foreach (var graph_info in graph_ids) { var bol = await bll.DeleteByID(graph_info.Id); if (!bol) { err_hz_list.Add(graph_info.Basis); continue; } } if (err_hz_list != null && err_hz_list.Any()) { var info = Yw.Untity.DoubleListHelper.ToString(err_hz_list); TipFormHelper.ShowError($"{info}删除失败!"); } var newVmo = await new Yw.BLL.PhartDiagramExtensions().GetByID(_vmo.ID); if (newVmo == null) { TipFormHelper.ShowWarn("获取失败!"); return; } SetBindingData(newVmo, _nr); SetEquip(); } /// /// 获取 /// public Yw.Vmo.PhartDiagramExGraphListVmo Get() { return new Yw.Vmo.PhartDiagramExGraphListVmo(); } } }