OTSReport_Export.cs 56 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473
  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. try
  663. {
  664. if (m_mbszclass.M_VDA19.IsVDA19)
  665. {
  666. double d1 = Convert.ToDouble(Serial / total) * 100.0;
  667. Serial++;
  668. richTextBox1.SelectionColor = Color.Black;
  669. richTextBox1.SelectionStart = 0; // 设置选择开始位置
  670. richTextBox1.AppendText(table["tcleannessa"].ToString() + "\n");
  671. richTextBox1.AppendText(table["loading"].ToString() + Math.Round(d1, length).ToString() + "%\n");
  672. DEVReport.SetTCleannessA();
  673. richTextBox1.ScrollToCaret();
  674. }
  675. }
  676. catch
  677. {
  678. richTextBox1.SelectionColor = Color.Red;
  679. richTextBox1.AppendText(table["tcleannessa_fail"].ToString() + "\n");
  680. return;
  681. }
  682. // 执行后台任务...
  683. try
  684. {
  685. if (m_mbszclass.M_KLFXJG.b_ck_klcc_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["particle_size"].ToString() + "\n");
  692. richTextBox1.AppendText(table["loading"].ToString() + Math.Round(d1, length).ToString() + "%\n");
  693. DEVReport.setParticleSizeTable(m_mbszclass);
  694. richTextBox1.ScrollToCaret();
  695. }
  696. }
  697. catch
  698. {
  699. richTextBox1.SelectionColor = Color.Red;
  700. richTextBox1.AppendText(table["particle_size_fail"].ToString() + "\n");
  701. return;
  702. }
  703. try
  704. {
  705. if (m_mbszclass.M_YSFXJG.b_ck_ysfx_xsmk)//元素分析表
  706. {
  707. double d1 = Convert.ToDouble(Serial / total) * 100.0;
  708. Serial++;
  709. richTextBox1.SelectionColor = Color.Black;
  710. richTextBox1.SelectionStart = 0; // 设置选择开始位置
  711. richTextBox1.AppendText(table["elemental_analysis"].ToString() + "\n");
  712. richTextBox1.AppendText(table["loading"].ToString() + Math.Round(d1, length).ToString() + "%\n");
  713. DEVReport.XRPageBreak();
  714. DEVReport.setElementAvgGrid();
  715. richTextBox1.ScrollToCaret();
  716. }
  717. }
  718. catch
  719. {
  720. richTextBox1.SelectionColor = Color.Red;
  721. richTextBox1.AppendText(table["elemental_analysis_fail"].ToString() + "\n");
  722. return;
  723. }
  724. try
  725. {
  726. if (m_mbszclass.M_JZWZB.b_ck_surface)//夹杂物面积比表
  727. {
  728. double d1 = Convert.ToDouble(Serial / total) * 100.0;
  729. Serial++;
  730. richTextBox1.SelectionColor = Color.Black;
  731. richTextBox1.SelectionStart = 0; // 设置选择开始位置
  732. richTextBox1.AppendText(table["inclusion"].ToString() + "\n");
  733. richTextBox1.AppendText(table["loading"].ToString() + Math.Round(d1, length).ToString() + "%\n");
  734. DEVReport.XRPageBreak();
  735. DEVReport.setINCAtable();
  736. richTextBox1.ScrollToCaret();
  737. }
  738. }
  739. catch
  740. {
  741. richTextBox1.SelectionColor = Color.Red;
  742. richTextBox1.AppendText(table["inclusion_fail"].ToString() + "\n");
  743. return;
  744. }
  745. try
  746. {
  747. if (m_mbszclass.M_JZWZB.b_ck_surface)
  748. {
  749. if (m_mbszclass.M_KLFXJG.b_ck_klcc_dfl == true || m_mbszclass.M_KLFXJG.b_ck_klcc_xfl == true)
  750. {
  751. double d1 = Convert.ToDouble(Serial / total) * 100.0;
  752. Serial++;
  753. richTextBox1.SelectionColor = Color.Black;
  754. richTextBox1.SelectionStart = 0; // 设置选择开始位置
  755. richTextBox1.AppendText(table["inclusion_chart"].ToString() + "\n");
  756. richTextBox1.AppendText(table["loading"].ToString() + Math.Round(d1, length).ToString() + "%\n");
  757. DEVReport.XRPageBreak();
  758. DEVReport.set_incaPIC_classify(m_mbszclass);
  759. DEVReport.set_incaPIC_subdivision(m_mbszclass);
  760. richTextBox1.ScrollToCaret();
  761. }
  762. }
  763. }
  764. catch
  765. {
  766. richTextBox1.SelectionColor = Color.Red;
  767. richTextBox1.AppendText(table["inclusion_chart_fail"].ToString() + "\n");
  768. return;
  769. }
  770. try
  771. {
  772. if (m_mbszclass.M_SYXT.b_ck_syxt_xsmk)//三元图
  773. {
  774. double d1 = Convert.ToDouble(Serial / total) * 100.0;
  775. Serial++;
  776. richTextBox1.SelectionColor = Color.Black;
  777. richTextBox1.SelectionStart = 0; // 设置选择开始位置
  778. richTextBox1.AppendText(table["ternary_diagram"].ToString() + "\n");
  779. richTextBox1.AppendText(table["loading"].ToString() + Math.Round(d1, length).ToString() + "%\n");
  780. DEVReport.XRPageBreak();
  781. DEVReport.InsertReportTemplateChart_Trianglediagram();
  782. richTextBox1.ScrollToCaret();
  783. }
  784. }
  785. catch
  786. {
  787. richTextBox1.SelectionColor = Color.Red;
  788. richTextBox1.AppendText(table["ternary_diagram_fail"].ToString() + "\n");
  789. return;
  790. }
  791. try
  792. {
  793. if (m_mbszclass.M_KLLBXX.b_ck_kllb_xsmk)//颗粒列表
  794. {
  795. double d1 = Convert.ToDouble(Serial / total) * 100.0;
  796. Serial++;
  797. richTextBox1.SelectionColor = Color.Black;
  798. richTextBox1.SelectionStart = 0; // 设置选择开始位置
  799. richTextBox1.AppendText(table["particle_list"].ToString() + "\n");
  800. richTextBox1.AppendText(table["loading"].ToString() + Math.Round(d1, length).ToString() + "%\n");
  801. //DEVReport.XRPageBreak();
  802. DEVReport.set_kllb_data();
  803. richTextBox1.ScrollToCaret();
  804. }
  805. }
  806. catch
  807. {
  808. richTextBox1.SelectionColor = Color.Red;
  809. richTextBox1.AppendText(table["particle_list_fail"].ToString() + "\n");
  810. return;
  811. }
  812. try
  813. {
  814. if (m_mbszclass.M_KLLBXX.b_ck_kllb_fjzt)//颗粒帧图列表
  815. {
  816. double d1 = Convert.ToDouble(Serial / total) * 100.0;
  817. Serial++;
  818. richTextBox1.SelectionColor = Color.Black;
  819. richTextBox1.SelectionStart = 0; // 设置选择开始位置
  820. richTextBox1.AppendText(table["particle_list_chart"].ToString() + "\n");
  821. richTextBox1.AppendText(table["loading"].ToString() + Math.Round(d1, length).ToString() + "%\n");
  822. //DEVReport.XRPageBreak();
  823. DEVReport.set_kllb_data_frame();
  824. richTextBox1.ScrollToCaret();
  825. }
  826. }
  827. catch
  828. {
  829. richTextBox1.SelectionColor = Color.Red;
  830. richTextBox1.AppendText(table["particle_list_chart_fail"].ToString() + "\n");
  831. return;
  832. }
  833. richTextBox1.SelectionColor = Color.Red;
  834. richTextBox1.AppendText(table["complete"].ToString() + "\n");
  835. richTextBox1.ScrollToCaret();
  836. }
  837. #endregion
  838. #region 读取文件
  839. private void LoadControlsToXml()
  840. {
  841. string strpath;
  842. if (m_ReportApp.m_RptConfigFile.Systype == OTS_SysType_ID.BatteryCleannessA)
  843. strpath = Application.StartupPath + "\\Config\\ReportTemplate\\CleannessA_Template\\" + fileName;
  844. else if (m_ReportApp.m_RptConfigFile.Systype == OTS_SysType_ID.IncA)
  845. strpath = Application.StartupPath + "\\Config\\ReportTemplate\\Inca_Template\\" + fileName;
  846. else
  847. strpath = Application.StartupPath + "\\Config\\ReportTemplate\\TCleannessA_Template\\" + fileName;
  848. tb_mblj.Text = fileName;
  849. OTSIncAReportApp.Controls.XmlOperateUtil xmlutil = new OTSIncAReportApp.Controls.XmlOperateUtil(strpath);
  850. //首页
  851. m_mbszclass.M_SY.str_tb_ZBT = xmlutil.Read("M_SY", "str_tb_ZBT");
  852. m_mbszclass.M_SY.str_tb_FBT = xmlutil.Read("M_SY", "str_tb_FBT");
  853. m_mbszclass.M_SY.str_tb_YPBH = xmlutil.Read("M_SY", "str_tb_YPBH");
  854. m_mbszclass.M_SY.str_tb_SampleName = xmlutil.Read("M_SY", "str_tb_SampleName");
  855. m_mbszclass.M_SY.str_tb_CKBZ = xmlutil.Read("M_SY", "str_tb_CKBZ");
  856. m_mbszclass.M_SY.b_ck_ypsm = Convert.ToBoolean(xmlutil.Read("M_SY", "b_ck_ypsm"));
  857. m_mbszclass.M_SY.LOGName = xmlutil.Read("M_SY", "LOGName");
  858. m_mbszclass.M_SY.StandardLibraryName= xmlutil.Read("M_SY", "StandardLibraryName");
  859. m_mbszclass.M_SY.str_tb_djsb= xmlutil.Read("M_SY", "str_tb_djsb");
  860. m_mbszclass.M_SY.str_tb_npsb= xmlutil.Read("M_SY", "str_tb_npsb");
  861. if (m_mbszclass.M_SY.LOGName == null || m_mbszclass.M_SY.LOGName == "")
  862. {
  863. m_mbszclass.M_SY.LOGName = "ReportIdentification.bmp";
  864. }
  865. //页眉页脚
  866. m_mbszclass.M_YMYJ.str_tb_ymwb = xmlutil.Read("M_YMYJ", "str_tb_ymwb");
  867. m_mbszclass.M_YMYJ.str_tb_KHH = xmlutil.Read("M_YMYJ", "str_tb_KHH");
  868. //m_mbszclass.M_YMYJ.b_ck_ym = Convert.ToBoolean(xmlutil.Read("M_YMYJ", "b_ck_ym"));
  869. m_mbszclass.M_YMYJ.str_tb_yjwb = xmlutil.Read("M_YMYJ", "str_tb_yjwb");
  870. //颗粒分析结果
  871. m_mbszclass.M_KLFXJG.b_ck_klcc_xsmk = Convert.ToBoolean(xmlutil.Read("M_KLFXJG", "b_ck_klcc_xsmk"));//是否显示模块
  872. m_mbszclass.M_KLFXJG.b_ck_klcc_xsddt = Convert.ToBoolean(xmlutil.Read("M_KLFXJG", "b_ck_klcc_xsddt"));
  873. m_mbszclass.M_KLFXJG.index_cb_klcc_klfw = Convert.ToInt32(xmlutil.Read("M_KLFXJG", "index_cb_klcc_klfw"));//颗粒范围
  874. m_mbszclass.M_KLFXJG.b_cb_jzwfl_xsmk = Convert.ToBoolean(xmlutil.Read("M_KLFXJG", "b_cb_jzwfl_xsmk"));//是否显示该模块
  875. m_mbszclass.M_KLFXJG.index_cb_jzwfl_xstx = Convert.ToInt32(xmlutil.Read("M_KLFXJG", "index_cb_jzwfl_xstx"));//选择图像
  876. m_mbszclass.M_KLFXJG.index_cb_jzwfl_jsfs = Convert.ToInt32(xmlutil.Read("M_KLFXJG", "index_cb_jzwfl_jsfs"));//计算方式
  877. m_mbszclass.M_KLFXJG.index_cb_jzwfl_ljb = Convert.ToInt32(xmlutil.Read("M_KLFXJG", "index_cb_jzwfl_ljb"));//粒级表
  878. m_mbszclass.M_KLFXJG.index_cb_jzwfl_klfw = Convert.ToInt32(xmlutil.Read("M_KLFXJG", "index_cb_jzwfl_klfw"));//颗粒范围
  879. //元素分析结果
  880. m_mbszclass.M_YSFXJG.b_ck_ysfx_xsmk = Convert.ToBoolean(xmlutil.Read("M_YSFXJG", "b_ck_ysfx_xsmk")); //是否显示模块
  881. m_mbszclass.M_YSFXJG.index_cb_yxfx_jsfs = Convert.ToInt32(xmlutil.Read("M_YSFXJG", "index_cb_yxfx_jsfs")); //计算方式
  882. m_mbszclass.M_YSFXJG.index_cb_ysfx_klfw = Convert.ToInt32(xmlutil.Read("M_YSFXJG", "index_cb_ysfx_klfw")); //颗粒范围
  883. m_mbszclass.M_YSFXJG.str_tb_ysfx_xsys = xmlutil.Read("M_YSFXJG", "str_tb_ysfx_xsys"); //显示元素
  884. m_mbszclass.M_KLFXJG.ParticleSizeGraphicSelection= Convert.ToInt32(xmlutil.Read("M_KLFXJG", "ParticleSizeGraphicSelection"));
  885. m_mbszclass.M_KLFXJG.INCAGraphicSelection = Convert.ToInt32(xmlutil.Read("M_KLFXJG", "INCAGraphicSelection"));
  886. m_mbszclass.M_YSFXJG.list_str_tb_ysfx_xsys.Clear();
  887. for (int i = 0; i < 100; i++) //取得所有元素列表
  888. {
  889. string str = xmlutil.Read("M_YSFXJG", "list_str_tb_ysfx_xsys", "YS" + i.ToString());
  890. if (str == null)
  891. {
  892. break;
  893. }
  894. else
  895. {
  896. m_mbszclass.M_YSFXJG.list_str_tb_ysfx_xsys.Add(str);
  897. }
  898. }
  899. m_mbszclass.M_YSFXJG.b_ck_yscf_xsmk = Convert.ToBoolean(xmlutil.Read("M_YSFXJG", "b_ck_yscf_xsmk")); //是否显示模块
  900. m_mbszclass.M_YSFXJG.index_cb_yscf_xstx = Convert.ToInt32(xmlutil.Read("M_YSFXJG", "index_cb_yscf_xstx")); //显示图形
  901. m_mbszclass.M_YSFXJG.index_cb_yscf_jsfs = Convert.ToInt32(xmlutil.Read("M_YSFXJG", "index_cb_yscf_jsfs")); //计算方式
  902. m_mbszclass.M_YSFXJG.index_cb_yscf_klfw = Convert.ToInt32(xmlutil.Read("M_YSFXJG", "index_cb_yscf_klfw")); //颗粒范围
  903. m_mbszclass.M_YSFXJG.str_tb_yscf_ysxx = xmlutil.Read("M_YSFXJG", "str_tb_yscf_ysxx"); //显示元素
  904. m_mbszclass.M_YSFXJG.list_str_tb_yscf_ysxx.Clear();
  905. for (int i = 0; i < 100; i++) //取得所有元素列表
  906. {
  907. string str = xmlutil.Read("M_YSFXJG", "list_str_tb_yscf_ysxx", "YS" + i.ToString());
  908. if (str == null)
  909. {
  910. break;
  911. }
  912. else
  913. {
  914. m_mbszclass.M_YSFXJG.list_str_tb_yscf_ysxx.Add(str);
  915. }
  916. }
  917. //三元相图
  918. m_mbszclass.M_SYXT.b_ck_syxt_xsmk = Convert.ToBoolean(xmlutil.Read("M_SYXT", "b_ck_syxt_xsmk")); //是否显示模块
  919. m_mbszclass.M_SYXT.index_cb_syxt_jsfs = Convert.ToInt32(xmlutil.Read("M_SYXT", "index_cb_syxt_jsfs")); //计算方式
  920. m_mbszclass.M_SYXT.index_cb_syxt_klfw = Convert.ToInt32(xmlutil.Read("M_SYXT", "index_cb_syxt_klfw")); //颗粒范围
  921. m_mbszclass.M_SYXT.str_cb_syxt_mhxssl = xmlutil.Read("M_SYXT", "str_cb_syxt_mhxssl"); //每行显示数量
  922. m_mbszclass.M_SYXT.list_lbv_syxt_mblb.Clear();
  923. for (int i = 0; i < 100; i++) //取得所有模板列表
  924. {
  925. string str = xmlutil.Read("M_SYXT", "list_lbv_syxt_mblb", "MB" + i.ToString());
  926. if (str == null)
  927. {
  928. break;
  929. }
  930. else
  931. {
  932. m_mbszclass.M_SYXT.list_lbv_syxt_mblb.Add(str);
  933. }
  934. }
  935. m_mbszclass.M_SYXT.list_lbv_syxt_mblb_index.Clear();
  936. for (int i = 0; i < 100; i++) //取得所有模板列表 索引
  937. {
  938. string str = xmlutil.Read("M_SYXT", "list_lbv_syxt_mblb_index", "MBIndex" + i.ToString());
  939. if (str == null)
  940. {
  941. break;
  942. }
  943. else
  944. {
  945. m_mbszclass.M_SYXT.list_lbv_syxt_mblb_index.Add(Convert.ToInt32(str));
  946. }
  947. }
  948. //颗粒列表信息
  949. m_mbszclass.M_KLLBXX.b_ck_kllb_xsmk = Convert.ToBoolean(xmlutil.Read("M_KLLBXX", "b_ck_kllb_xsmk")); //是否显示模块
  950. m_mbszclass.M_KLLBXX.index_cb_kllb_jsfs = Convert.ToInt32(xmlutil.Read("M_KLLBXX", "index_cb_kllb_jsfs")); //计算方式
  951. m_mbszclass.M_KLLBXX.index_cb_kllb_klfw = Convert.ToInt32(xmlutil.Read("M_KLLBXX", "index_cb_kllb_klfw")); //颗粒范围
  952. m_mbszclass.M_KLLBXX.str_tb_kllb_sxys = xmlutil.Read("M_KLLBXX", "str_tb_kllb_sxys"); //显示元素
  953. m_mbszclass.M_KLLBXX.b_ck_kllb_fjzt = Convert.ToBoolean(xmlutil.Read("M_KLLBXX", "b_ck_kllb_fjzt"));
  954. m_mbszclass.M_KLLBXX.list_str_tb_lllb_sxys.Clear();
  955. for (int i = 0; i < 100; i++) //取得所有元素列表
  956. {
  957. string str = xmlutil.Read("M_KLLBXX", "list_str_tb_lllb_sxys", "YS" + i.ToString());
  958. if (str == null)
  959. {
  960. break;
  961. }
  962. else
  963. {
  964. m_mbszclass.M_KLLBXX.list_str_tb_lllb_sxys.Add(str);
  965. }
  966. }
  967. m_mbszclass.M_KLLBXX.str_cb_kllb_sort_p1 = Convert.ToString(xmlutil.Read("M_KLLBXX", "str_cb_kllb_sort_p1"));//颗粒列表列中第一个可选参数
  968. m_mbszclass.M_KLLBXX.index_cb_kllb_sort_p1 = Convert.ToInt32(xmlutil.Read("M_KLLBXX", "index_cb_kllb_sort_p1"));
  969. m_mbszclass.M_KLLBXX.str_cb_kllb_sort_p2 = Convert.ToString(xmlutil.Read("M_KLLBXX", "str_cb_kllb_sort_p2"));//颗粒列表中第二个可选参数
  970. m_mbszclass.M_KLLBXX.index_cb_kllb_sort_p2 = Convert.ToInt32(xmlutil.Read("M_KLLBXX", "index_cb_kllb_sort_p2"));
  971. m_mbszclass.M_KLLBXX.str_cb_kllb_sort_p3 = Convert.ToString(xmlutil.Read("M_KLLBXX", "str_cb_kllb_sort_p3"));//颗粒列表中第三个可选参数
  972. m_mbszclass.M_KLLBXX.index_cb_kllb_sort_p3 = Convert.ToInt32(xmlutil.Read("M_KLLBXX", "index_cb_kllb_sort_p3"));
  973. m_mbszclass.M_KLLBXX.list_int_kllb_number = Convert.ToInt32(xmlutil.Read("M_KLLBXX", "list_int_kllb_number"));//保存显示颗粒数量
  974. m_mbszclass.M_KLLBXX.str_kllb_qcys = Convert.ToString(xmlutil.Read("M_KLLBXX", "str_kllb_qcys"));
  975. m_mbszclass.M_KLLBXX.list_str_kllb_qcys.Clear();
  976. for (int i = 0; i < 100; i++) //取得所有元素列表
  977. {
  978. string str = xmlutil.Read("M_KLLBXX", "list_str_kllb_qcys", "YS" + i.ToString());
  979. if (str == null)
  980. {
  981. break;
  982. }
  983. else
  984. {
  985. m_mbszclass.M_KLLBXX.list_str_kllb_qcys.Add(str);
  986. }
  987. }
  988. //m_mbszclass.M_KLLBXX.str_kllb_DeleteClass = Convert.ToString(xmlutil.Read("M_KLLBXX", "str_kllb_DeleteClass"));
  989. m_mbszclass.M_KLLBXX.list_str_kllb_DeleteClass.Clear();
  990. for (int i = 0; i < 100; i++) //取得所有元素列表
  991. {
  992. string str = xmlutil.Read("M_KLLBXX", "list_str_kllb_DeleteClass", "YS" + i.ToString());
  993. if (str == null)
  994. {
  995. break;
  996. }
  997. else
  998. {
  999. m_mbszclass.M_KLLBXX.list_str_kllb_DeleteClass.Add(str);
  1000. }
  1001. }
  1002. m_mbszclass.M_KLLBXX.list_str_kllb_DeleteClass_Serial.Clear();
  1003. for (int i = 0; i < 100; i++) //取得所有元素列表
  1004. {
  1005. string str = xmlutil.Read("M_KLLBXX", "list_str_kllb_DeleteClass_Serial", "YS" + i.ToString());
  1006. if (str == null)
  1007. {
  1008. break;
  1009. }
  1010. else
  1011. {
  1012. m_mbszclass.M_KLLBXX.list_str_kllb_DeleteClass_Serial.Add(str);
  1013. }
  1014. }
  1015. //夹杂物占比
  1016. m_mbszclass.M_JZWZB.b_ck_surface = Convert.ToBoolean(xmlutil.Read("M_JZWZB", "b_ck_surface"));//夹杂物占比表
  1017. m_mbszclass.M_JZWZB.b_ck_chart = Convert.ToBoolean(xmlutil.Read("M_JZWZB", "b_ck_chart"));//夹杂物占比图
  1018. m_mbszclass.list_str_MainPriority.Clear();
  1019. for (int i = 0; i < 100; i++) //全局优先排序
  1020. {
  1021. string str = xmlutil.Read("whole", "list_str_MainPriority", "YS" + i.ToString());
  1022. if (str == null)
  1023. {
  1024. break;
  1025. }
  1026. else
  1027. {
  1028. m_mbszclass.list_str_MainPriority.Add(str);
  1029. }
  1030. }
  1031. m_mbszclass.list_str_MainPriority_Serial.Clear();
  1032. for (int i = 0; i < 100; i++) //全局优先排序
  1033. {
  1034. string str = xmlutil.Read("whole", "list_str_MainPriority_Serial", "YS" + i.ToString());
  1035. if (str == null)
  1036. {
  1037. break;
  1038. }
  1039. else
  1040. {
  1041. m_mbszclass.list_str_MainPriority_Serial.Add(str);
  1042. }
  1043. }
  1044. m_mbszclass.list_str_SecondaryPriority.Clear();
  1045. for (int i = 0; i < 100; i++) //全局次要排序
  1046. {
  1047. string str = xmlutil.Read("whole", "list_str_SecondaryPriority", "YS" + i.ToString());
  1048. if (str == null)
  1049. {
  1050. break;
  1051. }
  1052. else
  1053. {
  1054. m_mbszclass.list_str_SecondaryPriority.Add(str);
  1055. }
  1056. }
  1057. m_mbszclass.str_MainPriority = Convert.ToString(xmlutil.Read("whole", "str_MainPriority"));
  1058. m_mbszclass.str_MainPriorityID = Convert.ToString(xmlutil.Read("whole", "str_MainPriorityID"));
  1059. m_mbszclass.str_SecondaryPriority = Convert.ToString(xmlutil.Read("whole", "str_SecondaryPriority"));
  1060. m_mbszclass.M_SYXT.str_cb_syxt_ljb = Convert.ToString(xmlutil.Read("M_SYXT", "str_cb_syxt_ljb"));
  1061. m_mbszclass.M_KLFXJG.b_ck_klcc_dfl = Convert.ToBoolean(xmlutil.Read("M_KLFXJG", "b_ck_klcc_dfl"));
  1062. m_mbszclass.M_KLFXJG.b_ck_klcc_xfl = Convert.ToBoolean(xmlutil.Read("M_KLFXJG", "b_ck_klcc_xfl"));
  1063. m_mbszclass.M_DZ.Notes = Convert.ToString(xmlutil.Read("M_DZ", "Notes"));
  1064. m_mbszclass.M_VDA19.IsVDA19 = Convert.ToBoolean(xmlutil.Read("M_VDA19", "IsVDA19"));
  1065. if (m_ReportApp.m_RptConfigFile.Systype != OTS_SysType_ID.IncA)
  1066. GroupSelectionConfiguration();
  1067. }
  1068. #region 加载组
  1069. /// <summary>
  1070. /// 组加载配置
  1071. /// </summary>
  1072. private void GroupSelectionConfiguration()
  1073. {
  1074. ResultFile resfile = m_ReportApp.m_rstDataMgr.ResultFilesList[m_ReportApp.m_rstDataMgr.GetWorkingResultId()];
  1075. string str_libraryName = resfile.GetSTDName();
  1076. bool endsWithDb = str_libraryName.EndsWith(".db", StringComparison.OrdinalIgnoreCase);
  1077. string fullPathR = "";
  1078. if (endsWithDb)
  1079. {
  1080. fullPathR = m_ReportApp.m_rstDataMgr.CurResultFile.FilePath + "\\" + str_libraryName;
  1081. }
  1082. else
  1083. {
  1084. fullPathR = m_ReportApp.m_rstDataMgr.CurResultFile.FilePath + "\\" + str_libraryName + ".db";
  1085. }
  1086. ParticleData particleData = new ParticleData();
  1087. m_mbszclass.RuleGroup = particleData.ObtainParticleCategory_start(fullPathR);
  1088. m_mbszclass.List_data = particleData.ObtainRuleData_start(m_mbszclass.RuleGroup, fullPathR);
  1089. string[] Separator = { " , " };
  1090. string[] parts = m_mbszclass.str_MainPriorityID.ToString().Split(Separator, StringSplitOptions.RemoveEmptyEntries);
  1091. List<string> strings1 = new List<string>();
  1092. for (int i = 0; i < parts.Length; i++)
  1093. {
  1094. string[] strss = parts[i].ToString().Split(':');
  1095. bool bl = false;
  1096. for (int a = 0; a < strings1.Count; a++)
  1097. {
  1098. if (strings1[a] == strss[0])
  1099. {
  1100. bl = true;
  1101. }
  1102. }
  1103. if (!bl)
  1104. {
  1105. strings1.Add(strss[0]);
  1106. }
  1107. }
  1108. //循环每个组
  1109. for (int i = 0; i < m_mbszclass.List_data.Count; i++)
  1110. {
  1111. string groupID = m_mbszclass.List_data[i].TableName;
  1112. for (int j = 0; j < strings1.Count; j++)
  1113. {
  1114. if (m_mbszclass.List_data[i].TableName.ToString() == strings1[j])
  1115. {
  1116. m_mbszclass.RuleGroup.Rows[i]["display"] = "1";
  1117. }
  1118. }
  1119. //循环当前组中的规则
  1120. for (int a = 0; a < m_mbszclass.List_data[i].Rows.Count; a++)
  1121. {
  1122. //循环记录勾选的规则信息
  1123. for (int j = 0; j < parts.Length; j++)
  1124. {
  1125. string[] strss = parts[j].ToString().Split(':');
  1126. if (m_mbszclass.List_data[i].Rows[a]["STDId"].ToString() == strss[1])
  1127. {
  1128. m_mbszclass.List_data[i].Rows[a]["display"] = 1;
  1129. }
  1130. }
  1131. }
  1132. }
  1133. UpdateRuleSelectionDisplay(m_mbszclass.RuleGroup, m_mbszclass.List_data);
  1134. }
  1135. private void UpdateRuleSelectionDisplay(DataTable RuleGroup, List<DataTable> List_data)
  1136. {
  1137. string RuleFormation = "";
  1138. //循环所有分组名称
  1139. for (int i = 0; i < RuleGroup.Rows.Count; i++)
  1140. {
  1141. //判断分组是否选中
  1142. if (RuleGroup.Rows[i]["display"].ToString() == "1")
  1143. {
  1144. //循环选中的分组列表信息
  1145. for (int a = 0; a < List_data.Count; a++)
  1146. {
  1147. //判断当前组的ID和当前分组列表的名称(分组名称和分组ID一致)
  1148. if (RuleGroup.Rows[i]["GroupId"].ToString() == List_data[a].TableName)
  1149. {
  1150. //循环当前分组列表的规则
  1151. for (int j = 0; j < List_data[a].Rows.Count; j++)
  1152. {
  1153. if (List_data[a].Rows[j]["display"].ToString() == "1")
  1154. {
  1155. if (RuleFormation == "")
  1156. {
  1157. RuleFormation = RuleFormation + RuleGroup.Rows[i]["GroupName"].ToString() + ":" + List_data[a].Rows[j]["StrName"].ToString();
  1158. }
  1159. else
  1160. {
  1161. RuleFormation = RuleFormation + " , " + RuleGroup.Rows[i]["GroupName"].ToString() + ":" + List_data[a].Rows[j]["StrName"].ToString();
  1162. }
  1163. }
  1164. }
  1165. }
  1166. }
  1167. }
  1168. }
  1169. }
  1170. #endregion
  1171. #endregion
  1172. private void button7_Click(object sender, EventArgs e)
  1173. {
  1174. OTSReport_criterion criterion = new OTSReport_criterion(m_export_reporttemplate, GB_Report,this);
  1175. criterion.Sample_order = cbo_sjy.SelectedIndex;
  1176. criterion.ShowDialog();
  1177. }
  1178. private void OTSReport_Export_FormClosed(object sender, FormClosedEventArgs e)
  1179. {
  1180. }
  1181. private void ReadClassificationNo()
  1182. {
  1183. LibraryName.Clear();
  1184. string MeasurementFiles = System.IO.Directory.GetCurrentDirectory() + "\\Config\\SysData";
  1185. // 获取文件夹中的所有文件信息
  1186. List<string> getNameM = GetDbFilesInDirectory(MeasurementFiles);
  1187. // 遍历文件信息数组并打印出文件名
  1188. for (int i = 0; i < getNameM.Count; i++)
  1189. {
  1190. string[] vs = new string[] { getNameM[i], MeasurementFiles + "\\" + getNameM[i] };
  1191. LibraryName.Add(vs);
  1192. }
  1193. if ( m_mbszclass.M_SY.StandardLibraryName == "NoSTDDB.db")
  1194. {
  1195. m_mbszclass.M_SY.StandardLibraryName = "";
  1196. }
  1197. }
  1198. private void ReadClassification()
  1199. {
  1200. LibraryName.Clear();
  1201. string fullPathM = "";
  1202. string fullPathR = "";
  1203. ResultFile resfile = m_ReportApp.m_rstDataMgr.ResultFilesList[m_ReportApp.m_rstDataMgr.GetWorkingResultId()];
  1204. string str_libraryName = resfile.GetSTDName();
  1205. bool endsWithDb = str_libraryName.EndsWith(".db", StringComparison.OrdinalIgnoreCase);
  1206. if(!endsWithDb)
  1207. {
  1208. str_libraryName = str_libraryName + ".db";
  1209. }
  1210. try
  1211. {
  1212. fullPathR = m_ReportApp.m_rstDataMgr.CurResultFile.FilePath + "\\" + str_libraryName /*+ ".db"*/;
  1213. string ReportFile = m_ReportApp.m_rstDataMgr.CurResultFile.FilePath;
  1214. // 获取文件夹中的所有文件信息
  1215. List<string> getNameR = GetDbFilesInDirectory(ReportFile);
  1216. for (int i = 0; i < getNameR.Count; i++)
  1217. {
  1218. string[] vs = new string[] { getNameR[i], ReportFile + "\\" + getNameR[i] };
  1219. LibraryName.Add(vs);
  1220. }
  1221. }
  1222. catch
  1223. {
  1224. }
  1225. try
  1226. {
  1227. fullPathM = System.IO.Directory.GetCurrentDirectory() + "\\Config\\SysData\\" + str_libraryName /*+ ".db"*/;
  1228. string MeasurementFiles = System.IO.Directory.GetCurrentDirectory() + "\\Config\\SysData";
  1229. // 获取文件夹中的所有文件信息
  1230. List<string> getNameM = GetDbFilesInDirectory(MeasurementFiles);
  1231. // 遍历文件信息数组并打印出文件名
  1232. for (int i = 0; i < getNameM.Count; i++)
  1233. {
  1234. string[] vs = new string[] { getNameM[i], MeasurementFiles + "\\" + getNameM[i] };
  1235. LibraryName.Add(vs);
  1236. }
  1237. }
  1238. catch
  1239. {
  1240. }
  1241. if (str_libraryName == "NoSTDDB.db" || m_mbszclass.M_SY.StandardLibraryName== "NoSTDDB.db")
  1242. {
  1243. m_mbszclass.M_SY.StandardLibraryName = "";
  1244. }
  1245. else
  1246. {
  1247. if (System.IO.File.Exists(fullPathR))
  1248. {
  1249. return;
  1250. }
  1251. else if (System.IO.File.Exists(fullPathM))
  1252. {
  1253. return;
  1254. }
  1255. else
  1256. {
  1257. MessageBox.Show(table["library_does_not_match"].ToString());
  1258. }
  1259. }
  1260. }
  1261. static List<string> GetDbFilesInDirectory(string directoryPath)
  1262. {
  1263. List<string> files = new List<string>();
  1264. // 使用搜索模式 "*.db" 来查找所有.db文件
  1265. string[] allDbFiles = Directory.GetFiles(directoryPath, "*.db");
  1266. // 将找到的文件名添加到列表中
  1267. files.AddRange(allDbFiles.Select(Path.GetFileName)); // 如果只需要文件名,而不是完整路径
  1268. // 如果你需要文件的完整路径,可以直接返回 allDbFiles 数组(转换为List<string>)
  1269. // return allDbFiles.ToList();
  1270. return files;
  1271. }
  1272. private void button_export6156_Click(object sender, EventArgs e)
  1273. {
  1274. //XtraReport_yb6156 Report_yb6156= new XtraReport_yb6156();
  1275. //DevExpress.XtraReports.UI.ReportPrintTool tool = new DevExpress.XtraReports.UI.ReportPrintTool(Report_yb6156);
  1276. //tool.ShowPreview();
  1277. }
  1278. }
  1279. }