Procházet zdrojové kódy

优化报告浏览部分代码增加夹杂物表的整合部分功能,优化清洁度类别显示部分代码增加组的概念显示

zhangjiaxin před 4 měsíci
rodič
revize
77d069c737

+ 77 - 64
OTSIncAReportApp/1-UI/FormStandardLibraryInformation.Designer.cs

@@ -28,69 +28,81 @@
         /// </summary>
         private void InitializeComponent()
         {
-            this.panel1 = new System.Windows.Forms.Panel();
-            this.listView1 = new System.Windows.Forms.ListView();
-            this.label1 = new System.Windows.Forms.Label();
-            this.label2 = new System.Windows.Forms.Label();
-            this.panel1.SuspendLayout();
-            this.SuspendLayout();
-            // 
-            // panel1
-            // 
-            this.panel1.AutoScroll = true;
-            this.panel1.Controls.Add(this.label2);
-            this.panel1.Controls.Add(this.label1);
-            this.panel1.Controls.Add(this.listView1);
-            this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.panel1.Location = new System.Drawing.Point(0, 0);
-            this.panel1.Name = "panel1";
-            this.panel1.Size = new System.Drawing.Size(284, 450);
-            this.panel1.TabIndex = 0;
-            // 
-            // listView1
-            // 
-            this.listView1.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.listView1.HideSelection = false;
-            this.listView1.Location = new System.Drawing.Point(0, 0);
-            this.listView1.Name = "listView1";
-            this.listView1.Size = new System.Drawing.Size(284, 450);
-            this.listView1.TabIndex = 0;
-            this.listView1.UseCompatibleStateImageBehavior = false;
-            // 
-            // label1
-            // 
-            this.label1.AutoSize = true;
-            this.label1.BackColor = System.Drawing.Color.Transparent;
-            this.label1.Location = new System.Drawing.Point(58, 9);
-            this.label1.Name = "label1";
-            this.label1.Size = new System.Drawing.Size(41, 12);
-            this.label1.TabIndex = 1;
-            this.label1.Text = "分类名";
-            // 
-            // label2
-            // 
-            this.label2.AutoSize = true;
-            this.label2.BackColor = System.Drawing.Color.Transparent;
-            this.label2.Location = new System.Drawing.Point(201, 9);
-            this.label2.Name = "label2";
-            this.label2.Size = new System.Drawing.Size(29, 12);
-            this.label2.TabIndex = 2;
-            this.label2.Text = "颜色";
-            // 
-            // FormStandardLibraryInformation
-            // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
-            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(284, 450);
-            this.Controls.Add(this.panel1);
-            this.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.Name = "FormStandardLibraryInformation";
-            this.Text = "标准库信息";
-            this.Activated += new System.EventHandler(this.FormStandardLibraryInformation_Activated);
-            this.Load += new System.EventHandler(this.FormStandardLibraryInformation_Load);
-            this.panel1.ResumeLayout(false);
-            this.panel1.PerformLayout();
-            this.ResumeLayout(false);
+			this.panel1 = new System.Windows.Forms.Panel();
+			this.label2 = new System.Windows.Forms.Label();
+			this.label1 = new System.Windows.Forms.Label();
+			this.listView1 = new System.Windows.Forms.ListView();
+			this.label3 = new System.Windows.Forms.Label();
+			this.panel1.SuspendLayout();
+			this.SuspendLayout();
+			// 
+			// panel1
+			// 
+			this.panel1.AutoScroll = true;
+			this.panel1.Controls.Add(this.label3);
+			this.panel1.Controls.Add(this.label2);
+			this.panel1.Controls.Add(this.label1);
+			this.panel1.Controls.Add(this.listView1);
+			this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
+			this.panel1.Location = new System.Drawing.Point(0, 0);
+			this.panel1.Name = "panel1";
+			this.panel1.Size = new System.Drawing.Size(284, 450);
+			this.panel1.TabIndex = 0;
+			// 
+			// label2
+			// 
+			this.label2.AutoSize = true;
+			this.label2.BackColor = System.Drawing.Color.Transparent;
+			this.label2.Location = new System.Drawing.Point(243, 9);
+			this.label2.Name = "label2";
+			this.label2.Size = new System.Drawing.Size(29, 12);
+			this.label2.TabIndex = 2;
+			this.label2.Text = "颜色";
+			// 
+			// label1
+			// 
+			this.label1.AutoSize = true;
+			this.label1.BackColor = System.Drawing.Color.Transparent;
+			this.label1.Location = new System.Drawing.Point(137, 9);
+			this.label1.Name = "label1";
+			this.label1.Size = new System.Drawing.Size(41, 12);
+			this.label1.TabIndex = 1;
+			this.label1.Text = "分类名";
+			// 
+			// listView1
+			// 
+			this.listView1.Dock = System.Windows.Forms.DockStyle.Fill;
+			this.listView1.HideSelection = false;
+			this.listView1.Location = new System.Drawing.Point(0, 0);
+			this.listView1.Name = "listView1";
+			this.listView1.Size = new System.Drawing.Size(284, 450);
+			this.listView1.TabIndex = 0;
+			this.listView1.UseCompatibleStateImageBehavior = false;
+			// 
+			// label3
+			// 
+			this.label3.AutoSize = true;
+			this.label3.BackColor = System.Drawing.Color.Transparent;
+			this.label3.Location = new System.Drawing.Point(33, 9);
+			this.label3.Name = "label3";
+			this.label3.Size = new System.Drawing.Size(41, 12);
+			this.label3.TabIndex = 3;
+			this.label3.Text = "分组名";
+			// 
+			// FormStandardLibraryInformation
+			// 
+			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+			this.ClientSize = new System.Drawing.Size(284, 450);
+			this.Controls.Add(this.panel1);
+			this.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+			this.Name = "FormStandardLibraryInformation";
+			this.Text = "标准库信息";
+			this.Activated += new System.EventHandler(this.FormStandardLibraryInformation_Activated);
+			this.Load += new System.EventHandler(this.FormStandardLibraryInformation_Load);
+			this.panel1.ResumeLayout(false);
+			this.panel1.PerformLayout();
+			this.ResumeLayout(false);
 
         }
 
