123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473 |
- using OTSIncAReportApp.Controls;
- using OTSCommon.DBOperate.Model;
- using OTSIncAReportApp.OTSTemplateDesigner;
- using OTSIncAReportApp.SysMgrTools;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Drawing;
- using System.IO;
- using System.Windows.Forms;
- using OTSIncAReportApp._1_UI.OTSTemplateDesigner;
- using DevExpress.XtraReports.UI;
- using OTSIncAReportApp.ReportTemplate;
- using System.Linq;
- using static OTSDataType.otsdataconst;
- using OTSCommon.DBOperate;
- using OTSIncAReportApp.OTSRstMgrFunction;
- using static OTSIncAReportApp.OTSReport_Export.c_TemplateClass;
- using OTSIncAReportApp._1_UI.OTSReportExport;
- using OTSIncAReportApp.DataOperation.DataAccess;
- using DevExpress.CodeParser;
- using DevExpress.XtraTreeList.Data;
- namespace OTSIncAReportApp
- {
- public partial class OTSReport_Export : Form
- {
-
- #region 全局变量
- System.Collections.Hashtable table;
- public frmReportApp m_ReportApp = null; //报告项目总进程对象
- public string m_export_type = "Excel"; //导出文件的格式类型Excel,Word,Pdf
- GBData m_export_reporttemplate;
- private string SummaryInfoPath = "./Config/ReportTemplate/SummaryInfo.xml";
- private XmlOperateUtil SummaryInfoXmluti;
- private string fileName = "";
- public c_TemplateClass m_mbszclass = null;
- OTS_DEVReport DEVReport;
- GBReport GB_Report;
- public List<string[]> LibraryName = new List<string[]>();
- private bool isExport = true;
- // 获取文件夹中的所有文件信息
- List<string> GetAllFileInformation = new List<string>();
-
- #endregion
- #region 模板设置类
- /// <summary>
- /// 模板设置类
- /// </summary>
- public class c_TemplateClass
- {
-
- /// <summary>
- /// 备注信息,及路径
- /// </summary>
- public DZ M_DZ { get; set; }
- #region 属性
- /// <summary>
- /// 首页
- /// </summary>
- public SY M_SY { get; set; }
- /// <summary>
- /// 页眉页脚
- /// </summary>
- public YMYJ M_YMYJ { get; set; }
- /// <summary>
- /// 颗粒分析结果
- /// </summary>
- public KLFXJG M_KLFXJG { get; set; }
- /// <summary>
- /// 元素分析结果
- /// </summary>
- public YSFXJG M_YSFXJG { get; set; }
- /// <summary>
- /// 三元相图
- /// </summary>
- public SYXT M_SYXT { get; set; }
- /// <summary>
- /// 颗粒列表信息
- /// </summary>
- public KLLBXX M_KLLBXX { get; set; }
- /// <summary>
- /// 夹杂物占比
- /// </summary>
- public JZWZB M_JZWZB { get; set; }
- /// <summary>
- /// 汽车清洁度
- /// </summary>
- public VDA19 M_VDA19 { get; set; }
- /// <summary>
- /// 清洁度排序显示
- /// </summary>
- public string str_MainPriority { get; set; }
- /// <summary>
- /// 清洁度排序ID
- /// </summary>
- public string str_MainPriorityID { get; set; }
- /// <summary>
- /// 主要优先排序
- /// </summary>
- public List<string> list_str_MainPriority { get; set; }
- /// <summary>
- /// 主要优先排序序号
- /// </summary>
- public List<string> list_str_MainPriority_Serial { get; set; }
- /// <summary>
- /// 次要优先排序string
- /// </summary>
- public string str_SecondaryPriority { get; set; }
- /// <summary>
- /// 次要优先排序
- /// </summary>
- public List<string> list_str_SecondaryPriority { get; set; }
- /// <summary>
- /// 清洁度所有组
- /// </summary>
- public DataTable RuleGroup { get; set; }
- /// <summary>
- /// 清洁度所有组内的规则
- /// </summary>
- public List<DataTable> List_data { get; set; }
- #endregion
- #region 构造函数
- public c_TemplateClass()
- {
- M_SY = new SY();
- M_YMYJ = new YMYJ();
- M_KLFXJG = new KLFXJG();
- M_YSFXJG = new YSFXJG();
- M_YSFXJG.list_str_tb_yscf_ysxx = new List<string>();
- M_YSFXJG.list_str_tb_ysfx_xsys = new List<string>();
- M_SYXT = new SYXT();
- M_SYXT.list_lbv_syxt_mblb = new List<string>();
- M_SYXT.list_lbv_syxt_mblb_index = new List<int>();
- M_KLLBXX = new KLLBXX();
- M_JZWZB = new JZWZB();
- M_VDA19 = new VDA19();
- M_KLLBXX.list_str_tb_lllb_sxys = new List<string>();
- M_KLLBXX.list_str_kllb_qcys = new List<string>();
- M_KLLBXX.list_str_kllb_DeleteClass = new List<string>();
- M_KLLBXX.list_str_kllb_DeleteClass_Serial = new List<string>();
- M_DZ = new DZ();
- list_str_MainPriority = new List<string>();
- list_str_MainPriority_Serial = new List<string>();
- list_str_SecondaryPriority = new List<string>();
- str_MainPriority = "";
- str_MainPriorityID = "";
- str_SecondaryPriority = "";
- /// <summary>
- /// 清洁度所有组
- /// </summary>
- DataTable RuleGroup = new DataTable();
- /// <summary>
- /// 清洁度所有组内的规则
- /// </summary>
- List<DataTable> List_data = new List<DataTable>();
- }
- #endregion
- public class DZ
- {
- public string route { get; set; }
- /// <summary>
- /// 备注
- /// </summary>
- public string Notes { get; set; }
- }
- public class VDA19
- {/// <summary>
- /// VDA19模块是否显示
- /// </summary>
- public bool IsVDA19 { get; set; }
- }
- #region 首页部份
- public class SY
- {
- public string LOGName { get; set; }
- /// <summary>
- /// 主标题
- /// </summary>
- public string str_tb_ZBT { get; set; }
- /// <summary>
- /// 副标题
- /// </summary>
- public string str_tb_FBT { get; set; }
- /// <summary>
- /// 样品名称
- /// </summary>
- public string str_tb_SampleName { get; set; }
- /// <summary>
- /// 样品编号
- /// </summary>
- public string str_tb_YPBH { get; set; }
- /// <summary>
- /// 参考标准
- /// </summary>
- public string str_tb_CKBZ { get; set; }
- /// <summary>
- /// 是否显示样品说明
- /// </summary>
- public bool b_ck_ypsm { get; set; }
- /// <summary>
- /// 设备名称
- /// </summary>
- public string str_tb_djsb { get; set; }
- /// <summary>
- /// 能谱名称
- /// </summary>
- public string str_tb_npsb { get; set; }
- /// <summary>
- /// 标准库名称
- /// </summary>
- public string StandardLibraryName { get; set; }
- }
- #endregion
- #region 页眉页脚部份
- public class YMYJ
- {
- /// <summary>
- /// 页眉文本
- /// </summary>
- public string str_tb_ymwb { get; set; }
- /// <summary>
- /// 客户号
- /// </summary>
- public string str_tb_KHH { get; set; }
- ///// <summary>
- ///// 是否显示页码
- ///// </summary>
- //public bool b_ck_ym { get; set; }
- /// <summary>
- /// 页脚文本
- /// </summary>
- public string str_tb_yjwb { get; set; }
-
- }
- #endregion
- #region 颗粒分析结果部份
- public class KLFXJG
- {
- /// <summary>
- /// 大分类是否显示
- /// </summary>
- public bool b_ck_klcc_dfl { get; set; }
- /// <summary>
- /// 小分类是否显示
- /// </summary>
- public bool b_ck_klcc_xfl { get; set; }
- /// <summary>
- /// 是否显示颗粒尺寸分析结果表
- /// </summary>
- public bool b_ck_klcc_xsmk { get; set; }
- /// <summary>
- /// 是否显示颗粒尺寸 堆叠图
- /// </summary>
- public bool b_ck_klcc_xsddt { get; set; }
- /// <summary>
- ///颗粒尺寸分析结果表 颗粒选择范围索引
- /// </summary>
- public int index_cb_klcc_klfw { get; set; }
- /// <summary>
- /// 夹杂物分类图 是否显示该模块
- /// </summary>
- public bool b_cb_jzwfl_xsmk { get; set; }
-
- /// <summary>
- ///夹杂物分类图 显示图形 选择索引
- /// </summary>
- public int index_cb_jzwfl_xstx { get; set; }
- /// <summary>
- /// 颗粒尺寸图形选择(饼、柱、线)
- /// </summary>
- public int ParticleSizeGraphicSelection { get; set; }
- /// <summary>
- /// 夹杂物分类图形选择(饼、柱、线)
- /// </summary>
- public int INCAGraphicSelection { get; set; }
- /// <summary>
- ///夹杂物分类图 计算方式 选择索引
- /// </summary>
- public int index_cb_jzwfl_jsfs { get; set; }
-
- /// <summary>
- ///夹杂物分类图 粒级表 选择索引
- /// </summary>
- public int index_cb_jzwfl_ljb { get; set; }
-
- /// <summary>
- ///夹杂物分类图 颗粒范围 选择索引
- /// </summary>
- public int index_cb_jzwfl_klfw { get; set; }
- }
- #endregion
- #region 元素分析结果部份
- public class YSFXJG
- {
- /// <summary>
- /// 元素分析表 是否显示该模块
- /// </summary>
- public bool b_ck_ysfx_xsmk { get; set; }
-
- /// <summary>
- /// 元素分析表 计算方式 选择索引
- /// </summary>
- public int index_cb_yxfx_jsfs { get; set; }
-
- /// <summary>
- /// 元素分析表 颗粒范围 选择索引
- /// </summary>
- public int index_cb_ysfx_klfw { get; set; }
- /// <summary>
- /// 元素分析表 显示元素显示文本
- /// </summary>
- public string str_tb_ysfx_xsys { get; set; }
- /// <summary>
- /// 元素分析表 显示元素拆分元素列表
- /// </summary>
- public List<string> list_str_tb_ysfx_xsys { get; set; }
- /// <summary>
- /// 元素成份图 是否显示该模块
- /// </summary>
- public bool b_ck_yscf_xsmk { get; set; }
-
- /// <summary>
- /// 元素成份图 显示图形 索引
- /// </summary>
- public int index_cb_yscf_xstx { get; set; }
-
- /// <summary>
- /// 元素成份图 计算方式 索引
- /// </summary>
- public int index_cb_yscf_jsfs { get; set; }
-
- /// <summary>
- /// 元素成份图 颗粒范围 索引
- /// </summary>
- public int index_cb_yscf_klfw { get; set; }
- /// <summary>
- /// 元素成份图 元素信息
- /// </summary>
- public string str_tb_yscf_ysxx { get; set; }
- /// <summary>
- /// 元素成份图 元素信息列表拆分字符列表
- /// </summary>
- public List<string> list_str_tb_yscf_ysxx { get; set; }
- }
- #endregion
- #region 三元相图部份
- public class SYXT
- {
- /// <summary>
- /// 三元相图 是否显示该模块
- /// </summary>
- public bool b_ck_syxt_xsmk { get; set; }
-
- /// <summary>
- /// 计算方式 索引
- /// </summary>
- public int index_cb_syxt_jsfs { get; set; }
-
- /// <summary>
- /// 颗粒范围 索引
- /// </summary>
- public int index_cb_syxt_klfw { get; set; }
- /// <summary>
- /// 粒级表信息 文本
- /// </summary>
- public string str_cb_syxt_ljb { get; set; }
- /// <summary>
- /// 粒级表信息 索引
- /// </summary>
- public int index_cb_syxt_ljb { get; set; }
- /// <summary>
- /// 每行显示数量 文本
- /// </summary>
- public string str_cb_syxt_mhxssl { get; set; }
-
- /// <summary>
- /// 三元相图模板集合列表
- /// </summary>
- public List<string> list_lbv_syxt_mblb { get; set; }
- /// <summary>
- /// 三元相图模板索引集合列表
- /// </summary>
- public List<int> list_lbv_syxt_mblb_index { get; set; }
- }
- #endregion
- #region 颗粒列表信息部份
- public class KLLBXX
- {
- /// <summary>
- /// 颗粒列表 是否显示该模块
- /// </summary>
- public bool b_ck_kllb_xsmk { get; set; }
- /// <summary>
- /// 颗粒列表 是否显示附加帧图模块
- /// </summary>
- public bool b_ck_kllb_fjzt { get; set; }
-
- /// <summary>
- /// 颗粒列表 计算方式 索引
- /// </summary>
- public int index_cb_kllb_jsfs { get; set; }
-
- /// <summary>
- /// 颗粒列表 颗粒范围 索引
- /// </summary>
- public int index_cb_kllb_klfw { get; set; }
-
- /// <summary>
- /// 颗粒列表 显示元素
- /// </summary>
- public string str_tb_kllb_sxys { get; set; }
- /// <summary>
- /// 颗粒列表 显示元素拆分元素列表
- /// </summary>
- public List<string> list_str_tb_lllb_sxys { get; set; }
-
- /// <summary>
- /// 颗粒列表 颗粒排序表行中第一个可选字段 文本
- /// </summary>
- public string str_cb_kllb_sort_p1 { get; set; }
- /// <summary>
- /// 颗粒列表 颗粒排序表行中第一个可选字段 索引
- /// </summary>
- public int index_cb_kllb_sort_p1 { get; set; }
- /// <summary>
- /// 颗粒列表 颗粒排序表行中第二个可选字段 文本
- /// </summary>
- public string str_cb_kllb_sort_p2 { get; set; }
- /// <summary>
- /// 颗粒列表 颗粒排序表行中第二个可选字段 索引
- /// </summary>
- public int index_cb_kllb_sort_p2 { get; set; }
- /// <summary>
- /// 颗粒列表 颗粒排序表行中第三个可选字段 文本
- /// </summary>
- public string str_cb_kllb_sort_p3 { get; set; }
- /// <summary>
- /// 颗粒列表 颗粒排序表行中第三个可选字段 索引
- /// </summary>
- public int index_cb_kllb_sort_p3 { get; set; }
-
-
-
-
- /// <summary>
- /// 颗粒列表去除不要的颗粒
- /// </summary>
- public string str_kllb_qcys { get; set; }
- /// <summary>
- /// 颗粒列表去除不要的颗粒
- /// </summary>
- public List<string> list_str_kllb_qcys { get; set; }
- /// <summary>
- /// 颗粒列表去除不要的物质分类
- /// </summary>
- public string str_kllb_DeleteClass { get; set; }
- /// <summary>
- /// 颗粒列表去除不要的物质分类
- /// </summary>
- public List<string> list_str_kllb_DeleteClass { get; set; }
- /// <summary>
- /// 颗粒列表去除不要的物质分类
- /// </summary>
- public List<string> list_str_kllb_DeleteClass_Serial { get; set; }
- /// <summary>
- /// 显示颗粒数量
- /// </summary>
- public int list_int_kllb_number { get; set; }
- }
- #endregion
- #region 夹杂物占比
- public class JZWZB
- {
- /// <summary>
- /// 夹杂物占比表
- /// </summary>
- public bool b_ck_surface { get; set; }
- /// <summary>
- /// 夹杂物占比图
- /// </summary>
- public bool b_ck_chart { get; set; }
- }
- #endregion
- }
- #endregion
- #region 窗体加载及构造函数
- /// <summary>
- ///
- /// </summary>
- /// <param name="ReportApp"></param>
- /// <param name="a_isTemplate">是否有导出功能</param>
- public OTSReport_Export(frmReportApp ReportApp,bool a_isExport)
- {
- InitializeComponent();
- m_ReportApp = ReportApp;
- m_export_reporttemplate = new GBData(this);
- SummaryInfoXmluti = new XmlOperateUtil(SummaryInfoPath);
- m_mbszclass = new c_TemplateClass();
- //读取配置文件中的模板路径
- LoadMBSZClass();
- #region 国际化语言
- Language lan = new Language(this);
- table = lan.GetNameTable(this.Name);
- #endregion
- isExport = a_isExport;
- if (!a_isExport)
- {
- button7.Enabled = false;
- btn_preview.Enabled = false;
- }
- }
-
- /// <summary>
- /// 从配置文件中读取报告模板路径
- /// </summary>
- private void LoadMBSZClass()
- {
- string path;
- if (m_ReportApp.m_RptConfigFile.Systype != OTS_SysType_ID.IncA)
- path = SummaryInfoXmluti.Read("M_address", "Path_CA");
- else
- path = SummaryInfoXmluti.Read("M_address", "Path");
-
- fileName = path;
- tb_mblj.Text = fileName;
- m_mbszclass.M_DZ.route = fileName;
- }
- /// <summary>
- /// 将报告模板信息保存到配置文件中
- /// </summary>
- private void SaveMBSClass()
- {
- if (m_ReportApp.m_RptConfigFile.Systype != OTS_SysType_ID.IncA)
- //文件路径
- SummaryInfoXmluti.Write(m_mbszclass.M_DZ.route.ToString(), "M_address", "Path_CA");
- else
- SummaryInfoXmluti.Write(m_mbszclass.M_DZ.route.ToString(), "M_address", "Path");
- }
- /// <summary>
- /// 加载报告模板选择项,数据源选项
- /// </summary>
- private void BindComboBox()
- {
- //加载数据源
- for (int i = 0; i < m_ReportApp.m_rstDataMgr.ResultFilesList.Count; i++)
- {
- cbo_sjy.Items.Add(m_ReportApp.m_rstDataMgr.ResultFilesList[i].anotherFileName);
- }
- if (cbo_sjy.Items.Count > 0)
- cbo_sjy.SelectedIndex = 0;
- }
- private void OTSReport_Export_Load(object sender, EventArgs e)
- {
- //窗体加载时,初始化Combobox
- BindComboBox();
- LoadControlsToXml();
- tb_mblj.Text = fileName;
- if (isExport)
- ReadClassification();
- else
- ReadClassificationNo();
- if (m_ReportApp.m_RptConfigFile.Systype != OTS_SysType_ID.IncA)
- {
- button7.Visible = false;
- }
- }
- #endregion
- #region 自定义方法
- #endregion
- #region 窗体控件事件
- private void btn_preview_Click(object sender, EventArgs e)
- {
- m_ReportApp.m_rstDataMgr.SetWorkingResultId(cbo_sjy.SelectedIndex);
- DEVReport = new OTS_DEVReport(this, m_mbszclass, m_ReportApp, table);
- LoadData();
- ReportPrintTool tool = new ReportPrintTool(DEVReport);
- tool.ShowPreview();
- }
-
- private void button2_Click(object sender, EventArgs e)
- {
- //退出
- this.Close();
- }
- private void btn_openfilepath_Click(object sender, EventArgs e)
- {
- string path;
- if (m_ReportApp.m_RptConfigFile.Systype == OTS_SysType_ID.BatteryCleannessA)
- {
- path = Application.StartupPath + "\\Config\\ReportTemplate\\CleannessA_Template";
- }
- else if (m_ReportApp.m_RptConfigFile.Systype == OTS_SysType_ID.IncA)
- {
- path = Application.StartupPath + "\\Config\\ReportTemplate\\Inca_Template";
- }
- else /*if (m_ReportApp.m_RptConfigFile.Systype == OTS_SysType_ID.TCCleannessA)*/
- {
- path = Application.StartupPath + "\\Config\\ReportTemplate\\TCleannessA_Template";
- }
-
- FileNameSelect NameSelect = new FileNameSelect(path, fileName);
- NameSelect.ShowDialog();
- if (NameSelect.yes)
- {
- fileName = NameSelect.ChangePathName;
- m_mbszclass.M_DZ.route = fileName;
- LoadControlsToXml();
- SaveMBSClass();
- if (isExport)
- ReadClassification();
- else
- ReadClassificationNo();
- }
-
- }
-
- //调用编辑模板窗体
- private void btn_TempDes_Click(object sender, EventArgs e)
- {
- //预览设置
- if (m_ReportApp.m_RptConfigFile.Systype != OTS_SysType_ID.IncA)
- {
- OTSReport_Template_CleannessA OtsTemDRM = new OTSReport_Template_CleannessA(this, fileName);
- if (OtsTemDRM.ShowDialog() == DialogResult.Yes)
- {
- //如果用户点击确定,则将m_mbszclass,模板设置类的内容存到文件中。
- m_mbszclass.M_DZ.route = tb_mblj.Text;
- SaveMBSClass();
- }
- }
- else
- {
- OTSReport_Template_INCA OtsTemDRM = new OTSReport_Template_INCA(this, fileName);
- if (OtsTemDRM.ShowDialog() == DialogResult.Yes)
- {
- //如果用户点击确定,则将m_mbszclass,模板设置类的内容存到文件中。
- m_mbszclass.M_DZ.route = tb_mblj.Text;
- SaveMBSClass();
- }
- }
- }
- #endregion
- #region 导出工作线程部份
- private void LoadData()
- {
- double total = 1;
- if (m_mbszclass.M_KLFXJG.b_ck_klcc_xsmk)
- total++;
- if (m_mbszclass.M_YSFXJG.b_ck_ysfx_xsmk)
- total++;
- if (m_mbszclass.M_JZWZB.b_ck_surface)
- total++;
- if(m_mbszclass.M_JZWZB.b_ck_chart)
- total++;
- if(m_mbszclass.M_SYXT.b_ck_syxt_xsmk)
- total++;
- if(m_mbszclass.M_KLLBXX.b_ck_kllb_xsmk)
- total++;
- if(m_mbszclass.M_KLLBXX.b_ck_kllb_fjzt)
- total++;
- if(m_mbszclass.M_VDA19.IsVDA19)
- total++;
- double Serial = 1;
- int length = 2;
- try
- {
- if (true)//测量结果信息表
- {
- double d1 = Convert.ToDouble(Serial / total) * 100.0;
- Serial++;
- richTextBox1.SelectionColor = Color.Black;
- richTextBox1.SelectionStart = 0; // 设置选择开始位置
- richTextBox1.AppendText(table["measurement_result"].ToString() + "\n");
- richTextBox1.AppendText(table["loading"].ToString() + Math.Round(d1, length).ToString() + "%\n");
- DEVReport.International_language();
- bool isINCA = false;
- if (m_ReportApp.m_RptConfigFile.Systype == OTS_SysType_ID.IncA)
- {
- isINCA = true;
- }
- DEVReport.setResultGrid(isINCA);
- richTextBox1.ScrollToCaret();
- }
- }
- catch
- {
- richTextBox1.SelectionColor = Color.Red;
- richTextBox1.AppendText(table["measurementResult_fail"].ToString() + "\n");
- return;
- }
- try
- {
- if (m_mbszclass.M_VDA19.IsVDA19)
- {
- double d1 = Convert.ToDouble(Serial / total) * 100.0;
- Serial++;
- richTextBox1.SelectionColor = Color.Black;
- richTextBox1.SelectionStart = 0; // 设置选择开始位置
- richTextBox1.AppendText(table["tcleannessa"].ToString() + "\n");
- richTextBox1.AppendText(table["loading"].ToString() + Math.Round(d1, length).ToString() + "%\n");
- DEVReport.SetTCleannessA();
- richTextBox1.ScrollToCaret();
- }
- }
- catch
- {
- richTextBox1.SelectionColor = Color.Red;
- richTextBox1.AppendText(table["tcleannessa_fail"].ToString() + "\n");
- return;
- }
- // 执行后台任务...
- try
- {
- if (m_mbszclass.M_KLFXJG.b_ck_klcc_xsmk)//颗粒尺寸分析表
- {
- double d1 = Convert.ToDouble(Serial / total) * 100.0;
- Serial++;
- richTextBox1.SelectionColor = Color.Black;
- richTextBox1.SelectionStart = 0; // 设置选择开始位置
- richTextBox1.AppendText(table["particle_size"].ToString() + "\n");
- richTextBox1.AppendText(table["loading"].ToString() + Math.Round(d1, length).ToString() + "%\n");
- DEVReport.setParticleSizeTable(m_mbszclass);
- richTextBox1.ScrollToCaret();
- }
- }
- catch
- {
- richTextBox1.SelectionColor = Color.Red;
- richTextBox1.AppendText(table["particle_size_fail"].ToString() + "\n");
- return;
- }
- try
- {
- if (m_mbszclass.M_YSFXJG.b_ck_ysfx_xsmk)//元素分析表
- {
- double d1 = Convert.ToDouble(Serial / total) * 100.0;
- Serial++;
- richTextBox1.SelectionColor = Color.Black;
- richTextBox1.SelectionStart = 0; // 设置选择开始位置
- richTextBox1.AppendText(table["elemental_analysis"].ToString() + "\n");
- richTextBox1.AppendText(table["loading"].ToString() + Math.Round(d1, length).ToString() + "%\n");
- DEVReport.XRPageBreak();
- DEVReport.setElementAvgGrid();
- richTextBox1.ScrollToCaret();
- }
- }
- catch
- {
- richTextBox1.SelectionColor = Color.Red;
- richTextBox1.AppendText(table["elemental_analysis_fail"].ToString() + "\n");
- return;
- }
- try
- {
- if (m_mbszclass.M_JZWZB.b_ck_surface)//夹杂物面积比表
- {
- double d1 = Convert.ToDouble(Serial / total) * 100.0;
- Serial++;
- richTextBox1.SelectionColor = Color.Black;
- richTextBox1.SelectionStart = 0; // 设置选择开始位置
- richTextBox1.AppendText(table["inclusion"].ToString() + "\n");
- richTextBox1.AppendText(table["loading"].ToString() + Math.Round(d1, length).ToString() + "%\n");
- DEVReport.XRPageBreak();
- DEVReport.setINCAtable();
- richTextBox1.ScrollToCaret();
- }
- }
- catch
- {
- richTextBox1.SelectionColor = Color.Red;
- richTextBox1.AppendText(table["inclusion_fail"].ToString() + "\n");
- return;
- }
- try
- {
- if (m_mbszclass.M_JZWZB.b_ck_surface)
- {
- if (m_mbszclass.M_KLFXJG.b_ck_klcc_dfl == true || m_mbszclass.M_KLFXJG.b_ck_klcc_xfl == true)
- {
- double d1 = Convert.ToDouble(Serial / total) * 100.0;
- Serial++;
- richTextBox1.SelectionColor = Color.Black;
- richTextBox1.SelectionStart = 0; // 设置选择开始位置
- richTextBox1.AppendText(table["inclusion_chart"].ToString() + "\n");
- richTextBox1.AppendText(table["loading"].ToString() + Math.Round(d1, length).ToString() + "%\n");
- DEVReport.XRPageBreak();
- DEVReport.set_incaPIC_classify(m_mbszclass);
- DEVReport.set_incaPIC_subdivision(m_mbszclass);
- richTextBox1.ScrollToCaret();
- }
- }
- }
- catch
- {
- richTextBox1.SelectionColor = Color.Red;
- richTextBox1.AppendText(table["inclusion_chart_fail"].ToString() + "\n");
- return;
- }
- try
- {
- if (m_mbszclass.M_SYXT.b_ck_syxt_xsmk)//三元图
- {
- double d1 = Convert.ToDouble(Serial / total) * 100.0;
- Serial++;
- richTextBox1.SelectionColor = Color.Black;
- richTextBox1.SelectionStart = 0; // 设置选择开始位置
- richTextBox1.AppendText(table["ternary_diagram"].ToString() + "\n");
- richTextBox1.AppendText(table["loading"].ToString() + Math.Round(d1, length).ToString() + "%\n");
- DEVReport.XRPageBreak();
- DEVReport.InsertReportTemplateChart_Trianglediagram();
- richTextBox1.ScrollToCaret();
- }
- }
- catch
- {
- richTextBox1.SelectionColor = Color.Red;
- richTextBox1.AppendText(table["ternary_diagram_fail"].ToString() + "\n");
- return;
- }
- try
- {
- if (m_mbszclass.M_KLLBXX.b_ck_kllb_xsmk)//颗粒列表
- {
- double d1 = Convert.ToDouble(Serial / total) * 100.0;
- Serial++;
- richTextBox1.SelectionColor = Color.Black;
- richTextBox1.SelectionStart = 0; // 设置选择开始位置
- richTextBox1.AppendText(table["particle_list"].ToString() + "\n");
- richTextBox1.AppendText(table["loading"].ToString() + Math.Round(d1, length).ToString() + "%\n");
- //DEVReport.XRPageBreak();
- DEVReport.set_kllb_data();
- richTextBox1.ScrollToCaret();
- }
- }
- catch
- {
- richTextBox1.SelectionColor = Color.Red;
- richTextBox1.AppendText(table["particle_list_fail"].ToString() + "\n");
- return;
- }
- try
- {
- if (m_mbszclass.M_KLLBXX.b_ck_kllb_fjzt)//颗粒帧图列表
- {
- double d1 = Convert.ToDouble(Serial / total) * 100.0;
- Serial++;
- richTextBox1.SelectionColor = Color.Black;
- richTextBox1.SelectionStart = 0; // 设置选择开始位置
- richTextBox1.AppendText(table["particle_list_chart"].ToString() + "\n");
- richTextBox1.AppendText(table["loading"].ToString() + Math.Round(d1, length).ToString() + "%\n");
- //DEVReport.XRPageBreak();
- DEVReport.set_kllb_data_frame();
- richTextBox1.ScrollToCaret();
- }
- }
- catch
- {
- richTextBox1.SelectionColor = Color.Red;
- richTextBox1.AppendText(table["particle_list_chart_fail"].ToString() + "\n");
- return;
- }
- richTextBox1.SelectionColor = Color.Red;
- richTextBox1.AppendText(table["complete"].ToString() + "\n");
- richTextBox1.ScrollToCaret();
- }
- #endregion
- #region 读取文件
- private void LoadControlsToXml()
- {
- string strpath;
- if (m_ReportApp.m_RptConfigFile.Systype == OTS_SysType_ID.BatteryCleannessA)
- strpath = Application.StartupPath + "\\Config\\ReportTemplate\\CleannessA_Template\\" + fileName;
- else if (m_ReportApp.m_RptConfigFile.Systype == OTS_SysType_ID.IncA)
- strpath = Application.StartupPath + "\\Config\\ReportTemplate\\Inca_Template\\" + fileName;
- else
- strpath = Application.StartupPath + "\\Config\\ReportTemplate\\TCleannessA_Template\\" + fileName;
- tb_mblj.Text = fileName;
- OTSIncAReportApp.Controls.XmlOperateUtil xmlutil = new OTSIncAReportApp.Controls.XmlOperateUtil(strpath);
- //首页
- m_mbszclass.M_SY.str_tb_ZBT = xmlutil.Read("M_SY", "str_tb_ZBT");
- m_mbszclass.M_SY.str_tb_FBT = xmlutil.Read("M_SY", "str_tb_FBT");
- m_mbszclass.M_SY.str_tb_YPBH = xmlutil.Read("M_SY", "str_tb_YPBH");
- m_mbszclass.M_SY.str_tb_SampleName = xmlutil.Read("M_SY", "str_tb_SampleName");
- m_mbszclass.M_SY.str_tb_CKBZ = xmlutil.Read("M_SY", "str_tb_CKBZ");
- m_mbszclass.M_SY.b_ck_ypsm = Convert.ToBoolean(xmlutil.Read("M_SY", "b_ck_ypsm"));
-
- m_mbszclass.M_SY.LOGName = xmlutil.Read("M_SY", "LOGName");
- m_mbszclass.M_SY.StandardLibraryName= xmlutil.Read("M_SY", "StandardLibraryName");
- m_mbszclass.M_SY.str_tb_djsb= xmlutil.Read("M_SY", "str_tb_djsb");
- m_mbszclass.M_SY.str_tb_npsb= xmlutil.Read("M_SY", "str_tb_npsb");
- if (m_mbszclass.M_SY.LOGName == null || m_mbszclass.M_SY.LOGName == "")
- {
- m_mbszclass.M_SY.LOGName = "ReportIdentification.bmp";
- }
- //页眉页脚
- m_mbszclass.M_YMYJ.str_tb_ymwb = xmlutil.Read("M_YMYJ", "str_tb_ymwb");
- m_mbszclass.M_YMYJ.str_tb_KHH = xmlutil.Read("M_YMYJ", "str_tb_KHH");
- //m_mbszclass.M_YMYJ.b_ck_ym = Convert.ToBoolean(xmlutil.Read("M_YMYJ", "b_ck_ym"));
- m_mbszclass.M_YMYJ.str_tb_yjwb = xmlutil.Read("M_YMYJ", "str_tb_yjwb");
- //颗粒分析结果
- m_mbszclass.M_KLFXJG.b_ck_klcc_xsmk = Convert.ToBoolean(xmlutil.Read("M_KLFXJG", "b_ck_klcc_xsmk"));//是否显示模块
- m_mbszclass.M_KLFXJG.b_ck_klcc_xsddt = Convert.ToBoolean(xmlutil.Read("M_KLFXJG", "b_ck_klcc_xsddt"));
-
- m_mbszclass.M_KLFXJG.index_cb_klcc_klfw = Convert.ToInt32(xmlutil.Read("M_KLFXJG", "index_cb_klcc_klfw"));//颗粒范围
- m_mbszclass.M_KLFXJG.b_cb_jzwfl_xsmk = Convert.ToBoolean(xmlutil.Read("M_KLFXJG", "b_cb_jzwfl_xsmk"));//是否显示该模块
- m_mbszclass.M_KLFXJG.index_cb_jzwfl_xstx = Convert.ToInt32(xmlutil.Read("M_KLFXJG", "index_cb_jzwfl_xstx"));//选择图像
- m_mbszclass.M_KLFXJG.index_cb_jzwfl_jsfs = Convert.ToInt32(xmlutil.Read("M_KLFXJG", "index_cb_jzwfl_jsfs"));//计算方式
-
- m_mbszclass.M_KLFXJG.index_cb_jzwfl_ljb = Convert.ToInt32(xmlutil.Read("M_KLFXJG", "index_cb_jzwfl_ljb"));//粒级表
- m_mbszclass.M_KLFXJG.index_cb_jzwfl_klfw = Convert.ToInt32(xmlutil.Read("M_KLFXJG", "index_cb_jzwfl_klfw"));//颗粒范围
- //元素分析结果
- m_mbszclass.M_YSFXJG.b_ck_ysfx_xsmk = Convert.ToBoolean(xmlutil.Read("M_YSFXJG", "b_ck_ysfx_xsmk")); //是否显示模块
- m_mbszclass.M_YSFXJG.index_cb_yxfx_jsfs = Convert.ToInt32(xmlutil.Read("M_YSFXJG", "index_cb_yxfx_jsfs")); //计算方式
- m_mbszclass.M_YSFXJG.index_cb_ysfx_klfw = Convert.ToInt32(xmlutil.Read("M_YSFXJG", "index_cb_ysfx_klfw")); //颗粒范围
- m_mbszclass.M_YSFXJG.str_tb_ysfx_xsys = xmlutil.Read("M_YSFXJG", "str_tb_ysfx_xsys"); //显示元素
- m_mbszclass.M_KLFXJG.ParticleSizeGraphicSelection= Convert.ToInt32(xmlutil.Read("M_KLFXJG", "ParticleSizeGraphicSelection"));
- m_mbszclass.M_KLFXJG.INCAGraphicSelection = Convert.ToInt32(xmlutil.Read("M_KLFXJG", "INCAGraphicSelection"));
- m_mbszclass.M_YSFXJG.list_str_tb_ysfx_xsys.Clear();
- for (int i = 0; i < 100; i++) //取得所有元素列表
- {
- string str = xmlutil.Read("M_YSFXJG", "list_str_tb_ysfx_xsys", "YS" + i.ToString());
- if (str == null)
- {
- break;
- }
- else
- {
- m_mbszclass.M_YSFXJG.list_str_tb_ysfx_xsys.Add(str);
- }
- }
- m_mbszclass.M_YSFXJG.b_ck_yscf_xsmk = Convert.ToBoolean(xmlutil.Read("M_YSFXJG", "b_ck_yscf_xsmk")); //是否显示模块
- m_mbszclass.M_YSFXJG.index_cb_yscf_xstx = Convert.ToInt32(xmlutil.Read("M_YSFXJG", "index_cb_yscf_xstx")); //显示图形
- m_mbszclass.M_YSFXJG.index_cb_yscf_jsfs = Convert.ToInt32(xmlutil.Read("M_YSFXJG", "index_cb_yscf_jsfs")); //计算方式
- m_mbszclass.M_YSFXJG.index_cb_yscf_klfw = Convert.ToInt32(xmlutil.Read("M_YSFXJG", "index_cb_yscf_klfw")); //颗粒范围
- m_mbszclass.M_YSFXJG.str_tb_yscf_ysxx = xmlutil.Read("M_YSFXJG", "str_tb_yscf_ysxx"); //显示元素
- m_mbszclass.M_YSFXJG.list_str_tb_yscf_ysxx.Clear();
- for (int i = 0; i < 100; i++) //取得所有元素列表
- {
- string str = xmlutil.Read("M_YSFXJG", "list_str_tb_yscf_ysxx", "YS" + i.ToString());
- if (str == null)
- {
- break;
- }
- else
- {
- m_mbszclass.M_YSFXJG.list_str_tb_yscf_ysxx.Add(str);
- }
- }
- //三元相图
- m_mbszclass.M_SYXT.b_ck_syxt_xsmk = Convert.ToBoolean(xmlutil.Read("M_SYXT", "b_ck_syxt_xsmk")); //是否显示模块
- m_mbszclass.M_SYXT.index_cb_syxt_jsfs = Convert.ToInt32(xmlutil.Read("M_SYXT", "index_cb_syxt_jsfs")); //计算方式
- m_mbszclass.M_SYXT.index_cb_syxt_klfw = Convert.ToInt32(xmlutil.Read("M_SYXT", "index_cb_syxt_klfw")); //颗粒范围
- m_mbszclass.M_SYXT.str_cb_syxt_mhxssl = xmlutil.Read("M_SYXT", "str_cb_syxt_mhxssl"); //每行显示数量
- m_mbszclass.M_SYXT.list_lbv_syxt_mblb.Clear();
- for (int i = 0; i < 100; i++) //取得所有模板列表
- {
- string str = xmlutil.Read("M_SYXT", "list_lbv_syxt_mblb", "MB" + i.ToString());
- if (str == null)
- {
- break;
- }
- else
- {
- m_mbszclass.M_SYXT.list_lbv_syxt_mblb.Add(str);
- }
- }
- m_mbszclass.M_SYXT.list_lbv_syxt_mblb_index.Clear();
- for (int i = 0; i < 100; i++) //取得所有模板列表 索引
- {
- string str = xmlutil.Read("M_SYXT", "list_lbv_syxt_mblb_index", "MBIndex" + i.ToString());
- if (str == null)
- {
- break;
- }
- else
- {
- m_mbszclass.M_SYXT.list_lbv_syxt_mblb_index.Add(Convert.ToInt32(str));
- }
- }
- //颗粒列表信息
- m_mbszclass.M_KLLBXX.b_ck_kllb_xsmk = Convert.ToBoolean(xmlutil.Read("M_KLLBXX", "b_ck_kllb_xsmk")); //是否显示模块
- m_mbszclass.M_KLLBXX.index_cb_kllb_jsfs = Convert.ToInt32(xmlutil.Read("M_KLLBXX", "index_cb_kllb_jsfs")); //计算方式
- m_mbszclass.M_KLLBXX.index_cb_kllb_klfw = Convert.ToInt32(xmlutil.Read("M_KLLBXX", "index_cb_kllb_klfw")); //颗粒范围
- m_mbszclass.M_KLLBXX.str_tb_kllb_sxys = xmlutil.Read("M_KLLBXX", "str_tb_kllb_sxys"); //显示元素
- m_mbszclass.M_KLLBXX.b_ck_kllb_fjzt = Convert.ToBoolean(xmlutil.Read("M_KLLBXX", "b_ck_kllb_fjzt"));
- m_mbszclass.M_KLLBXX.list_str_tb_lllb_sxys.Clear();
- for (int i = 0; i < 100; i++) //取得所有元素列表
- {
- string str = xmlutil.Read("M_KLLBXX", "list_str_tb_lllb_sxys", "YS" + i.ToString());
- if (str == null)
- {
- break;
- }
- else
- {
- m_mbszclass.M_KLLBXX.list_str_tb_lllb_sxys.Add(str);
- }
- }
- m_mbszclass.M_KLLBXX.str_cb_kllb_sort_p1 = Convert.ToString(xmlutil.Read("M_KLLBXX", "str_cb_kllb_sort_p1"));//颗粒列表列中第一个可选参数
- m_mbszclass.M_KLLBXX.index_cb_kllb_sort_p1 = Convert.ToInt32(xmlutil.Read("M_KLLBXX", "index_cb_kllb_sort_p1"));
- m_mbszclass.M_KLLBXX.str_cb_kllb_sort_p2 = Convert.ToString(xmlutil.Read("M_KLLBXX", "str_cb_kllb_sort_p2"));//颗粒列表中第二个可选参数
- m_mbszclass.M_KLLBXX.index_cb_kllb_sort_p2 = Convert.ToInt32(xmlutil.Read("M_KLLBXX", "index_cb_kllb_sort_p2"));
- m_mbszclass.M_KLLBXX.str_cb_kllb_sort_p3 = Convert.ToString(xmlutil.Read("M_KLLBXX", "str_cb_kllb_sort_p3"));//颗粒列表中第三个可选参数
- m_mbszclass.M_KLLBXX.index_cb_kllb_sort_p3 = Convert.ToInt32(xmlutil.Read("M_KLLBXX", "index_cb_kllb_sort_p3"));
-
- m_mbszclass.M_KLLBXX.list_int_kllb_number = Convert.ToInt32(xmlutil.Read("M_KLLBXX", "list_int_kllb_number"));//保存显示颗粒数量
- m_mbszclass.M_KLLBXX.str_kllb_qcys = Convert.ToString(xmlutil.Read("M_KLLBXX", "str_kllb_qcys"));
- m_mbszclass.M_KLLBXX.list_str_kllb_qcys.Clear();
- for (int i = 0; i < 100; i++) //取得所有元素列表
- {
- string str = xmlutil.Read("M_KLLBXX", "list_str_kllb_qcys", "YS" + i.ToString());
- if (str == null)
- {
- break;
- }
- else
- {
- m_mbszclass.M_KLLBXX.list_str_kllb_qcys.Add(str);
- }
- }
- //m_mbszclass.M_KLLBXX.str_kllb_DeleteClass = Convert.ToString(xmlutil.Read("M_KLLBXX", "str_kllb_DeleteClass"));
- m_mbszclass.M_KLLBXX.list_str_kllb_DeleteClass.Clear();
- for (int i = 0; i < 100; i++) //取得所有元素列表
- {
- string str = xmlutil.Read("M_KLLBXX", "list_str_kllb_DeleteClass", "YS" + i.ToString());
- if (str == null)
- {
- break;
- }
- else
- {
- m_mbszclass.M_KLLBXX.list_str_kllb_DeleteClass.Add(str);
- }
- }
- m_mbszclass.M_KLLBXX.list_str_kllb_DeleteClass_Serial.Clear();
- for (int i = 0; i < 100; i++) //取得所有元素列表
- {
- string str = xmlutil.Read("M_KLLBXX", "list_str_kllb_DeleteClass_Serial", "YS" + i.ToString());
- if (str == null)
- {
- break;
- }
- else
- {
- m_mbszclass.M_KLLBXX.list_str_kllb_DeleteClass_Serial.Add(str);
- }
- }
- //夹杂物占比
- m_mbszclass.M_JZWZB.b_ck_surface = Convert.ToBoolean(xmlutil.Read("M_JZWZB", "b_ck_surface"));//夹杂物占比表
- m_mbszclass.M_JZWZB.b_ck_chart = Convert.ToBoolean(xmlutil.Read("M_JZWZB", "b_ck_chart"));//夹杂物占比图
- m_mbszclass.list_str_MainPriority.Clear();
- for (int i = 0; i < 100; i++) //全局优先排序
- {
- string str = xmlutil.Read("whole", "list_str_MainPriority", "YS" + i.ToString());
- if (str == null)
- {
- break;
- }
- else
- {
- m_mbszclass.list_str_MainPriority.Add(str);
- }
- }
- m_mbszclass.list_str_MainPriority_Serial.Clear();
- for (int i = 0; i < 100; i++) //全局优先排序
- {
- string str = xmlutil.Read("whole", "list_str_MainPriority_Serial", "YS" + i.ToString());
- if (str == null)
- {
- break;
- }
- else
- {
- m_mbszclass.list_str_MainPriority_Serial.Add(str);
- }
- }
- m_mbszclass.list_str_SecondaryPriority.Clear();
- for (int i = 0; i < 100; i++) //全局次要排序
- {
- string str = xmlutil.Read("whole", "list_str_SecondaryPriority", "YS" + i.ToString());
- if (str == null)
- {
- break;
- }
- else
- {
- m_mbszclass.list_str_SecondaryPriority.Add(str);
- }
- }
- m_mbszclass.str_MainPriority = Convert.ToString(xmlutil.Read("whole", "str_MainPriority"));
- m_mbszclass.str_MainPriorityID = Convert.ToString(xmlutil.Read("whole", "str_MainPriorityID"));
- m_mbszclass.str_SecondaryPriority = Convert.ToString(xmlutil.Read("whole", "str_SecondaryPriority"));
-
- m_mbszclass.M_SYXT.str_cb_syxt_ljb = Convert.ToString(xmlutil.Read("M_SYXT", "str_cb_syxt_ljb"));
- m_mbszclass.M_KLFXJG.b_ck_klcc_dfl = Convert.ToBoolean(xmlutil.Read("M_KLFXJG", "b_ck_klcc_dfl"));
- m_mbszclass.M_KLFXJG.b_ck_klcc_xfl = Convert.ToBoolean(xmlutil.Read("M_KLFXJG", "b_ck_klcc_xfl"));
- m_mbszclass.M_DZ.Notes = Convert.ToString(xmlutil.Read("M_DZ", "Notes"));
- m_mbszclass.M_VDA19.IsVDA19 = Convert.ToBoolean(xmlutil.Read("M_VDA19", "IsVDA19"));
- if (m_ReportApp.m_RptConfigFile.Systype != OTS_SysType_ID.IncA)
- GroupSelectionConfiguration();
- }
- #region 加载组
- /// <summary>
- /// 组加载配置
- /// </summary>
- private void GroupSelectionConfiguration()
- {
- ResultFile resfile = m_ReportApp.m_rstDataMgr.ResultFilesList[m_ReportApp.m_rstDataMgr.GetWorkingResultId()];
- string str_libraryName = resfile.GetSTDName();
- bool endsWithDb = str_libraryName.EndsWith(".db", StringComparison.OrdinalIgnoreCase);
- string fullPathR = "";
- if (endsWithDb)
- {
- fullPathR = m_ReportApp.m_rstDataMgr.CurResultFile.FilePath + "\\" + str_libraryName;
- }
- else
- {
- fullPathR = m_ReportApp.m_rstDataMgr.CurResultFile.FilePath + "\\" + str_libraryName + ".db";
- }
-
- ParticleData particleData = new ParticleData();
- m_mbszclass.RuleGroup = particleData.ObtainParticleCategory_start(fullPathR);
- m_mbszclass.List_data = particleData.ObtainRuleData_start(m_mbszclass.RuleGroup, fullPathR);
- string[] Separator = { " , " };
- string[] parts = m_mbszclass.str_MainPriorityID.ToString().Split(Separator, StringSplitOptions.RemoveEmptyEntries);
- List<string> strings1 = new List<string>();
- for (int i = 0; i < parts.Length; i++)
- {
- string[] strss = parts[i].ToString().Split(':');
- bool bl = false;
- for (int a = 0; a < strings1.Count; a++)
- {
- if (strings1[a] == strss[0])
- {
- bl = true;
- }
- }
- if (!bl)
- {
- strings1.Add(strss[0]);
- }
- }
- //循环每个组
- for (int i = 0; i < m_mbszclass.List_data.Count; i++)
- {
- string groupID = m_mbszclass.List_data[i].TableName;
- for (int j = 0; j < strings1.Count; j++)
- {
- if (m_mbszclass.List_data[i].TableName.ToString() == strings1[j])
- {
- m_mbszclass.RuleGroup.Rows[i]["display"] = "1";
- }
- }
- //循环当前组中的规则
- for (int a = 0; a < m_mbszclass.List_data[i].Rows.Count; a++)
- {
- //循环记录勾选的规则信息
- for (int j = 0; j < parts.Length; j++)
- {
- string[] strss = parts[j].ToString().Split(':');
- if (m_mbszclass.List_data[i].Rows[a]["STDId"].ToString() == strss[1])
- {
- m_mbszclass.List_data[i].Rows[a]["display"] = 1;
- }
- }
- }
- }
- UpdateRuleSelectionDisplay(m_mbszclass.RuleGroup, m_mbszclass.List_data);
- }
- private void UpdateRuleSelectionDisplay(DataTable RuleGroup, List<DataTable> List_data)
- {
- string RuleFormation = "";
- //循环所有分组名称
- for (int i = 0; i < RuleGroup.Rows.Count; i++)
- {
- //判断分组是否选中
- if (RuleGroup.Rows[i]["display"].ToString() == "1")
- {
- //循环选中的分组列表信息
- for (int a = 0; a < List_data.Count; a++)
- {
- //判断当前组的ID和当前分组列表的名称(分组名称和分组ID一致)
- if (RuleGroup.Rows[i]["GroupId"].ToString() == List_data[a].TableName)
- {
- //循环当前分组列表的规则
- for (int j = 0; j < List_data[a].Rows.Count; j++)
- {
- if (List_data[a].Rows[j]["display"].ToString() == "1")
- {
- if (RuleFormation == "")
- {
- RuleFormation = RuleFormation + RuleGroup.Rows[i]["GroupName"].ToString() + ":" + List_data[a].Rows[j]["StrName"].ToString();
- }
- else
- {
- RuleFormation = RuleFormation + " , " + RuleGroup.Rows[i]["GroupName"].ToString() + ":" + List_data[a].Rows[j]["StrName"].ToString();
- }
- }
- }
- }
- }
- }
- }
- }
- #endregion
- #endregion
- private void button7_Click(object sender, EventArgs e)
- {
- OTSReport_criterion criterion = new OTSReport_criterion(m_export_reporttemplate, GB_Report,this);
- criterion.Sample_order = cbo_sjy.SelectedIndex;
- criterion.ShowDialog();
- }
-
- private void OTSReport_Export_FormClosed(object sender, FormClosedEventArgs e)
- {
-
- }
-
- private void ReadClassificationNo()
- {
- LibraryName.Clear();
- string MeasurementFiles = System.IO.Directory.GetCurrentDirectory() + "\\Config\\SysData";
- // 获取文件夹中的所有文件信息
- List<string> getNameM = GetDbFilesInDirectory(MeasurementFiles);
- // 遍历文件信息数组并打印出文件名
- for (int i = 0; i < getNameM.Count; i++)
- {
- string[] vs = new string[] { getNameM[i], MeasurementFiles + "\\" + getNameM[i] };
- LibraryName.Add(vs);
- }
- if ( m_mbszclass.M_SY.StandardLibraryName == "NoSTDDB.db")
- {
- m_mbszclass.M_SY.StandardLibraryName = "";
- }
- }
- private void ReadClassification()
- {
- LibraryName.Clear();
- string fullPathM = "";
- string fullPathR = "";
- ResultFile resfile = m_ReportApp.m_rstDataMgr.ResultFilesList[m_ReportApp.m_rstDataMgr.GetWorkingResultId()];
- string str_libraryName = resfile.GetSTDName();
- bool endsWithDb = str_libraryName.EndsWith(".db", StringComparison.OrdinalIgnoreCase);
- if(!endsWithDb)
- {
- str_libraryName = str_libraryName + ".db";
- }
- try
- {
- fullPathR = m_ReportApp.m_rstDataMgr.CurResultFile.FilePath + "\\" + str_libraryName /*+ ".db"*/;
- string ReportFile = m_ReportApp.m_rstDataMgr.CurResultFile.FilePath;
- // 获取文件夹中的所有文件信息
- List<string> getNameR = GetDbFilesInDirectory(ReportFile);
- for (int i = 0; i < getNameR.Count; i++)
- {
- string[] vs = new string[] { getNameR[i], ReportFile + "\\" + getNameR[i] };
- LibraryName.Add(vs);
- }
- }
- catch
- {
- }
- try
- {
- fullPathM = System.IO.Directory.GetCurrentDirectory() + "\\Config\\SysData\\" + str_libraryName /*+ ".db"*/;
- string MeasurementFiles = System.IO.Directory.GetCurrentDirectory() + "\\Config\\SysData";
- // 获取文件夹中的所有文件信息
- List<string> getNameM = GetDbFilesInDirectory(MeasurementFiles);
- // 遍历文件信息数组并打印出文件名
- for (int i = 0; i < getNameM.Count; i++)
- {
- string[] vs = new string[] { getNameM[i], MeasurementFiles + "\\" + getNameM[i] };
- LibraryName.Add(vs);
- }
- }
- catch
- {
- }
-
-
- if (str_libraryName == "NoSTDDB.db" || m_mbszclass.M_SY.StandardLibraryName== "NoSTDDB.db")
- {
- m_mbszclass.M_SY.StandardLibraryName = "";
- }
- else
- {
- if (System.IO.File.Exists(fullPathR))
- {
- return;
- }
- else if (System.IO.File.Exists(fullPathM))
- {
- return;
- }
- else
- {
- MessageBox.Show(table["library_does_not_match"].ToString());
- }
-
- }
- }
- static List<string> GetDbFilesInDirectory(string directoryPath)
- {
- List<string> files = new List<string>();
- // 使用搜索模式 "*.db" 来查找所有.db文件
- string[] allDbFiles = Directory.GetFiles(directoryPath, "*.db");
- // 将找到的文件名添加到列表中
- files.AddRange(allDbFiles.Select(Path.GetFileName)); // 如果只需要文件名,而不是完整路径
- // 如果你需要文件的完整路径,可以直接返回 allDbFiles 数组(转换为List<string>)
- // return allDbFiles.ToList();
- return files;
- }
- private void button_export6156_Click(object sender, EventArgs e)
- {
- //XtraReport_yb6156 Report_yb6156= new XtraReport_yb6156();
- //DevExpress.XtraReports.UI.ReportPrintTool tool = new DevExpress.XtraReports.UI.ReportPrintTool(Report_yb6156);
- //tool.ShowPreview();
- }
- }
- }
|