Export_ReportTemplate.cs 131 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697
  1. using OTSIncAReportApp.Control_ECharts;
  2. using OTSIncAReportApp.DataOperation.DataAccess;
  3. using OTSIncAReportApp.DataOperation.Model;
  4. using OTSIncAReportGraph.Controls;
  5. using OTSIncAReportGrids;
  6. using OTSRptPeriodicTable;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Data;
  10. using System.Drawing;
  11. using System.IO;
  12. using System.Linq;
  13. using System.Windows.Forms;
  14. namespace OTSIncAReportApp.OTSTemplateDesigner
  15. {
  16. public class Export_ReportTemplate
  17. {
  18. #region 全局变量
  19. public List<DataTable> m_list_dt; //导出的各模块数据,合集
  20. public OTSReport_Export m_otsreport_export;
  21. DataTable m_bt_DBData = new DataTable();
  22. List<string> TemplateList;
  23. #endregion
  24. #region 构造函数
  25. public Export_ReportTemplate(OTSReport_Export in_export)
  26. {
  27. m_otsreport_export = in_export;
  28. TemplateList = new List<string>();
  29. //加载三元相图各项
  30. string pathtpf = in_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.TrigTemplateFileFolder + "\\" + in_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.TriTempFile;// Application.StartupPath + "\\Config\\ProData\\DefaultTriTemplateFile.tpf";
  31. TemplateList = new List<string>();
  32. DataSet ds = DataOperation.DataAccess.XMLoperate.GetXmlData(pathtpf, "XMLData");
  33. DataTable dt = ds.Tables["Member"];
  34. foreach (DataRow item in dt.Rows)
  35. {
  36. if (item["TemplateName"].ToString() != "")
  37. {
  38. TemplateList.Add(item["TemplateName"].ToString());
  39. }
  40. }
  41. m_list_dt = new List<DataTable>();
  42. }
  43. public Export_ReportTemplate()
  44. {
  45. m_list_dt = new List<DataTable>();
  46. }
  47. #endregion
  48. #region 插入测量结果Grid表格
  49. /// <summary>
  50. /// 向 模板设计器 中插入测量结果Grid表格
  51. /// </summary>
  52. /// <returns></returns>
  53. public DataTable InsertReportTemplateTable_ResultGrid()
  54. {
  55. //------------------加载模块,获取数据-------------------------------------------------
  56. ResultGrid ls_resultgrid = new ResultGrid(m_otsreport_export.m_ReportApp);
  57. Dictionary<string, string> keyValues_ResultGrid = ls_resultgrid.GetData_ResultGrid_Report();
  58. //------------------加载模块,获取数据结束----------------------------------------------
  59. Dictionary<string, string>.Enumerator en = keyValues_ResultGrid.GetEnumerator();
  60. string str_CLJGMC = "";
  61. string str_YXSJ = "";
  62. string str_SCZS = "";
  63. string str_FLFA = "";
  64. string str_YJCTZ = "";
  65. string str_SCMJ = "";
  66. string str_CKBZ = "GB/T30834-2014";
  67. keyValues_ResultGrid.TryGetValue(ls_resultgrid.table["col1"].ToString(), out str_CLJGMC);//测量结果名称
  68. keyValues_ResultGrid.TryGetValue(ls_resultgrid.table["col4"].ToString(), out str_YXSJ);//运行时间
  69. keyValues_ResultGrid.TryGetValue(ls_resultgrid.table["col5"].ToString(), out str_SCZS);//视场总数
  70. keyValues_ResultGrid.TryGetValue(ls_resultgrid.table["col6"].ToString(), out str_FLFA);//分类方案
  71. keyValues_ResultGrid.TryGetValue(ls_resultgrid.table["col7"].ToString(), out str_YJCTZ);//已检测特征
  72. keyValues_ResultGrid.TryGetValue(ls_resultgrid.table["col8"].ToString(), out str_SCMJ);//视场面积
  73. //将获取到的数据转换成报告模板能接收的格式。
  74. DataTable ls_new_dt = new DataTable();
  75. ls_new_dt.TableName = "ResultGrid";
  76. ls_new_dt.Columns.Add("CLJGMC"); //测量结果名称
  77. ls_new_dt.Columns.Add("YXSJ"); //运行时间
  78. ls_new_dt.Columns.Add("SCZS"); //视场总数
  79. ls_new_dt.Columns.Add("FLFA"); //分类方案
  80. ls_new_dt.Columns.Add("YJCTZ"); //已检测特征
  81. ls_new_dt.Columns.Add("SCMJ"); //视场面积
  82. ls_new_dt.Columns.Add("CKBZ"); //参考标准
  83. //行转列,这里不会发生改变,所以这样写
  84. DataRow dr = ls_new_dt.NewRow();
  85. dr["CLJGMC"] = str_CLJGMC;
  86. dr["YXSJ"] = str_YXSJ;
  87. dr["SCZS"] = str_SCZS;
  88. dr["FLFA"] = str_FLFA;
  89. dr["YJCTZ"] = str_YJCTZ;
  90. dr["SCMJ"] = str_SCMJ;
  91. dr["CKBZ"] = str_CKBZ;
  92. ls_new_dt.Rows.Add(dr);
  93. m_list_dt.Add(ls_new_dt);
  94. return ls_new_dt;
  95. }
  96. #endregion
  97. #region 一次性读取数据所需要的数据
  98. private void GetSTL(out DataTable data)
  99. {
  100. DataTable dt = new DataTable();
  101. dt.Columns.Add("TypeId");
  102. dt.Columns.Add("Hardness", typeof(double));
  103. dt.Columns.Add("Hardness_detailed");
  104. ResultFile resfile = m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.getSelectedIndex()];
  105. string str_libraryName = ((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)resfile.ResultInfo["Sample"])["Members"])["MsrParams"])["STDName"].ToString();
  106. OTSSysMgrTools.SqLiteHelper sh = new OTSSysMgrTools.SqLiteHelper("data source='" + System.IO.Directory.GetCurrentDirectory()+ "\\Config\\SysData\\"+ str_libraryName + ".db" + "'");
  107. DataTable dt_stl= sh.ExecuteQuery("select * from ClassifySTD");
  108. for (int i=0;i< dt_stl.Rows.Count;i++)
  109. {
  110. DataRow dr = dt.NewRow();
  111. dr["TypeId"] = dt_stl.Rows[i]["StrName"].ToString();
  112. dr["Hardness_detailed"] = dt_stl.Rows[i]["Hardness"].ToString();
  113. if (System.Text.RegularExpressions.Regex.Replace(dt_stl.Rows[i]["Hardness"].ToString(), @"[^\d.\d]", "").ToString()!="")
  114. {
  115. dr["Hardness"] = Convert.ToDouble(System.Text.RegularExpressions.Regex.Replace(dt_stl.Rows[i]["Hardness"].ToString(), @"[^\d.\d]", ""));
  116. }else
  117. {
  118. dr["Hardness"] = 0;
  119. }
  120. dt.Rows.Add(dr);
  121. }
  122. data = dt;
  123. }
  124. public bool GetDBData()
  125. {
  126. //GetSTL();
  127. m_bt_DBData.Clear();
  128. m_bt_DBData.Columns.Clear();
  129. ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.getSelectedIndex()].FilePath);
  130. List<string> colid = new List<string>() { "TypeName", "ar", "TypeId", "Largest", "Class", "con" };
  131. //获取粒级表
  132. string path1 = m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFileFolder + m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFile;
  133. DataSet ds = OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.GetXml(path1);
  134. string sizestr = ds.Tables[0].Rows[0]["Sizes"].ToString();
  135. for (int i = 0; i < sizestr.Split(',').Length - 1; i++)
  136. {
  137. if (sizestr.Split(',')[i].Length > 0)
  138. {
  139. double d1 = Convert.ToDouble(sizestr.Split(',')[i]);
  140. double d2 = Convert.ToDouble(sizestr.Split(',')[i + 1]);
  141. colid.Add(d1.ToString() + "~" + d2.ToString());
  142. }
  143. }
  144. double d = Convert.ToDouble(sizestr.Split(',')[sizestr.Split(',').Length - 1]);
  145. colid.Add(d.ToString() + "~MAX");
  146. for (int i=0;i< colid.Count;i++)
  147. {
  148. m_bt_DBData.Columns.Add(colid[i].ToString());
  149. }
  150. DataTable dt =InvalidRemoval(fielddata.GetParticleListForParticlSize("area", ""), "TypeName");
  151. //DataTable dt = fielddata.GetParticleListForParticlSize("area", "");
  152. DataTable AreaInformationOfAllElements = InvalidRemoval(fielddata.GetAreaByAllIncA(""), "TypeName");
  153. //DataTable AreaInformationOfAllElements = fielddata.GetAreaByAllIncA("");//获取所有分类面积和数量信息
  154. DataTable dtp = InvalidRemoval(fielddata.GetParticleAll(""), "GroupName");
  155. //DataTable dtp = fielddata.GetParticleAll("");
  156. List<string> vs = new List<string>() { "DMAX", "DMIN", "Area", "FERET" };
  157. string po = vs[m_otsreport_export.m_mbszclass.M_KLFXJG.index_cb_klcc_jsfs];
  158. switch (po)
  159. {
  160. case "DMAX":
  161. po = "DMAX";
  162. break;
  163. case "DMIN":
  164. po = "DMIN";
  165. break;
  166. case "CIRCLE":
  167. po = "Area";
  168. break;
  169. case "FERET":
  170. po = "DFERET";
  171. break;
  172. }
  173. for (int i=0;i< dt.Rows.Count;i++)
  174. {
  175. DataRow dr = m_bt_DBData.NewRow();
  176. dr["TypeName"] = dt.Rows[i]["TypeName"].ToString();
  177. dr["TypeId"] = dt.Rows[i]["TypeId"].ToString();
  178. dr["con"]= dt.Rows[i]["con"].ToString();
  179. dr["Class"] = dt.Rows[i]["GroupName"].ToString();
  180. dr["Largest"] = Math.Round(Convert.ToDouble(dt.Rows[i]["max"]), 2);
  181. for (int a=6;a< colid.Count;a++)
  182. {
  183. string d1 = colid[a].Split('~')[0];
  184. string d2 = colid[a].Split('~')[1];
  185. if (d2 == "MAX")
  186. {
  187. d2 = "999";
  188. }
  189. DataRow[] datas = dtp.Select(getWhere(d2, d1, po, dt.Rows[i]["TypeId"].ToString()));
  190. dr[colid[a]] = datas.Count();
  191. }
  192. for (int a=0;a< AreaInformationOfAllElements.Rows.Count;a++)
  193. {
  194. if (dt.Rows[i]["TypeId"].ToString()== AreaInformationOfAllElements.Rows[a]["TypeId"].ToString())
  195. {
  196. dr["ar"] = AreaInformationOfAllElements.Rows[a]["ar"];
  197. }
  198. }
  199. m_bt_DBData.Rows.Add(dr);
  200. }
  201. return true;
  202. }
  203. private DataTable InvalidRemoval(DataTable dt ,string str)
  204. {
  205. DataTable dataTable = dt.Copy();
  206. dataTable.Clear();
  207. for (int i=0;i<dt.Rows.Count;i++)
  208. {
  209. if (dt.Rows[i][str].ToString() != "Invalid" && dt.Rows[i][str].ToString()!= "Not Identified" && dt.Rows[i][str].ToString()!= "NOT_INCLUTION")
  210. {
  211. dataTable.Rows.Add(dt.Rows[i].ItemArray);
  212. }
  213. }
  214. return dataTable;
  215. }
  216. private string getWhere(string max, string min, string col, string partic)
  217. {
  218. return col + ">=" + min + " and " + col + "<" + max + " and TypeId=" + partic;
  219. }
  220. #endregion
  221. #region 插入颗粒列表并带有帧图
  222. /// <summary>
  223. /// 颗粒列表中插入帧图,并带上颗粒分组信息
  224. /// </summary>
  225. /// <returns></returns>
  226. public bool InsertReportTemplateTable_ParticlesGridDevidePage()
  227. {
  228. int serialNumber = 1;
  229. //------------------加载模块,获取数据-------------------------------------------------
  230. m_otsreport_export.m_ReportApp.im_ParticlesGridDevidePage = new ParticlesGridDevidePage(m_otsreport_export.m_ReportApp);
  231. //根据sql条件,查询获取颗粒信息数据
  232. ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.getSelectedIndex()].FilePath);
  233. DataTable dt = InvalidRemoval(fielddata.GetIncaSurfaceData(),"TypeName") ;
  234. //将颗粒大小排序(从大到小)
  235. DataView dv = dt.DefaultView;
  236. dv.Sort = "DMAX DESC";
  237. DataTable dt_ParticlesGridDevidePage = dv.ToTable();
  238. string str_resultPath = m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.getSelectedIndex()].FilePath;
  239. //------------------加载模块,获取数据结束----------------------------------------------
  240. #region 创建要插入数据库表结构
  241. //插入模板需父子表,结构
  242. //表名field_dt表:(父表) 帧图表
  243. DataTable DT_field_dt = new DataTable();
  244. DT_field_dt.TableName = "field_dt";
  245. DataColumn colpictid2 = new DataColumn("FieldId");
  246. colpictid2.DataType = typeof(int);
  247. DT_field_dt.Columns.Add(colpictid2);
  248. //图像列
  249. DataColumn colpict2 = new DataColumn("FieldImg");
  250. colpict2.DataType = System.Type.GetType("System.Byte[]");
  251. DT_field_dt.Columns.Add(colpict2);
  252. //表名Largest_frame表:(子表) 显示20条颗粒除外的部份颗粒信息
  253. DataTable DT_field_dt_copy = new DataTable();
  254. DataTable DT_Largest_frame = new DataTable();
  255. DT_Largest_frame.TableName = "Largest_frame";
  256. DT_Largest_frame.Columns.Add("pid");
  257. DT_Largest_frame.Columns.Add("Size");
  258. DT_Largest_frame.Columns.Add("Width");
  259. DT_Largest_frame.Columns.Add("DMAX");
  260. DT_Largest_frame.Columns.Add("DMIN");
  261. DT_Largest_frame.Columns.Add("Class");
  262. DT_Largest_frame.Columns.Add("ColName1");
  263. DT_Largest_frame.Columns.Add("ColName2");
  264. DT_Largest_frame.Columns.Add("ColName3");
  265. DT_Largest_frame.Columns.Add("ColName4");
  266. DT_Largest_frame.Columns.Add("ColName5");
  267. DT_Largest_frame.Columns.Add("ColName6");
  268. DT_Largest_frame.Columns.Add("ColVal1");
  269. DT_Largest_frame.Columns.Add("ColVal2");
  270. DT_Largest_frame.Columns.Add("ColVal3");
  271. DT_Largest_frame.Columns.Add("ColVal4");
  272. DT_Largest_frame.Columns.Add("ColVal5");
  273. DT_Largest_frame.Columns.Add("ColVal6");
  274. DataColumn colpictid = new DataColumn("FieldId");
  275. colpictid.DataType = typeof(int);
  276. DT_Largest_frame.Columns.Add(colpictid);
  277. //图像列
  278. DataColumn colpict = new DataColumn("p1");
  279. colpict.DataType = System.Type.GetType("System.Byte[]");
  280. DT_Largest_frame.Columns.Add(colpict);
  281. //largest20表:(无关系表) 需要显示前20条带有显示能谱图像的颗粒表
  282. DataTable DT_Largest20 = new DataTable();
  283. DT_Largest20.TableName = "Largest20";
  284. DT_Largest20.Columns.Add("pid");
  285. DT_Largest20.Columns.Add("Size");
  286. DT_Largest20.Columns.Add("Width");
  287. DT_Largest20.Columns.Add("DMAX");
  288. DT_Largest20.Columns.Add("DMIN");
  289. DT_Largest20.Columns.Add("Class");
  290. DT_Largest20.Columns.Add("ColName1");
  291. DT_Largest20.Columns.Add("ColName2");
  292. DT_Largest20.Columns.Add("ColName3");
  293. DT_Largest20.Columns.Add("ColName4");
  294. DT_Largest20.Columns.Add("ColName5");
  295. DT_Largest20.Columns.Add("ColName6");
  296. DT_Largest20.Columns.Add("ColVal1");
  297. DT_Largest20.Columns.Add("ColVal2");
  298. DT_Largest20.Columns.Add("ColVal3");
  299. DT_Largest20.Columns.Add("ColVal4");
  300. DT_Largest20.Columns.Add("ColVal5");
  301. DT_Largest20.Columns.Add("ColVal6");
  302. // 图像列
  303. DataColumn colpict_20ago = new DataColumn("p1");
  304. colpict_20ago.DataType = System.Type.GetType("System.Byte[]");
  305. DT_Largest20.Columns.Add(colpict_20ago);
  306. DataColumn colpict2_20ago = new DataColumn("p2");
  307. colpict2_20ago.DataType = System.Type.GetType("System.Byte[]");
  308. DT_Largest20.Columns.Add(colpict2_20ago);
  309. DataColumn colpict3_20ago = new DataColumn("p3");
  310. colpict3_20ago.DataType = System.Type.GetType("System.Byte[]");
  311. DT_Largest20.Columns.Add(colpict3_20ago);
  312. #endregion
  313. #region 插入-前20颗粒部份
  314. for (int i_row = 0; i_row < dt_ParticlesGridDevidePage.Rows.Count; i_row++)
  315. {
  316. if (dt_ParticlesGridDevidePage.Rows[i_row].ItemArray[24].ToString()!= "Not Identified")
  317. {
  318. //获取颗粒的fieldid,和particleid
  319. string str_fieldid = dt_ParticlesGridDevidePage.Rows[i_row]["fieldid"].ToString();
  320. string str_particleid = dt_ParticlesGridDevidePage.Rows[i_row]["particleid"].ToString();
  321. string str_subparticles = dt_ParticlesGridDevidePage.Rows[i_row]["SubParticles"].ToString();
  322. string str_typeid = dt_ParticlesGridDevidePage.Rows[i_row]["TypeId"].ToString();
  323. string str_typename = dt_ParticlesGridDevidePage.Rows[i_row]["TypeName"].ToString();
  324. string str_element = dt_ParticlesGridDevidePage.Rows[i_row]["Element"].ToString();
  325. //获取原始颗粒图像
  326. Bitmap bp_particle = new Bitmap(1, 1);
  327. string str_path = str_resultPath + "\\FIELD_FILES\\";
  328. string str_imagePath = str_path + "Field" + str_fieldid.ToString() + ".bmp";
  329. if (str_fieldid == "-1")
  330. continue;
  331. if (serialNumber > 20)
  332. continue;
  333. if (str_subparticles != null && str_subparticles != "")
  334. {
  335. //合并大颗粒
  336. double ScanFieldSize = 1142;
  337. Bitmap tempbit = fielddata.ReadImageFile(str_imagePath);
  338. int pixw = tempbit.Width;
  339. double xs = pixw / ScanFieldSize;
  340. bp_particle = fielddata.GetBitmapForBig(str_subparticles, xs, str_resultPath);
  341. }
  342. else
  343. {
  344. //正常颗粒
  345. Rectangle rectangle = new Rectangle() { X = Convert.ToInt32(dt_ParticlesGridDevidePage.Rows[i_row]["RectLeft"]), Y = Convert.ToInt32(dt_ParticlesGridDevidePage.Rows[i_row]["RectTop"]), Width = Convert.ToInt32(dt_ParticlesGridDevidePage.Rows[i_row]["RectWidth"]), Height = Convert.ToInt32(dt_ParticlesGridDevidePage.Rows[i_row]["RectHeight"]) };
  346. Bitmap bp_field = fielddata.ReadImageFile(str_imagePath);
  347. bp_particle = fielddata.GetBitmapByParticle(bp_field, rectangle);
  348. bp_particle.Tag = new List<string>() { dt_ParticlesGridDevidePage.Rows[i_row]["FieldId"].ToString(), dt_ParticlesGridDevidePage.Rows[i_row]["ParticleId"].ToString(), dt_ParticlesGridDevidePage.Rows[i_row]["TypeId"].ToString() };
  349. }
  350. //获取该颗粒的xray能谱图像
  351. System.Drawing.Bitmap bp_xraybp = ExportXRayBitmap(str_fieldid,
  352. str_particleid, Convert.ToInt32(str_typeid), str_typename, fielddata);
  353. Bitmap ls_xraybpnew = new Bitmap(1, 1);
  354. ls_xraybpnew = OTSIncAReportGraph.Class.DrawFunction.KiResizeImage(bp_xraybp, 700, 115);//能谱图处理
  355. //获取该颗粒的二次放大处理图像
  356. Bitmap ls_processbitmap = new Bitmap(1, 1);
  357. ls_processbitmap = OTSIncAReportGraph.Class.DrawFunction.GetReZoomBitmap(bp_particle);// (Bitmap)bp_particle.Clone();//待完善
  358. //再将图像转成二进制流-------------------------------------------------------------------
  359. //原图
  360. MemoryStream newms_p1 = new MemoryStream();
  361. bp_particle.Save(newms_p1, System.Drawing.Imaging.ImageFormat.Bmp);
  362. newms_p1.Seek(0, SeekOrigin.Begin);
  363. byte[] newarr_p1 = new byte[newms_p1.Length];
  364. newms_p1.Read(newarr_p1, 0, newarr_p1.Length);
  365. //二次放大图
  366. MemoryStream newms_p2 = new MemoryStream();
  367. ls_processbitmap.Save(newms_p2, System.Drawing.Imaging.ImageFormat.Bmp);
  368. newms_p2.Seek(0, SeekOrigin.Begin);
  369. byte[] newarr_p2 = new byte[newms_p2.Length];
  370. newms_p2.Read(newarr_p2, 0, newarr_p2.Length);
  371. //能谱图
  372. MemoryStream newms_p3 = new MemoryStream();
  373. ls_xraybpnew.Save(newms_p3, System.Drawing.Imaging.ImageFormat.Bmp);
  374. newms_p3.Seek(0, SeekOrigin.Begin);
  375. byte[] newarr_p3 = new byte[newms_p3.Length];
  376. newms_p3.Read(newarr_p3, 0, newarr_p3.Length);
  377. //---------------------------------------------------------------------------------------
  378. DataRow dr = DT_Largest20.NewRow();
  379. dr["p1"] = newarr_p1;
  380. dr["p2"] = newarr_p2;
  381. dr["p3"] = newarr_p3;
  382. newms_p1.Dispose();
  383. newms_p2.Dispose();
  384. newms_p3.Dispose();
  385. dr["pid"] = serialNumber++.ToString();
  386. //dr["pid"] = str_fieldid + dt_ParticlesGridDevidePage.Rows[i_row]["particleid"].ToString();
  387. dr["Size"] = Convert.ToDouble(dt_ParticlesGridDevidePage.Rows[i_row]["area"]).ToString("#0.00"); //可以需要选择切换,计算方式
  388. dr["Width"] = dt_ParticlesGridDevidePage.Rows[i_row]["rectwidth"].ToString();
  389. dr["DMAX"] = Math.Round(Convert.ToDouble(dt_ParticlesGridDevidePage.Rows[i_row]["dmax"]), 2).ToString();
  390. dr["DMIN"] = Math.Round(Convert.ToDouble(dt_ParticlesGridDevidePage.Rows[i_row]["dmin"]), 2).ToString();
  391. dr["Class"] = dt_ParticlesGridDevidePage.Rows[i_row]["typename"].ToString();
  392. List<string> list_max_elementname = new List<string>();
  393. List<double> list_max_elementvale = new List<double>();
  394. GetMaxElementFromDataTable(dt_ParticlesGridDevidePage, i_row, out list_max_elementname, out list_max_elementvale);
  395. //元素1
  396. dr["ColName1"] = list_max_elementname[0];
  397. dr["ColVal1"] = list_max_elementvale[0].ToString();
  398. //元素2
  399. dr["ColName2"] = list_max_elementname[1];
  400. dr["ColVal2"] = list_max_elementvale[1].ToString();
  401. //元素3
  402. dr["ColName3"] = list_max_elementname[2];
  403. dr["ColVal3"] = list_max_elementvale[2].ToString();
  404. //元素4
  405. dr["ColName4"] = list_max_elementname[3];
  406. dr["ColVal4"] = list_max_elementvale[3].ToString();
  407. //元素5
  408. dr["ColName5"] = list_max_elementname[4];
  409. dr["ColVal5"] = list_max_elementvale[4].ToString();
  410. //元素6
  411. dr["ColName6"] = list_max_elementname[5];
  412. dr["ColVal6"] = list_max_elementvale[5].ToString();
  413. DT_Largest20.Rows.Add(dr);
  414. }
  415. }
  416. #endregion
  417. #region 插入-帧图图像部份
  418. List<string> vs = new List<string>();
  419. DataTable data = new DataTable();
  420. //首先生成标记颗粒的帧图图像文件
  421. DataTable dt_GridDevidePage = new DataTable();
  422. dt_GridDevidePage = dt_ParticlesGridDevidePage.Copy();
  423. dt_GridDevidePage.Clear();
  424. for (int i=0;i< dt_ParticlesGridDevidePage.Rows.Count;i++)
  425. {
  426. if (dt_ParticlesGridDevidePage.Rows[i]["TypeName"].ToString() != "Not Identified")
  427. {
  428. dt_GridDevidePage.Rows.Add(dt_ParticlesGridDevidePage.Rows[i].ItemArray);
  429. }
  430. }
  431. m_otsreport_export.m_ReportApp.im_ParticlesGridDevidePage.SaveMarkParticleRectangleOnFieldFile(dt_GridDevidePage, out vs ,out data);
  432. string str_path_FIELD_FILES_MARK = str_resultPath + "\\FIELD_FILES_MARK\\";
  433. DirectoryInfo theFolder = new DirectoryInfo(str_path_FIELD_FILES_MARK);
  434. if (theFolder.Exists)
  435. {
  436. for (int i=0;i<vs.Count;i++)
  437. {
  438. foreach (FileInfo nextifile in theFolder.GetFiles())
  439. {
  440. if (nextifile.Name.Contains(".bmp") == true || nextifile.Name.Contains(".BMP") == true)
  441. {
  442. //确认对应的帧图名
  443. string str_fieldid = Path.GetFileNameWithoutExtension(nextifile.Name);
  444. if (str_fieldid==vs[i].ToString())
  445. {
  446. //在数据表中有颗粒在该帧图中的话,则对该帧图标记图像进行读取存入数据库
  447. DataRow[] datarowlist = dt_GridDevidePage.Select(" fieldid = " + str_fieldid);
  448. if (datarowlist.Count() > 0)
  449. {
  450. Bitmap ls_bp_fieldmark = new Bitmap(nextifile.FullName);
  451. DataRow dr = DT_field_dt.NewRow();
  452. MemoryStream newms_bp_fieldmark = new MemoryStream();
  453. ls_bp_fieldmark.Save(newms_bp_fieldmark, System.Drawing.Imaging.ImageFormat.Bmp);
  454. newms_bp_fieldmark.Seek(0, SeekOrigin.Begin);
  455. byte[] newarr_fieldmark = new byte[newms_bp_fieldmark.Length];
  456. newms_bp_fieldmark.Read(newarr_fieldmark, 0, newarr_fieldmark.Length);
  457. dr["FieldImg"] = newarr_fieldmark;
  458. dr["FieldId"] = str_fieldid;
  459. ls_bp_fieldmark.Dispose();
  460. DT_field_dt.Rows.Add(dr);
  461. }
  462. }
  463. }
  464. }
  465. }
  466. DT_field_dt_copy = DT_field_dt.Copy();
  467. }
  468. #endregion
  469. #region 插入-前20颗粒外的颗粒
  470. for (int i_row = 0; i_row < dt_ParticlesGridDevidePage.Rows.Count; i_row++)
  471. {
  472. if (dt_ParticlesGridDevidePage.Rows[i_row]["element"].ToString() == "")
  473. continue;
  474. //获取颗粒的fieldid,和particleid
  475. string str_fieldid = dt_ParticlesGridDevidePage.Rows[i_row]["fieldid"].ToString();
  476. if (Convert.ToInt32(str_fieldid) < 20)
  477. {
  478. string str_particleid = dt_ParticlesGridDevidePage.Rows[i_row]["particleid"].ToString();
  479. string str_subparticles = dt_ParticlesGridDevidePage.Rows[i_row]["SubParticles"].ToString();
  480. string str_typeid = dt_ParticlesGridDevidePage.Rows[i_row]["TypeId"].ToString();
  481. string str_typename = dt_ParticlesGridDevidePage.Rows[i_row]["TypeName"].ToString();
  482. string str_element = dt_ParticlesGridDevidePage.Rows[i_row]["Element"].ToString();
  483. //获取原始颗粒图像
  484. Bitmap bp_particle = new Bitmap(1, 1);
  485. string str_path = str_resultPath + "\\FIELD_FILES\\";
  486. string str_imagePath = str_path + "Field" + str_fieldid.ToString() + ".bmp";
  487. if (str_subparticles != null && str_subparticles != "")
  488. {
  489. //合并大颗粒
  490. //double ScanFieldSize = 1142;
  491. //Bitmap tempbit = fielddata.ReadImageFile(str_imagePath);
  492. //int pixw = tempbit.Width;
  493. //double xs = pixw / ScanFieldSize;
  494. //bp_particle = fielddata.GetBitmapForBig(str_subparticles, xs, str_resultPath);
  495. continue;
  496. }
  497. else
  498. {
  499. //正常颗粒
  500. Rectangle rectangle = new Rectangle() { X = Convert.ToInt32(dt_ParticlesGridDevidePage.Rows[i_row]["RectLeft"]), Y = Convert.ToInt32(dt_ParticlesGridDevidePage.Rows[i_row]["RectTop"]), Width = Convert.ToInt32(dt_ParticlesGridDevidePage.Rows[i_row]["RectWidth"]), Height = Convert.ToInt32(dt_ParticlesGridDevidePage.Rows[i_row]["RectHeight"]) };
  501. Bitmap bp_field = fielddata.ReadImageFile(str_imagePath);
  502. bp_particle = fielddata.GetBitmapByParticle(bp_field, rectangle);
  503. bp_particle.Tag = new List<string>() { dt_ParticlesGridDevidePage.Rows[i_row]["FieldId"].ToString(), dt_ParticlesGridDevidePage.Rows[i_row]["ParticleId"].ToString(), dt_ParticlesGridDevidePage.Rows[i_row]["TypeId"].ToString() };
  504. }
  505. //获取该颗粒的xray能谱图像
  506. System.Drawing.Bitmap bp_xraybp = ExportXRayBitmap(str_fieldid,
  507. str_particleid, Convert.ToInt32(str_typeid), str_typename, fielddata);
  508. //获取该颗粒的二次放大处理图像
  509. Bitmap ls_processbitmap = new Bitmap(1, 1);
  510. ls_processbitmap = (Bitmap)bp_particle.Clone();//待完善
  511. //再将图像转成二进制流-------------------------------------------------------------------
  512. //原图
  513. MemoryStream newms_p1 = new MemoryStream();
  514. bp_particle.Save(newms_p1, System.Drawing.Imaging.ImageFormat.Bmp);
  515. newms_p1.Seek(0, SeekOrigin.Begin);
  516. byte[] newarr_p1 = new byte[newms_p1.Length];
  517. newms_p1.Read(newarr_p1, 0, newarr_p1.Length);
  518. //---------------------------------------------------------------------------------------
  519. DataRow dr = DT_Largest_frame.NewRow();
  520. dr["p1"] = newarr_p1;
  521. newms_p1.Dispose();
  522. dr["pid"] = str_fieldid + dt_ParticlesGridDevidePage.Rows[i_row]["particleid"].ToString();
  523. dr["Size"] = Convert.ToDouble(dt_ParticlesGridDevidePage.Rows[i_row]["area"]).ToString("#0.00"); //可以需要选择切换,计算方式
  524. dr["Width"] = dt_ParticlesGridDevidePage.Rows[i_row]["rectwidth"].ToString();
  525. dr["DMAX"] = Math.Round(Convert.ToDouble(dt_ParticlesGridDevidePage.Rows[i_row]["dmax"]),2).ToString();
  526. dr["DMIN"] = Math.Round(Convert.ToDouble(dt_ParticlesGridDevidePage.Rows[i_row]["dmin"]),2).ToString();
  527. dr["Class"] = dt_ParticlesGridDevidePage.Rows[i_row]["typename"].ToString();
  528. dr["fieldid"] = str_fieldid;
  529. List<string> list_max_elementname = new List<string>();
  530. List<double> list_max_elementvale = new List<double>();
  531. GetMaxElementFromDataTable(dt_ParticlesGridDevidePage, i_row, out list_max_elementname, out list_max_elementvale);
  532. //元素1
  533. dr["ColName1"] = list_max_elementname[0];
  534. dr["ColVal1"] = list_max_elementvale[0].ToString();
  535. //元素2
  536. dr["ColName2"] = list_max_elementname[1];
  537. dr["ColVal2"] = list_max_elementvale[1].ToString();
  538. //元素3
  539. dr["ColName3"] = list_max_elementname[2];
  540. dr["ColVal3"] = list_max_elementvale[2].ToString();
  541. //元素4
  542. dr["ColName4"] = list_max_elementname[3];
  543. dr["ColVal4"] = list_max_elementvale[3].ToString();
  544. //元素5
  545. dr["ColName5"] = list_max_elementname[4];
  546. dr["ColVal5"] = list_max_elementvale[4].ToString();
  547. //元素6
  548. dr["ColName6"] = list_max_elementname[5];
  549. dr["ColVal6"] = list_max_elementvale[5].ToString();
  550. DT_Largest_frame.Rows.Add(dr);
  551. }
  552. }
  553. #endregion
  554. FrameGraphParticleTable(dt_ParticlesGridDevidePage, str_resultPath, fielddata, DT_field_dt);
  555. m_list_dt.Add(DT_field_dt_copy);
  556. m_list_dt.Add(DT_Largest_frame);
  557. m_list_dt.Add(DT_Largest20);
  558. return true;
  559. }
  560. public bool InsertReportTemplateTable_ParticlesGridDevidePage_CleanlinessA()
  561. {
  562. DataTable dt_stl = new DataTable();
  563. GetSTL(out dt_stl);
  564. int serialNumber = 1;
  565. //------------------加载模块,获取数据-------------------------------------------------
  566. m_otsreport_export.m_ReportApp.im_ParticlesGridDevidePage = new ParticlesGridDevidePage(m_otsreport_export.m_ReportApp);
  567. //根据sql条件,查询获取颗粒信息数据
  568. ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.getSelectedIndex()].FilePath);
  569. DataTable dt = InvalidRemoval(fielddata.GetIncaSurfaceData(), "TypeName");
  570. dt.Columns.Add("Hardness", typeof(double));
  571. dt.Columns.Add("Hardness_detailed");
  572. for (int i=0;i<dt.Rows.Count;i++)
  573. {
  574. for (int a=0;a< dt_stl.Rows.Count;a++)
  575. {
  576. if (dt.Rows[i]["TypeName"].ToString() ==dt_stl.Rows[a]["TypeId"].ToString())
  577. {
  578. dt.Rows[i]["Hardness"] = Convert.ToDouble(dt_stl.Rows[a]["Hardness"]);
  579. dt.Rows[i]["Hardness_detailed"] = dt_stl.Rows[a]["Hardness_detailed"];
  580. break;
  581. }
  582. }
  583. }
  584. //将颗粒大小排序(从大到小)
  585. DataView dv = dt.DefaultView;
  586. dv.Sort = "Hardness DESC";
  587. DataTable dt_ParticlesGridDevidePage = dv.ToTable();
  588. string str_resultPath = m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.getSelectedIndex()].FilePath;
  589. //------------------加载模块,获取数据结束----------------------------------------------
  590. #region 创建要插入数据库表结构
  591. //插入模板需父子表,结构
  592. //表名field_dt表:(父表) 帧图表
  593. DataTable DT_field_dt = new DataTable();
  594. DT_field_dt.TableName = "field_dt";
  595. DataColumn colpictid2 = new DataColumn("FieldId");
  596. colpictid2.DataType = typeof(int);
  597. DT_field_dt.Columns.Add(colpictid2);
  598. //图像列
  599. DataColumn colpict2 = new DataColumn("FieldImg");
  600. colpict2.DataType = System.Type.GetType("System.Byte[]");
  601. DT_field_dt.Columns.Add(colpict2);
  602. //表名Largest_frame表:(子表) 显示20条颗粒除外的部份颗粒信息
  603. DataTable DT_field_dt_copy = new DataTable();
  604. DataTable DT_Largest_frame = new DataTable();
  605. DT_Largest_frame.TableName = "Largest_frame";
  606. DT_Largest_frame.Columns.Add("pid");
  607. DT_Largest_frame.Columns.Add("Size");
  608. DT_Largest_frame.Columns.Add("Width");
  609. DT_Largest_frame.Columns.Add("DMAX");
  610. DT_Largest_frame.Columns.Add("DMIN");
  611. DT_Largest_frame.Columns.Add("Class");
  612. DT_Largest_frame.Columns.Add("ColName1");
  613. DT_Largest_frame.Columns.Add("ColName2");
  614. DT_Largest_frame.Columns.Add("ColName3");
  615. DT_Largest_frame.Columns.Add("ColName4");
  616. DT_Largest_frame.Columns.Add("ColName5");
  617. DT_Largest_frame.Columns.Add("ColName6");
  618. DT_Largest_frame.Columns.Add("ColVal1");
  619. DT_Largest_frame.Columns.Add("ColVal2");
  620. DT_Largest_frame.Columns.Add("ColVal3");
  621. DT_Largest_frame.Columns.Add("ColVal4");
  622. DT_Largest_frame.Columns.Add("ColVal5");
  623. DT_Largest_frame.Columns.Add("ColVal6");
  624. DataColumn colpictid = new DataColumn("FieldId");
  625. colpictid.DataType = typeof(int);
  626. DT_Largest_frame.Columns.Add(colpictid);
  627. //图像列
  628. DataColumn colpict = new DataColumn("p1");
  629. colpict.DataType = System.Type.GetType("System.Byte[]");
  630. DT_Largest_frame.Columns.Add(colpict);
  631. //largest20表:(无关系表) 需要显示前20条带有显示能谱图像的颗粒表
  632. DataTable DT_Largest20 = new DataTable();
  633. DT_Largest20.TableName = "Largest20";
  634. DT_Largest20.Columns.Add("pid");
  635. DT_Largest20.Columns.Add("Size");
  636. DT_Largest20.Columns.Add("Width");
  637. DT_Largest20.Columns.Add("DMAX");
  638. DT_Largest20.Columns.Add("DMIN");
  639. DT_Largest20.Columns.Add("Class");
  640. DT_Largest20.Columns.Add("ColName1");
  641. DT_Largest20.Columns.Add("ColName2");
  642. DT_Largest20.Columns.Add("ColName3");
  643. DT_Largest20.Columns.Add("ColName4");
  644. DT_Largest20.Columns.Add("ColName5");
  645. DT_Largest20.Columns.Add("ColName6");
  646. DT_Largest20.Columns.Add("ColVal1");
  647. DT_Largest20.Columns.Add("ColVal2");
  648. DT_Largest20.Columns.Add("ColVal3");
  649. DT_Largest20.Columns.Add("ColVal4");
  650. DT_Largest20.Columns.Add("ColVal5");
  651. DT_Largest20.Columns.Add("ColVal6");
  652. // 图像列
  653. DataColumn colpict_20ago = new DataColumn("p1");
  654. colpict_20ago.DataType = System.Type.GetType("System.Byte[]");
  655. DT_Largest20.Columns.Add(colpict_20ago);
  656. DataColumn colpict2_20ago = new DataColumn("p2");
  657. colpict2_20ago.DataType = System.Type.GetType("System.Byte[]");
  658. DT_Largest20.Columns.Add(colpict2_20ago);
  659. DataColumn colpict3_20ago = new DataColumn("p3");
  660. colpict3_20ago.DataType = System.Type.GetType("System.Byte[]");
  661. DT_Largest20.Columns.Add(colpict3_20ago);
  662. #endregion
  663. #region 插入-前20颗粒部份
  664. for (int i_row = 0; i_row < dt_ParticlesGridDevidePage.Rows.Count; i_row++)
  665. {
  666. if (dt_ParticlesGridDevidePage.Rows[i_row].ItemArray[24].ToString() != "Not Identified")
  667. {
  668. //获取颗粒的fieldid,和particleid
  669. string str_fieldid = dt_ParticlesGridDevidePage.Rows[i_row]["fieldid"].ToString();
  670. string str_particleid = dt_ParticlesGridDevidePage.Rows[i_row]["particleid"].ToString();
  671. string str_subparticles = dt_ParticlesGridDevidePage.Rows[i_row]["SubParticles"].ToString();
  672. string str_typeid = dt_ParticlesGridDevidePage.Rows[i_row]["TypeId"].ToString();
  673. string str_typename = dt_ParticlesGridDevidePage.Rows[i_row]["TypeName"].ToString();
  674. string str_element = dt_ParticlesGridDevidePage.Rows[i_row]["Element"].ToString();
  675. //获取原始颗粒图像
  676. Bitmap bp_particle = new Bitmap(1, 1);
  677. string str_path = str_resultPath + "\\FIELD_FILES\\";
  678. string str_imagePath = str_path + "Field" + str_fieldid.ToString() + ".bmp";
  679. if (str_fieldid == "-1")
  680. continue;
  681. if (serialNumber > 20)
  682. continue;
  683. if (str_subparticles != null && str_subparticles != "")
  684. {
  685. //合并大颗粒
  686. double ScanFieldSize = 1142;
  687. Bitmap tempbit = fielddata.ReadImageFile(str_imagePath);
  688. int pixw = tempbit.Width;
  689. double xs = pixw / ScanFieldSize;
  690. bp_particle = fielddata.GetBitmapForBig(str_subparticles, xs, str_resultPath);
  691. }
  692. else
  693. {
  694. //正常颗粒
  695. Rectangle rectangle = new Rectangle() { X = Convert.ToInt32(dt_ParticlesGridDevidePage.Rows[i_row]["RectLeft"]), Y = Convert.ToInt32(dt_ParticlesGridDevidePage.Rows[i_row]["RectTop"]), Width = Convert.ToInt32(dt_ParticlesGridDevidePage.Rows[i_row]["RectWidth"]), Height = Convert.ToInt32(dt_ParticlesGridDevidePage.Rows[i_row]["RectHeight"]) };
  696. Bitmap bp_field = fielddata.ReadImageFile(str_imagePath);
  697. bp_particle = fielddata.GetBitmapByParticle(bp_field, rectangle);
  698. bp_particle.Tag = new List<string>() { dt_ParticlesGridDevidePage.Rows[i_row]["FieldId"].ToString(), dt_ParticlesGridDevidePage.Rows[i_row]["ParticleId"].ToString(), dt_ParticlesGridDevidePage.Rows[i_row]["TypeId"].ToString() };
  699. }
  700. //获取该颗粒的xray能谱图像
  701. System.Drawing.Bitmap bp_xraybp = ExportXRayBitmap(str_fieldid,
  702. str_particleid, Convert.ToInt32(str_typeid), str_typename, fielddata);
  703. Bitmap ls_xraybpnew = new Bitmap(1, 1);
  704. ls_xraybpnew = OTSIncAReportGraph.Class.DrawFunction.KiResizeImage(bp_xraybp, 700, 115);//能谱图处理
  705. //获取该颗粒的二次放大处理图像
  706. Bitmap ls_processbitmap = new Bitmap(1, 1);
  707. ls_processbitmap = OTSIncAReportGraph.Class.DrawFunction.GetReZoomBitmap(bp_particle);// (Bitmap)bp_particle.Clone();//待完善
  708. //再将图像转成二进制流-------------------------------------------------------------------
  709. //原图
  710. MemoryStream newms_p1 = new MemoryStream();
  711. bp_particle.Save(newms_p1, System.Drawing.Imaging.ImageFormat.Bmp);
  712. newms_p1.Seek(0, SeekOrigin.Begin);
  713. byte[] newarr_p1 = new byte[newms_p1.Length];
  714. newms_p1.Read(newarr_p1, 0, newarr_p1.Length);
  715. //二次放大图
  716. MemoryStream newms_p2 = new MemoryStream();
  717. ls_processbitmap.Save(newms_p2, System.Drawing.Imaging.ImageFormat.Bmp);
  718. newms_p2.Seek(0, SeekOrigin.Begin);
  719. byte[] newarr_p2 = new byte[newms_p2.Length];
  720. newms_p2.Read(newarr_p2, 0, newarr_p2.Length);
  721. //能谱图
  722. MemoryStream newms_p3 = new MemoryStream();
  723. ls_xraybpnew.Save(newms_p3, System.Drawing.Imaging.ImageFormat.Bmp);
  724. newms_p3.Seek(0, SeekOrigin.Begin);
  725. byte[] newarr_p3 = new byte[newms_p3.Length];
  726. newms_p3.Read(newarr_p3, 0, newarr_p3.Length);
  727. //---------------------------------------------------------------------------------------
  728. DataRow dr = DT_Largest20.NewRow();
  729. dr["p1"] = newarr_p1;
  730. dr["p2"] = newarr_p2;
  731. dr["p3"] = newarr_p3;
  732. newms_p1.Dispose();
  733. newms_p2.Dispose();
  734. newms_p3.Dispose();
  735. dr["pid"] = serialNumber++.ToString();
  736. //dr["pid"] = str_fieldid + dt_ParticlesGridDevidePage.Rows[i_row]["particleid"].ToString();
  737. dr["Size"] = Convert.ToDouble(dt_ParticlesGridDevidePage.Rows[i_row]["area"]).ToString("#0.00"); //可以需要选择切换,计算方式
  738. dr["Width"] = dt_ParticlesGridDevidePage.Rows[i_row]["rectwidth"].ToString();
  739. dr["DMAX"] = Math.Round(Convert.ToDouble(dt_ParticlesGridDevidePage.Rows[i_row]["dmax"]), 2).ToString();
  740. dr["DMIN"] = dt_ParticlesGridDevidePage.Rows[i_row]["Hardness_detailed"].ToString();
  741. dr["Class"] = dt_ParticlesGridDevidePage.Rows[i_row]["typename"].ToString();
  742. List<string> list_max_elementname = new List<string>();
  743. List<double> list_max_elementvale = new List<double>();
  744. GetMaxElementFromDataTable(dt_ParticlesGridDevidePage, i_row, out list_max_elementname, out list_max_elementvale);
  745. //元素1
  746. dr["ColName1"] = list_max_elementname[0];
  747. dr["ColVal1"] = list_max_elementvale[0].ToString();
  748. //元素2
  749. dr["ColName2"] = list_max_elementname[1];
  750. dr["ColVal2"] = list_max_elementvale[1].ToString();
  751. //元素3
  752. dr["ColName3"] = list_max_elementname[2];
  753. dr["ColVal3"] = list_max_elementvale[2].ToString();
  754. //元素4
  755. dr["ColName4"] = list_max_elementname[3];
  756. dr["ColVal4"] = list_max_elementvale[3].ToString();
  757. //元素5
  758. dr["ColName5"] = list_max_elementname[4];
  759. dr["ColVal5"] = list_max_elementvale[4].ToString();
  760. //元素6
  761. dr["ColName6"] = list_max_elementname[5];
  762. dr["ColVal6"] = list_max_elementvale[5].ToString();
  763. DT_Largest20.Rows.Add(dr);
  764. }
  765. }
  766. #endregion
  767. #region 插入-帧图图像部份
  768. List<string> vs = new List<string>();
  769. DataTable data = new DataTable();
  770. //首先生成标记颗粒的帧图图像文件
  771. DataTable dt_GridDevidePage = new DataTable();
  772. dt_GridDevidePage = dt_ParticlesGridDevidePage.Copy();
  773. dt_GridDevidePage.Clear();
  774. for (int i = 0; i < dt_ParticlesGridDevidePage.Rows.Count; i++)
  775. {
  776. if (dt_ParticlesGridDevidePage.Rows[i]["TypeName"].ToString() != "Not Identified")
  777. {
  778. dt_GridDevidePage.Rows.Add(dt_ParticlesGridDevidePage.Rows[i].ItemArray);
  779. }
  780. }
  781. m_otsreport_export.m_ReportApp.im_ParticlesGridDevidePage.SaveMarkParticleRectangleOnFieldFile(dt_GridDevidePage, out vs, out data);
  782. string str_path_FIELD_FILES_MARK = str_resultPath + "\\FIELD_FILES_MARK\\";
  783. DirectoryInfo theFolder = new DirectoryInfo(str_path_FIELD_FILES_MARK);
  784. if (theFolder.Exists)
  785. {
  786. for (int i = 0; i < vs.Count; i++)
  787. {
  788. foreach (FileInfo nextifile in theFolder.GetFiles())
  789. {
  790. if (nextifile.Name.Contains(".bmp") == true || nextifile.Name.Contains(".BMP") == true)
  791. {
  792. //确认对应的帧图名
  793. string str_fieldid = Path.GetFileNameWithoutExtension(nextifile.Name);
  794. if (str_fieldid == vs[i].ToString())
  795. {
  796. //在数据表中有颗粒在该帧图中的话,则对该帧图标记图像进行读取存入数据库
  797. DataRow[] datarowlist = dt_GridDevidePage.Select(" fieldid = " + str_fieldid);
  798. if (datarowlist.Count() > 0)
  799. {
  800. Bitmap ls_bp_fieldmark = new Bitmap(nextifile.FullName);
  801. DataRow dr = DT_field_dt.NewRow();
  802. MemoryStream newms_bp_fieldmark = new MemoryStream();
  803. ls_bp_fieldmark.Save(newms_bp_fieldmark, System.Drawing.Imaging.ImageFormat.Bmp);
  804. newms_bp_fieldmark.Seek(0, SeekOrigin.Begin);
  805. byte[] newarr_fieldmark = new byte[newms_bp_fieldmark.Length];
  806. newms_bp_fieldmark.Read(newarr_fieldmark, 0, newarr_fieldmark.Length);
  807. dr["FieldImg"] = newarr_fieldmark;
  808. dr["FieldId"] = str_fieldid;
  809. ls_bp_fieldmark.Dispose();
  810. DT_field_dt.Rows.Add(dr);
  811. }
  812. }
  813. }
  814. }
  815. }
  816. DT_field_dt_copy = DT_field_dt.Copy();
  817. }
  818. #endregion
  819. #region 插入-前20颗粒外的颗粒
  820. for (int i_row = 0; i_row < dt_ParticlesGridDevidePage.Rows.Count; i_row++)
  821. {
  822. if (dt_ParticlesGridDevidePage.Rows[i_row]["element"].ToString() == "")
  823. continue;
  824. //获取颗粒的fieldid,和particleid
  825. string str_fieldid = dt_ParticlesGridDevidePage.Rows[i_row]["fieldid"].ToString();
  826. if (Convert.ToInt32(str_fieldid) < 20)
  827. {
  828. string str_particleid = dt_ParticlesGridDevidePage.Rows[i_row]["particleid"].ToString();
  829. string str_subparticles = dt_ParticlesGridDevidePage.Rows[i_row]["SubParticles"].ToString();
  830. string str_typeid = dt_ParticlesGridDevidePage.Rows[i_row]["TypeId"].ToString();
  831. string str_typename = dt_ParticlesGridDevidePage.Rows[i_row]["TypeName"].ToString();
  832. string str_element = dt_ParticlesGridDevidePage.Rows[i_row]["Element"].ToString();
  833. //获取原始颗粒图像
  834. Bitmap bp_particle = new Bitmap(1, 1);
  835. string str_path = str_resultPath + "\\FIELD_FILES\\";
  836. string str_imagePath = str_path + "Field" + str_fieldid.ToString() + ".bmp";
  837. if (str_subparticles != null && str_subparticles != "")
  838. {
  839. //合并大颗粒
  840. //double ScanFieldSize = 1142;
  841. //Bitmap tempbit = fielddata.ReadImageFile(str_imagePath);
  842. //int pixw = tempbit.Width;
  843. //double xs = pixw / ScanFieldSize;
  844. //bp_particle = fielddata.GetBitmapForBig(str_subparticles, xs, str_resultPath);
  845. continue;
  846. }
  847. else
  848. {
  849. //正常颗粒
  850. Rectangle rectangle = new Rectangle() { X = Convert.ToInt32(dt_ParticlesGridDevidePage.Rows[i_row]["RectLeft"]), Y = Convert.ToInt32(dt_ParticlesGridDevidePage.Rows[i_row]["RectTop"]), Width = Convert.ToInt32(dt_ParticlesGridDevidePage.Rows[i_row]["RectWidth"]), Height = Convert.ToInt32(dt_ParticlesGridDevidePage.Rows[i_row]["RectHeight"]) };
  851. Bitmap bp_field = fielddata.ReadImageFile(str_imagePath);
  852. bp_particle = fielddata.GetBitmapByParticle(bp_field, rectangle);
  853. bp_particle.Tag = new List<string>() { dt_ParticlesGridDevidePage.Rows[i_row]["FieldId"].ToString(), dt_ParticlesGridDevidePage.Rows[i_row]["ParticleId"].ToString(), dt_ParticlesGridDevidePage.Rows[i_row]["TypeId"].ToString() };
  854. }
  855. //获取该颗粒的xray能谱图像
  856. System.Drawing.Bitmap bp_xraybp = ExportXRayBitmap(str_fieldid,
  857. str_particleid, Convert.ToInt32(str_typeid), str_typename, fielddata);
  858. //获取该颗粒的二次放大处理图像
  859. Bitmap ls_processbitmap = new Bitmap(1, 1);
  860. ls_processbitmap = (Bitmap)bp_particle.Clone();//待完善
  861. //再将图像转成二进制流-------------------------------------------------------------------
  862. //原图
  863. MemoryStream newms_p1 = new MemoryStream();
  864. bp_particle.Save(newms_p1, System.Drawing.Imaging.ImageFormat.Bmp);
  865. newms_p1.Seek(0, SeekOrigin.Begin);
  866. byte[] newarr_p1 = new byte[newms_p1.Length];
  867. newms_p1.Read(newarr_p1, 0, newarr_p1.Length);
  868. //---------------------------------------------------------------------------------------
  869. DataRow dr = DT_Largest_frame.NewRow();
  870. dr["p1"] = newarr_p1;
  871. newms_p1.Dispose();
  872. dr["pid"] = str_fieldid + dt_ParticlesGridDevidePage.Rows[i_row]["particleid"].ToString();
  873. dr["Size"] = Convert.ToDouble(dt_ParticlesGridDevidePage.Rows[i_row]["area"]).ToString("#0.00"); //可以需要选择切换,计算方式
  874. dr["Width"] = dt_ParticlesGridDevidePage.Rows[i_row]["rectwidth"].ToString();
  875. dr["DMAX"] = Math.Round(Convert.ToDouble(dt_ParticlesGridDevidePage.Rows[i_row]["dmax"]), 2).ToString();
  876. dr["DMIN"] = dt_ParticlesGridDevidePage.Rows[i_row]["Hardness_detailed"].ToString();
  877. dr["Class"] = dt_ParticlesGridDevidePage.Rows[i_row]["typename"].ToString();
  878. dr["fieldid"] = str_fieldid;
  879. List<string> list_max_elementname = new List<string>();
  880. List<double> list_max_elementvale = new List<double>();
  881. GetMaxElementFromDataTable(dt_ParticlesGridDevidePage, i_row, out list_max_elementname, out list_max_elementvale);
  882. //元素1
  883. dr["ColName1"] = list_max_elementname[0];
  884. dr["ColVal1"] = list_max_elementvale[0].ToString();
  885. //元素2
  886. dr["ColName2"] = list_max_elementname[1];
  887. dr["ColVal2"] = list_max_elementvale[1].ToString();
  888. //元素3
  889. dr["ColName3"] = list_max_elementname[2];
  890. dr["ColVal3"] = list_max_elementvale[2].ToString();
  891. //元素4
  892. dr["ColName4"] = list_max_elementname[3];
  893. dr["ColVal4"] = list_max_elementvale[3].ToString();
  894. //元素5
  895. dr["ColName5"] = list_max_elementname[4];
  896. dr["ColVal5"] = list_max_elementvale[4].ToString();
  897. //元素6
  898. dr["ColName6"] = list_max_elementname[5];
  899. dr["ColVal6"] = list_max_elementvale[5].ToString();
  900. DT_Largest_frame.Rows.Add(dr);
  901. }
  902. }
  903. #endregion
  904. FrameGraphParticleTable(dt_ParticlesGridDevidePage, str_resultPath, fielddata, DT_field_dt);
  905. m_list_dt.Add(DT_field_dt_copy);
  906. m_list_dt.Add(DT_Largest_frame);
  907. m_list_dt.Add(DT_Largest20);
  908. return true;
  909. }
  910. private bool JudgeWhetherItExists(int id, DataTable dt,string column)
  911. {
  912. for (int i=0;i<dt.Rows.Count;i++)
  913. {
  914. if (id == Convert.ToInt32(dt.Rows[i][column].ToString()))
  915. return true;
  916. }
  917. return false;
  918. }
  919. /// <param name="dt_ParticlesGridDevidePage">数据源</param>
  920. /// <param name="str_resultPath">地址</param>
  921. /// <param name="fielddata"></param>
  922. /// <param name="DT_field_dt">主表</param>
  923. private void FrameGraphParticleTable(DataTable dt_ParticlesGridDevidePage,string str_resultPath, ParticleData fielddata,DataTable DT_field_dt)
  924. {
  925. //表名Largest_frame表:(子表) 显示20条颗粒除外的部份颗粒信息
  926. DataTable FrameGraphSubTable = new DataTable();
  927. FrameGraphSubTable.TableName = "FrameGraphSubTable";
  928. FrameGraphSubTable.Columns.Add("pid");
  929. FrameGraphSubTable.Columns.Add("Size");
  930. FrameGraphSubTable.Columns.Add("Width");
  931. FrameGraphSubTable.Columns.Add("DMAX");
  932. FrameGraphSubTable.Columns.Add("DMIN");
  933. FrameGraphSubTable.Columns.Add("Class");
  934. FrameGraphSubTable.Columns.Add("ColName1");
  935. FrameGraphSubTable.Columns.Add("ColName2");
  936. FrameGraphSubTable.Columns.Add("ColName3");
  937. FrameGraphSubTable.Columns.Add("ColName4");
  938. FrameGraphSubTable.Columns.Add("ColName5");
  939. FrameGraphSubTable.Columns.Add("ColName6");
  940. FrameGraphSubTable.Columns.Add("ColVal1");
  941. FrameGraphSubTable.Columns.Add("ColVal2");
  942. FrameGraphSubTable.Columns.Add("ColVal3");
  943. FrameGraphSubTable.Columns.Add("ColVal4");
  944. FrameGraphSubTable.Columns.Add("ColVal5");
  945. FrameGraphSubTable.Columns.Add("ColVal6");
  946. DataColumn colpictid = new DataColumn("FieldId");
  947. colpictid.DataType = typeof(int);
  948. FrameGraphSubTable.Columns.Add(colpictid);
  949. //图像列
  950. DataColumn colpict = new DataColumn("p1");
  951. colpict.DataType = System.Type.GetType("System.Byte[]");
  952. FrameGraphSubTable.Columns.Add(colpict);
  953. for (int i_row = 0; i_row < dt_ParticlesGridDevidePage.Rows.Count; i_row++)
  954. {
  955. if (dt_ParticlesGridDevidePage.Rows[i_row]["element"].ToString() == "")
  956. continue;
  957. if (dt_ParticlesGridDevidePage.Rows[i_row]["TypeName"].ToString() == "Not Identified")
  958. continue;
  959. //获取颗粒的fieldid,和particleid
  960. string str_fieldid = dt_ParticlesGridDevidePage.Rows[i_row]["fieldid"].ToString();
  961. //if (Convert.ToInt32(str_fieldid) < 20)
  962. if (JudgeWhetherItExists(Convert.ToInt32(str_fieldid), DT_field_dt, "FieldId"))
  963. {
  964. string str_particleid = dt_ParticlesGridDevidePage.Rows[i_row]["particleid"].ToString();
  965. string str_subparticles = dt_ParticlesGridDevidePage.Rows[i_row]["SubParticles"].ToString();
  966. string str_typeid = dt_ParticlesGridDevidePage.Rows[i_row]["TypeId"].ToString();
  967. string str_typename = dt_ParticlesGridDevidePage.Rows[i_row]["TypeName"].ToString();
  968. string str_element = dt_ParticlesGridDevidePage.Rows[i_row]["Element"].ToString();
  969. //获取原始颗粒图像
  970. Bitmap bp_particle = new Bitmap(1, 1);
  971. string str_path = str_resultPath + "\\FIELD_FILES\\";
  972. string str_imagePath = str_path + "Field" + str_fieldid.ToString() + ".bmp";
  973. if (str_subparticles != null && str_subparticles != "")
  974. {
  975. continue;
  976. }
  977. else
  978. {
  979. //正常颗粒
  980. Rectangle rectangle = new Rectangle() { X = Convert.ToInt32(dt_ParticlesGridDevidePage.Rows[i_row]["RectLeft"]), Y = Convert.ToInt32(dt_ParticlesGridDevidePage.Rows[i_row]["RectTop"]), Width = Convert.ToInt32(dt_ParticlesGridDevidePage.Rows[i_row]["RectWidth"]), Height = Convert.ToInt32(dt_ParticlesGridDevidePage.Rows[i_row]["RectHeight"]) };
  981. Bitmap bp_field = fielddata.ReadImageFile(str_imagePath);
  982. bp_particle = fielddata.GetBitmapByParticle(bp_field, rectangle);
  983. bp_particle.Tag = new List<string>() { dt_ParticlesGridDevidePage.Rows[i_row]["FieldId"].ToString(), dt_ParticlesGridDevidePage.Rows[i_row]["ParticleId"].ToString(), dt_ParticlesGridDevidePage.Rows[i_row]["TypeId"].ToString() };
  984. }
  985. //获取该颗粒的xray能谱图像
  986. System.Drawing.Bitmap bp_xraybp = ExportXRayBitmap(str_fieldid,
  987. str_particleid, Convert.ToInt32(str_typeid), str_typename, fielddata);
  988. //获取该颗粒的二次放大处理图像
  989. Bitmap ls_processbitmap = new Bitmap(1, 1);
  990. ls_processbitmap = (Bitmap)bp_particle.Clone();//待完善
  991. //再将图像转成二进制流-------------------------------------------------------------------
  992. //原图
  993. MemoryStream newms_p1 = new MemoryStream();
  994. bp_particle.Save(newms_p1, System.Drawing.Imaging.ImageFormat.Bmp);
  995. newms_p1.Seek(0, SeekOrigin.Begin);
  996. byte[] newarr_p1 = new byte[newms_p1.Length];
  997. newms_p1.Read(newarr_p1, 0, newarr_p1.Length);
  998. //---------------------------------------------------------------------------------------
  999. DataRow dr = FrameGraphSubTable.NewRow();
  1000. dr["p1"] = newarr_p1;
  1001. newms_p1.Dispose();
  1002. ResultFile resfile = m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.getSelectedIndex()];
  1003. if (((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)resfile.ResultInfo["Sample"])["Members"])["MsrParams"])["SysType"].ToString() == "0:IncA")
  1004. {
  1005. dr["pid"] = str_fieldid + dt_ParticlesGridDevidePage.Rows[i_row]["particleid"].ToString();
  1006. }
  1007. else
  1008. {
  1009. dr["pid"] = /*str_fieldid + */dt_ParticlesGridDevidePage.Rows[i_row]["Hardness_detailed"].ToString();
  1010. }
  1011. dr["Size"] = Convert.ToDouble(dt_ParticlesGridDevidePage.Rows[i_row]["area"]).ToString("#0.00"); //可以需要选择切换,计算方式
  1012. dr["Width"] = dt_ParticlesGridDevidePage.Rows[i_row]["rectwidth"].ToString();
  1013. dr["DMAX"] = Math.Round(Convert.ToDouble(dt_ParticlesGridDevidePage.Rows[i_row]["dmax"]),2).ToString();
  1014. dr["DMIN"] = Math.Round(Convert.ToDouble(dt_ParticlesGridDevidePage.Rows[i_row]["dmin"]),2).ToString();
  1015. dr["Class"] = dt_ParticlesGridDevidePage.Rows[i_row]["typename"].ToString();
  1016. dr["fieldid"] = str_fieldid;
  1017. List<string> list_max_elementname = new List<string>();
  1018. List<double> list_max_elementvale = new List<double>();
  1019. GetMaxElementFromDataTable(dt_ParticlesGridDevidePage, i_row, out list_max_elementname, out list_max_elementvale);
  1020. //元素1
  1021. dr["ColName1"] = list_max_elementname[0];
  1022. dr["ColVal1"] = list_max_elementvale[0].ToString();
  1023. //元素2
  1024. dr["ColName2"] = list_max_elementname[1];
  1025. dr["ColVal2"] = list_max_elementvale[1].ToString();
  1026. //元素3
  1027. dr["ColName3"] = list_max_elementname[2];
  1028. dr["ColVal3"] = list_max_elementvale[2].ToString();
  1029. //元素4
  1030. dr["ColName4"] = list_max_elementname[3];
  1031. dr["ColVal4"] = list_max_elementvale[3].ToString();
  1032. //元素5
  1033. dr["ColName5"] = list_max_elementname[4];
  1034. dr["ColVal5"] = list_max_elementvale[4].ToString();
  1035. //元素6
  1036. dr["ColName6"] = list_max_elementname[5];
  1037. dr["ColVal6"] = list_max_elementvale[5].ToString();
  1038. FrameGraphSubTable.Rows.Add(dr);
  1039. }
  1040. }
  1041. m_list_dt.Add(FrameGraphSubTable);
  1042. }
  1043. #endregion
  1044. #region 插入颗粒尺寸表
  1045. /// <summary>
  1046. /// 向 模板设计器 中插入 颗粒尺寸表
  1047. /// </summary>
  1048. /// <returns></returns>
  1049. public bool InsertReportTemplateTable_ParticleSizeGrid()
  1050. {
  1051. try
  1052. {
  1053. if (m_bt_DBData.Columns.Count==0)
  1054. {
  1055. GetDBData();
  1056. }
  1057. List<string> colid = new List<string>();
  1058. //获取粒级表
  1059. string path1 = m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFileFolder + m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFile;
  1060. DataSet ds = OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.GetXml(path1);
  1061. string sizestr = ds.Tables[0].Rows[0]["Sizes"].ToString();
  1062. for (int i = 0; i < sizestr.Split(',').Length - 1; i++)
  1063. {
  1064. if (sizestr.Split(',')[i].Length > 0)
  1065. {
  1066. double d1 = Convert.ToDouble(sizestr.Split(',')[i]);
  1067. double d2 = Convert.ToDouble(sizestr.Split(',')[i + 1]);
  1068. colid.Add(d1.ToString() + "~" + d2.ToString());
  1069. }
  1070. }
  1071. double d = Convert.ToDouble(sizestr.Split(',')[sizestr.Split(',').Length - 1]);
  1072. colid.Add(d.ToString() + "~MAX");
  1073. ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.getSelectedIndex()].FilePath);
  1074. //------------------------------------------------
  1075. DataTable ls_partsize_dt = new DataTable();
  1076. ls_partsize_dt.TableName = "PartSize";
  1077. ls_partsize_dt.Columns.Add("c1");
  1078. ls_partsize_dt.Columns.Add("c2");
  1079. ls_partsize_dt.Columns.Add("c3");
  1080. ls_partsize_dt.Columns.Add("c4");
  1081. ls_partsize_dt.Columns.Add("c5");
  1082. ls_partsize_dt.Columns.Add("c6");
  1083. ls_partsize_dt.Columns.Add("c7");
  1084. ls_partsize_dt.Columns.Add("c8");
  1085. ls_partsize_dt.Columns.Add("c9");
  1086. DataRow dr = ls_partsize_dt.NewRow();
  1087. for (int i=1;i<10;i++)
  1088. {
  1089. if (colid.Count<i)
  1090. {
  1091. dr["c" + i.ToString()] = "";
  1092. }
  1093. else
  1094. {
  1095. dr["c" + i.ToString()] = colid[i - 1];
  1096. }
  1097. }
  1098. ls_partsize_dt.Rows.Add(dr);
  1099. DataTable ls_Particel_dt = new DataTable();
  1100. ls_Particel_dt.TableName = "Particel";
  1101. ls_Particel_dt.Columns.Add("c1", typeof(double));
  1102. ls_Particel_dt.Columns.Add("c2", typeof(double));
  1103. ls_Particel_dt.Columns.Add("c3", typeof(double));
  1104. ls_Particel_dt.Columns.Add("c4", typeof(double));
  1105. ls_Particel_dt.Columns.Add("c5", typeof(double));
  1106. ls_Particel_dt.Columns.Add("c6", typeof(double));
  1107. ls_Particel_dt.Columns.Add("c7", typeof(double));
  1108. ls_Particel_dt.Columns.Add("c8", typeof(double));
  1109. ls_Particel_dt.Columns.Add("c9", typeof(double));
  1110. ls_Particel_dt.Columns.Add("Name");
  1111. ls_Particel_dt.Columns.Add("total", typeof(double));
  1112. ls_Particel_dt.Columns.Add("TypeId");
  1113. ls_Particel_dt.Columns.Add("Class");
  1114. for (int i = 0; i < m_bt_DBData.Rows.Count; i++)
  1115. {
  1116. DataRow dr2 = ls_Particel_dt.NewRow();
  1117. dr2["Name"] = m_bt_DBData.Rows[i]["TypeName"].ToString();
  1118. dr2["Class"] = m_bt_DBData.Rows[i]["Class"].ToString();
  1119. dr2["TypeId"] = m_bt_DBData.Rows[i]["TypeId"].ToString();//获取分类编号
  1120. for (int j=1;j< 10;j++)
  1121. {
  1122. if (colid.Count >= j)
  1123. {
  1124. dr2["c" + j.ToString()] = Convert.ToDouble(m_bt_DBData.Rows[i][colid[j-1]]);
  1125. }
  1126. }
  1127. if (dr2["Name"].ToString() != "" && dr2["Name"].ToString().IndexOf("number") < 0)
  1128. {
  1129. dr2["total"] = "0"; //求合
  1130. double d_total = 0;
  1131. for (int j = 1; j < 10; j++)
  1132. {
  1133. if (colid.Count >= j)
  1134. {
  1135. d_total = d_total + Convert.ToInt64(m_bt_DBData.Rows[i][colid[j - 1]]);
  1136. }
  1137. }
  1138. dr2["total"] = d_total.ToString();
  1139. }
  1140. ls_Particel_dt.Rows.Add(dr2);
  1141. }
  1142. //按照list列表进行物质类排序,物质类中的元素分类按照面积的大小进行排序
  1143. List<string> ClassName = new List<string>();
  1144. DataTable getClass_dt = fielddata.GetAllClass();
  1145. for (int i = 0; i < getClass_dt.Rows.Count; i++)
  1146. {
  1147. if (getClass_dt.Rows[i]["GroupName"].ToString() != "NOT_INCLUTION" && getClass_dt.Rows[i]["GroupName"].ToString() != "Invalid")
  1148. ClassName.Add(getClass_dt.Rows[i]["GroupName"].ToString());
  1149. }
  1150. //for (int i = 0; i < getClass_dt.Rows.Count; i++)
  1151. //{
  1152. // if (getClass_dt.Rows[i]["GroupName"].ToString() == "NOT_INCLUTION")
  1153. // ClassName.Add(getClass_dt.Rows[i]["GroupName"].ToString());
  1154. //}
  1155. //获取大分类信息
  1156. DataTable dt = InvalidRemoval(QuantityOfIntegratedSubstances(ls_Particel_dt, ClassName), "Class");
  1157. //DataTable dt = QuantityOfIntegratedSubstances(ls_Particel_dt, ClassName);
  1158. ClassificationSort(ls_Particel_dt,ClassName, dt);
  1159. m_list_dt.Add(ls_partsize_dt);
  1160. return true;
  1161. }
  1162. catch (Exception ee)
  1163. {
  1164. m_otsreport_export.WriteRictBox(ee.ToString());
  1165. return false;
  1166. }
  1167. }
  1168. private DataTable QuantityOfIntegratedSubstances(DataTable dataTable, List<string> ClassName )
  1169. {
  1170. DataTable dt_Class = dataTable.Copy();
  1171. dt_Class.Clear();
  1172. dt_Class.TableName = "Particel";
  1173. dt_Class.Columns.Remove("Name");
  1174. dt_Class.Columns.Remove("TypeId");
  1175. for (int i = 0; i < ClassName.Count; i++)
  1176. {
  1177. //保留当前循环中大类物质,去除其他物质
  1178. DataTable dt = dataTable.Copy();
  1179. dt.Clear();
  1180. for (int a = 0; a < dataTable.Rows.Count; a++)
  1181. {
  1182. if (dataTable.Rows[a]["Class"].ToString() == ClassName[i].ToString())
  1183. {
  1184. dt.Rows.Add(dataTable.Rows[a].ItemArray);
  1185. }
  1186. }
  1187. if (dt.Rows.Count == 0)
  1188. continue;
  1189. DataTable dt_2 = new DataTable();
  1190. dt_2 = dataTable.Copy();
  1191. dt_2.Clear();
  1192. DataRow row = dt_2.NewRow();
  1193. dt_2.Rows.Add(row);
  1194. for (int a=0;a< dt.Columns.Count;a++)
  1195. {
  1196. if (dt.Columns[a].ToString() != "Name" && dt.Columns[a].ToString() != "Class"&&dt.Columns[a].ToString()!= "TypeId")
  1197. {
  1198. bool bl = false;
  1199. for (int b = 0; b < dt.Rows.Count; b++)
  1200. {
  1201. if (!dt.Rows[b].IsNull(dt.Columns[a].ToString()))
  1202. {
  1203. bl = true;
  1204. }
  1205. }
  1206. if (bl)
  1207. {
  1208. dt_2.Rows[0][dt.Columns[a].ToString()] = decimal.Parse(dt.Compute("sum(" + dt.Columns[a].ToString() + ")", "").ToString());
  1209. }
  1210. }
  1211. }
  1212. dt_2.Columns.Remove("Name");
  1213. dt_2.Columns.Remove("TypeId");
  1214. dt_2.Rows[0]["Class"] = ClassName[i];
  1215. //dt_2.Rows[0]["TypeId"] = dt.Rows[0]["TypeId"].ToString();
  1216. dt_Class.Rows.Add(dt_2.Rows[0].ItemArray);
  1217. }
  1218. m_list_dt.Add(dt_Class);
  1219. return dt_Class;
  1220. }
  1221. private void ClassificationSort(DataTable dataTable,List<string> ClassName,DataTable data)
  1222. {
  1223. DataTable dt = new DataTable();
  1224. dt = dataTable.Copy();
  1225. dt.Clear();
  1226. dt.TableName = "Particel_subdivision";
  1227. //循环list中每个类型
  1228. for (int i=0;i< ClassName.Count();i++)
  1229. {
  1230. DataTable data1 = dt.Copy();
  1231. data1.Clear();
  1232. data1.Rows.Add();
  1233. for (int a=0;a< data.Rows.Count;a++)
  1234. {
  1235. if (data.Rows[a]["Class"].ToString()== ClassName[i].ToString())
  1236. {
  1237. for (int b=1;b<10;b++)
  1238. {
  1239. data1.Rows[0]["c"+b.ToString()] = data.Rows[a]["c"+b.ToString()];
  1240. }
  1241. data1.Rows[0]["total"] = data.Rows[a]["total"];
  1242. data1.Rows[0]["Class"] = data.Rows[a]["Class"];
  1243. dt.Rows.Add(data1.Rows[0].ItemArray);
  1244. }
  1245. }
  1246. DataTable dt_1 = new DataTable();
  1247. dt_1 = dt.Copy();
  1248. dt_1.Clear();
  1249. //循环DataTable中每个分类的数据
  1250. for (int a=0;a< dataTable.Rows.Count;a++)
  1251. {
  1252. if (dataTable.Rows[a]["Class"].ToString()== ClassName[i])
  1253. {
  1254. dataTable.Rows[a]["Class"] = "";
  1255. dt_1.Rows.Add(dataTable.Rows[a].ItemArray);
  1256. }
  1257. }
  1258. //将颗粒数量排序(从大到小)
  1259. DataView dv = dt_1.DefaultView;
  1260. dv.Sort = "total DESC";
  1261. DataTable dt_1_sort = dv.ToTable();
  1262. for (int a = 0; a < dt_1_sort.Rows.Count; a++)
  1263. {
  1264. dt.Rows.Add(dt_1_sort.Rows[a].ItemArray);
  1265. }
  1266. }
  1267. dt.Columns.Remove("TypeId");
  1268. m_list_dt.Add(dt);
  1269. }
  1270. #endregion
  1271. #region 插入平均元素含量表
  1272. /// <summary>
  1273. /// 向 模板设计器 中插入 平均元素含量表
  1274. /// </summary>
  1275. /// <returns></returns>
  1276. public bool InsertReportTemplateTable_ElementCompositionAvgGrid()
  1277. {
  1278. try
  1279. {
  1280. //加载模块
  1281. ElementCompositionAvgGrid ls_elementcompositionavggrid = new ElementCompositionAvgGrid(m_otsreport_export.m_ReportApp);
  1282. m_otsreport_export.panel_container.Controls.Clear();
  1283. m_otsreport_export.panel_container.Controls.Add(ls_elementcompositionavggrid);
  1284. DataGridView ls_gv = new DataGridView();
  1285. DataTable ls_dt = new DataTable();
  1286. ls_elementcompositionavggrid.GetDataTableAndGridView(out ls_dt, out ls_gv);
  1287. //------------------------------------------------
  1288. DataTable ls_elementname_dt = new DataTable();
  1289. ls_elementname_dt.TableName = "ElementName";
  1290. ls_elementname_dt.Columns.Add("e1");
  1291. ls_elementname_dt.Columns.Add("e2");
  1292. ls_elementname_dt.Columns.Add("e3");
  1293. ls_elementname_dt.Columns.Add("e4");
  1294. ls_elementname_dt.Columns.Add("e5");
  1295. ls_elementname_dt.Columns.Add("e6");
  1296. ls_elementname_dt.Columns.Add("e7");
  1297. ls_elementname_dt.Columns.Add("e8");
  1298. ls_elementname_dt.Columns.Add("e9");
  1299. ls_elementname_dt.Columns.Add("e10");
  1300. ls_elementname_dt.Columns.Add("e11");
  1301. ls_elementname_dt.Columns.Add("e12");
  1302. ls_elementname_dt.Columns.Add("e13");
  1303. ls_elementname_dt.Columns.Add("e14");
  1304. DataRow dr = ls_elementname_dt.NewRow();
  1305. int col = 4;
  1306. for (int i = 1; i < 15; i++)
  1307. {
  1308. if (ls_gv.Columns.Count > col)
  1309. dr["e" + i.ToString()] = ls_gv.Columns[col++].Name;
  1310. }
  1311. ls_elementname_dt.Rows.Add(dr);
  1312. DataTable ls_element_dt = new DataTable();
  1313. ls_element_dt.TableName = "ElementValue";
  1314. ls_element_dt.Columns.Add("e1");
  1315. ls_element_dt.Columns.Add("e2");
  1316. ls_element_dt.Columns.Add("e3");
  1317. ls_element_dt.Columns.Add("e4");
  1318. ls_element_dt.Columns.Add("e5");
  1319. ls_element_dt.Columns.Add("e6");
  1320. ls_element_dt.Columns.Add("e7");
  1321. ls_element_dt.Columns.Add("e8");
  1322. ls_element_dt.Columns.Add("e9");
  1323. ls_element_dt.Columns.Add("e10");
  1324. ls_element_dt.Columns.Add("e11");
  1325. ls_element_dt.Columns.Add("e12");
  1326. ls_element_dt.Columns.Add("e13");
  1327. ls_element_dt.Columns.Add("e14");
  1328. ls_element_dt.Columns.Add("PName");
  1329. ls_element_dt.Columns.Add("Count");
  1330. ls_element_dt.Columns.Add("AllElements");
  1331. for (int i = 0; i < ls_gv.Rows.Count; i++)
  1332. {
  1333. DataRow dr2 = ls_element_dt.NewRow();
  1334. dr2["PName"] = ls_gv.Rows[i].Cells[1].Value.ToString();
  1335. dr2["Count"] = ls_gv.Rows[i].Cells[2].Value.ToString();
  1336. int colq = 4;
  1337. for (int j = 1; j < 15; j++)
  1338. {
  1339. if (ls_gv.Columns.Count > colq)
  1340. dr2["e" + j.ToString()] = ls_gv.Rows[i].Cells[colq++].Tag.ToString();
  1341. }
  1342. colq = 4;
  1343. string AllElements=null;
  1344. for (int j = 0; j < ls_gv.Rows[i].Cells.Count; j++)
  1345. {
  1346. if (ls_gv.Columns.Count > colq)
  1347. {
  1348. AllElements = AllElements+ ls_gv.Columns[colq].Name + "%="+ ls_gv.Rows[i].Cells[colq++].Tag.ToString()+"; ";
  1349. }
  1350. }
  1351. dr2["AllElements"] = AllElements;
  1352. ls_element_dt.Rows.Add(dr2);
  1353. }
  1354. //把用户设置感兴趣的元素显示在前边
  1355. for (int i=0;i< m_otsreport_export.m_mbszclass.M_YSFXJG.list_str_tb_ysfx_xsys.Count(); i++)
  1356. {
  1357. if (i > 13)
  1358. continue;
  1359. for (int a=0;a< ls_elementname_dt.Rows[0].ItemArray.Count(); a++)
  1360. {
  1361. if (m_otsreport_export.m_mbszclass.M_YSFXJG.list_str_tb_ysfx_xsys[i]== ls_elementname_dt.Rows[0][a].ToString())
  1362. {
  1363. string str_elementname = "";
  1364. str_elementname = ls_elementname_dt.Rows[0][i].ToString();
  1365. ls_elementname_dt.Rows[0][i] = ls_elementname_dt.Rows[0][a];
  1366. ls_elementname_dt.Rows[0][a] = str_elementname;
  1367. for (int j=0;j< ls_element_dt.Rows.Count;j++)
  1368. {
  1369. string str_element = "0";
  1370. str_element = ls_element_dt.Rows[j][i].ToString();
  1371. ls_element_dt.Rows[j][i] = ls_element_dt.Rows[j][a];
  1372. ls_element_dt.Rows[j][a] = str_element;
  1373. }
  1374. }
  1375. }
  1376. }
  1377. m_list_dt.Add(ls_elementname_dt);
  1378. m_list_dt.Add(ls_element_dt);
  1379. List<string> elementColumn= m_otsreport_export.m_mbszclass.M_YSFXJG.list_str_tb_ysfx_xsys;
  1380. return true;
  1381. }
  1382. catch (Exception ee)
  1383. {
  1384. m_otsreport_export.WriteRictBox(ee.ToString());
  1385. return false;
  1386. }
  1387. }
  1388. public bool InsertReportTemplateTable_ElementAvgGrid()
  1389. {
  1390. if (m_bt_DBData.Columns.Count == 0)
  1391. {
  1392. GetDBData();
  1393. }
  1394. //根据sql条件,查询获取颗粒信息数据
  1395. ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.getSelectedIndex()].FilePath);
  1396. DataTable AllAnalysisDetails = new DataTable();
  1397. AllAnalysisDetails.TableName = "ElementValue";
  1398. AllAnalysisDetails.Columns.Add("Name");
  1399. AllAnalysisDetails.Columns.Add("TypeId");
  1400. AllAnalysisDetails.Columns.Add("Area",typeof(double));
  1401. AllAnalysisDetails.Columns.Add("Class");
  1402. for (int i = 0; i < m_bt_DBData.Rows.Count; i++)
  1403. {
  1404. DataRow dr2 = AllAnalysisDetails.NewRow();
  1405. dr2["Name"] = m_bt_DBData.Rows[i]["TypeName"].ToString();
  1406. dr2["Area"] = Convert.ToDouble(m_bt_DBData.Rows[i]["ar"]);
  1407. dr2["TypeId"] = m_bt_DBData.Rows[i]["TypeId"].ToString();
  1408. dr2["Class"]= m_bt_DBData.Rows[i]["Class"].ToString();
  1409. AllAnalysisDetails.Rows.Add(dr2);
  1410. }
  1411. //按照list列表进行物质类排序,物质类中的元素分类按照面积的大小进行排序
  1412. List<string> ClassName = new List<string>();
  1413. DataTable getClass_dt= fielddata.GetAllClass();
  1414. for (int i = 0; i < getClass_dt.Rows.Count; i++)
  1415. {
  1416. if (getClass_dt.Rows[i]["GroupName"].ToString() != "NOT_INCLUTION" && getClass_dt.Rows[i]["GroupName"].ToString()!= "Invalid")
  1417. ClassName.Add(getClass_dt.Rows[i]["GroupName"].ToString());
  1418. }
  1419. //for (int i = 0; i < getClass_dt.Rows.Count; i++)
  1420. //{
  1421. // if (getClass_dt.Rows[i]["GroupName"].ToString() == "NOT_INCLUTION")
  1422. // ClassName.Add(getClass_dt.Rows[i]["GroupName"].ToString());
  1423. //}
  1424. //统计元素物质大类的元素信息和面积占比
  1425. DataTable dt_ElementalSubstance= ElementalSubstance(AllAnalysisDetails, ClassName, fielddata);
  1426. //统计元素并按照Class Name自定义列表进行排序,大类中的小类元素信息按照面积从大到小排序
  1427. DataTable dt_ElementSorting= ElementSorting( AllAnalysisDetails, ClassName, fielddata);
  1428. //生成最后导出时物质元素成分表
  1429. DataTable dt= MaterialElementComposition(dt_ElementalSubstance,13);//导出14个元素成分信息
  1430. //生成最后导出时物质元素细分表
  1431. SubdivisionOfMaterialElements(dt_ElementSorting, 13, ClassName, dt);
  1432. //夹杂物面积比添加大类
  1433. DataTable RawParticleData = InclusionAreaRatio();
  1434. //夹杂物面积比计算大类占比
  1435. ProportionOfParticleArea(RawParticleData, ClassName);
  1436. return true;
  1437. }
  1438. private bool ProportionOfParticleArea(DataTable dataTable, List<string> ClassName)
  1439. {
  1440. DataTable AllAnalysisDetails = dataTable.Copy();
  1441. AllAnalysisDetails.Clear();
  1442. AllAnalysisDetails.TableName = "InclusionAreaRatio";
  1443. for (int i=0;i< ClassName.Count;i++)
  1444. {
  1445. DataTable dt = dataTable.Copy();
  1446. dt.Clear();
  1447. for (int a=0;a< dataTable.Rows.Count;a++)
  1448. {
  1449. if (dataTable.Rows[a]["e1"].ToString()== ClassName[i].ToString())
  1450. {
  1451. dt.Rows.Add(dataTable.Rows[a].ItemArray);
  1452. }
  1453. }
  1454. if (dt.Rows.Count>0)
  1455. {
  1456. double totalInclusionArea = Convert.ToDouble(decimal.Parse(dataTable.Compute("sum(e3)", "").ToString()));
  1457. double Area= Convert.ToDouble(decimal.Parse(dt.Compute("sum(e3)", "").ToString()));
  1458. DataRow dr = AllAnalysisDetails.NewRow();
  1459. dr["e1"] = ClassName[i].ToString();
  1460. dr["e3"] = Math.Round(Area, 2);
  1461. //Convert.ToDouble(decimal.Parse(dt.Compute("sum(e3)", "").ToString()));
  1462. dr["e4"] = Math.Round((Convert.ToDouble(Area) / totalInclusionArea) * 100, 2);
  1463. dr["e5"] = Math.Round((Convert.ToDouble(Area) / Convert.ToDouble(m_list_dt.Where(aa => aa.TableName.Contains("ResultGrid")).ToList()[0].Rows[0][5])) * 100, 4);
  1464. AllAnalysisDetails.Rows.Add(dr);
  1465. DataView dv = dt.DefaultView;
  1466. dv.Sort = "e3 DESC";
  1467. DataTable dt_Area = dv.ToTable();
  1468. for (int a=0;a< dt_Area.Rows.Count;a++)
  1469. {
  1470. dt_Area.Rows[a]["e1"] = "";
  1471. dt_Area.Rows[a]["e3"] = Math.Round(Convert.ToDouble(dt_Area.Rows[a]["e3"]), 2);
  1472. AllAnalysisDetails.Rows.Add(dt_Area.Rows[a].ItemArray);
  1473. }
  1474. }
  1475. }
  1476. m_list_dt.Add(AllAnalysisDetails);
  1477. return true;
  1478. }
  1479. private DataTable ElementSorting( DataTable AllAnalysisDetails, List<string> ClassName , ParticleData fielddata)
  1480. {
  1481. DataTable dte = fielddata.GetAllElement();
  1482. DataTable ElementSorting_dt = AllAnalysisDetails.Copy();
  1483. ElementSorting_dt.Clear();
  1484. for (int i=0; i< ClassName.Count;i++)
  1485. {
  1486. DataTable dt = AllAnalysisDetails.Copy();
  1487. dt.Clear();
  1488. for (int a=0;a< AllAnalysisDetails.Rows.Count;a++)
  1489. {
  1490. if (AllAnalysisDetails.Rows[a]["Class"].ToString()== ClassName[i].ToString())
  1491. {
  1492. dt.Rows.Add(AllAnalysisDetails.Rows[a].ItemArray);
  1493. }
  1494. }
  1495. //将颗粒大小排序(从大到小)
  1496. DataView dv = dt.DefaultView;
  1497. dv.Sort = "Area DESC";
  1498. DataTable dt_Element = dv.ToTable();
  1499. for (int a=0;a< dt_Element.Rows.Count;a++)
  1500. {
  1501. ElementSorting_dt.Rows.Add(dt_Element.Rows[a].ItemArray);
  1502. }
  1503. }
  1504. //循环创建元素列(类型定义为double,为以后计算做准备)
  1505. for (int a = 0; a < dte.Rows.Count; a++)
  1506. {
  1507. ElementSorting_dt.Columns.Add(dte.Rows[a]["Name"].ToString(), typeof(double));
  1508. }
  1509. for (int a = 0; a < ElementSorting_dt.Rows.Count; a++)
  1510. {
  1511. DataTable ClassificationDetails = fielddata.GetAreaByIncA(ElementSorting_dt.Rows[a]["TypeId"].ToString(), "");//获取单个分类的元素信息
  1512. //DataRow dr2 = ElementSorting_dt.NewRow();
  1513. foreach (DataRow dr in ClassificationDetails.Rows)
  1514. {
  1515. double doe = Convert.ToDouble(dr["pc"]);
  1516. ElementSorting_dt.Rows[a][dr["Name"].ToString()] = Math.Round( doe/Convert.ToDouble(ElementSorting_dt.Rows[a]["Area"]),2);
  1517. }
  1518. }
  1519. return ElementSorting_dt;
  1520. }
  1521. private DataTable ElementalSubstance(DataTable AllAnalysisDetails, List<string> ClassName, ParticleData fielddata)
  1522. {
  1523. //当前元素物质类面积的总和
  1524. double ElementalSubstance = 0;
  1525. DataTable dte = fielddata.GetAllElement();
  1526. DataTable dt_Class = new DataTable();
  1527. dt_Class.Columns.Add("Name");
  1528. dt_Class.Columns.Add("Area");
  1529. //循环创建元素列(类型定义为double,为以后计算做准备)
  1530. for (int a = 0; a < dte.Rows.Count; a++)
  1531. {
  1532. dt_Class.Columns.Add(dte.Rows[a]["Name"].ToString(), typeof(double));
  1533. }
  1534. //循环大类物质列表
  1535. for (int i = 0; i < ClassName.Count; i++)
  1536. {
  1537. //保留当前循环中大类物质,去除其他物质
  1538. DataTable dt = AllAnalysisDetails.Copy();
  1539. dt.Clear();
  1540. for (int a = 0; a < AllAnalysisDetails.Rows.Count; a++)
  1541. {
  1542. if (AllAnalysisDetails.Rows[a]["Class"].ToString() == ClassName[i].ToString())
  1543. {
  1544. dt.Rows.Add(AllAnalysisDetails.Rows[a].ItemArray);
  1545. }
  1546. }
  1547. if (dt.Rows.Count == 0)
  1548. continue;
  1549. //计算出当前循环中大类物质的面积
  1550. ElementalSubstance=Convert.ToDouble(decimal.Parse(dt.Compute("sum(Area)", "").ToString()));
  1551. DataTable ta = new DataTable();
  1552. ta = dt_Class.Copy();
  1553. ta.Clear();
  1554. for (int a = 0; a < dt.Rows.Count; a++)
  1555. {
  1556. DataTable ClassificationDetails = fielddata.GetAreaByIncA(dt.Rows[a]["TypeId"].ToString(), "");//获取单个分类的元素信息
  1557. DataRow dr2 = ta.NewRow();
  1558. foreach (DataRow dr in ClassificationDetails.Rows)
  1559. {
  1560. double doe = Convert.ToDouble(dr["pc"]);
  1561. dr2[dr["Name"].ToString()] = doe;
  1562. }
  1563. ta.Rows.Add(dr2);
  1564. }
  1565. DataTable dataTable = ta.Copy();
  1566. dataTable.Clear();
  1567. DataRow row = dataTable.NewRow();
  1568. dataTable.Rows.Add(row);
  1569. for (int a=0;a< ta.Columns.Count;a++)
  1570. {
  1571. if (ta.Columns[a].ToString()!="Name"&& ta.Columns[a].ToString() !="Class")
  1572. {
  1573. bool bl = false;
  1574. for (int b=0;b<ta.Rows.Count;b++)
  1575. {
  1576. if (!ta.Rows[b].IsNull(ta.Columns[a].ToString()))
  1577. {
  1578. bl = true;
  1579. }
  1580. }
  1581. if (bl)
  1582. //datatSuncolumn(ta, ta.Columns[a].ToString());
  1583. dataTable.Rows[0][ta.Columns[a].ToString()] = Math.Round(datatSuncolumn(ta, ta.Columns[a].ToString()) / ElementalSubstance,2);
  1584. }
  1585. }
  1586. dataTable.Rows[0]["Name"] = ClassName[i].ToString();
  1587. dataTable.Rows[0]["Area"] = ElementalSubstance;
  1588. dt_Class.Rows.Add(dataTable.Rows[0].ItemArray);
  1589. }
  1590. return dt_Class;
  1591. }
  1592. private double datatSuncolumn(DataTable dt ,string str)
  1593. {
  1594. double sum=0;
  1595. for (int i=0;i<dt.Rows.Count;i++)
  1596. {
  1597. if (dt.Rows[i][str].ToString()=="")
  1598. {
  1599. dt.Rows[i][str] = 0;
  1600. }
  1601. sum = sum+Convert.ToDouble(dt.Rows[i][str].ToString());
  1602. }
  1603. return sum;
  1604. }
  1605. private DataTable MaterialElementComposition(DataTable a_ElementalSubstance,int NumberOfColumns)
  1606. {
  1607. DataTable dt_ElementalSubstance = new DataTable();
  1608. dt_ElementalSubstance.TableName = "ElementalSubstance_Value";
  1609. dt_ElementalSubstance.Columns.Add("Name");
  1610. dt_ElementalSubstance.Columns.Add("Area");
  1611. for (int i=0;i< a_ElementalSubstance.Rows.Count;i++)
  1612. {
  1613. dt_ElementalSubstance.Rows.Add(a_ElementalSubstance.Rows[i]["Name"]);
  1614. dt_ElementalSubstance.Rows[i]["Area"]=Math.Round(Convert.ToDouble(a_ElementalSubstance.Rows[i]["Area"]),2) ;
  1615. }
  1616. int cunt = 1;
  1617. for (int i=0;i< NumberOfColumns; i++)
  1618. {
  1619. if (i< m_otsreport_export.m_mbszclass.M_YSFXJG.list_str_tb_ysfx_xsys.Count())
  1620. {
  1621. dt_ElementalSubstance.Columns.Add(m_otsreport_export.m_mbszclass.M_YSFXJG.list_str_tb_ysfx_xsys[i]);
  1622. for (int a=0;a< a_ElementalSubstance.Rows.Count;a++)
  1623. {
  1624. if (a_ElementalSubstance.Columns.Contains(m_otsreport_export.m_mbszclass.M_YSFXJG.list_str_tb_ysfx_xsys[i]))
  1625. {
  1626. if (a_ElementalSubstance.Rows[a][m_otsreport_export.m_mbszclass.M_YSFXJG.list_str_tb_ysfx_xsys[i]].ToString() == "")
  1627. {
  1628. dt_ElementalSubstance.Rows[a][m_otsreport_export.m_mbszclass.M_YSFXJG.list_str_tb_ysfx_xsys[i]] = 0;
  1629. }
  1630. else
  1631. {
  1632. 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]];
  1633. }
  1634. }
  1635. else
  1636. {
  1637. dt_ElementalSubstance.Rows[a][m_otsreport_export.m_mbszclass.M_YSFXJG.list_str_tb_ysfx_xsys[i]] = 0;
  1638. }
  1639. }
  1640. }
  1641. else
  1642. {
  1643. dt_ElementalSubstance.Columns.Add("Null"+ cunt.ToString());
  1644. cunt = cunt + 1;
  1645. for (int a = 0; a < a_ElementalSubstance.Rows.Count; a++)
  1646. {
  1647. dt_ElementalSubstance.Rows[a][i+2] = "-";
  1648. }
  1649. }
  1650. }
  1651. DataTable dataTable = new DataTable();
  1652. dataTable = dt_ElementalSubstance.Copy();
  1653. dataTable.Clear();
  1654. DataRow row = dataTable.NewRow();
  1655. dataTable.Rows.Add(row);
  1656. dataTable.TableName = "ElementalSubstance_Name";
  1657. for (int i=0;i< dataTable.Columns.Count;i++)
  1658. {
  1659. dataTable.Rows[0][dataTable.Columns[i].ToString()] = dataTable.Columns[i].ToString();
  1660. }
  1661. m_list_dt.Add(dataTable);
  1662. m_list_dt.Add(dt_ElementalSubstance);
  1663. return dt_ElementalSubstance;
  1664. }
  1665. private bool SubdivisionOfMaterialElements(DataTable a_ElementalSubstance, int NumberOfColumns, List<string> ClassName,DataTable data)
  1666. {
  1667. DataTable dt_ElementalSubstance = new DataTable();
  1668. dt_ElementalSubstance= data.Copy();
  1669. dt_ElementalSubstance.Clear();
  1670. dt_ElementalSubstance.TableName = "ElementSubdivision_Value";
  1671. dt_ElementalSubstance.Columns["Name"].ColumnName = "Class";
  1672. dt_ElementalSubstance.Columns.Add("Name");
  1673. //处理元素面积保留小数点后两位
  1674. for (int i=0;i< a_ElementalSubstance.Rows.Count;i++)
  1675. {
  1676. a_ElementalSubstance.Rows[i]["Area"] = Math.Round(Convert.ToDouble(a_ElementalSubstance.Rows[i]["Area"].ToString()), 2);
  1677. }
  1678. //循环元素物质大类
  1679. for (int i = 0; i < ClassName.Count; i++)
  1680. {
  1681. DataTable dt_1 = new DataTable();
  1682. dt_1 = data.Copy();
  1683. dt_1.Clear();
  1684. for (int a = 0; a < data.Rows.Count; a++)
  1685. {
  1686. if (data.Rows[a]["Name"].ToString() == ClassName[i].ToString())
  1687. {
  1688. dt_1.Rows.Add(data.Rows[a].ItemArray);
  1689. }
  1690. }
  1691. dt_1.Columns["Name"].ColumnName = "Class";
  1692. dt_1.Columns.Add("Name");
  1693. DataTable dt_2 = new DataTable();
  1694. dt_2 = dt_1.Copy();
  1695. dt_2.Clear();
  1696. dt_2.Rows.Add();
  1697. //循环整个表筛选出当前的物质
  1698. for (int a = 0; a < a_ElementalSubstance.Rows.Count; a++)
  1699. {
  1700. if (ClassName[i].ToString() == a_ElementalSubstance.Rows[a]["Class"].ToString())
  1701. {
  1702. for (int b=0;b< dt_1.Columns.Count;b++)
  1703. {
  1704. if (dt_2.Columns[b].ToString()!="Class")
  1705. {
  1706. if (a_ElementalSubstance.Columns.Contains(dt_2.Columns[b].ToString()))
  1707. {
  1708. if (a_ElementalSubstance.Rows[a][dt_2.Columns[b].ToString()].ToString() == "")
  1709. {
  1710. dt_2.Rows[0][dt_2.Columns[b].ToString()] = 0;
  1711. }
  1712. else
  1713. {
  1714. dt_2.Rows[0][dt_2.Columns[b].ToString()] = a_ElementalSubstance.Rows[a][dt_2.Columns[b].ToString()];
  1715. }
  1716. }
  1717. else
  1718. {
  1719. dt_2.Rows[0][dt_2.Columns[b].ToString()] = 0;
  1720. }
  1721. }
  1722. }
  1723. dt_1.Rows.Add(dt_2.Rows[0].ItemArray);
  1724. }
  1725. }
  1726. for (int a=0;a< dt_1.Rows.Count;a++)
  1727. {
  1728. dt_ElementalSubstance.Rows.Add(dt_1.Rows[a].ItemArray);
  1729. }
  1730. }
  1731. DataTable dataTable = new DataTable();
  1732. dataTable = dt_ElementalSubstance.Copy();
  1733. dataTable.Clear();
  1734. DataRow row = dataTable.NewRow();
  1735. dataTable.Rows.Add(row);
  1736. dataTable.TableName = "ElementSubdivision_Name";
  1737. for (int i = 0; i < dataTable.Columns.Count; i++)
  1738. {
  1739. dataTable.Rows[0][dataTable.Columns[i].ToString()] = dataTable.Columns[i].ToString();
  1740. }
  1741. m_list_dt.Add(dataTable);
  1742. m_list_dt.Add(dt_ElementalSubstance);
  1743. return true;
  1744. }
  1745. #endregion
  1746. private DataTable InclusionAreaRatio()
  1747. {
  1748. //根据sql条件,查询获取颗粒信息数据
  1749. ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.getSelectedIndex()].FilePath);
  1750. //DataTable AreaInformationOfAllElements = fielddata.GetAreaByAllIncA("");//获取所有分类面积和数量信息
  1751. DataTable AreaInformationOfAllElements = InvalidRemoval(InvalidRemoval(fielddata.GetAreaByAllIncA(""), "GroupName"),"TypeName") ;
  1752. DataTable AllAnalysisDetails = new DataTable();
  1753. //AllAnalysisDetails.TableName = "ElementValue";
  1754. AllAnalysisDetails.Columns.Add("Name");
  1755. AllAnalysisDetails.Columns.Add("TypeId");
  1756. AllAnalysisDetails.Columns.Add("Area", typeof(double));
  1757. AllAnalysisDetails.Columns.Add("Class");
  1758. AllAnalysisDetails.Columns.Add("Cunt",typeof(double));
  1759. for (int i = 0; i < AreaInformationOfAllElements.Rows.Count; i++)
  1760. {
  1761. //if (Convert.ToInt32(AreaInformationOfAllElements.Rows[i]["TypeId"]) < 100)
  1762. // continue;
  1763. DataRow dr2 = AllAnalysisDetails.NewRow();
  1764. dr2["Name"] = AreaInformationOfAllElements.Rows[i]["TypeName"].ToString();
  1765. dr2["Area"] = Convert.ToDouble(AreaInformationOfAllElements.Rows[i]["ar"]);
  1766. dr2["TypeId"] = AreaInformationOfAllElements.Rows[i]["TypeId"].ToString();
  1767. dr2["Cunt"] = Convert.ToDouble(AreaInformationOfAllElements.Rows[i]["con"]);
  1768. dr2["Class"] = AreaInformationOfAllElements.Rows[i]["GroupName"].ToString();
  1769. AllAnalysisDetails.Rows.Add(dr2);
  1770. }
  1771. List<string> ClassName = new List<string>();
  1772. DataTable getClass_dt = fielddata.GetAllClass();
  1773. for (int i = 0; i < getClass_dt.Rows.Count; i++)
  1774. {
  1775. if (getClass_dt.Rows[i]["GroupName"].ToString() != "NOT_INCLUTION" && getClass_dt.Rows[i]["GroupName"].ToString() != "Invalid")
  1776. ClassName.Add(getClass_dt.Rows[i]["GroupName"].ToString());
  1777. }
  1778. DataTable AreaRatio = new DataTable();
  1779. AreaRatio.TableName = "InclusionAreaRatio";
  1780. AreaRatio.Columns.Add("e1");
  1781. AreaRatio.Columns.Add("e2");
  1782. AreaRatio.Columns.Add("e3", typeof(double));
  1783. AreaRatio.Columns.Add("e4");
  1784. AreaRatio.Columns.Add("e5");
  1785. //获取夹杂物的总面积用于计算夹杂物类别的占比(gridview最后一个固定是未识别颗粒,要排除未识别颗粒所以for循环至grid view长度减一)
  1786. double totalInclusionArea = 0;
  1787. //for (int i = 0; i < ls_gv.Rows.Count - 1; i++)
  1788. //{
  1789. // totalInclusionArea = totalInclusionArea + Convert.ToDouble(ls_gv.Rows[i].Cells[2].Value.ToString());
  1790. //}
  1791. totalInclusionArea= Convert.ToDouble(decimal.Parse(AllAnalysisDetails.Compute("sum(Area)", "").ToString()));
  1792. for (int i=0;i< AllAnalysisDetails.Rows.Count;i++)
  1793. {
  1794. DataRow dr = AreaRatio.NewRow();
  1795. dr["e1"] = AllAnalysisDetails.Rows[i]["Class"].ToString();
  1796. dr["e2"] = AllAnalysisDetails.Rows[i]["Name"].ToString();
  1797. dr["e3"] = Convert.ToDouble(AllAnalysisDetails.Rows[i]["Area"]);
  1798. dr["e4"]= Math.Round((Convert.ToDouble(AllAnalysisDetails.Rows[i]["Area"]) / totalInclusionArea) * 100, 2);
  1799. 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);
  1800. AreaRatio.Rows.Add(dr);
  1801. }
  1802. DataTable AreaRatio_dt = AreaRatio.Copy();
  1803. AreaRatio_dt.Clear();
  1804. for (int i=0;i< ClassName.Count();i++)
  1805. {
  1806. DataTable dt = AreaRatio.Copy();
  1807. dt.Clear();
  1808. for (int a=0; a< AreaRatio.Rows.Count;a++)
  1809. {
  1810. if (AreaRatio.Rows[a]["e1"].ToString()== ClassName[i].ToString())
  1811. {
  1812. dt.Rows.Add(AreaRatio.Rows[a].ItemArray);
  1813. }
  1814. }
  1815. DataView dv = dt.DefaultView;
  1816. dv.Sort = "e3 DESC";
  1817. DataTable dt_Element = dv.ToTable();
  1818. for (int a = 0; a < dt_Element.Rows.Count;a++)
  1819. {
  1820. AreaRatio_dt.Rows.Add(dt_Element.Rows[a].ItemArray);
  1821. }
  1822. }
  1823. return AreaRatio_dt;
  1824. //m_list_dt.Add(AreaRatio_dt);
  1825. }
  1826. #region 插入颗粒图chart
  1827. /// <summary>
  1828. /// 用于颗粒图chart
  1829. /// </summary>
  1830. /// <returns></returns>
  1831. private DataTable GetPicDataTable_PicKL()
  1832. {
  1833. if (m_list_dt.Where(aa => aa.TableName.Contains("PicKL")).ToList().Count == 0)
  1834. {
  1835. //创建二进制列的数据表
  1836. DataTable ls_dt = new DataTable();
  1837. ls_dt.TableName = "PicKL";
  1838. DataColumn colpict = new DataColumn("pict");
  1839. colpict.DataType = System.Type.GetType("System.Byte[]");
  1840. ls_dt.Columns.Add(colpict);
  1841. m_list_dt.Add(ls_dt);
  1842. return ls_dt;
  1843. }
  1844. else
  1845. {
  1846. return m_list_dt.Where(aa => aa.TableName.Contains("PicKL")).ToList()[0];
  1847. }
  1848. }
  1849. #endregion
  1850. private DataTable GetPicDataTable_InclusionAreaRatio(string str)
  1851. {
  1852. if (m_list_dt.Where(aa => aa.TableName.Contains(str)).ToList().Count == 0)
  1853. {
  1854. //创建二进制列的数据表
  1855. DataTable ls_dt = new DataTable();
  1856. ls_dt.TableName = str;
  1857. DataColumn colpict = new DataColumn("pict");
  1858. colpict.DataType = System.Type.GetType("System.Byte[]");
  1859. ls_dt.Columns.Add(colpict);
  1860. m_list_dt.Add(ls_dt);
  1861. return ls_dt;
  1862. }
  1863. else
  1864. {
  1865. return m_list_dt.Where(aa => aa.TableName.Contains(str)).ToList()[0];
  1866. }
  1867. }
  1868. #region 插入元素图chart
  1869. /// <summary>
  1870. /// 用于元素图chart
  1871. /// </summary>
  1872. /// <returns></returns>
  1873. private DataTable GetPicDataTable_PicYS()
  1874. {
  1875. if (m_list_dt.Where(aa => aa.TableName.Contains("PicYS")).ToList().Count == 0)
  1876. {
  1877. //创建二进制列的数据表
  1878. DataTable ls_dt = new DataTable();
  1879. ls_dt.TableName = "PicYS";
  1880. DataColumn colpict = new DataColumn("pict");
  1881. colpict.DataType = System.Type.GetType("System.Byte[]");
  1882. ls_dt.Columns.Add(colpict);
  1883. m_list_dt.Add(ls_dt);
  1884. return ls_dt;
  1885. }
  1886. else
  1887. {
  1888. return m_list_dt.Where(aa => aa.TableName.Contains("PicYS")).ToList()[0];
  1889. }
  1890. }
  1891. #endregion
  1892. #region 插入大分类夹杂物面积比图
  1893. public bool InsertReportTemplateChart_InclusionAreaClassRatio(string a_GraphicStyle)
  1894. {
  1895. //加载模块
  1896. m_otsreport_export.m_ReportApp.im_EChart_ParticlesComposition = new EChart_ParticlesComposition(m_otsreport_export.m_ReportApp, "InclusionareaClassRatio");
  1897. m_otsreport_export.m_ReportApp.m_reportname = "";
  1898. m_otsreport_export.m_ReportApp.type = a_GraphicStyle;
  1899. m_otsreport_export.m_ReportApp.timerKG = true;
  1900. m_otsreport_export.m_ReportApp.m_ChartsWindow.Controls.Add(m_otsreport_export.m_ReportApp.im_EChart_ParticlesComposition);
  1901. //弹出加载图片窗体
  1902. OTSReport_GetEChartImage og = new OTSReport_GetEChartImage();
  1903. //将EChart委托事件注册给加载图片窗体的方法
  1904. m_otsreport_export.m_ReportApp.im_EChart_ParticlesComposition.butclic += og.get_ParticalesCompositionChart;
  1905. og.ShowDialog();
  1906. //获取图片数据
  1907. string str = og.PicStr;
  1908. //将Base64String转为图片并保存
  1909. byte[] arr = Convert.FromBase64String(str.Substring(str.IndexOf(',') + 1));
  1910. MemoryStream ms = new MemoryStream(arr);
  1911. System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(ms);
  1912. //再将图转成流,流再转二进制-------------------------------------------
  1913. MemoryStream newms = new MemoryStream();
  1914. bmp.Save(newms, System.Drawing.Imaging.ImageFormat.Bmp);
  1915. newms.Seek(0, SeekOrigin.Begin);
  1916. byte[] newarr = new byte[newms.Length];
  1917. newms.Read(newarr, 0, newarr.Length);
  1918. newms.Dispose();
  1919. DataTable ls_dt = GetPicDataTable_InclusionAreaRatio("Pic_InclusionareaClassRatio");
  1920. DataRow dr = ls_dt.NewRow();
  1921. dr["pict"] = newarr;//图像二进制
  1922. ls_dt.Rows.Add(dr);
  1923. return true;
  1924. }
  1925. #endregion
  1926. #region 插入夹杂物面积比图
  1927. public bool InsertReportTemplateChart_InclusionAreaRatio(string a_GraphicStyle)
  1928. {
  1929. //加载模块
  1930. m_otsreport_export.m_ReportApp.im_EChart_ParticlesComposition = new EChart_ParticlesComposition(m_otsreport_export.m_ReportApp, "InclusionareaRatio");
  1931. m_otsreport_export.m_ReportApp.m_reportname = "";
  1932. m_otsreport_export.m_ReportApp.type = a_GraphicStyle;
  1933. m_otsreport_export.m_ReportApp.timerKG = true;
  1934. m_otsreport_export.m_ReportApp.m_ChartsWindow.Controls.Add(m_otsreport_export.m_ReportApp.im_EChart_ParticlesComposition);
  1935. //弹出加载图片窗体
  1936. OTSReport_GetEChartImage og = new OTSReport_GetEChartImage();
  1937. //将EChart委托事件注册给加载图片窗体的方法
  1938. m_otsreport_export.m_ReportApp.im_EChart_ParticlesComposition.butclic += og.get_ParticalesCompositionChart;
  1939. og.ShowDialog();
  1940. //获取图片数据
  1941. string str = og.PicStr;
  1942. //将Base64String转为图片并保存
  1943. byte[] arr = Convert.FromBase64String(str.Substring(str.IndexOf(',') + 1));
  1944. MemoryStream ms = new MemoryStream(arr);
  1945. System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(ms);
  1946. //再将图转成流,流再转二进制-------------------------------------------
  1947. MemoryStream newms = new MemoryStream();
  1948. bmp.Save(newms, System.Drawing.Imaging.ImageFormat.Bmp);
  1949. newms.Seek(0, SeekOrigin.Begin);
  1950. byte[] newarr = new byte[newms.Length];
  1951. newms.Read(newarr, 0, newarr.Length);
  1952. newms.Dispose();
  1953. DataTable ls_dt = GetPicDataTable_InclusionAreaRatio("Pic_InclusionAreaRatio");
  1954. DataRow dr = ls_dt.NewRow();
  1955. dr["pict"] = newarr;//图像二进制
  1956. ls_dt.Rows.Add(dr);
  1957. return true;
  1958. }
  1959. #endregion
  1960. #region 插入颗粒成份图
  1961. /// <summary>
  1962. /// 向 模板设计器 中插入 颗粒成份图
  1963. /// </summary>
  1964. /// <returns></returns>
  1965. public bool InsertReportTemplateChart_ParticlesCompositionChart(string a_GraphicStyle)
  1966. {
  1967. try
  1968. {
  1969. //-----------------------------------颗粒成份图-----------------------------------------------------------------------------------------------
  1970. //加载模块
  1971. m_otsreport_export.m_ReportApp.im_EChart_ParticlesComposition = new EChart_ParticlesComposition(m_otsreport_export.m_ReportApp, "PComponent");
  1972. m_otsreport_export.m_ReportApp.m_reportname = "InclusionClassification";
  1973. m_otsreport_export.m_ReportApp.type = a_GraphicStyle;
  1974. m_otsreport_export.m_ReportApp.timerKG = true;
  1975. m_otsreport_export.m_ReportApp.m_ChartsWindow.Controls.Add(m_otsreport_export.m_ReportApp.im_EChart_ParticlesComposition);
  1976. //弹出加载图片窗体
  1977. OTSReport_GetEChartImage og = new OTSReport_GetEChartImage();
  1978. //将EChart委托事件注册给加载图片窗体的方法
  1979. m_otsreport_export.m_ReportApp.im_EChart_ParticlesComposition.butclic += og.get_ParticalesCompositionChart;
  1980. og.ShowDialog();
  1981. //获取图片数据
  1982. string str = og.PicStr;
  1983. //将Base64String转为图片并保存
  1984. byte[] arr = Convert.FromBase64String(str.Substring(str.IndexOf(',') + 1));
  1985. MemoryStream ms = new MemoryStream(arr);
  1986. System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(ms);
  1987. //再将图转成流,流再转二进制-------------------------------------------
  1988. MemoryStream newms = new MemoryStream();
  1989. bmp.Save(newms, System.Drawing.Imaging.ImageFormat.Bmp);
  1990. newms.Seek(0, SeekOrigin.Begin);
  1991. byte[] newarr = new byte[newms.Length];
  1992. newms.Read(newarr, 0, newarr.Length);
  1993. newms.Dispose();
  1994. //创建二进制列的数据表
  1995. DataTable ls_dt = GetPicDataTable_PicKL();
  1996. DataRow dr = ls_dt.NewRow();
  1997. dr["pict"] = newarr;//图像二进制
  1998. ls_dt.Rows.Add(dr);
  1999. return true;
  2000. }
  2001. catch (Exception ee)
  2002. {
  2003. m_otsreport_export.WriteRictBox(ee.ToString());
  2004. return false;
  2005. }
  2006. }
  2007. #endregion
  2008. #region 插入元素成份图
  2009. /// <summary>
  2010. /// 向 模板设计器 中插入 元素成份图
  2011. /// </summary>
  2012. /// <returns></returns>
  2013. public bool InsertReportTemplateChart_ElementCompositionChart(string a_GraphicStyle)
  2014. {
  2015. try
  2016. {
  2017. //-----------------------------------元素成份图-----------------------------------------------------------------------------------------------
  2018. //加载模块
  2019. m_otsreport_export.m_ReportApp.im_EChart_ParticlesComposition = new EChart_ParticlesComposition(m_otsreport_export.m_ReportApp, "EComponent");
  2020. m_otsreport_export.m_ReportApp.m_reportname = "ElementComposition";
  2021. m_otsreport_export.m_ReportApp.type = a_GraphicStyle;
  2022. m_otsreport_export.m_ReportApp.timerKG = true;
  2023. m_otsreport_export.m_ReportApp.m_ChartsWindow.Controls.Add(m_otsreport_export.m_ReportApp.im_EChart_ParticlesComposition);
  2024. //弹出加载图片窗体
  2025. OTSReport_GetEChartImage og = new OTSReport_GetEChartImage();
  2026. //将EChart委托事件注册给加载图片窗体的方法
  2027. m_otsreport_export.m_ReportApp.im_EChart_ParticlesComposition.butclic += og.get_ParticalesCompositionChart;
  2028. og.ShowDialog();
  2029. //获取图片数据
  2030. string str = og.PicStr;
  2031. //将Base64String转为图片并保存
  2032. byte[] arr = Convert.FromBase64String(str.Substring(str.IndexOf(',') + 1));
  2033. MemoryStream ms = new MemoryStream(arr);
  2034. System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(ms);
  2035. //再将图转成流,流再转二进制-------------------------------------------
  2036. MemoryStream newms = new MemoryStream();
  2037. bmp.Save(newms, System.Drawing.Imaging.ImageFormat.Bmp);
  2038. newms.Seek(0, SeekOrigin.Begin);
  2039. byte[] newarr = new byte[newms.Length];
  2040. newms.Read(newarr, 0, newarr.Length);
  2041. newms.Dispose();
  2042. //创建二进制列的数据表
  2043. DataTable ls_dt = GetPicDataTable_PicYS();
  2044. DataRow dr = ls_dt.NewRow();
  2045. dr["pict"] = newarr;//图像二进制
  2046. ls_dt.Rows.Add(dr);
  2047. return true;
  2048. }
  2049. catch (Exception ee)
  2050. {
  2051. m_otsreport_export.WriteRictBox(ee.ToString());
  2052. return false;
  2053. }
  2054. }
  2055. #endregion
  2056. #region 插入三元相图
  2057. /// <summary>
  2058. /// 获取或创建pic表格,用于三元相图
  2059. /// </summary>
  2060. /// <returns></returns>
  2061. private DataTable GetPicDataTable_PicSYXT2T()
  2062. {
  2063. if (m_list_dt.Where(aa => aa.TableName.Contains("PicSYXT2T")).ToList().Count == 0)
  2064. {
  2065. //创建二进制列的数据表
  2066. DataTable ls_dt = new DataTable();
  2067. ls_dt.TableName = "PicSYXT2T";
  2068. DataColumn colpict = new DataColumn("pict");
  2069. colpict.DataType = System.Type.GetType("System.Byte[]");
  2070. ls_dt.Columns.Add(colpict);
  2071. DataColumn colpict2 = new DataColumn("pict2");
  2072. colpict2.DataType = System.Type.GetType("System.Byte[]");
  2073. ls_dt.Columns.Add(colpict2);
  2074. m_list_dt.Add(ls_dt);
  2075. return ls_dt;
  2076. }
  2077. else
  2078. {
  2079. return m_list_dt.Where(aa => aa.TableName.Contains("PicSYXT2T")).ToList()[0];
  2080. }
  2081. }
  2082. /// <summary>
  2083. /// 获取或创建pic表格,用于三元相图,3个列的
  2084. /// </summary>
  2085. /// <returns></returns>
  2086. private DataTable GetPicDataTable_PicSYXT3T()
  2087. {
  2088. if (m_list_dt.Where(aa => aa.TableName.Contains("PicSYXT3T")).ToList().Count == 0)
  2089. {
  2090. //创建二进制列的数据表
  2091. DataTable ls_dt = new DataTable();
  2092. ls_dt.TableName = "PicSYXT3T";
  2093. DataColumn colpict = new DataColumn("pict");
  2094. colpict.DataType = System.Type.GetType("System.Byte[]");
  2095. ls_dt.Columns.Add(colpict);
  2096. DataColumn colpict2 = new DataColumn("pict2");
  2097. colpict2.DataType = System.Type.GetType("System.Byte[]");
  2098. ls_dt.Columns.Add(colpict2);
  2099. DataColumn colpict3 = new DataColumn("pict3");
  2100. colpict3.DataType = System.Type.GetType("System.Byte[]");
  2101. ls_dt.Columns.Add(colpict3);
  2102. m_list_dt.Add(ls_dt);
  2103. return ls_dt;
  2104. }
  2105. else
  2106. {
  2107. return m_list_dt.Where(aa => aa.TableName.Contains("PicSYXT")).ToList()[0];
  2108. }
  2109. }
  2110. /// <summary>
  2111. /// 获取三元相图二进制数据
  2112. /// </summary>
  2113. /// <param name="selectindex"></param>
  2114. /// <returns></returns>
  2115. private byte[] GetByte_InsertReportTemplateChart_Trianglediagram(int selectindex)
  2116. {
  2117. byte[] newarr = new byte[0];
  2118. //加载模块
  2119. m_otsreport_export.m_ReportApp.im_EChart_Trianglediagram = new EChart_Trianglediagram(m_otsreport_export.m_ReportApp, TemplateList[selectindex]);
  2120. m_otsreport_export.m_ReportApp.timerKG = true;
  2121. m_otsreport_export.m_ReportApp.im_EChart_Trianglediagram.condition = m_otsreport_export.m_mbszclass.M_SYXT.index_cb_syxt_jsfs;
  2122. m_otsreport_export.m_ReportApp.m_ChartsWindow.Controls.Add(m_otsreport_export.m_ReportApp.im_EChart_Trianglediagram);
  2123. //ls_echart_trianglediagram.
  2124. //弹出加载图片窗体
  2125. OTSReport_GetEChartImage og = new OTSReport_GetEChartImage();
  2126. //将EChart委托事件注册给加载图片窗体的方法
  2127. m_otsreport_export.m_ReportApp.im_EChart_Trianglediagram.butclic += og.get_ParticalesCompositionChart;
  2128. og.ShowDialog();
  2129. //获取图片数据
  2130. string str = og.PicStr;
  2131. //将Base64String转为图片并保存
  2132. byte[] arr = Convert.FromBase64String(str.Substring(str.IndexOf(',') + 1));
  2133. MemoryStream ms = new MemoryStream(arr);
  2134. System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(ms);
  2135. //再将图转成流,流再转二进制-------------------------------------------
  2136. MemoryStream newms = new MemoryStream();
  2137. bmp.Save(newms, System.Drawing.Imaging.ImageFormat.Bmp);
  2138. newms.Seek(0, SeekOrigin.Begin);
  2139. newarr = new byte[newms.Length];
  2140. newms.Read(newarr, 0, newarr.Length);
  2141. newms.Dispose();
  2142. return newarr;
  2143. }
  2144. /// <summary>
  2145. /// 向 模板设计器 中插入 三元相图
  2146. /// </summary>
  2147. /// <returns></returns>
  2148. public bool InsertReportTemplateChart_Trianglediagram()
  2149. {
  2150. try
  2151. {
  2152. //创建二进制列的数据表,循环插入三元选择的模板
  2153. DataTable ls_dt = GetPicDataTable_PicSYXT2T();
  2154. DataTable ls_dt3t = GetPicDataTable_PicSYXT3T();
  2155. //这里要校验一下,总数必须要是2的整倍数,不可有余数
  2156. if (m_otsreport_export.m_mbszclass.M_SYXT.str_cb_syxt_mhxssl == "2" && m_otsreport_export.m_mbszclass.M_SYXT.list_lbv_syxt_mblb_index.Count % 2 == 0)
  2157. {
  2158. for (int i = 0; i < m_otsreport_export.m_mbszclass.M_SYXT.list_lbv_syxt_mblb_index.Count; i = i + 2)
  2159. {
  2160. byte[] newarr, newarr2;
  2161. newarr = GetByte_InsertReportTemplateChart_Trianglediagram(m_otsreport_export.m_mbszclass.M_SYXT.list_lbv_syxt_mblb_index[i]);
  2162. newarr2 = GetByte_InsertReportTemplateChart_Trianglediagram(m_otsreport_export.m_mbszclass.M_SYXT.list_lbv_syxt_mblb_index[i + 1]);
  2163. DataRow dr = ls_dt.NewRow();
  2164. dr["pict"] = newarr;//图像二进制
  2165. dr["pict2"] = newarr2;//图像二进制
  2166. ls_dt.Rows.Add(dr);
  2167. }
  2168. }
  2169. else
  2170. {
  2171. DataRow dr = ls_dt.NewRow();
  2172. dr["pict"] = null;//图像二进制
  2173. dr["pict2"] = null;//图像二进制
  2174. ls_dt.Rows.Add(dr);
  2175. }
  2176. if (m_otsreport_export.m_mbszclass.M_SYXT.str_cb_syxt_mhxssl == "3" && m_otsreport_export.m_mbszclass.M_SYXT.list_lbv_syxt_mblb_index.Count % 3 == 0)
  2177. {
  2178. for (int i = 0; i < m_otsreport_export.m_mbszclass.M_SYXT.list_lbv_syxt_mblb_index.Count; i = i + 3)
  2179. {
  2180. byte[] newarr, newarr2, newarr3;
  2181. newarr = GetByte_InsertReportTemplateChart_Trianglediagram(m_otsreport_export.m_mbszclass.M_SYXT.list_lbv_syxt_mblb_index[i]);
  2182. newarr2 = GetByte_InsertReportTemplateChart_Trianglediagram(m_otsreport_export.m_mbszclass.M_SYXT.list_lbv_syxt_mblb_index[i + 1]);
  2183. newarr3 = GetByte_InsertReportTemplateChart_Trianglediagram(m_otsreport_export.m_mbszclass.M_SYXT.list_lbv_syxt_mblb_index[i + 2]);
  2184. DataRow dr = ls_dt3t.NewRow();
  2185. dr["pict"] = newarr;//图像二进制
  2186. dr["pict2"] = newarr2;//图像二进制
  2187. dr["pict3"] = newarr3;//图像二进制
  2188. ls_dt3t.Rows.Add(dr);
  2189. }
  2190. }
  2191. else
  2192. {
  2193. DataRow dr = ls_dt3t.NewRow();
  2194. dr["pict"] = null;//图像二进制
  2195. dr["pict2"] = null;//图像二进制
  2196. dr["pict3"] = null;//图像二进制
  2197. ls_dt3t.Rows.Add(dr);
  2198. }
  2199. return true;
  2200. }
  2201. catch (Exception ee)
  2202. {
  2203. m_otsreport_export.WriteRictBox(ee.ToString());
  2204. return false;
  2205. }
  2206. }
  2207. #endregion
  2208. #region 其它部份
  2209. /// <summary>
  2210. /// 输入颗粒的所在帧图id,颗粒id,颗粒类型id,获取对应的XRay能谱数据图
  2211. /// </summary>
  2212. /// <returns></returns>
  2213. public Bitmap ExportXRayBitmap(string in_fieldid, string in_particleid, int in_stdtypeid, string TypeName, ParticleData particleData)
  2214. {
  2215. Bitmap ret_bp;
  2216. //显示xray相关信息
  2217. uint[] Search_xray = new uint[2000];
  2218. uint[] Analysis_xray = new uint[2000];
  2219. //
  2220. int i_xray_id = 0;
  2221. List<Element> list_celementchemistryclr = new List<Element>();
  2222. //获取Xray数据
  2223. list_celementchemistryclr = new List<Element>();
  2224. Particle list = particleData.GetParticleByFidAndPid(in_fieldid, in_particleid);
  2225. if (list == null)
  2226. {
  2227. return null;
  2228. }
  2229. Particle particle = list;
  2230. if (particle.XrayId > -1)
  2231. {
  2232. for (int i = 0; i < 2000; i++)
  2233. {
  2234. if (particle.XRayData!=null)
  2235. {
  2236. Analysis_xray[i] = BitConverter.ToUInt32(particle.XRayData, i * 4);
  2237. }
  2238. }
  2239. Search_xray = Analysis_xray;
  2240. i_xray_id = particle.XrayId;
  2241. list_celementchemistryclr = particle.ElementList;
  2242. }
  2243. //get CElementChemistryClr list
  2244. List<ShowElementInfo> list_showelementinfo = new List<ShowElementInfo>();
  2245. for (int i = 0; i < list_celementchemistryclr.Count; i++)
  2246. {
  2247. ShowElementInfo ls_sei = new ShowElementInfo();
  2248. ls_sei.ElementName = list_celementchemistryclr[i].Name;
  2249. ls_sei.Percentage = list_celementchemistryclr[i].Percentage;
  2250. ls_sei.dKF = Convert.ToDouble(CListPeriodic.GetPeriodicByYsm(CListPeriodic.GetListPeriodic(), ls_sei.ElementName).SX1);
  2251. list_showelementinfo.Add(ls_sei);
  2252. }
  2253. //获取使用标准库的名称
  2254. string str_stdname = "";
  2255. string str_IncALibName = "";
  2256. if (in_stdtypeid < 1000)
  2257. {
  2258. //小于1000,使用系统默认分类
  2259. str_IncALibName = TypeName;
  2260. str_stdname = "Default standard library";
  2261. }
  2262. else if (in_stdtypeid >= 1000 && in_stdtypeid < 10000)
  2263. {
  2264. //大于等于1000,并且小于10000时,使用系统数据库中夹杂物来分析
  2265. str_IncALibName = TypeName;
  2266. str_stdname = "User defined standard library";
  2267. }
  2268. else if (in_stdtypeid > 10000)
  2269. {
  2270. //大于10000时,使用用户标准库来分析夹杂物名称
  2271. str_IncALibName = TypeName;
  2272. str_stdname = "System standard library";
  2273. }
  2274. //获取数据后,需要对xraytable设置
  2275. OTSIncAReportGraph.Controls.Control_XRayTable control_XRayTable1 = new Control_XRayTable();
  2276. control_XRayTable1.SetXRayShowLineValue(Search_xray, Analysis_xray, list_showelementinfo);
  2277. //颗粒国标信息
  2278. //control_XRayTable1.GBInfoStr = in_dparticle.GBContent;
  2279. control_XRayTable1.MaterialName = str_IncALibName;//杂夹物
  2280. control_XRayTable1.STDName = str_stdname;//标准库
  2281. control_XRayTable1.List_ShowElementInfo = list_showelementinfo;
  2282. control_XRayTable1.Visible = true;
  2283. control_XRayTable1.Invalidate();
  2284. control_XRayTable1.Refresh();
  2285. ret_bp = control_XRayTable1.ExportXRayImage();
  2286. return ret_bp;
  2287. }
  2288. /// <summary>
  2289. /// 传入DataTable,和行号,返回该Row行中,返回6个靠前的元素,不足6个返回空
  2290. /// </summary>
  2291. /// <param name="in_dt"></param>
  2292. /// <param name="row_index"></param>
  2293. /// <returns></returns>
  2294. private void GetMaxElementFromDataTable(DataTable in_dt, int row_index, out List<string> out_list_elementname, out List<double> out_list_elementvalue)
  2295. {
  2296. out_list_elementname = new List<string>();
  2297. out_list_elementvalue = new List<double>();
  2298. //分别排出元素名,元素值列表
  2299. List<string> list_elementname = new List<string>();
  2300. List<double> list_elementvalue = new List<double>();
  2301. string str_element = in_dt.Rows[row_index]["Element"].ToString();
  2302. //防止取出的元素信息为空
  2303. if (str_element != "")
  2304. {
  2305. string[] strcbo = str_element.Split(';');
  2306. for (int i = 0; i < strcbo.Length-1; i++)
  2307. {
  2308. string[] str = strcbo[i].Split('-');
  2309. list_elementname.Add(str[0]);
  2310. list_elementvalue.Add(Math.Round(Convert.ToDouble(str[1]), 2));
  2311. }
  2312. }
  2313. //循环6次,得到最大的6个元素信息
  2314. for (int geti = 0; geti < 6; geti++)
  2315. {
  2316. double max_elementvalue = -1;
  2317. string max_elementname = "";
  2318. int max_index = -1;
  2319. if (list_elementvalue.Count > 0)
  2320. {
  2321. for (int i = 0; i < list_elementvalue.Count; i++)
  2322. {
  2323. if (list_elementvalue[i] > max_elementvalue)
  2324. {
  2325. max_elementvalue = list_elementvalue[i];
  2326. max_elementname = list_elementname[i];
  2327. max_index = i;
  2328. }
  2329. }
  2330. //移除掉最大的元素
  2331. list_elementname.RemoveAt(max_index);
  2332. list_elementvalue.RemoveAt(max_index);
  2333. //将最大的元素添加到list中
  2334. if (max_elementvalue > 0)
  2335. {
  2336. out_list_elementname.Add(max_elementname);
  2337. out_list_elementvalue.Add(max_elementvalue);
  2338. }
  2339. else
  2340. {
  2341. out_list_elementname.Add(" ");
  2342. out_list_elementvalue.Add(0);
  2343. }
  2344. }
  2345. else
  2346. {
  2347. //如果元素数量已经不够,则添加空
  2348. out_list_elementname.Add(" ");
  2349. out_list_elementvalue.Add(0);
  2350. }
  2351. }
  2352. }
  2353. #endregion
  2354. /// <summary>
  2355. /// 国标一
  2356. /// </summary>
  2357. /// <returns></returns>
  2358. public List<DataTable> InsertReportTemplateTable_ChineseStandardABCDDS(OTSCLRINTERFACE.CPropParamClr cPropParamClr)
  2359. {
  2360. //得到国标一的DataTable表格
  2361. cPropParamClr.SetDataSourceId(0);//
  2362. cPropParamClr.SetType(1);//table
  2363. cPropParamClr.SetCalTableType(6);//国标1
  2364. List<OTSCLRINTERFACE.CGridDataClr> listGriddataclr = m_otsreport_export.m_ReportApp.m_rstDataMgr.m_ReportMgr.GridDataTransfer(cPropParamClr);
  2365. m_otsreport_export.m_ReportApp.im_ChineseStandardABCDDS = new OTSIncAReportGB.ChineseStandardABCDDS(m_otsreport_export.m_ReportApp.m_rstDataMgr.m_ReportMgr, listGriddataclr);
  2366. m_otsreport_export.m_ReportApp.m_TablesWindow.Controls.Clear();
  2367. //List<DataTable> GB_1 = m_otsreport_export.m_ReportApp.im_ChineseStandardABCDDS.ChineseStandardABCD_GetDataTable();
  2368. //string s = GB_1[0].Rows[0][0].ToString();
  2369. return m_otsreport_export.m_ReportApp.im_ChineseStandardABCDDS.ChineseStandardABCD_GetDataTable(); ;
  2370. }
  2371. /// <summary>
  2372. /// 国标二
  2373. /// </summary>
  2374. /// <returns></returns>
  2375. public List<DataTable> InsertReportTemplateTable_NationalStandardMethodTwo(OTSCLRINTERFACE.CPropParamClr cPropParamClr)
  2376. {
  2377. //得到国标二的DataTable表格
  2378. cPropParamClr.SetDataSourceId(0);//
  2379. cPropParamClr.SetType(1);//table
  2380. cPropParamClr.SetCalTableType(7);//国标2
  2381. List<OTSCLRINTERFACE.CGridDataClr> listGriddataclr2 = m_otsreport_export.m_ReportApp.m_rstDataMgr.m_ReportMgr.GridDataTransfer(cPropParamClr);//
  2382. m_otsreport_export.m_ReportApp.m_TablesWindow.Controls.Clear();
  2383. m_otsreport_export.m_ReportApp.im_NationalStandardMethodTwo = new OTSIncAReportGB.NationalStandardMethodTwo(m_otsreport_export.m_ReportApp.m_rstDataMgr.m_ReportMgr, listGriddataclr2);
  2384. return m_otsreport_export.m_ReportApp.im_NationalStandardMethodTwo.ChineseStandardABCD_GetDataTable();
  2385. }
  2386. }
  2387. }