From 982cde7e9372dc218f23b204265d8e54f7e9ce4f Mon Sep 17 00:00:00 2001 From: ningshuxia <ningshuxia0927@outlook.com> Date: 星期四, 13 三月 2025 10:34:21 +0800 Subject: [PATCH] boxModel --- WinFrmUI/HStation.WinFrmUI.Assets.Core/20-exchanger/04-curveql/AssetsExchangerCurveQLMgrPage.cs | 200 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 188 insertions(+), 12 deletions(-) diff --git a/WinFrmUI/HStation.WinFrmUI.Assets.Core/20-exchanger/04-curveql/AssetsExchangerCurveQLMgrPage.cs b/WinFrmUI/HStation.WinFrmUI.Assets.Core/20-exchanger/04-curveql/AssetsExchangerCurveQLMgrPage.cs index 5ee305d..9fa8500 100644 --- a/WinFrmUI/HStation.WinFrmUI.Assets.Core/20-exchanger/04-curveql/AssetsExchangerCurveQLMgrPage.cs +++ b/WinFrmUI/HStation.WinFrmUI.Assets.Core/20-exchanger/04-curveql/AssetsExchangerCurveQLMgrPage.cs @@ -1,14 +1,6 @@ 锘縰sing DevExpress.XtraEditors; using HStation.Vmo; -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; namespace HStation.WinFrmUI { @@ -20,14 +12,17 @@ this.PageTitle.Caption = "姘村ご鎹熷け鏇茬嚎"; this.PageTitle.HeaderSvgImage = AssetsMainSvgImageHelper.Curve; this.PageTitle.SvgImageSize = new Size(24, 24); + this.phartDiagramRelationListCtrl1.SelectedChangedEvent += PhartDiagramRelationListCtrl1_SelectedChangedEvent; } private AssetsExchangerMainVmo _vmo = null; + private List<PhartDiagramRelationVmo> _allBindingList = null; + private PhartDiagramRelationVmo _relation = null; /// <summary> - /// + /// /// </summary> - public void SetBindingData(AssetsExchangerMainVmo vmo) + public async void SetBindingData(AssetsExchangerMainVmo vmo) { if (vmo == null) { @@ -35,9 +30,190 @@ } _vmo = vmo; this.PageTitle.Caption = $"{vmo.Name}\r\n姘村ご鎹熷け鏇茬嚎"; + _allBindingList = new List<PhartDiagramRelationVmo>(); + var allList = await BLLFactory<HStation.BLL.PhartDiagramRelation>.Instance + .GetByObjectTypeAndObjectID(HStation.Assets.DataType.ExchangerMain, vmo.ID); + allList?.ForEach(x => _allBindingList.Add(x)); + this.phartDiagramRelationListCtrl1.SetBindingData(_allBindingList); } + //excel + private void Excel() + { + if (_vmo == null) + { + return; + } + var dlg = new ImportAssetsExchangerCurveQLByExcelDlg(); + dlg.ReloadDataEvent += (rhs) => + { + _allBindingList.Add(rhs); + this.phartDiagramRelationListCtrl1.SetBindingData(_allBindingList); + }; + dlg.SetBindingData(_vmo); + dlg.ShowDialog(); + } + //鍥剧墖 + private void Picture() + { + if (_vmo == null) + { + return; + } + var vm = GetCurrentViewModel(); + if (vm == null) + { + return; + } + var dlg = new ImportAssetsExchangerCurveQLByPictureDlg(); + dlg.ReloadDataEvent += (rhs) => + { + _allBindingList.Add(rhs); + this.phartDiagramRelationListCtrl1.SetBindingData(_allBindingList); + }; + dlg.SetBindingData(_vmo); + dlg.ShowDialog(); + } + //鍩烘湰淇℃伅 + private void Info() + { + var vm = GetCurrentViewModel(); + if (vm == null) + { + return; + } + var dlg = new EditPhartDiagramRelationDlg(); + dlg.ReloadDataEvent += (rhs) => + { + var item = _allBindingList?.Find(x => x.ID == rhs.ID); + if (item == null) + { + return; + } + item.Reset(rhs); + this.phartDiagramRelationListCtrl1.SetBindingData(_allBindingList); + }; + dlg.SetBindingData(vm); + dlg.ShowDialog(); + } + + //鏇茬嚎 + private async void Curve() + { + var vm = GetCurrentViewModel(); + if (vm == null) + { + return; + } + var vmo = await BLLFactory<Yw.BLL.PhartDiagramExtensions>.Instance.GetByID(vm.DiagramID); + var dlg = new EditAssetsExchangerCurveQLDlg(); + dlg.ReloadDataEvent += (rhs) => + { + this.universalChartViewCtrl1.SetBindingData(rhs); + }; + dlg.SetBindingData(vmo); + dlg.ShowDialog(); + } + + //鍒犻櫎 + private async void Delete() + { + var vm = GetCurrentViewModel(); + if (vm == null) + { + return; + } + var result = XtraMessageBox.Show("璇烽棶纭鍒犻櫎褰撳墠鏁版嵁鍚楋紵", "璇㈤棶", MessageBoxButtons.YesNo) == DialogResult.Yes; + if (!result) + { + return; + } + var bol = await BLLFactory<HStation.BLL.PhartDiagramRelation>.Instance.DeleteByID(vm.ID); + if (!bol) + { + TipFormHelper.ShowError("鍒犻櫎澶辫触锛�"); + return; + } + _allBindingList.Remove(vm); + this.universalChartViewCtrl1.ClearBindingData(); + this.phartDiagramRelationListCtrl1.SetBindingData(_allBindingList); + TipFormHelper.ShowSucceed("鍒犻櫎鎴愬姛锛�"); + } + + #region 褰撳墠 + + //鑾峰彇褰撳墠 + private PhartDiagramRelationVmo GetCurrentViewModel() + { + if (_allBindingList == null) + { + TipFormHelper.ShowError("鏁版嵁鍒濆鍖栭敊璇紒"); + return null; + } + if (_allBindingList.Count < 1) + { + TipFormHelper.ShowInfo("鏃犳暟鎹紒"); + return null; + } + if (_relation == null) + { + TipFormHelper.ShowWarn("璇烽�夋嫨鏁版嵁琛岋紒"); + return null; + } + return _relation; + } + + #endregion 褰撳墠 + + //Excel瀵煎叆 + private void barBtnImportByExcel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + Excel(); + } + + //鍥剧墖瀵煎叆 + private void barBtnImportByPicture_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + Picture(); + } + + //鍩烘湰淇℃伅 + private void barBtnInfo_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + Info(); + } + + //鏇茬嚎 + private void barBtnCurve_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + Curve(); + } + + //鍒犻櫎 + private void barBtnDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + Delete(); + } + + //閫夋嫨鏀瑰彉 + private void PhartDiagramRelationListCtrl1_SelectedChangedEvent(PhartDiagramRelationVmo obj) + { + _relation = obj; + LoadPhart(_relation); + } + + //鍔犺浇鍥捐〃 + private async void LoadPhart(PhartDiagramRelationVmo relation) + { + if (relation == null) + { + this.universalChartViewCtrl1.SetBindingData(null); + return; + } + var vmo = await BLLFactory<Yw.BLL.PhartDiagramExtensions>.Instance.GetByID(relation.DiagramID); + this.universalChartViewCtrl1.SetBindingData(vmo); + } } -} +} \ No newline at end of file -- Gitblit v1.9.3