From fd206ba4e3e792eb01898fea540d50c2fd92f364 Mon Sep 17 00:00:00 2001 From: qin <a@163.com> Date: 星期二, 18 三月 2025 13:46:34 +0800 Subject: [PATCH] IBox封装隐藏按钮 --- WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/13-print/report/SimulationCommonReport.cs | 1224 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 1,151 insertions(+), 73 deletions(-) diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/13-print/report/SimulationCommonReport.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/13-print/report/SimulationCommonReport.cs index 289f0e4..fe55894 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/13-print/report/SimulationCommonReport.cs +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/13-print/report/SimulationCommonReport.cs @@ -1,8 +1,10 @@ -锘縰sing DevExpress.XtraReports.UI; -using System; -using System.Collections; -using System.ComponentModel; -using System.Drawing; +锘縰sing 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 { @@ -13,16 +15,23 @@ 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 椤电湁 @@ -37,7 +46,7 @@ labForCorp.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; this.TopMargin.Controls.Add(labForCorp); - #endregion + #endregion 椤电湁 #region 椤佃剼 @@ -51,15 +60,14 @@ 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); @@ -69,35 +77,24 @@ 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); @@ -107,15 +104,15 @@ 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); @@ -125,36 +122,52 @@ 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, @@ -202,38 +215,1103 @@ // 灏嗚〃鏍兼坊鍔犲埌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; - } - - - } -} +} \ No newline at end of file -- Gitblit v1.9.3