@@ -100,5 +112,6 @@
         private System.Windows.Forms.ListView listView1;
         private System.Windows.Forms.Label label2;
         private System.Windows.Forms.Label label1;
-    }
+		private System.Windows.Forms.Label label3;
+	}
 }

+ 27 - 11
OTSIncAReportApp/1-UI/FormStandardLibraryInformation.cs

@@ -1,4 +1,5 @@
 using DevExpress.Utils;
+using DevExpress.XtraDiagram.Bars;
 using OTS.WinFormsUI.Docking;
 using OTSCommon.DBOperate;
 using OTSIncAReportApp.OTSRstMgrFunction;
@@ -40,14 +41,16 @@ namespace OTSIncAReportApp._1_UI
         {
             label1.Text = " ";
             label2.Text = " ";
-            // 设置ListView为详细视图
-            listView1.View = View.Details;
+			label3.Text = " ";
+			// 设置ListView为详细视图
+			listView1.View = View.Details;
             listView1.FullRowSelect = true; // 可选,设置是否选择整行
             listView1.GridLines = true; // 可选,设置是否显示网格线
             listView1.Columns.Clear();
-            listView1.Columns.Add(" ", 170, HorizontalAlignment.Left);
-            listView1.Columns.Add(" ", 100, HorizontalAlignment.Left);
-            listView1.Items.Clear();
+            listView1.Columns.Add(" ", 90, HorizontalAlignment.Left);
+            listView1.Columns.Add(" ", 130, HorizontalAlignment.Left);
+			listView1.Columns.Add(" ", 70, HorizontalAlignment.Left);
+			listView1.Items.Clear();
             DataLoad();
         }
 
@@ -99,8 +102,10 @@ namespace OTSIncAReportApp._1_UI
                 {
                     listView1.Items.Clear();
                     DataTable dt_stl = new DataTable();
+                    DataTable Dt_grouping = new DataTable();
 
-                    if (result[0] == "3")
+
+					if (result[0] == "3")
                     {
 						SqLiteHelper sh = new SqLiteHelper("data source='" + LibraryName[i][1] + "'");
 
@@ -132,14 +137,24 @@ namespace OTSIncAReportApp._1_UI
 						}
 
 						dt_stl = sh.ExecuteQuery("select * from ClassifySTD");
+						Dt_grouping= sh.ExecuteQuery("select * from STDGroups");
 						m_data = dt_stl.Copy();
 						for (int a = 0; a < dt_stl.Rows.Count; a++)
 						{
-							ListViewItem item1 = new ListViewItem(dt_stl.Rows[a]["StrName"].ToString());
+                            string grouping = "";
+                            for (int b = 0; b < Dt_grouping.Rows.Count; b++)
+                            {
+                                if (dt_stl.Rows[a]["GroupId"].ToString() == Dt_grouping.Rows[b]["id"].ToString())
+                                {
+                                    grouping = Dt_grouping.Rows[b]["name"].ToString();
+								}
+                            }
+							ListViewItem item1 = new ListViewItem(grouping/*,dt_stl.Rows[a]["StrName"].ToString()*/);
+                            item1.SubItems.Add(dt_stl.Rows[a]["StrName"].ToString());
 							item1.SubItems.Add(dt_stl.Rows[a]["Color"].ToString());
 
 							item1.UseItemStyleForSubItems = false; // 允许为每个 SubItem 设置不同的样式
-							item1.SubItems[1].BackColor = Color.LightBlue; // 这将不会生效,除非我们处理 OwnerDraw
+							item1.SubItems[2].BackColor = Color.LightBlue; // 这将不会生效,除非我们处理 OwnerDraw
 							listView1.Items.Add(item1);
 						}
 						break;
@@ -150,8 +165,9 @@ namespace OTSIncAReportApp._1_UI
             }
             label1.Text = "分类名";
             label2.Text = "颜色";
