| | |
| | | using DevExpress.XtraEditors; |
| | | |
| | | namespace HStation.WinFrmUI.PhartRelation |
| | | namespace HStation.WinFrmUI.PhartRelation |
| | | { |
| | | public partial class XhsPumpMainPhartPanel : DocumentPage |
| | | { |
| | |
| | | { |
| | | InitializeComponent(); |
| | | this.PageTitle.Caption = "泵型号曲线"; |
| | | |
| | | this.xhsPumpMainPhartListCtrl1.FocusedChangedEvent += XhsPumpMainPhartListCtrl1_FocusedChangedEvent; |
| | | } |
| | | |
| | | |
| | | private long _pump_main_id; |
| | | private Vmo.XhsPumpMainPhartMappingExtensionsStd _xhs_phart_diagram_ex_dto = null; |
| | | private BLL.XhsPumpMainPhartMappingExtensions _bll_ex = new(); |
| | | private BLL.XhsPumpMainPhartMappingExtensionsStd _bll_ex_std = new(); |
| | | private Vmo.XhsPumpMainPhartMappingExtensions _xhs_phart_diagram_ex_std_dto = null; |
| | | private readonly BLL.XhsPumpMainPhartMappingExtensions _bll_ex = new(); |
| | | |
| | | |
| | | public async void InitialDataSource(long pump_main_id) |
| | | /// <summary> |
| | | /// 初始化数据 |
| | | /// </summary> |
| | | public void InitialDataSource(long pump_main_id) |
| | | { |
| | | _pump_main_id = pump_main_id; |
| | | if (_pump_main_id < 1) |
| | | { |
| | | this.xhsPumpMainPhartListCtrl1.Clear(); |
| | | return; |
| | | } |
| | | _xhs_phart_diagram_ex_dto = await _bll_ex_std.GetDefaultByPumpMainID(_pump_main_id); |
| | | if (_xhs_phart_diagram_ex_dto == null) |
| | | { |
| | | return; |
| | | } |
| | | InitChart(_xhs_phart_diagram_ex_dto); |
| | | this.xhsPumpMainPhartListCtrl1.SetBindingData(pump_main_id); |
| | | } |
| | | |
| | | //选择曲线变换事件 |
| | | private void XhsPumpMainPhartListCtrl1_FocusedChangedEvent(Vmo.XhsPumpMainPhartMappingExtensions obj) |
| | | { |
| | | _xhs_phart_diagram_ex_std_dto = obj; |
| | | InitChart(_xhs_phart_diagram_ex_std_dto); |
| | | } |
| | | |
| | | #region 图表 |
| | | |
| | | //初始化图表数据 |
| | | private void InitChart(Vmo.XhsPumpMainPhartMappingExtensionsStd dto) |
| | | private void InitChart(Vmo.XhsPumpMainPhartMappingExtensions dto) |
| | | { |
| | | if (dto == null) |
| | | { |
| | |
| | | { |
| | | return; |
| | | } |
| | | |
| | | var graph_qh = graph_list.Find(x => x.GraphType ==HStation.PhartRelation. eGraphType.QH); |
| | | var graph_qe = graph_list.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.QH); |
| | | var graph_qp = graph_list.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.QH); |
| | | |
| | | 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.PumpQH); |
| | | var graph_qp = graph_list.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.PumpQH); |
| | | |
| | | if (graph_qp == null) |
| | | { |
| | |
| | | this.xtrPerform2dChart1.InitialChartData(); |
| | | } |
| | | |
| | | #endregion 图表 |
| | | |
| | | #region 导入 |
| | | |
| | | //Excel 导入 |
| | | private void barBtnImportByExcel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //Image 导入 |
| | | private void barBtnImportByImage_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | //图片 导入 |
| | | private void barBtnImportByPicture_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | |
| | | XtraMessageBox.Show("待补充!"); |
| | | } |
| | | |
| | | // 导入 |
| | | private async Task<bool> Import(string other_name, Yw.Pump.CurveQH qh, Yw.Pump.CurveQE qe, Yw.Pump.CurveQP qp) |
| | | { |
| | | if (_pump_main_id < 1) |
| | | { |
| | | XtraMessageBox.Show("PumpMain is null!"); |
| | | return false; |
| | | } |
| | | if (_xhs_phart_diagram_ex_dto != null) |
| | | { |
| | | var bol = await Delete(); |
| | | if (!bol) |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | var input = new Vmo.XhsPumpMainPhartMappingExtensions(); |
| | |
| | | { |
| | | Name = other_name+"-QH", |
| | | GeometryStyle= HStation.PhartRelation.eGeometryStyle.FeatCurve, |
| | | GraphType= HStation.PhartRelation.eGraphType.QH, |
| | | GraphType= HStation.PhartRelation.eGraphType.PumpQH, |
| | | GeometryInfo=qh.ToDbString() |
| | | }, |
| | | new () |
| | | { |
| | | Name = other_name+"-QE", |
| | | GeometryStyle= HStation.PhartRelation.eGeometryStyle.FeatCurve, |
| | | GraphType= HStation.PhartRelation.eGraphType.QE, |
| | | GraphType= HStation.PhartRelation.eGraphType.PumpQE, |
| | | GeometryInfo=qe.ToDbString() |
| | | }, |
| | | new () |
| | | { |
| | | Name = other_name+"-QP", |
| | | GeometryStyle= HStation.PhartRelation.eGeometryStyle.FeatCurve, |
| | | GraphType= HStation.PhartRelation.eGraphType.QP, |
| | | GraphType= HStation.PhartRelation.eGraphType.PumpQP, |
| | | GeometryInfo=qp.ToDbString() |
| | | }, |
| | | } |
| | | }; |
| | | |
| | | |
| | | var mapping_id = await _bll_ex.Insert(input); |
| | | if (mapping_id < 1) |
| | | { |
| | | return false; |
| | | } |
| | | _xhs_phart_diagram_ex_dto = await _bll_ex_std.GetDefaultByPumpMainID(_pump_main_id); |
| | | InitChart(_xhs_phart_diagram_ex_dto); |
| | | |
| | | var xhs_phart_diagram_ex_std_dto = await _bll_ex.GetByID(mapping_id); |
| | | this.xhsPumpMainPhartListCtrl1.Add(xhs_phart_diagram_ex_std_dto); |
| | | return true; |
| | | } |
| | | |
| | | #endregion 导入 |
| | | |
| | | #region 操作 |
| | | |
| | | //别名 |
| | | private void barBtnOtherName_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_xhs_phart_diagram_ex_std_dto == null) |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new SetOtherNameDlg(); |
| | | dlg.SetBindingData(_xhs_phart_diagram_ex_std_dto.OtherName); |
| | | dlg.VerifyValueChanged += async (value) => |
| | | { |
| | | _xhs_phart_diagram_ex_std_dto.OtherName = value; |
| | | var bol = await _bll_ex.Update(_xhs_phart_diagram_ex_std_dto); |
| | | if (!bol) |
| | | { |
| | | XtraMessageBox.Show("更新失败!"); |
| | | return false; |
| | | } |
| | | this.xhsPumpMainPhartListCtrl1.UpdateOtherName(_xhs_phart_diagram_ex_std_dto.ID, value); |
| | | XtraMessageBox.Show("更新成功!"); |
| | | return true; |
| | | }; |
| | | |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //重要度 |
| | | private void barBtnUpdateimportance_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_xhs_phart_diagram_ex_std_dto == null) |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new SetImportanceDlg(); |
| | | dlg.SetBindingData(_xhs_phart_diagram_ex_std_dto.Importance); |
| | | dlg.VerifyValueChanged += async (value) => |
| | | { |
| | | _xhs_phart_diagram_ex_std_dto.Importance = value; |
| | | var bol = await _bll_ex.Update(_xhs_phart_diagram_ex_std_dto); |
| | | if (!bol) |
| | | { |
| | | XtraMessageBox.Show("更新失败!"); |
| | | return false; |
| | | } |
| | | this.xhsPumpMainPhartListCtrl1.UpdateImportance(_xhs_phart_diagram_ex_std_dto.ID, value); |
| | | XtraMessageBox.Show("更新成功!"); |
| | | return true; |
| | | }; |
| | | |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | #region 删除 |
| | | |
| | | //删除 |
| | | private async void barBtnDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | |
| | | await Delete(); |
| | | } |
| | | |
| | | |
| | | //删除 |
| | | private async Task<bool> Delete() |
| | | { |
| | | if (_xhs_phart_diagram_ex_dto == null) |
| | | if (_xhs_phart_diagram_ex_std_dto == null) |
| | | { |
| | | return false; |
| | | } |
| | | var diagramId = _xhs_phart_diagram_ex_dto.Diagram.ID; |
| | | var diagramId = _xhs_phart_diagram_ex_std_dto.Diagram.ID; |
| | | var bol = await _bll_ex.DeleteByDiagramID(diagramId); |
| | | if (!bol) |
| | | { |
| | |
| | | return false; |
| | | } |
| | | XtraMessageBox.Show("删除成功!"); |
| | | _xhs_phart_diagram_ex_dto = null; |
| | | ClearChart(); |
| | | this.xhsPumpMainPhartListCtrl1.Delete(_xhs_phart_diagram_ex_std_dto.ID); |
| | | |
| | | return true; |
| | | } |
| | | |
| | | private void barBtnAddText_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | XtraMessageBox.Show("待补充!"); |
| | | } |
| | | #endregion 删除 |
| | | |
| | | #endregion 操作 |
| | | } |
| | | } |