BasicData.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680
  1. 
  2. using DevExpress.Office.Drawing;
  3. using NPOI.Util;
  4. using OTSCommon.DBOperate;
  5. using OTSIncAReportApp._2_CommonFunction.CommonClass;
  6. using OTSIncAReportApp.DataOperation.DataAccess;
  7. using OTSIncAReportApp.OTSRstMgrFunction;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Data;
  11. using System.Linq;
  12. using System.Text;
  13. using System.Threading.Tasks;
  14. using static OTSDataType.otsdataconst;
  15. using static OTSIncAReportApp.OTSReport_Export;
  16. namespace OTSIncAReportApp._1_UI.OTSReportExport.DataIntegration
  17. {
  18. public class BasicData
  19. {
  20. ParticleData fielddata;
  21. private string SizeChart = "";
  22. List<string> colid = new List<string>();
  23. List<string> colid_Below7 = new List<string>();
  24. List<string> GroupInformation = new List<string>();
  25. private List<DataTable> BData = new List<DataTable>();
  26. private List<DataTable> Measurements = new List<DataTable>();//测量结果数据列队
  27. private DataTable AllClass = new DataTable();
  28. private DataTable AllElement = new DataTable();
  29. private bool IsShereAClassificationGroup = false;
  30. private ResultFile resfile;
  31. private string FilePath = "";
  32. private string VDA19String = "5,15,25,50,100,150,200,400,600,1000";
  33. /// <summary>
  34. /// 获取粒级表
  35. /// </summary>
  36. public void SetParticlesizeTable(OTSReport_Export m_otsreport_export)
  37. {
  38. colid_Below7.Clear();
  39. //获取粒级表
  40. string path1 = m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFileFolder +
  41. m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFile;
  42. DataSet ds = OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.GetXml(path1);
  43. SizeChart = ds.Tables[0].Rows[0]["Sizes"].ToString();
  44. for (int i = 0; i < SizeChart.Split(',').Length; i++)
  45. {
  46. if (SizeChart.Split(',')[i].Length > 0)
  47. {
  48. double d1 = Convert.ToDouble(SizeChart.Split(',')[i]);
  49. //double d2 = Convert.ToDouble(SizeChart.Split(',')[i + 1]);
  50. colid.Add("≥"+ d1.ToString() /*+ "~" + d2.ToString()*/);
  51. }
  52. }
  53. for (int i = 0; i < SizeChart.Split(',').Length - 1; i++)
  54. {
  55. if (SizeChart.Split(',')[i].Length > 0)
  56. {
  57. double d1 = Convert.ToDouble(SizeChart.Split(',')[i]);
  58. double d2 = Convert.ToDouble(SizeChart.Split(',')[i + 1]);
  59. colid_Below7.Add(d1.ToString() + "~" + d2.ToString());
  60. }
  61. }
  62. double d = Convert.ToDouble(SizeChart.Split(',')[SizeChart.Split(',').Length - 1]);
  63. colid_Below7.Add(d.ToString() + "~MAX");
  64. //double d = Convert.ToDouble(SizeChart.Split(',')[SizeChart.Split(',').Length - 1]);
  65. //colid.Add(d.ToString() + "~MAX");
  66. }
  67. /// <summary>
  68. /// 获取粒级表
  69. /// </summary>
  70. /// <returns></returns>
  71. public List<string> GetParticlesizeTable()
  72. {
  73. if(colid.Count>7)
  74. {
  75. return colid;
  76. }else
  77. {
  78. return colid_Below7;
  79. }
  80. }
  81. public void SetDBData(c_TemplateClass m_mbszclass, OTSReport_Export m_otsreport_export, string ComputeMode)
  82. {
  83. DataTable m_bt_DBData = new DataTable();
  84. ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.GetWorkingResultId()].FilePath);
  85. List<string> colid = new List<string>() { "TypeName", "ar", "TypeId", "Largest", "Class", "GroupId", "con" };
  86. //获取粒级表
  87. string path1 = m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFileFolder +
  88. m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFile;
  89. DataSet ds = OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.GetXml(path1);
  90. string sizestr = "";
  91. if (m_mbszclass.M_VDA19.IsVDA19)
  92. sizestr = VDA19String;
  93. else
  94. sizestr = ds.Tables[0].Rows[0]["Sizes"].ToString();
  95. bool blBelow7 = false;
  96. if (sizestr.Split(',').Length>7)
  97. {
  98. for (int i = 0; i < sizestr.Split(',').Length; i++)
  99. {
  100. if (sizestr.Split(',')[i].Length > 0)
  101. {
  102. double d1 = Convert.ToDouble(sizestr.Split(',')[i]);
  103. //double d2 = Convert.ToDouble(sizestr.Split(',')[i + 1]);
  104. colid.Add("≥" + d1.ToString() /*+ "~" + d2.ToString()*/);
  105. }
  106. }
  107. blBelow7 = true;
  108. }
  109. else
  110. {
  111. for (int i = 0; i < sizestr.Split(',').Length - 1; i++)
  112. {
  113. if (sizestr.Split(',')[i].Length > 0)
  114. {
  115. double d1 = Convert.ToDouble(sizestr.Split(',')[i]);
  116. double d2 = Convert.ToDouble(sizestr.Split(',')[i + 1]);
  117. colid.Add(d1.ToString() + "~" + d2.ToString());
  118. }
  119. }
  120. double d = Convert.ToDouble(sizestr.Split(',')[sizestr.Split(',').Length - 1]);
  121. colid.Add(d.ToString() + "~MAX");
  122. blBelow7 = false;
  123. }
  124. for (int i = 0; i < colid.Count; i++)
  125. {
  126. m_bt_DBData.Columns.Add(colid[i].ToString());
  127. }
  128. DataTable dt = InvalidRemoval(fielddata.GetParticleListForParticlSize("area", ""));
  129. DataTable AreaInformationOfAllElements = InvalidRemoval(fielddata.GetAreaByAllIncA(""));
  130. DataTable dtp = InvalidRemoval(fielddata.GetParticleAll(""));
  131. string po = ComputeMode;
  132. switch (po)
  133. {
  134. case "DMAX":
  135. po = "DMAX";
  136. break;
  137. case "DMIN":
  138. po = "DMIN";
  139. break;
  140. case "ECD":
  141. po = "Area";
  142. break;
  143. case "FERET":
  144. po = "DFERET";
  145. break;
  146. }
  147. for (int i = 0; i < dt.Rows.Count; i++)
  148. {
  149. DataRow dr = m_bt_DBData.NewRow();
  150. dr["TypeName"] = dt.Rows[i]["TypeName"].ToString();
  151. dr["TypeId"] = dt.Rows[i]["TypeId"].ToString();
  152. dr["con"] = dt.Rows[i]["con"].ToString();
  153. dr["GroupId"] = dt.Rows[i]["GroupId"].ToString();
  154. if (dt.Rows[i]["GroupName"].ToString() == "")
  155. dr["Class"] = "Default";
  156. else
  157. dr["Class"] = dt.Rows[i]["GroupName"].ToString();
  158. //continue;
  159. dr["Largest"] = Math.Round(Convert.ToDouble(dt.Rows[i]["max"]), 2);
  160. if(blBelow7)
  161. {
  162. for (int a = 7; a < colid.Count; a++)
  163. {
  164. string d1 = colid[a].Split('≥')[1];
  165. string d2;
  166. if (a == colid.Count - 1)
  167. {
  168. d2 = "9999999999999";
  169. }
  170. else
  171. {
  172. d2 = colid[a + 1].Split('≥')[1];
  173. }
  174. DataRow[] datas = dtp.Select(getWhere(d2, d1, po, dt.Rows[i]["TypeId"].ToString()));
  175. dr[colid[a]] = datas.Count();
  176. }
  177. }
  178. else
  179. {
  180. for (int a = 7; a < colid.Count; a++)
  181. {
  182. string d1 = colid[a].Split('~')[0];
  183. string d2 = colid[a].Split('~')[1];
  184. if (d2 == "MAX")
  185. {
  186. d2 = "999";
  187. }
  188. DataRow[] datas = dtp.Select(getWhere(d2, d1, po, dt.Rows[i]["TypeId"].ToString()));
  189. dr[colid[a]] = datas.Count();
  190. }
  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. //去除物质分类(非夹杂物分类)//颗粒种类ID赛选
  202. //for (int a = 0; a < m_mbszclass.M_KLLBXX.list_str_kllb_DeleteClass_Serial.Count; a++)
  203. //{
  204. // for (int i = m_bt_DBData.Rows.Count - 1; i >= 0; i--)
  205. // {
  206. // if (m_bt_DBData.Rows[i]["TypeId"].ToString() == m_mbszclass.M_KLLBXX.list_str_kllb_DeleteClass_Serial[a].ToString())
  207. // {
  208. // m_bt_DBData.Rows.RemoveAt(i);
  209. // }
  210. // }
  211. //}
  212. //去除物质分类(非夹杂物分类)//颗粒种类名称赛选
  213. for (int a = 0; a < m_mbszclass.M_KLLBXX.list_str_kllb_DeleteClass.Count; a++)
  214. {
  215. for (int i = m_bt_DBData.Rows.Count - 1; i >= 0; i--)
  216. {
  217. if (m_bt_DBData.Rows[i]["TypeName"].ToString() == m_mbszclass.M_KLLBXX.list_str_kllb_DeleteClass[a].ToString())
  218. {
  219. m_bt_DBData.Rows.RemoveAt(i);
  220. }
  221. }
  222. }
  223. GroupInformation = new List<string>();
  224. for (int i = 0; i < m_bt_DBData.Rows.Count; i++)
  225. {
  226. bool bl = false;
  227. for (int a = 0; a < GroupInformation.Count; a++)
  228. {
  229. if (GroupInformation[a] == m_bt_DBData.Rows[i]["Class"].ToString())
  230. {
  231. bl = true;
  232. }
  233. }
  234. if (!bl)
  235. {
  236. GroupInformation.Add(m_bt_DBData.Rows[i]["Class"].ToString());
  237. }
  238. }
  239. if (m_otsreport_export.m_ReportApp.m_RptConfigFile.Systype == OTS_SysType_ID.IncA)
  240. {
  241. Measurements = new List<DataTable>();
  242. for (int i = 0; i < GroupInformation.Count; i++)
  243. {
  244. DataTable table = m_bt_DBData.Clone();
  245. for (int a = 0; a < m_bt_DBData.Rows.Count; a++)
  246. {
  247. if (GroupInformation[i] == m_bt_DBData.Rows[a]["Class"].ToString())
  248. {
  249. table.Rows.Add(m_bt_DBData.Rows[a].ItemArray);
  250. }
  251. }
  252. BData.Add(table);
  253. }
  254. //Measurements = BData.Copy();
  255. for (int i = 0; i < GroupInformation.Count; i++)
  256. {
  257. DataTable table = dtp.Clone();
  258. for (int a = 0; a < dtp.Rows.Count; a++)
  259. {
  260. if (GroupInformation[i] == dtp.Rows[a]["GroupName"].ToString())
  261. {
  262. table.Rows.Add(dtp.Rows[a].ItemArray);
  263. }
  264. }
  265. Measurements.Add(table);
  266. }
  267. return;
  268. }
  269. #region 判断是否使用指定选择组和规则
  270. bool bl1 = false;
  271. for (int i = 0; i < m_otsreport_export.m_mbszclass.RuleGroup.Rows.Count; i++)
  272. {
  273. if (m_otsreport_export.m_mbszclass.RuleGroup.Rows[i]["GroupId"].ToString() == "0")
  274. {
  275. bl1 = true;
  276. }
  277. }
  278. #endregion
  279. if (!bl1)
  280. {
  281. #region 筛选现有组
  282. List<string> strings = new List<string>();
  283. for (int i = 0; i < m_bt_DBData.Rows.Count; i++)
  284. {
  285. bool bl2 = false;
  286. for (int a = 0; a < strings.Count; a++)
  287. {
  288. if (m_bt_DBData.Rows[i]["GroupId"].ToString() == strings[a])
  289. {
  290. bl2 = true;
  291. }
  292. }
  293. if (!bl2)
  294. {
  295. strings.Add(m_bt_DBData.Rows[i]["GroupId"].ToString());
  296. }
  297. }
  298. #endregion
  299. List<DataTable> OutData = new List<DataTable>();
  300. for (int i = 0; i < strings.Count(); i++)
  301. {
  302. DataTable data = m_bt_DBData.Clone();
  303. for (int a = 0; a < m_bt_DBData.Rows.Count; a++)
  304. {
  305. if (strings[i] == m_bt_DBData.Rows[a]["GroupId"].ToString())
  306. {
  307. data.Rows.Add(m_bt_DBData.Rows[a].ItemArray);
  308. }
  309. }
  310. OutData.Add(data);
  311. }
  312. BData = OutData.Copy();
  313. Measurements = new List<DataTable>();
  314. for (int i = 0; i < GroupInformation.Count; i++)
  315. {
  316. DataTable table = dtp.Clone();
  317. for (int a = 0; a < dtp.Rows.Count; a++)
  318. {
  319. string strGroupId = "Default";
  320. if (dtp.Rows[a]["GroupName"].ToString() != "")
  321. {
  322. strGroupId = dtp.Rows[a]["GroupName"].ToString();
  323. }
  324. if (GroupInformation[i] == strGroupId)
  325. {
  326. table.Rows.Add(dtp.Rows[a].ItemArray);
  327. }
  328. }
  329. Measurements.Add(table);
  330. }
  331. return;
  332. }
  333. List<DataTable> SpecifyGroup = new List<DataTable>();
  334. for (int i = 0; i < m_otsreport_export.m_mbszclass.List_data.Count; i++)
  335. {
  336. DataTable data= m_bt_DBData.Clone();
  337. bool b3 = false;
  338. string str_class = "";
  339. for (int a = 0; a < m_otsreport_export.m_mbszclass.RuleGroup.Rows.Count; a++)
  340. {
  341. if (m_otsreport_export.m_mbszclass.RuleGroup.Rows[a]["GroupId"].ToString() == m_otsreport_export.m_mbszclass.List_data[i].TableName)
  342. {
  343. if (m_otsreport_export.m_mbszclass.RuleGroup.Rows[a]["display"].ToString() == "1")
  344. {
  345. str_class = m_otsreport_export.m_mbszclass.RuleGroup.Rows[a]["GroupName"].ToString();
  346. b3 = true;
  347. }
  348. }
  349. }
  350. data.TableName = m_otsreport_export.m_mbszclass.List_data[i].TableName;
  351. if (b3)
  352. {
  353. for (int a = 0; a < m_otsreport_export.m_mbszclass.List_data[i].Rows.Count; a++)
  354. {
  355. if (m_otsreport_export.m_mbszclass.List_data[i].Rows[a]["display"].ToString() == "1")
  356. {
  357. DataTable data1 = m_bt_DBData.Clone();
  358. DataRow row = data.NewRow();
  359. row["TypeName"] = m_otsreport_export.m_mbszclass.List_data[i].Rows[a]["StrName"];
  360. row["ar"] = 0;
  361. row["TypeId"] = m_otsreport_export.m_mbszclass.List_data[i].Rows[a]["STDId"];
  362. row["GroupId"] = m_otsreport_export.m_mbszclass.List_data[i].Rows[a]["GroupId"];
  363. row["con"] = 0;
  364. row["Largest"] = 0;
  365. row["Class"] = str_class;
  366. for (int j = 7; j < data.Columns.Count; j++)
  367. {
  368. row[j] = 0;
  369. }
  370. bool b2 = false;
  371. for (int j = 0; j < m_bt_DBData.Rows.Count; j++)
  372. {
  373. if (m_otsreport_export.m_mbszclass.List_data[i].Rows[a]["STDId"].ToString() == m_bt_DBData.Rows[j]["TypeId"].ToString())
  374. {
  375. data1.Rows.Add(m_bt_DBData.Rows[j].ItemArray);
  376. b2 = true;
  377. }
  378. }
  379. if (b2)
  380. {
  381. data.Rows.Add(data1.Rows[0].ItemArray);
  382. }
  383. else
  384. {
  385. data.Rows.Add(row);
  386. }
  387. }
  388. }
  389. }
  390. SpecifyGroup.Add(data);
  391. }
  392. BData = SpecifyGroup.Copy();
  393. #region 测量结果颗粒组队列
  394. List<DataTable> datas1 = new List<DataTable>();
  395. ResultFile rstf = m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.GetWorkingResultId()];
  396. UserSTDDbAccess dbAccess = new UserSTDDbAccess(rstf.GetSTDName(),rstf.FilePath);
  397. List<string> stringsa = dbAccess.ObtainParticleCategory(m_otsreport_export, this);
  398. for (int i = 0; i < stringsa.Count; i++)
  399. {
  400. DataTable data = dtp.Clone();
  401. for (int a = 0; a < dtp.Rows.Count; a++)
  402. {
  403. if (Convert.ToInt64(dtp.Rows[i]["TypeId"]) > 10)
  404. {
  405. string strGroupName = "Default";
  406. if (dtp.Rows[a]["GroupName"].ToString() != "")
  407. {
  408. strGroupName = dtp.Rows[a]["GroupName"].ToString();
  409. }
  410. if (stringsa[i].ToString() == strGroupName)
  411. {
  412. data.Rows.Add(dtp.Rows[a].ItemArray);
  413. }
  414. }
  415. }
  416. datas1.Add(data);
  417. }
  418. Measurements = new List<DataTable>();
  419. for (int i = 0; i < m_otsreport_export.m_mbszclass.List_data.Count; i++)
  420. {
  421. bool b3 = false;
  422. string str_class = "";
  423. for (int a = 0; a < m_otsreport_export.m_mbszclass.RuleGroup.Rows.Count; a++)
  424. {
  425. if (m_otsreport_export.m_mbszclass.RuleGroup.Rows[a]["GroupId"].ToString() == m_otsreport_export.m_mbszclass.List_data[i].TableName)
  426. {
  427. if (m_otsreport_export.m_mbszclass.RuleGroup.Rows[a]["display"].ToString() == "1")
  428. {
  429. str_class = m_otsreport_export.m_mbszclass.RuleGroup.Rows[a]["GroupName"].ToString();
  430. b3 = true;
  431. }
  432. }
  433. }
  434. if (b3)
  435. {
  436. DataTable table = datas1[i].Clone();
  437. for (int a = 0; a < datas1[i].Rows.Count; a++)
  438. {
  439. for (int b = 0; b < m_otsreport_export.m_mbszclass.List_data[i].Rows.Count; b++)
  440. {
  441. if (m_otsreport_export.m_mbszclass.List_data[i].Rows[b]["display"].ToString() == "1")
  442. {
  443. if (datas1[i].Rows[a]["TypeId"].ToString() == m_otsreport_export.m_mbszclass.List_data[i].Rows[b]["STDId"].ToString())
  444. {
  445. table.Rows.Add(datas1[i].Rows[a].ItemArray);
  446. }
  447. }
  448. }
  449. }
  450. Measurements.Add(table);
  451. }
  452. }
  453. #endregion
  454. }
  455. /// <summary>
  456. /// 获取夹杂物组信息
  457. /// </summary>
  458. /// <returns></returns>
  459. public List<string> GetGroupInformation()
  460. {
  461. return GroupInformation;
  462. }
  463. /// <summary>
  464. /// 获取读取数据库并过滤颗粒
  465. /// </summary>
  466. /// <returns></returns>
  467. public List<DataTable> GetDBData()
  468. {
  469. return BData;
  470. }
  471. /// <summary>
  472. /// 获取读取数据库并过滤颗粒
  473. /// </summary>
  474. /// <returns></returns>
  475. public List<DataTable> etDBData()
  476. {
  477. return BData;
  478. }
  479. public void SetAllClass()
  480. {
  481. AllClass = fielddata.GetAllClass();
  482. }
  483. /// <summary>
  484. /// 获取全部大类
  485. /// </summary>
  486. /// <returns></returns>
  487. public DataTable GetAllClass()
  488. {
  489. return AllClass;
  490. }
  491. /// <summary>
  492. ///测量结果数据列队
  493. /// </summary>
  494. /// <returns></returns>
  495. public List<DataTable> GetMeasurements()
  496. {
  497. return Measurements;
  498. }
  499. /// <summary>
  500. /// 定义ParticleData类
  501. /// </summary>
  502. public void newParticleData(OTSReport_Export m_otsreport_export)
  503. {
  504. fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.GetWorkingResultId()].FilePath);
  505. }
  506. public ParticleData getParticleData()
  507. {
  508. return fielddata;
  509. }
  510. public void SetAllElement()
  511. {
  512. AllElement = fielddata.GetAllElement();
  513. }
  514. /// <summary>
  515. /// 获取全部元素
  516. /// </summary>
  517. /// <returns></returns>
  518. public DataTable GetAllElement()
  519. {
  520. return AllElement;
  521. }
  522. /// <summary>
  523. /// 判断是否有大分类,有为true
  524. /// </summary>
  525. /// <param name="m_otsreport_export"></param>
  526. /// <returns></returns>
  527. public void IsThereAMajorClassification(BasicData basicData, OTSReport_Export m_otsreport_export)
  528. {
  529. //List<string> ClassName = ObtainParticleCategory(m_otsreport_export, basicData);
  530. List<string> ClassName = new List<string>();
  531. for (int i = 0; i < BData.Count; i++)
  532. {
  533. if (BData[i].Rows.Count != 0)
  534. {
  535. ClassName.Add(i.ToString());
  536. }
  537. }
  538. if (ClassName.Count < 2)
  539. {
  540. IsShereAClassificationGroup= false;
  541. }
  542. else
  543. {
  544. IsShereAClassificationGroup= true;
  545. }
  546. }
  547. public bool GetIsThereAMajorClassification()
  548. {
  549. return IsShereAClassificationGroup;
  550. }
  551. public void IsResultFilesList(OTSReport_Export m_otsreport_export)
  552. {
  553. resfile = m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.GetWorkingResultId()];
  554. }
  555. /// <summary>
  556. /// 获取标准库名称
  557. /// </summary>
  558. /// <returns></returns>
  559. public string GetResfile()
  560. {
  561. string str_libraryName = "";
  562. bool endsWithDb = resfile.GetSTDName().EndsWith(".db", StringComparison.OrdinalIgnoreCase);
  563. if (endsWithDb)
  564. {
  565. str_libraryName = resfile.GetSTDName();
  566. }
  567. else
  568. {
  569. str_libraryName = resfile.GetSTDName() + ".db";
  570. }
  571. return str_libraryName;
  572. }
  573. public void IsFilePath(OTSReport_Export m_otsreport_export)
  574. {
  575. FilePath= m_otsreport_export.m_ReportApp.m_rstDataMgr.CurResultFile.FilePath;
  576. }
  577. /// <summary>
  578. /// 得到文件路径
  579. /// </summary>
  580. /// <returns></returns>
  581. public string GetFilePath()
  582. {
  583. return FilePath;
  584. }
  585. #region 内部函数
  586. private string getWhere(string max, string min, string col, string partic)
  587. {
  588. if (col == "Area")
  589. {
  590. return col + ">=" + ((Convert.ToDouble(min) / 2) * (Convert.ToDouble(min) / 2) * Math.PI).ToString() + " and " + col + "<" + ((Convert.ToDouble(max) / 2) * (Convert.ToDouble(max) / 2) * Math.PI).ToString() + " and TypeId=" + partic;
  591. }
  592. else
  593. {
  594. return col + ">=" + min + " and " + col + "<" + max + " and TypeId=" + partic;
  595. }
  596. }
  597. private DataTable InvalidRemoval(DataTable dt)
  598. {
  599. DataTable dataTable = dt.Copy();
  600. dataTable.Clear();
  601. for (int i = 0; i < dt.Rows.Count; i++)
  602. {
  603. if (Convert.ToInt32(dt.Rows[i]["TypeId"]) > 10)
  604. {
  605. dataTable.Rows.Add(dt.Rows[i].ItemArray);
  606. }
  607. }
  608. return dataTable;
  609. }
  610. #endregion
  611. }
  612. }