-            // 由于 ListViewItem 不直接支持为 SubItem 设置背景色,我们需要启用 OwnerDrawFixed 模式
-            listView1.OwnerDraw = true;
+			label3.Text = "分组名";
+			// 由于 ListViewItem 不直接支持为 SubItem 设置背景色,我们需要启用 OwnerDrawFixed 模式
+			listView1.OwnerDraw = true;
             listView1.DrawItem += new DrawListViewItemEventHandler(ListView1_DrawItem);
             listView1.DrawSubItem += new DrawListViewSubItemEventHandler(ListView1_DrawSubItem);
 
@@ -185,7 +201,7 @@ namespace OTSIncAReportApp._1_UI
         private void ListView1_DrawSubItem(object sender, DrawListViewSubItemEventArgs e)
         {
             // 检查是否是我们要自定义颜色的那一列
-            if (e.ColumnIndex == 1) // 第二列的索引是 1
+            if (e.ColumnIndex == 2) // 第二列的索引是 1
             {
                 Color color = ColorTranslator.FromHtml(e.SubItem.Text);
 

+ 33 - 2
OTSIncAReportApp/1-UI/OTSReportExport/Template/DataTemplate.cs

@@ -2147,7 +2147,9 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
                 list_AreaOfInclusion.Add(set_AreaOfInclusion(subscript.Getsubscriptstring(a_data.Rows[i]["Class"].ToString()), subscript.Getsubscriptstring(a_data.Rows[i]["subdivision"].ToString()), a_data.Rows[i]["Area"].ToString(), a_data.Rows[i]["inca_proportion"].ToString(),
                     a_data.Rows[i]["inca_FieldRatio"].ToString()));
             }
-            for (int i = 0; i < a_data.Rows.Count; i++)
+            double area_total = 0;
+            float Fieldratio = 0;
+			for (int i = 0; i < a_data.Rows.Count; i++)
             {
                 XRTableRow row = new XRTableRow();
                 XRTableCell tCell_classify = new XRTableCell();
@@ -2161,8 +2163,37 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
                 XRTableCellData_AreaOfInclusion(row, tCell_inca_proportion, Schriftart_english, DevExpress.XtraPrinting.TextAlignment.MiddleCenter, "Text", list_AreaOfInclusion[i], "inca_proportion");
                 XRTableCellData_AreaOfInclusion(row, tCell_inca_FieldRatio, Schriftart_english, DevExpress.XtraPrinting.TextAlignment.MiddleCenter, "Text", list_AreaOfInclusion[i], "inca_FieldRatio");
                 xRTable.Rows.Add(row);
+
+                if (a_data.Rows[i]["Class"].ToString() != "")
+                {
+                    area_total = area_total + Convert.ToDouble(a_data.Rows[i]["Area"]);
+					Fieldratio = Fieldratio+ float.Parse(a_data.Rows[i]["inca_FieldRatio"].ToString());
+				}
+
             }
-            xRTable.LocationF = new PointF(10f, NeueStartposition);
+			XRTableRow row_z = new XRTableRow();
+			XRTableCell tCell_classify_z = new XRTableCell();
+			tCell_classify_z.WidthF = 267.2f;
+            tCell_classify_z.Text = "统计";
+			XRTableCell tCell_area_z = new XRTableCell();
+			tCell_area_z.WidthF = 133.6f;
+            tCell_area_z.Text = area_total.ToString();
+			XRTableCell tCell_inca_proportion_z = new XRTableCell();
+			tCell_inca_proportion_z.WidthF = 133.6f;
+            tCell_inca_proportion_z.Text = "100%";
+			XRTableCell tCell_inca_FieldRatio_z = new XRTableCell();
+			tCell_inca_FieldRatio_z.WidthF = 133.6f;
+            tCell_inca_FieldRatio_z.Text = Fieldratio.ToString()+"%";
+			row_z.WidthF = 668f;
+			row_z.Borders = DevExpress.XtraPrinting.BorderSide.All;
+			row_z.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter;
+			row_z.Controls.Add(tCell_classify_z);
+			row_z.Controls.Add(tCell_area_z);
+			row_z.Controls.Add(tCell_inca_proportion_z);
+			row_z.Controls.Add(tCell_inca_FieldRatio_z);
+			xRTable.Rows.Add(row_z);
+
+			xRTable.LocationF = new PointF(10f, NeueStartposition);
             NeueStartposition = xRTable.LocationF.Y + xRTable.SizeF.Height;
             this.Detail.Controls.Add(xRTable);
         }