duheng
2025-02-19 ad8f813f5eddd66740b4e09801e4ea02ddf70a4a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
using DevExpress.Charts.Native;
using DevExpress.Utils;
using DevExpress.XtraCharts;
using DevExpress.XtraReports.UI;
 
namespace HStation.WinFrmUI
{
    public partial class XtraReport1 : DevExpress.XtraReports.UI.XtraReport
    {
        public XtraReport1()
        {
            InitializeComponent();
        }
 
        private SimulationPrintViewModel _printViewModel;
 
        public void SetBingdingData(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; // 一级标题高度
            float pageHeight = 1069F; // 页面可用高度
            float currentY = 0F; // 当前Y坐标
 
            #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 标题
 
            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, currentY);
            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);
            currentY += 50F;
 
            #endregion 标题
 
            #region 一、项目概述
 
            var labForDescription = CreateFirstCaption("一、项目概述", contentWidth, firstCaptionHeight, 0F, currentY);
            this.Detail.Controls.Add(labForDescription);
            currentY += 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, currentY);
            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);
            currentY += 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, currentY);
            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);
            currentY += 25F;
 
            // 水泵明细内容
            if (vm.PumpList != null && vm.PumpList.Count > 0)
            {
                // 创建 XRTable
                var tableForPumpList = new XRTable();
                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("额定功率(KW)", 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);
                currentY += tableForPumpList.HeightF;
                //currentY += vm.PumpList.Count*10;
            }
 
            var labForWorking = CreateFirstCaption("三、工况视图", contentWidth, firstCaptionHeight, 0F, currentY);
            this.Detail.Controls.Add(labForWorking);
            currentY += firstCaptionHeight;
            var labForAccuracy = CreateFirstCaption("(1)、精度评估", contentWidth - 25F, 15F, 20F, currentY);
            this.Detail.Controls.Add(labForAccuracy);
            currentY += firstCaptionHeight;
            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, currentY);
                    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);
                    Series series2 = new Series("Series2", ViewType.Spline);
                    // 添加数据点
                    foreach (var item in working.PumpAnaly.Items[0].CurrentCurveQE)
                    {
                        series2.Points.Add(new SeriesPoint(item.X, item.Y));
                    }
                    chart.Series.Add(series2);
                    Series series3 = new Series("Series3", ViewType.Spline);
                    // 添加数据点
                    foreach (var item in working.PumpAnaly.Items[0].CurrentCurveQP)
                    {
                        series3.Points.Add(new SeriesPoint(item.X, item.Y));
                    }
                    chart.Series.Add(series3);
 
                    Detail.Controls.Add(chart);
                    currentY += chart.HeightF;*/
                    /*          var accuracyFlowChart = CreateAccuracyItem(working.Accuracy.Flow?.AvgError ?? 0, 213F, 250F, 300F, currentY);
                              if (currentY + accuracyFlowChart.HeightF > pageHeight)
                              {
                                  accuracyFlowChart.LocationF = new DevExpress.Utils.PointFloat(accuracyFlowChart.LocationF.X, currentY);
                              }
                              Detail.Controls.Add(accuracyFlowChart);
                              currentY += accuracyFlowChart.HeightF;
 
                              var accuracyPressChart = CreateAccuracyItem(working.Accuracy.Press?.AvgError ?? 0, 213F, 250F, 513F, currentY);
                              if (currentY + accuracyPressChart.HeightF > pageHeight)
                              {
                                  accuracyPressChart.LocationF = new DevExpress.Utils.PointFloat(accuracyPressChart.LocationF.X, currentY);
                              }
                              Detail.Controls.Add(accuracyPressChart);
                              currentY += accuracyPressChart.HeightF;*/
                    var accuracyScaleChart = CreateAccuracyScale(working.Accuracy.Scale, 300F, 230F, currentY);
                    Detail.Controls.Add(accuracyScaleChart);
                    var accuracyFlowChart = CreateAccuracyItem(working.Accuracy.Flow?.AvgError ?? 0, 213F, 230F, 300F, currentY);
                    Detail.Controls.Add(accuracyFlowChart);
                    var accuracyPressChart = CreateAccuracyItem(working.Accuracy.Press?.AvgError ?? 0, 213F, 230F, 513F, currentY);
                    Detail.Controls.Add(accuracyPressChart);
                    currentY += accuracyScaleChart.HeightF;
                }
                currentY += 20F;
            }
            var labForAccuracyList = CreateFirstCaption("(1.1)、评估列表", contentWidth - 25F, 15F, 20F, currentY);
            this.Detail.Controls.Add(labForAccuracyList);
            currentY += firstCaptionHeight;
 
            #region 评估列表
 
            if (vm.WorkingList != null && vm.WorkingList.Count > 0)
            {
                foreach (var working in vm.WorkingList)
                {
                    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(CreateTableCell("评估构件", 100));
                        headerRowAccuracyList.Cells.Add(CreateTableCell("评估项", 100));
                        headerRowAccuracyList.Cells.Add(CreateTableCell("监测值", 100));
                        headerRowAccuracyList.Cells.Add(CreateTableCell("计算值", 100));
                        headerRowAccuracyList.Cells.Add(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,
                                Borders = DevExpress.XtraPrinting.BorderSide.All
                            });
                            tableForAccuracyList.Rows.Add(dataRow);
                        }
                        // 将表格添加到Detail
                        this.Detail.Controls.Add(tableForAccuracyList);
                        currentY += tableForAccuracyList.HeightF;
                    }
                }
                currentY += 20F;
            }
 
            #endregion 评估列表
 
            #region 水泵分析
 
            var labForPump = CreateFirstCaption("(2)、水泵分析", contentWidth - 25F, 15F, 20F, currentY);
            this.Detail.Controls.Add(labForPump);
            currentY += 20F;
            if (vm.WorkingList != null && vm.WorkingList.Count > 0)
            {
                foreach (var working in vm.WorkingList)
                {
                    if (working.PumpAnaly != null && working.PumpAnaly.Items != null && working.PumpAnaly.Items.Count > 0)
                    {
                        foreach (var item in working.PumpAnaly.Items)
                        {
                            var label = CreateFirstCaption(item.Name, 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 = 700F;
                            chart.Legend.Visibility = DevExpress.Utils.DefaultBoolean.False;
 
                            // 创建 XY 图表
                            XYDiagram xyDiagram = new XYDiagram();
                            ((System.ComponentModel.ISupportInitialize)(xyDiagram)).BeginInit();
                            // 设置 X 轴主要网格线可见
                            xyDiagram.AxisX.GridLines.Visible = true;
                            // 设置 X 轴主要刻度间隔,可根据需求调整该值,值越小网格越密
                            xyDiagram.AxisX.Tickmarks.Thickness = 1;
                            // 设置 Y 轴主要网格线可见
                            xyDiagram.AxisY.GridLines.Visible = true;
                            // 设置 Y 轴主要刻度间隔,可根据需求调整该值,值越小网格越密
                            xyDiagram.AxisX.Tickmarks.Thickness = 1;
 
                            // 配置主 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);
 
                            chart.Diagram = xyDiagram;
                            ((System.ComponentModel.ISupportInitialize)(xyDiagram)).EndInit();
                            ((System.ComponentModel.ISupportInitialize)(chart)).EndInit();
 
                            // 创建第一个系列
                            Series series1 = new Series("Series 1", ViewType.Spline);
                            foreach (var qh in item.RatedCurveQH)
                            {
                                series1.Points.Add(new SeriesPoint(qh.X, qh.Y));
                            }
                            series1.LabelsVisibility = DefaultBoolean.False;
                            chart.Series.Add(series1);
                            // 创建第二个系列
                            Series series2 = new Series("Series 2", ViewType.Spline);
                            foreach (var qe in item.RatedCurveQE)
                            {
                                series2.Points.Add(new SeriesPoint(qe.X, qe.Y));
                            }
((XYDiagramSeriesViewBase)series2.View).Pane = pane2;
                            ((XYDiagramSeriesViewBase)series2.View).AxisY = secondaryAxisY2;
                            series2.LabelsVisibility = DefaultBoolean.False;
                            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));
                            }
((XYDiagramSeriesViewBase)series3.View).Pane = pane1;
                            ((XYDiagramSeriesViewBase)series3.View).AxisY = secondaryAxisY1;
                            series3.LabelsVisibility = DefaultBoolean.False;
                            chart.Series.Add(series3);
 
                            Detail.Controls.Add(chart);
                            currentY += chart.HeightF;
                        }
                    }
                }
                currentY += 20F;
            }
 
            #endregion 水泵分析
 
            #region 监测分析
 
            var labForMonitor = CreateFirstCaption("(3)、监测分析", contentWidth - 25F, 15F, 20F, currentY);
            this.Detail.Controls.Add(labForMonitor);
            currentY += 20F;
            if (vm.WorkingList != null && vm.WorkingList.Count > 0)
            {
                foreach (var working in vm.WorkingList)
                {
                    if (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(CreateTableCell("构件", 100));
                        headerRowMonitorList.Cells.Add(CreateTableCell("属性", 100));
                        headerRowMonitorList.Cells.Add(CreateTableCell("计算值", 100));
                        headerRowMonitorList.Cells.Add(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 = CreateFirstCaption("(4)、能耗分析", contentWidth - 25F, 15F, 20F, currentY);
            this.Detail.Controls.Add(labForEnergyAnaly);
            currentY += 20F;
            if (vm.WorkingList != null && vm.WorkingList.Count > 0)
            {
                foreach (var working in vm.WorkingList)
                {
                    if (working.EnergyAnaly != null)
                    {
                        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 = 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.GridLines.Visible = true;
                                // 设置 X 轴主要刻度间隔,可根据需求调整该值,值越小网格越密
                                xyDiagram.AxisX.Tickmarks.Thickness = 1;
                                // 设置 Y 轴主要网格线可见
                                xyDiagram.AxisY.GridLines.Visible = true;
                                // 设置 Y 轴主要刻度间隔,可根据需求调整该值,值越小网格越密
                                xyDiagram.AxisX.Tickmarks.Thickness = 1;
                                // 配置主 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.AxisY.Alignment = AxisAlignment.Zero; // 设置 Y 轴与 X 轴共用零点
 
                                // 创建两个面板
                                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);
 
                                chart.Diagram = xyDiagram;
                                ((System.ComponentModel.ISupportInitialize)(xyDiagram)).EndInit();
                                ((System.ComponentModel.ISupportInitialize)(chart)).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));
                                        }
                                        series1.LabelsVisibility = DefaultBoolean.False;
                                        chart.Series.Add(series1);
                                    }
                                    // 创建第二个系列
                                    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;
                                        series2.LabelsVisibility = DefaultBoolean.False;
                                        chart.Series.Add(series2);
                                    }
                                    // 创建第三个系列
                                    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;
                                        series3.LabelsVisibility = DefaultBoolean.False;
                                        chart.Series.Add(series3);
                                    }
                                }
                                Detail.Controls.Add(chart);
                                currentY += chart.HeightF;
                            }
                        }
                    }
                }
            }
 
            #endregion 能耗分析
 
            //能效明细
            var labForEnergyDetails = CreateFirstCaption("(4.1)、能效明细", contentWidth - 25F, 15F, 20F, currentY);
            this.Detail.Controls.Add(labForEnergyDetails);
            currentY += 20F;
            if (vm.WorkingList != null && vm.WorkingList.Count > 0)
            {
                foreach (var working in vm.WorkingList)
                {
                    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(CreateTableCell("分组", 100));
                        headerRowEnergyDetails.Cells.Add(CreateTableCell("名称", 100));
                        headerRowEnergyDetails.Cells.Add(CreateTableCell("运行状态", 100));
                        headerRowEnergyDetails.Cells.Add(CreateTableCell("设定频率(hz)", 100));
                        headerRowEnergyDetails.Cells.Add(CreateTableCell("设定流量(m³/h)", 100));
                        headerRowEnergyDetails.Cells.Add(CreateTableCell("进口压力(m)", 100));
                        headerRowEnergyDetails.Cells.Add(CreateTableCell("出口压力(m)", 100));
                        headerRowEnergyDetails.Cells.Add(CreateTableCell("扬程(m)", 100));
                        headerRowEnergyDetails.Cells.Add(CreateTableCell("功率(Kw)", 100));
                        headerRowEnergyDetails.Cells.Add(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 = 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 = CreateFirstCaption("(5)、损失曲线", contentWidth - 25F, 15F, 20F, currentY);
            this.Detail.Controls.Add(labForLossCurve);
            currentY += 20F;
            if (vm.WorkingList != null && vm.WorkingList.Count > 0)
            {
                foreach (var working in vm.WorkingList)
                {
                    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;
                        // 添加数据点
                        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 = CreateFirstCaption("(6)、损失统计", contentWidth - 25F, 15F, 20F, currentY);
            this.Detail.Controls.Add(labForLossStatistics);
            currentY += 20F;
            if (vm.WorkingList != null && vm.WorkingList.Count > 0)
            {
                foreach (var working in vm.WorkingList)
                {
                    var accuracyScaleChart = CreateLossStatistics(working.LossStatistics, 350F, 230F, 0F, currentY);
                    Detail.Controls.Add(accuracyScaleChart);
                    var EnergyLossChart = CreateEnergyLoss(working.LossStatistics, 377F, 230F, 350F, currentY);
                    Detail.Controls.Add(EnergyLossChart);
                    currentY += accuracyScaleChart.HeightF;
                    var CategoryChart = CreateCategory(working.LossStatistics, 727F, 230F, 0F, currentY);
                    Detail.Controls.Add(CategoryChart);
                    currentY += CategoryChart.HeightF;
                }
            }
 
            #endregion 损失统计
        }
 
        //创建一级标题
        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 != null)
            {
                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 CreateLossStatistics(HydroLossStatisticsViewModel statistics, 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);
 
            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", 8F, 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 (statistics != null)
            {
                if (statistics.Input.Items != null && statistics.Input.Items.Count > 0)
                {
                    foreach (var item in statistics.Input.Items)
                    {
                        series.Points.Add(new SeriesPoint(item.EnergyName.ToString(), item.EnergyValue));
                    }
                }
                doughnutSeriesView.TotalLabel.TextPattern = $"总能量:{statistics.Input.TotalEnergyValue:P0}";
            }
            return chart;
        }
 
        //创建能量统计
        private XRChart CreateCategory(HydroLossStatisticsViewModel statistics, 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.SizeF = new System.Drawing.SizeF(sizeX, sizeY);
            chart.StylePriority.UseBackColor = false;
            chart.StylePriority.UsePadding = false;
            if (statistics != null)
            {
                if (statistics.Category != null && statistics.Category.Items.Count > 0)
                {
                    foreach (var item in statistics.Category.Items)
                    {
                        var series1 = new Series(item.EnergyName, ViewType.Bar);
                        series1.Points.Add(new SeriesPoint(item.EnergyName.ToString(), item.EnergyValue));
                        // 获取系列视图并转换为 BarSeriesView 类型
                        BarSeriesView barSeriesView = (BarSeriesView)series1.View;
                        series1.Label.TextPattern = "{V} KW";
                        // 设置柱子宽度,这里设置为 0.8,可根据需要调整
                        barSeriesView.BarWidth = 2.5;
                        // 将系列添加到图表中
                        chart.Series.Add(series1);
                    }
                }
            }
            return chart;
        }
 
        //创建能量损失
        private XRChart CreateEnergyLoss(HydroLossStatisticsViewModel statistics, 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);
 
            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", 8F, 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 (statistics != null)
            {
                if (statistics.Catalog != null && statistics.Catalog.Items.Count > 0)
                {
                    foreach (var item in statistics.Catalog.Items)
                    {
                        series.Points.Add(new SeriesPoint(item.EnergyName.ToString(), item.EnergyValue));
                    }
                }
                doughnutSeriesView.TotalLabel.TextPattern = $"总损失:{statistics.Input.TotalEnergyValue:P0}";
            }
            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;
        }
    }
}