From 26f45822a2a84af81e20ca543da98d3b822c5afd Mon Sep 17 00:00:00 2001 From: duheng <2784771470@qq.com> Date: 星期一, 17 二月 2025 21:25:59 +0800 Subject: [PATCH] Merge branch 'master' of http://47.103.154.90:83/r/HStation/XHS.V1.0 --- WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/13-print/report/SimulationCommonReport.cs | 371 ++++++++++++++++++++++++++++ WinFrmUI/Yw.WinFrmUI.Hydro.Core/accuracy/scale/HydroAccuracyScaleChartCtrl.cs | 65 +++++ WinFrmUI/Yw.WinFrmUI.Hydro.Core/accuracy/scale/HydroAccuracyScaleChartCtrl.resx | 123 +++++++++ WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/13-print/pump/SimulationPrintPumpViewModel.cs | 6 WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/13-print/report/SimulationCommonReport.Designer.cs | 37 -- WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs | 5 WinFrmUI/Yw.WinFrmUI.Hydro.Core/Yw.WinFrmUI.Hydro.Core.csproj | 3 WinFrmUI/Yw.WinFrmUI.Hydro.Core/accuracy/scale/HydroAccuracyScaleItemViewModel.cs | 25 + WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/13-print/report/SimulationCommonReportDlg.Designer.cs | 2 WinFrmUI/Yw.WinFrmUI.Hydro.Core/accuracy/scale/HydroAccuracyScaleChartCtrl.Designer.cs | 94 +++++++ 10 files changed, 698 insertions(+), 33 deletions(-) diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs index 9ad14eb..e6c4d62 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs @@ -2833,7 +2833,10 @@ //瀵煎嚭word private async void barBtnExportWord_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { - //var printInfo = await CreatePrintInfo(); + var printInfo = await CreatePrintInfo(); + var printDlg = new SimulationCommonReportDlg(); + printDlg.SetBindingData(printInfo); + printDlg.ShowDialog(); if (_visual == null) { SelectInputSource(); diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/13-print/pump/SimulationPrintPumpViewModel.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/13-print/pump/SimulationPrintPumpViewModel.cs index 4697bcc..21e79a0 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/13-print/pump/SimulationPrintPumpViewModel.cs +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/13-print/pump/SimulationPrintPumpViewModel.cs @@ -19,6 +19,7 @@ this.BeginGroup = rhs.BeginGroup; this.Name = rhs.Name; this.Code = rhs.Code; + this.ModelType = rhs.ModelType; this.RatedQ = rhs.RatedQ; this.RatedH = rhs.RatedH; this.RatedP = rhs.RatedP; @@ -41,6 +42,11 @@ public string Code { get; set; } /// <summary> + /// 鍨嬪彿 + /// </summary> + public string ModelType { get; set; } + + /// <summary> /// 棰濆畾娴侀噺 /// </summary> public double RatedQ { get; set; } diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/13-print/report/SimulationCommonReport.Designer.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/13-print/report/SimulationCommonReport.Designer.cs index 807d293..a1c87bf 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/13-print/report/SimulationCommonReport.Designer.cs +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/13-print/report/SimulationCommonReport.Designer.cs @@ -31,47 +31,22 @@ this.TopMargin = new DevExpress.XtraReports.UI.TopMarginBand(); this.BottomMargin = new DevExpress.XtraReports.UI.BottomMarginBand(); this.Detail = new DevExpress.XtraReports.UI.DetailBand(); - this.labCorp = new DevExpress.XtraReports.UI.XRLabel(); - this.pageCurrentNum = new DevExpress.XtraReports.UI.XRPageInfo(); ((System.ComponentModel.ISupportInitialize)(this)).BeginInit(); // // TopMargin // - this.TopMargin.Controls.AddRange(new DevExpress.XtraReports.UI.XRControl[] { - this.labCorp}); + this.TopMargin.HeightF = 50F; this.TopMargin.Name = "TopMargin"; // // BottomMargin // - this.BottomMargin.Controls.AddRange(new DevExpress.XtraReports.UI.XRControl[] { - this.pageCurrentNum}); + this.BottomMargin.HeightF = 50F; this.BottomMargin.Name = "BottomMargin"; // // Detail // + this.Detail.HeightF = 684.375F; this.Detail.Name = "Detail"; - // - // labCorp - // - this.labCorp.LocationFloat = new DevExpress.Utils.PointFloat(404.5833F, 65.95834F); - this.labCorp.Multiline = true; - this.labCorp.Name = "labCorp"; - this.labCorp.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 96F); - this.labCorp.SizeF = new System.Drawing.SizeF(235.4166F, 24.04166F); - this.labCorp.StylePriority.UseTextAlignment = false; - this.labCorp.Text = "鏉窞绉戠淮鑺傝兘鎶�鏈偂浠芥湁闄愬叕鍙� "; - this.labCorp.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; - // - // pageCurrentNum - // - this.pageCurrentNum.LocationFloat = new DevExpress.Utils.PointFloat(539.9999F, 10.00001F); - this.pageCurrentNum.Name = "pageCurrentNum"; - this.pageCurrentNum.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 96F); - this.pageCurrentNum.PageInfo = DevExpress.XtraPrinting.PageInfo.Number; - this.pageCurrentNum.SizeF = new System.Drawing.SizeF(100F, 23F); - this.pageCurrentNum.StylePriority.UseTextAlignment = false; - this.pageCurrentNum.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; - this.pageCurrentNum.TextFormatString = "绗瑊0}椤�"; // // SimulationCommonReport // @@ -80,6 +55,10 @@ this.BottomMargin, this.Detail}); this.Font = new DevExpress.Drawing.DXFont("Arial", 9.75F); + this.Margins = new DevExpress.Drawing.DXMargins(50F, 50F, 50F, 50F); + this.PageHeight = 1169; + this.PageWidth = 827; + this.PaperKind = DevExpress.Drawing.Printing.DXPaperKind.A4; this.Version = "23.2"; ((System.ComponentModel.ISupportInitialize)(this)).EndInit(); @@ -90,7 +69,5 @@ private DevExpress.XtraReports.UI.TopMarginBand TopMargin; private DevExpress.XtraReports.UI.BottomMarginBand BottomMargin; private DevExpress.XtraReports.UI.DetailBand Detail; - private DevExpress.XtraReports.UI.XRLabel labCorp; - private DevExpress.XtraReports.UI.XRPageInfo pageCurrentNum; } } 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 72a045c..038e653 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,4 +1,5 @@ -锘縰sing DevExpress.XtraReports.UI; +锘縰sing DevExpress.XtraCharts; +using DevExpress.XtraReports.UI; using System; using System.Collections; using System.ComponentModel; @@ -18,7 +19,375 @@ /// </summary> public void SetBindingData(SimulationPrintViewModel vm) { + //A4璁剧疆 827 1169 + this.PaperKind = DevExpress.Drawing.Printing.DXPaperKind.A4; + this.Margins = new DevExpress.Drawing.DXMargins(50, 50, 50, 50); + //鍐呭瀹藉害 + float contentWidth = 727F;//鍐呭瀹藉害 + float firstCaptionHeight = 30F;//涓�绾ф爣棰橀珮搴� + + //727 1069 + + #region 椤电湁 + + var labForCorp = new XRLabel(); + labForCorp.Name = "椤电湁"; + labForCorp.Text = "鏉窞绉戠淮鑺傝兘鎶�鏈偂浠芥湁闄愬叕鍙�"; + labForCorp.Multiline = true; + labForCorp.LocationFloat = new DevExpress.Utils.PointFloat(482F, 16F); + labForCorp.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); + labForCorp.SizeF = new System.Drawing.SizeF(236F, 24F); + labForCorp.StylePriority.UseTextAlignment = false; + labForCorp.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; + this.TopMargin.Controls.Add(labForCorp); + + #endregion + + #region 椤佃剼 + + var pageForCurrentNum = new XRPageInfo(); + pageForCurrentNum.LocationFloat = new DevExpress.Utils.PointFloat(617F, 10.00001F); + pageForCurrentNum.Name = "椤佃剼"; + pageForCurrentNum.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); + pageForCurrentNum.SizeF = new System.Drawing.SizeF(100F, 23F); + pageForCurrentNum.StylePriority.UseTextAlignment = false; + pageForCurrentNum.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; + pageForCurrentNum.TextFormatString = "绗瑊0}椤�"; + this.BottomMargin.Controls.Add(pageForCurrentNum); + + #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.Multiline = true; + labForTitle.Name = "labTitle"; + labForTitle.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 96F); + labForTitle.SizeF = new System.Drawing.SizeF(727F, 50F); + labForTitle.StylePriority.UseFont = false; + labForTitle.StylePriority.UseTextAlignment = false; + labForTitle.Text = $"{vm.Project.Name}椤圭洰鑺傝兘鎶ュ憡"; + labForTitle.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; + this.Detail.Controls.Add(labForTitle); + locationY += 50F; + + #endregion + + #region 涓�銆侀」鐩杩� + + var labForDescription = CreateFirstCaption("涓�銆侀」鐩杩�", contentWidth, firstCaptionHeight, 0F, locationY); + this.Detail.Controls.Add(labForDescription); + locationY += firstCaptionHeight; + + #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.Multiline = true; + labForDescriptionContent.Name = "labForDescriptionContent"; + labForDescriptionContent.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 96F); + labForDescriptionContent.SizeF = new System.Drawing.SizeF(727F, 100F); + labForDescriptionContent.StylePriority.UseFont = false; + labForDescriptionContent.StylePriority.UseTextAlignment = false; + labForDescriptionContent.Text = $" {vm.Project.Description}"; + labForDescriptionContent.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft; + this.Detail.Controls.Add(labForDescriptionContent); + locationY += 100F; + + #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.Multiline = true; + labForPumpList.Name = "labForPumpList"; + labForPumpList.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); + labForPumpList.SizeF = new System.Drawing.SizeF(727F, 25F); + labForPumpList.StylePriority.UseFont = false; + labForPumpList.StylePriority.UseTextAlignment = false; + labForPumpList.Text = "浜屻�佹按娉垫槑缁�"; + labForPumpList.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft; + this.Detail.Controls.Add(labForPumpList); + locationY += 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); // 璁剧疆澶у皬 + + // 鍒涘缓琛ㄥご琛� + 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)); + + // 灏嗚〃澶磋娣诲姞鍒拌〃鏍� + tableForPumpList.Rows.Add(headerRowPumpList); + + //閬嶅巻姘存车 + foreach (var pump in vm.PumpList) + { + // 鍒涘缓鏁版嵁琛� + var dataRow = new XRTableRow(); + dataRow.Cells.Add(new XRTableCell() + { + Text = pump.Name, + WidthF = 100F, + TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter, + Borders = DevExpress.XtraPrinting.BorderSide.All + }); + dataRow.Cells.Add(new XRTableCell() + { + Text = pump.Code, + WidthF = 100F, + TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter, + Borders = DevExpress.XtraPrinting.BorderSide.All + }); + dataRow.Cells.Add(new XRTableCell() + { + Text = pump.RatedQ.ToString(), + WidthF = 100F, + TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter, + Borders = DevExpress.XtraPrinting.BorderSide.All + }); + dataRow.Cells.Add(new XRTableCell() + { + Text = pump.RatedH.ToString(), + WidthF = 100F, + TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter, + Borders = DevExpress.XtraPrinting.BorderSide.All + }); + dataRow.Cells.Add(new XRTableCell() + { + Text = pump.RatedP.ToString(), + WidthF = 100F, + TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter, + Borders = DevExpress.XtraPrinting.BorderSide.All + }); + dataRow.Cells.Add(new XRTableCell() + { + Text = pump.RatedN.ToString(), + WidthF = 100F, + TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter, + Borders = DevExpress.XtraPrinting.BorderSide.All + }); + tableForPumpList.Rows.Add(dataRow); + } + + // 灏嗚〃鏍兼坊鍔犲埌Detail + this.Detail.Controls.Add(tableForPumpList); + locationY += 30F; + locationY += 30F * vm.PumpList.Count; + } + + if (vm.WorkingList != null && vm.WorkingList.Count > 0) + { + foreach (var working in vm.WorkingList) + { + //XRChart chart = new XRChart(); + //chart.LocationF = new DevExpress.Utils.PointFloat(0F, locationY); + //chart.WidthF = contentWidth; + //chart.HeightF = 300F; + + //// 鍒涘缓涓�涓嚎绯诲垪 + //Series series = new Series("Series1", ViewType.Spline); + + //// 娣诲姞鏁版嵁鐐� + //foreach (var item in working.PumpAnaly.Items[0].RatedCurveQH) + //{ + // series.Points.Add(new SeriesPoint(item.X, item.Y)); + //} + + //chart.Series.Add(series); + + //Detail.Controls.Add(chart); + + var accuracyScaleChart = CreateAccuracyScale(working.Accuracy.Scale, 300F, 250F, locationY); + Detail.Controls.Add(accuracyScaleChart); + var accuracyFlowChart = CreateAccuracyItem(working.Accuracy.Flow?.AvgError ?? 0, 213F, 250F, 300F, locationY); + Detail.Controls.Add(accuracyFlowChart); + var accuracyPressChart = CreateAccuracyItem(working.Accuracy.Press?.AvgError ?? 0, 213F, 250F, 513F, locationY); + Detail.Controls.Add(accuracyPressChart); + + //var chart = new XRChart(); + //chart.BackColor = System.Drawing.Color.Transparent; + //chart.BorderColor = System.Drawing.Color.Black; + //chart.Borders = DevExpress.XtraPrinting.BorderSide.None; + ////chart.Legend.LegendID = -1; + //chart.Legend.Name = "Default Legend"; + //chart.Legend.Visibility = DevExpress.Utils.DefaultBoolean.False; + //chart.LocationFloat = new DevExpress.Utils.PointFloat(20F, locationY); + //chart.Name = "xrChart6"; + //chart.Padding = new DevExpress.XtraPrinting.PaddingInfo(10, 10, 20, 20, 96F); + //chart.PaletteRepository.Add("Palette 1", new DevExpress.XtraCharts.Palette("Palette 1", DevExpress.XtraCharts.PaletteScaleMode.Repeat, new DevExpress.XtraCharts.PaletteEntry[] { + //new DevExpress.XtraCharts.PaletteEntry(System.Drawing.Color.FromArgb(((int)(((byte)(103)))), ((int)(((byte)(174)))), ((int)(((byte)(197))))), System.Drawing.Color.FromArgb(((int)(((byte)(103)))), ((int)(((byte)(174)))), ((int)(((byte)(197)))))), + //new DevExpress.XtraCharts.PaletteEntry(System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(236)))), ((int)(((byte)(240))))), System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(236)))), ((int)(((byte)(240))))))})); + //chart.PaletteName = "Palette 1"; + + + + //var series = new DevExpress.XtraCharts.Series(); + //series.LabelsVisibility = DevExpress.Utils.DefaultBoolean.False; + //series.Name = "Series 1"; + ////series.SeriesID = 0; + //var doughnutSeriesView = new DevExpress.XtraCharts.DoughnutSeriesView(); + //doughnutSeriesView.HoleRadiusPercent = 45; + //doughnutSeriesView.TotalLabel.DXFont = new DevExpress.Drawing.DXFont("Tahoma", 12F, DevExpress.Drawing.DXFontStyle.Bold); + //doughnutSeriesView.TotalLabel.Visible = true; + //series.View = doughnutSeriesView; + //chart.SeriesSerializable = new DevExpress.XtraCharts.Series[] { series }; + //chart.SizeF = new System.Drawing.SizeF(175F, 185F); + //chart.StylePriority.UseBackColor = false; + //chart.StylePriority.UsePadding = false; + + //series.Points.Add(new SeriesPoint("璇樊", 15)); + //series.Points.Add(new SeriesPoint("鍏朵粬", 85)); + + //doughnutSeriesView.TotalLabel.TextPattern = string.Format("{0:0%}", 0.15); + + //this.Detail.Controls.Add(chart); + + + } + } + } + + //鍒涘缓涓�绾ф爣棰� + private XRLabel CreateFirstCaption(string caption, float sizeX, float sizeY, float locationX, float locationY) + { + var lab = new XRLabel(); + lab.AnchorHorizontal = (DevExpress.XtraReports.UI.HorizontalAnchorStyles.Left | DevExpress.XtraReports.UI.HorizontalAnchorStyles.Right); + lab.Font = new DevExpress.Drawing.DXFont("Arial", 12F, DevExpress.Drawing.DXFontStyle.Bold); + lab.LocationFloat = new DevExpress.Utils.PointFloat(locationX, locationY); + lab.Multiline = true; + lab.Name = "lab"; + lab.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); + lab.SizeF = new System.Drawing.SizeF(sizeX, sizeY); + lab.StylePriority.UseFont = false; + lab.StylePriority.UseTextAlignment = false; + lab.Text = caption; + lab.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft; + return lab; + } + + //鍒涘缓绮惧害姣斾緥 + private XRChart CreateAccuracyScale(SimulationPrintAccuracyScaleViewModel scale, float sizeX, float sizeY, float locationY) + { + var chart = new XRChart(); + chart.BackColor = System.Drawing.Color.Transparent; + chart.BorderColor = System.Drawing.Color.Black; + chart.Borders = DevExpress.XtraPrinting.BorderSide.All; + chart.Legend.Name = "Default Legend"; + chart.Legend.Visibility = DevExpress.Utils.DefaultBoolean.False; + chart.LocationFloat = new DevExpress.Utils.PointFloat(0F, locationY); + chart.Name = "chart"; + chart.Padding = new DevExpress.XtraPrinting.PaddingInfo(10, 10, 20, 20, 100F); + + var series = new DevExpress.XtraCharts.Series(); + series.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; + series.Name = "Series"; + var doughnutSeriesView = new DevExpress.XtraCharts.DoughnutSeriesView(); + doughnutSeriesView.HoleRadiusPercent = 45; + doughnutSeriesView.TotalLabel.DXFont = new DevExpress.Drawing.DXFont("Tahoma", 12F, DevExpress.Drawing.DXFontStyle.Bold); + doughnutSeriesView.TotalLabel.Visible = true; + series.View = doughnutSeriesView; + series.Label.LineVisibility = DevExpress.Utils.DefaultBoolean.True; + series.Label.TextPattern = "{A}锛歿VP:P1}"; + chart.SeriesSerializable = new DevExpress.XtraCharts.Series[] { series }; + chart.SizeF = new System.Drawing.SizeF(sizeX, sizeY); + chart.StylePriority.UseBackColor = false; + chart.StylePriority.UsePadding = false; + + if (scale.Items != null && scale.Items.Count > 0) + { + foreach (var item in scale.Items) + { + series.Points.Add(new SeriesPoint(item.EvaluateItem, item.EvaluateCount)); + } + } + doughnutSeriesView.TotalLabel.TextPattern = string.Format("{0:0%}", (scale.AvgError ?? 0) / 100F); + return chart; + } + + //鍒涘缓绮惧害椤� + private XRChart CreateAccuracyItem(double value, float sizeX, float sizeY, float locationX, float locationY) + { + var chart = new XRChart(); + chart.BackColor = System.Drawing.Color.Transparent; + chart.BorderColor = System.Drawing.Color.Black; + chart.Borders = DevExpress.XtraPrinting.BorderSide.All; + chart.Legend.Name = "Default Legend"; + chart.Legend.Visibility = DevExpress.Utils.DefaultBoolean.False; + chart.LocationFloat = new DevExpress.Utils.PointFloat(locationX, locationY); + chart.Name = "chart"; + chart.Padding = new DevExpress.XtraPrinting.PaddingInfo(10, 10, 20, 20, 100F); + chart.PaletteRepository.Add("Palette 1", new DevExpress.XtraCharts.Palette("Palette 1", DevExpress.XtraCharts.PaletteScaleMode.Repeat, new DevExpress.XtraCharts.PaletteEntry[] { + new DevExpress.XtraCharts.PaletteEntry(System.Drawing.Color.FromArgb(((int)(((byte)(103)))), ((int)(((byte)(174)))), ((int)(((byte)(197))))), System.Drawing.Color.FromArgb(((int)(((byte)(103)))), ((int)(((byte)(174)))), ((int)(((byte)(197)))))), + new DevExpress.XtraCharts.PaletteEntry(System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(236)))), ((int)(((byte)(240))))), System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(236)))), ((int)(((byte)(240))))))})); + chart.PaletteName = "Palette 1"; + + var series = new DevExpress.XtraCharts.Series(); + series.LabelsVisibility = DevExpress.Utils.DefaultBoolean.False; + series.Name = "Series"; + var doughnutSeriesView = new DevExpress.XtraCharts.DoughnutSeriesView(); + doughnutSeriesView.HoleRadiusPercent = 45; + doughnutSeriesView.TotalLabel.DXFont = new DevExpress.Drawing.DXFont("Tahoma", 12F, DevExpress.Drawing.DXFontStyle.Bold); + doughnutSeriesView.TotalLabel.Visible = true; + series.View = doughnutSeriesView; + chart.SeriesSerializable = new DevExpress.XtraCharts.Series[] { series }; + chart.SizeF = new System.Drawing.SizeF(sizeX, sizeY); + chart.StylePriority.UseBackColor = false; + chart.StylePriority.UsePadding = false; + + var otherValue = 100 - value; + series.Points.Add(new SeriesPoint("璇樊", value)); + series.Points.Add(new SeriesPoint("鍏朵粬", otherValue)); + + doughnutSeriesView.TotalLabel.TextPattern = string.Format("{0:0%}", value / 100f); + return chart; + } + + + // 鍒涘缓琛ㄥご鍗曞厓鏍� + 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; } diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/13-print/report/SimulationCommonReportDlg.Designer.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/13-print/report/SimulationCommonReportDlg.Designer.cs index 3ddfaaa..c7a6cab 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/13-print/report/SimulationCommonReportDlg.Designer.cs +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/13-print/report/SimulationCommonReportDlg.Designer.cs @@ -79,7 +79,7 @@ Ribbon = ribbon; RibbonVisibility = DevExpress.XtraBars.Ribbon.RibbonVisibility.Hidden; StartPosition = FormStartPosition.CenterParent; - Text = "鎬ц兘鏇茬嚎"; + Text = "鑺傝兘鎶ュ憡"; ((ISupportInitialize)ribbon).EndInit(); ResumeLayout(false); PerformLayout(); diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/Yw.WinFrmUI.Hydro.Core.csproj b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/Yw.WinFrmUI.Hydro.Core.csproj index c386c77..4951a48 100644 --- a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/Yw.WinFrmUI.Hydro.Core.csproj +++ b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/Yw.WinFrmUI.Hydro.Core.csproj @@ -404,6 +404,9 @@ <Compile Update="06-visual\18-valve\SetHydroValveDlg.cs"> <SubType>Form</SubType> </Compile> + <Compile Update="accuracy\scale\HydroAccuracyScaleChartCtrl.cs"> + <SubType>UserControl</SubType> + </Compile> <Compile Update="Properties\Resources.Designer.cs"> <DesignTime>True</DesignTime> <AutoGen>True</AutoGen> diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/accuracy/scale/HydroAccuracyScaleChartCtrl.Designer.cs b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/accuracy/scale/HydroAccuracyScaleChartCtrl.Designer.cs new file mode 100644 index 0000000..2f1978a --- /dev/null +++ b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/accuracy/scale/HydroAccuracyScaleChartCtrl.Designer.cs @@ -0,0 +1,94 @@ +锘縩amespace Yw.WinFrmUI +{ + partial class HydroAccuracyScaleChartCtrl + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + components = new Container(); + DevExpress.XtraCharts.Series series1 = new DevExpress.XtraCharts.Series(); + DevExpress.XtraCharts.DoughnutSeriesLabel doughnutSeriesLabel1 = new DevExpress.XtraCharts.DoughnutSeriesLabel(); + DevExpress.XtraCharts.DoughnutSeriesView doughnutSeriesView1 = new DevExpress.XtraCharts.DoughnutSeriesView(); + chartControl1 = new DevExpress.XtraCharts.ChartControl(); + hydroWorkingTotalEvaluationViewModelBindingSource = new BindingSource(components); + ((ISupportInitialize)chartControl1).BeginInit(); + ((ISupportInitialize)series1).BeginInit(); + ((ISupportInitialize)doughnutSeriesLabel1).BeginInit(); + ((ISupportInitialize)doughnutSeriesView1).BeginInit(); + ((ISupportInitialize)hydroWorkingTotalEvaluationViewModelBindingSource).BeginInit(); + SuspendLayout(); + // + // chartControl1 + // + chartControl1.DataSource = hydroWorkingTotalEvaluationViewModelBindingSource; + chartControl1.Dock = DockStyle.Fill; + chartControl1.Legend.LegendID = -1; + chartControl1.Legend.Visibility = DevExpress.Utils.DefaultBoolean.False; + chartControl1.Location = new Point(0, 0); + chartControl1.Name = "chartControl1"; + series1.ArgumentDataMember = "EvaluateItem"; + doughnutSeriesLabel1.LineVisibility = DevExpress.Utils.DefaultBoolean.True; + doughnutSeriesLabel1.TextPattern = "{A}锛歿VP:P1}"; + series1.Label = doughnutSeriesLabel1; + series1.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; + series1.Name = "Series 1"; + series1.SeriesID = 0; + series1.ValueDataMembersSerializable = "EvaluateCount"; + doughnutSeriesView1.TotalLabel.TextPattern = "鎬昏宸�"; + doughnutSeriesView1.TotalLabel.Visible = true; + series1.View = doughnutSeriesView1; + chartControl1.SeriesSerializable = new DevExpress.XtraCharts.Series[] + { + series1 + }; + chartControl1.Size = new Size(558, 434); + chartControl1.TabIndex = 0; + // + // hydroWorkingTotalEvaluationViewModelBindingSource + // + hydroWorkingTotalEvaluationViewModelBindingSource.DataSource = typeof(HydroWorkingTotalEvaluationViewModel); + // + // HydroAccuracyScaleChartCtrl + // + AutoScaleDimensions = new SizeF(7F, 14F); + AutoScaleMode = AutoScaleMode.Font; + Controls.Add(chartControl1); + Name = "HydroAccuracyScaleChartCtrl"; + Size = new Size(558, 434); + ((ISupportInitialize)doughnutSeriesLabel1).EndInit(); + ((ISupportInitialize)doughnutSeriesView1).EndInit(); + ((ISupportInitialize)series1).EndInit(); + ((ISupportInitialize)chartControl1).EndInit(); + ((ISupportInitialize)hydroWorkingTotalEvaluationViewModelBindingSource).EndInit(); + ResumeLayout(false); + } + + #endregion + + private DevExpress.XtraCharts.ChartControl chartControl1; + private BindingSource hydroWorkingTotalEvaluationViewModelBindingSource; + } +} diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/accuracy/scale/HydroAccuracyScaleChartCtrl.cs b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/accuracy/scale/HydroAccuracyScaleChartCtrl.cs new file mode 100644 index 0000000..0d22d42 --- /dev/null +++ b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/accuracy/scale/HydroAccuracyScaleChartCtrl.cs @@ -0,0 +1,65 @@ +锘縰sing DevExpress.Utils; +using DevExpress.XtraCharts; + +namespace Yw.WinFrmUI +{ + public partial class HydroAccuracyScaleChartCtrl : DevExpress.XtraEditors.XtraUserControl + { + public HydroAccuracyScaleChartCtrl() + { + InitializeComponent(); + } + + /// <summary> + /// 杈规鍙鎬� + /// </summary> + public bool BorderVisible + { + get + { + return this.chartControl1.BorderOptions.Visibility != DevExpress.Utils.DefaultBoolean.False; + } + set + { + this.chartControl1.BorderOptions.Visibility = value ? DefaultBoolean.Default : DefaultBoolean.False; + } + } + + private List<HydroWorkingTotalEvaluationViewModel> _allBindingList = null;//鎵�鏈夌粦瀹氬垪琛� + + /// <summary> + /// 缁戝畾鏁版嵁 + /// </summary> + public void SetBindingData(List<HydroWorkingMonitorEvaluationViewModel> allEvaluationList) + { + _allBindingList = new List<HydroWorkingTotalEvaluationViewModel>(); + if (allEvaluationList != null && allEvaluationList.Count > 0) + { + var allEvaluationHasList = allEvaluationList.Where(x => x.EvaluateError.HasValue).ToList(); + if (allEvaluationHasList.Count > 0) + { + var totalAvgValue = allEvaluationHasList.Average(x => x.EvaluateError.Value); + var seriesView = this.chartControl1.Series[0].View as DoughnutSeriesView; + seriesView.TotalLabel.TextPattern = $"{Math.Round(totalAvgValue, 1)}%"; + var groupList = allEvaluationHasList.GroupBy(x => x.EvaluateItem); + foreach (var group in groupList) + { + var avgValue = group.Average(x => x.EvaluateError.Value); + var vm = new HydroWorkingTotalEvaluationViewModel(); + vm.EvaluateItem = group.Key; + vm.EvaluateCount = group.Count(); + vm.EvaluateValue = Math.Round(avgValue, 1); + _allBindingList.Add(vm); + } + } + } + this.hydroWorkingTotalEvaluationViewModelBindingSource.DataSource = _allBindingList; + this.hydroWorkingTotalEvaluationViewModelBindingSource.ResetBindings(false); + } + + + + + + } +} diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/accuracy/scale/HydroAccuracyScaleChartCtrl.resx b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/accuracy/scale/HydroAccuracyScaleChartCtrl.resx new file mode 100644 index 0000000..f33ce33 --- /dev/null +++ b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/accuracy/scale/HydroAccuracyScaleChartCtrl.resx @@ -0,0 +1,123 @@ +锘�<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <metadata name="hydroWorkingTotalEvaluationViewModelBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> +</root> \ No newline at end of file diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/accuracy/scale/HydroAccuracyScaleItemViewModel.cs b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/accuracy/scale/HydroAccuracyScaleItemViewModel.cs new file mode 100644 index 0000000..1653174 --- /dev/null +++ b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/accuracy/scale/HydroAccuracyScaleItemViewModel.cs @@ -0,0 +1,25 @@ +锘縩amespace Yw.WinFrmUI +{ + /// <summary> + /// 绮惧害姣斾緥椤硅鍥� + /// </summary> + public class HydroAccuracyScaleItemViewModel + { + /// <summary> + /// 璇勪及椤� + /// </summary> + public string EvaluateItem { get; set; } + + /// <summary> + /// 璇勪及鏁伴噺 + /// </summary> + public int EvaluateCount { get; set; } + + /// <summary> + /// 璇勪及鍊� + /// </summary> + public double EvaluateValue { get; set; } + + + } +} -- Gitblit v1.9.3