From a27817f01817b22fff839a2d0b98cbb6e45a22f7 Mon Sep 17 00:00:00 2001 From: lixiaojun <1287241240@qq.com> Date: 星期五, 25 十月 2024 14:18:19 +0800 Subject: [PATCH] 增加云文件选择功能 --- WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-pump/PumpFullInfoViewDlg.cs | 245 ++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 212 insertions(+), 33 deletions(-) diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-pump/PumpFullInfoViewDlg.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-pump/PumpFullInfoViewDlg.cs index f85637e..7ccf441 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-pump/PumpFullInfoViewDlg.cs +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-pump/PumpFullInfoViewDlg.cs @@ -1,12 +1,11 @@ 锘縰sing DevExpress.XtraBars; +using HStation.WinFrmUI.PhartRelation; +using Yw.WinFrmUI.Phart; namespace HStation.WinFrmUI { public partial class PumpFullInfoViewDlg : XtraForm { - private bool _isMaxWindowStatus = true;//鏈�澶у寲绐椾綋瑕嗙洊浠诲姟鏍� - private PumpFullInfoCtrl thePumpCtrl = null; - #region 鏋勯�� public PumpFullInfoViewDlg() @@ -21,19 +20,47 @@ this.bsiPromptInfo.Caption = ""; } + private Vmo.XhsPumpMainPhartMappingExtensions _xhs_phart_diagram_ex_std_dto = null; + private readonly BLL.XhsPumpMainPhartMappingExtensions _bll_ex = new(); + + private bool _isMaxWindowStatus = true;//鏈�澶у寲绐椾綋瑕嗙洊浠诲姟鏍� + private PumpFullInfoCtrl thePumpCtrl = null; + private void OnFrmLoad(object sender, EventArgs e) { //鎵嬫満椤甸潰 navBtn鎵嬫満椤甸潰.Visible = false; - //bbi娣诲姞涓插苟鑱�.Visibility = BarItemVisibility.Never;//鍔熻兘娌℃湁瀹屾垚 LocationDialog(); SetNavTileControlMoveAble(); this.SetMaxWindowStatus(); } - public void SetBindindData(PumpMatchingViewModel pumpMatchingViewModel) + private PumpMatchingViewModel _pumpMatchingView; + + public event Action<PumpMatchingViewModel> ReloadDataEvent; + + private long _PumpId; + + public async void SetBindindData(PumpMatchingViewModel pumpMatchingViewModel) { + _pumpMatchingView = pumpMatchingViewModel; + this.navBtnTitle.Caption = $"娉靛瀷鍙�:{pumpMatchingViewModel.ModelType}"; pumpFullInfoCtrl1.SetBindingData(pumpMatchingViewModel); + if (long.TryParse(pumpMatchingViewModel.DbId, out long pumpId)) + { + _PumpId = pumpId; + } + var list = await _bll_ex.GetByPumpMainID(_PumpId); + if (list != null && list.Any()) + { + //list= list.OrderBy(x => x.Importance).ToList(); + /* foreach (var item in list) + { + var vm = new CurrentViewModel(item); + _allBindingList.Add(vm); + }*/ + _xhs_phart_diagram_ex_std_dto = list.First(); + } } private void OnFrmShown(object sender, EventArgs e) @@ -76,34 +103,6 @@ private void navBtn瀵煎嚭_ElementClick(object sender, DevExpress.XtraBars.Navigation.NavElementEventArgs e) { this.popupMenu1.ShowPopup(MousePosition); - } - - private void bbi瀵煎嚭瀹夎鍥綺ItemClick(object sender, ItemClickEventArgs e) - { - } - - private void bbi瀵煎嚭鎬ц兘鏇茬嚎_ItemClick(object sender, ItemClickEventArgs e) - { - } - - private void bbi涓嬭浇BIM鏂囦欢_ItemClick(object sender, ItemClickEventArgs e) - { - } - - private void bbi瀵煎嚭灞炴�ц〃_ItemClick(object sender, ItemClickEventArgs e) - { - } - - private void navBtn閫夊瀷鎶ュ憡_ElementClick(object sender, DevExpress.XtraBars.Navigation.NavElementEventArgs e) - { - } - - private void navBtn鎵嬫満椤甸潰_ElementClick(object sender, DevExpress.XtraBars.Navigation.NavElementEventArgs e) - { - } - - private void navBtn瀵垮懡鎴愭湰璁$畻_ElementClick(object sender, DevExpress.XtraBars.Navigation.NavElementEventArgs e) - { } #region 鏈�澶ф渶灏忔寜閽搷浣� @@ -322,5 +321,185 @@ this.Close(); JumpPumpFullInfoCtrl.Invoke(this.pumpFullInfoCtrl1); } + + private void navBtnEdit_ElementClick(object sender, DevExpress.XtraBars.Navigation.NavElementEventArgs e) + { + this.popupMenuEdit.ShowPopup(MousePosition); + } + + //琛ㄦ牸缂栬緫 + private void BarButtonItem1_ItemClick(object sender, ItemClickEventArgs e) + { + var dlg = new Yw.WinFrmUI.Phart.ImportPumpPerform2dByExcelDlg(); + dlg.ReloadDataEvent += async (other_name, qh, qe, qp) => + { + var bol = await Import(other_name, qh, qe, qp); + return bol; + }; + dlg.ShowDialog(); + } + + //娉靛瀷鍙峰睘鎬х紪杈� + private void BarBtnEditProp_ItemClick(object sender, ItemClickEventArgs e) + { + var dlg = new EditPumpPartPropDlg(); + dlg.SetBindingData(PumpPropViewCtrl.GetPumpMainVmo()); + dlg.ShowDialog(); + this.pumpFullInfoCtrl1.RefreshPropData(); + } + + //娉靛瀷鍙烽噸鏂板尮閰� + private void BarBtnRefreshMatching_ItemClick(object sender, ItemClickEventArgs e) + { + var dlg = new PumpSingleMatchingDlg(); + dlg.SetBindingData(_pumpMatchingView); + dlg.ReloadDataEvent += (matching) => + { + _pumpMatchingView = matching; + ReloadDataEvent.Invoke(_pumpMatchingView); + this.SetBindindData(_pumpMatchingView); + }; + dlg.ShowDialog(); + } + + //鍗曠偣缂栬緫 + private void BarButtonItemOnePoint_ItemClick(object sender, ItemClickEventArgs e) + { + var dlg = new Yw.WinFrmUI.Phart.ImportPumpPerform2dByOnePointDlg(); + dlg.ReloadDataEvent += async (other_name, qh, qe, qp) => + { + var bol = await Import(other_name, qh, qe, qp); + return bol; + }; + dlg.ShowDialog(); + } + + //鏇茬嚎缂栬緫 + private void BarButtonItemEdit_ItemClick(object sender, ItemClickEventArgs e) + { + if (_xhs_phart_diagram_ex_std_dto == null) + { + return; + } + var diagram = _xhs_phart_diagram_ex_std_dto.Diagram; + if (diagram == null) + { + return; + } + var graph_list = diagram.GraphList; + if (graph_list == null || !graph_list.Any()) + { + return; + } + + var graph_qh = graph_list.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.PumpQH); + var graph_qe = graph_list.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.PumpQE); + var graph_qp = graph_list.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.PumpQP); + + if (graph_qh == null) + { + return; + } + Yw.Pump.CurveQH qh = null; + Yw.Pump.CurveQE qe = null; + Yw.Pump.CurveQP qp = null; + List<Yw.Geometry.Point2d> points_qh = null, points_qe = null, points_qp = null; + points_qh = PhartPerformCurveHelper.GetFeatPointList(graph_qh.GraphType, graph_qh.GeometryInfo, 12, null); + qh = new Yw.Pump.CurveQH(Yw.Pump.eFeatType.Cubic, points_qh); + if (graph_qe != null) + { + points_qe = PhartPerformCurveHelper.GetFeatPointList(graph_qe.GraphType, graph_qe.GeometryInfo, 12, null); + qe = new Yw.Pump.CurveQE(Yw.Pump.eFeatType.Cubic, points_qe); + } + if (graph_qp != null) + { + points_qp = PhartPerformCurveHelper.GetFeatPointList(graph_qp.GraphType, graph_qp.GeometryInfo, 12, null); + qp = new Yw.Pump.CurveQP(Yw.Pump.eFeatType.Cubic, points_qp); + } + + var dlg = new Yw.WinFrmUI.Phart.PumpPerform2dEditDlg(); + dlg.SetBindingData(qh, qe, qp); + dlg.ReloadDataEvent += async (new_qh, new_qe, new_qp) => + { + var new_points_qh = new_qh.GetPointList(); + var new_points_qe = new_qe.GetPointList(); + var new_points_qp = new_qp.GetPointList(); + + graph_qh.GeometryInfo = new Yw.Pump.CurveQH(Yw.Pump.eFeatType.Cubic, new_points_qh).ToDbString(); + graph_qe.GeometryInfo = new Yw.Pump.CurveQE(Yw.Pump.eFeatType.Cubic, new_points_qe).ToDbString(); + graph_qp.GeometryInfo = new Yw.Pump.CurveQP(Yw.Pump.eFeatType.Cubic, new_points_qp).ToDbString(); + + _xhs_phart_diagram_ex_std_dto.Diagram.GraphList = new List<Vmo.PhartGraph>() + { + graph_qh, + graph_qe, + graph_qp, + }; + Yw.Geometry.Point2d point2D = new Yw.Geometry.Point2d(); + var bol = await _bll_ex.Update(_xhs_phart_diagram_ex_std_dto); + if (bol) + { + } + return bol; + }; + dlg.ShowDialog(); + } + + //鍥剧墖缂栬緫 + private void BarButtonItemPicture_ItemClick(object sender, ItemClickEventArgs e) + { + } + + // 瀵煎叆 + private async Task<bool> Import(string other_name, Yw.Pump.CurveQH qh, Yw.Pump.CurveQE qe, Yw.Pump.CurveQP qp) + { + if (_PumpId < 1) + { + XtraMessageBox.Show("PumpMain is null!"); + return false; + } + + var input = new Vmo.XhsPumpMainPhartMappingExtensions(); + input.PumpMainID = _PumpId; + input.Importance = 0; + input.OtherName = other_name; + input.Diagram = new Vmo.PhartDiagramExGraphList() + { + DiagramType = HStation.PhartRelation.eDiagramType.Feat, + Name = other_name, + GraphList = new List<Vmo.PhartGraph>() + { + new () + { + Name = other_name+"-QH", + GeometryStyle= HStation.PhartRelation.eGeometryStyle.FeatCurve, + GraphType= HStation.PhartRelation.eGraphType.PumpQH, + GeometryInfo=qh.ToDbString() + }, + new () + { + Name = other_name+"-QE", + GeometryStyle= HStation.PhartRelation.eGeometryStyle.FeatCurve, + GraphType= HStation.PhartRelation.eGraphType.PumpQE, + GeometryInfo=qe.ToDbString() + }, + new () + { + Name = other_name+"-QP", + GeometryStyle= HStation.PhartRelation.eGeometryStyle.FeatCurve, + GraphType= HStation.PhartRelation.eGraphType.PumpQP, + GeometryInfo=qp.ToDbString() + }, + } + }; + + var mapping_id = await _bll_ex.Insert(input); + if (mapping_id < 1) + { + return false; + } + var xhs_phart_diagram_ex_std_dto = await _bll_ex.GetByID(mapping_id); + return true; + } } } \ No newline at end of file -- Gitblit v1.9.3