OTSReport_Export.cs 56 KB

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