OTSReport_Export.cs 55 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455
  1. using OTSIncAReportApp.Controls;
  2. using OTSCommon.DBOperate.Model;
  3. using OTSIncAReportApp.OTSTemplateDesigner;
  4. using OTSIncAReportApp.SysMgrTools;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Data;
  8. using System.Drawing;
  9. using System.IO;
  10. using System.Windows.Forms;
  11. using OTSIncAReportApp._1_UI.OTSTemplateDesigner;
  12. using DevExpress.XtraReports.UI;
  13. using OTSIncAReportApp.ReportTemplate;
  14. using System.Linq;
  15. using static OTSDataType.otsdataconst;
  16. using OTSCommon.DBOperate;
  17. using OTSIncAReportApp.OTSRstMgrFunction;
  18. using static OTSIncAReportApp.OTSReport_Export.c_TemplateClass;
  19. using OTSIncAReportApp._1_UI.OTSReportExport;
  20. using OTSIncAReportApp.DataOperation.DataAccess;
  21. using DevExpress.CodeParser;
  22. using DevExpress.XtraTreeList.Data;
  23. namespace OTSIncAReportApp
  24. {
  25. public partial class OTSReport_Export : Form
  26. {
  27. #region 全局变量
  28. System.Collections.Hashtable table;
  29. public frmReportApp m_ReportApp = null; //报告项目总进程对象
  30. public string m_export_type = "Excel"; //导出文件的格式类型Excel,Word,Pdf
  31. GBData m_export_reporttemplate;
  32. private string SummaryInfoPath = "./Config/ReportTemplate/SummaryInfo.xml";
  33. private XmlOperateUtil SummaryInfoXmluti;
  34. private string fileName = "";
  35. public c_TemplateClass m_mbszclass = null;
  36. OTS_DEVReport DEVReport;
  37. GBReport GB_Report;
  38. public List<string[]> LibraryName = new List<string[]>();
  39. private bool isExport = true;
  40. // 获取文件夹中的所有文件信息
  41. List<string> GetAllFileInformation = new List<string>();
  42. #endregion
  43. #region 模板设置类
  44. /// <summary>
  45. /// 模板设置类
  46. /// </summary>
  47. public class c_TemplateClass
  48. {
  49. /// <summary>
  50. /// 备注信息,及路径
  51. /// </summary>
  52. public DZ M_DZ { get; set; }
  53. #region 属性
  54. /// <summary>
  55. /// 首页
  56. /// </summary>
  57. public SY M_SY { get; set; }
  58. /// <summary>
  59. /// 页眉页脚
  60. /// </summary>
  61. public YMYJ M_YMYJ { get; set; }
  62. /// <summary>
  63. /// 颗粒分析结果
  64. /// </summary>
  65. public KLFXJG M_KLFXJG { get; set; }
  66. /// <summary>
  67. /// 元素分析结果
  68. /// </summary>
  69. public YSFXJG M_YSFXJG { get; set; }
  70. /// <summary>
  71. /// 三元相图
  72. /// </summary>
  73. public SYXT M_SYXT { get; set; }
  74. /// <summary>
  75. /// 颗粒列表信息
  76. /// </summary>
  77. public KLLBXX M_KLLBXX { get; set; }
  78. /// <summary>
  79. /// 夹杂物占比
  80. /// </summary>
  81. public JZWZB M_JZWZB { get; set; }
  82. /// <summary>
  83. /// 汽车清洁度
  84. /// </summary>
  85. public VDA19 M_VDA19 { get; set; }
  86. /// <summary>
  87. /// 清洁度排序显示
  88. /// </summary>
  89. public string str_MainPriority { get; set; }
  90. /// <summary>
  91. /// 清洁度排序ID
  92. /// </summary>
  93. public string str_MainPriorityID { get; set; }
  94. /// <summary>
  95. /// 主要优先排序
  96. /// </summary>
  97. public List<string> list_str_MainPriority { get; set; }
  98. /// <summary>
  99. /// 主要优先排序序号
  100. /// </summary>
  101. public List<string> list_str_MainPriority_Serial { get; set; }
  102. /// <summary>
  103. /// 次要优先排序string
  104. /// </summary>
  105. public string str_SecondaryPriority { get; set; }
  106. /// <summary>
  107. /// 次要优先排序
  108. /// </summary>
  109. public List<string> list_str_SecondaryPriority { get; set; }
  110. /// <summary>
  111. /// 清洁度所有组
  112. /// </summary>
  113. public DataTable RuleGroup { get; set; }
  114. /// <summary>
  115. /// 清洁度所有组内的规则
  116. /// </summary>
  117. public List<DataTable> List_data { get; set; }
  118. #endregion
  119. #region 构造函数
  120. public c_TemplateClass()
  121. {
  122. M_SY = new SY();
  123. M_YMYJ = new YMYJ();
  124. M_KLFXJG = new KLFXJG();
  125. M_YSFXJG = new YSFXJG();
  126. M_YSFXJG.list_str_tb_yscf_ysxx = new List<string>();
  127. M_YSFXJG.list_str_tb_ysfx_xsys = new List<string>();
  128. M_SYXT = new SYXT();
  129. M_SYXT.list_lbv_syxt_mblb = new List<string>();
  130. M_SYXT.list_lbv_syxt_mblb_index = new List<int>();
  131. M_KLLBXX = new KLLBXX();
  132. M_JZWZB = new JZWZB();
  133. M_VDA19 = new VDA19();
  134. M_KLLBXX.list_str_tb_lllb_sxys = new List<string>();
  135. M_KLLBXX.list_str_kllb_qcys = new List<string>();
  136. M_KLLBXX.list_str_kllb_DeleteClass = new List<string>();
  137. M_KLLBXX.list_str_kllb_DeleteClass_Serial = new List<string>();
  138. M_DZ = new DZ();
  139. list_str_MainPriority = new List<string>();
  140. list_str_MainPriority_Serial = new List<string>();
  141. list_str_SecondaryPriority = new List<string>();
  142. str_MainPriority = "";
  143. str_MainPriorityID = "";
  144. str_SecondaryPriority = "";
  145. /// <summary>
  146. /// 清洁度所有组
  147. /// </summary>
  148. DataTable RuleGroup = new DataTable();
  149. /// <summary>
  150. /// 清洁度所有组内的规则
  151. /// </summary>
  152. List<DataTable> List_data = new List<DataTable>();
  153. }
  154. #endregion
  155. public class DZ
  156. {
  157. public string route { get; set; }
  158. /// <summary>
  159. /// 备注
  160. /// </summary>
  161. public string Notes { get; set; }
  162. }
  163. public class VDA19
  164. {/// <summary>
  165. /// VDA19模块是否显示
  166. /// </summary>
  167. public bool IsVDA19 { get; set; }
  168. }
  169. #region 首页部份
  170. public class SY
  171. {
  172. public string LOGName { get; set; }
  173. /// <summary>
  174. /// 主标题
  175. /// </summary>
  176. public string str_tb_ZBT { get; set; }
  177. /// <summary>
  178. /// 副标题
  179. /// </summary>
  180. public string str_tb_FBT { get; set; }
  181. /// <summary>
  182. /// 样品名称
  183. /// </summary>
  184. public string str_tb_SampleName { get; set; }
  185. /// <summary>
  186. /// 样品编号
  187. /// </summary>
  188. public string str_tb_YPBH { get; set; }
  189. /// <summary>
  190. /// 参考标准
  191. /// </summary>
  192. public string str_tb_CKBZ { get; set; }
  193. /// <summary>
  194. /// 是否显示样品说明
  195. /// </summary>
  196. public bool b_ck_ypsm { get; set; }
  197. /// <summary>
  198. /// 设备名称
  199. /// </summary>
  200. public string str_tb_djsb { get; set; }
  201. /// <summary>
  202. /// 能谱名称
  203. /// </summary>
  204. public string str_tb_npsb { get; set; }
  205. /// <summary>
  206. /// 标准库名称
  207. /// </summary>
  208. public string StandardLibraryName { get; set; }
  209. }
  210. #endregion
  211. #region 页眉页脚部份
  212. public class YMYJ
  213. {
  214. /// <summary>
  215. /// 页眉文本
  216. /// </summary>
  217. public string str_tb_ymwb { get; set; }
  218. /// <summary>
  219. /// 客户号
  220. /// </summary>
  221. public string str_tb_KHH { get; set; }
  222. ///// <summary>
  223. ///// 是否显示页码
  224. ///// </summary>
  225. //public bool b_ck_ym { get; set; }
  226. /// <summary>
  227. /// 页脚文本
  228. /// </summary>
  229. public string str_tb_yjwb { get; set; }
  230. }
  231. #endregion
  232. #region 颗粒分析结果部份
  233. public class KLFXJG
  234. {
  235. /// <summary>
  236. /// 大分类是否显示
  237. /// </summary>
  238. public bool b_ck_klcc_dfl { get; set; }
  239. /// <summary>
  240. /// 小分类是否显示
  241. /// </summary>
  242. public bool b_ck_klcc_xfl { get; set; }
  243. /// <summary>
  244. /// 是否显示颗粒尺寸分析结果表
  245. /// </summary>
  246. public bool b_ck_klcc_xsmk { get; set; }
  247. /// <summary>
  248. /// 是否显示颗粒尺寸 堆叠图
  249. /// </summary>
  250. public bool b_ck_klcc_xsddt { get; set; }
  251. /// <summary>
  252. ///颗粒尺寸分析结果表 颗粒选择范围索引
  253. /// </summary>
  254. public int index_cb_klcc_klfw { get; set; }
  255. /// <summary>
  256. /// 夹杂物分类图 是否显示该模块
  257. /// </summary>
  258. public bool b_cb_jzwfl_xsmk { get; set; }
  259. /// <summary>
  260. ///夹杂物分类图 显示图形 选择索引
  261. /// </summary>
  262. public int index_cb_jzwfl_xstx { get; set; }
  263. /// <summary>
  264. /// 颗粒尺寸图形选择(饼、柱、线)
  265. /// </summary>
  266. public int ParticleSizeGraphicSelection { get; set; }
  267. /// <summary>
  268. /// 夹杂物分类图形选择(饼、柱、线)
  269. /// </summary>
  270. public int INCAGraphicSelection { get; set; }
  271. /// <summary>
  272. ///夹杂物分类图 计算方式 选择索引
  273. /// </summary>
  274. public int index_cb_jzwfl_jsfs { get; set; }
  275. /// <summary>
  276. ///夹杂物分类图 粒级表 选择索引
  277. /// </summary>
  278. public int index_cb_jzwfl_ljb { get; set; }
  279. /// <summary>
  280. ///夹杂物分类图 颗粒范围 选择索引
  281. /// </summary>
  282. public int index_cb_jzwfl_klfw { get; set; }
  283. }
  284. #endregion
  285. #region 元素分析结果部份
  286. public class YSFXJG
  287. {
  288. /// <summary>
  289. /// 元素分析表 是否显示该模块
  290. /// </summary>
  291. public bool b_ck_ysfx_xsmk { get; set; }
  292. /// <summary>
  293. /// 元素分析表 计算方式 选择索引
  294. /// </summary>
  295. public int index_cb_yxfx_jsfs { get; set; }
  296. /// <summary>
  297. /// 元素分析表 颗粒范围 选择索引
  298. /// </summary>
  299. public int index_cb_ysfx_klfw { get; set; }
  300. /// <summary>
  301. /// 元素分析表 显示元素显示文本
  302. /// </summary>
  303. public string str_tb_ysfx_xsys { get; set; }
  304. /// <summary>
  305. /// 元素分析表 显示元素拆分元素列表
  306. /// </summary>
  307. public List<string> list_str_tb_ysfx_xsys { get; set; }
  308. /// <summary>
  309. /// 元素成份图 是否显示该模块
  310. /// </summary>
  311. public bool b_ck_yscf_xsmk { get; set; }
  312. /// <summary>
  313. /// 元素成份图 显示图形 索引
  314. /// </summary>
  315. public int index_cb_yscf_xstx { get; set; }
  316. /// <summary>
  317. /// 元素成份图 计算方式 索引
  318. /// </summary>
  319. public int index_cb_yscf_jsfs { get; set; }
  320. /// <summary>
  321. /// 元素成份图 颗粒范围 索引
  322. /// </summary>
  323. public int index_cb_yscf_klfw { get; set; }
  324. /// <summary>
  325. /// 元素成份图 元素信息
  326. /// </summary>
  327. public string str_tb_yscf_ysxx { get; set; }
  328. /// <summary>
  329. /// 元素成份图 元素信息列表拆分字符列表
  330. /// </summary>
  331. public List<string> list_str_tb_yscf_ysxx { get; set; }
  332. }
  333. #endregion
  334. #region 三元相图部份
  335. public class SYXT
  336. {
  337. /// <summary>
  338. /// 三元相图 是否显示该模块
  339. /// </summary>
  340. public bool b_ck_syxt_xsmk { get; set; }
  341. /// <summary>
  342. /// 计算方式 索引
  343. /// </summary>
  344. public int index_cb_syxt_jsfs { get; set; }
  345. /// <summary>
  346. /// 颗粒范围 索引
  347. /// </summary>
  348. public int index_cb_syxt_klfw { get; set; }
  349. /// <summary>
  350. /// 粒级表信息 文本
  351. /// </summary>
  352. public string str_cb_syxt_ljb { get; set; }
  353. /// <summary>
  354. /// 粒级表信息 索引
  355. /// </summary>
  356. public int index_cb_syxt_ljb { get; set; }
  357. /// <summary>
  358. /// 每行显示数量 文本
  359. /// </summary>
  360. public string str_cb_syxt_mhxssl { get; set; }
  361. /// <summary>
  362. /// 三元相图模板集合列表
  363. /// </summary>
  364. public List<string> list_lbv_syxt_mblb { get; set; }
  365. /// <summary>
  366. /// 三元相图模板索引集合列表
  367. /// </summary>
  368. public List<int> list_lbv_syxt_mblb_index { get; set; }
  369. }
  370. #endregion
  371. #region 颗粒列表信息部份
  372. public class KLLBXX
  373. {
  374. /// <summary>
  375. /// 颗粒列表 是否显示该模块
  376. /// </summary>
  377. public bool b_ck_kllb_xsmk { get; set; }
  378. /// <summary>
  379. /// 颗粒列表 是否显示附加帧图模块
  380. /// </summary>
  381. public bool b_ck_kllb_fjzt { get; set; }
  382. /// <summary>
  383. /// 颗粒列表 计算方式 索引
  384. /// </summary>
  385. public int index_cb_kllb_jsfs { get; set; }
  386. /// <summary>
  387. /// 颗粒列表 颗粒范围 索引
  388. /// </summary>
  389. public int index_cb_kllb_klfw { get; set; }
  390. /// <summary>
  391. /// 颗粒列表 显示元素
  392. /// </summary>
  393. public string str_tb_kllb_sxys { get; set; }
  394. /// <summary>
  395. /// 颗粒列表 显示元素拆分元素列表
  396. /// </summary>
  397. public List<string> list_str_tb_lllb_sxys { get; set; }
  398. /// <summary>
  399. /// 颗粒列表 颗粒排序表行中第一个可选字段 文本
  400. /// </summary>
  401. public string str_cb_kllb_sort_p1 { get; set; }
  402. /// <summary>
  403. /// 颗粒列表 颗粒排序表行中第一个可选字段 索引
  404. /// </summary>
  405. public int index_cb_kllb_sort_p1 { get; set; }
  406. /// <summary>
  407. /// 颗粒列表 颗粒排序表行中第二个可选字段 文本
  408. /// </summary>
  409. public string str_cb_kllb_sort_p2 { get; set; }
  410. /// <summary>
  411. /// 颗粒列表 颗粒排序表行中第二个可选字段 索引
  412. /// </summary>
  413. public int index_cb_kllb_sort_p2 { get; set; }
  414. /// <summary>
  415. /// 颗粒列表 颗粒排序表行中第三个可选字段 文本
  416. /// </summary>
  417. public string str_cb_kllb_sort_p3 { get; set; }
  418. /// <summary>
  419. /// 颗粒列表 颗粒排序表行中第三个可选字段 索引
  420. /// </summary>
  421. public int index_cb_kllb_sort_p3 { get; set; }
  422. /// <summary>
  423. /// 颗粒列表去除不要的颗粒
  424. /// </summary>
  425. public string str_kllb_qcys { get; set; }
  426. /// <summary>
  427. /// 颗粒列表去除不要的颗粒
  428. /// </summary>
  429. public List<string> list_str_kllb_qcys { get; set; }
  430. /// <summary>
  431. /// 颗粒列表去除不要的物质分类
  432. /// </summary>
  433. public string str_kllb_DeleteClass { get; set; }
  434. /// <summary>
  435. /// 颗粒列表去除不要的物质分类
  436. /// </summary>
  437. public List<string> list_str_kllb_DeleteClass { get; set; }
  438. /// <summary>
  439. /// 颗粒列表去除不要的物质分类
  440. /// </summary>
  441. public List<string> list_str_kllb_DeleteClass_Serial { get; set; }
  442. /// <summary>
  443. /// 显示颗粒数量
  444. /// </summary>
  445. public int list_int_kllb_number { get; set; }
  446. }
  447. #endregion
  448. #region 夹杂物占比
  449. public class JZWZB
  450. {
  451. /// <summary>
  452. /// 夹杂物占比表
  453. /// </summary>
  454. public bool b_ck_surface { get; set; }
  455. /// <summary>
  456. /// 夹杂物占比图
  457. /// </summary>
  458. public bool b_ck_chart { get; set; }
  459. }
  460. #endregion
  461. }
  462. #endregion
  463. #region 窗体加载及构造函数
  464. /// <summary>
  465. ///
  466. /// </summary>
  467. /// <param name="ReportApp"></param>
  468. /// <param name="a_isTemplate">是否有导出功能</param>
  469. public OTSReport_Export(frmReportApp ReportApp,bool a_isExport)
  470. {
  471. InitializeComponent();
  472. m_ReportApp = ReportApp;
  473. m_export_reporttemplate = new GBData(this);
  474. SummaryInfoXmluti = new XmlOperateUtil(SummaryInfoPath);
  475. m_mbszclass = new c_TemplateClass();
  476. //读取配置文件中的模板路径
  477. LoadMBSZClass();
  478. #region 国际化语言
  479. Language lan = new Language(this);
  480. table = lan.GetNameTable(this.Name);
  481. #endregion
  482. isExport = a_isExport;
  483. if (!a_isExport)
  484. {
  485. button7.Enabled = false;
  486. btn_preview.Enabled = false;
  487. }
  488. }
  489. /// <summary>
  490. /// 从配置文件中读取报告模板路径
  491. /// </summary>
  492. private void LoadMBSZClass()
  493. {
  494. string path;
  495. if (m_ReportApp.m_RptConfigFile.Systype != OTS_SysType_ID.IncA)
  496. path = SummaryInfoXmluti.Read("M_address", "Path_CA");
  497. else
  498. path = SummaryInfoXmluti.Read("M_address", "Path");
  499. fileName = path;
  500. tb_mblj.Text = fileName;
  501. m_mbszclass.M_DZ.route = fileName;
  502. }
  503. /// <summary>
  504. /// 将报告模板信息保存到配置文件中
  505. /// </summary>
  506. private void SaveMBSClass()
  507. {
  508. if (m_ReportApp.m_RptConfigFile.Systype != OTS_SysType_ID.IncA)
  509. //文件路径
  510. SummaryInfoXmluti.Write(m_mbszclass.M_DZ.route.ToString(), "M_address", "Path_CA");
  511. else
  512. SummaryInfoXmluti.Write(m_mbszclass.M_DZ.route.ToString(), "M_address", "Path");
  513. }
  514. /// <summary>
  515. /// 加载报告模板选择项,数据源选项
  516. /// </summary>
  517. private void BindComboBox()
  518. {
  519. //加载数据源
  520. for (int i = 0; i < m_ReportApp.m_rstDataMgr.ResultFilesList.Count; i++)
  521. {
  522. cbo_sjy.Items.Add(m_ReportApp.m_rstDataMgr.ResultFilesList[i].anotherFileName);
  523. }
  524. if (cbo_sjy.Items.Count > 0)
  525. cbo_sjy.SelectedIndex = 0;
  526. }
  527. private void OTSReport_Export_Load(object sender, EventArgs e)
  528. {
  529. //窗体加载时,初始化Combobox
  530. BindComboBox();
  531. LoadControlsToXml();
  532. tb_mblj.Text = fileName;
  533. if (isExport)
  534. ReadClassification();
  535. else
  536. ReadClassificationNo();
  537. if (m_ReportApp.m_RptConfigFile.Systype != OTS_SysType_ID.IncA)
  538. {
  539. button7.Visible = false;
  540. }
  541. }
  542. #endregion
  543. #region 自定义方法
  544. #endregion
  545. #region 窗体控件事件
  546. private void btn_preview_Click(object sender, EventArgs e)
  547. {
  548. m_ReportApp.m_rstDataMgr.SetWorkingResultId(cbo_sjy.SelectedIndex);
  549. DEVReport = new OTS_DEVReport(this, m_mbszclass, m_ReportApp, table);
  550. LoadData();
  551. ReportPrintTool tool = new ReportPrintTool(DEVReport);
  552. tool.ShowPreview();
  553. }
  554. private void button2_Click(object sender, EventArgs e)
  555. {
  556. //退出
  557. this.Close();
  558. }
  559. private void btn_openfilepath_Click(object sender, EventArgs e)
  560. {
  561. string path;
  562. if (m_ReportApp.m_RptConfigFile.Systype == OTS_SysType_ID.BatteryCleannessA)
  563. {
  564. path = Application.StartupPath + "\\Config\\ReportTemplate\\CleannessA_Template";
  565. }
  566. else if (m_ReportApp.m_RptConfigFile.Systype == OTS_SysType_ID.IncA)
  567. {
  568. path = Application.StartupPath + "\\Config\\ReportTemplate\\Inca_Template";
  569. }
  570. else /*if (m_ReportApp.m_RptConfigFile.Systype == OTS_SysType_ID.TCCleannessA)*/
  571. {
  572. path = Application.StartupPath + "\\Config\\ReportTemplate\\TCleannessA_Template";
  573. }
  574. FileNameSelect NameSelect = new FileNameSelect(path, fileName);
  575. NameSelect.ShowDialog();
  576. if (NameSelect.yes)
  577. {
  578. fileName = NameSelect.ChangePathName;
  579. m_mbszclass.M_DZ.route = fileName;
  580. LoadControlsToXml();
  581. SaveMBSClass();
  582. if (isExport)
  583. ReadClassification();
  584. else
  585. ReadClassificationNo();
  586. }
  587. }
  588. //调用编辑模板窗体
  589. private void btn_TempDes_Click(object sender, EventArgs e)
  590. {
  591. //预览设置
  592. if (m_ReportApp.m_RptConfigFile.Systype != OTS_SysType_ID.IncA)
  593. {
  594. OTSReport_Template_CleannessA OtsTemDRM = new OTSReport_Template_CleannessA(this, fileName);
  595. if (OtsTemDRM.ShowDialog() == DialogResult.Yes)
  596. {
  597. //如果用户点击确定,则将m_mbszclass,模板设置类的内容存到文件中。
  598. m_mbszclass.M_DZ.route = tb_mblj.Text;
  599. SaveMBSClass();
  600. }
  601. }
  602. else
  603. {
  604. OTSReport_Template_INCA OtsTemDRM = new OTSReport_Template_INCA(this, fileName);
  605. if (OtsTemDRM.ShowDialog() == DialogResult.Yes)
  606. {
  607. //如果用户点击确定,则将m_mbszclass,模板设置类的内容存到文件中。
  608. m_mbszclass.M_DZ.route = tb_mblj.Text;
  609. SaveMBSClass();
  610. }
  611. }
  612. }
  613. #endregion
  614. #region 导出工作线程部份
  615. private void LoadData()
  616. {
  617. double total = 1;
  618. if (m_mbszclass.M_KLFXJG.b_ck_klcc_xsmk)
  619. total++;
  620. if (m_mbszclass.M_YSFXJG.b_ck_ysfx_xsmk)
  621. total++;
  622. if (m_mbszclass.M_JZWZB.b_ck_surface)
  623. total++;
  624. if(m_mbszclass.M_JZWZB.b_ck_chart)
  625. total++;
  626. if(m_mbszclass.M_SYXT.b_ck_syxt_xsmk)
  627. total++;
  628. if(m_mbszclass.M_KLLBXX.b_ck_kllb_xsmk)
  629. total++;
  630. if(m_mbszclass.M_KLLBXX.b_ck_kllb_fjzt)
  631. total++;
  632. if(m_mbszclass.M_VDA19.IsVDA19)
  633. total++;
  634. double Serial = 1;
  635. int length = 2;
  636. try
  637. {
  638. if (true)//测量结果信息表
  639. {
  640. double d1 = Convert.ToDouble(Serial / total) * 100.0;
  641. Serial++;
  642. richTextBox1.SelectionColor = Color.Black;
  643. richTextBox1.SelectionStart = 0; // 设置选择开始位置
  644. richTextBox1.AppendText(table["measurement_result"].ToString() + "\n");
  645. richTextBox1.AppendText(table["loading"].ToString() + Math.Round(d1, length).ToString() + "%\n");
  646. DEVReport.International_language();
  647. bool isINCA = false;
  648. if (m_ReportApp.m_RptConfigFile.Systype == OTS_SysType_ID.IncA)
  649. {
  650. isINCA = true;
  651. }
  652. DEVReport.setResultGrid(isINCA);
  653. richTextBox1.ScrollToCaret();
  654. }
  655. }
  656. catch
  657. {
  658. richTextBox1.SelectionColor = Color.Red;
  659. richTextBox1.AppendText(table["measurementResult_fail"].ToString() + "\n");
  660. return;
  661. }
  662. // 执行后台任务...
  663. try
  664. {
  665. if (m_mbszclass.M_KLFXJG.b_ck_klcc_xsmk)//颗粒尺寸分析表
  666. {
  667. double d1 = Convert.ToDouble(Serial / total) * 100.0;
  668. Serial++;
  669. richTextBox1.SelectionColor = Color.Black;
  670. richTextBox1.SelectionStart = 0; // 设置选择开始位置
  671. richTextBox1.AppendText(table["particle_size"].ToString() + "\n");
  672. richTextBox1.AppendText(table["loading"].ToString() + Math.Round(d1, length).ToString() + "%\n");
  673. DEVReport.setParticleSizeTable(m_mbszclass);
  674. richTextBox1.ScrollToCaret();
  675. }
  676. }
  677. catch
  678. {
  679. richTextBox1.SelectionColor = Color.Red;
  680. richTextBox1.AppendText(table["particle_size_fail"].ToString() + "\n");
  681. return;
  682. }
  683. try
  684. {
  685. if (m_mbszclass.M_YSFXJG.b_ck_ysfx_xsmk)//元素分析表
  686. {
  687. double d1 = Convert.ToDouble(Serial / total) * 100.0;
  688. Serial++;
  689. richTextBox1.SelectionColor = Color.Black;
  690. richTextBox1.SelectionStart = 0; // 设置选择开始位置
  691. richTextBox1.AppendText(table["elemental_analysis"].ToString() + "\n");
  692. richTextBox1.AppendText(table["loading"].ToString() + Math.Round(d1, length).ToString() + "%\n");
  693. DEVReport.XRPageBreak();
  694. DEVReport.setElementAvgGrid();
  695. richTextBox1.ScrollToCaret();
  696. }
  697. }
  698. catch
  699. {
  700. richTextBox1.SelectionColor = Color.Red;
  701. richTextBox1.AppendText(table["elemental_analysis_fail"].ToString() + "\n");
  702. return;
  703. }
  704. try
  705. {
  706. if (m_mbszclass.M_JZWZB.b_ck_surface)//夹杂物面积比表
  707. {
  708. double d1 = Convert.ToDouble(Serial / total) * 100.0;
  709. Serial++;
  710. richTextBox1.SelectionColor = Color.Black;
  711. richTextBox1.SelectionStart = 0; // 设置选择开始位置
  712. richTextBox1.AppendText(table["inclusion"].ToString() + "\n");
  713. richTextBox1.AppendText(table["loading"].ToString() + Math.Round(d1, length).ToString() + "%\n");
  714. DEVReport.XRPageBreak();
  715. DEVReport.setINCAtable();
  716. richTextBox1.ScrollToCaret();
  717. }
  718. }
  719. catch
  720. {
  721. richTextBox1.SelectionColor = Color.Red;
  722. richTextBox1.AppendText(table["inclusion_fail"].ToString() + "\n");
  723. return;
  724. }
  725. try
  726. {
  727. if (m_mbszclass.M_JZWZB.b_ck_surface)
  728. {
  729. if (m_mbszclass.M_KLFXJG.b_ck_klcc_dfl == true || m_mbszclass.M_KLFXJG.b_ck_klcc_xfl == true)
  730. {
  731. double d1 = Convert.ToDouble(Serial / total) * 100.0;
  732. Serial++;
  733. richTextBox1.SelectionColor = Color.Black;
  734. richTextBox1.SelectionStart = 0; // 设置选择开始位置
  735. richTextBox1.AppendText(table["inclusion_chart"].ToString() + "\n");
  736. richTextBox1.AppendText(table["loading"].ToString() + Math.Round(d1, length).ToString() + "%\n");
  737. DEVReport.XRPageBreak();
  738. DEVReport.set_incaPIC_classify(m_mbszclass);
  739. DEVReport.set_incaPIC_subdivision(m_mbszclass);
  740. richTextBox1.ScrollToCaret();
  741. }
  742. }
  743. }
  744. catch
  745. {
  746. richTextBox1.SelectionColor = Color.Red;
  747. richTextBox1.AppendText(table["inclusion_chart_fail"].ToString() + "\n");
  748. return;
  749. }
  750. try
  751. {
  752. if (m_mbszclass.M_SYXT.b_ck_syxt_xsmk)//三元图
  753. {
  754. double d1 = Convert.ToDouble(Serial / total) * 100.0;
  755. Serial++;
  756. richTextBox1.SelectionColor = Color.Black;
  757. richTextBox1.SelectionStart = 0; // 设置选择开始位置
  758. richTextBox1.AppendText(table["ternary_diagram"].ToString() + "\n");
  759. richTextBox1.AppendText(table["loading"].ToString() + Math.Round(d1, length).ToString() + "%\n");
  760. DEVReport.XRPageBreak();
  761. DEVReport.InsertReportTemplateChart_Trianglediagram();
  762. richTextBox1.ScrollToCaret();
  763. }
  764. }
  765. catch
  766. {
  767. richTextBox1.SelectionColor = Color.Red;
  768. richTextBox1.AppendText(table["ternary_diagram_fail"].ToString() + "\n");
  769. return;
  770. }
  771. try
  772. {
  773. if (m_mbszclass.M_KLLBXX.b_ck_kllb_xsmk)//颗粒列表
  774. {
  775. double d1 = Convert.ToDouble(Serial / total) * 100.0;
  776. Serial++;
  777. richTextBox1.SelectionColor = Color.Black;
  778. richTextBox1.SelectionStart = 0; // 设置选择开始位置
  779. richTextBox1.AppendText(table["particle_list"].ToString() + "\n");
  780. richTextBox1.AppendText(table["loading"].ToString() + Math.Round(d1, length).ToString() + "%\n");
  781. //DEVReport.XRPageBreak();
  782. DEVReport.set_Particle_List_data();
  783. richTextBox1.ScrollToCaret();
  784. }
  785. }
  786. catch
  787. {
  788. richTextBox1.SelectionColor = Color.Red;
  789. richTextBox1.AppendText(table["particle_list_fail"].ToString() + "\n");
  790. return;
  791. }
  792. try
  793. {
  794. if (m_mbszclass.M_KLLBXX.b_ck_kllb_fjzt)//颗粒帧图列表
  795. {
  796. double d1 = Convert.ToDouble(Serial / total) * 100.0;
  797. Serial++;
  798. richTextBox1.SelectionColor = Color.Black;
  799. richTextBox1.SelectionStart = 0; // 设置选择开始位置
  800. richTextBox1.AppendText(table["particle_list_chart"].ToString() + "\n");
  801. richTextBox1.AppendText(table["loading"].ToString() + Math.Round(d1, length).ToString() + "%\n");
  802. //DEVReport.XRPageBreak();
  803. DEVReport.set_Particle_List_data_frame();
  804. richTextBox1.ScrollToCaret();
  805. }
  806. }
  807. catch
  808. {
  809. richTextBox1.SelectionColor = Color.Red;
  810. richTextBox1.AppendText(table["particle_list_chart_fail"].ToString() + "\n");
  811. return;
  812. }
  813. richTextBox1.SelectionColor = Color.Red;
  814. richTextBox1.AppendText(table["complete"].ToString() + "\n");
  815. richTextBox1.ScrollToCaret();
  816. }
  817. #endregion
  818. #region 读取文件
  819. private void LoadControlsToXml()
  820. {
  821. string strpath;
  822. if (m_ReportApp.m_RptConfigFile.Systype == OTS_SysType_ID.BatteryCleannessA)
  823. strpath = Application.StartupPath + "\\Config\\ReportTemplate\\CleannessA_Template\\" + fileName;
  824. else if (m_ReportApp.m_RptConfigFile.Systype == OTS_SysType_ID.IncA)
  825. strpath = Application.StartupPath + "\\Config\\ReportTemplate\\Inca_Template\\" + fileName;
  826. else
  827. strpath = Application.StartupPath + "\\Config\\ReportTemplate\\TCleannessA_Template\\" + fileName;
  828. tb_mblj.Text = fileName;
  829. OTSIncAReportApp.Controls.XmlOperateUtil xmlutil = new OTSIncAReportApp.Controls.XmlOperateUtil(strpath);
  830. //首页
  831. m_mbszclass.M_SY.str_tb_ZBT = xmlutil.Read("M_SY", "str_tb_ZBT");
  832. m_mbszclass.M_SY.str_tb_FBT = xmlutil.Read("M_SY", "str_tb_FBT");
  833. m_mbszclass.M_SY.str_tb_YPBH = xmlutil.Read("M_SY", "str_tb_YPBH");
  834. m_mbszclass.M_SY.str_tb_SampleName = xmlutil.Read("M_SY", "str_tb_SampleName");
  835. m_mbszclass.M_SY.str_tb_CKBZ = xmlutil.Read("M_SY", "str_tb_CKBZ");
  836. m_mbszclass.M_SY.b_ck_ypsm = Convert.ToBoolean(xmlutil.Read("M_SY", "b_ck_ypsm"));
  837. m_mbszclass.M_SY.LOGName = xmlutil.Read("M_SY", "LOGName");
  838. m_mbszclass.M_SY.StandardLibraryName= xmlutil.Read("M_SY", "StandardLibraryName");
  839. m_mbszclass.M_SY.str_tb_djsb= xmlutil.Read("M_SY", "str_tb_djsb");
  840. m_mbszclass.M_SY.str_tb_npsb= xmlutil.Read("M_SY", "str_tb_npsb");
  841. if (m_mbszclass.M_SY.LOGName == null || m_mbszclass.M_SY.LOGName == "")
  842. {
  843. m_mbszclass.M_SY.LOGName = "ReportIdentification.bmp";
  844. }
  845. //页眉页脚
  846. m_mbszclass.M_YMYJ.str_tb_ymwb = xmlutil.Read("M_YMYJ", "str_tb_ymwb");
  847. m_mbszclass.M_YMYJ.str_tb_KHH = xmlutil.Read("M_YMYJ", "str_tb_KHH");
  848. //m_mbszclass.M_YMYJ.b_ck_ym = Convert.ToBoolean(xmlutil.Read("M_YMYJ", "b_ck_ym"));
  849. m_mbszclass.M_YMYJ.str_tb_yjwb = xmlutil.Read("M_YMYJ", "str_tb_yjwb");
  850. //颗粒分析结果
  851. m_mbszclass.M_KLFXJG.b_ck_klcc_xsmk = Convert.ToBoolean(xmlutil.Read("M_KLFXJG", "b_ck_klcc_xsmk"));//是否显示模块
  852. m_mbszclass.M_KLFXJG.b_ck_klcc_xsddt = Convert.ToBoolean(xmlutil.Read("M_KLFXJG", "b_ck_klcc_xsddt"));
  853. m_mbszclass.M_KLFXJG.index_cb_klcc_klfw = Convert.ToInt32(xmlutil.Read("M_KLFXJG", "index_cb_klcc_klfw"));//颗粒范围
  854. m_mbszclass.M_KLFXJG.b_cb_jzwfl_xsmk = Convert.ToBoolean(xmlutil.Read("M_KLFXJG", "b_cb_jzwfl_xsmk"));//是否显示该模块
  855. m_mbszclass.M_KLFXJG.index_cb_jzwfl_xstx = Convert.ToInt32(xmlutil.Read("M_KLFXJG", "index_cb_jzwfl_xstx"));//选择图像
  856. m_mbszclass.M_KLFXJG.index_cb_jzwfl_jsfs = Convert.ToInt32(xmlutil.Read("M_KLFXJG", "index_cb_jzwfl_jsfs"));//计算方式
  857. m_mbszclass.M_KLFXJG.index_cb_jzwfl_ljb = Convert.ToInt32(xmlutil.Read("M_KLFXJG", "index_cb_jzwfl_ljb"));//粒级表
  858. m_mbszclass.M_KLFXJG.index_cb_jzwfl_klfw = Convert.ToInt32(xmlutil.Read("M_KLFXJG", "index_cb_jzwfl_klfw"));//颗粒范围
  859. //元素分析结果
  860. m_mbszclass.M_YSFXJG.b_ck_ysfx_xsmk = Convert.ToBoolean(xmlutil.Read("M_YSFXJG", "b_ck_ysfx_xsmk")); //是否显示模块
  861. m_mbszclass.M_YSFXJG.index_cb_yxfx_jsfs = Convert.ToInt32(xmlutil.Read("M_YSFXJG", "index_cb_yxfx_jsfs")); //计算方式
  862. m_mbszclass.M_YSFXJG.index_cb_ysfx_klfw = Convert.ToInt32(xmlutil.Read("M_YSFXJG", "index_cb_ysfx_klfw")); //颗粒范围
  863. m_mbszclass.M_YSFXJG.str_tb_ysfx_xsys = xmlutil.Read("M_YSFXJG", "str_tb_ysfx_xsys"); //显示元素
  864. m_mbszclass.M_KLFXJG.ParticleSizeGraphicSelection= Convert.ToInt32(xmlutil.Read("M_KLFXJG", "ParticleSizeGraphicSelection"));
  865. m_mbszclass.M_KLFXJG.INCAGraphicSelection = Convert.ToInt32(xmlutil.Read("M_KLFXJG", "INCAGraphicSelection"));
  866. m_mbszclass.M_YSFXJG.list_str_tb_ysfx_xsys.Clear();
  867. for (int i = 0; i < 100; i++) //取得所有元素列表
  868. {
  869. string str = xmlutil.Read("M_YSFXJG", "list_str_tb_ysfx_xsys", "YS" + i.ToString());
  870. if (str == null)
  871. {
  872. break;
  873. }
  874. else
  875. {
  876. m_mbszclass.M_YSFXJG.list_str_tb_ysfx_xsys.Add(str);
  877. }
  878. }
  879. m_mbszclass.M_YSFXJG.b_ck_yscf_xsmk = Convert.ToBoolean(xmlutil.Read("M_YSFXJG", "b_ck_yscf_xsmk")); //是否显示模块
  880. m_mbszclass.M_YSFXJG.index_cb_yscf_xstx = Convert.ToInt32(xmlutil.Read("M_YSFXJG", "index_cb_yscf_xstx")); //显示图形
  881. m_mbszclass.M_YSFXJG.index_cb_yscf_jsfs = Convert.ToInt32(xmlutil.Read("M_YSFXJG", "index_cb_yscf_jsfs")); //计算方式
  882. m_mbszclass.M_YSFXJG.index_cb_yscf_klfw = Convert.ToInt32(xmlutil.Read("M_YSFXJG", "index_cb_yscf_klfw")); //颗粒范围
  883. m_mbszclass.M_YSFXJG.str_tb_yscf_ysxx = xmlutil.Read("M_YSFXJG", "str_tb_yscf_ysxx"); //显示元素
  884. m_mbszclass.M_YSFXJG.list_str_tb_yscf_ysxx.Clear();
  885. for (int i = 0; i < 100; i++) //取得所有元素列表
  886. {
  887. string str = xmlutil.Read("M_YSFXJG", "list_str_tb_yscf_ysxx", "YS" + i.ToString());
  888. if (str == null)
  889. {
  890. break;
  891. }
  892. else
  893. {
  894. m_mbszclass.M_YSFXJG.list_str_tb_yscf_ysxx.Add(str);
  895. }
  896. }
  897. //三元相图
  898. m_mbszclass.M_SYXT.b_ck_syxt_xsmk = Convert.ToBoolean(xmlutil.Read("M_SYXT", "b_ck_syxt_xsmk")); //是否显示模块
  899. m_mbszclass.M_SYXT.index_cb_syxt_jsfs = Convert.ToInt32(xmlutil.Read("M_SYXT", "index_cb_syxt_jsfs")); //计算方式
  900. m_mbszclass.M_SYXT.index_cb_syxt_klfw = Convert.ToInt32(xmlutil.Read("M_SYXT", "index_cb_syxt_klfw")); //颗粒范围
  901. m_mbszclass.M_SYXT.str_cb_syxt_mhxssl = xmlutil.Read("M_SYXT", "str_cb_syxt_mhxssl"); //每行显示数量
  902. m_mbszclass.M_SYXT.list_lbv_syxt_mblb.Clear();
  903. for (int i = 0; i < 100; i++) //取得所有模板列表
  904. {
  905. string str = xmlutil.Read("M_SYXT", "list_lbv_syxt_mblb", "MB" + i.ToString());
  906. if (str == null)
  907. {
  908. break;
  909. }
  910. else
  911. {
  912. m_mbszclass.M_SYXT.list_lbv_syxt_mblb.Add(str);
  913. }
  914. }
  915. m_mbszclass.M_SYXT.list_lbv_syxt_mblb_index.Clear();
  916. for (int i = 0; i < 100; i++) //取得所有模板列表 索引
  917. {
  918. string str = xmlutil.Read("M_SYXT", "list_lbv_syxt_mblb_index", "MBIndex" + i.ToString());
  919. if (str == null)
  920. {
  921. break;
  922. }
  923. else
  924. {
  925. m_mbszclass.M_SYXT.list_lbv_syxt_mblb_index.Add(Convert.ToInt32(str));
  926. }
  927. }
  928. //颗粒列表信息
  929. m_mbszclass.M_KLLBXX.b_ck_kllb_xsmk = Convert.ToBoolean(xmlutil.Read("M_KLLBXX", "b_ck_kllb_xsmk")); //是否显示模块
  930. m_mbszclass.M_KLLBXX.index_cb_kllb_jsfs = Convert.ToInt32(xmlutil.Read("M_KLLBXX", "index_cb_kllb_jsfs")); //计算方式
  931. m_mbszclass.M_KLLBXX.index_cb_kllb_klfw = Convert.ToInt32(xmlutil.Read("M_KLLBXX", "index_cb_kllb_klfw")); //颗粒范围
  932. m_mbszclass.M_KLLBXX.str_tb_kllb_sxys = xmlutil.Read("M_KLLBXX", "str_tb_kllb_sxys"); //显示元素
  933. m_mbszclass.M_KLLBXX.b_ck_kllb_fjzt = Convert.ToBoolean(xmlutil.Read("M_KLLBXX", "b_ck_kllb_fjzt"));
  934. m_mbszclass.M_KLLBXX.list_str_tb_lllb_sxys.Clear();
  935. for (int i = 0; i < 100; i++) //取得所有元素列表
  936. {
  937. string str = xmlutil.Read("M_KLLBXX", "list_str_tb_lllb_sxys", "YS" + i.ToString());
  938. if (str == null)
  939. {
  940. break;
  941. }
  942. else
  943. {
  944. m_mbszclass.M_KLLBXX.list_str_tb_lllb_sxys.Add(str);
  945. }
  946. }
  947. m_mbszclass.M_KLLBXX.str_cb_kllb_sort_p1 = Convert.ToString(xmlutil.Read("M_KLLBXX", "str_cb_kllb_sort_p1"));//颗粒列表列中第一个可选参数
  948. m_mbszclass.M_KLLBXX.index_cb_kllb_sort_p1 = Convert.ToInt32(xmlutil.Read("M_KLLBXX", "index_cb_kllb_sort_p1"));
  949. m_mbszclass.M_KLLBXX.str_cb_kllb_sort_p2 = Convert.ToString(xmlutil.Read("M_KLLBXX", "str_cb_kllb_sort_p2"));//颗粒列表中第二个可选参数
  950. m_mbszclass.M_KLLBXX.index_cb_kllb_sort_p2 = Convert.ToInt32(xmlutil.Read("M_KLLBXX", "index_cb_kllb_sort_p2"));
  951. m_mbszclass.M_KLLBXX.str_cb_kllb_sort_p3 = Convert.ToString(xmlutil.Read("M_KLLBXX", "str_cb_kllb_sort_p3"));//颗粒列表中第三个可选参数
  952. m_mbszclass.M_KLLBXX.index_cb_kllb_sort_p3 = Convert.ToInt32(xmlutil.Read("M_KLLBXX", "index_cb_kllb_sort_p3"));
  953. m_mbszclass.M_KLLBXX.list_int_kllb_number = Convert.ToInt32(xmlutil.Read("M_KLLBXX", "list_int_kllb_number"));//保存显示颗粒数量
  954. m_mbszclass.M_KLLBXX.str_kllb_qcys = Convert.ToString(xmlutil.Read("M_KLLBXX", "str_kllb_qcys"));
  955. m_mbszclass.M_KLLBXX.list_str_kllb_qcys.Clear();
  956. for (int i = 0; i < 100; i++) //取得所有元素列表
  957. {
  958. string str = xmlutil.Read("M_KLLBXX", "list_str_kllb_qcys", "YS" + i.ToString());
  959. if (str == null)
  960. {
  961. break;
  962. }
  963. else
  964. {
  965. m_mbszclass.M_KLLBXX.list_str_kllb_qcys.Add(str);
  966. }
  967. }
  968. //m_mbszclass.M_KLLBXX.str_kllb_DeleteClass = Convert.ToString(xmlutil.Read("M_KLLBXX", "str_kllb_DeleteClass"));
  969. m_mbszclass.M_KLLBXX.list_str_kllb_DeleteClass.Clear();
  970. for (int i = 0; i < 100; i++) //取得所有元素列表
  971. {
  972. string str = xmlutil.Read("M_KLLBXX", "list_str_kllb_DeleteClass", "YS" + i.ToString());
  973. if (str == null)
  974. {
  975. break;
  976. }
  977. else
  978. {
  979. m_mbszclass.M_KLLBXX.list_str_kllb_DeleteClass.Add(str);
  980. }
  981. }
  982. m_mbszclass.M_KLLBXX.list_str_kllb_DeleteClass_Serial.Clear();
  983. for (int i = 0; i < 100; i++) //取得所有元素列表
  984. {
  985. string str = xmlutil.Read("M_KLLBXX", "list_str_kllb_DeleteClass_Serial", "YS" + i.ToString());
  986. if (str == null)
  987. {
  988. break;
  989. }
  990. else
  991. {
  992. m_mbszclass.M_KLLBXX.list_str_kllb_DeleteClass_Serial.Add(str);
  993. }
  994. }
  995. //夹杂物占比
  996. m_mbszclass.M_JZWZB.b_ck_surface = Convert.ToBoolean(xmlutil.Read("M_JZWZB", "b_ck_surface"));//夹杂物占比表
  997. m_mbszclass.M_JZWZB.b_ck_chart = Convert.ToBoolean(xmlutil.Read("M_JZWZB", "b_ck_chart"));//夹杂物占比图
  998. m_mbszclass.list_str_MainPriority.Clear();
  999. for (int i = 0; i < 100; i++) //全局优先排序
  1000. {
  1001. string str = xmlutil.Read("whole", "list_str_MainPriority", "YS" + i.ToString());
  1002. if (str == null)
  1003. {
  1004. break;
  1005. }
  1006. else
  1007. {
  1008. m_mbszclass.list_str_MainPriority.Add(str);
  1009. }
  1010. }
  1011. m_mbszclass.list_str_MainPriority_Serial.Clear();
  1012. for (int i = 0; i < 100; i++) //全局优先排序
  1013. {
  1014. string str = xmlutil.Read("whole", "list_str_MainPriority_Serial", "YS" + i.ToString());
  1015. if (str == null)
  1016. {
  1017. break;
  1018. }
  1019. else
  1020. {
  1021. m_mbszclass.list_str_MainPriority_Serial.Add(str);
  1022. }
  1023. }
  1024. m_mbszclass.list_str_SecondaryPriority.Clear();
  1025. for (int i = 0; i < 100; i++) //全局次要排序
  1026. {
  1027. string str = xmlutil.Read("whole", "list_str_SecondaryPriority", "YS" + i.ToString());
  1028. if (str == null)
  1029. {
  1030. break;
  1031. }
  1032. else
  1033. {
  1034. m_mbszclass.list_str_SecondaryPriority.Add(str);
  1035. }
  1036. }
  1037. m_mbszclass.str_MainPriority = Convert.ToString(xmlutil.Read("whole", "str_MainPriority"));
  1038. m_mbszclass.str_MainPriorityID = Convert.ToString(xmlutil.Read("whole", "str_MainPriorityID"));
  1039. m_mbszclass.str_SecondaryPriority = Convert.ToString(xmlutil.Read("whole", "str_SecondaryPriority"));
  1040. m_mbszclass.M_SYXT.str_cb_syxt_ljb = Convert.ToString(xmlutil.Read("M_SYXT", "str_cb_syxt_ljb"));
  1041. m_mbszclass.M_KLFXJG.b_ck_klcc_dfl = Convert.ToBoolean(xmlutil.Read("M_KLFXJG", "b_ck_klcc_dfl"));
  1042. m_mbszclass.M_KLFXJG.b_ck_klcc_xfl = Convert.ToBoolean(xmlutil.Read("M_KLFXJG", "b_ck_klcc_xfl"));
  1043. m_mbszclass.M_DZ.Notes = Convert.ToString(xmlutil.Read("M_DZ", "Notes"));
  1044. m_mbszclass.M_VDA19.IsVDA19 = Convert.ToBoolean(xmlutil.Read("M_VDA19", "IsVDA19"));
  1045. if (m_ReportApp.m_RptConfigFile.Systype != OTS_SysType_ID.IncA)
  1046. GroupSelectionConfiguration();
  1047. }
  1048. #region 加载组
  1049. /// <summary>
  1050. /// 组加载配置
  1051. /// </summary>
  1052. private void GroupSelectionConfiguration()
  1053. {
  1054. ResultFile resfile = m_ReportApp.m_rstDataMgr.ResultFilesList[m_ReportApp.m_rstDataMgr.GetWorkingResultId()];
  1055. string str_libraryName = resfile.GetSTDName();
  1056. bool endsWithDb = str_libraryName.EndsWith(".db", StringComparison.OrdinalIgnoreCase);
  1057. string fullPathR = "";
  1058. if (endsWithDb)
  1059. {
  1060. fullPathR = m_ReportApp.m_rstDataMgr.CurResultFile.FilePath + "\\" + str_libraryName;
  1061. }
  1062. else
  1063. {
  1064. fullPathR = m_ReportApp.m_rstDataMgr.CurResultFile.FilePath + "\\" + str_libraryName + ".db";
  1065. }
  1066. ParticleData particleData = new ParticleData();
  1067. m_mbszclass.RuleGroup = particleData.ObtainParticleCategory_start(fullPathR);
  1068. m_mbszclass.List_data = particleData.ObtainRuleData_start(m_mbszclass.RuleGroup, fullPathR);
  1069. string[] Separator = { " , " };
  1070. string[] parts = m_mbszclass.str_MainPriorityID.ToString().Split(Separator, StringSplitOptions.RemoveEmptyEntries);
  1071. List<string> strings1 = new List<string>();
  1072. for (int i = 0; i < parts.Length; i++)
  1073. {
  1074. string[] strss = parts[i].ToString().Split(':');
  1075. bool bl = false;
  1076. for (int a = 0; a < strings1.Count; a++)
  1077. {
  1078. if (strings1[a] == strss[0])
  1079. {
  1080. bl = true;
  1081. }
  1082. }
  1083. if (!bl)
  1084. {
  1085. strings1.Add(strss[0]);
  1086. }
  1087. }
  1088. //循环每个组
  1089. for (int i = 0; i < m_mbszclass.List_data.Count; i++)
  1090. {
  1091. string groupID = m_mbszclass.List_data[i].TableName;
  1092. for (int j = 0; j < strings1.Count; j++)
  1093. {
  1094. if (m_mbszclass.List_data[i].TableName.ToString() == strings1[j])
  1095. {
  1096. m_mbszclass.RuleGroup.Rows[i]["display"] = "1";
  1097. }
  1098. }
  1099. //循环当前组中的规则
  1100. for (int a = 0; a < m_mbszclass.List_data[i].Rows.Count; a++)
  1101. {
  1102. //循环记录勾选的规则信息
  1103. for (int j = 0; j < parts.Length; j++)
  1104. {
  1105. string[] strss = parts[j].ToString().Split(':');
  1106. if (m_mbszclass.List_data[i].Rows[a]["STDId"].ToString() == strss[1])
  1107. {
  1108. m_mbszclass.List_data[i].Rows[a]["display"] = 1;
  1109. }
  1110. }
  1111. }
  1112. }
  1113. UpdateRuleSelectionDisplay(m_mbszclass.RuleGroup, m_mbszclass.List_data);
  1114. }
  1115. private void UpdateRuleSelectionDisplay(DataTable RuleGroup, List<DataTable> List_data)
  1116. {
  1117. string RuleFormation = "";
  1118. //循环所有分组名称
  1119. for (int i = 0; i < RuleGroup.Rows.Count; i++)
  1120. {
  1121. //判断分组是否选中
  1122. if (RuleGroup.Rows[i]["display"].ToString() == "1")
  1123. {
  1124. //循环选中的分组列表信息
  1125. for (int a = 0; a < List_data.Count; a++)
  1126. {
  1127. //判断当前组的ID和当前分组列表的名称(分组名称和分组ID一致)
  1128. if (RuleGroup.Rows[i]["GroupId"].ToString() == List_data[a].TableName)
  1129. {
  1130. //循环当前分组列表的规则
  1131. for (int j = 0; j < List_data[a].Rows.Count; j++)
  1132. {
  1133. if (List_data[a].Rows[j]["display"].ToString() == "1")
  1134. {
  1135. if (RuleFormation == "")
  1136. {
  1137. RuleFormation = RuleFormation + RuleGroup.Rows[i]["GroupName"].ToString() + ":" + List_data[a].Rows[j]["StrName"].ToString();
  1138. }
  1139. else
  1140. {
  1141. RuleFormation = RuleFormation + " , " + RuleGroup.Rows[i]["GroupName"].ToString() + ":" + List_data[a].Rows[j]["StrName"].ToString();
  1142. }
  1143. }
  1144. }
  1145. }
  1146. }
  1147. }
  1148. }
  1149. }
  1150. #endregion
  1151. #endregion
  1152. private void button7_Click(object sender, EventArgs e)
  1153. {
  1154. m_ReportApp.m_rstDataMgr.SetWorkingResultId(cbo_sjy.SelectedIndex);
  1155. OTSReport_criterion criterion = new OTSReport_criterion(m_export_reporttemplate, GB_Report,this);
  1156. criterion.Sample_order = cbo_sjy.SelectedIndex;
  1157. criterion.ShowDialog();
  1158. }
  1159. private void OTSReport_Export_FormClosed(object sender, FormClosedEventArgs e)
  1160. {
  1161. }
  1162. private void ReadClassificationNo()
  1163. {
  1164. LibraryName.Clear();
  1165. string MeasurementFiles = System.IO.Directory.GetCurrentDirectory() + "\\Config\\SysData";
  1166. // 获取文件夹中的所有文件信息
  1167. List<string> getNameM = GetDbFilesInDirectory(MeasurementFiles);
  1168. // 遍历文件信息数组并打印出文件名
  1169. for (int i = 0; i < getNameM.Count; i++)
  1170. {
  1171. string[] vs = new string[] { getNameM[i], MeasurementFiles + "\\" + getNameM[i] };
  1172. LibraryName.Add(vs);
  1173. }
  1174. if ( m_mbszclass.M_SY.StandardLibraryName == "NoSTDDB.db")
  1175. {
  1176. m_mbszclass.M_SY.StandardLibraryName = "";
  1177. }
  1178. }
  1179. private void ReadClassification()
  1180. {
  1181. LibraryName.Clear();
  1182. string fullPathM = "";
  1183. string fullPathR = "";
  1184. ResultFile resfile = m_ReportApp.m_rstDataMgr.ResultFilesList[m_ReportApp.m_rstDataMgr.GetWorkingResultId()];
  1185. string str_libraryName = resfile.GetSTDName();
  1186. bool endsWithDb = str_libraryName.EndsWith(".db", StringComparison.OrdinalIgnoreCase);
  1187. if(!endsWithDb)
  1188. {
  1189. str_libraryName = str_libraryName + ".db";
  1190. }
  1191. try
  1192. {
  1193. fullPathR = m_ReportApp.m_rstDataMgr.CurResultFile.FilePath + "\\" + str_libraryName /*+ ".db"*/;
  1194. string ReportFile = m_ReportApp.m_rstDataMgr.CurResultFile.FilePath;
  1195. // 获取文件夹中的所有文件信息
  1196. List<string> getNameR = GetDbFilesInDirectory(ReportFile);
  1197. for (int i = 0; i < getNameR.Count; i++)
  1198. {
  1199. string[] vs = new string[] { getNameR[i], ReportFile + "\\" + getNameR[i] };
  1200. LibraryName.Add(vs);
  1201. }
  1202. }
  1203. catch
  1204. {
  1205. }
  1206. try
  1207. {
  1208. fullPathM = System.IO.Directory.GetCurrentDirectory() + "\\Config\\SysData\\" + str_libraryName /*+ ".db"*/;
  1209. string MeasurementFiles = System.IO.Directory.GetCurrentDirectory() + "\\Config\\SysData";
  1210. // 获取文件夹中的所有文件信息
  1211. List<string> getNameM = GetDbFilesInDirectory(MeasurementFiles);
  1212. // 遍历文件信息数组并打印出文件名
  1213. for (int i = 0; i < getNameM.Count; i++)
  1214. {
  1215. string[] vs = new string[] { getNameM[i], MeasurementFiles + "\\" + getNameM[i] };
  1216. LibraryName.Add(vs);
  1217. }
  1218. }
  1219. catch
  1220. {
  1221. }
  1222. if (str_libraryName == "NoSTDDB.db" || m_mbszclass.M_SY.StandardLibraryName== "NoSTDDB.db")
  1223. {
  1224. m_mbszclass.M_SY.StandardLibraryName = "";
  1225. }
  1226. else
  1227. {
  1228. if (System.IO.File.Exists(fullPathR))
  1229. {
  1230. return;
  1231. }
  1232. else if (System.IO.File.Exists(fullPathM))
  1233. {
  1234. return;
  1235. }
  1236. else
  1237. {
  1238. MessageBox.Show(table["library_does_not_match"].ToString());
  1239. }
  1240. }
  1241. }
  1242. static List<string> GetDbFilesInDirectory(string directoryPath)
  1243. {
  1244. List<string> files = new List<string>();
  1245. // 使用搜索模式 "*.db" 来查找所有.db文件
  1246. string[] allDbFiles = Directory.GetFiles(directoryPath, "*.db");
  1247. // 将找到的文件名添加到列表中
  1248. files.AddRange(allDbFiles.Select(Path.GetFileName)); // 如果只需要文件名,而不是完整路径
  1249. // 如果你需要文件的完整路径,可以直接返回 allDbFiles 数组(转换为List<string>)
  1250. // return allDbFiles.ToList();
  1251. return files;
  1252. }
  1253. private void button_export6156_Click(object sender, EventArgs e)
  1254. {
  1255. //XtraReport_yb6156 Report_yb6156= new XtraReport_yb6156();
  1256. //DevExpress.XtraReports.UI.ReportPrintTool tool = new DevExpress.XtraReports.UI.ReportPrintTool(Report_yb6156);
  1257. //tool.ShowPreview();
  1258. }
  1259. }
  1260. }