1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129 |
-
- using OTSCommon.Model;
- using OTSIncAReportApp.DataOperation.DataAccess;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using static OTSIncAReportApp.OTSReport_Export;
- namespace OTSIncAReportApp._1_UI.OTSReportExport.DataIntegration
- {
- /// <summary>
- /// 颗粒分析
- /// </summary>
- class ParticleAnalysis
- {
- /// <summary>
- /// 大分类
- /// </summary>
- /// <returns></returns>
- public DataTable GetLargeClassification(c_TemplateClass m_mbszclass, OTSReport_Export m_otsreport_export,string ComputeMode)
- {
- DataTable data = GetDBData(m_mbszclass, m_otsreport_export, ComputeMode);
- List<string> colid = new List<string>();
- //获取粒级表
- string path1 = m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFileFolder +
- m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFile;
- DataSet ds = OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.GetXml(path1);
- string sizestr = ds.Tables[0].Rows[0]["Sizes"].ToString();
- for (int i = 0; i < sizestr.Split(',').Length - 1; i++)
- {
- if (sizestr.Split(',')[i].Length > 0)
- {
- double d1 = Convert.ToDouble(sizestr.Split(',')[i]);
- double d2 = Convert.ToDouble(sizestr.Split(',')[i + 1]);
- colid.Add(d1.ToString() + "~" + d2.ToString());
- }
- }
- double d = Convert.ToDouble(sizestr.Split(',')[sizestr.Split(',').Length - 1]);
- colid.Add(d.ToString() + "~MAX");
- ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.getSelectedIndex()].FilePath);
- DataTable ls_partsize_dt = new DataTable();
- ls_partsize_dt.TableName = "PartSize";
- ls_partsize_dt.Columns.Add("c1");
- ls_partsize_dt.Columns.Add("c2");
- ls_partsize_dt.Columns.Add("c3");
- ls_partsize_dt.Columns.Add("c4");
- ls_partsize_dt.Columns.Add("c5");
- ls_partsize_dt.Columns.Add("c6");
- ls_partsize_dt.Columns.Add("c7");
- ls_partsize_dt.Columns.Add("c8");
- ls_partsize_dt.Columns.Add("c9");
- DataRow dr = ls_partsize_dt.NewRow();
- for (int i = 1; i < 10; i++)
- {
- if (colid.Count < i)
- {
- dr["c" + i.ToString()] = "";
- }
- else
- {
- dr["c" + i.ToString()] = colid[i - 1];
- }
- }
- ls_partsize_dt.Rows.Add(dr);
- DataTable ls_Particel_dt = new DataTable();
- ls_Particel_dt.TableName = "Particel";
- 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 < data.Rows.Count; i++)
- {
- DataRow dr2 = ls_Particel_dt.NewRow();
- dr2["Name"] = data.Rows[i]["TypeName"].ToString();
- dr2["Class"] = data.Rows[i]["Class"].ToString();
- dr2["TypeId"] = data.Rows[i]["TypeId"].ToString();//获取分类编号
- for (int j = 1; j < 10; j++)
- {
- if (colid.Count >= j)
- {
- dr2["c" + j.ToString()] = Convert.ToDouble(data.Rows[i][colid[j - 1]]);
- }
- }
- if (dr2["Name"].ToString() != "" && dr2["Name"].ToString().IndexOf("number") < 0)
- {
- dr2["total"] = "0"; //求合
- double d_total = 0;
- for (int j = 1; j < 10; j++)
- {
- if (colid.Count >= j)
- {
- d_total = d_total + Convert.ToInt64(data.Rows[i][colid[j - 1]]);
- }
- }
- dr2["total"] = d_total.ToString();
- }
- ls_Particel_dt.Rows.Add(dr2);
- }
- //按照list列表进行物质类排序,物质类中的元素分类按照面积的大小进行排序
- List<string> ClassName = new List<string>();
- DataTable getClass_dt = fielddata.GetAllClass();
- for (int i = 0; i < getClass_dt.Rows.Count; i++)
- {
- if (getClass_dt.Rows[i]["GroupName"].ToString() != "NOT_INCLUTION" && getClass_dt.Rows[i]["GroupName"].ToString() != "Invalid")
- if (getClass_dt.Rows[i]["GroupName"].ToString() == "")
- ClassName.Add("NULL");
- else
- ClassName.Add(getClass_dt.Rows[i]["GroupName"].ToString());
- }
- //获取大分类信息
- DataTable dt = QuantityOfIntegratedSubstances(ls_Particel_dt, ClassName);
- return dt;
- }
- /// <summary>
- /// 小分类
- /// </summary>
- /// <returns></returns>
- public DataTable GetSubClassification(c_TemplateClass m_mbszclass, OTSReport_Export m_otsreport_export, string ComputeMode)
- {
- DataTable data = GetDBData(m_mbszclass, m_otsreport_export, ComputeMode);
- List<string> colid = new List<string>();
- //获取粒级表
- string path1 = m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFileFolder +
- m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFile;
- DataSet ds = OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.GetXml(path1);
- string sizestr = ds.Tables[0].Rows[0]["Sizes"].ToString();
- for (int i = 0; i < sizestr.Split(',').Length - 1; i++)
- {
- if (sizestr.Split(',')[i].Length > 0)
- {
- double d1 = Convert.ToDouble(sizestr.Split(',')[i]);
- double d2 = Convert.ToDouble(sizestr.Split(',')[i + 1]);
- colid.Add(d1.ToString() + "~" + d2.ToString());
- }
- }
- double d = Convert.ToDouble(sizestr.Split(',')[sizestr.Split(',').Length - 1]);
- colid.Add(d.ToString() + "~MAX");
- //------------------------------------------------
- DataTable ls_partsize_dt = new DataTable();
- ls_partsize_dt.TableName = "PartSize";
- ls_partsize_dt.Columns.Add("c1");
- ls_partsize_dt.Columns.Add("c2");
- ls_partsize_dt.Columns.Add("c3");
- ls_partsize_dt.Columns.Add("c4");
- ls_partsize_dt.Columns.Add("c5");
- ls_partsize_dt.Columns.Add("c6");
- ls_partsize_dt.Columns.Add("c7");
- ls_partsize_dt.Columns.Add("c8");
- ls_partsize_dt.Columns.Add("c9");
- DataRow dr = ls_partsize_dt.NewRow();
- for (int i = 1; i < 10; i++)
- {
- if (colid.Count < i)
- {
- dr["c" + i.ToString()] = "";
- }
- else
- {
- dr["c" + i.ToString()] = colid[i - 1];
- }
- }
- ls_partsize_dt.Rows.Add(dr);
- DataTable ls_Particel_dt = new DataTable();
- ls_Particel_dt.TableName = "Particel";
- 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 < data.Rows.Count; i++)
- {
- DataRow dr2 = ls_Particel_dt.NewRow();
- dr2["Name"] = data.Rows[i]["TypeName"].ToString();
- dr2["Class"] = data.Rows[i]["Class"].ToString();
- dr2["TypeId"] = data.Rows[i]["TypeId"].ToString();//获取分类编号
- for (int j = 1; j < 10; j++)
- {
- if (colid.Count >= j)
- {
- dr2["c" + j.ToString()] = Convert.ToDouble(data.Rows[i][colid[j - 1]]);
- }
- }
- if (dr2["Name"].ToString() != "" && dr2["Name"].ToString().IndexOf("number") < 0)
- {
- dr2["total"] = "0"; //求合
- double d_total = 0;
- for (int j = 1; j < 10; j++)
- {
- if (colid.Count >= j)
- {
- d_total = d_total + Convert.ToInt64(data.Rows[i][colid[j - 1]]);
- }
- }
- dr2["total"] = d_total.ToString();
- }
- ls_Particel_dt.Rows.Add(dr2);
- }
- return ls_Particel_dt;
- }
- /// <summary>
- /// 分类整合大小分类都有
- /// </summary>
- /// <returns></returns>
- public List<DataTable> GetClassificationConsolidationTable(c_TemplateClass m_mbszclass, OTSReport_Export m_otsreport_export, string ComputeMode)
- {
- List<DataTable> datas = new List<DataTable>();
- DataTable data = GetDBData(m_mbszclass, m_otsreport_export, ComputeMode);
- List<string> colid = new List<string>();
- //获取粒级表
- string path1 = m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFileFolder +
- m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFile;
- DataSet ds = OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.GetXml(path1);
- string sizestr = ds.Tables[0].Rows[0]["Sizes"].ToString();
- for (int i = 0; i < sizestr.Split(',').Length - 1; i++)
- {
- if (sizestr.Split(',')[i].Length > 0)
- {
- double d1 = Convert.ToDouble(sizestr.Split(',')[i]);
- double d2 = Convert.ToDouble(sizestr.Split(',')[i + 1]);
- colid.Add(d1.ToString() + "~" + d2.ToString());
- }
- }
- double d = Convert.ToDouble(sizestr.Split(',')[sizestr.Split(',').Length - 1]);
- colid.Add(d.ToString() + "~MAX");
- ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.getSelectedIndex()].FilePath);
- //------------------------------------------------
- DataTable ls_partsize_dt = new DataTable();
- ls_partsize_dt.TableName = "PartSize";
- ls_partsize_dt.Columns.Add("c1");
- ls_partsize_dt.Columns.Add("c2");
- ls_partsize_dt.Columns.Add("c3");
- ls_partsize_dt.Columns.Add("c4");
- ls_partsize_dt.Columns.Add("c5");
- ls_partsize_dt.Columns.Add("c6");
- ls_partsize_dt.Columns.Add("c7");
- ls_partsize_dt.Columns.Add("c8");
- ls_partsize_dt.Columns.Add("c9");
- DataRow dr = ls_partsize_dt.NewRow();
- for (int i = 1; i < 10; i++)
- {
- if (colid.Count < i)
- {
- dr["c" + i.ToString()] = "";
- }
- else
- {
- dr["c" + i.ToString()] = colid[i - 1];
- }
- }
- ls_partsize_dt.Rows.Add(dr);
- DataTable ls_Particel_dt = new DataTable();
- ls_Particel_dt.TableName = "Particel";
- 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 < data.Rows.Count; i++)
- {
- DataRow dr2 = ls_Particel_dt.NewRow();
- dr2["Name"] = data.Rows[i]["TypeName"].ToString();
- dr2["Class"] = data.Rows[i]["Class"].ToString();
- dr2["TypeId"] = data.Rows[i]["TypeId"].ToString();//获取分类编号
- for (int j = 1; j < 10; j++)
- {
- if (colid.Count >= j)
- {
- dr2["c" + j.ToString()] = Convert.ToDouble(data.Rows[i][colid[j - 1]]);
- }
- }
- if (dr2["Name"].ToString() != "" && dr2["Name"].ToString().IndexOf("number") < 0)
- {
- dr2["total"] = "0"; //求合
- double d_total = 0;
- for (int j = 1; j < 10; j++)
- {
- if (colid.Count >= j)
- {
- d_total = d_total + Convert.ToInt64(data.Rows[i][colid[j - 1]]);
- }
- }
- dr2["total"] = d_total.ToString();
- }
- ls_Particel_dt.Rows.Add(dr2);
- }
- //按照list列表进行物质类排序,物质类中的元素分类按照面积的大小进行排序
- List<string> ClassName = new List<string>();
- DataTable getClass_dt = fielddata.GetAllClass();
- bool bl = false;
- for (int i = 0; i < getClass_dt.Rows.Count; i++)
- {
- if (getClass_dt.Rows[i]["GroupName"].ToString() != "NOT_INCLUTION" && getClass_dt.Rows[i]["GroupName"].ToString() != "Invalid"
- && getClass_dt.Rows[i]["GroupName"].ToString() != "Not Identified")
- if (getClass_dt.Rows[i]["GroupName"].ToString() == "")
- {
- if (!bl)
- {
- ClassName.Add("Default");
- bl = true;
- }
- }
- else
- {
- if (getClass_dt.Rows[i]["GroupName"].ToString() != "Default")
- {
- ClassName.Add(getClass_dt.Rows[i]["GroupName"].ToString());
- }
- }
- }
- //获取大分类信息
- DataTable dt = QuantityOfIntegratedSubstances(ls_Particel_dt, ClassName);
- DataTable data2 = classIfIcationSort(ls_Particel_dt, ClassName, dt);
- datas.Add(ls_partsize_dt.Copy());
- datas.Add(data2.Copy());
- return datas;
- }
- /// <summary>
- /// 判断是否有大分类,有为true
- /// </summary>
- /// <param name="m_otsreport_export"></param>
- /// <returns></returns>
- public bool IsThereAMajorClassification(OTSReport_Export m_otsreport_export)
- {
- ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.getSelectedIndex()].FilePath);
- DataTable getClass_dt = fielddata.GetAllClass();
- List<string> ClassName = new List<string>();
- bool bl = false;
- for (int i = 0; i < getClass_dt.Rows.Count; i++)
- {
- if (getClass_dt.Rows[i]["GroupName"].ToString() != "NOT_INCLUTION" && getClass_dt.Rows[i]["GroupName"].ToString() != "Invalid"
- && getClass_dt.Rows[i]["GroupName"].ToString() != "Not Identified")
- if (getClass_dt.Rows[i]["GroupName"].ToString() == "")
- {
- if (!bl)
- {
- ClassName.Add("Default");
- bl = true;
- }
- }
- else
- {
- if (getClass_dt.Rows[i]["GroupName"].ToString() != "Default")
- {
- ClassName.Add(getClass_dt.Rows[i]["GroupName"].ToString());
- }
- }
- }
- if (ClassName.Count < 2)
- {
- return false;
- }
- else
- {
- return true;
- }
- }
- /// <summary>
- /// 大分类chart数据
- /// </summary>
- /// <param name="m_mbszclass"></param>
- /// <param name="m_otsreport_export"></param>
- /// <returns></returns>
- public DataTable GetChartDataCalss(c_TemplateClass m_mbszclass, OTSReport_Export m_otsreport_export, string ComputeMode)
- {
- DataTable data = GetDBData(m_mbszclass, m_otsreport_export, ComputeMode);
- List<string> colid = new List<string>();
- //获取粒级表
- string path1 = m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFileFolder +
- m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFile;
- DataSet ds = OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.GetXml(path1);
- string sizestr = ds.Tables[0].Rows[0]["Sizes"].ToString();
- for (int i = 0; i < sizestr.Split(',').Length - 1; i++)
- {
- if (sizestr.Split(',')[i].Length > 0)
- {
- double d1 = Convert.ToDouble(sizestr.Split(',')[i]);
- double d2 = Convert.ToDouble(sizestr.Split(',')[i + 1]);
- colid.Add(d1.ToString() + "~" + d2.ToString());
- }
- }
- double d = Convert.ToDouble(sizestr.Split(',')[sizestr.Split(',').Length - 1]);
- colid.Add(d.ToString() + "~MAX");
- ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.getSelectedIndex()].FilePath);
- //------------------------------------------------
- DataTable ls_partsize_dt = new DataTable();
- ls_partsize_dt.TableName = "PartSize";
- ls_partsize_dt.Columns.Add("c1");
- ls_partsize_dt.Columns.Add("c2");
- ls_partsize_dt.Columns.Add("c3");
- ls_partsize_dt.Columns.Add("c4");
- ls_partsize_dt.Columns.Add("c5");
- ls_partsize_dt.Columns.Add("c6");
- ls_partsize_dt.Columns.Add("c7");
- ls_partsize_dt.Columns.Add("c8");
- ls_partsize_dt.Columns.Add("c9");
- DataRow dr = ls_partsize_dt.NewRow();
- for (int i = 1; i < 10; i++)
- {
- if (colid.Count < i)
- {
- dr["c" + i.ToString()] = "";
- }
- else
- {
- dr["c" + i.ToString()] = colid[i - 1];
- }
- }
- ls_partsize_dt.Rows.Add(dr);
- DataTable ls_Particel_dt = new DataTable();
- ls_Particel_dt.TableName = "Particel";
- 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 < data.Rows.Count; i++)
- {
- DataRow dr2 = ls_Particel_dt.NewRow();
- dr2["Name"] = data.Rows[i]["TypeName"].ToString();
- dr2["Class"] = data.Rows[i]["Class"].ToString();
- dr2["TypeId"] = data.Rows[i]["TypeId"].ToString();//获取分类编号
- for (int j = 1; j < 10; j++)
- {
- if (colid.Count >= j)
- {
- dr2["c" + j.ToString()] = Convert.ToDouble(data.Rows[i][colid[j - 1]]);
- }
- }
- if (dr2["Name"].ToString() != "" && dr2["Name"].ToString().IndexOf("number") < 0)
- {
- dr2["total"] = "0"; //求合
- double d_total = 0;
- for (int j = 1; j < 10; j++)
- {
- if (colid.Count >= j)
- {
- d_total = d_total + Convert.ToInt64(data.Rows[i][colid[j - 1]]);
- }
- }
- dr2["total"] = d_total.ToString();
- }
- ls_Particel_dt.Rows.Add(dr2);
- }
- //按照list列表进行物质类排序,物质类中的元素分类按照面积的大小进行排序
- List<string> ClassName = new List<string>();
- DataTable getClass_dt = fielddata.GetAllClass();
- for (int i = 0; i < getClass_dt.Rows.Count; i++)
- {
- if (getClass_dt.Rows[i]["GroupName"].ToString() != "NOT_INCLUTION" && getClass_dt.Rows[i]["GroupName"].ToString() != "Invalid")
- if (getClass_dt.Rows[i]["GroupName"].ToString() == "")
- ClassName.Add("NULL");
- else
- ClassName.Add(getClass_dt.Rows[i]["GroupName"].ToString());
- }
- //颗粒尺寸数据(例 1.5有多少,2.0有多少)
- DataTable colid_data = new DataTable();
- colid_data.Columns.Add("name");
- colid_data.Columns.Add("quantity", typeof(double));
- for (int i = 0; i < ls_Particel_dt.Columns.Count; i++)
- {
- if (ls_Particel_dt.Columns[i].ColumnName == "c" + (i + 1).ToString())
- {
- if (i < colid.Count)
- {
- DataRow dr1 = colid_data.NewRow();
- dr1["name"] = colid[i].ToString();
- int quantity = 0;
- for (int a = 0; a < ls_Particel_dt.Rows.Count; a++)
- {
- quantity = quantity + Convert.ToInt32(ls_Particel_dt.Rows[a][i].ToString());
- }
- dr1["quantity"] = quantity.ToString();
- colid_data.Rows.Add(dr1);
- }
- }
- }
- return colid_data;
-
- }
- /// <summary>
- /// 小分类chart数据
- /// </summary>
- /// <param name="m_mbszclass"></param>
- /// <param name="m_otsreport_export"></param>
- /// <returns></returns>
- public DataTable GetChartDataSubdivision(c_TemplateClass m_mbszclass, OTSReport_Export m_otsreport_export, string ComputeMode)
- {
- DataTable data = GetDBData(m_mbszclass, m_otsreport_export, ComputeMode);
- List<string> colid = new List<string>();
- string path1 = m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFileFolder +
- m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFile;
- DataSet ds = OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.GetXml(path1);
- string sizestr = ds.Tables[0].Rows[0]["Sizes"].ToString();
- for (int i = 0; i < sizestr.Split(',').Length - 1; i++)
- {
- if (sizestr.Split(',')[i].Length > 0)
- {
- double d1 = Convert.ToDouble(sizestr.Split(',')[i]);
- double d2 = Convert.ToDouble(sizestr.Split(',')[i + 1]);
- colid.Add(d1.ToString() + "~" + d2.ToString());
- }
- }
- double d = Convert.ToDouble(sizestr.Split(',')[sizestr.Split(',').Length - 1]);
- colid.Add(d.ToString() + "~MAX");
- //------------------------------------------------
- DataTable ls_partsize_dt = new DataTable();
- ls_partsize_dt.TableName = "PartSize";
- ls_partsize_dt.Columns.Add("c1");
- ls_partsize_dt.Columns.Add("c2");
- ls_partsize_dt.Columns.Add("c3");
- ls_partsize_dt.Columns.Add("c4");
- ls_partsize_dt.Columns.Add("c5");
- ls_partsize_dt.Columns.Add("c6");
- ls_partsize_dt.Columns.Add("c7");
- ls_partsize_dt.Columns.Add("c8");
- ls_partsize_dt.Columns.Add("c9");
- DataRow dr = ls_partsize_dt.NewRow();
- for (int i = 1; i < 10; i++)
- {
- if (colid.Count < i)
- {
- dr["c" + i.ToString()] = "";
- }
- else
- {
- dr["c" + i.ToString()] = colid[i - 1];
- }
- }
- ls_partsize_dt.Rows.Add(dr);
- DataTable ls_Particel_dt = new DataTable();
- ls_Particel_dt.TableName = "Particel";
- 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 < data.Rows.Count; i++)
- {
- DataRow dr2 = ls_Particel_dt.NewRow();
- dr2["Name"] = data.Rows[i]["TypeName"].ToString();
- dr2["Class"] = data.Rows[i]["Class"].ToString();
- dr2["TypeId"] = data.Rows[i]["TypeId"].ToString();//获取分类编号
- for (int j = 1; j < 10; j++)
- {
- if (colid.Count >= j)
- {
- dr2["c" + j.ToString()] = Convert.ToDouble(data.Rows[i][colid[j - 1]]);
- }
- }
- if (dr2["Name"].ToString() != "" && dr2["Name"].ToString().IndexOf("number") < 0)
- {
- dr2["total"] = "0"; //求合
- double d_total = 0;
- for (int j = 1; j < 10; j++)
- {
- if (colid.Count >= j)
- {
- d_total = d_total + Convert.ToInt64(data.Rows[i][colid[j - 1]]);
- }
- }
- dr2["total"] = d_total.ToString();
- }
- ls_Particel_dt.Rows.Add(dr2);
- }
- return ls_Particel_dt;
-
- }
- public DataTable ParticleResults(c_TemplateClass m_mbszclass, OTSReport_Export m_otsreport_export, string ComputeMode)
- {
- DataTable data = GetDBData(m_mbszclass, m_otsreport_export, ComputeMode);
- List<string> colid = new List<string>();
- //获取粒级表
- string path1 = m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFileFolder +
- m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFile;
- DataSet ds = OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.GetXml(path1);
- string sizestr = ds.Tables[0].Rows[0]["Sizes"].ToString();
- for (int i = 0; i < sizestr.Split(',').Length - 1; i++)
- {
- if (sizestr.Split(',')[i].Length > 0)
- {
- double d1 = Convert.ToDouble(sizestr.Split(',')[i]);
- double d2 = Convert.ToDouble(sizestr.Split(',')[i + 1]);
- colid.Add(d1.ToString() + "~" + d2.ToString());
- }
- }
- double d = Convert.ToDouble(sizestr.Split(',')[sizestr.Split(',').Length - 1]);
- colid.Add(d.ToString() + "~MAX");
- ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.getSelectedIndex()].FilePath);
- //------------------------------------------------
- DataTable ls_partsize_dt = new DataTable();
- ls_partsize_dt.TableName = "PartSize";
- ls_partsize_dt.Columns.Add("c1");
- ls_partsize_dt.Columns.Add("c2");
- ls_partsize_dt.Columns.Add("c3");
- ls_partsize_dt.Columns.Add("c4");
- ls_partsize_dt.Columns.Add("c5");
- ls_partsize_dt.Columns.Add("c6");
- ls_partsize_dt.Columns.Add("c7");
- ls_partsize_dt.Columns.Add("c8");
- ls_partsize_dt.Columns.Add("c9");
- ls_partsize_dt.Columns.Add("c10");
- DataRow dr = ls_partsize_dt.NewRow();
- for (int i = 1; i < 10; i++)
- {
- if (colid.Count < i)
- {
- dr["c" + i.ToString()] = "";
- }
- else
- {
- dr["c" + i.ToString()] = colid[i - 1];
- }
- }
- 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("c10");
- ls_Particel_dt.Columns.Add("Name");
- ls_Particel_dt.Columns.Add("total");
- ls_Particel_dt.Columns.Add("TypeId");
- for (int i = 0; i < data.Rows.Count; i++)
- {
- DataRow dr2 = ls_Particel_dt.NewRow();
- dr2["Name"] = data.Rows[i]["TypeName"].ToString();
- dr2["TypeId"] = data.Rows[i]["TypeId"].ToString();//获取分类编号
- for (int j = 1; j < 11; j++)
- {
- if (colid.Count >= j)
- {
- double de = Convert.ToDouble(data.Rows[i][colid[j - 1]]);
- if (de == 0)
- dr2["c" + j.ToString()] = " ";
- else
- dr2["c" + j.ToString()] = de.ToString();
- }
- }
- if (dr2["Name"].ToString() != "" && dr2["Name"].ToString().IndexOf("number") < 0)
- {
- dr2["total"] = " "; //求合
- double d_total = 0;
- for (int j = 1; j < 11; j++)
- {
- if (colid.Count >= j)
- {
- d_total = d_total + Convert.ToInt64(data.Rows[i][colid[j - 1]]);
- }
- }
- if (d_total == 0)
- {
- continue;
- dr2["total"] = " ";
- }
- else
- dr2["total"] = d_total.ToString();
- }
- ls_Particel_dt.Rows.Add(dr2);
- }
- return ls_Particel_dt;
- }
- public DataTable TypeRange(c_TemplateClass m_mbszclass, OTSReport_Export m_otsreport_export)
- {
- List<string> colid = new List<string>();
- //获取粒级表
- string path1 = m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFileFolder +
- m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFile;
- DataSet ds = OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.GetXml(path1);
- string sizestr = ds.Tables[0].Rows[0]["Sizes"].ToString();
- for (int i = 0; i < sizestr.Split(',').Length - 1; i++)
- {
- if (sizestr.Split(',')[i].Length > 0)
- {
- double d1 = Convert.ToDouble(sizestr.Split(',')[i]);
- double d2 = Convert.ToDouble(sizestr.Split(',')[i + 1]);
- colid.Add(d1.ToString() + "~" + d2.ToString());
- }
- }
- double d = Convert.ToDouble(sizestr.Split(',')[sizestr.Split(',').Length - 1]);
- colid.Add(d.ToString() + "~MAX");
- DataTable ls_partsize_dt = new DataTable();
- ls_partsize_dt.TableName = "PartSize";
- ls_partsize_dt.Columns.Add("c1");
- ls_partsize_dt.Columns.Add("c2");
- ls_partsize_dt.Columns.Add("c3");
- ls_partsize_dt.Columns.Add("c4");
- ls_partsize_dt.Columns.Add("c5");
- ls_partsize_dt.Columns.Add("c6");
- ls_partsize_dt.Columns.Add("c7");
- ls_partsize_dt.Columns.Add("c8");
- ls_partsize_dt.Columns.Add("c9");
- ls_partsize_dt.Columns.Add("c10");
- ls_partsize_dt.Columns.Add("c11");
- ls_partsize_dt.Columns.Add("c12");
- DataRow dr = ls_partsize_dt.NewRow();
- for (int i = 1; i < 13; i++)
- {
- if (colid.Count < i)
- {
- dr["c" + i.ToString()] = "";
- }
- else
- {
- dr["c" + i.ToString()] = colid[i - 1];
- }
- }
- ls_partsize_dt.Rows.Add(dr);
- return ls_partsize_dt;
- }
- 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_Class.Rows.Add(dt_2.Rows[0].ItemArray);
- }
- return dt_Class;
- }
- private DataTable 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 (!string.IsNullOrWhiteSpace(ClassName[i].ToString()))
- if (dataTable.Rows[a]["Class"].ToString() == ClassName[i].ToString())
- {
- 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");
- return dt;
- }
- private DataTable InvalidRemoval(DataTable dt)
- {
- DataTable dataTable = dt.Copy();
- dataTable.Clear();
- for (int i = 0; i < dt.Rows.Count; i++)
- {
- if (Convert.ToInt32(dt.Rows[i]["TypeId"])>10 )
- {
- dataTable.Rows.Add(dt.Rows[i].ItemArray);
- }
- }
- return dataTable;
- }
-
- private DataTable GetParticleListForParticlSize(DataTable data, DataTable table)
- {
- DataTable dt_Partick = new DataTable();
- dt_Partick.Columns.Add("TypeId");
- dt_Partick.Columns.Add("TypeName");
- dt_Partick.Columns.Add("TypeColor");
- dt_Partick.Columns.Add("con");
- dt_Partick.Columns.Add("ar");
- dt_Partick.Columns.Add("max");
- dt_Partick.Columns.Add("Area", typeof(double));
- dt_Partick.Columns.Add("GroupName");
- List<string> typeName = new List<string>();
- for (int i = 0; i < data.Rows.Count; i++)
- {
- typeName.Add(data.Rows[i]["TypeId"].ToString());
- }
- typeName = typeName.Distinct().ToList();
- for (int i = 0; i < typeName.Count; i++)
- {
- DataTable dt = dt_Partick.Clone();
- for (int j = 0; j < data.Rows.Count; j++)
- {
- if (typeName[i].ToString() == data.Rows[j]["TypeId"].ToString())
- {
- DataRow row = dt.NewRow();
- row["TypeId"] = data.Rows[j]["TypeId"];
- row["TypeName"] = data.Rows[j]["TypeName"];
- row["TypeColor"] = data.Rows[j]["TypeColor"];
- row["Area"] = data.Rows[j]["Area"];
- dt.Rows.Add(row);
- }
- }
- DataRow dr = dt_Partick.NewRow();
- dr["TypeId"] = dt.Rows[0]["TypeId"].ToString();
- dr["TypeName"] = dt.Rows[0]["TypeName"].ToString();
- dr["TypeColor"] = dt.Rows[0]["TypeColor"].ToString();
- dr["con"] = dt.Rows.Count;
- dr["ar"] = dt.Compute("min(Area)", "");
- dr["max"] = dt.Compute("Max(Area)", "");
- dr["Area"] = dt.Compute("SUM(Area)", "");
- dt_Partick.Rows.Add(dr);
- }
- for (int i = 0; i < dt_Partick.Rows.Count; i++)
- {
- for (int j = 0; j < table.Rows.Count; j++)
- {
- if (dt_Partick.Rows[i]["TypeId"].ToString() == table.Rows[j]["TypeId"].ToString())
- {
- dt_Partick.Rows[i]["GroupName"] = table.Rows[j]["GroupName"];
- break;
- }
- }
- }
- return dt_Partick;
- }
- private string getWhere(string max, string min, string col, string partic)
- {
- return col + ">=" + min + " and " + col + "<" + max + " and TypeId=" + partic;
- }
- private DataTable GetDBData(c_TemplateClass m_mbszclass , OTSReport_Export m_otsreport_export,string ComputeMode)
- {
- DataTable m_bt_DBData = new DataTable();
- ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.getSelectedIndex()].FilePath);
- List<string> colid = new List<string>() { "TypeName", "ar", "TypeId", "Largest", "Class", "con" };
- //获取粒级表
- string path1 = m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFileFolder +
- m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFile;
- DataSet ds = OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.GetXml(path1);
- string sizestr = ds.Tables[0].Rows[0]["Sizes"].ToString();
- for (int i = 0; i < sizestr.Split(',').Length - 1; i++)
- {
- if (sizestr.Split(',')[i].Length > 0)
- {
- double d1 = Convert.ToDouble(sizestr.Split(',')[i]);
- double d2 = Convert.ToDouble(sizestr.Split(',')[i + 1]);
- colid.Add(d1.ToString() + "~" + d2.ToString());
- }
- }
- double d = Convert.ToDouble(sizestr.Split(',')[sizestr.Split(',').Length - 1]);
- colid.Add(d.ToString() + "~MAX");
- for (int i = 0; i < colid.Count; i++)
- {
- m_bt_DBData.Columns.Add(colid[i].ToString());
- }
- DataTable dt = InvalidRemoval(fielddata.GetParticleListForParticlSize("area", ""));
- DataTable AreaInformationOfAllElements = InvalidRemoval(fielddata.GetAreaByAllIncA(""));
- DataTable dtp = InvalidRemoval(fielddata.GetParticleAll(""));
-
- string po = ComputeMode;
- switch (po)
- {
- case "DMAX":
- po = "DMAX";
- break;
- case "DMIN":
- po = "DMIN";
- break;
- case "ECD":
- po = "Area";
- break;
- case "FERET":
- po = "DFERET";
- break;
- }
- for (int i = 0; i < dt.Rows.Count; i++)
- {
- DataRow dr = m_bt_DBData.NewRow();
- dr["TypeName"] = dt.Rows[i]["TypeName"].ToString();
- dr["TypeId"] = dt.Rows[i]["TypeId"].ToString();
- dr["con"] = dt.Rows[i]["con"].ToString();
- if (dt.Rows[i]["GroupName"].ToString() == "")
- dr["Class"] = "Default";
- else
- dr["Class"] = dt.Rows[i]["GroupName"].ToString();
- //continue;
- dr["Largest"] = Math.Round(Convert.ToDouble(dt.Rows[i]["max"]), 2);
- for (int a = 6; a < colid.Count; a++)
- {
- string d1 = colid[a].Split('~')[0];
- string d2 = colid[a].Split('~')[1];
- if (d2 == "MAX")
- {
- d2 = "999";
- }
- DataRow[] datas = dtp.Select(getWhere(d2, d1, po, dt.Rows[i]["TypeId"].ToString()));
- dr[colid[a]] = datas.Count();
- }
- for (int a = 0; a < AreaInformationOfAllElements.Rows.Count; a++)
- {
- if (dt.Rows[i]["TypeId"].ToString() == AreaInformationOfAllElements.Rows[a]["TypeId"].ToString())
- {
- dr["ar"] = AreaInformationOfAllElements.Rows[a]["ar"];
- }
- }
- m_bt_DBData.Rows.Add(dr);
- }
- //去除物质分类(非夹杂物分类)
- for (int a = 0; a < m_mbszclass.M_KLLBXX.list_str_kllb_DeleteClass.Count; a++)
- {
- for (int i = m_bt_DBData.Rows.Count - 1; i >= 0; i--)
- {
- if (m_bt_DBData.Rows[i]["TypeName"].ToString() == m_mbszclass.M_KLLBXX.list_str_kllb_DeleteClass[a].ToString())
- {
- m_bt_DBData.Rows.RemoveAt(i);
- }
- }
- }
- if (m_mbszclass.list_str_MainPriority.Count==0)
- {
- return m_bt_DBData;
- }
- DataTable datass = m_bt_DBData.Clone();
- for (int i = 0; i < m_bt_DBData.Rows.Count; i++)
- {
- for (int a = 0; a < m_mbszclass.list_str_MainPriority.Count; a++)
- {
- if (m_bt_DBData.Rows[i]["TypeName"].ToString() == m_mbszclass.list_str_MainPriority[a])
- {
- datass.Rows.Add(m_bt_DBData.Rows[i].ItemArray);
- continue;
- }
- }
- }
- return datass;
- }
-
- }
- }
|