| | |
| | | using DevExpress.XtraReports.UI; |
| | | using System; |
| | | using System.Collections; |
| | | using System.ComponentModel; |
| | | using System.Drawing; |
| | | using DevExpress.Charts.Native; |
| | | using DevExpress.Utils; |
| | | using DevExpress.XtraCharts; |
| | | using DevExpress.XtraReports.UI; |
| | | using Furion.DataValidation; |
| | | using Microsoft.CodeAnalysis; |
| | | using Yw.WinFrmUI.Phart; |
| | | |
| | | namespace HStation.WinFrmUI |
| | | { |
| | |
| | | InitializeComponent(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 绑定数据 |
| | | /// </summary> |
| | | public void SetBindingData(SimulationPrintViewModel vm) |
| | | private List<Tuple<XYDiagram, AxisX, AxisY, SecondaryAxisY, SecondaryAxisY, HydroEnergyAnalyPipeItemViewModel>> _pointTuple = new(); |
| | | |
| | | private int _currentChartIndex; // 当前图表索引 |
| | | |
| | | public void SetBingdingData(SimulationPrintViewModel vm) |
| | | { |
| | | //A4设置 827 1169 |
| | | if (vm == null) |
| | | return; |
| | | // A4设置 827 1169 |
| | | this.PaperKind = DevExpress.Drawing.Printing.DXPaperKind.A4; |
| | | this.Margins = new DevExpress.Drawing.DXMargins(50, 50, 50, 50); |
| | | |
| | | //727 1069 |
| | | // 内容宽度 |
| | | float contentWidth = 727F; // 内容宽度 |
| | | float firstCaptionHeight = 30F; // 一级标题高度 |
| | | float pageHeight = 1069F; // 页面可用高度 |
| | | float currentY = 0F; // 当前Y坐标 |
| | | |
| | | #region 页眉 |
| | | |
| | |
| | | labForCorp.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; |
| | | this.TopMargin.Controls.Add(labForCorp); |
| | | |
| | | #endregion |
| | | #endregion 页眉 |
| | | |
| | | #region 页脚 |
| | | |
| | |
| | | pageForCurrentNum.TextFormatString = "第{0}页"; |
| | | this.BottomMargin.Controls.Add(pageForCurrentNum); |
| | | |
| | | #endregion |
| | | #endregion 页脚 |
| | | |
| | | #region 标题 |
| | | |
| | | float locationY = 0F; |
| | | var labForTitle = new XRLabel(); |
| | | labForTitle.AnchorHorizontal = ((DevExpress.XtraReports.UI.HorizontalAnchorStyles)((DevExpress.XtraReports.UI.HorizontalAnchorStyles.Left | DevExpress.XtraReports.UI.HorizontalAnchorStyles.Right))); |
| | | labForTitle.Font = new DevExpress.Drawing.DXFont("Arial", 15F, DevExpress.Drawing.DXFontStyle.Bold); |
| | | labForTitle.LocationFloat = new DevExpress.Utils.PointFloat(0F, 0F); |
| | | labForTitle.LocationFloat = new DevExpress.Utils.PointFloat(0F, currentY); |
| | | labForTitle.Multiline = true; |
| | | labForTitle.Name = "labTitle"; |
| | | labForTitle.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 96F); |
| | |
| | | labForTitle.Text = $"{vm.Project.Name}项目节能报告"; |
| | | labForTitle.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; |
| | | this.Detail.Controls.Add(labForTitle); |
| | | locationY += 50F; |
| | | currentY += 50F; |
| | | |
| | | #endregion |
| | | #endregion 标题 |
| | | |
| | | #region 一、项目概述 |
| | | |
| | | var labForDescription = new XRLabel(); |
| | | labForDescription.AnchorHorizontal = (DevExpress.XtraReports.UI.HorizontalAnchorStyles.Left | DevExpress.XtraReports.UI.HorizontalAnchorStyles.Right); |
| | | labForDescription.Font = new DevExpress.Drawing.DXFont("Arial", 12F, DevExpress.Drawing.DXFontStyle.Bold); |
| | | labForDescription.LocationFloat = new DevExpress.Utils.PointFloat(0F, locationY); |
| | | labForDescription.Multiline = true; |
| | | labForDescription.Name = "labForDescription"; |
| | | labForDescription.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); |
| | | labForDescription.SizeF = new System.Drawing.SizeF(727F, 25F); |
| | | labForDescription.StylePriority.UseFont = false; |
| | | labForDescription.StylePriority.UseTextAlignment = false; |
| | | labForDescription.Text = "一、项目概述"; |
| | | labForDescription.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft; |
| | | var labForDescription = ReportHelper.CreateFirstCaption("一、项目概述", contentWidth, firstCaptionHeight, 0F, currentY); |
| | | this.Detail.Controls.Add(labForDescription); |
| | | locationY += 25F; |
| | | currentY += firstCaptionHeight; |
| | | |
| | | #endregion |
| | | #endregion 一、项目概述 |
| | | |
| | | #region 项目概述内容 |
| | | |
| | | var labForDescriptionContent = new XRLabel(); |
| | | labForDescriptionContent.AnchorHorizontal = (DevExpress.XtraReports.UI.HorizontalAnchorStyles.Left | DevExpress.XtraReports.UI.HorizontalAnchorStyles.Right); |
| | | labForDescriptionContent.Font = new DevExpress.Drawing.DXFont("Arial", 10F); |
| | | labForDescriptionContent.LocationFloat = new DevExpress.Utils.PointFloat(0F, locationY); |
| | | labForDescriptionContent.LocationFloat = new DevExpress.Utils.PointFloat(0F, currentY); |
| | | labForDescriptionContent.Multiline = true; |
| | | labForDescriptionContent.Name = "labForDescriptionContent"; |
| | | labForDescriptionContent.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 96F); |
| | |
| | | labForDescriptionContent.Text = $" {vm.Project.Description}"; |
| | | labForDescriptionContent.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft; |
| | | this.Detail.Controls.Add(labForDescriptionContent); |
| | | locationY += 100F; |
| | | currentY += 100F; |
| | | |
| | | #endregion |
| | | #endregion 项目概述内容 |
| | | |
| | | //二、水泵明细 |
| | | // 二、水泵明细 |
| | | var labForPumpList = new XRLabel(); |
| | | labForPumpList.AnchorHorizontal = (DevExpress.XtraReports.UI.HorizontalAnchorStyles.Left | DevExpress.XtraReports.UI.HorizontalAnchorStyles.Right); |
| | | labForPumpList.Font = new DevExpress.Drawing.DXFont("Arial", 12F, DevExpress.Drawing.DXFontStyle.Bold); |
| | | labForPumpList.LocationFloat = new DevExpress.Utils.PointFloat(0F, locationY); |
| | | labForPumpList.LocationFloat = new DevExpress.Utils.PointFloat(0F, currentY); |
| | | labForPumpList.Multiline = true; |
| | | labForPumpList.Name = "labForPumpList"; |
| | | labForPumpList.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); |
| | |
| | | labForPumpList.Text = "二、水泵明细"; |
| | | labForPumpList.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft; |
| | | this.Detail.Controls.Add(labForPumpList); |
| | | locationY += 25F; |
| | | currentY += 25F; |
| | | |
| | | //水泵明细内容 |
| | | // 水泵明细内容 |
| | | if (vm.PumpList != null && vm.PumpList.Count > 0) |
| | | { |
| | | // 创建 XRTable |
| | | var tableForPumpList = new XRTable(); |
| | | tableForPumpList.LocationF = new DevExpress.Utils.PointFloat(0F, locationY); |
| | | tableForPumpList.SizeF = new SizeF(727F, 30F); // 设置大小 |
| | | tableForPumpList.LocationF = new DevExpress.Utils.PointFloat(0F, currentY); |
| | | tableForPumpList.SizeF = new SizeF(727F, 30F + vm.PumpList.Count * 25F); // 设置大小 |
| | | |
| | | // 创建表头行 |
| | | XRTableRow headerRowPumpList = new XRTableRow(); |
| | | headerRowPumpList.BackColor = Color.LightGray; // 设置背景颜色 |
| | | |
| | | // 添加表头列 |
| | | headerRowPumpList.Cells.Add(CreateTableCell("名称", 100)); |
| | | headerRowPumpList.Cells.Add(CreateTableCell("编码", 100)); |
| | | headerRowPumpList.Cells.Add(CreateTableCell("额定流量", 100)); |
| | | headerRowPumpList.Cells.Add(CreateTableCell("额定扬程", 100)); |
| | | headerRowPumpList.Cells.Add(CreateTableCell("额定功率", 100)); |
| | | headerRowPumpList.Cells.Add(CreateTableCell("额定转速", 100)); |
| | | headerRowPumpList.Cells.Add(ReportHelper.CreateTableCell("分组", 100)); |
| | | headerRowPumpList.Cells.Add(ReportHelper.CreateTableCell("型号", 100)); |
| | | headerRowPumpList.Cells.Add(ReportHelper.CreateTableCell("名称", 100)); |
| | | headerRowPumpList.Cells.Add(ReportHelper.CreateTableCell("编码", 100)); |
| | | headerRowPumpList.Cells.Add(ReportHelper.CreateTableCell("额定流量", 100)); |
| | | headerRowPumpList.Cells.Add(ReportHelper.CreateTableCell("额定扬程", 100)); |
| | | headerRowPumpList.Cells.Add(ReportHelper.CreateTableCell("额定功率(KW)", 100)); |
| | | headerRowPumpList.Cells.Add(ReportHelper.CreateTableCell("额定转速", 100)); |
| | | |
| | | // 将表头行添加到表格 |
| | | tableForPumpList.Rows.Add(headerRowPumpList); |
| | | |
| | | //遍历水泵 |
| | | // 遍历水泵 |
| | | foreach (var pump in vm.PumpList) |
| | | { |
| | | // 创建数据行 |
| | | var dataRow = new XRTableRow(); |
| | | dataRow.Cells.Add(new XRTableCell() |
| | | { |
| | | Text = pump.BeginGroup, |
| | | WidthF = 100F, |
| | | TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter, |
| | | Borders = DevExpress.XtraPrinting.BorderSide.All |
| | | }); |
| | | dataRow.Cells.Add(new XRTableCell() |
| | | { |
| | | Text = pump.ModelType, |
| | | WidthF = 100F, |
| | | TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter, |
| | | Borders = DevExpress.XtraPrinting.BorderSide.All |
| | | }); |
| | | dataRow.Cells.Add(new XRTableCell() |
| | | { |
| | | Text = pump.Name, |
| | |
| | | |
| | | // 将表格添加到Detail |
| | | this.Detail.Controls.Add(tableForPumpList); |
| | | currentY += tableForPumpList.HeightF; |
| | | //currentY += vm.PumpList.Count*10; |
| | | } |
| | | |
| | | var labForWorking = ReportHelper.CreateFirstCaption("三、工况列表", contentWidth, firstCaptionHeight, 0F, currentY); |
| | | this.Detail.Controls.Add(labForWorking); |
| | | currentY += firstCaptionHeight; |
| | | |
| | | if (vm.WorkingList != null && vm.WorkingList.Count > 0) //工况列表开始 |
| | | { |
| | | foreach (var working in vm.WorkingList) |
| | | { |
| | | currentY += 30F; |
| | | var labForWorkingName = ReportHelper.CreateGroupCaption(working.Name, contentWidth - 25F, 15F, 20F, currentY); |
| | | this.Detail.Controls.Add(labForWorkingName); |
| | | currentY += 50F; |
| | | |
| | | var labForAccuracy = ReportHelper.CreateFirstCaption("(1)、精度评估", contentWidth - 25F, 15F, 20F, currentY); |
| | | this.Detail.Controls.Add(labForAccuracy); |
| | | currentY += firstCaptionHeight; |
| | | |
| | | if (working.Accuracy != null) |
| | | { |
| | | XRChart accuracyScaleChart = null; |
| | | if (working.Accuracy.Scale != null) |
| | | { |
| | | accuracyScaleChart = ReportHelper.CreateAccuracyScale(working.Accuracy.Scale, 300F, 230F, currentY); |
| | | Detail.Controls.Add(accuracyScaleChart); |
| | | } |
| | | |
| | | var accuracyFlowChart = ReportHelper.CreateAccuracyItem(working.Accuracy.Flow?.AvgError ?? 0, 213F, 230F, 300F, currentY); |
| | | Detail.Controls.Add(accuracyFlowChart); |
| | | var accuracyPressChart = ReportHelper.CreateAccuracyItem(working.Accuracy.Press?.AvgError ?? 0, 213F, 230F, 513F, currentY); |
| | | Detail.Controls.Add(accuracyPressChart); |
| | | |
| | | currentY += 20F; |
| | | |
| | | var labForAccuracyList = ReportHelper.CreateFirstCaption("(1.1)、评估列表", contentWidth - 25F, 15F, 20F, currentY); |
| | | this.Detail.Controls.Add(labForAccuracyList); |
| | | currentY += firstCaptionHeight; |
| | | if (accuracyScaleChart != null) |
| | | { |
| | | currentY += accuracyScaleChart.HeightF; |
| | | } |
| | | |
| | | #region 评估列表 |
| | | |
| | | if (working.Accuracy.Items != null && working.Accuracy.Items.Count > 0) |
| | | { // 创建 XRTable |
| | | var tableForAccuracyList = new XRTable(); |
| | | tableForAccuracyList.LocationF = new DevExpress.Utils.PointFloat(0F, currentY); |
| | | tableForAccuracyList.SizeF = new SizeF(727F, 30F + working.Accuracy.Items.Count * 25F); // 设置大小 |
| | | |
| | | // 创建表头行 |
| | | XRTableRow headerRowAccuracyList = new XRTableRow(); |
| | | headerRowAccuracyList.BackColor = Color.LightGray; // 设置背景颜色 |
| | | |
| | | // 添加表头列 |
| | | headerRowAccuracyList.Cells.Add(ReportHelper.CreateTableCell("评估构件", 100)); |
| | | headerRowAccuracyList.Cells.Add(ReportHelper.CreateTableCell("评估项", 100)); |
| | | headerRowAccuracyList.Cells.Add(ReportHelper.CreateTableCell("监测值", 100)); |
| | | headerRowAccuracyList.Cells.Add(ReportHelper.CreateTableCell("计算值", 100)); |
| | | headerRowAccuracyList.Cells.Add(ReportHelper.CreateTableCell("评估误差", 100)); |
| | | |
| | | // 将表头行添加到表格 |
| | | tableForAccuracyList.Rows.Add(headerRowAccuracyList); |
| | | |
| | | foreach (var item in working.Accuracy.Items) |
| | | { |
| | | // 创建数据行 |
| | | var dataRow = new XRTableRow(); |
| | | dataRow.Cells.Add(new XRTableCell() |
| | | { |
| | | Text = item.EvaluateName, |
| | | WidthF = 100F, |
| | | TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter, |
| | | Borders = DevExpress.XtraPrinting.BorderSide.All |
| | | }); |
| | | dataRow.Cells.Add(new XRTableCell() |
| | | { |
| | | Text = item.EvaluateItem, |
| | | WidthF = 100F, |
| | | TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter, |
| | | Borders = DevExpress.XtraPrinting.BorderSide.All |
| | | }); |
| | | dataRow.Cells.Add(new XRTableCell() |
| | | { |
| | | Text = item.MonitorValue.ToString(), |
| | | WidthF = 100F, |
| | | TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter, |
| | | Borders = DevExpress.XtraPrinting.BorderSide.All |
| | | }); |
| | | dataRow.Cells.Add(new XRTableCell() |
| | | { |
| | | Text = item.CalcuValue.ToString(), |
| | | WidthF = 100F, |
| | | TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter, |
| | | Borders = DevExpress.XtraPrinting.BorderSide.All |
| | | }); |
| | | dataRow.Cells.Add(new XRTableCell() |
| | | { |
| | | Text = item.EvaluateError?.ToString(), |
| | | WidthF = 100F, |
| | | TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter, |
| | | ForeColor = Color.Red, |
| | | Borders = DevExpress.XtraPrinting.BorderSide.All |
| | | }); |
| | | tableForAccuracyList.Rows.Add(dataRow); |
| | | } |
| | | // 将表格添加到Detail |
| | | this.Detail.Controls.Add(tableForAccuracyList); |
| | | currentY += tableForAccuracyList.HeightF; |
| | | |
| | | currentY += 20F; |
| | | } |
| | | } |
| | | |
| | | #endregion 评估列表 |
| | | |
| | | #region 水泵分析 |
| | | |
| | | var labForPump = ReportHelper.CreateFirstCaption("(2)、水泵分析", contentWidth - 25F, 15F, 20F, currentY); |
| | | this.Detail.Controls.Add(labForPump); |
| | | currentY += 20F; |
| | | |
| | | if (working.PumpAnaly != null && working.PumpAnaly.Items != null && working.PumpAnaly.Items.Count > 0) |
| | | { |
| | | foreach (var item in working.PumpAnaly.Items) |
| | | { |
| | | var label = ReportHelper.CreateFirstCaption(item.Name, contentWidth - 25F, 15F, 20F, currentY); |
| | | this.Detail.Controls.Add(label); |
| | | currentY += 20F; |
| | | |
| | | #region 创建 |
| | | |
| | | XRChart chart = new XRChart(); |
| | | ((System.ComponentModel.ISupportInitialize)(chart)).BeginInit(); |
| | | chart.LocationF = new DevExpress.Utils.PointFloat(0F, currentY); |
| | | chart.WidthF = contentWidth; |
| | | chart.HeightF = 700F; |
| | | chart.Legend.Visibility = DevExpress.Utils.DefaultBoolean.False; |
| | | ReportHelper.SetChartDisplay(chart); |
| | | // 创建 XY 图表 |
| | | XYDiagram xyDiagram = new XYDiagram(); |
| | | |
| | | // 配置主 X 轴 |
| | | xyDiagram.AxisX.Title.Text = "流量(m³/h)"; |
| | | xyDiagram.AxisX.Title.Visibility = DefaultBoolean.True; |
| | | // xyDiagram.AxisX.Visibility = DefaultBoolean.True; |
| | | |
| | | // 配置主 Y 轴 |
| | | xyDiagram.AxisY.Title.Text = "扬程/m"; |
| | | xyDiagram.AxisY.Title.Visibility = DefaultBoolean.True; |
| | | xyDiagram.AxisY.Visibility = DefaultBoolean.True; |
| | | |
| | | // 创建两个面板 |
| | | XYDiagramPane pane1 = new XYDiagramPane(); |
| | | pane1.Name = "Pane 1"; |
| | | xyDiagram.Panes.Add(pane1); |
| | | |
| | | XYDiagramPane pane2 = new XYDiagramPane(); |
| | | pane2.Name = "Pane 2"; |
| | | xyDiagram.Panes.Add(pane2); |
| | | |
| | | // 创建次要 Y 轴 |
| | | SecondaryAxisY secondaryAxisY1 = new SecondaryAxisY("Secondary Y-Axis 1"); |
| | | secondaryAxisY1.Title.Text = "功率(KW)"; |
| | | secondaryAxisY1.Title.Visibility = DefaultBoolean.True; |
| | | secondaryAxisY1.Visibility = DefaultBoolean.True; |
| | | secondaryAxisY1.GridLines.Visible = true; |
| | | secondaryAxisY1.Tickmarks.Thickness = 1; |
| | | secondaryAxisY1.GridLines.Color = Color.LightGray; |
| | | |
| | | xyDiagram.SecondaryAxesY.Add(secondaryAxisY1); |
| | | |
| | | SecondaryAxisY secondaryAxisY2 = new SecondaryAxisY("Secondary Y-Axis 2"); |
| | | secondaryAxisY2.Title.Text = "效率(%)"; |
| | | secondaryAxisY2.Title.Visibility = DefaultBoolean.True; |
| | | secondaryAxisY2.Visibility = DefaultBoolean.True; |
| | | secondaryAxisY2.GridLines.Visible = true; |
| | | secondaryAxisY2.Tickmarks.Thickness = 1; |
| | | secondaryAxisY2.GridLines.Color = Color.LightGray; |
| | | |
| | | xyDiagram.SecondaryAxesY.Add(secondaryAxisY2); |
| | | |
| | | xyDiagram.AxisX.VisibleInPanesSerializable = "1"; |
| | | chart.Diagram = xyDiagram; |
| | | ((System.ComponentModel.ISupportInitialize)(xyDiagram)).EndInit(); |
| | | |
| | | #endregion 创建 |
| | | |
| | | // 创建第一个系列 |
| | | Series series1 = new Series("Series 1", ViewType.Spline); |
| | | foreach (var qh in item.RatedCurveQH) |
| | | { |
| | | series1.Points.Add(new SeriesPoint(qh.X, qh.Y)); |
| | | } |
| | | if (item.CurrentQ != null && item.CurrentH != null) |
| | | { |
| | | Yw.Geometry.Point2d anchorPoint = new Yw.Geometry.Point2d((double)item.CurrentQ, (double)item.CurrentH + 3); // 锚点坐标 |
| | | TextAnnotation annotation = ReportHelper.AddAnnotation("SampleTag", "运行曲线(50Hz)", Color.Red, xyDiagram.AxisY, xyDiagram.DefaultPane, anchorPoint); |
| | | if (annotation != null) |
| | | { |
| | | chart.AnnotationRepository.Add(annotation); |
| | | } |
| | | } |
| | | |
| | | ((SplineSeriesView)series1.View).MarkerVisibility = DefaultBoolean.False; |
| | | series1.LabelsVisibility = DefaultBoolean.False; |
| | | |
| | | var min_flow = item.RatedCurveQH.Min(x => x.X); |
| | | var max_flow = item.RatedCurveQH.Max(x => x.X); |
| | | |
| | | var min_head = item.RatedCurveQH.Min(x => x.Y); |
| | | var max_head = item.RatedCurveQH.Max(x => x.Y); |
| | | |
| | | var min_eff = item.RatedCurveQE.Min(x => x.Y); |
| | | var max_eff = item.RatedCurveQE.Max(x => x.Y); |
| | | |
| | | var min_power = item.RatedCurveQP.Min(x => x.Y); |
| | | var max_power = item.RatedCurveQP.Max(x => x.Y); |
| | | |
| | | ReportHelper.GetOptimalSpaceMax(min_flow, max_flow, 10, out double min_flow_chart, out double max_flow_chart); |
| | | ReportHelper.GetOptimalSpaceMax(min_head, max_head, 6, out double min_head_chart, out double max_head_chart); |
| | | |
| | | ReportHelper.GetOptimalSpaceMax(min_power, max_power, 4, out double min_power_chart, out double max_power_chart); |
| | | |
| | | min_power_chart = ReportHelper.RoundDownMin(min_power_chart); |
| | | |
| | | min_eff = 40; |
| | | |
| | | ReportHelper.GetOptimalSpaceMax(0, 100, 5, out double min_eff_chart, out double max_eff_chart); |
| | | |
| | | min_eff_chart = ReportHelper.RoundDownMin(min_eff_chart); |
| | | |
| | | ReportHelper.SetAxisX(xyDiagram, min_flow_chart, max_flow_chart); |
| | | ReportHelper.SetAxisY(xyDiagram, min_head_chart, max_head_chart); |
| | | chart.Series.Add(series1); |
| | | Series qhWorking = new Series("Series 5", ViewType.Spline); |
| | | qhWorking.LabelsVisibility = DefaultBoolean.False; |
| | | if (item.CurrentQ != null && item.CurrentH != null) |
| | | { |
| | | qhWorking.Points.Add(new SeriesPoint(item.CurrentQ, item.CurrentH)); |
| | | chart.Series.Add(qhWorking); |
| | | } |
| | | // 创建第二个系列 |
| | | Series series2 = new Series("Series 2", ViewType.Spline); |
| | | foreach (var qe in item.RatedCurveQE) |
| | | { |
| | | series2.Points.Add(new SeriesPoint(qe.X, qe.Y)); |
| | | } |
| | | |
| | | ReportHelper.SetSecondaryAxisY(secondaryAxisY2, min_eff_chart, max_eff_chart); |
| | | ((XYDiagramSeriesViewBase)series2.View).Pane = pane2; |
| | | ((XYDiagramSeriesViewBase)series2.View).AxisY = secondaryAxisY2; |
| | | ((SplineSeriesView)series2.View).MarkerVisibility = DefaultBoolean.False; |
| | | series2.LabelsVisibility = DefaultBoolean.False; |
| | | Series qeWorking = new Series("Series 6", ViewType.Spline); |
| | | qeWorking.LabelsVisibility = DefaultBoolean.False; |
| | | if (item.CurrentQ != null && item.CurrentE != null) |
| | | { |
| | | qeWorking.Points.Add(new SeriesPoint(item.CurrentQ, item.CurrentE)); |
| | | ((XYDiagramSeriesViewBase)qeWorking.View).Pane = pane2; |
| | | ((XYDiagramSeriesViewBase)qeWorking.View).AxisY = secondaryAxisY2; |
| | | chart.Series.Add(qeWorking); |
| | | } |
| | | chart.Series.Add(series2); |
| | | // 创建第三个系列 |
| | | Series series3 = new Series("Series 3", ViewType.Spline); |
| | | foreach (var qp in item.RatedCurveQP) |
| | | { |
| | | series3.Points.Add(new SeriesPoint(qp.X, qp.Y)); |
| | | } |
| | | ReportHelper.SetSecondaryAxisY(secondaryAxisY1, min_power_chart, max_power_chart); |
| | | |
| | | ((XYDiagramSeriesViewBase)series3.View).Pane = pane1; |
| | | ((XYDiagramSeriesViewBase)series3.View).AxisY = secondaryAxisY1; |
| | | series3.LabelsVisibility = DefaultBoolean.False; |
| | | ((SplineSeriesView)series3.View).MarkerVisibility = DefaultBoolean.False; |
| | | Series qpWorking = new Series("Series 8", ViewType.Spline); |
| | | qpWorking.LabelsVisibility = DefaultBoolean.False; |
| | | if (item.CurrentQ != null && item.CurrentP != null) |
| | | { |
| | | qpWorking.Points.Add(new SeriesPoint(item.CurrentQ, item.CurrentP)); |
| | | ((XYDiagramSeriesViewBase)qpWorking.View).Pane = pane1; |
| | | ((XYDiagramSeriesViewBase)qpWorking.View).AxisY = secondaryAxisY1; |
| | | chart.Series.Add(qpWorking); |
| | | } |
| | | |
| | | chart.Series.Add(series3); |
| | | ((System.ComponentModel.ISupportInitialize)(chart)).EndInit(); |
| | | Detail.Controls.Add(chart); |
| | | currentY += chart.HeightF; |
| | | } |
| | | |
| | | currentY += 20F; |
| | | } |
| | | |
| | | var labForPumpParallel = ReportHelper.CreateFirstCaption("(2.1)、水泵并联", contentWidth - 25F, 15F, 20F, currentY); |
| | | this.Detail.Controls.Add(labForPumpParallel); |
| | | currentY += 50F; |
| | | if (working.PumpAnaly != null && working.PumpAnaly.Parallel != null && working.PumpAnaly.Parallel.Items.Count > 0) |
| | | { |
| | | var group = working.PumpAnaly.Parallel.Items.GroupBy(x => x.BeginGroup).ToArray(); |
| | | foreach (var item in group) |
| | | { |
| | | var label = ReportHelper.CreateFirstCaption(item.Key, contentWidth - 25F, 15F, 20F, currentY); |
| | | this.Detail.Controls.Add(label); |
| | | currentY += 20F; |
| | | |
| | | XRChart chart = new XRChart(); |
| | | ((System.ComponentModel.ISupportInitialize)(chart)).BeginInit(); |
| | | chart.LocationF = new DevExpress.Utils.PointFloat(0F, currentY); |
| | | chart.WidthF = contentWidth; |
| | | chart.HeightF = 600F; |
| | | chart.Legend.Visibility = DevExpress.Utils.DefaultBoolean.False; |
| | | |
| | | // 创建 XY 图表 |
| | | XYDiagram xyDiagram = new XYDiagram(); |
| | | ((System.ComponentModel.ISupportInitialize)(xyDiagram)).BeginInit(); |
| | | // 配置主 X 轴 |
| | | xyDiagram.AxisX.Title.Text = "流量(m³/h)"; |
| | | xyDiagram.AxisX.Title.Visibility = DefaultBoolean.True; |
| | | xyDiagram.AxisX.Visibility = DefaultBoolean.True; |
| | | |
| | | // 配置主 Y 轴 |
| | | xyDiagram.AxisY.Title.Text = "扬程/m"; |
| | | xyDiagram.AxisY.Title.Visibility = DefaultBoolean.True; |
| | | xyDiagram.AxisY.Visibility = DefaultBoolean.True; |
| | | xyDiagram.AxisX.VisibleInPanesSerializable = "1"; |
| | | // 创建两个面板 |
| | | XYDiagramPane pane1 = new XYDiagramPane(); |
| | | pane1.Name = "Pane 1"; |
| | | xyDiagram.Panes.Add(pane1); |
| | | |
| | | XYDiagramPane pane2 = new XYDiagramPane(); |
| | | pane2.Name = "Pane 2"; |
| | | xyDiagram.Panes.Add(pane2); |
| | | |
| | | // 创建次要 Y 轴 |
| | | SecondaryAxisY secondaryAxisY1 = new SecondaryAxisY("Secondary Y-Axis 1"); |
| | | secondaryAxisY1.Title.Text = "功率(KW)"; |
| | | secondaryAxisY1.Title.Visibility = DefaultBoolean.True; |
| | | secondaryAxisY1.Visibility = DefaultBoolean.True; |
| | | secondaryAxisY1.GridLines.Visible = true; |
| | | secondaryAxisY1.Tickmarks.Thickness = 1; |
| | | secondaryAxisY1.GridLines.Color = Color.LightGray; |
| | | |
| | | xyDiagram.SecondaryAxesY.Add(secondaryAxisY1); |
| | | |
| | | SecondaryAxisY secondaryAxisY2 = new SecondaryAxisY("Secondary Y-Axis 2"); |
| | | secondaryAxisY2.Title.Text = "效率(%)"; |
| | | secondaryAxisY2.Title.Visibility = DefaultBoolean.True; |
| | | secondaryAxisY2.Visibility = DefaultBoolean.True; |
| | | secondaryAxisY2.GridLines.Visible = true; |
| | | secondaryAxisY2.Tickmarks.Thickness = 1; |
| | | secondaryAxisY2.GridLines.Color = Color.LightGray; |
| | | |
| | | xyDiagram.SecondaryAxesY.Add(secondaryAxisY2); |
| | | |
| | | var pipe = working.PumpAnaly.Parallel.Items[0]; |
| | | |
| | | chart.Diagram = xyDiagram; |
| | | ((System.ComponentModel.ISupportInitialize)(xyDiagram)).EndInit(); |
| | | |
| | | foreach (var valve in item) |
| | | { |
| | | if (valve.Items != null && valve.Items.Count > 0) |
| | | { |
| | | foreach (var curve in valve.Items) |
| | | { |
| | | Series seriesQh = new Series("Series Qh", ViewType.Spline); |
| | | if (curve.CurrentCurveQH != null) |
| | | { |
| | | foreach (var qh in curve.CurrentCurveQH) |
| | | { |
| | | seriesQh.Points.Add(new SeriesPoint(qh.X, qh.Y)); |
| | | } |
| | | } |
| | | ((SplineSeriesView)seriesQh.View).MarkerVisibility = DefaultBoolean.False; |
| | | seriesQh.LabelsVisibility = DefaultBoolean.False; |
| | | chart.Series.Add(seriesQh); |
| | | |
| | | Yw.Geometry.Point2d anchorPointQh = new Yw.Geometry.Point2d((double)valve.CurveQH.Last().X, (double)valve.CurveQH.Last().Y + 3); // 锚点坐标 |
| | | TextAnnotation annotation = ReportHelper.AddAnnotation("SampleTag", "并联线", Color.Red, xyDiagram.AxisY, xyDiagram.DefaultPane, anchorPointQh); |
| | | if (annotation != null) |
| | | { |
| | | chart.AnnotationRepository.Add(annotation); |
| | | } |
| | | |
| | | Series seriesQe = new Series("Series Qe", ViewType.Spline); |
| | | if (curve.CurrentCurveQE != null) |
| | | { |
| | | foreach (var qe in curve.CurrentCurveQE) |
| | | { |
| | | seriesQe.Points.Add(new SeriesPoint(qe.X, qe.Y)); |
| | | } |
| | | } |
| | | |
| | | ((XYDiagramSeriesViewBase)seriesQe.View).Pane = pane2; |
| | | ((XYDiagramSeriesViewBase)seriesQe.View).AxisY = secondaryAxisY2; |
| | | ((SplineSeriesView)seriesQe.View).MarkerVisibility = DefaultBoolean.False; |
| | | seriesQe.LabelsVisibility = DefaultBoolean.False; |
| | | chart.Series.Add(seriesQe); |
| | | |
| | | Series seriesQp = new Series("Series Qp", ViewType.Spline); |
| | | if (curve.CurrentCurveQP != null) |
| | | { |
| | | foreach (var qp in curve.CurrentCurveQP) |
| | | { |
| | | seriesQp.Points.Add(new SeriesPoint(qp.X, qp.Y)); |
| | | } |
| | | } |
| | | |
| | | ((XYDiagramSeriesViewBase)seriesQp.View).Pane = pane1; |
| | | ((XYDiagramSeriesViewBase)seriesQp.View).AxisY = secondaryAxisY1; |
| | | ((SplineSeriesView)seriesQp.View).MarkerVisibility = DefaultBoolean.False; |
| | | seriesQp.LabelsVisibility = DefaultBoolean.False; |
| | | chart.Series.Add(seriesQp); |
| | | } |
| | | } |
| | | // 创建第一个系列 |
| | | Series series1 = new Series("Series 1", ViewType.Spline); |
| | | if (valve.CurveQH != null) |
| | | { |
| | | foreach (var qh in valve.CurveQH) |
| | | { |
| | | series1.Points.Add(new SeriesPoint(qh.X, qh.Y)); |
| | | } |
| | | ((SplineSeriesView)series1.View).MarkerVisibility = DefaultBoolean.False; |
| | | ((SplineSeriesView)series1.View).Color = Color.Black; |
| | | series1.LabelsVisibility = DefaultBoolean.False; |
| | | } |
| | | chart.Series.Add(series1); |
| | | |
| | | // 创建第二个系列 |
| | | Series series2 = new Series("Series 2", ViewType.Spline); |
| | | if (valve.CurveQE != null) |
| | | { |
| | | foreach (var qe in valve.CurveQE) |
| | | { |
| | | series2.Points.Add(new SeriesPoint(qe.X, qe.Y)); |
| | | } |
| | | ((XYDiagramSeriesViewBase)series2.View).Pane = pane2; |
| | | ((XYDiagramSeriesViewBase)series2.View).AxisY = secondaryAxisY2; |
| | | ((SplineSeriesView)series2.View).MarkerVisibility = DefaultBoolean.False; |
| | | ((SplineSeriesView)series2.View).Color = Color.Black; |
| | | series2.LabelsVisibility = DefaultBoolean.False; |
| | | chart.Series.Add(series2); |
| | | } |
| | | |
| | | // 创建第三个系列 |
| | | Series series3 = new Series("Series 3", ViewType.Spline); |
| | | if (valve.CurveQP != null) |
| | | { |
| | | foreach (var qp in valve.CurveQP) |
| | | { |
| | | series3.Points.Add(new SeriesPoint(qp.X, qp.Y)); |
| | | } |
| | | ((XYDiagramSeriesViewBase)series3.View).Pane = pane1; |
| | | ((XYDiagramSeriesViewBase)series3.View).AxisY = secondaryAxisY1; |
| | | ((SplineSeriesView)series3.View).MarkerVisibility = DefaultBoolean.False; |
| | | ((SplineSeriesView)series3.View).Color = Color.Black; |
| | | series3.LabelsVisibility = DefaultBoolean.False; |
| | | chart.Series.Add(series3); |
| | | } |
| | | |
| | | if (item != null) |
| | | { |
| | | foreach (var itemInList in item) |
| | | { |
| | | if (itemInList.Items != null && itemInList.Items.Count > 0) |
| | | { |
| | | if (valve.CurveQH != null) |
| | | { |
| | | foreach (var items in itemInList.Items) |
| | | { |
| | | if (items != null && items.CurrentCurveQH != null) |
| | | { |
| | | items.CurrentCurveQH.AddRange(valve.CurveQH); |
| | | break; |
| | | } |
| | | } |
| | | //itemInList.Items[0].CurrentCurveQH.AddRange(valve.CurveQH); |
| | | //break; |
| | | } |
| | | } |
| | | } |
| | | foreach (var itemInList in item) |
| | | { |
| | | if (itemInList.Items != null && itemInList.Items.Count > 0) |
| | | { |
| | | if (valve.CurveQE != null) |
| | | { |
| | | foreach (var items in itemInList.Items) |
| | | { |
| | | if (items != null && items.CurrentCurveQE != null) |
| | | { |
| | | items.CurrentCurveQE.AddRange(valve.CurveQE); |
| | | break; |
| | | } |
| | | } |
| | | //itemInList.Items[0].CurrentCurveQE.AddRange(valve.CurveQE); |
| | | //break; |
| | | } |
| | | } |
| | | } |
| | | foreach (var itemInList in item) |
| | | { |
| | | if (itemInList.Items != null && itemInList.Items.Count > 0) |
| | | { |
| | | foreach (var items in itemInList.Items) |
| | | { |
| | | if (items != null && items.CurrentCurveQP != null) |
| | | { |
| | | items.CurrentCurveQP.AddRange(valve.CurveQP); |
| | | break; |
| | | } |
| | | } |
| | | /*if (valve.CurveQP != null) |
| | | { |
| | | itemInList.Items[0].CurrentCurveQP.AddRange(valve.CurveQP); |
| | | break; |
| | | }*/ |
| | | } |
| | | } |
| | | |
| | | // 处理 X 轴设置 |
| | | var allQHForXY = item |
| | | .Where(i => i.Items != null) |
| | | .SelectMany(i => i.Items) |
| | | .Where(inner => inner.CurrentCurveQH != null) |
| | | .SelectMany(inner => inner.CurrentCurveQH); |
| | | |
| | | if (allQHForXY.Any()) |
| | | { |
| | | var globalXMax = allQHForXY.Max(qh => qh.X); |
| | | var globalXMin = allQHForXY.Min(qh => qh.X); |
| | | var globalYMax = allQHForXY.Max(qh => qh.Y); |
| | | var globalYMin = allQHForXY.Min(qh => qh.Y); |
| | | ReportHelper.SetAxisX(xyDiagram, ReportHelper.RoundDownMin(globalXMin), ReportHelper.RoundUpMax(globalXMax)); |
| | | ReportHelper.SetAxisY(xyDiagram, ReportHelper.RoundDownMin(globalYMin), ReportHelper.RoundUpMax(globalYMax)); |
| | | } |
| | | |
| | | // 处理 Y 轴设置 |
| | | var allQpForY = item |
| | | .Where(i => i.Items != null) |
| | | .SelectMany(i => i.Items) |
| | | .Where(inner => inner.CurrentCurveQP != null) |
| | | .SelectMany(inner => inner.CurrentCurveQP); |
| | | |
| | | if (allQpForY.Any()) |
| | | { |
| | | var globalYMax = allQpForY.Max(qh => qh.Y); |
| | | var globalYMin = allQpForY.Min(qh => qh.Y); |
| | | ReportHelper.SetSecondaryAxisY(secondaryAxisY1, ReportHelper.RoundDownMin(globalYMin), ReportHelper.RoundUpMax(globalYMax)); |
| | | } |
| | | |
| | | // 处理 Y 轴设置 |
| | | var allQeForY = item |
| | | .Where(i => i.Items != null) |
| | | .SelectMany(i => i.Items) |
| | | .Where(inner => inner.CurrentCurveQE != null) |
| | | .SelectMany(inner => inner.CurrentCurveQE); |
| | | |
| | | if (allQeForY.Any()) |
| | | { |
| | | var globalYMax = allQeForY.Max(qh => qh.Y); |
| | | var globalYMin = allQeForY.Min(qh => qh.Y); |
| | | ReportHelper.SetSecondaryAxisY(secondaryAxisY2, ReportHelper.RoundDownMin(globalYMin), ReportHelper.RoundUpMax(globalYMax)); |
| | | } |
| | | } |
| | | } |
| | | ((System.ComponentModel.ISupportInitialize)(chart)).EndInit(); |
| | | |
| | | Detail.Controls.Add(chart); |
| | | |
| | | currentY += chart.HeightF; |
| | | } |
| | | |
| | | currentY += 20F; |
| | | } |
| | | |
| | | #endregion 水泵分析 |
| | | |
| | | #region 监测分析 |
| | | |
| | | var labForMonitor = ReportHelper.CreateFirstCaption("(3)、监测分析", contentWidth - 25F, 15F, 20F, currentY); |
| | | this.Detail.Controls.Add(labForMonitor); |
| | | currentY += 20F; |
| | | |
| | | if (working.MonitorAnaly != null && working.MonitorAnaly.Items != null && working.MonitorAnaly.Items.Count > 0) |
| | | { // 创建 XRTable |
| | | var tableForMonitorList = new XRTable(); |
| | | tableForMonitorList.LocationF = new DevExpress.Utils.PointFloat(0F, currentY); |
| | | tableForMonitorList.SizeF = new SizeF(727F, 30F + working.MonitorAnaly.Items.Count * 25F); // 设置大小 |
| | | |
| | | // 创建表头行 |
| | | XRTableRow headerRowMonitorList = new XRTableRow(); |
| | | headerRowMonitorList.BackColor = Color.LightGray; // 设置背景颜色 |
| | | |
| | | // 添加表头列 |
| | | headerRowMonitorList.Cells.Add(ReportHelper.CreateTableCell("构件", 100)); |
| | | headerRowMonitorList.Cells.Add(ReportHelper.CreateTableCell("属性", 100)); |
| | | headerRowMonitorList.Cells.Add(ReportHelper.CreateTableCell("计算值", 100)); |
| | | headerRowMonitorList.Cells.Add(ReportHelper.CreateTableCell("单位", 100)); |
| | | |
| | | // 将表头行添加到表格 |
| | | tableForMonitorList.Rows.Add(headerRowMonitorList); |
| | | |
| | | foreach (var item in working.MonitorAnaly.Items) |
| | | { |
| | | // 创建数据行 |
| | | var dataRow = new XRTableRow(); |
| | | dataRow.Cells.Add(new XRTableCell() |
| | | { |
| | | Text = item.VisualName, |
| | | WidthF = 100F, |
| | | TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter, |
| | | Borders = DevExpress.XtraPrinting.BorderSide.All |
| | | }); |
| | | dataRow.Cells.Add(new XRTableCell() |
| | | { |
| | | Text = item.PropName, |
| | | WidthF = 100F, |
| | | TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter, |
| | | Borders = DevExpress.XtraPrinting.BorderSide.All |
| | | }); |
| | | dataRow.Cells.Add(new XRTableCell() |
| | | { |
| | | Text = item.CalcuValue?.ToString(), |
| | | WidthF = 100F, |
| | | TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter, |
| | | Borders = DevExpress.XtraPrinting.BorderSide.All |
| | | }); |
| | | dataRow.Cells.Add(new XRTableCell() |
| | | { |
| | | Text = item.UnitName, |
| | | WidthF = 100F, |
| | | TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter, |
| | | Borders = DevExpress.XtraPrinting.BorderSide.All |
| | | }); |
| | | tableForMonitorList.Rows.Add(dataRow); |
| | | } |
| | | // 将表格添加到Detail |
| | | this.Detail.Controls.Add(tableForMonitorList); |
| | | currentY += tableForMonitorList.HeightF; |
| | | currentY += 20F; |
| | | } |
| | | |
| | | #endregion 监测分析 |
| | | |
| | | #region 能耗分析 |
| | | |
| | | var labForEnergyAnaly = ReportHelper.CreateFirstCaption("(4)、能耗分析", contentWidth - 25F, 15F, 20F, currentY); |
| | | this.Detail.Controls.Add(labForEnergyAnaly); |
| | | currentY += 20F; |
| | | |
| | | if (working.EnergyAnaly != null) |
| | | { |
| | | int groupIndex = 0; |
| | | if (working.EnergyAnaly.Items != null && working.EnergyAnaly.Items.Count > 0) |
| | | { |
| | | var group = working.EnergyAnaly.Items.GroupBy(x => x.BeginGroup).ToArray(); |
| | | foreach (var item in group) |
| | | { |
| | | var label = ReportHelper.CreateFirstCaption(item.Key, contentWidth - 25F, 15F, 20F, currentY); |
| | | this.Detail.Controls.Add(label); |
| | | currentY += 20F; |
| | | |
| | | XRChart chart = new XRChart(); |
| | | ((System.ComponentModel.ISupportInitialize)(chart)).BeginInit(); |
| | | chart.LocationF = new DevExpress.Utils.PointFloat(0F, currentY); |
| | | chart.WidthF = contentWidth; |
| | | chart.HeightF = 600F; |
| | | chart.Legend.Visibility = DevExpress.Utils.DefaultBoolean.False; |
| | | |
| | | chart.CustomPaint += (sender, e) => |
| | | { |
| | | using Pen pen = new(Color.Black, 2) |
| | | { |
| | | DashStyle = System.Drawing.Drawing2D.DashStyle.DashDotDot |
| | | }; |
| | | ReportHelper.DrawEquipPoint(_pointTuple[_currentChartIndex].Item1, _pointTuple[_currentChartIndex].Item2, _pointTuple[_currentChartIndex].Item3, _pointTuple[_currentChartIndex].Item4, _pointTuple[_currentChartIndex].Item5, e.Graphics, pen, _pointTuple[_currentChartIndex].Item6); |
| | | ReportHelper.DrawEquipLine(_pointTuple[_currentChartIndex].Item1, _pointTuple[_currentChartIndex].Item2, _pointTuple[_currentChartIndex].Item3, e.Graphics, pen, _pointTuple[_currentChartIndex].Item6); |
| | | _currentChartIndex++; |
| | | }; |
| | | |
| | | // 创建 XY 图表 |
| | | XYDiagram xyDiagram = new XYDiagram(); |
| | | ((System.ComponentModel.ISupportInitialize)(xyDiagram)).BeginInit(); |
| | | xyDiagram.Tag = groupIndex; |
| | | // 配置主 X 轴 |
| | | xyDiagram.AxisX.Title.Text = "流量(m³/h)"; |
| | | xyDiagram.AxisX.Title.Visibility = DefaultBoolean.True; |
| | | xyDiagram.AxisX.Visibility = DefaultBoolean.True; |
| | | |
| | | // 配置主 Y 轴 |
| | | xyDiagram.AxisY.Title.Text = "扬程/m"; |
| | | xyDiagram.AxisY.Title.Visibility = DefaultBoolean.True; |
| | | xyDiagram.AxisY.Visibility = DefaultBoolean.True; |
| | | xyDiagram.AxisX.VisibleInPanesSerializable = "1"; |
| | | // 创建两个面板 |
| | | XYDiagramPane pane1 = new XYDiagramPane(); |
| | | pane1.Name = "Pane 1"; |
| | | xyDiagram.Panes.Add(pane1); |
| | | |
| | | XYDiagramPane pane2 = new XYDiagramPane(); |
| | | pane2.Name = "Pane 2"; |
| | | xyDiagram.Panes.Add(pane2); |
| | | |
| | | // 创建次要 Y 轴 |
| | | SecondaryAxisY secondaryAxisY1 = new SecondaryAxisY("Secondary Y-Axis 1"); |
| | | secondaryAxisY1.Title.Text = "功率(KW)"; |
| | | secondaryAxisY1.Title.Visibility = DefaultBoolean.True; |
| | | secondaryAxisY1.Visibility = DefaultBoolean.True; |
| | | secondaryAxisY1.GridLines.Visible = true; |
| | | secondaryAxisY1.Tickmarks.Thickness = 1; |
| | | secondaryAxisY1.GridLines.Color = Color.LightGray; |
| | | |
| | | xyDiagram.SecondaryAxesY.Add(secondaryAxisY1); |
| | | |
| | | SecondaryAxisY secondaryAxisY2 = new SecondaryAxisY("Secondary Y-Axis 2"); |
| | | secondaryAxisY2.Title.Text = "效率(%)"; |
| | | secondaryAxisY2.Title.Visibility = DefaultBoolean.True; |
| | | secondaryAxisY2.Visibility = DefaultBoolean.True; |
| | | secondaryAxisY2.GridLines.Visible = true; |
| | | secondaryAxisY2.Tickmarks.Thickness = 1; |
| | | secondaryAxisY2.GridLines.Color = Color.LightGray; |
| | | |
| | | xyDiagram.SecondaryAxesY.Add(secondaryAxisY2); |
| | | |
| | | var pipe = working.EnergyAnaly.Pipe.Items[groupIndex]; |
| | | if (pipe != null) |
| | | { |
| | | _pointTuple.Add(new Tuple<XYDiagram, AxisX, AxisY, SecondaryAxisY, SecondaryAxisY, HydroEnergyAnalyPipeItemViewModel>( |
| | | xyDiagram, |
| | | xyDiagram.AxisX, |
| | | xyDiagram.AxisY, |
| | | secondaryAxisY2, |
| | | secondaryAxisY1, |
| | | pipe |
| | | )); |
| | | } |
| | | |
| | | groupIndex++; |
| | | chart.Diagram = xyDiagram; |
| | | ((System.ComponentModel.ISupportInitialize)(xyDiagram)).EndInit(); |
| | | |
| | | foreach (var valve in item) |
| | | { |
| | | // 创建第一个系列 |
| | | Series series1 = new Series("Series 1", ViewType.Spline); |
| | | if (valve.CurrentCurveQH != null) |
| | | { |
| | | foreach (var qh in valve.CurrentCurveQH) |
| | | { |
| | | series1.Points.Add(new SeriesPoint(qh.X, qh.Y)); |
| | | } |
| | | ((SplineSeriesView)series1.View).MarkerVisibility = DefaultBoolean.False; |
| | | series1.LabelsVisibility = DefaultBoolean.False; |
| | | } |
| | | chart.Series.Add(series1); |
| | | |
| | | var pt_f_list = new List<Yw.Geometry.Point2d>(); |
| | | if (pipe != null) |
| | | { |
| | | if (pipe.PipeH != null || pipe.PipeQ != null) |
| | | { |
| | | var start_point = new Yw.Geometry.Point2d(0.0, pipe.StartH); |
| | | var end_point = new Yw.Geometry.Point2d(pipe.PipeQ.Value, pipe.PipeH.Value); |
| | | pt_f_list = Yw.Pump.PerformParabolaHelper.GetEquipCurvePointList(start_point, end_point, 30); |
| | | } |
| | | } |
| | | |
| | | if (item != null) |
| | | { |
| | | foreach (var itemInList in item) |
| | | { |
| | | if (itemInList.CurrentCurveQH != null) |
| | | { |
| | | if (pt_f_list != null) |
| | | { |
| | | itemInList.CurrentCurveQH.AddRange(pt_f_list); |
| | | // 处理 X 轴设置 |
| | | var allQHForX = item |
| | | .Where(singleItem => singleItem.CurrentCurveQH != null) |
| | | .SelectMany(singleItem => singleItem.CurrentCurveQH); |
| | | |
| | | if (allQHForX.Any()) |
| | | { |
| | | var globalXMax = allQHForX.Max(qh => qh.X); |
| | | var globalXMin = allQHForX.Min(qh => qh.X); |
| | | |
| | | ReportHelper.SetAxisX(xyDiagram, ReportHelper.RoundDownMin(globalXMin), ReportHelper.RoundUpMax(globalXMax)); |
| | | } |
| | | |
| | | // 处理 Y 轴设置 |
| | | var allQHForY = item |
| | | .Where(singleItem => singleItem.CurrentCurveQH != null) |
| | | .SelectMany(singleItem => singleItem.CurrentCurveQH); |
| | | |
| | | if (allQHForY.Any()) |
| | | { |
| | | var globalYMax = allQHForY.Max(qh => qh.Y); |
| | | var globalYMin = allQHForY.Min(qh => qh.Y); |
| | | ReportHelper.SetAxisY(xyDiagram, ReportHelper.RoundDownMin(globalYMin), ReportHelper.RoundUpMax(globalYMax)); |
| | | } |
| | | itemInList.CurrentCurveQH.RemoveAll(item => pt_f_list.Contains(item)); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 处理 Y 轴设置 |
| | | var allQpForY = item |
| | | .Where(singleItem => singleItem.RatedCurveQP != null) |
| | | .SelectMany(singleItem => singleItem.RatedCurveQP); |
| | | |
| | | if (allQpForY.Any()) |
| | | { |
| | | var globalYMax = allQpForY.Max(qh => qh.Y); |
| | | var globalYMin = allQpForY.Min(qh => qh.Y); |
| | | ReportHelper.SetSecondaryAxisY(secondaryAxisY1, ReportHelper.RoundDownMin(globalYMin), ReportHelper.RoundUpMax(globalYMax)); |
| | | } |
| | | |
| | | // 处理 Y 轴设置 |
| | | var allQeForY = item |
| | | .Where(singleItem => singleItem.RatedCurveQE != null) |
| | | .SelectMany(singleItem => singleItem.RatedCurveQE); |
| | | |
| | | if (allQeForY.Any()) |
| | | { |
| | | var globalYMax = allQeForY.Max(qh => qh.Y); |
| | | var globalYMin = allQeForY.Min(qh => qh.Y); |
| | | ReportHelper.SetSecondaryAxisY(secondaryAxisY2, ReportHelper.RoundDownMin(globalYMin), ReportHelper.RoundUpMax(globalYMax)); |
| | | } |
| | | } |
| | | |
| | | Series qhWorking = new Series("Series 5", ViewType.Spline); |
| | | qhWorking.LabelsVisibility = DefaultBoolean.False; |
| | | if (valve.CurrentQ != null && valve.CurrentH != null) |
| | | { |
| | | qhWorking.Points.Add(new SeriesPoint(valve.CurrentQ, valve.CurrentH)); |
| | | chart.Series.Add(qhWorking); |
| | | } |
| | | |
| | | // 创建第二个系列 |
| | | Series series2 = new Series("Series 2", ViewType.Spline); |
| | | if (valve.CurrentCurveQE != null) |
| | | { |
| | | foreach (var qe in valve.CurrentCurveQE) |
| | | { |
| | | series2.Points.Add(new SeriesPoint(qe.X, qe.Y)); |
| | | } |
| | | ((XYDiagramSeriesViewBase)series2.View).Pane = pane2; |
| | | ((XYDiagramSeriesViewBase)series2.View).AxisY = secondaryAxisY2; |
| | | ((SplineSeriesView)series2.View).MarkerVisibility = DefaultBoolean.False; |
| | | series2.LabelsVisibility = DefaultBoolean.False; |
| | | chart.Series.Add(series2); |
| | | } |
| | | |
| | | Series qeWorking = new Series("Series 6", ViewType.Spline); |
| | | qeWorking.LabelsVisibility = DefaultBoolean.False; |
| | | if (valve.CurrentQ != null && valve.CurrentE != null) |
| | | { |
| | | qeWorking.Points.Add(new SeriesPoint(valve.CurrentQ, valve.CurrentE)); |
| | | ((XYDiagramSeriesViewBase)qeWorking.View).Pane = pane2; |
| | | ((XYDiagramSeriesViewBase)qeWorking.View).AxisY = secondaryAxisY2; |
| | | |
| | | chart.Series.Add(qeWorking); |
| | | } |
| | | |
| | | // 创建第三个系列 |
| | | Series series3 = new Series("Series 3", ViewType.Spline); |
| | | if (valve.RatedCurveQP != null) |
| | | { |
| | | foreach (var qp in valve.RatedCurveQP) |
| | | { |
| | | series3.Points.Add(new SeriesPoint(qp.X, qp.Y)); |
| | | } |
| | | ((XYDiagramSeriesViewBase)series3.View).Pane = pane1; |
| | | ((XYDiagramSeriesViewBase)series3.View).AxisY = secondaryAxisY1; |
| | | ((SplineSeriesView)series3.View).MarkerVisibility = DefaultBoolean.False; |
| | | series3.LabelsVisibility = DefaultBoolean.False; |
| | | chart.Series.Add(series3); |
| | | |
| | | if (valve.CurrentQ != null && valve.CurrentP != null) |
| | | { |
| | | Series qpWorking = new Series("Series 7", ViewType.Spline); |
| | | qpWorking.LabelsVisibility = DefaultBoolean.False; |
| | | qpWorking.Points.Add(new SeriesPoint(valve.CurrentQ, valve.CurrentP)); |
| | | ((XYDiagramSeriesViewBase)qpWorking.View).Pane = pane1; |
| | | ((XYDiagramSeriesViewBase)qpWorking.View).AxisY = secondaryAxisY1; |
| | | chart.Series.Add(qpWorking); |
| | | } |
| | | } |
| | | } |
| | | ((System.ComponentModel.ISupportInitialize)(chart)).EndInit(); |
| | | // 重新设置高度 |
| | | chart.HeightF = chart.HeightF; |
| | | |
| | | // 重新设置位置 |
| | | chart.LocationF = chart.LocationF; |
| | | Detail.Controls.Add(chart); |
| | | |
| | | currentY += chart.HeightF; |
| | | } |
| | | } |
| | | } |
| | | |
| | | #endregion 能耗分析 |
| | | |
| | | //能效明细 |
| | | var labForEnergyDetails = ReportHelper.CreateFirstCaption("(4.1)、能效明细", contentWidth - 25F, 15F, 20F, currentY); |
| | | this.Detail.Controls.Add(labForEnergyDetails); |
| | | currentY += 20F; |
| | | |
| | | if (working.EnergyAnaly.Items != null && working.EnergyAnaly.Items.Count > 0) |
| | | { |
| | | // 创建 XRTable |
| | | var tableForEnergyDetails = new XRTable(); |
| | | tableForEnergyDetails.LocationF = new DevExpress.Utils.PointFloat(0F, currentY); |
| | | tableForEnergyDetails.SizeF = new SizeF(727F, 30F + working.EnergyAnaly.Items.Count * 25F); // 设置大小 |
| | | |
| | | // 创建表头行 |
| | | XRTableRow headerRowEnergyDetails = new XRTableRow(); |
| | | headerRowEnergyDetails.BackColor = Color.LightGray; // 设置背景颜色 |
| | | |
| | | // 添加表头列 |
| | | headerRowEnergyDetails.Cells.Add(ReportHelper.CreateTableCell("分组", 100)); |
| | | headerRowEnergyDetails.Cells.Add(ReportHelper.CreateTableCell("名称", 100)); |
| | | headerRowEnergyDetails.Cells.Add(ReportHelper.CreateTableCell("运行状态", 100)); |
| | | headerRowEnergyDetails.Cells.Add(ReportHelper.CreateTableCell("设定频率(hz)", 100)); |
| | | headerRowEnergyDetails.Cells.Add(ReportHelper.CreateTableCell("设定流量(m³/h)", 100)); |
| | | headerRowEnergyDetails.Cells.Add(ReportHelper.CreateTableCell("进口压力(m)", 100)); |
| | | headerRowEnergyDetails.Cells.Add(ReportHelper.CreateTableCell("出口压力(m)", 100)); |
| | | headerRowEnergyDetails.Cells.Add(ReportHelper.CreateTableCell("扬程(m)", 100)); |
| | | headerRowEnergyDetails.Cells.Add(ReportHelper.CreateTableCell("功率(Kw)", 100)); |
| | | headerRowEnergyDetails.Cells.Add(ReportHelper.CreateTableCell("效率(%)", 100)); |
| | | // 将表头行添加到表格 |
| | | tableForEnergyDetails.Rows.Add(headerRowEnergyDetails); |
| | | |
| | | foreach (var item in working.EnergyAnaly.Items) |
| | | { |
| | | // 创建数据行 |
| | | var dataRow = new XRTableRow(); |
| | | dataRow.Cells.Add(new XRTableCell() |
| | | { |
| | | Text = item.BeginGroup, |
| | | WidthF = 100F, |
| | | TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter, |
| | | Borders = DevExpress.XtraPrinting.BorderSide.All |
| | | }); |
| | | dataRow.Cells.Add(new XRTableCell() |
| | | { |
| | | Text = item.Name, |
| | | WidthF = 100F, |
| | | TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter, |
| | | Borders = DevExpress.XtraPrinting.BorderSide.All |
| | | }); |
| | | dataRow.Cells.Add(new XRTableCell() |
| | | { |
| | | Text = HydroLinkStatusHelper.GetStatusName(item.LinkStatus), |
| | | WidthF = 100F, |
| | | TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter, |
| | | Borders = DevExpress.XtraPrinting.BorderSide.All |
| | | }); |
| | | dataRow.Cells.Add(new XRTableCell() |
| | | { |
| | | Text = item.RatedHz.ToString(), |
| | | WidthF = 100F, |
| | | TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter, |
| | | Borders = DevExpress.XtraPrinting.BorderSide.All |
| | | }); |
| | | dataRow.Cells.Add(new XRTableCell() |
| | | { |
| | | Text = item.CurrentQ?.ToString("F2"), |
| | | WidthF = 100F, |
| | | TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter, |
| | | Borders = DevExpress.XtraPrinting.BorderSide.All |
| | | }); |
| | | |
| | | dataRow.Cells.Add(new XRTableCell() |
| | | { |
| | | Text = item.CurrentPr1?.ToString("F2"), |
| | | WidthF = 100F, |
| | | TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter, |
| | | Borders = DevExpress.XtraPrinting.BorderSide.All |
| | | }); |
| | | dataRow.Cells.Add(new XRTableCell() |
| | | { |
| | | Text = item.CurrentPr2?.ToString("F2"), |
| | | WidthF = 100F, |
| | | TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter, |
| | | Borders = DevExpress.XtraPrinting.BorderSide.All |
| | | }); |
| | | dataRow.Cells.Add(new XRTableCell() |
| | | { |
| | | Text = item.CurrentH?.ToString("F2"), |
| | | WidthF = 100F, |
| | | TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter, |
| | | Borders = DevExpress.XtraPrinting.BorderSide.All |
| | | }); |
| | | dataRow.Cells.Add(new XRTableCell() |
| | | { |
| | | Text = item.CurrentP?.ToString("F2"), |
| | | WidthF = 100F, |
| | | TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter, |
| | | Borders = DevExpress.XtraPrinting.BorderSide.All |
| | | }); |
| | | dataRow.Cells.Add(new XRTableCell() |
| | | { |
| | | Text = item.CurrentE?.ToString("F2"), |
| | | WidthF = 100F, |
| | | TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter, |
| | | Borders = DevExpress.XtraPrinting.BorderSide.All |
| | | }); |
| | | tableForEnergyDetails.Rows.Add(dataRow); |
| | | } |
| | | // 将表格添加到Detail |
| | | this.Detail.Controls.Add(tableForEnergyDetails); |
| | | currentY += tableForEnergyDetails.HeightF; |
| | | currentY += 20F; |
| | | } |
| | | |
| | | #region 损失曲线 |
| | | |
| | | var labForLossCurve = ReportHelper.CreateFirstCaption("(5)、损失曲线", contentWidth - 25F, 15F, 20F, currentY); |
| | | this.Detail.Controls.Add(labForLossCurve); |
| | | currentY += 20F; |
| | | |
| | | if (working.LossCurve != null && working.LossCurve.Items != null) |
| | | { |
| | | XRChart chart = new XRChart(); |
| | | chart.LocationF = new DevExpress.Utils.PointFloat(0F, currentY); |
| | | chart.WidthF = contentWidth; |
| | | chart.HeightF = 300F; |
| | | chart.Legend.Visibility = DevExpress.Utils.DefaultBoolean.False; |
| | | |
| | | // 创建一个线系列 |
| | | Series series = new Series("Series1", ViewType.Area); |
| | | Series series2 = new Series("Series2", ViewType.Area); |
| | | Series series3 = new Series("Series3", ViewType.Area); |
| | | |
| | | series.LabelsVisibility = DefaultBoolean.False; |
| | | series2.LabelsVisibility = DefaultBoolean.False; |
| | | series3.LabelsVisibility = DefaultBoolean.False; |
| | | ((AreaSeriesView)series.View).MarkerVisibility = DefaultBoolean.False; |
| | | ((AreaSeriesView)series2.View).MarkerVisibility = DefaultBoolean.False; |
| | | ((AreaSeriesView)series3.View).MarkerVisibility = DefaultBoolean.False; |
| | | |
| | | // 添加数据点 |
| | | foreach (var item in working.LossCurve.End.Items) |
| | | { |
| | | series.Points.Add(new SeriesPoint(item.X, item.Y)); |
| | | } |
| | | |
| | | // 添加数据点 |
| | | foreach (var item in working.LossCurve.Start.Items) |
| | | { |
| | | series2.Points.Add(new SeriesPoint(item.X, item.Y)); |
| | | } |
| | | |
| | | // 添加数据点 |
| | | foreach (var item in working.LossCurve.Elev.Items) |
| | | { |
| | | series3.Points.Add(new SeriesPoint(item.X, item.Y)); |
| | | } |
| | | |
| | | chart.Series.Add(series); |
| | | chart.Series.Add(series2); |
| | | chart.Series.Add(series3); |
| | | |
| | | Detail.Controls.Add(chart); |
| | | currentY += chart.HeightF; |
| | | } |
| | | |
| | | #endregion 损失曲线 |
| | | |
| | | #region 损失统计 |
| | | |
| | | var labForLossStatistics = ReportHelper.CreateFirstCaption("(6)、损失统计", contentWidth - 25F, 15F, 20F, currentY); |
| | | this.Detail.Controls.Add(labForLossStatistics); |
| | | currentY += 20F; |
| | | var accuracyScaleChart1 = ReportHelper.CreateLossStatistics(working.LossStatistics, 350F, 300F, 0F, currentY); |
| | | Detail.Controls.Add(accuracyScaleChart1); |
| | | var EnergyLossChart = ReportHelper.CreateEnergyLoss(working.LossStatistics, 377F, 300F, 350F, currentY); |
| | | Detail.Controls.Add(EnergyLossChart); |
| | | currentY += accuracyScaleChart1.HeightF; |
| | | var CategoryChart = ReportHelper.CreateCategory(working.LossStatistics, 727F, 300F, 0F, currentY); |
| | | Detail.Controls.Add(CategoryChart); |
| | | currentY += CategoryChart.HeightF; |
| | | } |
| | | } |
| | | |
| | | #endregion 损失统计 |
| | | } |
| | | |
| | | // 创建表头单元格 |
| | | private XRTableCell CreateTableCell(string text, int width) |
| | | { |
| | | XRTableCell cell = new XRTableCell(); |
| | | cell.Text = text; |
| | | cell.Width = width; |
| | | cell.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; // 文本居中 |
| | | cell.Borders = DevExpress.XtraPrinting.BorderSide.All; // 设置边框 |
| | | return cell; |
| | | } |
| | | |
| | | // 创建数据绑定单元格 |
| | | private XRTableCell CreateTableCellWithBinding(string dataMember, int width) |
| | | { |
| | | XRTableCell cell = new XRTableCell(); |
| | | cell.DataBindings.Add(new XRBinding("Text", null, dataMember)); // 绑定数据字段 |
| | | cell.Width = width; |
| | | cell.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft; // 文本左对齐 |
| | | cell.Borders = DevExpress.XtraPrinting.BorderSide.All; // 设置边框 |
| | | return cell; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | | } |