123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268 |
- using OTSCommon;
- using OTSIncAReportApp;
- using OTSIncAReportApp.Controls;
- using OTSIncAReportApp.OTSRstMgrFunction;
- using OTSIncAReportApp.OTSMgrInfo;
- using OTSIncAReportApp.SysMgrTools;
- using System;
- using System.Data;
- using System.IO;
- using System.Windows.Forms;
- using Language = OTSIncAReportApp.SysMgrTools.Language;
- namespace OTSIncAReprotCharts
- {
- public partial class frmReportSysConfig : Form
- {
- #region 变量
- public ResultDataMgr m_DataMgrFun = null;
- //粒级文件夹路径
- public static string m_PathName = "";
- //粒级文件夹获取
- public static string m_strPath = "";
- /// <summary>
- /// 保存的全局主窗体对象
- /// </summary>
- frmReportApp m_ReportApp;
- string strbpath = ".\\Config\\ProData\\";
- #endregion
- #region 构造函数及窗体加载
- public frmReportSysConfig(frmReportApp ReportApp)
- {
- InitializeComponent();
- //粒级部分
- this.m_DataMgrFun = ReportApp.m_rstDataMgr;
- m_ReportApp = ReportApp;
- #region 国际化语言
- Language lan = new Language(this);
- #endregion
- }
- private void ReportMgrInfoForm_Load(object sender, EventArgs e)
- {
- //初始化数据
- InitMyComponent();
- InitData();
- }
- #endregion
- #region 自定义方法
- public void InitData()
- {
- DirectoryInfo theFolder = new DirectoryInfo(strbpath);
- if (!theFolder.Exists)
- return;
- comboBox_PartiSizeFileFolder.Items.Clear();
- //读取遍历粒级文件信息
- foreach (FileInfo nextifile in theFolder.GetFiles())
- {
- //找出粒级文件
- if (nextifile.Name.Contains(".psf") == true || nextifile.Name.Contains(".PSF") == true)
- {
- comboBox_PartiSizeFileFolder.Items.Add(nextifile.Name);
- }
- }
-
- cB_sjtmbwj.Items.Clear();
- //三元相图模板配置文件
- string path = m_DataMgrFun.m_RptConfigFile.TrigTemplateFileFolder + "\\" + m_DataMgrFun.m_RptConfigFile.TriTempFile;
- DataSet ds = XMLoperate.GetXmlData(path, "XMLData");
- DataTable dt = ds.Tables["Member"];
- for (int i = 0; i < dt.Rows.Count; i++)
- {
- cB_sjtmbwj.Items.Add(dt.Rows[i]["TemplateName"].ToString());
- }
- cB_SIZE_CAL_METHOD_TYPE.Items.Clear();
- cB_SIZE_CAL_METHOD_TYPE.Items.AddRange(m_DataMgrFun.GetSizeCalMethodTypeList().ToArray());
- DataSet ds1 = XMLoperate.GetXmlData(Application.StartupPath + RptConfigFile.m_ReportMgrParamFile, "XMLData");
- DataTable dt1 = ds1.Tables["Member"];
- foreach (DataRow element in dt1.Rows)
- {
- string RegName = element["RegName"].ToString();
- if (RegName == "PartSizeFile")
- {
- comboBox_PartiSizeFileFolder.SelectedIndex = comboBox_PartiSizeFileFolder.Items.IndexOf(element["name"].ToString());
- }
- if (RegName == "TRIO_CHART_TYPE")
- {
- cB_sjtmbwj.SelectedIndex = cB_sjtmbwj.Items.IndexOf(element["strValue"].ToString());
- }
- if (RegName == "SIZE_CAL_METHOD_TYPE")
- {
- cB_SIZE_CAL_METHOD_TYPE.SelectedIndex = cB_SIZE_CAL_METHOD_TYPE.Items.IndexOf(element["strValue"].ToString());
- }
- }
- }
- public void InitMyComponent()
- {
- string imagepath;
- //显示程序管理对话框参数设置
- imagepath = strbpath;
- DataSet ds = OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.GetXmlData(Application.StartupPath + RptConfigFile.m_ReportMgrParamFile, "XMLData");
- DataTable dt = ds.Tables["Member"];
- string str_scale="";
- foreach (DataRow element in dt.Rows)
- {
- string RegName = element["RegName"].ToString();
- if (RegName == "Scale")
- {
- str_scale = element["strValue"].ToString();
- }
- }
- //比例因子
- tb_blyz.Text = str_scale;
- }
- private void tb_blyz_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (((int)e.KeyChar < 48 || (int)e.KeyChar > 57) && (int)e.KeyChar != 8 && (int)e.KeyChar != 46)
- e.Handled = true;
- //小数点的处理。
- if ((int)e.KeyChar == 46) //小数点
- {
- if (tb_blyz.Text.Length <= 0)
- e.Handled = true; //小数点不能在第一位
- else
- {
- float f;
- float oldf;
- bool b1 = false, b2 = false;
- b1 = float.TryParse(tb_blyz.Text, out oldf);
- b2 = float.TryParse(tb_blyz.Text + e.KeyChar.ToString(), out f);
- if (b2 == false)
- {
- if (b1 == true)
- e.Handled = true;
- else
- e.Handled = false;
- }
- }
- }
- }
- #endregion
- #region 三元相图相关
- //三元相图模板文件夹
- private void btn_klljwjj_Click(object sender, EventArgs e)
- {
-
- string strb = ".\\Config\\ProData\\";
- folderBrowserDialog1.SelectedPath = strb;
- }
- private void btn_sjtwj_Click(object sender, EventArgs e)
- {
- Triangulation_List tl = new Triangulation_List(m_ReportApp);
- tl.ShowDialog();
- }
- #endregion
- #region 粒级相关
- private void btn_PartSize_Click(object sender, EventArgs e)
- {
- frmPartSizeEditorNew fPSEN = new frmPartSizeEditorNew(m_ReportApp, strbpath, comboBox_PartiSizeFileFolder.Text);
- if (fPSEN.ShowDialog() == DialogResult.OK)
- {
- }
- }
- #endregion
- #region 报告模板相关
- //报表模板
- private void btn_bbmbwjj_Click(object sender, EventArgs e)
- {
- FolderBrowserDialog ofd = new FolderBrowserDialog();
- if (ofd.ShowDialog() == DialogResult.OK)
- {
- //tb_bgmb.Text = ofd.SelectedPath + @"\";
- }
- }
- //参数设置,报告模板文件
- private void button2_Click(object sender, EventArgs e)
- {
- //if (tb_bgmb.Text != "")
- //{
- // OpenFileDialog op = new OpenFileDialog();
- // string strpath = "";
- // op.InitialDirectory = tb_bgmb.Text;
- // if (op.ShowDialog() == DialogResult.OK)
- // {
- // strpath = op.FileName;
- // tb_bgmbwj.Text = strpath;
- // }
- //}
- }
- #endregion
- #region 报告参数设置相关
- //取消
- private void btn_ybcsqx_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- public string strParSizeFile = "";
- //保存报告文件
- private void btn_ybcsbc_Click(object sender, EventArgs e)
- {
- double blyz = 0;
- if (!double.TryParse(tb_blyz.Text.ToString(), out blyz))
- {
- MessageBox.Show("please check params!");
- }
- //根据xml读取内容
- XmlOperateUtil xmlutil = new XmlOperateUtil(".\\Config\\ProData\\"+comboBox_PartiSizeFileFolder.Text.ToString());
- string PartiSize=xmlutil.GetAttribute("Name", "XMLData");
- //比例因子
- OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.EditXmlInfo(Application.StartupPath + RptConfigFile.m_ReportMgrParamFile, "Scale", "strValue", tb_blyz.Text.ToString());
- OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.EditXmlInfo(Application.StartupPath + RptConfigFile.m_ReportMgrParamFile, "PartSizeFile", "name", comboBox_PartiSizeFileFolder.Text.ToString());
- //OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.EditXmlInfo(Application.StartupPath + RptConfigFile.m_ReportMgrParamFile, "PartSize", "strValue", PartiSize);
- OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.EditXmlInfo(Application.StartupPath + RptConfigFile.m_ReportMgrParamFile, "TRIO_CHART_TYPE", "strValue", cB_sjtmbwj.Text.ToString());
- OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.EditXmlInfo(Application.StartupPath + RptConfigFile.m_ReportMgrParamFile, "SIZE_CAL_METHOD_TYPE", "strValue", cB_SIZE_CAL_METHOD_TYPE.Text.ToString());
- if (m_ReportApp.m_rstDataMgr.CurResultFile != null)
- {
- m_ReportApp.m_conditionChoose.SetDefaultConditionValue();
- }
- this.Close();
- }
- #endregion
- }
- }
|