OTSReport_Export.cs 56 KB

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