ParticleAnalysis.cs 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129
  1. 
  2. using OTSCommon.Model;
  3. using OTSIncAReportApp.DataOperation.DataAccess;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Data;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using static OTSIncAReportApp.OTSReport_Export;
  11. namespace OTSIncAReportApp._1_UI.OTSReportExport.DataIntegration
  12. {
  13. /// <summary>
  14. /// 颗粒分析
  15. /// </summary>
  16. class ParticleAnalysis
  17. {
  18. /// <summary>
  19. /// 大分类
  20. /// </summary>
  21. /// <returns></returns>
  22. public DataTable GetLargeClassification(c_TemplateClass m_mbszclass, OTSReport_Export m_otsreport_export,string ComputeMode)
  23. {
  24. DataTable data = GetDBData(m_mbszclass, m_otsreport_export, ComputeMode);
  25. List<string> colid = new List<string>();
  26. //获取粒级表
  27. string path1 = m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFileFolder +
  28. m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFile;
  29. DataSet ds = OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.GetXml(path1);
  30. string sizestr = ds.Tables[0].Rows[0]["Sizes"].ToString();
  31. for (int i = 0; i < sizestr.Split(',').Length - 1; i++)
  32. {
  33. if (sizestr.Split(',')[i].Length > 0)
  34. {
  35. double d1 = Convert.ToDouble(sizestr.Split(',')[i]);
  36. double d2 = Convert.ToDouble(sizestr.Split(',')[i + 1]);
  37. colid.Add(d1.ToString() + "~" + d2.ToString());
  38. }
  39. }
  40. double d = Convert.ToDouble(sizestr.Split(',')[sizestr.Split(',').Length - 1]);
  41. colid.Add(d.ToString() + "~MAX");
  42. ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.getSelectedIndex()].FilePath);
  43. DataTable ls_partsize_dt = new DataTable();
  44. ls_partsize_dt.TableName = "PartSize";
  45. ls_partsize_dt.Columns.Add("c1");
  46. ls_partsize_dt.Columns.Add("c2");
  47. ls_partsize_dt.Columns.Add("c3");
  48. ls_partsize_dt.Columns.Add("c4");
  49. ls_partsize_dt.Columns.Add("c5");
  50. ls_partsize_dt.Columns.Add("c6");
  51. ls_partsize_dt.Columns.Add("c7");
  52. ls_partsize_dt.Columns.Add("c8");
  53. ls_partsize_dt.Columns.Add("c9");
  54. DataRow dr = ls_partsize_dt.NewRow();
  55. for (int i = 1; i < 10; i++)
  56. {
  57. if (colid.Count < i)
  58. {
  59. dr["c" + i.ToString()] = "";
  60. }
  61. else
  62. {
  63. dr["c" + i.ToString()] = colid[i - 1];
  64. }
  65. }
  66. ls_partsize_dt.Rows.Add(dr);
  67. DataTable ls_Particel_dt = new DataTable();
  68. ls_Particel_dt.TableName = "Particel";
  69. ls_Particel_dt.Columns.Add("c1", typeof(double));
  70. ls_Particel_dt.Columns.Add("c2", typeof(double));
  71. ls_Particel_dt.Columns.Add("c3", typeof(double));
  72. ls_Particel_dt.Columns.Add("c4", typeof(double));
  73. ls_Particel_dt.Columns.Add("c5", typeof(double));
  74. ls_Particel_dt.Columns.Add("c6", typeof(double));
  75. ls_Particel_dt.Columns.Add("c7", typeof(double));
  76. ls_Particel_dt.Columns.Add("c8", typeof(double));
  77. ls_Particel_dt.Columns.Add("c9", typeof(double));
  78. ls_Particel_dt.Columns.Add("Name");
  79. ls_Particel_dt.Columns.Add("total", typeof(double));
  80. ls_Particel_dt.Columns.Add("TypeId");
  81. ls_Particel_dt.Columns.Add("Class");
  82. for (int i = 0; i < data.Rows.Count; i++)
  83. {
  84. DataRow dr2 = ls_Particel_dt.NewRow();
  85. dr2["Name"] = data.Rows[i]["TypeName"].ToString();
  86. dr2["Class"] = data.Rows[i]["Class"].ToString();
  87. dr2["TypeId"] = data.Rows[i]["TypeId"].ToString();//获取分类编号
  88. for (int j = 1; j < 10; j++)
  89. {
  90. if (colid.Count >= j)
  91. {
  92. dr2["c" + j.ToString()] = Convert.ToDouble(data.Rows[i][colid[j - 1]]);
  93. }
  94. }
  95. if (dr2["Name"].ToString() != "" && dr2["Name"].ToString().IndexOf("number") < 0)
  96. {
  97. dr2["total"] = "0"; //求合
  98. double d_total = 0;
  99. for (int j = 1; j < 10; j++)
  100. {
  101. if (colid.Count >= j)
  102. {
  103. d_total = d_total + Convert.ToInt64(data.Rows[i][colid[j - 1]]);
  104. }
  105. }
  106. dr2["total"] = d_total.ToString();
  107. }
  108. ls_Particel_dt.Rows.Add(dr2);
  109. }
  110. //按照list列表进行物质类排序,物质类中的元素分类按照面积的大小进行排序
  111. List<string> ClassName = new List<string>();
  112. DataTable getClass_dt = fielddata.GetAllClass();
  113. for (int i = 0; i < getClass_dt.Rows.Count; i++)
  114. {
  115. if (getClass_dt.Rows[i]["GroupName"].ToString() != "NOT_INCLUTION" && getClass_dt.Rows[i]["GroupName"].ToString() != "Invalid")
  116. if (getClass_dt.Rows[i]["GroupName"].ToString() == "")
  117. ClassName.Add("NULL");
  118. else
  119. ClassName.Add(getClass_dt.Rows[i]["GroupName"].ToString());
  120. }
  121. //获取大分类信息
  122. DataTable dt = QuantityOfIntegratedSubstances(ls_Particel_dt, ClassName);
  123. return dt;
  124. }
  125. /// <summary>
  126. /// 小分类
  127. /// </summary>
  128. /// <returns></returns>
  129. public DataTable GetSubClassification(c_TemplateClass m_mbszclass, OTSReport_Export m_otsreport_export, string ComputeMode)
  130. {
  131. DataTable data = GetDBData(m_mbszclass, m_otsreport_export, ComputeMode);
  132. List<string> colid = new List<string>();
  133. //获取粒级表
  134. string path1 = m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFileFolder +
  135. m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFile;
  136. DataSet ds = OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.GetXml(path1);
  137. string sizestr = ds.Tables[0].Rows[0]["Sizes"].ToString();
  138. for (int i = 0; i < sizestr.Split(',').Length - 1; i++)
  139. {
  140. if (sizestr.Split(',')[i].Length > 0)
  141. {
  142. double d1 = Convert.ToDouble(sizestr.Split(',')[i]);
  143. double d2 = Convert.ToDouble(sizestr.Split(',')[i + 1]);
  144. colid.Add(d1.ToString() + "~" + d2.ToString());
  145. }
  146. }
  147. double d = Convert.ToDouble(sizestr.Split(',')[sizestr.Split(',').Length - 1]);
  148. colid.Add(d.ToString() + "~MAX");
  149. //------------------------------------------------
  150. DataTable ls_partsize_dt = new DataTable();
  151. ls_partsize_dt.TableName = "PartSize";
  152. ls_partsize_dt.Columns.Add("c1");
  153. ls_partsize_dt.Columns.Add("c2");
  154. ls_partsize_dt.Columns.Add("c3");
  155. ls_partsize_dt.Columns.Add("c4");
  156. ls_partsize_dt.Columns.Add("c5");
  157. ls_partsize_dt.Columns.Add("c6");
  158. ls_partsize_dt.Columns.Add("c7");
  159. ls_partsize_dt.Columns.Add("c8");
  160. ls_partsize_dt.Columns.Add("c9");
  161. DataRow dr = ls_partsize_dt.NewRow();
  162. for (int i = 1; i < 10; i++)
  163. {
  164. if (colid.Count < i)
  165. {
  166. dr["c" + i.ToString()] = "";
  167. }
  168. else
  169. {
  170. dr["c" + i.ToString()] = colid[i - 1];
  171. }
  172. }
  173. ls_partsize_dt.Rows.Add(dr);
  174. DataTable ls_Particel_dt = new DataTable();
  175. ls_Particel_dt.TableName = "Particel";
  176. ls_Particel_dt.Columns.Add("c1", typeof(double));
  177. ls_Particel_dt.Columns.Add("c2", typeof(double));
  178. ls_Particel_dt.Columns.Add("c3", typeof(double));
  179. ls_Particel_dt.Columns.Add("c4", typeof(double));
  180. ls_Particel_dt.Columns.Add("c5", typeof(double));
  181. ls_Particel_dt.Columns.Add("c6", typeof(double));
  182. ls_Particel_dt.Columns.Add("c7", typeof(double));
  183. ls_Particel_dt.Columns.Add("c8", typeof(double));
  184. ls_Particel_dt.Columns.Add("c9", typeof(double));
  185. ls_Particel_dt.Columns.Add("Name");
  186. ls_Particel_dt.Columns.Add("total", typeof(double));
  187. ls_Particel_dt.Columns.Add("TypeId");
  188. ls_Particel_dt.Columns.Add("Class");
  189. for (int i = 0; i < data.Rows.Count; i++)
  190. {
  191. DataRow dr2 = ls_Particel_dt.NewRow();
  192. dr2["Name"] = data.Rows[i]["TypeName"].ToString();
  193. dr2["Class"] = data.Rows[i]["Class"].ToString();
  194. dr2["TypeId"] = data.Rows[i]["TypeId"].ToString();//获取分类编号
  195. for (int j = 1; j < 10; j++)
  196. {
  197. if (colid.Count >= j)
  198. {
  199. dr2["c" + j.ToString()] = Convert.ToDouble(data.Rows[i][colid[j - 1]]);
  200. }
  201. }
  202. if (dr2["Name"].ToString() != "" && dr2["Name"].ToString().IndexOf("number") < 0)
  203. {
  204. dr2["total"] = "0"; //求合
  205. double d_total = 0;
  206. for (int j = 1; j < 10; j++)
  207. {
  208. if (colid.Count >= j)
  209. {
  210. d_total = d_total + Convert.ToInt64(data.Rows[i][colid[j - 1]]);
  211. }
  212. }
  213. dr2["total"] = d_total.ToString();
  214. }
  215. ls_Particel_dt.Rows.Add(dr2);
  216. }
  217. return ls_Particel_dt;
  218. }
  219. /// <summary>
  220. /// 分类整合大小分类都有
  221. /// </summary>
  222. /// <returns></returns>
  223. public List<DataTable> GetClassificationConsolidationTable(c_TemplateClass m_mbszclass, OTSReport_Export m_otsreport_export, string ComputeMode)
  224. {
  225. List<DataTable> datas = new List<DataTable>();
  226. DataTable data = GetDBData(m_mbszclass, m_otsreport_export, ComputeMode);
  227. List<string> colid = new List<string>();
  228. //获取粒级表
  229. string path1 = m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFileFolder +
  230. m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFile;
  231. DataSet ds = OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.GetXml(path1);
  232. string sizestr = ds.Tables[0].Rows[0]["Sizes"].ToString();
  233. for (int i = 0; i < sizestr.Split(',').Length - 1; i++)
  234. {
  235. if (sizestr.Split(',')[i].Length > 0)
  236. {
  237. double d1 = Convert.ToDouble(sizestr.Split(',')[i]);
  238. double d2 = Convert.ToDouble(sizestr.Split(',')[i + 1]);
  239. colid.Add(d1.ToString() + "~" + d2.ToString());
  240. }
  241. }
  242. double d = Convert.ToDouble(sizestr.Split(',')[sizestr.Split(',').Length - 1]);
  243. colid.Add(d.ToString() + "~MAX");
  244. ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.getSelectedIndex()].FilePath);
  245. //------------------------------------------------
  246. DataTable ls_partsize_dt = new DataTable();
  247. ls_partsize_dt.TableName = "PartSize";
  248. ls_partsize_dt.Columns.Add("c1");
  249. ls_partsize_dt.Columns.Add("c2");
  250. ls_partsize_dt.Columns.Add("c3");
  251. ls_partsize_dt.Columns.Add("c4");
  252. ls_partsize_dt.Columns.Add("c5");
  253. ls_partsize_dt.Columns.Add("c6");
  254. ls_partsize_dt.Columns.Add("c7");
  255. ls_partsize_dt.Columns.Add("c8");
  256. ls_partsize_dt.Columns.Add("c9");
  257. DataRow dr = ls_partsize_dt.NewRow();
  258. for (int i = 1; i < 10; i++)
  259. {
  260. if (colid.Count < i)
  261. {
  262. dr["c" + i.ToString()] = "";
  263. }
  264. else
  265. {
  266. dr["c" + i.ToString()] = colid[i - 1];
  267. }
  268. }
  269. ls_partsize_dt.Rows.Add(dr);
  270. DataTable ls_Particel_dt = new DataTable();
  271. ls_Particel_dt.TableName = "Particel";
  272. ls_Particel_dt.Columns.Add("c1", typeof(double));
  273. ls_Particel_dt.Columns.Add("c2", typeof(double));
  274. ls_Particel_dt.Columns.Add("c3", typeof(double));
  275. ls_Particel_dt.Columns.Add("c4", typeof(double));
  276. ls_Particel_dt.Columns.Add("c5", typeof(double));
  277. ls_Particel_dt.Columns.Add("c6", typeof(double));
  278. ls_Particel_dt.Columns.Add("c7", typeof(double));
  279. ls_Particel_dt.Columns.Add("c8", typeof(double));
  280. ls_Particel_dt.Columns.Add("c9", typeof(double));
  281. ls_Particel_dt.Columns.Add("Name");
  282. ls_Particel_dt.Columns.Add("total", typeof(double));
  283. ls_Particel_dt.Columns.Add("TypeId");
  284. ls_Particel_dt.Columns.Add("Class");
  285. for (int i = 0; i < data.Rows.Count; i++)
  286. {
  287. DataRow dr2 = ls_Particel_dt.NewRow();
  288. dr2["Name"] = data.Rows[i]["TypeName"].ToString();
  289. dr2["Class"] = data.Rows[i]["Class"].ToString();
  290. dr2["TypeId"] = data.Rows[i]["TypeId"].ToString();//获取分类编号
  291. for (int j = 1; j < 10; j++)
  292. {
  293. if (colid.Count >= j)
  294. {
  295. dr2["c" + j.ToString()] = Convert.ToDouble(data.Rows[i][colid[j - 1]]);
  296. }
  297. }
  298. if (dr2["Name"].ToString() != "" && dr2["Name"].ToString().IndexOf("number") < 0)
  299. {
  300. dr2["total"] = "0"; //求合
  301. double d_total = 0;
  302. for (int j = 1; j < 10; j++)
  303. {
  304. if (colid.Count >= j)
  305. {
  306. d_total = d_total + Convert.ToInt64(data.Rows[i][colid[j - 1]]);
  307. }
  308. }
  309. dr2["total"] = d_total.ToString();
  310. }
  311. ls_Particel_dt.Rows.Add(dr2);
  312. }
  313. //按照list列表进行物质类排序,物质类中的元素分类按照面积的大小进行排序
  314. List<string> ClassName = new List<string>();
  315. DataTable getClass_dt = fielddata.GetAllClass();
  316. bool bl = false;
  317. for (int i = 0; i < getClass_dt.Rows.Count; i++)
  318. {
  319. if (getClass_dt.Rows[i]["GroupName"].ToString() != "NOT_INCLUTION" && getClass_dt.Rows[i]["GroupName"].ToString() != "Invalid"
  320. && getClass_dt.Rows[i]["GroupName"].ToString() != "Not Identified")
  321. if (getClass_dt.Rows[i]["GroupName"].ToString() == "")
  322. {
  323. if (!bl)
  324. {
  325. ClassName.Add("Default");
  326. bl = true;
  327. }
  328. }
  329. else
  330. {
  331. if (getClass_dt.Rows[i]["GroupName"].ToString() != "Default")
  332. {
  333. ClassName.Add(getClass_dt.Rows[i]["GroupName"].ToString());
  334. }
  335. }
  336. }
  337. //获取大分类信息
  338. DataTable dt = QuantityOfIntegratedSubstances(ls_Particel_dt, ClassName);
  339. DataTable data2 = classIfIcationSort(ls_Particel_dt, ClassName, dt);
  340. datas.Add(ls_partsize_dt.Copy());
  341. datas.Add(data2.Copy());
  342. return datas;
  343. }
  344. /// <summary>
  345. /// 判断是否有大分类,有为true
  346. /// </summary>
  347. /// <param name="m_otsreport_export"></param>
  348. /// <returns></returns>
  349. public bool IsThereAMajorClassification(OTSReport_Export m_otsreport_export)
  350. {
  351. ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.getSelectedIndex()].FilePath);
  352. DataTable getClass_dt = fielddata.GetAllClass();
  353. List<string> ClassName = new List<string>();
  354. bool bl = false;
  355. for (int i = 0; i < getClass_dt.Rows.Count; i++)
  356. {
  357. if (getClass_dt.Rows[i]["GroupName"].ToString() != "NOT_INCLUTION" && getClass_dt.Rows[i]["GroupName"].ToString() != "Invalid"
  358. && getClass_dt.Rows[i]["GroupName"].ToString() != "Not Identified")
  359. if (getClass_dt.Rows[i]["GroupName"].ToString() == "")
  360. {
  361. if (!bl)
  362. {
  363. ClassName.Add("Default");
  364. bl = true;
  365. }
  366. }
  367. else
  368. {
  369. if (getClass_dt.Rows[i]["GroupName"].ToString() != "Default")
  370. {
  371. ClassName.Add(getClass_dt.Rows[i]["GroupName"].ToString());
  372. }
  373. }
  374. }
  375. if (ClassName.Count < 2)
  376. {
  377. return false;
  378. }
  379. else
  380. {
  381. return true;
  382. }
  383. }
  384. /// <summary>
  385. /// 大分类chart数据
  386. /// </summary>
  387. /// <param name="m_mbszclass"></param>
  388. /// <param name="m_otsreport_export"></param>
  389. /// <returns></returns>
  390. public DataTable GetChartDataCalss(c_TemplateClass m_mbszclass, OTSReport_Export m_otsreport_export, string ComputeMode)
  391. {
  392. DataTable data = GetDBData(m_mbszclass, m_otsreport_export, ComputeMode);
  393. List<string> colid = new List<string>();
  394. //获取粒级表
  395. string path1 = m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFileFolder +
  396. m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFile;
  397. DataSet ds = OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.GetXml(path1);
  398. string sizestr = ds.Tables[0].Rows[0]["Sizes"].ToString();
  399. for (int i = 0; i < sizestr.Split(',').Length - 1; i++)
  400. {
  401. if (sizestr.Split(',')[i].Length > 0)
  402. {
  403. double d1 = Convert.ToDouble(sizestr.Split(',')[i]);
  404. double d2 = Convert.ToDouble(sizestr.Split(',')[i + 1]);
  405. colid.Add(d1.ToString() + "~" + d2.ToString());
  406. }
  407. }
  408. double d = Convert.ToDouble(sizestr.Split(',')[sizestr.Split(',').Length - 1]);
  409. colid.Add(d.ToString() + "~MAX");
  410. ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.getSelectedIndex()].FilePath);
  411. //------------------------------------------------
  412. DataTable ls_partsize_dt = new DataTable();
  413. ls_partsize_dt.TableName = "PartSize";
  414. ls_partsize_dt.Columns.Add("c1");
  415. ls_partsize_dt.Columns.Add("c2");
  416. ls_partsize_dt.Columns.Add("c3");
  417. ls_partsize_dt.Columns.Add("c4");
  418. ls_partsize_dt.Columns.Add("c5");
  419. ls_partsize_dt.Columns.Add("c6");
  420. ls_partsize_dt.Columns.Add("c7");
  421. ls_partsize_dt.Columns.Add("c8");
  422. ls_partsize_dt.Columns.Add("c9");
  423. DataRow dr = ls_partsize_dt.NewRow();
  424. for (int i = 1; i < 10; i++)
  425. {
  426. if (colid.Count < i)
  427. {
  428. dr["c" + i.ToString()] = "";
  429. }
  430. else
  431. {
  432. dr["c" + i.ToString()] = colid[i - 1];
  433. }
  434. }
  435. ls_partsize_dt.Rows.Add(dr);
  436. DataTable ls_Particel_dt = new DataTable();
  437. ls_Particel_dt.TableName = "Particel";
  438. ls_Particel_dt.Columns.Add("c1", typeof(double));
  439. ls_Particel_dt.Columns.Add("c2", typeof(double));
  440. ls_Particel_dt.Columns.Add("c3", typeof(double));
  441. ls_Particel_dt.Columns.Add("c4", typeof(double));
  442. ls_Particel_dt.Columns.Add("c5", typeof(double));
  443. ls_Particel_dt.Columns.Add("c6", typeof(double));
  444. ls_Particel_dt.Columns.Add("c7", typeof(double));
  445. ls_Particel_dt.Columns.Add("c8", typeof(double));
  446. ls_Particel_dt.Columns.Add("c9", typeof(double));
  447. ls_Particel_dt.Columns.Add("Name");
  448. ls_Particel_dt.Columns.Add("total", typeof(double));
  449. ls_Particel_dt.Columns.Add("TypeId");
  450. ls_Particel_dt.Columns.Add("Class");
  451. for (int i = 0; i < data.Rows.Count; i++)
  452. {
  453. DataRow dr2 = ls_Particel_dt.NewRow();
  454. dr2["Name"] = data.Rows[i]["TypeName"].ToString();
  455. dr2["Class"] = data.Rows[i]["Class"].ToString();
  456. dr2["TypeId"] = data.Rows[i]["TypeId"].ToString();//获取分类编号
  457. for (int j = 1; j < 10; j++)
  458. {
  459. if (colid.Count >= j)
  460. {
  461. dr2["c" + j.ToString()] = Convert.ToDouble(data.Rows[i][colid[j - 1]]);
  462. }
  463. }
  464. if (dr2["Name"].ToString() != "" && dr2["Name"].ToString().IndexOf("number") < 0)
  465. {
  466. dr2["total"] = "0"; //求合
  467. double d_total = 0;
  468. for (int j = 1; j < 10; j++)
  469. {
  470. if (colid.Count >= j)
  471. {
  472. d_total = d_total + Convert.ToInt64(data.Rows[i][colid[j - 1]]);
  473. }
  474. }
  475. dr2["total"] = d_total.ToString();
  476. }
  477. ls_Particel_dt.Rows.Add(dr2);
  478. }
  479. //按照list列表进行物质类排序,物质类中的元素分类按照面积的大小进行排序
  480. List<string> ClassName = new List<string>();
  481. DataTable getClass_dt = fielddata.GetAllClass();
  482. for (int i = 0; i < getClass_dt.Rows.Count; i++)
  483. {
  484. if (getClass_dt.Rows[i]["GroupName"].ToString() != "NOT_INCLUTION" && getClass_dt.Rows[i]["GroupName"].ToString() != "Invalid")
  485. if (getClass_dt.Rows[i]["GroupName"].ToString() == "")
  486. ClassName.Add("NULL");
  487. else
  488. ClassName.Add(getClass_dt.Rows[i]["GroupName"].ToString());
  489. }
  490. //颗粒尺寸数据(例 1.5有多少,2.0有多少)
  491. DataTable colid_data = new DataTable();
  492. colid_data.Columns.Add("name");
  493. colid_data.Columns.Add("quantity", typeof(double));
  494. for (int i = 0; i < ls_Particel_dt.Columns.Count; i++)
  495. {
  496. if (ls_Particel_dt.Columns[i].ColumnName == "c" + (i + 1).ToString())
  497. {
  498. if (i < colid.Count)
  499. {
  500. DataRow dr1 = colid_data.NewRow();
  501. dr1["name"] = colid[i].ToString();
  502. int quantity = 0;
  503. for (int a = 0; a < ls_Particel_dt.Rows.Count; a++)
  504. {
  505. quantity = quantity + Convert.ToInt32(ls_Particel_dt.Rows[a][i].ToString());
  506. }
  507. dr1["quantity"] = quantity.ToString();
  508. colid_data.Rows.Add(dr1);
  509. }
  510. }
  511. }
  512. return colid_data;
  513. }
  514. /// <summary>
  515. /// 小分类chart数据
  516. /// </summary>
  517. /// <param name="m_mbszclass"></param>
  518. /// <param name="m_otsreport_export"></param>
  519. /// <returns></returns>
  520. public DataTable GetChartDataSubdivision(c_TemplateClass m_mbszclass, OTSReport_Export m_otsreport_export, string ComputeMode)
  521. {
  522. DataTable data = GetDBData(m_mbszclass, m_otsreport_export, ComputeMode);
  523. List<string> colid = new List<string>();
  524. string path1 = m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFileFolder +
  525. m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFile;
  526. DataSet ds = OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.GetXml(path1);
  527. string sizestr = ds.Tables[0].Rows[0]["Sizes"].ToString();
  528. for (int i = 0; i < sizestr.Split(',').Length - 1; i++)
  529. {
  530. if (sizestr.Split(',')[i].Length > 0)
  531. {
  532. double d1 = Convert.ToDouble(sizestr.Split(',')[i]);
  533. double d2 = Convert.ToDouble(sizestr.Split(',')[i + 1]);
  534. colid.Add(d1.ToString() + "~" + d2.ToString());
  535. }
  536. }
  537. double d = Convert.ToDouble(sizestr.Split(',')[sizestr.Split(',').Length - 1]);
  538. colid.Add(d.ToString() + "~MAX");
  539. //------------------------------------------------
  540. DataTable ls_partsize_dt = new DataTable();
  541. ls_partsize_dt.TableName = "PartSize";
  542. ls_partsize_dt.Columns.Add("c1");
  543. ls_partsize_dt.Columns.Add("c2");
  544. ls_partsize_dt.Columns.Add("c3");
  545. ls_partsize_dt.Columns.Add("c4");
  546. ls_partsize_dt.Columns.Add("c5");
  547. ls_partsize_dt.Columns.Add("c6");
  548. ls_partsize_dt.Columns.Add("c7");
  549. ls_partsize_dt.Columns.Add("c8");
  550. ls_partsize_dt.Columns.Add("c9");
  551. DataRow dr = ls_partsize_dt.NewRow();
  552. for (int i = 1; i < 10; i++)
  553. {
  554. if (colid.Count < i)
  555. {
  556. dr["c" + i.ToString()] = "";
  557. }
  558. else
  559. {
  560. dr["c" + i.ToString()] = colid[i - 1];
  561. }
  562. }
  563. ls_partsize_dt.Rows.Add(dr);
  564. DataTable ls_Particel_dt = new DataTable();
  565. ls_Particel_dt.TableName = "Particel";
  566. ls_Particel_dt.Columns.Add("c1", typeof(double));
  567. ls_Particel_dt.Columns.Add("c2", typeof(double));
  568. ls_Particel_dt.Columns.Add("c3", typeof(double));
  569. ls_Particel_dt.Columns.Add("c4", typeof(double));
  570. ls_Particel_dt.Columns.Add("c5", typeof(double));
  571. ls_Particel_dt.Columns.Add("c6", typeof(double));
  572. ls_Particel_dt.Columns.Add("c7", typeof(double));
  573. ls_Particel_dt.Columns.Add("c8", typeof(double));
  574. ls_Particel_dt.Columns.Add("c9", typeof(double));
  575. ls_Particel_dt.Columns.Add("Name");
  576. ls_Particel_dt.Columns.Add("total", typeof(double));
  577. ls_Particel_dt.Columns.Add("TypeId");
  578. ls_Particel_dt.Columns.Add("Class");
  579. for (int i = 0; i < data.Rows.Count; i++)
  580. {
  581. DataRow dr2 = ls_Particel_dt.NewRow();
  582. dr2["Name"] = data.Rows[i]["TypeName"].ToString();
  583. dr2["Class"] = data.Rows[i]["Class"].ToString();
  584. dr2["TypeId"] = data.Rows[i]["TypeId"].ToString();//获取分类编号
  585. for (int j = 1; j < 10; j++)
  586. {
  587. if (colid.Count >= j)
  588. {
  589. dr2["c" + j.ToString()] = Convert.ToDouble(data.Rows[i][colid[j - 1]]);
  590. }
  591. }
  592. if (dr2["Name"].ToString() != "" && dr2["Name"].ToString().IndexOf("number") < 0)
  593. {
  594. dr2["total"] = "0"; //求合
  595. double d_total = 0;
  596. for (int j = 1; j < 10; j++)
  597. {
  598. if (colid.Count >= j)
  599. {
  600. d_total = d_total + Convert.ToInt64(data.Rows[i][colid[j - 1]]);
  601. }
  602. }
  603. dr2["total"] = d_total.ToString();
  604. }
  605. ls_Particel_dt.Rows.Add(dr2);
  606. }
  607. return ls_Particel_dt;
  608. }
  609. public DataTable ParticleResults(c_TemplateClass m_mbszclass, OTSReport_Export m_otsreport_export, string ComputeMode)
  610. {
  611. DataTable data = GetDBData(m_mbszclass, m_otsreport_export, ComputeMode);
  612. List<string> colid = new List<string>();
  613. //获取粒级表
  614. string path1 = m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFileFolder +
  615. m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFile;
  616. DataSet ds = OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.GetXml(path1);
  617. string sizestr = ds.Tables[0].Rows[0]["Sizes"].ToString();
  618. for (int i = 0; i < sizestr.Split(',').Length - 1; i++)
  619. {
  620. if (sizestr.Split(',')[i].Length > 0)
  621. {
  622. double d1 = Convert.ToDouble(sizestr.Split(',')[i]);
  623. double d2 = Convert.ToDouble(sizestr.Split(',')[i + 1]);
  624. colid.Add(d1.ToString() + "~" + d2.ToString());
  625. }
  626. }
  627. double d = Convert.ToDouble(sizestr.Split(',')[sizestr.Split(',').Length - 1]);
  628. colid.Add(d.ToString() + "~MAX");
  629. ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.getSelectedIndex()].FilePath);
  630. //------------------------------------------------
  631. DataTable ls_partsize_dt = new DataTable();
  632. ls_partsize_dt.TableName = "PartSize";
  633. ls_partsize_dt.Columns.Add("c1");
  634. ls_partsize_dt.Columns.Add("c2");
  635. ls_partsize_dt.Columns.Add("c3");
  636. ls_partsize_dt.Columns.Add("c4");
  637. ls_partsize_dt.Columns.Add("c5");
  638. ls_partsize_dt.Columns.Add("c6");
  639. ls_partsize_dt.Columns.Add("c7");
  640. ls_partsize_dt.Columns.Add("c8");
  641. ls_partsize_dt.Columns.Add("c9");
  642. ls_partsize_dt.Columns.Add("c10");
  643. DataRow dr = ls_partsize_dt.NewRow();
  644. for (int i = 1; i < 10; i++)
  645. {
  646. if (colid.Count < i)
  647. {
  648. dr["c" + i.ToString()] = "";
  649. }
  650. else
  651. {
  652. dr["c" + i.ToString()] = colid[i - 1];
  653. }
  654. }
  655. ls_partsize_dt.Rows.Add(dr);
  656. DataTable ls_Particel_dt = new DataTable();
  657. ls_Particel_dt.TableName = "Particel";
  658. ls_Particel_dt.Columns.Add("c1");
  659. ls_Particel_dt.Columns.Add("c2");
  660. ls_Particel_dt.Columns.Add("c3");
  661. ls_Particel_dt.Columns.Add("c4");
  662. ls_Particel_dt.Columns.Add("c5");
  663. ls_Particel_dt.Columns.Add("c6");
  664. ls_Particel_dt.Columns.Add("c7");
  665. ls_Particel_dt.Columns.Add("c8");
  666. ls_Particel_dt.Columns.Add("c9");
  667. ls_Particel_dt.Columns.Add("c10");
  668. ls_Particel_dt.Columns.Add("Name");
  669. ls_Particel_dt.Columns.Add("total");
  670. ls_Particel_dt.Columns.Add("TypeId");
  671. for (int i = 0; i < data.Rows.Count; i++)
  672. {
  673. DataRow dr2 = ls_Particel_dt.NewRow();
  674. dr2["Name"] = data.Rows[i]["TypeName"].ToString();
  675. dr2["TypeId"] = data.Rows[i]["TypeId"].ToString();//获取分类编号
  676. for (int j = 1; j < 11; j++)
  677. {
  678. if (colid.Count >= j)
  679. {
  680. double de = Convert.ToDouble(data.Rows[i][colid[j - 1]]);
  681. if (de == 0)
  682. dr2["c" + j.ToString()] = " ";
  683. else
  684. dr2["c" + j.ToString()] = de.ToString();
  685. }
  686. }
  687. if (dr2["Name"].ToString() != "" && dr2["Name"].ToString().IndexOf("number") < 0)
  688. {
  689. dr2["total"] = " "; //求合
  690. double d_total = 0;
  691. for (int j = 1; j < 11; j++)
  692. {
  693. if (colid.Count >= j)
  694. {
  695. d_total = d_total + Convert.ToInt64(data.Rows[i][colid[j - 1]]);
  696. }
  697. }
  698. if (d_total == 0)
  699. {
  700. continue;
  701. dr2["total"] = " ";
  702. }
  703. else
  704. dr2["total"] = d_total.ToString();
  705. }
  706. ls_Particel_dt.Rows.Add(dr2);
  707. }
  708. return ls_Particel_dt;
  709. }
  710. public DataTable TypeRange(c_TemplateClass m_mbszclass, OTSReport_Export m_otsreport_export)
  711. {
  712. List<string> colid = new List<string>();
  713. //获取粒级表
  714. string path1 = m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFileFolder +
  715. m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFile;
  716. DataSet ds = OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.GetXml(path1);
  717. string sizestr = ds.Tables[0].Rows[0]["Sizes"].ToString();
  718. for (int i = 0; i < sizestr.Split(',').Length - 1; i++)
  719. {
  720. if (sizestr.Split(',')[i].Length > 0)
  721. {
  722. double d1 = Convert.ToDouble(sizestr.Split(',')[i]);
  723. double d2 = Convert.ToDouble(sizestr.Split(',')[i + 1]);
  724. colid.Add(d1.ToString() + "~" + d2.ToString());
  725. }
  726. }
  727. double d = Convert.ToDouble(sizestr.Split(',')[sizestr.Split(',').Length - 1]);
  728. colid.Add(d.ToString() + "~MAX");
  729. DataTable ls_partsize_dt = new DataTable();
  730. ls_partsize_dt.TableName = "PartSize";
  731. ls_partsize_dt.Columns.Add("c1");
  732. ls_partsize_dt.Columns.Add("c2");
  733. ls_partsize_dt.Columns.Add("c3");
  734. ls_partsize_dt.Columns.Add("c4");
  735. ls_partsize_dt.Columns.Add("c5");
  736. ls_partsize_dt.Columns.Add("c6");
  737. ls_partsize_dt.Columns.Add("c7");
  738. ls_partsize_dt.Columns.Add("c8");
  739. ls_partsize_dt.Columns.Add("c9");
  740. ls_partsize_dt.Columns.Add("c10");
  741. ls_partsize_dt.Columns.Add("c11");
  742. ls_partsize_dt.Columns.Add("c12");
  743. DataRow dr = ls_partsize_dt.NewRow();
  744. for (int i = 1; i < 13; i++)
  745. {
  746. if (colid.Count < i)
  747. {
  748. dr["c" + i.ToString()] = "";
  749. }
  750. else
  751. {
  752. dr["c" + i.ToString()] = colid[i - 1];
  753. }
  754. }
  755. ls_partsize_dt.Rows.Add(dr);
  756. return ls_partsize_dt;
  757. }
  758. private DataTable QuantityOfIntegratedSubstances(DataTable dataTable, List<string> ClassName)
  759. {
  760. DataTable dt_Class = dataTable.Copy();
  761. dt_Class.Clear();
  762. dt_Class.TableName = "Particel";
  763. dt_Class.Columns.Remove("Name");
  764. dt_Class.Columns.Remove("TypeId");
  765. for (int i = 0; i < ClassName.Count; i++)
  766. {
  767. //保留当前循环中大类物质,去除其他物质
  768. DataTable dt = dataTable.Copy();
  769. dt.Clear();
  770. for (int a = 0; a < dataTable.Rows.Count; a++)
  771. {
  772. if (dataTable.Rows[a]["Class"].ToString() == ClassName[i].ToString())
  773. {
  774. dt.Rows.Add(dataTable.Rows[a].ItemArray);
  775. }
  776. }
  777. if (dt.Rows.Count == 0)
  778. continue;
  779. DataTable dt_2 = new DataTable();
  780. dt_2 = dataTable.Copy();
  781. dt_2.Clear();
  782. DataRow row = dt_2.NewRow();
  783. dt_2.Rows.Add(row);
  784. for (int a = 0; a < dt.Columns.Count; a++)
  785. {
  786. if (dt.Columns[a].ToString() != "Name" && dt.Columns[a].ToString() != "Class" && dt.Columns[a].ToString() != "TypeId")
  787. {
  788. bool bl = false;
  789. for (int b = 0; b < dt.Rows.Count; b++)
  790. {
  791. if (!dt.Rows[b].IsNull(dt.Columns[a].ToString()))
  792. {
  793. bl = true;
  794. }
  795. }
  796. if (bl)
  797. {
  798. dt_2.Rows[0][dt.Columns[a].ToString()] = decimal.Parse(dt.Compute("sum(" + dt.Columns[a].ToString() + ")", "").ToString());
  799. }
  800. }
  801. }
  802. dt_2.Columns.Remove("Name");
  803. dt_2.Columns.Remove("TypeId");
  804. dt_2.Rows[0]["Class"] = ClassName[i];
  805. dt_Class.Rows.Add(dt_2.Rows[0].ItemArray);
  806. }
  807. return dt_Class;
  808. }
  809. private DataTable classIfIcationSort(DataTable dataTable, List<string> ClassName, DataTable data)
  810. {
  811. DataTable dt = new DataTable();
  812. dt = dataTable.Copy();
  813. dt.Clear();
  814. dt.TableName = "Particel_subdivision";
  815. //循环list中每个类型
  816. for (int i = 0; i < ClassName.Count(); i++)
  817. {
  818. DataTable data1 = dt.Copy();
  819. data1.Clear();
  820. data1.Rows.Add();
  821. for (int a = 0; a < data.Rows.Count; a++)
  822. {
  823. if (data.Rows[a]["Class"].ToString() == ClassName[i].ToString())
  824. {
  825. for (int b = 1; b < 10; b++)
  826. {
  827. data1.Rows[0]["c" + b.ToString()] = data.Rows[a]["c" + b.ToString()];
  828. }
  829. data1.Rows[0]["total"] = data.Rows[a]["total"];
  830. data1.Rows[0]["Class"] = data.Rows[a]["Class"];
  831. dt.Rows.Add(data1.Rows[0].ItemArray);
  832. }
  833. }
  834. DataTable dt_1 = new DataTable();
  835. dt_1 = dt.Copy();
  836. dt_1.Clear();
  837. //循环DataTable中每个分类的数据
  838. for (int a = 0; a < dataTable.Rows.Count; a++)
  839. {
  840. if (!string.IsNullOrWhiteSpace(ClassName[i].ToString()))
  841. if (dataTable.Rows[a]["Class"].ToString() == ClassName[i].ToString())
  842. {
  843. dataTable.Rows[a]["Class"] = "";
  844. dt_1.Rows.Add(dataTable.Rows[a].ItemArray);
  845. }
  846. }
  847. //将颗粒数量排序(从大到小)
  848. DataView dv = dt_1.DefaultView;
  849. dv.Sort = "total DESC";
  850. DataTable dt_1_sort = dv.ToTable();
  851. for (int a = 0; a < dt_1_sort.Rows.Count; a++)
  852. {
  853. dt.Rows.Add(dt_1_sort.Rows[a].ItemArray);
  854. }
  855. }
  856. dt.Columns.Remove("TypeId");
  857. return dt;
  858. }
  859. private DataTable InvalidRemoval(DataTable dt)
  860. {
  861. DataTable dataTable = dt.Copy();
  862. dataTable.Clear();
  863. for (int i = 0; i < dt.Rows.Count; i++)
  864. {
  865. if (Convert.ToInt32(dt.Rows[i]["TypeId"])>10 )
  866. {
  867. dataTable.Rows.Add(dt.Rows[i].ItemArray);
  868. }
  869. }
  870. return dataTable;
  871. }
  872. private DataTable GetParticleListForParticlSize(DataTable data, DataTable table)
  873. {
  874. DataTable dt_Partick = new DataTable();
  875. dt_Partick.Columns.Add("TypeId");
  876. dt_Partick.Columns.Add("TypeName");
  877. dt_Partick.Columns.Add("TypeColor");
  878. dt_Partick.Columns.Add("con");
  879. dt_Partick.Columns.Add("ar");
  880. dt_Partick.Columns.Add("max");
  881. dt_Partick.Columns.Add("Area", typeof(double));
  882. dt_Partick.Columns.Add("GroupName");
  883. List<string> typeName = new List<string>();
  884. for (int i = 0; i < data.Rows.Count; i++)
  885. {
  886. typeName.Add(data.Rows[i]["TypeId"].ToString());
  887. }
  888. typeName = typeName.Distinct().ToList();
  889. for (int i = 0; i < typeName.Count; i++)
  890. {
  891. DataTable dt = dt_Partick.Clone();
  892. for (int j = 0; j < data.Rows.Count; j++)
  893. {
  894. if (typeName[i].ToString() == data.Rows[j]["TypeId"].ToString())
  895. {
  896. DataRow row = dt.NewRow();
  897. row["TypeId"] = data.Rows[j]["TypeId"];
  898. row["TypeName"] = data.Rows[j]["TypeName"];
  899. row["TypeColor"] = data.Rows[j]["TypeColor"];
  900. row["Area"] = data.Rows[j]["Area"];
  901. dt.Rows.Add(row);
  902. }
  903. }
  904. DataRow dr = dt_Partick.NewRow();
  905. dr["TypeId"] = dt.Rows[0]["TypeId"].ToString();
  906. dr["TypeName"] = dt.Rows[0]["TypeName"].ToString();
  907. dr["TypeColor"] = dt.Rows[0]["TypeColor"].ToString();
  908. dr["con"] = dt.Rows.Count;
  909. dr["ar"] = dt.Compute("min(Area)", "");
  910. dr["max"] = dt.Compute("Max(Area)", "");
  911. dr["Area"] = dt.Compute("SUM(Area)", "");
  912. dt_Partick.Rows.Add(dr);
  913. }
  914. for (int i = 0; i < dt_Partick.Rows.Count; i++)
  915. {
  916. for (int j = 0; j < table.Rows.Count; j++)
  917. {
  918. if (dt_Partick.Rows[i]["TypeId"].ToString() == table.Rows[j]["TypeId"].ToString())
  919. {
  920. dt_Partick.Rows[i]["GroupName"] = table.Rows[j]["GroupName"];
  921. break;
  922. }
  923. }
  924. }
  925. return dt_Partick;
  926. }
  927. private string getWhere(string max, string min, string col, string partic)
  928. {
  929. return col + ">=" + min + " and " + col + "<" + max + " and TypeId=" + partic;
  930. }
  931. private DataTable GetDBData(c_TemplateClass m_mbszclass , OTSReport_Export m_otsreport_export,string ComputeMode)
  932. {
  933. DataTable m_bt_DBData = new DataTable();
  934. ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.getSelectedIndex()].FilePath);
  935. List<string> colid = new List<string>() { "TypeName", "ar", "TypeId", "Largest", "Class", "con" };
  936. //获取粒级表
  937. string path1 = m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFileFolder +
  938. m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFile;
  939. DataSet ds = OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.GetXml(path1);
  940. string sizestr = ds.Tables[0].Rows[0]["Sizes"].ToString();
  941. for (int i = 0; i < sizestr.Split(',').Length - 1; i++)
  942. {
  943. if (sizestr.Split(',')[i].Length > 0)
  944. {
  945. double d1 = Convert.ToDouble(sizestr.Split(',')[i]);
  946. double d2 = Convert.ToDouble(sizestr.Split(',')[i + 1]);
  947. colid.Add(d1.ToString() + "~" + d2.ToString());
  948. }
  949. }
  950. double d = Convert.ToDouble(sizestr.Split(',')[sizestr.Split(',').Length - 1]);
  951. colid.Add(d.ToString() + "~MAX");
  952. for (int i = 0; i < colid.Count; i++)
  953. {
  954. m_bt_DBData.Columns.Add(colid[i].ToString());
  955. }
  956. DataTable dt = InvalidRemoval(fielddata.GetParticleListForParticlSize("area", ""));
  957. DataTable AreaInformationOfAllElements = InvalidRemoval(fielddata.GetAreaByAllIncA(""));
  958. DataTable dtp = InvalidRemoval(fielddata.GetParticleAll(""));
  959. string po = ComputeMode;
  960. switch (po)
  961. {
  962. case "DMAX":
  963. po = "DMAX";
  964. break;
  965. case "DMIN":
  966. po = "DMIN";
  967. break;
  968. case "ECD":
  969. po = "Area";
  970. break;
  971. case "FERET":
  972. po = "DFERET";
  973. break;
  974. }
  975. for (int i = 0; i < dt.Rows.Count; i++)
  976. {
  977. DataRow dr = m_bt_DBData.NewRow();
  978. dr["TypeName"] = dt.Rows[i]["TypeName"].ToString();
  979. dr["TypeId"] = dt.Rows[i]["TypeId"].ToString();
  980. dr["con"] = dt.Rows[i]["con"].ToString();
  981. if (dt.Rows[i]["GroupName"].ToString() == "")
  982. dr["Class"] = "Default";
  983. else
  984. dr["Class"] = dt.Rows[i]["GroupName"].ToString();
  985. //continue;
  986. dr["Largest"] = Math.Round(Convert.ToDouble(dt.Rows[i]["max"]), 2);
  987. for (int a = 6; a < colid.Count; a++)
  988. {
  989. string d1 = colid[a].Split('~')[0];
  990. string d2 = colid[a].Split('~')[1];
  991. if (d2 == "MAX")
  992. {
  993. d2 = "999";
  994. }
  995. DataRow[] datas = dtp.Select(getWhere(d2, d1, po, dt.Rows[i]["TypeId"].ToString()));
  996. dr[colid[a]] = datas.Count();
  997. }
  998. for (int a = 0; a < AreaInformationOfAllElements.Rows.Count; a++)
  999. {
  1000. if (dt.Rows[i]["TypeId"].ToString() == AreaInformationOfAllElements.Rows[a]["TypeId"].ToString())
  1001. {
  1002. dr["ar"] = AreaInformationOfAllElements.Rows[a]["ar"];
  1003. }
  1004. }
  1005. m_bt_DBData.Rows.Add(dr);
  1006. }
  1007. //去除物质分类(非夹杂物分类)
  1008. for (int a = 0; a < m_mbszclass.M_KLLBXX.list_str_kllb_DeleteClass.Count; a++)
  1009. {
  1010. for (int i = m_bt_DBData.Rows.Count - 1; i >= 0; i--)
  1011. {
  1012. if (m_bt_DBData.Rows[i]["TypeName"].ToString() == m_mbszclass.M_KLLBXX.list_str_kllb_DeleteClass[a].ToString())
  1013. {
  1014. m_bt_DBData.Rows.RemoveAt(i);
  1015. }
  1016. }
  1017. }
  1018. if (m_mbszclass.list_str_MainPriority.Count==0)
  1019. {
  1020. return m_bt_DBData;
  1021. }
  1022. DataTable datass = m_bt_DBData.Clone();
  1023. for (int i = 0; i < m_bt_DBData.Rows.Count; i++)
  1024. {
  1025. for (int a = 0; a < m_mbszclass.list_str_MainPriority.Count; a++)
  1026. {
  1027. if (m_bt_DBData.Rows[i]["TypeName"].ToString() == m_mbszclass.list_str_MainPriority[a])
  1028. {
  1029. datass.Rows.Add(m_bt_DBData.Rows[i].ItemArray);
  1030. continue;
  1031. }
  1032. }
  1033. }
  1034. return datass;
  1035. }
  1036. }
  1037. }