ResultDataMgr.cs 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. using OTSCLRINTERFACE;
  2. using OTSIncAReportApp.OTSSampleReportInfo;
  3. using OTSIncAReportApp.SysMgrTools;
  4. using OTSIncAReportGraph.OTSIncAReportGraphFuncation;
  5. using System;
  6. using System.Collections;
  7. using System.Collections.Generic;
  8. using System.Data;
  9. using System.IO;
  10. using System.Linq;
  11. namespace OTSIncAReportApp.OTSDataMgrFunction
  12. {
  13. /// <summary>
  14. /// 框架与底层进行交互的操作类
  15. /// </summary>
  16. public class ResultDataMgr
  17. {
  18. #region 变量定义
  19. /// <summary>
  20. /// 报告主进程框架对象
  21. /// </summary>
  22. private frmReportApp m_ReportApp = null;
  23. public CReportMgrClr m_ReportMgr;
  24. public List<DataOperation.Model.ResultFile> resultFilesList = new List<DataOperation.Model.ResultFile>(); //测量结果列表
  25. public int WorkingResult = -1;
  26. public DataOperation.Model.RptConfigFile m_RptConfigFile = new DataOperation.Model.RptConfigFile(); //报表程序的配置文件
  27. #endregion
  28. public OTSReportFun m_ReportFun = null;
  29. #region 构造函数
  30. /// <summary>
  31. /// 构造函数
  32. /// </summary>
  33. /// <param name="ReportApp"></param>
  34. public ResultDataMgr(frmReportApp ReportApp)
  35. {
  36. m_ReportApp = ReportApp;
  37. if (null == m_ReportMgr)
  38. {
  39. //初始化相关变量
  40. m_ReportMgr = new CReportMgrClr();
  41. }
  42. }
  43. #endregion
  44. #region 获取组合项相关方法
  45. /// <summary>
  46. /// 根据系统设置的默认粒级表路径,获取所有的粒级表文件List
  47. /// </summary>
  48. /// <returns></returns>
  49. public List<string> GetPartSizeFileList()
  50. {
  51. List<string> ret_list = new List<string>();
  52. //遍历粒级文件夹
  53. DirectoryInfo theFolder = new DirectoryInfo(m_RptConfigFile.FileFolderSize);
  54. if (!theFolder.Exists)
  55. return ret_list;
  56. //读取遍历粒级文件信息
  57. foreach (FileInfo nextifile in theFolder.GetFiles())
  58. {
  59. //找出粒级文件
  60. if (nextifile.Name.Contains(".psf") == true || nextifile.Name.Contains(".PSF") == true)
  61. {
  62. ret_list.Add(nextifile.Name);
  63. }
  64. }
  65. return ret_list;
  66. }
  67. /// <summary>
  68. /// 根据系统设置默认的粒级表的路径,获取粒级表List
  69. /// </summary>
  70. /// <param name="path"></param>
  71. /// <returns></returns>
  72. public List<string> GetPartSizeList()
  73. {
  74. DataSet ds = DataOperation.DataAccess.XMLoperate.GetXml(m_RptConfigFile.FileFolderSize + m_RptConfigFile.PartSizeFile);
  75. string sizestr = ds.Tables[0].Rows[0]["Sizes"].ToString();
  76. List<string> sizeList = new List<string>();
  77. for (int i = 0; i < sizestr.Split(',').Length - 1; i++)
  78. {
  79. if (sizestr.Split(',')[i].Length > 0)
  80. {
  81. double d1 = Convert.ToDouble(sizestr.Split(',')[i]);
  82. double d2 = Convert.ToDouble(sizestr.Split(',')[i + 1]);
  83. sizeList.Add(d1.ToString() + "~" + d2.ToString());
  84. }
  85. }
  86. double d = Convert.ToDouble(sizestr.Split(',')[sizestr.Split(',').Length - 1]);
  87. sizeList.Add(d.ToString() + "~MAX");
  88. return sizeList;
  89. }
  90. /// <summary>
  91. /// 根据传入的粒级表目录,获取粒级表List
  92. /// </summary>
  93. /// <returns></returns>
  94. public List<string> GetPartSizeList(string path)
  95. {
  96. DataSet ds = DataOperation.DataAccess.XMLoperate.GetXml(path);
  97. string sizestr = ds.Tables[0].Rows[0]["Sizes"].ToString();
  98. List<string> sizeList = new List<string>();
  99. for (int i = 0; i < sizestr.Split(',').Length - 1; i++)
  100. {
  101. if (sizestr.Split(',')[i].Length > 0)
  102. {
  103. double d1 = Convert.ToDouble(sizestr.Split(',')[i]);
  104. double d2 = Convert.ToDouble(sizestr.Split(',')[i + 1]);
  105. sizeList.Add(d1.ToString() + "~" + d2.ToString());
  106. }
  107. }
  108. double d = Convert.ToDouble(sizestr.Split(',')[sizestr.Split(',').Length - 1]);
  109. sizeList.Add(d.ToString() + "~MAX");
  110. return sizeList;
  111. }
  112. /// <summary>
  113. /// 获取三元相图模板名称列表
  114. /// </summary>
  115. /// <returns></returns>
  116. public List<string> GetTriTemplateNameList()
  117. {
  118. string pathtpf = m_RptConfigFile.FileFolderTrigTemp + m_RptConfigFile.TriTempFile;
  119. List<string> ret_list = new List<string>();
  120. DataSet ds = DataOperation.DataAccess.XMLoperate.GetXmlData(pathtpf, "XMLData");
  121. DataTable dt = ds.Tables["Member"];
  122. foreach (DataRow item in dt.Rows)
  123. {
  124. if (item["TemplateName"].ToString() != "")
  125. {
  126. ret_list.Add(item["TemplateName"].ToString());
  127. }
  128. }
  129. return ret_list;
  130. }
  131. /// <summary>
  132. /// 获取测量结果名称列表
  133. /// </summary>
  134. /// <returns></returns>
  135. public List<string> GetSampleListName()
  136. {
  137. List<string> ret_list = new List<string>();
  138. var resultfileList = resultFilesList;
  139. foreach (var item in resultfileList)
  140. {
  141. ret_list.Add(item.FileName);
  142. }
  143. if (m_ReportApp.MoreSource != "")
  144. {
  145. ret_list.Add(m_ReportApp.MoreSource);
  146. }
  147. return ret_list;
  148. }
  149. public List<string> GetDataSourceTypeList()
  150. {
  151. //string sscaptionname23 = table["sscaptionname23"].ToString();
  152. //string sscaptionname24 = table["sscaptionname24"].ToString();
  153. List<string> ret_list = new List<string>() { "AllParticles"};
  154. return ret_list;
  155. }
  156. /// <summary>
  157. /// 获取计算方法列表
  158. /// </summary>
  159. /// <returns></returns>
  160. public List<string> GetSizeCalMethodTypeList()
  161. {
  162. List<string> ret_list = new List<string>() { "DMAX", "DMIN", "Area", "FERET" };
  163. return ret_list;
  164. }
  165. /// <summary>
  166. /// 数据类型,全部颗粒,分析颗粒
  167. /// </summary>
  168. /// <returns></returns>
  169. #endregion
  170. #region [测量结果treeview]相关封装方法
  171. /// <summary>
  172. /// 获取测量结果treeview树测量结果名
  173. /// </summary>
  174. /// <returns></returns>
  175. public string GetSampleName()
  176. {
  177. //获取样品名
  178. String sWorkSampleName = resultFilesList[WorkingResult].FileName;
  179. if (null == sWorkSampleName)
  180. {
  181. return "";
  182. }
  183. return sWorkSampleName;
  184. }
  185. #endregion
  186. }
  187. }