| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224 |
- using OTSCLRINTERFACE;
- using OTSIncAReportApp.OTSSampleReportInfo;
- using OTSIncAReportApp.SysMgrTools;
- using OTSIncAReportGraph.OTSIncAReportGraphFuncation;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Data;
- using System.IO;
- using System.Linq;
- namespace OTSIncAReportApp.OTSDataMgrFunction
- {
- /// <summary>
- /// 框架与底层进行交互的操作类
- /// </summary>
- public class ResultDataMgr
- {
- #region 变量定义
- /// <summary>
- /// 报告主进程框架对象
- /// </summary>
- private frmReportApp m_ReportApp = null;
- public CReportMgrClr m_ReportMgr;
- public List<DataOperation.Model.ResultFile> resultFilesList = new List<DataOperation.Model.ResultFile>(); //测量结果列表
- public int WorkingResult = -1;
- public DataOperation.Model.RptConfigFile m_RptConfigFile = new DataOperation.Model.RptConfigFile(); //报表程序的配置文件
- #endregion
- public OTSReportFun m_ReportFun = null;
- #region 构造函数
- /// <summary>
- /// 构造函数
- /// </summary>
- /// <param name="ReportApp"></param>
- public ResultDataMgr(frmReportApp ReportApp)
- {
- m_ReportApp = ReportApp;
-
- if (null == m_ReportMgr)
- {
- //初始化相关变量
- m_ReportMgr = new CReportMgrClr();
- }
- }
-
-
- #endregion
- #region 获取组合项相关方法
- /// <summary>
- /// 根据系统设置的默认粒级表路径,获取所有的粒级表文件List
- /// </summary>
- /// <returns></returns>
- public List<string> GetPartSizeFileList()
- {
- List<string> ret_list = new List<string>();
- //遍历粒级文件夹
- DirectoryInfo theFolder = new DirectoryInfo(m_RptConfigFile.FileFolderSize);
- if (!theFolder.Exists)
- return ret_list;
- //读取遍历粒级文件信息
- foreach (FileInfo nextifile in theFolder.GetFiles())
- {
- //找出粒级文件
- if (nextifile.Name.Contains(".psf") == true || nextifile.Name.Contains(".PSF") == true)
- {
- ret_list.Add(nextifile.Name);
- }
- }
- return ret_list;
- }
- /// <summary>
- /// 根据系统设置默认的粒级表的路径,获取粒级表List
- /// </summary>
- /// <param name="path"></param>
- /// <returns></returns>
- public List<string> GetPartSizeList()
- {
- DataSet ds = DataOperation.DataAccess.XMLoperate.GetXml(m_RptConfigFile.FileFolderSize + m_RptConfigFile.PartSizeFile);
- string sizestr = ds.Tables[0].Rows[0]["Sizes"].ToString();
- List<string> sizeList = new List<string>();
- for (int i = 0; i < sizestr.Split(',').Length - 1; i++)
- {
- if (sizestr.Split(',')[i].Length > 0)
- {
- double d1 = Convert.ToDouble(sizestr.Split(',')[i]);
- double d2 = Convert.ToDouble(sizestr.Split(',')[i + 1]);
- sizeList.Add(d1.ToString() + "~" + d2.ToString());
- }
- }
- double d = Convert.ToDouble(sizestr.Split(',')[sizestr.Split(',').Length - 1]);
- sizeList.Add(d.ToString() + "~MAX");
- return sizeList;
- }
- /// <summary>
- /// 根据传入的粒级表目录,获取粒级表List
- /// </summary>
- /// <returns></returns>
- public List<string> GetPartSizeList(string path)
- {
- DataSet ds = DataOperation.DataAccess.XMLoperate.GetXml(path);
- string sizestr = ds.Tables[0].Rows[0]["Sizes"].ToString();
- List<string> sizeList = new List<string>();
- for (int i = 0; i < sizestr.Split(',').Length - 1; i++)
- {
- if (sizestr.Split(',')[i].Length > 0)
- {
- double d1 = Convert.ToDouble(sizestr.Split(',')[i]);
- double d2 = Convert.ToDouble(sizestr.Split(',')[i + 1]);
- sizeList.Add(d1.ToString() + "~" + d2.ToString());
- }
- }
- double d = Convert.ToDouble(sizestr.Split(',')[sizestr.Split(',').Length - 1]);
- sizeList.Add(d.ToString() + "~MAX");
- return sizeList;
- }
- /// <summary>
- /// 获取三元相图模板名称列表
- /// </summary>
- /// <returns></returns>
- public List<string> GetTriTemplateNameList()
- {
- string pathtpf = m_RptConfigFile.FileFolderTrigTemp + m_RptConfigFile.TriTempFile;
- List<string> ret_list = new List<string>();
- DataSet ds = DataOperation.DataAccess.XMLoperate.GetXmlData(pathtpf, "XMLData");
- DataTable dt = ds.Tables["Member"];
- foreach (DataRow item in dt.Rows)
- {
- if (item["TemplateName"].ToString() != "")
- {
- ret_list.Add(item["TemplateName"].ToString());
- }
- }
- return ret_list;
- }
- /// <summary>
- /// 获取测量结果名称列表
- /// </summary>
- /// <returns></returns>
- public List<string> GetSampleListName()
- {
- List<string> ret_list = new List<string>();
- var resultfileList = resultFilesList;
- foreach (var item in resultfileList)
- {
- ret_list.Add(item.FileName);
- }
- if (m_ReportApp.MoreSource != "")
- {
- ret_list.Add(m_ReportApp.MoreSource);
- }
- return ret_list;
- }
- public List<string> GetDataSourceTypeList()
- {
- //string sscaptionname23 = table["sscaptionname23"].ToString();
- //string sscaptionname24 = table["sscaptionname24"].ToString();
- List<string> ret_list = new List<string>() { "AllParticles"};
- return ret_list;
- }
- /// <summary>
- /// 获取计算方法列表
- /// </summary>
- /// <returns></returns>
- public List<string> GetSizeCalMethodTypeList()
- {
- List<string> ret_list = new List<string>() { "DMAX", "DMIN", "Area", "FERET" };
- return ret_list;
- }
- /// <summary>
- /// 数据类型,全部颗粒,分析颗粒
- /// </summary>
- /// <returns></returns>
- #endregion
- #region [测量结果treeview]相关封装方法
- /// <summary>
- /// 获取测量结果treeview树测量结果名
- /// </summary>
- /// <returns></returns>
- public string GetSampleName()
- {
- //获取样品名
- String sWorkSampleName = resultFilesList[WorkingResult].FileName;
- if (null == sWorkSampleName)
- {
- return "";
- }
- return sWorkSampleName;
- }
- #endregion
-
- }
- }
|