|
@@ -47,6 +47,10 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
|
|
|
|
|
|
m_list_dt = new List<DataTable>();
|
|
|
}
|
|
|
+ public Export_ReportTemplate()
|
|
|
+ {
|
|
|
+ m_list_dt = new List<DataTable>();
|
|
|
+ }
|
|
|
#endregion
|
|
|
|
|
|
#region 插入测量结果Grid表格
|
|
@@ -676,6 +680,7 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
+ ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.GetWorkingResult()].FilePath);
|
|
|
//加载模块
|
|
|
ParticlesSizeGrid ls_particlesizegrid = new ParticlesSizeGrid(m_otsreport_export.m_ReportApp);
|
|
|
List<string> vs = new List<string>() { "DMAX", "DMIN", "CIRCLE", "FERET" };
|
|
@@ -706,48 +711,48 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
|
|
|
for (int i = 1; i < 11; i++)
|
|
|
{
|
|
|
if (ls_gv.Columns.Count > col)
|
|
|
- if (i<10)
|
|
|
+ if (i < 10)
|
|
|
dr["c" + i.ToString()] = ls_gv.Columns[col++].Name;
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
ls_partsize_dt.Rows.Add(dr);
|
|
|
|
|
|
DataTable ls_Particel_dt = new DataTable();
|
|
|
ls_Particel_dt.TableName = "Particel";
|
|
|
- ls_Particel_dt.Columns.Add("c1");
|
|
|
- ls_Particel_dt.Columns.Add("c2");
|
|
|
- ls_Particel_dt.Columns.Add("c3");
|
|
|
- ls_Particel_dt.Columns.Add("c4");
|
|
|
- ls_Particel_dt.Columns.Add("c5");
|
|
|
- ls_Particel_dt.Columns.Add("c6");
|
|
|
- ls_Particel_dt.Columns.Add("c7");
|
|
|
- ls_Particel_dt.Columns.Add("c8");
|
|
|
- ls_Particel_dt.Columns.Add("c9");
|
|
|
- ls_Particel_dt.Columns.Add("SName");
|
|
|
- ls_Particel_dt.Columns.Add("total");
|
|
|
- ls_Particel_dt.Columns.Add("Largest");
|
|
|
- ls_Particel_dt.Columns.Add("Hardness");
|
|
|
- ls_Particel_dt.Columns.Add("Density");
|
|
|
- ls_Particel_dt.Columns.Add("Conductivity");
|
|
|
+
|
|
|
+ ls_Particel_dt.Columns.Add("c1", typeof(double));
|
|
|
+ ls_Particel_dt.Columns.Add("c2", typeof(double));
|
|
|
+ ls_Particel_dt.Columns.Add("c3", typeof(double));
|
|
|
+ ls_Particel_dt.Columns.Add("c4", typeof(double));
|
|
|
+ ls_Particel_dt.Columns.Add("c5", typeof(double));
|
|
|
+ ls_Particel_dt.Columns.Add("c6", typeof(double));
|
|
|
+ ls_Particel_dt.Columns.Add("c7", typeof(double));
|
|
|
+ ls_Particel_dt.Columns.Add("c8", typeof(double));
|
|
|
+ ls_Particel_dt.Columns.Add("c9", typeof(double));
|
|
|
+ ls_Particel_dt.Columns.Add("Name");
|
|
|
+ ls_Particel_dt.Columns.Add("total", typeof(double));
|
|
|
+ ls_Particel_dt.Columns.Add("TypeId");
|
|
|
+ ls_Particel_dt.Columns.Add("Class");
|
|
|
for (int i = 0; i < ls_gv.Rows.Count; i++)
|
|
|
{
|
|
|
+ if (Convert.ToInt32(ls_gv.Rows[i].Cells[3].Value) < 100)
|
|
|
+ continue;
|
|
|
+
|
|
|
+
|
|
|
DataRow dr2 = ls_Particel_dt.NewRow();
|
|
|
- dr2["SName"] = ls_gv.Rows[i].Cells[1].Value.ToString();
|
|
|
- dr2["Largest"] = ls_gv.Rows[i].Cells[4].Value.ToString();
|
|
|
- dr2["Hardness"] = ls_gv.Rows[i].Cells[6].Value.ToString();
|
|
|
- dr2["Density"] = ls_gv.Rows[i].Cells[7].Value.ToString();
|
|
|
- dr2["Conductivity"] = ls_gv.Rows[i].Cells[8].Value.ToString();
|
|
|
+ dr2["Name"] = ls_gv.Rows[i].Cells[1].Value.ToString();
|
|
|
+
|
|
|
+ dr2["TypeId"] = ls_gv.Rows[i].Cells[3].Value.ToString();//获取分类编号
|
|
|
int col2 = 6;
|
|
|
for (int j = 1; j < 11; j++)
|
|
|
{
|
|
|
if (ls_gv.Columns.Count > col2)
|
|
|
- if(j<10)
|
|
|
- dr2["c" + j.ToString()] = ls_gv.Rows[i].Cells[col2++].Value.ToString();
|
|
|
+ if (j < 10)
|
|
|
+ dr2["c" + j.ToString()] = Convert.ToDouble(ls_gv.Rows[i].Cells[col2++].Value);
|
|
|
}
|
|
|
|
|
|
- //total,不为空行,和不能是总计行
|
|
|
- if (dr2["SName"].ToString() != "" && dr2["SName"].ToString().IndexOf("number") < 0)
|
|
|
+ if (dr2["Name"].ToString() != "" && dr2["Name"].ToString().IndexOf("number") < 0)
|
|
|
{
|
|
|
dr2["total"] = "0"; //求合
|
|
|
double d_total = 0;
|
|
@@ -763,8 +768,27 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
|
|
|
|
|
|
ls_Particel_dt.Rows.Add(dr2);
|
|
|
}
|
|
|
+
|
|
|
+ //元素物质定义
|
|
|
+ List<List<string>> ElementData = new List<List<string>>();
|
|
|
+ ElementData.Add(new List<string> { "O", "S" });//氧硫化物
|
|
|
+
|
|
|
+ ElementData.Add(new List<string> { "C", "N" });//碳氮化物
|
|
|
+ ElementData.Add(new List<string> { "O", "N" });//碳氮化物
|
|
|
+
|
|
|
+ ElementData.Add(new List<string> { "O" });//氧化物
|
|
|
+
|
|
|
+ ElementData.Add(new List<string> { "S" });//硫化物
|
|
|
+ //按照list列表进行物质类排序,物质类中的元素分类按照面积的大小进行排序
|
|
|
+ List<string> ClassName = new List<string>() { "氧硫化物", "碳氮化物", "氧化物", "硫化物", "其他物质" };
|
|
|
+ //给每个元素进行划分大类
|
|
|
+ ElementClassification(ref ls_Particel_dt, ElementData, fielddata);
|
|
|
+ //获取大分类信息
|
|
|
+ DataTable dt = QuantityOfIntegratedSubstances(ls_Particel_dt, ClassName);
|
|
|
+
|
|
|
+ ClassificationSort(ls_Particel_dt,ClassName, dt);
|
|
|
m_list_dt.Add(ls_partsize_dt);
|
|
|
- m_list_dt.Add(ls_Particel_dt);
|
|
|
+ //m_list_dt.Add(ls_Particel_dt);
|
|
|
|
|
|
return true;
|
|
|
}
|
|
@@ -774,6 +798,117 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ private DataTable QuantityOfIntegratedSubstances(DataTable dataTable, List<string> ClassName )
|
|
|
+ {
|
|
|
+ DataTable dt_Class = dataTable.Copy();
|
|
|
+ dt_Class.Clear();
|
|
|
+ dt_Class.TableName = "Particel";
|
|
|
+ dt_Class.Columns.Remove("Name");
|
|
|
+ dt_Class.Columns.Remove("TypeId");
|
|
|
+
|
|
|
+ for (int i = 0; i < ClassName.Count; i++)
|
|
|
+ {
|
|
|
+ //保留当前循环中大类物质,去除其他物质
|
|
|
+ DataTable dt = dataTable.Copy();
|
|
|
+ dt.Clear();
|
|
|
+ for (int a = 0; a < dataTable.Rows.Count; a++)
|
|
|
+ {
|
|
|
+ if (dataTable.Rows[a]["Class"].ToString() == ClassName[i].ToString())
|
|
|
+ {
|
|
|
+ dt.Rows.Add(dataTable.Rows[a].ItemArray);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (dt.Rows.Count == 0)
|
|
|
+ continue;
|
|
|
+
|
|
|
+ DataTable dt_2 = new DataTable();
|
|
|
+ dt_2 = dataTable.Copy();
|
|
|
+ dt_2.Clear();
|
|
|
+ DataRow row = dt_2.NewRow();
|
|
|
+ dt_2.Rows.Add(row);
|
|
|
+
|
|
|
+ for (int a=0;a< dt.Columns.Count;a++)
|
|
|
+ {
|
|
|
+ if (dt.Columns[a].ToString() != "Name" && dt.Columns[a].ToString() != "Class"&&dt.Columns[a].ToString()!= "TypeId")
|
|
|
+ {
|
|
|
+ bool bl = false;
|
|
|
+ for (int b = 0; b < dt.Rows.Count; b++)
|
|
|
+ {
|
|
|
+ if (!dt.Rows[b].IsNull(dt.Columns[a].ToString()))
|
|
|
+ {
|
|
|
+ bl = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (bl)
|
|
|
+ {
|
|
|
+ dt_2.Rows[0][dt.Columns[a].ToString()] = decimal.Parse(dt.Compute("sum(" + dt.Columns[a].ToString() + ")", "").ToString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dt_2.Columns.Remove("Name");
|
|
|
+ dt_2.Columns.Remove("TypeId");
|
|
|
+ dt_2.Rows[0]["Class"] = ClassName[i];
|
|
|
+ //dt_2.Rows[0]["TypeId"] = dt.Rows[0]["TypeId"].ToString();
|
|
|
+ dt_Class.Rows.Add(dt_2.Rows[0].ItemArray);
|
|
|
+ }
|
|
|
+ m_list_dt.Add(dt_Class);
|
|
|
+ return dt_Class;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void ClassificationSort(DataTable dataTable,List<string> ClassName,DataTable data)
|
|
|
+ {
|
|
|
+ DataTable dt = new DataTable();
|
|
|
+ dt = dataTable.Copy();
|
|
|
+ dt.Clear();
|
|
|
+ dt.TableName = "Particel_subdivision";
|
|
|
+ //循环list中每个类型
|
|
|
+ for (int i=0;i< ClassName.Count();i++)
|
|
|
+ {
|
|
|
+ DataTable data1 = dt.Copy();
|
|
|
+ data1.Clear();
|
|
|
+ data1.Rows.Add();
|
|
|
+ for (int a=0;a< data.Rows.Count;a++)
|
|
|
+ {
|
|
|
+ if (data.Rows[a]["Class"].ToString()== ClassName[i].ToString())
|
|
|
+ {
|
|
|
+ for (int b=1;b<10;b++)
|
|
|
+ {
|
|
|
+ data1.Rows[0]["c"+b.ToString()] = data.Rows[a]["c"+b.ToString()];
|
|
|
+ }
|
|
|
+ data1.Rows[0]["total"] = data.Rows[a]["total"];
|
|
|
+ data1.Rows[0]["Class"] = data.Rows[a]["Class"];
|
|
|
+
|
|
|
+ dt.Rows.Add(data1.Rows[0].ItemArray);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ DataTable dt_1 = new DataTable();
|
|
|
+ dt_1 = dt.Copy();
|
|
|
+ dt_1.Clear();
|
|
|
+ //循环DataTable中每个分类的数据
|
|
|
+ for (int a=0;a< dataTable.Rows.Count;a++)
|
|
|
+ {
|
|
|
+ if (dataTable.Rows[a]["Class"].ToString()== ClassName[i])
|
|
|
+ {
|
|
|
+ dataTable.Rows[a]["Class"] = "";
|
|
|
+ dt_1.Rows.Add(dataTable.Rows[a].ItemArray);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //将颗粒数量排序(从大到小)
|
|
|
+ DataView dv = dt_1.DefaultView;
|
|
|
+ dv.Sort = "total DESC";
|
|
|
+ DataTable dt_1_sort = dv.ToTable();
|
|
|
+ for (int a = 0; a < dt_1_sort.Rows.Count; a++)
|
|
|
+ {
|
|
|
+ dt.Rows.Add(dt_1_sort.Rows[a].ItemArray);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dt.Columns.Remove("TypeId");
|
|
|
+
|
|
|
+
|
|
|
+ m_list_dt.Add(dt);
|
|
|
+ }
|
|
|
#endregion
|
|
|
|
|
|
#region 插入平均元素含量表
|
|
@@ -870,7 +1005,7 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
|
|
|
ls_element_dt.Rows.Add(dr2);
|
|
|
}
|
|
|
|
|
|
- InclusionAreaRatio(ls_gv);
|
|
|
+
|
|
|
//把用户设置感兴趣的元素显示在前边
|
|
|
for (int i=0;i< m_otsreport_export.m_mbszclass.M_YSFXJG.list_str_tb_ysfx_xsys.Count(); i++)
|
|
|
{
|
|
@@ -912,39 +1047,515 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public bool InsertReportTemplateTable_ElementAvgGrid()
|
|
|
+ {
|
|
|
+ //根据sql条件,查询获取颗粒信息数据
|
|
|
+ ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.GetWorkingResult()].FilePath);
|
|
|
+ DataTable AreaInformationOfAllElements = fielddata.GetAreaByAllIncA("");//获取所有分类面积和数量信息
|
|
|
+ DataTable AllAnalysisDetails = new DataTable();
|
|
|
+ AllAnalysisDetails.TableName = "ElementValue";
|
|
|
+ AllAnalysisDetails.Columns.Add("Name");
|
|
|
+ AllAnalysisDetails.Columns.Add("TypeId");
|
|
|
+ AllAnalysisDetails.Columns.Add("Area",typeof(double));
|
|
|
+ AllAnalysisDetails.Columns.Add("Class");
|
|
|
+ for (int i = 0; i < AreaInformationOfAllElements.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ if (Convert.ToInt32(AreaInformationOfAllElements.Rows[i]["TypeId"]) < 100)
|
|
|
+ continue;
|
|
|
+
|
|
|
+ DataRow dr2 = AllAnalysisDetails.NewRow();
|
|
|
+ dr2["Name"] = AreaInformationOfAllElements.Rows[i]["TypeName"].ToString();
|
|
|
+ dr2["Area"] = Convert.ToDouble(AreaInformationOfAllElements.Rows[i]["ar"]);
|
|
|
+ dr2["TypeId"] = AreaInformationOfAllElements.Rows[i]["TypeId"].ToString();
|
|
|
+
|
|
|
+ AllAnalysisDetails.Rows.Add(dr2);
|
|
|
+ }
|
|
|
+ //元素物质定义
|
|
|
+ List<List<string>> ElementData = new List<List<string>>();
|
|
|
+ ElementData.Add(new List<string> { "O", "S" });//氧硫化物
|
|
|
+
|
|
|
+ ElementData.Add(new List<string> { "C", "N" });//碳氮化物
|
|
|
+ ElementData.Add(new List<string> { "O", "N" });//碳氮化物
|
|
|
+
|
|
|
+ ElementData.Add(new List<string> { "O" });//氧化物
|
|
|
+
|
|
|
+ ElementData.Add(new List<string> { "S" });//硫化物
|
|
|
+ //按照list列表进行物质类排序,物质类中的元素分类按照面积的大小进行排序
|
|
|
+ List<string> ClassName = new List<string>() { "氧硫化物", "碳氮化物", "氧化物", "硫化物", "其他物质" };
|
|
|
+ //给每个元素进行划分大类
|
|
|
+ ElementClassification(ref AllAnalysisDetails, ElementData, fielddata);
|
|
|
+ //统计元素物质大类的元素信息和面积占比
|
|
|
+ DataTable dt_ElementalSubstance= ElementalSubstance(AllAnalysisDetails, ClassName, fielddata);
|
|
|
+ //统计元素并按照Class Name自定义列表进行排序,大类中的小类元素信息按照面积从大到小排序
|
|
|
+ DataTable dt_ElementSorting= ElementSorting( AllAnalysisDetails, ClassName, fielddata);
|
|
|
+ //生成最后导出时物质元素成分表
|
|
|
+ DataTable dt= MaterialElementComposition(dt_ElementalSubstance,13);//导出14个元素成分信息
|
|
|
+ //生成最后导出时物质元素细分表
|
|
|
+ SubdivisionOfMaterialElements(dt_ElementSorting, 13, ClassName, dt);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ //夹杂物面积比添加大类
|
|
|
+ DataTable RawParticleData = InclusionAreaRatio();
|
|
|
+ //夹杂物面积比计算大类占比
|
|
|
+ ProportionOfParticleArea(RawParticleData, ClassName);
|
|
|
+ return true;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private bool ProportionOfParticleArea(DataTable dataTable, List<string> ClassName)
|
|
|
+ {
|
|
|
+
|
|
|
+ DataTable AllAnalysisDetails = dataTable.Copy();
|
|
|
+ AllAnalysisDetails.Clear();
|
|
|
+ AllAnalysisDetails.TableName = "InclusionAreaRatio";
|
|
|
+
|
|
|
+ for (int i=0;i< ClassName.Count;i++)
|
|
|
+ {
|
|
|
+ DataTable dt = dataTable.Copy();
|
|
|
+ dt.Clear();
|
|
|
+ for (int a=0;a< dataTable.Rows.Count;a++)
|
|
|
+ {
|
|
|
+ if (dataTable.Rows[a]["e1"].ToString()== ClassName[i].ToString())
|
|
|
+ {
|
|
|
+ dt.Rows.Add(dataTable.Rows[a].ItemArray);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (dt.Rows.Count>0)
|
|
|
+ {
|
|
|
+ double totalInclusionArea = Convert.ToDouble(decimal.Parse(dataTable.Compute("sum(e3)", "").ToString()));
|
|
|
+ double Area= Convert.ToDouble(decimal.Parse(dt.Compute("sum(e3)", "").ToString()));
|
|
|
+ DataRow dr = AllAnalysisDetails.NewRow();
|
|
|
+ dr["e1"] = ClassName[i].ToString();
|
|
|
+ dr["e3"] = Math.Round(Area, 2);
|
|
|
+ //Convert.ToDouble(decimal.Parse(dt.Compute("sum(e3)", "").ToString()));
|
|
|
+ dr["e4"] = Math.Round((Convert.ToDouble(dt.Rows[0]["e3"]) / totalInclusionArea) * 100, 2);
|
|
|
+ dr["e5"] = Math.Round((Convert.ToDouble(dt.Rows[0]["e3"]) / Convert.ToDouble(m_list_dt.Where(aa => aa.TableName.Contains("ResultGrid")).ToList()[0].Rows[0][5])) * 100, 4);
|
|
|
+ AllAnalysisDetails.Rows.Add(dr);
|
|
|
+
|
|
|
+ DataView dv = dt.DefaultView;
|
|
|
+ dv.Sort = "e3 DESC";
|
|
|
+ DataTable dt_Area = dv.ToTable();
|
|
|
+ for (int a=0;a< dt_Area.Rows.Count;a++)
|
|
|
+ {
|
|
|
+ dt_Area.Rows[a]["e1"] = "";
|
|
|
+ dt_Area.Rows[a]["e3"] = Math.Round(Convert.ToDouble(dt_Area.Rows[a]["e3"]), 2);
|
|
|
+ AllAnalysisDetails.Rows.Add(dt_Area.Rows[a].ItemArray);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ m_list_dt.Add(AllAnalysisDetails);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public bool ElementClassification(ref DataTable AreaInformationOfAllElements, List<List<string>> ElementData, ParticleData fielddata)
|
|
|
+ {
|
|
|
+
|
|
|
+ for (int i=0;i< AreaInformationOfAllElements.Rows.Count;i++)
|
|
|
+ {
|
|
|
+ List<string> ElementGroup = new List<string>();
|
|
|
+ DataTable ClassificationDetails = fielddata.GetAreaByIncA(AreaInformationOfAllElements.Rows[i]["TypeId"].ToString(), "");//获取单个分类的元素信息
|
|
|
+ for (int a=0;a< ClassificationDetails.Rows.Count;a++)
|
|
|
+ {
|
|
|
+ ElementGroup.Add(ClassificationDetails.Rows[a]["Name"].ToString());
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int a=0;a< ElementGroup.Count()-1;a++)
|
|
|
+ {
|
|
|
+ ElementGroup[a] = ElementGroup[a].Split('-')[0];
|
|
|
+ }
|
|
|
+
|
|
|
+ if (ElementData[0].All(b => ElementGroup.Any(a => a.Equals(b))))
|
|
|
+ {
|
|
|
+ AreaInformationOfAllElements.Rows[i]["Class"] = "氧硫化物";
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (ElementData[1].All(b => ElementGroup.Any(a => a.Equals(b)))|| ElementData[2].All(b => ElementGroup.Any(a => a.Equals(b))))
|
|
|
+ {
|
|
|
+ AreaInformationOfAllElements.Rows[i]["Class"] = "碳氮化物";
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (ElementData[4].All(b => ElementGroup.Any(a => a.Equals(b))))
|
|
|
+ {
|
|
|
+ AreaInformationOfAllElements.Rows[i]["Class"] = "硫化物";
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (ElementData[3].All(b => ElementGroup.Any(a => a.Equals(b))))
|
|
|
+ {
|
|
|
+ AreaInformationOfAllElements.Rows[i]["Class"] = "氧化物";
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ AreaInformationOfAllElements.Rows[i]["Class"] = "其他物质";
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ private DataTable ElementSorting( DataTable AllAnalysisDetails, List<string> ClassName , ParticleData fielddata)
|
|
|
+ {
|
|
|
+ DataTable dte = fielddata.GetAllElement();
|
|
|
+ DataTable ElementSorting_dt = AllAnalysisDetails.Copy();
|
|
|
+ ElementSorting_dt.Clear();
|
|
|
+ for (int i=0; i< ClassName.Count;i++)
|
|
|
+ {
|
|
|
+ DataTable dt = AllAnalysisDetails.Copy();
|
|
|
+ dt.Clear();
|
|
|
+ for (int a=0;a< AllAnalysisDetails.Rows.Count;a++)
|
|
|
+ {
|
|
|
+ if (AllAnalysisDetails.Rows[a]["Class"].ToString()== ClassName[i].ToString())
|
|
|
+ {
|
|
|
+ dt.Rows.Add(AllAnalysisDetails.Rows[a].ItemArray);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //将颗粒大小排序(从大到小)
|
|
|
+ DataView dv = dt.DefaultView;
|
|
|
+ dv.Sort = "Area DESC";
|
|
|
+ DataTable dt_Element = dv.ToTable();
|
|
|
+
|
|
|
+ for (int a=0;a< dt_Element.Rows.Count;a++)
|
|
|
+ {
|
|
|
+ ElementSorting_dt.Rows.Add(dt_Element.Rows[a].ItemArray);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //循环创建元素列(类型定义为double,为以后计算做准备)
|
|
|
+ for (int a = 0; a < dte.Rows.Count; a++)
|
|
|
+ {
|
|
|
+ ElementSorting_dt.Columns.Add(dte.Rows[a]["Name"].ToString(), typeof(double));
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int a = 0; a < ElementSorting_dt.Rows.Count; a++)
|
|
|
+ {
|
|
|
+ DataTable ClassificationDetails = fielddata.GetAreaByIncA(ElementSorting_dt.Rows[a]["TypeId"].ToString(), "");//获取单个分类的元素信息
|
|
|
+ //DataRow dr2 = ElementSorting_dt.NewRow();
|
|
|
+
|
|
|
+ foreach (DataRow dr in ClassificationDetails.Rows)
|
|
|
+ {
|
|
|
+ double doe = Convert.ToDouble(dr["pc"]);
|
|
|
+ ElementSorting_dt.Rows[a][dr["Name"].ToString()] = Math.Round( doe/Convert.ToDouble(ElementSorting_dt.Rows[a]["Area"]),2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return ElementSorting_dt;
|
|
|
+ }
|
|
|
+ private DataTable ElementalSubstance(DataTable AllAnalysisDetails, List<string> ClassName, ParticleData fielddata)
|
|
|
+ {
|
|
|
+ //当前元素物质类面积的总和
|
|
|
+ double ElementalSubstance = 0;
|
|
|
+ DataTable dte = fielddata.GetAllElement();
|
|
|
+ DataTable dt_Class = new DataTable();
|
|
|
+ dt_Class.Columns.Add("Name");
|
|
|
+ dt_Class.Columns.Add("Area");
|
|
|
+ //循环创建元素列(类型定义为double,为以后计算做准备)
|
|
|
+ for (int a = 0; a < dte.Rows.Count; a++)
|
|
|
+ {
|
|
|
+ dt_Class.Columns.Add(dte.Rows[a]["Name"].ToString(), typeof(double));
|
|
|
+ }
|
|
|
+ //循环大类物质列表
|
|
|
+ for (int i = 0; i < ClassName.Count; i++)
|
|
|
+ {
|
|
|
+ //保留当前循环中大类物质,去除其他物质
|
|
|
+ DataTable dt = AllAnalysisDetails.Copy();
|
|
|
+ dt.Clear();
|
|
|
+ for (int a = 0; a < AllAnalysisDetails.Rows.Count; a++)
|
|
|
+ {
|
|
|
+ if (AllAnalysisDetails.Rows[a]["Class"].ToString() == ClassName[i].ToString())
|
|
|
+ {
|
|
|
+ dt.Rows.Add(AllAnalysisDetails.Rows[a].ItemArray);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (dt.Rows.Count == 0)
|
|
|
+ continue;
|
|
|
+ //计算出当前循环中大类物质的面积
|
|
|
+ ElementalSubstance=Convert.ToDouble(decimal.Parse(dt.Compute("sum(Area)", "").ToString()));
|
|
|
+
|
|
|
+ DataTable ta = new DataTable();
|
|
|
+ ta = dt_Class.Copy();
|
|
|
+ ta.Clear();
|
|
|
+
|
|
|
+ for (int a = 0; a < dt.Rows.Count; a++)
|
|
|
+ {
|
|
|
+ DataTable ClassificationDetails = fielddata.GetAreaByIncA(dt.Rows[a]["TypeId"].ToString(), "");//获取单个分类的元素信息
|
|
|
+ DataRow dr2 = ta.NewRow();
|
|
|
+
|
|
|
+ foreach (DataRow dr in ClassificationDetails.Rows)
|
|
|
+ {
|
|
|
+ double doe = Convert.ToDouble(dr["pc"]);
|
|
|
+ dr2[dr["Name"].ToString()] = doe;
|
|
|
+ }
|
|
|
+ ta.Rows.Add(dr2);
|
|
|
+ }
|
|
|
+ DataTable dataTable = ta.Copy();
|
|
|
+ dataTable.Clear();
|
|
|
+ DataRow row = dataTable.NewRow();
|
|
|
+ dataTable.Rows.Add(row);
|
|
|
+ for (int a=0;a< ta.Columns.Count;a++)
|
|
|
+ {
|
|
|
+ if (ta.Columns[a].ToString()!="Name"&& ta.Columns[a].ToString() !="Class")
|
|
|
+ {
|
|
|
+ bool bl = false;
|
|
|
+ for (int b=0;b<ta.Rows.Count;b++)
|
|
|
+ {
|
|
|
+ if (!ta.Rows[b].IsNull(ta.Columns[a].ToString()))
|
|
|
+ {
|
|
|
+ bl = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (bl)
|
|
|
+ dataTable.Rows[0][ta.Columns[a].ToString()] = Math.Round( Convert.ToDouble(decimal.Parse(ta.Compute("sum(" + ta.Columns[a].ToString() + ")", "").ToString()))/ ElementalSubstance,2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dataTable.Rows[0]["Name"] = ClassName[i].ToString();
|
|
|
+ dataTable.Rows[0]["Area"] = ElementalSubstance;
|
|
|
+
|
|
|
+ dt_Class.Rows.Add(dataTable.Rows[0].ItemArray);
|
|
|
+
|
|
|
+ }
|
|
|
+ return dt_Class;
|
|
|
+ }
|
|
|
+ private DataTable MaterialElementComposition(DataTable a_ElementalSubstance,int NumberOfColumns)
|
|
|
+ {
|
|
|
+ DataTable dt_ElementalSubstance = new DataTable();
|
|
|
+ dt_ElementalSubstance.TableName = "ElementalSubstance_Value";
|
|
|
+ dt_ElementalSubstance.Columns.Add("Name");
|
|
|
+ dt_ElementalSubstance.Columns.Add("Area");
|
|
|
+ for (int i=0;i< a_ElementalSubstance.Rows.Count;i++)
|
|
|
+ {
|
|
|
+ dt_ElementalSubstance.Rows.Add(a_ElementalSubstance.Rows[i]["Name"]);
|
|
|
+ dt_ElementalSubstance.Rows[i]["Area"]=Math.Round(Convert.ToDouble(a_ElementalSubstance.Rows[i]["Area"]),2) ;
|
|
|
+ }
|
|
|
+ int cunt = 1;
|
|
|
+ for (int i=0;i< NumberOfColumns; i++)
|
|
|
+ {
|
|
|
+
|
|
|
+ if (i< m_otsreport_export.m_mbszclass.M_YSFXJG.list_str_tb_ysfx_xsys.Count())
|
|
|
+ {
|
|
|
+ dt_ElementalSubstance.Columns.Add(m_otsreport_export.m_mbszclass.M_YSFXJG.list_str_tb_ysfx_xsys[i]);
|
|
|
+ for (int a=0;a< a_ElementalSubstance.Rows.Count;a++)
|
|
|
+ {
|
|
|
+ if (a_ElementalSubstance.Rows[a][m_otsreport_export.m_mbszclass.M_YSFXJG.list_str_tb_ysfx_xsys[i]].ToString() == "")
|
|
|
+ {
|
|
|
+ dt_ElementalSubstance.Rows[a][m_otsreport_export.m_mbszclass.M_YSFXJG.list_str_tb_ysfx_xsys[i]] = 0;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ dt_ElementalSubstance.Rows[a][m_otsreport_export.m_mbszclass.M_YSFXJG.list_str_tb_ysfx_xsys[i]] = a_ElementalSubstance.Rows[a][m_otsreport_export.m_mbszclass.M_YSFXJG.list_str_tb_ysfx_xsys[i]];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ dt_ElementalSubstance.Columns.Add("Null"+ cunt.ToString());
|
|
|
+ cunt = cunt + 1;
|
|
|
+ for (int a = 0; a < a_ElementalSubstance.Rows.Count; a++)
|
|
|
+ {
|
|
|
+ dt_ElementalSubstance.Rows[a][i+2] = "-";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ DataTable dataTable = new DataTable();
|
|
|
+ dataTable = dt_ElementalSubstance.Copy();
|
|
|
+ dataTable.Clear();
|
|
|
+ DataRow row = dataTable.NewRow();
|
|
|
+ dataTable.Rows.Add(row);
|
|
|
+ dataTable.TableName = "ElementalSubstance_Name";
|
|
|
+ for (int i=0;i< dataTable.Columns.Count;i++)
|
|
|
+ {
|
|
|
+ dataTable.Rows[0][dataTable.Columns[i].ToString()] = dataTable.Columns[i].ToString();
|
|
|
+ }
|
|
|
+
|
|
|
+ m_list_dt.Add(dataTable);
|
|
|
+ m_list_dt.Add(dt_ElementalSubstance);
|
|
|
+
|
|
|
+ return dt_ElementalSubstance;
|
|
|
+ }
|
|
|
+ private bool SubdivisionOfMaterialElements(DataTable a_ElementalSubstance, int NumberOfColumns, List<string> ClassName,DataTable data)
|
|
|
+ {
|
|
|
+
|
|
|
+ DataTable dt_ElementalSubstance = new DataTable();
|
|
|
+ dt_ElementalSubstance= data.Copy();
|
|
|
+ dt_ElementalSubstance.Clear();
|
|
|
+ dt_ElementalSubstance.TableName = "ElementSubdivision_Value";
|
|
|
+ dt_ElementalSubstance.Columns["Name"].ColumnName = "Class";
|
|
|
+ dt_ElementalSubstance.Columns.Add("Name");
|
|
|
+ //处理元素面积保留小数点后两位
|
|
|
+ for (int i=0;i< a_ElementalSubstance.Rows.Count;i++)
|
|
|
+ {
|
|
|
+ a_ElementalSubstance.Rows[i]["Area"] = Math.Round(Convert.ToDouble(a_ElementalSubstance.Rows[i]["Area"].ToString()), 2);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //循环元素物质大类
|
|
|
+ for (int i = 0; i < ClassName.Count; i++)
|
|
|
+ {
|
|
|
+ DataTable dt_1 = new DataTable();
|
|
|
+ dt_1 = data.Copy();
|
|
|
+ dt_1.Clear();
|
|
|
+ for (int a = 0; a < data.Rows.Count; a++)
|
|
|
+ {
|
|
|
+ if (data.Rows[a]["Name"].ToString() == ClassName[i].ToString())
|
|
|
+ {
|
|
|
+ dt_1.Rows.Add(data.Rows[a].ItemArray);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dt_1.Columns["Name"].ColumnName = "Class";
|
|
|
+ dt_1.Columns.Add("Name");
|
|
|
+
|
|
|
+ DataTable dt_2 = new DataTable();
|
|
|
+ dt_2 = dt_1.Copy();
|
|
|
+ dt_2.Clear();
|
|
|
+ dt_2.Rows.Add();
|
|
|
+ //循环整个表筛选出当前的物质
|
|
|
+ for (int a = 0; a < a_ElementalSubstance.Rows.Count; a++)
|
|
|
+ {
|
|
|
+ if (ClassName[i].ToString() == a_ElementalSubstance.Rows[a]["Class"].ToString())
|
|
|
+ {
|
|
|
+
|
|
|
+ for (int b=0;b< dt_1.Columns.Count;b++)
|
|
|
+ {
|
|
|
+ if (dt_2.Columns[b].ToString()!="Class")
|
|
|
+ {
|
|
|
+ if (a_ElementalSubstance.Rows[a][dt_2.Columns[b].ToString()].ToString() == "")
|
|
|
+ {
|
|
|
+ dt_2.Rows[0][dt_2.Columns[b].ToString()] = 0;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ dt_2.Rows[0][dt_2.Columns[b].ToString()] = a_ElementalSubstance.Rows[a][dt_2.Columns[b].ToString()];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dt_1.Rows.Add(dt_2.Rows[0].ItemArray);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int a=0;a< dt_1.Rows.Count;a++)
|
|
|
+ {
|
|
|
+ dt_ElementalSubstance.Rows.Add(dt_1.Rows[a].ItemArray);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ DataTable dataTable = new DataTable();
|
|
|
+ dataTable = dt_ElementalSubstance.Copy();
|
|
|
+ dataTable.Clear();
|
|
|
+ DataRow row = dataTable.NewRow();
|
|
|
+ dataTable.Rows.Add(row);
|
|
|
+ dataTable.TableName = "ElementSubdivision_Name";
|
|
|
+ for (int i = 0; i < dataTable.Columns.Count; i++)
|
|
|
+ {
|
|
|
+ dataTable.Rows[0][dataTable.Columns[i].ToString()] = dataTable.Columns[i].ToString();
|
|
|
+ }
|
|
|
+
|
|
|
+ m_list_dt.Add(dataTable);
|
|
|
+ m_list_dt.Add(dt_ElementalSubstance);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
#endregion
|
|
|
|
|
|
- private void InclusionAreaRatio(DataGridView ls_gv)
|
|
|
+ private DataTable InclusionAreaRatio()
|
|
|
{
|
|
|
+
|
|
|
+ //根据sql条件,查询获取颗粒信息数据
|
|
|
+ ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.GetWorkingResult()].FilePath);
|
|
|
+ DataTable AreaInformationOfAllElements = fielddata.GetAreaByAllIncA("");//获取所有分类面积和数量信息
|
|
|
+ DataTable AllAnalysisDetails = new DataTable();
|
|
|
+ //AllAnalysisDetails.TableName = "ElementValue";
|
|
|
+ AllAnalysisDetails.Columns.Add("Name");
|
|
|
+ AllAnalysisDetails.Columns.Add("TypeId");
|
|
|
+ AllAnalysisDetails.Columns.Add("Area", typeof(double));
|
|
|
+ AllAnalysisDetails.Columns.Add("Class");
|
|
|
+ AllAnalysisDetails.Columns.Add("Cunt",typeof(double));
|
|
|
+ for (int i = 0; i < AreaInformationOfAllElements.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ if (Convert.ToInt32(AreaInformationOfAllElements.Rows[i]["TypeId"]) < 100)
|
|
|
+ continue;
|
|
|
+
|
|
|
+ DataRow dr2 = AllAnalysisDetails.NewRow();
|
|
|
+ dr2["Name"] = AreaInformationOfAllElements.Rows[i]["TypeName"].ToString();
|
|
|
+ dr2["Area"] = Convert.ToDouble(AreaInformationOfAllElements.Rows[i]["ar"]);
|
|
|
+ dr2["TypeId"] = AreaInformationOfAllElements.Rows[i]["TypeId"].ToString();
|
|
|
+ dr2["Cunt"] = Convert.ToDouble(AreaInformationOfAllElements.Rows[i]["con"]);
|
|
|
+ AllAnalysisDetails.Rows.Add(dr2);
|
|
|
+ }
|
|
|
+ //元素物质定义
|
|
|
+ List<List<string>> ElementData = new List<List<string>>();
|
|
|
+ ElementData.Add(new List<string> { "O", "S" });//氧硫化物
|
|
|
+
|
|
|
+ ElementData.Add(new List<string> { "C", "N" });//碳氮化物
|
|
|
+ ElementData.Add(new List<string> { "O", "N" });//碳氮化物
|
|
|
+
|
|
|
+ ElementData.Add(new List<string> { "O" });//氧化物
|
|
|
+
|
|
|
+ ElementData.Add(new List<string> { "S" });//硫化物
|
|
|
+ //按照list列表进行物质类排序,物质类中的元素分类按照面积的大小进行排序
|
|
|
+ List<string> ClassName = new List<string>() { "氧硫化物", "碳氮化物", "氧化物", "硫化物", "其他物质" };
|
|
|
+ //给每个元素进行划分大类
|
|
|
+ ElementClassification(ref AllAnalysisDetails, ElementData, fielddata);
|
|
|
+
|
|
|
+
|
|
|
DataTable AreaRatio = new DataTable();
|
|
|
AreaRatio.TableName = "InclusionAreaRatio";
|
|
|
AreaRatio.Columns.Add("e1");
|
|
|
AreaRatio.Columns.Add("e2");
|
|
|
- AreaRatio.Columns.Add("e3");
|
|
|
+ AreaRatio.Columns.Add("e3", typeof(double));
|
|
|
AreaRatio.Columns.Add("e4");
|
|
|
AreaRatio.Columns.Add("e5");
|
|
|
|
|
|
|
|
|
//获取夹杂物的总面积用于计算夹杂物类别的占比(gridview最后一个固定是未识别颗粒,要排除未识别颗粒所以for循环至grid view长度减一)
|
|
|
double totalInclusionArea = 0;
|
|
|
- for (int i = 0; i < ls_gv.Rows.Count - 1; i++)
|
|
|
+ //for (int i = 0; i < ls_gv.Rows.Count - 1; i++)
|
|
|
+ //{
|
|
|
+ // totalInclusionArea = totalInclusionArea + Convert.ToDouble(ls_gv.Rows[i].Cells[2].Value.ToString());
|
|
|
+ //}
|
|
|
+ totalInclusionArea= Convert.ToDouble(decimal.Parse(AllAnalysisDetails.Compute("sum(Area)", "").ToString()));
|
|
|
+ for (int i=0;i< AllAnalysisDetails.Rows.Count;i++)
|
|
|
{
|
|
|
- totalInclusionArea = totalInclusionArea + Convert.ToDouble(ls_gv.Rows[i].Cells[2].Value.ToString());
|
|
|
+ DataRow dr = AreaRatio.NewRow();
|
|
|
+ dr["e1"] = AllAnalysisDetails.Rows[i]["Class"].ToString();
|
|
|
+ dr["e2"] = AllAnalysisDetails.Rows[i]["Name"].ToString();
|
|
|
+ dr["e3"] = Convert.ToDouble(AllAnalysisDetails.Rows[i]["Area"]);
|
|
|
+ dr["e4"]= Math.Round((Convert.ToDouble(AllAnalysisDetails.Rows[i]["Area"]) / totalInclusionArea) * 100, 2);
|
|
|
+ dr["e5"] = Math.Round((Convert.ToDouble(AllAnalysisDetails.Rows[i]["Area"]) / Convert.ToDouble(m_list_dt.Where(aa => aa.TableName.Contains("ResultGrid")).ToList()[0].Rows[0][5])) * 100, 4);
|
|
|
+ AreaRatio.Rows.Add(dr);
|
|
|
}
|
|
|
|
|
|
|
|
|
- for (int i = 0; i < ls_gv.Rows.Count - 1; i++)
|
|
|
+ DataTable AreaRatio_dt = AreaRatio.Copy();
|
|
|
+ AreaRatio_dt.Clear();
|
|
|
+
|
|
|
+ for (int i=0;i< ClassName.Count();i++)
|
|
|
{
|
|
|
- DataRow dr = AreaRatio.NewRow();
|
|
|
- dr["e1"] = (i + 1).ToString();
|
|
|
- dr["e2"] = ls_gv.Rows[i].Cells[1].Value.ToString();
|
|
|
- dr["e3"] = ls_gv.Rows[i].Cells[2].Value.ToString();
|
|
|
- dr["e4"] = Math.Round((Convert.ToDouble(ls_gv.Rows[i].Cells[2].Value)/ totalInclusionArea)*100,2);
|
|
|
- dr["e5"] = Math.Round((Convert.ToDouble(ls_gv.Rows[i].Cells[2].Value) / Convert.ToDouble( m_list_dt.Where(aa => aa.TableName.Contains("ResultGrid")).ToList()[0].Rows[0][5])) * 100, 4);
|
|
|
- AreaRatio.Rows.Add(dr);
|
|
|
- }
|
|
|
|
|
|
- m_list_dt.Add(AreaRatio);
|
|
|
+ DataTable dt = AreaRatio.Copy();
|
|
|
+ dt.Clear();
|
|
|
+ for (int a=0; a< AreaRatio.Rows.Count;a++)
|
|
|
+ {
|
|
|
+ if (AreaRatio.Rows[a]["e1"].ToString()== ClassName[i].ToString())
|
|
|
+ {
|
|
|
+ dt.Rows.Add(AreaRatio.Rows[a].ItemArray);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ DataView dv = dt.DefaultView;
|
|
|
+ dv.Sort = "e3 DESC";
|
|
|
+ DataTable dt_Element = dv.ToTable();
|
|
|
+ for (int a = 0; a < dt_Element.Rows.Count;a++)
|
|
|
+ {
|
|
|
+ AreaRatio_dt.Rows.Add(dt_Element.Rows[a].ItemArray);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return AreaRatio_dt;
|
|
|
+ //m_list_dt.Add(AreaRatio_dt);
|
|
|
}
|
|
|
|
|
|
#region 插入颗粒图chart
|
|
@@ -974,13 +1585,13 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
- private DataTable GetPicDataTable_InclusionAreaRatio()
|
|
|
+ private DataTable GetPicDataTable_InclusionAreaRatio(string str)
|
|
|
{
|
|
|
- if (m_list_dt.Where(aa => aa.TableName.Contains("Pic_InclusionAreaRatio")).ToList().Count == 0)
|
|
|
+ if (m_list_dt.Where(aa => aa.TableName.Contains(str)).ToList().Count == 0)
|
|
|
{
|
|
|
//创建二进制列的数据表
|
|
|
DataTable ls_dt = new DataTable();
|
|
|
- ls_dt.TableName = "Pic_InclusionAreaRatio";
|
|
|
+ ls_dt.TableName = str;
|
|
|
DataColumn colpict = new DataColumn("pict");
|
|
|
colpict.DataType = System.Type.GetType("System.Byte[]");
|
|
|
ls_dt.Columns.Add(colpict);
|
|
@@ -991,7 +1602,7 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- return m_list_dt.Where(aa => aa.TableName.Contains("Pic_InclusionAreaRatio")).ToList()[0];
|
|
|
+ return m_list_dt.Where(aa => aa.TableName.Contains(str)).ToList()[0];
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1023,6 +1634,49 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
+ #region 插入大分类夹杂物面积比图
|
|
|
+ public bool InsertReportTemplateChart_InclusionAreaClassRatio(string a_GraphicStyle)
|
|
|
+ {
|
|
|
+ //加载模块
|
|
|
+ m_otsreport_export.m_ReportApp.im_EChart_ParticlesComposition = new EChart_ParticlesComposition(m_otsreport_export.m_ReportApp, "InclusionareaClassRatio");
|
|
|
+ m_otsreport_export.m_ReportApp.m_reportname = "夹杂物质面积比";
|
|
|
+ m_otsreport_export.m_ReportApp.type = a_GraphicStyle;
|
|
|
+ m_otsreport_export.m_ReportApp.timerKG = true;
|
|
|
+ m_otsreport_export.m_ReportApp.m_ChartsWindow.Controls.Add(m_otsreport_export.m_ReportApp.im_EChart_ParticlesComposition);
|
|
|
+
|
|
|
+ //弹出加载图片窗体
|
|
|
+ OTSReport_GetEChartImage og = new OTSReport_GetEChartImage();
|
|
|
+
|
|
|
+ //将EChart委托事件注册给加载图片窗体的方法
|
|
|
+ m_otsreport_export.m_ReportApp.im_EChart_ParticlesComposition.butclic += og.get_ParticalesCompositionChart;
|
|
|
+ og.ShowDialog();
|
|
|
+
|
|
|
+ //获取图片数据
|
|
|
+ string str = og.PicStr;
|
|
|
+
|
|
|
+ //将Base64String转为图片并保存
|
|
|
+ byte[] arr = Convert.FromBase64String(str.Substring(str.IndexOf(',') + 1));
|
|
|
+ MemoryStream ms = new MemoryStream(arr);
|
|
|
+ System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(ms);
|
|
|
+
|
|
|
+ //再将图转成流,流再转二进制-------------------------------------------
|
|
|
+ MemoryStream newms = new MemoryStream();
|
|
|
+ bmp.Save(newms, System.Drawing.Imaging.ImageFormat.Bmp);
|
|
|
+ newms.Seek(0, SeekOrigin.Begin);
|
|
|
+ byte[] newarr = new byte[newms.Length];
|
|
|
+ newms.Read(newarr, 0, newarr.Length);
|
|
|
+ newms.Dispose();
|
|
|
+ DataTable ls_dt = GetPicDataTable_InclusionAreaRatio("Pic_InclusionareaClassRatio");
|
|
|
+
|
|
|
+ DataRow dr = ls_dt.NewRow();
|
|
|
+ dr["pict"] = newarr;//图像二进制
|
|
|
+ ls_dt.Rows.Add(dr);
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
#region 插入夹杂物面积比图
|
|
|
public bool InsertReportTemplateChart_InclusionAreaRatio(string a_GraphicStyle)
|
|
|
{
|
|
@@ -1055,7 +1709,7 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
|
|
|
byte[] newarr = new byte[newms.Length];
|
|
|
newms.Read(newarr, 0, newarr.Length);
|
|
|
newms.Dispose();
|
|
|
- DataTable ls_dt = GetPicDataTable_InclusionAreaRatio();
|
|
|
+ DataTable ls_dt = GetPicDataTable_InclusionAreaRatio("Pic_InclusionAreaRatio");
|
|
|
|
|
|
DataRow dr = ls_dt.NewRow();
|
|
|
dr["pict"] = newarr;//图像二进制
|