| | |
| | | using DevExpress.XtraEditors.Controls; |
| | | using HStation.WinFrmUI.PhartRelation; |
| | | |
| | | namespace HStation.WinFrmUI.Xhs |
| | | namespace HStation.WinFrmUI.Xhs.Core |
| | | { |
| | | public partial class PumpMainCurveForm : DevExpress.XtraEditors.XtraUserControl |
| | | public partial class PumpMainForm : DevExpress.XtraEditors.XtraUserControl |
| | | { |
| | | public PumpMainCurveForm() |
| | | public PumpMainForm() |
| | | { |
| | | InitializeComponent(); |
| | | this.gridView1.SetNormalView(); |
| | | this.gridView2.SetNormalView(); |
| | | } |
| | | |
| | | public event Action<long> SelectEventReload = null; |
| | | public class PhartViewModel |
| | | { |
| | | public long ID { get; set; } |
| | | public string OtherName { get; set; } |
| | | } |
| | | |
| | | public class CurvieInfo |
| | | { |
| | | public long Dbid { get; set; } |
| | | public long Curveid { get; set; } |
| | | public Vmo.XhsPumpMainPhartMappingExtensions Curveinfo { get; set; } |
| | | } |
| | | |
| | | private List<PumpMainChoieViewModel> _allBindingList = null; |
| | | |
| | | private BLL.PumpMain _pumpBll = null; |
| | | |
| | | private List<PhartViewModel> _allPhartList = null; |
| | | private readonly Lazy<BLL.XhsPumpMainPhartMappingExtensions> _bll_ex = new(); |
| | | |
| | | public void SetBindingData(Vmo.PumpMain pumpMain) |
| | | private long _DbID; //泵型号ID |
| | | private long _Curveid;//曲线ID |
| | | private Vmo.XhsPumpMainPhartMappingExtensions _Curveinfo; //曲线详细信息 |
| | | |
| | | public async void SetBindingData(string Dbid, string ModelType) |
| | | { |
| | | this.TextEditErosion.Text = pumpMain.Erosion.ToString(); |
| | | this.TextEditName.Text = pumpMain.Name; |
| | | this.TextEditRatedFlow.Text = pumpMain.RatedFlow.ToString(); |
| | | this.TextEditD2.Text = pumpMain.D2.ToString(); |
| | | this.TextEditDescription.Text = pumpMain.Description; |
| | | this.TextEditRatedSpeed.Text = pumpMain.RatedSpeed.ToString(); |
| | | this.TextEditRatedPower.Text = pumpMain.RatedPower.ToString(); |
| | | CurveComoboxSetBindingData(pumpMain.ID); |
| | | _allBindingList = new List<PumpMainChoieViewModel>(); |
| | | _pumpBll = new BLL.PumpMain(); |
| | | var allPumpMain = await _pumpBll.GetAll(); |
| | | foreach (var Main in allPumpMain) |
| | | { |
| | | _allBindingList.Add(new PumpMainChoieViewModel(Main)); |
| | | } |
| | | this.gridControl2.DataSource = _allBindingList; |
| | | this.searchControl1.Text = ModelType; |
| | | } |
| | | |
| | | private async void CurveComoboxSetBindingData(long pump_main_id) |
| | | //初始化图表数据 |
| | | private void InitChart(Vmo.XhsPumpMainPhartMappingExtensions dto) |
| | | { |
| | | comboBoxPumpCurve.Properties.Items.Clear(); |
| | | var list = await _bll_ex.Value.GetByPumpMainID(pump_main_id); |
| | | if (list != null && list.Any()) |
| | | if (dto == null) |
| | | { |
| | | foreach (var item in list) |
| | | return; |
| | | } |
| | | var diagram = 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.PumpQH); |
| | | var graph_qp = graph_list.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.PumpQH); |
| | | |
| | | if (graph_qp == null) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | 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); |
| | | if (graph_qe != null) |
| | | points_qe = PhartPerformCurveHelper.GetFeatPointList(graph_qe.GraphType, graph_qe.GeometryInfo, 12, null); |
| | | if (graph_qp != null) |
| | | points_qp = PhartPerformCurveHelper.GetFeatPointList(graph_qp.GraphType, graph_qp.GeometryInfo, 12, null); |
| | | |
| | | var cubic_spline_qh = new Yw.Geometry.CubicSpline2d(points_qh); |
| | | var cubic_spline_qe = new Yw.Geometry.CubicSpline2d(points_qe); |
| | | var cubic_spline_qp = new Yw.Geometry.CubicSpline2d(points_qp); |
| | | |
| | | var disp_paras = diagram.DispParas; |
| | | var is_calc_disp_paras = string.IsNullOrWhiteSpace(disp_paras); |
| | | this.xtrPerform2dChart1.SetBindingData(cubic_spline_qh, cubic_spline_qe, cubic_spline_qp, disp_paras, is_calc_disp_paras); |
| | | } |
| | | |
| | | public CurvieInfo GetCurrentCurveinfo() |
| | | { |
| | | var info = new CurvieInfo |
| | | { |
| | | Dbid = _DbID, |
| | | Curveid = _Curveid, |
| | | Curveinfo = _Curveinfo |
| | | }; |
| | | return info; |
| | | } |
| | | |
| | | //泵型号列表选择项切换事件 |
| | | private async void gridView2_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) |
| | | { |
| | | _allPhartList = new List<PhartViewModel>(); |
| | | var vm = this.gridView2.GetCurrentViewModel(_allBindingList); |
| | | if (vm != null) |
| | | { |
| | | _DbID = vm.ID; |
| | | var list = await _bll_ex.Value.GetByPumpMainID(vm.ID); |
| | | if (list != null && list.Any()) |
| | | { |
| | | var image = new ImageComboBoxItem(); |
| | | image.Value = item.ID; |
| | | image.Description = item.OtherName; |
| | | comboBoxPumpCurve.Properties.Items.Add(image); |
| | | foreach (var item in list) |
| | | { |
| | | _allPhartList.Add(new PhartViewModel { ID = item.ID, OtherName = item.OtherName }); |
| | | } |
| | | } |
| | | } |
| | | this.gridControl1.DataSource = _allPhartList; |
| | | } |
| | | |
| | | //曲线选择变化 |
| | | private void comboBoxPumpCurve_SelectedIndexChanged(object sender, EventArgs e) |
| | | //曲线列表选择项切换事件 |
| | | private async void gridView1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) |
| | | { |
| | | SelectEventReload.Invoke(Convert.ToInt64(comboBoxPumpCurve.EditValue)); |
| | | var vm = this.gridView1.GetCurrentViewModel(_allPhartList); |
| | | if (vm != null) |
| | | { |
| | | _Curveid = vm.ID; |
| | | var vmo = await _bll_ex.Value.GetByID(vm.ID); |
| | | _Curveinfo = vmo; |
| | | InitChart(vmo); |
| | | } |
| | | } |
| | | } |
| | | } |