Browse Source

refactor the ParticleData class and create the new class FieldImage.cs

GSP 1 month ago
parent
commit
e26f2f90fb

+ 1 - 22
OTSCommon/DBOperate/Model/Field.cs

@@ -37,28 +37,7 @@ namespace OTSCommon.DBOperate.Model
         {
             return new PointF(FieldPosX, FieldPosY);
         }
-        public Bitmap GetFieldImage()
-        {
-            if (mImage == null)
-            {
-                 //mImage = DrawFunction.ReadImageFile(FieldImageName);
-                if (!File.Exists(FieldImageName))
-                {
-                    return null;//文件不存在
-                }
-                FileStream fs = File.OpenRead(FieldImageName); //OpenRead
-                int filelength = 0;
-                filelength = (int)fs.Length; //获得文件长度 
-                Byte[] image = new Byte[filelength]; //建立一个字节数组 
-                fs.Read(image, 0, filelength); //按字节流读取 
-                System.Drawing.Image result = System.Drawing.Image.FromStream(fs);
-                fs.Close();
-                 mImage = new Bitmap(result);
-               
-            }
-         
-            return mImage;
-        }
+       
         /// <summary>
         /// FieldPosY
         /// </summary>       

+ 15 - 14
OTSIncAReportApp/1-UI/Control_Grids/ParticlesGridDevidePage/ListOfSimilarParticles.cs

@@ -377,10 +377,10 @@ namespace OTSIncAReportApp._1_UI.Control_Grids.ParticlesGridDevidePage
                                 double ScanFieldSize = _particlesGridDevidePage.result.GetScanFieldSizeX();
                                 string filePatht = _particlesGridDevidePage.result.FilePath + "\\FIELD_FILES\\";
                                 string imagePatht = filePatht + "Field" + subt.Split(',')[0].Split(':')[0].ToString() + ".bmp";
-                                Bitmap tempbit = _particlesGridDevidePage.Particledata.ReadImageFile(imagePatht);
+                                Bitmap tempbit = _particlesGridDevidePage.fldImgAccess.ReadImageFile(imagePatht);
                                 int pixw = tempbit.Width;
                                 double xs = pixw / ScanFieldSize;
-                                bmap = _particlesGridDevidePage.Particledata.GetBitmapForBig(subt, xs, _particlesGridDevidePage.result.FilePath, tempbit.Height, tempbit.Width);
+                                bmap = _particlesGridDevidePage.fldImgAccess.GetBitmapForMergedParticle(subt, xs, _particlesGridDevidePage.result.FilePath, tempbit.Height, tempbit.Width);
                                 if (bmap != null)
                                 {
                                     string[] str = subt.Split(',');
@@ -394,10 +394,10 @@ namespace OTSIncAReportApp._1_UI.Control_Grids.ParticlesGridDevidePage
                                     string imagePath = filePath + "Field" + particles.Rows[i]["fieldid"].ToString() + ".bmp";
 
 
-                                    fieldpics.Add(particles.Rows[i]["fieldid"].ToString(), _particlesGridDevidePage.Particledata.ReadImageFile(imagePath));
+                                    fieldpics.Add(particles.Rows[i]["fieldid"].ToString(), _particlesGridDevidePage.fldImgAccess.ReadImageFile(imagePath));
                                 }
                                 Rectangle rectangle = new Rectangle() { X = Convert.ToInt32(particles.Rows[i]["RectLeft"]), Y = Convert.ToInt32(particles.Rows[i]["RectTop"]), Width = Convert.ToInt32(particles.Rows[i]["RectWidth"]), Height = Convert.ToInt32(particles.Rows[i]["RectHeight"]) };
-                                bmap = _particlesGridDevidePage.Particledata.GetBitmapByParticle(fieldpics[particles.Rows[i]["fieldid"].ToString()], rectangle);
+                                bmap = _particlesGridDevidePage.fldImgAccess.GetBitmapByParticle(fieldpics[particles.Rows[i]["fieldid"].ToString()], rectangle);
                                 bmap.Tag = new List<string>() { particles.Rows[i]["FieldId"].ToString(), particles.Rows[i]["ParticleId"].ToString() };
                                 dgV_SimilarParticles.Rows[add_rowindex].Height = bmap.Height + 20;
                             }
@@ -779,21 +779,22 @@ namespace OTSIncAReportApp._1_UI.Control_Grids.ParticlesGridDevidePage
                         string filePath = _particlesGridDevidePage.result.FilePath + "\\FIELD_FILES\\";
                         string imagePath = filePath + "Field" + dgvr.Cells["fieldid"].Value.ToString() + ".bmp";
                         Bitmap m_originalImage = DrawFunction.ReadImageFile(imagePath);
-                        Bitmap bmap = _particlesGridDevidePage.Particledata.GetBitmapByParticle(dpImage, rectangle);
-                        Bitmap bmap1 = _particlesGridDevidePage.Particledata.GetBitmapByParticle(m_originalImage, rectangle);
+                        Bitmap bmap = _particlesGridDevidePage.fldImgAccess.GetBitmapByParticle(dpImage, rectangle);
+                        Bitmap bmap1 = _particlesGridDevidePage.fldImgAccess.GetBitmapByParticle(m_originalImage, rectangle);
                         control_XRayTable1.SetBitmapOfPictureBox(bmap1, bmap);
                         Invalidate();
                     }
                     else
                     {
-                        double ScanFieldSize = _particlesGridDevidePage.result.GetScanFieldSizeX();
-                        string filePatht = _particlesGridDevidePage.result.FilePath + "\\FIELD_FILES\\";
-
-                        string imagePatht = filePatht + "Field" + subt.Split(',')[0].Split(':')[0].ToString() + ".bmp";
-                        Bitmap tempbit = _particlesGridDevidePage.Particledata.ReadImageFile(imagePatht);
-                        int pixw = tempbit.Width;
-                        double xs = pixw / ScanFieldSize;
-                        Bitmap bp = _particlesGridDevidePage.Particledata.GetBitmapForBigBlackAndWhiteImage(subt, xs, _particlesGridDevidePage.result.FilePath, tempbit.Height, tempbit.Width);
+                        double xs = _particlesGridDevidePage.result.GetPixelSize();
+                        int width = _particlesGridDevidePage.result.GetImageWidth();
+                        int height = _particlesGridDevidePage.result.GetImageHeight();
+                        int fldid = Convert.ToInt32(dgvr.Cells["fieldid"].Value);
+                        int partid = Convert.ToInt32(dgvr.Cells["particleId"].Value);
+                        var listseg = _particlesGridDevidePage.Particledata.GetSegmentData(fldid, partid);
+                        string vs = "," + subt.Replace(':', '-') + ",";
+                        DataTable dataTable = _particlesGridDevidePage.Particledata.GetParticleAllForBig(vs);//组成拼接颗粒的子颗粒
+                        Bitmap bp = _particlesGridDevidePage.fldImgAccess.GetBitmapForBigBlackAndWhiteImage(subt, xs, _particlesGridDevidePage.result.FilePath, height, width,dataTable,listseg);
                         control_XRayTable1.SetBitmapOfPictureBox(ls_bp, bp);
                         Invalidate();
                     }

+ 33 - 23
OTSIncAReportApp/1-UI/Control_Grids/ParticlesGridDevidePage/ParticlesGridDevidePage.cs

@@ -1,4 +1,5 @@
-using NPOI.SS.UserModel;
+using NPOI.SS.Formula.Functions;
+using NPOI.SS.UserModel;
 using NPOI.SS.UserModel.Charts;
 using NPOI.SS.Util;
 using NPOI.XSSF.UserModel;
@@ -8,6 +9,7 @@ using OTSCommon.DBOperate.Model;
 using OTSIncAReportApp;
 using OTSIncAReportApp._1_UI.Control_Grids.ParticlesGridDevidePage;
 using OTSIncAReportApp._2_CommonFunction.CommonClass;
+using OTSIncAReportApp._3_ServiceCenter.DataOperation.DataAccess;
 using OTSIncAReportApp.DataOperation.DataAccess;
 using OTSIncAReportApp.OTSRstMgrFunction;
 using OTSIncAReportApp.SysMgrTools;
@@ -78,7 +80,8 @@ namespace OTSIncAReportGrids
         DataTable particlesAll;
         DataTable particles;
         public ParticleData Particledata;
-        UserSTDDbData userSTDDb;
+       public UserSTDDbAccess userSTDDb;
+       public FieldImage fldImgAccess;
         DataTable userSTDDbData;
         NLog.Logger log = NLog.LogManager.GetCurrentClassLogger();
 
@@ -228,11 +231,12 @@ namespace OTSIncAReportGrids
                 m_mythread = new Thread(new ParameterizedThreadStart(ControlThread_GO));
                 fieldData = new FieldData(result.FilePath);
                 Particledata = new ParticleData(result.FilePath);
+                fldImgAccess = new FieldImage(result.FilePath);
                 var systype = m_ReportApp.m_RptConfigFile.Systype;
                 if (systype == OTS_SysType_ID.TCCleannessA || systype == OTS_SysType_ID.BatteryCleannessA)
                 {
                     string str_STDDbName = result.GetSTDName();
-                    userSTDDb = new UserSTDDbData(str_STDDbName, result.FilePath + "\\");
+                    userSTDDb = new UserSTDDbAccess(str_STDDbName, result.FilePath + "\\");
                     if (userSTDDb.GetSqlHelper() != null)
                     {
                         userSTDDbData = userSTDDb.GetSubAttributeFromDatabase();
@@ -515,14 +519,19 @@ namespace OTSIncAReportGrids
                             Bitmap bmap = null;
                             if (subt != null && subt != "" && subt != "IsSubParticle")
                             {
-                                double ScanFieldSize = result.GetScanFieldSizeX();
-                                string filePatht = result.FilePath + "\\FIELD_FILES\\";
-                                string imagePatht = filePatht + "Field" + subt.Split(',')[0].Split(':')[0].ToString() + ".bmp";
-                                Bitmap tempbit = Particledata.ReadImageFile(imagePatht);
-                                int pixw = tempbit.Width;
-                                double xs = pixw / ScanFieldSize;
-                                
-                                bmap = Particledata.GetBitmapForBig(subt, xs, result.FilePath, tempbit.Height, tempbit.Width);
+                                //double ScanFieldSize = result.GetScanFieldSizeX();
+                                //string filePatht = result.FilePath + "\\FIELD_FILES\\";
+                                //string imagePatht = filePatht + "Field" + subt.Split(',')[0].Split(':')[0].ToString() + ".bmp";
+                                //Bitmap tempbit = Particledata.ReadImageFile(imagePatht);
+                                //int pixw = tempbit.Width;
+                                double xs = result.GetPixelSize();
+                                int width = result.GetImageWidth(); 
+                                int height = result.GetImageHeight();
+                            
+                               
+                                string vs = "," + subt.Replace(':', '-') + ",";
+                                DataTable dataTable = Particledata.GetParticleAllForBig(vs);//组成拼接颗粒的子颗粒
+                                bmap = fldImgAccess.GetBitmapForMergedParticle(subt, xs, result.FilePath, height, width);
                                 if (bmap != null)
                                 {
                                     string[] str = subt.Split(',');
@@ -536,10 +545,10 @@ namespace OTSIncAReportGrids
                                     string imagePath = filePath + "Field" + particles.Rows[i]["fieldid"].ToString() + ".bmp";
 
                                     
-                                    fieldpics.Add(particles.Rows[i]["fieldid"].ToString(), Particledata.ReadImageFile(imagePath));
+                                    fieldpics.Add(particles.Rows[i]["fieldid"].ToString(), fldImgAccess.ReadImageFile(imagePath));
                                 }
                                 Rectangle rectangle = new Rectangle() { X = Convert.ToInt32(particles.Rows[i]["RectLeft"]), Y = Convert.ToInt32(particles.Rows[i]["RectTop"]), Width = Convert.ToInt32(particles.Rows[i]["RectWidth"]), Height = Convert.ToInt32(particles.Rows[i]["RectHeight"]) };
-                                bmap = Particledata.GetBitmapByParticle(fieldpics[particles.Rows[i]["fieldid"].ToString()], rectangle);
+                                bmap = fldImgAccess.GetBitmapByParticle(fieldpics[particles.Rows[i]["fieldid"].ToString()], rectangle);
                                 bmap.Tag = new List<string>() { particles.Rows[i]["FieldId"].ToString(), particles.Rows[i]["ParticleId"].ToString()};
                                 dgV_ParticlesDevidePage.Rows[add_rowindex].Height = bmap.Height + 20;
                             }
@@ -2494,21 +2503,22 @@ namespace OTSIncAReportGrids
                         string filePath = result.FilePath + "\\FIELD_FILES\\";
                         string imagePath = filePath + "Field" + dgvr.Cells["fieldid"].Value.ToString() + ".bmp";
                         Bitmap m_originalImage = DrawFunction.ReadImageFile(imagePath);
-                        Bitmap bmap = Particledata.GetBitmapByParticle(dpImage, rectangle);
-                        Bitmap bmap1 = Particledata.GetBitmapByParticle(m_originalImage, rectangle);
+                        Bitmap bmap = fldImgAccess.GetBitmapByParticle(dpImage, rectangle);
+                        Bitmap bmap1 = fldImgAccess.GetBitmapByParticle(m_originalImage, rectangle);
                         control_XRayTable1.SetBitmapOfPictureBox(bmap1, bmap);
                         Invalidate();
                     }
                     else
                     {
-                        double ScanFieldSize = result.GetScanFieldSizeX();
-                        string filePatht = result.FilePath + "\\FIELD_FILES\\";
-                        
-                        string imagePatht = filePatht + "Field" + subt.Split(',')[0].Split(':')[0].ToString() + ".bmp";
-                        Bitmap tempbit = Particledata.ReadImageFile(imagePatht);
-                        int pixw = tempbit.Width;
-                        double xs = pixw / ScanFieldSize;
-                        Bitmap bp= Particledata.GetBitmapForBigBlackAndWhiteImage(subt, xs, result.FilePath, tempbit.Height, tempbit.Width);
+                        double xs = result.GetPixelSize();
+                        int width = result.GetImageWidth();
+                        int height = result.GetImageHeight();
+                        int fldid= Convert.ToInt32(dgvr.Cells["fieldid"].Value);
+                        int partid= Convert.ToInt32(dgvr.Cells["particleId"].Value);
+                        var listseg = Particledata.GetSegmentData(fldid, partid);
+                        string vs = "," + subt.Replace(':', '-') + ",";
+                        DataTable dataTable = Particledata. GetParticleAllForBig(vs);//组成拼接颗粒的子颗粒
+                        Bitmap bp = fldImgAccess.GetBitmapForBigBlackAndWhiteImage(subt, xs, result.FilePath, height, width,dataTable,listseg );
                         control_XRayTable1.SetBitmapOfPictureBox(ls_bp,bp);
                         Invalidate();
                     }

+ 4 - 1
OTSIncAReportApp/1-UI/OTSReportExport/DataIntegration/BasicData.cs

@@ -2,6 +2,7 @@
 using DevExpress.Office.Drawing;
 using NPOI.Util;
 using OTSCommon.DBOperate;
+using OTSIncAReportApp._2_CommonFunction.CommonClass;
 using OTSIncAReportApp.DataOperation.DataAccess;
 using OTSIncAReportApp.OTSRstMgrFunction;
 using System;
@@ -441,7 +442,9 @@ namespace OTSIncAReportApp._1_UI.OTSReportExport.DataIntegration
 
             #region 测量结果颗粒组队列
             List<DataTable> datas1 = new List<DataTable>();
-			List<string> stringsa = fielddata.ObtainParticleCategory(m_otsreport_export, this);
+            ResultFile rstf = m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.GetWorkingResultId()];
+            UserSTDDbAccess dbAccess = new UserSTDDbAccess(rstf.GetSTDName(),rstf.FilePath);
+            List<string> stringsa = dbAccess.ObtainParticleCategory(m_otsreport_export, this);
 			for (int i = 0; i < stringsa.Count; i++)
 			{
 				DataTable data = dtp.Clone();

+ 18 - 14
OTSIncAReportApp/1-UI/OTSReportExport/DataIntegration/ParticleList.cs

@@ -4,9 +4,11 @@ using DevExpress.PivotGrid.OLAP.SchemaEntities;
 using DevExpress.XtraDiagram.Bars;
 using DevExpress.XtraTreeList.Data;
 using NPOI.Util;
+using Org.BouncyCastle.Crypto;
 using OTSCommon.DBOperate;
 using OTSCommon.DBOperate.Model;
 using OTSIncAReportApp._1_UI.Control_Graph.Controls;
+using OTSIncAReportApp._3_ServiceCenter.DataOperation.DataAccess;
 using OTSIncAReportApp.DataOperation.DataAccess;
 using OTSIncAReportApp.OTSRstMgrFunction;
 using OTSIncAReportGraph.Controls;
@@ -32,19 +34,21 @@ namespace OTSIncAReportApp._1_UI.OTSReportExport.DataIntegration
     /// </summary>
     class ParticleList
     {
-
-		/// <summary>
-		/// DEV颗粒列表颗粒前20个谱图排序
-		/// </summary>
-		/// <param name="m_mbszclass"></param>
-		/// <returns></returns>
-		public List<DataTable> Get_dev_kllb_data(c_TemplateClass m_mbszclass, OTSReport_Export m_otsreport_export,BasicData basicData,out List<DataTable> a_FilteredData)
+        //string str_resultPath = m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.GetWorkingResultId()].FilePath;
+        ParticleData fielddata;
+        FieldImage imgAcc;
+        /// <summary>
+        /// DEV颗粒列表颗粒前20个谱图排序
+        /// </summary>
+        /// <param name="m_mbszclass"></param>
+        /// <returns></returns>
+        public List<DataTable> Get_dev_kllb_data(c_TemplateClass m_mbszclass, OTSReport_Export m_otsreport_export,BasicData basicData,out List<DataTable> a_FilteredData)
 		{
 			
 			//------------------加载模块,获取数据-------------------------------------------------
 			string str_resultPath = m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.GetWorkingResultId()].FilePath;
-			ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.GetWorkingResultId()].FilePath);
-
+			 fielddata = new ParticleData(str_resultPath);
+             imgAcc = new FieldImage(str_resultPath   );
             List<DataTable> OutDt = new List<DataTable>();
             a_FilteredData = new List<DataTable>();
 
@@ -179,8 +183,8 @@ namespace OTSIncAReportApp._1_UI.OTSReportExport.DataIntegration
 								continue;
 							Rectangle rectangle = new Rectangle()
 							{ X = Convert.ToInt32(p1Data.Rows[i_row]["RectLeft"]), Y = Convert.ToInt32(p1Data.Rows[i_row]["RectTop"]), Width = Convert.ToInt32(p1Data.Rows[i_row]["RectWidth"]), Height = Convert.ToInt32(p1Data.Rows[i_row]["RectHeight"]) };
-							Bitmap bp_field = fielddata.ReadImageFile(str_imagePath);
-							Bitmap bp_particle = fielddata.GetBitmapByParticle(bp_field, rectangle);
+							Bitmap bp_field = imgAcc.ReadImageFile(str_imagePath);
+							Bitmap bp_particle = imgAcc.GetBitmapByParticle(bp_field, rectangle);
 							bp_particle = imageProcessor.ResizeImageWithPadding(bp_particle, 120, 120, System.Drawing.Color.White);
 							bp_particle.Tag = new List<string>() { p1Data.Rows[i_row]["FieldId"].ToString(), p1Data.Rows[i_row]["ParticleId"].ToString(), p1Data.Rows[i_row]["TypeId"].ToString() };
 							//获取该颗粒的xray能谱图像
@@ -316,10 +320,10 @@ namespace OTSIncAReportApp._1_UI.OTSReportExport.DataIntegration
 				if (FieldImage.Key != particles.Rows[i]["fieldid"].ToString() || FieldImage.Value == null)
 				{
 					string imagePath = filePath + "Field" + particles.Rows[i]["fieldid"].ToString() + ".bmp";
-					FieldImage = new KeyValuePair<string, Bitmap>(particles.Rows[i]["fieldid"].ToString(), Particledata.ReadImageFile(imagePath));
+					FieldImage = new KeyValuePair<string, Bitmap>(particles.Rows[i]["fieldid"].ToString(), imgAcc.ReadImageFile(imagePath));
 				}
 				Rectangle rectangle = new Rectangle() { X = Convert.ToInt32(particles.Rows[i]["RectLeft"]), Y = Convert.ToInt32(particles.Rows[i]["RectTop"]), Width = Convert.ToInt32(particles.Rows[i]["RectWidth"]), Height = Convert.ToInt32(particles.Rows[i]["RectHeight"]) };
-				Bitmap bmap = Particledata.GetBitmapByParticle(FieldImage.Value, rectangle);
+				Bitmap bmap = imgAcc.GetBitmapByParticle(FieldImage.Value, rectangle);
 				bmap.Tag = new List<string>() { particles.Rows[i]["FieldId"].ToString(), particles.Rows[i]["ParticleId"].ToString(), particles.Rows[i]["TypeId"].ToString(), particles.Rows[i]["XrayId"].ToString() };
                 DataRow row = SplicingParticlesData.NewRow();
                 row["image"] = bmap;
@@ -775,7 +779,7 @@ namespace OTSIncAReportApp._1_UI.OTSReportExport.DataIntegration
                             bp_field = new Bitmap(DT_field_dt.Rows[i]["fieldFullName"].ToString());
                         }
                     }
-                    bp_particle = fielddata.GetBitmapByParticle(bp_field, rectangle);
+                    bp_particle = imgAcc.GetBitmapByParticle(bp_field, rectangle);
                     bp_particle.Tag = new List<string>() { dt.Rows[i_row]["FieldId"].ToString(), dt.Rows[i_row]["ParticleId"].ToString(), dt.Rows[i_row]["TypeId"].ToString() };
                     DataRow dr = FrameGraphSubTable.NewRow();
                     dr["pic"] = bp_particle;

+ 5 - 2
OTSIncAReportApp/1-UI/OTSReportExport/OTSReport_Export.cs

@@ -20,6 +20,7 @@ using OTSIncAReportApp._1_UI.OTSReportExport;
 using OTSIncAReportApp.DataOperation.DataAccess;
 using DevExpress.CodeParser;
 using DevExpress.XtraTreeList.Data;
+using OTSIncAReportApp._2_CommonFunction.CommonClass;
 
 namespace OTSIncAReportApp
 {
@@ -1226,8 +1227,10 @@ namespace OTSIncAReportApp
                
 
 			ParticleData particleData = new ParticleData();
-			m_mbszclass.RuleGroup = particleData.ObtainParticleCategory_start(fullPathR);
-			m_mbszclass.List_data = particleData.ObtainRuleData_start(m_mbszclass.RuleGroup, fullPathR);
+            ResultFile rstf = m_ReportApp.m_rstDataMgr.ResultFilesList[m_ReportApp.m_rstDataMgr.GetWorkingResultId()];
+            UserSTDDbAccess dbAccess = new UserSTDDbAccess(rstf.GetSTDName(), rstf.FilePath);
+            m_mbszclass.RuleGroup = dbAccess.ObtainParticleCategory_start(fullPathR);
+			m_mbszclass.List_data = dbAccess.ObtainRuleData_start(m_mbszclass.RuleGroup, fullPathR);
 
 			string[] Separator = { " , " };
 			string[] parts = m_mbszclass.str_MainPriorityID.ToString().Split(Separator, StringSplitOptions.RemoveEmptyEntries);

+ 1 - 1
OTSIncAReportApp/1-UI/frmReMeasure.cs

@@ -469,7 +469,7 @@ namespace OTSIncAReportApp
             }
             string str_libraryName = ReportFun.resultFile.GetSTDName();
             DataTable userLibraryData = new DataTable();
-            UserSTDDbData userLibrary = new UserSTDDbData(str_libraryName, ReportFun.resultFile.FilePath+"\\");
+            UserSTDDbAccess userLibrary = new UserSTDDbAccess(str_libraryName, ReportFun.resultFile.FilePath+"\\");
             if (userLibrary.GetSqlHelper() != null)
             {
                 userLibraryData = userLibrary.GetSubAttributeFromDatabase();

+ 0 - 56
OTSIncAReportApp/2-CommonFunction/CommonClass/UserSTDDbData.cs

@@ -1,56 +0,0 @@
-using OTSIncAReportApp.DataOperation.DataAccess;
-using System;
-using System.Collections.Generic;
-using System.Data;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace OTSIncAReportApp._2_CommonFunction.CommonClass
-{
-    internal class UserSTDDbData
-    {
-
-        private SqlHelper dbHelper;
-
-        public UserSTDDbData(string STDDbName, string resultpath)
-        {
-            NLog.Logger log = NLog.LogManager.GetCurrentClassLogger();
-            if (!STDDbName.Contains(".db"))
-            {
-                STDDbName += ".db";
-            }
-            if (STDDbName.ToLower() == "nostddb.db")
-            {
-                dbHelper = null;
-                log.Error("Failed to load user-defined library" + "!");
-            }
-            string fullPath = resultpath + STDDbName;
-            string fullPath2 = System.IO.Directory.GetCurrentDirectory() + "\\Config\\SysData\\" + STDDbName;
-            if (System.IO.File.Exists(fullPath))
-            {
-                dbHelper = new SqlHelper("data source='" + fullPath + "'");
-                log.Warn("Loading the user standard library:" + fullPath + "!");
-            }
-            else if (System.IO.File.Exists(fullPath2))
-            {
-                dbHelper = new SqlHelper("data source='" + fullPath2 + "'");
-                log.Warn("Loading the user standard library:" + fullPath2 + "!");
-            }
-            else
-            {
-                dbHelper = null;
-                log.Error("Failed to load user-defined library" + "!");
-            }
-        }
-        public DataTable GetSubAttributeFromDatabase()
-        {
-            string sqliteString = "select STDId,Hardness,Density,Electrical_conductivity from ClassifySTD";
-            DataTable DT = new DataTable();
-            DT = dbHelper.ExecuteQuery(sqliteString);
-            return DT;
-        }
-
-        public SqlHelper GetSqlHelper() { return dbHelper; }
-    }
-}

+ 0 - 15
OTSIncAReportApp/2-CommonFunction/OTSRstMgrFunction/IReport.cs

@@ -1,15 +0,0 @@
-using OTSIncAReportApp.OTSSampleReportInfo;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace OTSIncAReportApp.OTSDataMgrFunction
-{
-    //报告项目,接口
-    public interface IReport
-    {
-
-    }
-}

+ 0 - 16
OTSIncAReportApp/2-CommonFunction/OTSRstMgrFunction/IReportBase.cs

@@ -1,16 +0,0 @@
-using OTSIncAReportApp.OTSSampleReportInfo;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-
-namespace OTSIncAReportApp.OTSDataMgrFunction
-{
-    //报告项目,共用接口类,基类,一起维护这个类,共同使用
-    public class IReportBase : IReport
-    {
-
-    }
-}

+ 0 - 402
OTSIncAReportApp/2-CommonFunction/OTSRstMgrFunction/ResultDataMgr.cs

@@ -1,402 +0,0 @@
-
-using OTSCLRINTERFACE;
-using OTSIncAReportApp.DataOperation.DataAccess;
-
-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;
-using System.Windows.Forms;
-using OTSCommon.DBOperate.Model;
-namespace OTSIncAReportApp.OTSRstMgrFunction
-{
-    /// <summary>
-    /// 框架与底层进行交互的操作类
-    /// </summary>
-    public class ResultDataMgr
-    {
-        #region 变量定义
-
-      
-        /// <summary>
-        /// 报告主进程框架对象
-        /// </summary>
-      
-        public CReportMgrClr m_ReportMgr;
-        private List<ResultFile> resultFilesList = new List<ResultFile>();   //测量结果列表
-        private int workingResultId = -1;
-       
-        public RptConfigFile m_RptConfigFile = RptConfigFile.GetRptConfig();         //报表程序的配置文件
-        #endregion
-
-     
-        
-        private ResultFile m_curResultFile;
-
-
-        public int GetWorkingResultId()
-        {
-            return workingResultId;
-        }
-
-        public void SetWorkingResultId(int value)
-        {
-            if (resultFilesList.Count > 0)
-            {
-                workingResultId = value;
-                m_curResultFile = resultFilesList[value];
-            }
-           
-        }
-     
-        public ResultFile GetResultFileObjByName(string rstName)
-        {
-            ResultFile rst = null;
-            foreach (var r in resultFilesList)
-            {
-                if (r.FileName_real == rstName)
-                {
-                    rst = r;
-                }
-
-            }
-            return rst;
-        }
-        public List<ResultFile> ResultFilesList { get => resultFilesList; set => resultFilesList = value; }
-        public ResultFile CurResultFile { get => m_curResultFile; set => m_curResultFile = value; }
-
-        #region 构造函数
-        /// <summary>
-        /// 构造函数
-        /// </summary>
-        /// <param name="ReportApp"></param>
-        public ResultDataMgr()
-        {
-         
-
-
-            if (null == m_ReportMgr)
-            {
-                //初始化相关变量
-                m_ReportMgr = new CReportMgrClr();
-            }
-           
-        }
-        public bool AddDataResult(string str_path)
-        {
-            //加载测量结果文件
-            Dictionary<string, object> suggestions = DataOperation.DataAccess.XMLoperate.GetXMLAllInfo(str_path);
-
-            string name = System.IO.Path.GetFileName(str_path);
-            int workingid = ResultFilesList.Count + 1;
-            string path = System.IO.Path.GetDirectoryName(str_path);
-            if (ResultFilesList.Find(s => s.FilePath == path) != null)
-            {
-                MessageBox.Show("Already have the same result!");
-                return false;
-            }
-            string strname = UpdateName(name, ResultFilesList);
-            if (strname == "")
-            {
-                MessageBox.Show("Already have the same result!");
-                return false;
-            }
-
-
-            ResultFile result = new ResultFile()
-            {
-                FileId = workingid.ToString(),
-                anotherFileName = strname,
-                FileName_real=name,
-                FilePath = path,
-               
-            };
-            result.SetResultInfoDic(suggestions);
-
-
-            ResultFilesList.Add(result);
-
-            SetWorkingResultId(ResultFilesList.IndexOf(result));
-
-            FieldData fieldData = new FieldData(path);
-            List<Field> fieldlist = fieldData.GetFieldList();
-            CurResultFile.SetList_OTSField(fieldlist);
-
-          
-
-            return true;
-        }
-        public void RemoveDataResult(string fileName)
-        {
-            ResultFile rst=null;
-            foreach (var r in resultFilesList)
-            {
-                if (r.FileName_real == fileName)
-                {
-                    rst = r;
-                }
-            
-            }
-            if (rst != null)
-            {
-                resultFilesList.Remove(rst);
-                workingResultId = 0;
-            }
-            else 
-            {
-                workingResultId =-1;
-            }
-           
-        
-        }
-
-        private string UpdateName(string name, List<ResultFile> ResultFilesList)
-        {
-            int reg = 51;
-            if (ResultFilesList.Find(s => s.anotherFileName == name) != null)
-            {
-                for (int i = 1; i < reg; i++)
-                {
-                    string str = name.Split('.')[0].ToString() + "(" + i.ToString() + ")" + name.Split('.')[1].ToString();
-                    if (ResultFilesList.Find(s => s.anotherFileName == str) == null)
-                    {
-                        return name.Split('.')[0].ToString() + "(" + i.ToString() + ")" + name.Split('.')[1].ToString();
-
-                    }
-                }
-            }
-            else
-            {
-                return name;
-            }
-            return "";
-        }
-        #endregion
-
-        #region 获取组合项相关方法
-        /// <summary>
-        /// 根据系统设置的默认粒级表路径,获取所有的粒级表文件List
-        /// </summary>
-        /// <returns></returns>
-        public List<string> GetPartSizeFileList()
-        {
-            List<string> ret_list = new List<string>();
-
-            //遍历粒级文件夹
-            DirectoryInfo theFolder = new DirectoryInfo(m_RptConfigFile.PartSizeFileFolder);
-            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);
-                }
-            }
-            ret_list.Add("AUTO.psf");
-            return ret_list;
-        }
-        public List<string> GetSTDIdList()
-        {
-            
-
-            HashSet<string> stdSet = new HashSet<string>();
-            stdSet.Add("All");
-            foreach (var f in CurResultFile.GetList_OTSField())
-            {
-                foreach (var p in f.ParticleList)
-                {
-                    if (!stdSet.Contains(p.TypeName))
-                    {
-                        stdSet.Add(p.TypeName);
-                    
-                    }
-                
-                }
-            
-            }
-            return stdSet.ToList();
-
-        }
-        /// <summary>
-        /// 根据系统设置默认的粒级表的路径,获取粒级表List
-        /// </summary>
-        /// <param name="path"></param>
-        /// <returns></returns>
-        public List<string> GetPartSizeList()
-        {
-            string sizestr = "";
-            List<string> sizeList = new List<string>();
-            if (m_RptConfigFile.PartSizeFile != "AUTO.psf")
-            {
-                DataSet ds = DataOperation.DataAccess.XMLoperate.GetXml(m_RptConfigFile.PartSizeFileFolder + m_RptConfigFile.PartSizeFile);
-                sizestr = ds.Tables[0].Rows[0]["Sizes"].ToString();
-            }
-            else
-            {
-                double dn;
-                dn = m_curResultFile.GetParticleMINECD();
-                sizestr = dn.ToString() + ",";
-                for (double p = dn; p < 50; p = p * Math.Sqrt(2))
-                {
-                    if (p > dn && p <= 50.5)
-                    {
-                        double dd = Math.Round(p);
-                        sizestr += dd.ToString() + ",";
-                    }
-                }
-                sizestr = sizestr.Remove(sizestr.Length - 1, 1);
-            }
-            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.TrigTemplateFileFolder + 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 string GetDefaultPartSize()
-        {
-            DataSet ds = DataOperation.DataAccess.XMLoperate.GetXml(Application.StartupPath + m_RptConfigFile.ReportMgrParamFile);
-            string sizestr = ds.Tables[1].Rows[3]["name"].ToString();
-            return sizestr;
-        }
-        public string GetDefaultTRIO_CHART_TYPE()
-        {
-            DataSet ds = DataOperation.DataAccess.XMLoperate.GetXml(Application.StartupPath + m_RptConfigFile.ReportMgrParamFile);
-            string sizestr = ds.Tables[1].Rows[4]["strValue"].ToString();
-            return sizestr;
-        }
-
-        public string GetDefaultSIZE_CAL_METHOD_TYPE()
-        {
-            DataSet ds = DataOperation.DataAccess.XMLoperate.GetXml(Application.StartupPath + m_RptConfigFile.ReportMgrParamFile);
-            string sizestr = ds.Tables[1].Rows[5]["strValue"].ToString();
-            return sizestr;
-        }
-
-        /// <summary>
-        /// 获取计算方法列表
-        /// </summary>
-        /// <returns></returns>
-        public List<string> GetSizeCalMethodTypeList()
-        {
-            List<string> ret_list = new List<string>() { "DMAX", "DMIN", "FERET", "ECD" };
-            return ret_list;
-        }
-        public List<string> ParticleRange()
-        {
-            List<string> pr_str = new List<string>() { "全部颗粒","选择颗粒" };
-            return pr_str;
-        }
-        public List<string> getTableData()
-        {
-            List<string> strlist = new List<string>() { "Area", "DMAX", "Hardness", "AveGray" };
-            return strlist;
-        }
-        public List<string> getTableData_INCA()
-        {
-            List<string> strlist = new List<string>() { "Area", "DMAX", "AveGray","ECD" };
-            return strlist;
-        }
-        public List<string> getTableData_CleannessA()
-        {
-            List<string> strlist = new List<string>() { "Area", "DMAX", "Hardness", "AveGray","ECD" };
-            return strlist;
-        }
-
-        #endregion
-
-
-
-        #region [测量结果treeview]相关封装方法
-        /// <summary>
-        /// 获取测量结果treeview树测量结果名
-        /// </summary>
-        /// <returns></returns>
-        public string GetSampleName()
-        {
-            //获取样品名
-            String sWorkSampleName = ResultFilesList[GetWorkingResultId()].anotherFileName;
-
-            if (null == sWorkSampleName)
-            {
-                return "";
-            }
-            return sWorkSampleName;
-        }
-
-        #endregion
-
- 
-
-
-    }
-}

+ 0 - 364
OTSIncAReportApp/2-CommonFunction/OTSRstMgrFunction/ResultFile.cs

@@ -1,364 +0,0 @@
-using System;
-using System.Collections.Generic;
-using OTSCommon.DBOperate.Model;
-using static OTSDataType.otsdataconst;
-
-namespace OTSIncAReportApp.OTSRstMgrFunction
-{
-
-    [Serializable]
-    public class ResultFile
-    {
-        /// <summary>
-        /// FileId
-        /// </summary>      
-        ///  //全局对象,为了能够快速的获取到xray数据,而做为一个临时变量进行保存,使用前应该判断是否为空
-        private List<Field> list_OTSField = null;
-  
-        public int GetTotalFields()
-        {
-            int all_FiledCount = Convert.ToInt32(((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)ResultInfo["Sample"])["Members"])["SEMDataMsr"])["TotalFields"]);
-            return all_FiledCount;
-
-        }
-        public float GetScanFieldSizeX()
-        {
-            Dictionary<string, object> sampleMembers = ((Dictionary<string, object>)((Dictionary<string, object>)ResultInfo["Sample"])["Members"]);
-            Dictionary<string, object> SEMDataMsr = (Dictionary<string, object>)sampleMembers["SEMDataMsr"];
-            //Dictionary<string, object> SEMStageData = (Dictionary<string, object>)ResultInfo["SEMStageData"];
-            float ScanFieldSizeX = float.Parse(SEMDataMsr["ScanFieldSize"].ToString());
-            return ScanFieldSizeX;
-        }
-        public float GetScanFieldSizeX100()
-        {
-            Dictionary<string, object> sampleMembers = ((Dictionary<string, object>)((Dictionary<string, object>)ResultInfo["Sample"])["Members"]);
-            Dictionary<string, object> SEMDataMsr = (Dictionary<string, object>)sampleMembers["SEMDataMsr"];
-            //Dictionary<string, object> SEMStageData = (Dictionary<string, object>)ResultInfo["SEMStageData"];
-            float ScanFieldSizeX100 = float.Parse(SEMDataMsr["ScanFieldSize100"].ToString());
-            return ScanFieldSizeX100;
-        }
-        public float GetMeasurementMagnification()
-        {
-            Dictionary<string, object> sampleMembers = ((Dictionary<string, object>)((Dictionary<string, object>)ResultInfo["Sample"])["Members"]);
-            Dictionary<string, object> SEMDataMsr = (Dictionary<string, object>)sampleMembers["SEMDataMsr"];
-            //Dictionary<string, object> SEMStageData = (Dictionary<string, object>)ResultInfo["SEMStageData"];
-            float ScanMagnification = 0;
-            try
-            {
-                ScanMagnification = float.Parse(SEMDataMsr["Magnification"].ToString());
-            }
-            catch
-            {
-                ScanMagnification = GetScanFieldSizeX100() * 100 / GetScanFieldSizeX();
-            }
-            return ScanMagnification;
-        }
-        public float GetScanFieldSizeY()
-        {
-            Dictionary<string, object> sampleMembers = ((Dictionary<string, object>)((Dictionary<string, object>)ResultInfo["Sample"])["Members"]);
-            Dictionary<string, object> SEMDataMsr = (Dictionary<string, object>)sampleMembers["SEMDataMsr"];
-            float ScanFieldSizeX = float.Parse(SEMDataMsr["ScanFieldSize"].ToString());
-            Dictionary<string, object> imageScanParam = (Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)sampleMembers["MsrParams"])["Members"])["ImageScanParam"];
-
-            string ImageResolution = imageScanParam["ImageResolution"].ToString();
-            int width = int.Parse(ImageResolution.Split('_')[1]);
-            int height = int.Parse(ImageResolution.Split('_')[2]);
-            float ScanFieldSizeY = ScanFieldSizeX * height / width;
-            return ScanFieldSizeY;
-        }
-
-        public string GetXAxisDir()
-        {
-            Dictionary<string, object> sampleMembers = ((Dictionary<string, object>)((Dictionary<string, object>)ResultInfo["Sample"])["Members"]);
-
-            Dictionary<string, object> SEMStageData = (Dictionary<string, object>)ResultInfo["SEMStageData"];
-      
-            string leftOrRight = SEMStageData["xAxisDir"].ToString().Split(':')[1];
-            return leftOrRight;
-        }
-        public OTS_X_AXIS_DIRECTION GetXAxisDirEnum()
-        {
-            Dictionary<string, object> sampleMembers = ((Dictionary<string, object>)((Dictionary<string, object>)ResultInfo["Sample"])["Members"]);
-
-            Dictionary<string, object> SEMStageData = (Dictionary<string, object>)ResultInfo["SEMStageData"];
-
-            int leftOrRight = Convert.ToInt32(SEMStageData["xAxisDir"].ToString().Split(':')[0]);
-            return (OTS_X_AXIS_DIRECTION)leftOrRight;
-        }
-        public OTS_Y_AXIS_DIRECTION GetYAxisDirEnum()
-        {
-            Dictionary<string, object> sampleMembers = ((Dictionary<string, object>)((Dictionary<string, object>)ResultInfo["Sample"])["Members"]);
-
-            Dictionary<string, object> SEMStageData = (Dictionary<string, object>)ResultInfo["SEMStageData"];
-
-            int dir = Convert.ToInt32(SEMStageData["yAxisDir"].ToString().Split(':')[0]);
-            return (OTS_Y_AXIS_DIRECTION)dir;
-        }
-
-        public string GetYAxisDir()
-        {
-            Dictionary<string, object> sampleMembers = ((Dictionary<string, object>)((Dictionary<string, object>)ResultInfo["Sample"])["Members"]);
-
-            Dictionary<string, object> SEMStageData = (Dictionary<string, object>)ResultInfo["SEMStageData"];
-
-            string downOrUp = SEMStageData["yAxisDir"].ToString().Split(':')[1];
-            return downOrUp;
-        }
-        public int GetXAxisStart()
-        {
-            //Dictionary<string, object> SEMStageData = (Dictionary<string, object>)ResultInfo["SEMStageData"];
-            int xStart = Convert.ToInt32(((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)ResultInfo["SEMStageData"])["Members"])["XAxis"])["start"]);
-            int xEnd = Convert.ToInt32(((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)ResultInfo["SEMStageData"])["Members"])["XAxis"])["end"]);
-            return xStart;
-        }
-        public int GetXAxisEnd()
-        {
-            //Dictionary<string, object> SEMStageData = (Dictionary<string, object>)ResultInfo["SEMStageData"];
-
-            int xEnd = Convert.ToInt32(((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)ResultInfo["SEMStageData"])["Members"])["XAxis"])["end"]);
-            return xEnd;
-        }
-        public int GetYAxisStart()
-        {
-            //Dictionary<string, object> SEMStageData = (Dictionary<string, object>)ResultInfo["SEMStageData"];
-
-            int yStart = Convert.ToInt32(((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)ResultInfo["SEMStageData"])["Members"])["YAxis"])["start"]);
-            return yStart;
-        }
-        public int GetYAxisEnd()
-        {
-            //Dictionary<string, object> SEMStageData = (Dictionary<string, object>)ResultInfo["SEMStageData"];
-
-            int yEnd = Convert.ToInt32(((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)ResultInfo["SEMStageData"])["Members"])["YAxis"])["end"]);
-            return yEnd;
-        }
-        public string GetImageResolution()
-        {
-            Dictionary<string, object> sampleMembers = ((Dictionary<string, object>)((Dictionary<string, object>)ResultInfo["Sample"])["Members"]);
-            Dictionary<string, object> imageScanParam = (Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)sampleMembers["MsrParams"])["Members"])["ImageScanParam"];
-
-            string ImageResolution = imageScanParam["ImageResolution"].ToString();
-            return ImageResolution;
-
-        }
-        public int GetImageWidth()
-        {
-            Dictionary<string, object> sampleMembers = ((Dictionary<string, object>)((Dictionary<string, object>)ResultInfo["Sample"])["Members"]);
-            Dictionary<string, object> imageScanParam = (Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)sampleMembers["MsrParams"])["Members"])["ImageScanParam"];
-            Dictionary<string, object> SEMDataMsr = (Dictionary<string, object>)sampleMembers["SEMDataMsr"];
-          
-           
-            string ImageResolution = imageScanParam["ImageResolution"].ToString();
-            int width = int.Parse(ImageResolution.Split('_')[1]);
-            return width;
-           
-        }
-        public int GetImageHeight()
-        {
-            Dictionary<string, object> sampleMembers = ((Dictionary<string, object>)((Dictionary<string, object>)ResultInfo["Sample"])["Members"]);
-            Dictionary<string, object> imageScanParam = (Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)sampleMembers["MsrParams"])["Members"])["ImageScanParam"];
-       
-
-            string ImageResolution = imageScanParam["ImageResolution"].ToString();
-          
-          
-            int height = int.Parse(ImageResolution.Split('_')[2]);
-
-            return height;
-        }
-        public float GetPixelSize()
-        {
-            Dictionary<string, object> sampleMembers = ((Dictionary<string, object>)((Dictionary<string, object>)ResultInfo["Sample"])["Members"]);
-            Dictionary<string, object> imageScanParam = (Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)sampleMembers["MsrParams"])["Members"])["ImageScanParam"];
-            Dictionary<string, object> SEMDataMsr = (Dictionary<string, object>)sampleMembers["SEMDataMsr"];
-          
-            float ScanFieldSizeX = float.Parse(SEMDataMsr["ScanFieldSize"].ToString());
-           
-            string ImageResolution = imageScanParam["ImageResolution"].ToString();
-            int width = int.Parse(ImageResolution.Split('_')[1]);
-            int height = int.Parse(ImageResolution.Split('_')[2]);
-           
-            float m_pixelSize = ScanFieldSizeX / width;
-            return m_pixelSize;
-
-        }
-      
-
-        public string GetSTDName()
-        {
-            Dictionary<string, object> sampleMembers = ((Dictionary<string, object>)((Dictionary<string, object>)ResultInfo["Sample"])["Members"]);
-            string STDName = ((Dictionary<string, object>)sampleMembers["MsrParams"])["STDName"].ToString();
-            return STDName;
-
-        }
-
-        public string GetSTDEngineType()
-        {
-            try
-            {
-				Dictionary<string, object> sampleMembers = ((Dictionary<string, object>)((Dictionary<string, object>)ResultInfo["Sample"])["Members"]);
-				string STDEngineType = ((Dictionary<string, object>)sampleMembers["MsrParams"])["EngineType"].ToString();
-				return STDEngineType;
-			}
-            catch 
-            {
-                return "-1";
-
-			}
-
-			
-		}
-        public string GetSysType()
-        {
-            try
-            {
-                Dictionary<string, object> sampleMembers = ((Dictionary<string, object>)((Dictionary<string, object>)ResultInfo["Sample"])["Members"]);
-                string STDEngineType = ((Dictionary<string, object>)sampleMembers["MsrParams"])["SysType"].ToString();
-                return STDEngineType;
-            }
-            catch
-            {
-                return "-1";
-
-            }
-
-
-        }
-
-        public bool GetUseSysSTD()
-        {
-            Dictionary<string, object> sampleMembers = ((Dictionary<string, object>)((Dictionary<string, object>)ResultInfo["Sample"])["Members"]);
-            string UseSysSTD = ((Dictionary<string, object>)sampleMembers["MsrParams"])["UseSysSTD"].ToString();
-            return Convert.ToBoolean(UseSysSTD);
-        }
-        public int GetOverlapParam()
-        {
-            Dictionary<string, object> sampleMembers = ((Dictionary<string, object>)((Dictionary<string, object>)ResultInfo["Sample"])["Members"]);
-            Dictionary<string, object> imageProcParam = (Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)sampleMembers["MsrParams"])["Members"])["ImageProcessParam"];
-            try
-            {
-                string overlap = imageProcParam["OverlapParam"].ToString();
-                return Convert.ToInt32(overlap);
-            }
-            catch 
-            {
-                return 0;
-            }
-           
-            
-        }
-        public double GetTotalArea()
-        {
-            try
-            {
-                double dTotalArea = -1;
-                Dictionary<string, object> valuePairs=(Dictionary<string, object>)ResultInfo["Sample"];
-                if (valuePairs.ContainsKey("TotalArea"))
-                {
-                    dTotalArea = Convert.ToDouble(valuePairs["TotalArea"]) /**1000000*/ ;
-                    return dTotalArea;
-                }
-                else
-                {
-                    return -1;
-                }
-            }
-            catch
-            {
-               return -1; 
-            }
-
-        }
-
-        public int GetIncASteeltech()
-        {
-            //--------the int number  meaning----------
-            //GeneralProcessMode = 0,
-            //CaProcessMode = 1,
-            //MgProcessMode = 2,
-            //RareEarthMode = 3
-            //------------------
-            Dictionary<string, object> sampleMembers = ((Dictionary<string, object>)((Dictionary<string, object>)ResultInfo["Sample"])["Members"]);
-            int steeltech = Convert.ToInt32(((Dictionary<string, object>)sampleMembers["MsrParams"])["SteelTech"]);
-            return steeltech;
-
-        }
-        public string GetResultDBPath()
-        {
-            string ResultDbPath = FilePath + "\\FIELD_FILES\\Inclusion.db";
-            return ResultDbPath;
-        }
-        public double GetParticleMINECD()
-        {
-            Dictionary<string, object> sampleMembers = ((Dictionary<string, object>)((Dictionary<string, object>)ResultInfo["Sample"])["Members"]);
-            Dictionary<string, object> MsrParams = (Dictionary<string, object>)sampleMembers["MsrParams"];
-            Dictionary<string, object> ImageProcessParam = ((Dictionary<string, object>)((Dictionary<string, object>)MsrParams["Members"])["ImageProcessParam"]);
-            Dictionary<string, object> Members = (Dictionary<string, object>)MsrParams["Members"];
-            Dictionary<string, object> IPP = ((Dictionary<string, object>)((Dictionary<string, object>)MsrParams["Members"])["ImageProcessParam"]);
-            Dictionary<string, object> IncArea = ((Dictionary<string, object>)((Dictionary<string, object>)IPP["Members"])["IncArea"]);
-            double dparticleMINECD = float.Parse(IncArea["start"].ToString());
-            return dparticleMINECD;
-        }
-
-        public string FileId
-        {
-            get;
-            set;
-        }
-        /// <summary>
-        /// FileName
-        /// </summary>       
-        public string anotherFileName
-        {
-            get;
-            set;
-        }
-        /// <summary>
-        /// FileName
-        /// </summary>       
-        public string FileName_real
-        {
-            get;
-            set;
-        }
-
-        /// <summary>
-        /// FilePath
-        /// </summary>       
-        public string FilePath
-        {
-            get;
-            set;
-        }
-        /// <summary>
-        /// ResuitInfo
-        /// </summary>       
-        public Dictionary<string, object> ResultInfo
-        {
-            get;
-            set;
-        }
-        public void SetResultInfoDic(Dictionary<string, object> info)
-        {
-            ResultInfo = info;
-        }
-        public List<Field> GetList_OTSField()
-        {
-            return list_OTSField;
-        }
-
-        public void SetList_OTSField(List<Field> value)
-        {
-            list_OTSField = value;
-        }
-
-        //public OTS_SysType_ID GetResultSystype()
-        //{
-        //    var Systype = ((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)(Dictionary<string, object>)this.ResultInfo["Sample"])["Members"])["MsrParams"])["SysType"];
-
-        //    return (OTS_SysType_ID)(Convert.ToInt32( Systype.ToString().Split(':')[0]));
-        //}
-    }
-
-
-}

+ 0 - 137
OTSIncAReportApp/2-CommonFunction/OTSRstMgrFunction/RptConfigFile.cs

@@ -1,137 +0,0 @@
-using OTSCommon;
-using System;
-using System.Data;
-using System.Windows.Forms;
-using static OTSDataType.otsdataconst;
-
-namespace OTSIncAReportApp.OTSRstMgrFunction
-{
- 
-    [Serializable]
-    public class RptConfigFile
-    {
-        private string path;
-        public const string ConfigFileFolder = @".\Config\ProData\";
-        private const string m_TriTempFile = "DefaultTriTemplateFile.tpf";
-
-        public static string m_ReportMgrParamFile = "\\Config\\SysData\\OTSReportMgrParam.rpf"; //报告对应使用的参数文件名
-        static RptConfigFile m_config=null;
-       public static RptConfigFile GetRptConfig()
-        {
-            if (m_config == null)
-            {
-                m_config = new RptConfigFile();
-            }
-            return m_config;
-        }
-        private RptConfigFile()
-        {
-
-            path = Application.StartupPath + RptConfigFile.m_ReportMgrParamFile;         //报表程序的配置文件
-
-            LoadDataFromFile();
-        }
-        public void LoadDataFromFile()
-        {
-            DataSet ds = XMLoperate.GetXml(path);
-
-          
-            var st= GetDataFromDataSetXml(ds, "systype");
-            if (st == "IncA")
-            {
-                this.Systype = OTS_SysType_ID.IncA;
-            }
-            else if(st == "TCCleannessA")
-            {
-                this.Systype = OTS_SysType_ID.TCCleannessA;
-            }
-            else if(st == "BatteryCleannessA")
-            {
-                this.Systype = OTS_SysType_ID.BatteryCleannessA;
-            }
-            else {this.Systype = OTS_SysType_ID.SteelMineral;}
-            this.PartSizeFile = GetDataFromDataSetXml(ds, "name", "PartSizeFile");//ds.Tables[1].Rows[2]["Name"].ToString();
-            this.TriTempFile = m_TriTempFile;
-        }
-
-
-        
-
-        public string GetDataFromDataSetXml(DataSet dataSrc, string propertyName,string memberName="XMLData")//the particular schema of OTS system.such as "<XMLData p1="aa" p2="bb"><Member RegName="cc" p1="dd"/>...</XMLData>
-        {
-            string v = "";
-            if (memberName == "XMLData")
-            {
-                v = dataSrc.Tables[memberName].Rows[0][propertyName].ToString();
-            }
-            else 
-            {
-                var rs = dataSrc.Tables["Member"].Select("RegName= '" + memberName+"'");
-                    
-                v=rs[0][propertyName].ToString();//find the first match row's corresponding property value.
-            }
-            return v;
-        }
-        /// <summary>
-        /// 粒级表目录
-        /// </summary>
-        public  string PartSizeFileFolder
-        {
-
-            get { return ConfigFileFolder; }
-        }
-        public OTS_SysType_ID Systype
-        {
-            get;
-            set;
-        }
-        /// <summary>
-        /// 三元相图目录
-        /// </summary>
-        public string TrigTemplateFileFolder
-        {
-            get { return ConfigFileFolder; }
-
-
-        }
-
-        public string ReportMgrParamFile
-        {
-            get { return m_ReportMgrParamFile; }
-
-
-        }
-
-        /// <summary>
-        /// 比例因子
-        /// </summary>
-        //public string Scale
-        //{
-        //    get;
-        //    set;
-        //}
-
-
-        /// <summary>
-        /// 默认使用的粒级文件
-        /// </summary>
-        public string PartSizeFile
-        {
-            get;
-            set;
-        }
-
-        /// <summary>
-        /// 默认使用的三元相图模板文件
-        /// </summary>
-        public string TriTempFile
-        {
-            get;
-            set;
-        }
-
-
-    }
-
-
-}

+ 0 - 7
OTSIncAReportApp/2-CommonFunction/OTSRstMgrFunction/SampleData.cs

@@ -1,7 +0,0 @@
-namespace OTSIncAReportApp.OTSDataMgrFunction
-{
-    public class SampleData
-    {
-
-    }
-}

+ 0 - 113
OTSIncAReportApp/3-ServiceCenter/COffLineClassifyLogic.cs

@@ -1,113 +0,0 @@
-using OTSCLRINTERFACE;
-using OTSModelSharp.ServiceCenter;
-using System.Collections.Generic;
-using static OTSDataType.otsdataconst;
-
-namespace OTSCommon
-{
-    public static class COffLineClassifyLogic
-    {
-        //we have a complicate online classify logic(considering the xray counts and using the spectrum compare and may do not quantify)
-        //when we do classification offline we cann't use that mechanism so we use a surrogate mechanism which is simpler and general .
-        private static CClassifyEngine m_classifyEngine = new CClassifyEngine();
-        public static bool ClassifyIncA(List<COTSParticleClr> parts, string stdname, int steelTech, int type)
-        {
-            bool r = true;
-            if (type == -1)
-            {
-                if (stdname != "NoSTDDB" && stdname != "NoSTDDB.db")
-                {
-                    foreach (var part in parts)
-                    {
-                        part.SetBasicClassifyId((int)OTS_PARTICLE_TYPE.NOT_IDENTIFIED);
-                        IClassifyEngine engine = m_classifyEngine.GetExpressionClassifyEngine(stdname);
-                        r = engine.ClassifyByExpression(part);
-
-
-                        if (part.GetBasicClassifyId() == (int)OTS_PARTICLE_TYPE.NOT_IDENTIFIED)
-                        {
-
-                            engine = m_classifyEngine.GetIncClassifyEngine();
-                            r = engine.ClassifyIncA(part, steelTech);
-
-                        }
-
-                    }
-
-                }
-                else
-                {
-                    foreach (var part in parts)
-                    {
-                        IClassifyEngine engine;
-                        engine = m_classifyEngine.GetIncClassifyEngine();
-                        r = engine.ClassifyIncA(part, steelTech);
-                    }
-                }
-            }
-            else if (type == 0)
-            {
-                foreach (var part in parts)
-                {
-                    IClassifyEngine engine;
-                    engine = m_classifyEngine.GetIncClassifyEngine();
-                    r = engine.ClassifyIncA(part, steelTech);
-                }
-            }
-            else if (type == 1 || type == 2 || type == 3 )
-            {
-                if (stdname != "NoSTDDB" && stdname != "NoSTDDB.db")
-                {
-                    foreach (var part in parts)
-                    {
-                        part.SetBasicClassifyId((int)OTS_PARTICLE_TYPE.NOT_IDENTIFIED);
-                        IClassifyEngine engine = m_classifyEngine.GetExpressionClassifyEngine(stdname);
-                        r = engine.ClassifyByExpression(part);
-
-
-                        if (part.GetBasicClassifyId() == (int)OTS_PARTICLE_TYPE.NOT_IDENTIFIED)
-                        {
-
-                            engine = m_classifyEngine.GetIncClassifyEngine();
-                            r = engine.ClassifyIncA(part, steelTech);
-
-                        }
-
-                    }
-
-                }
-                else
-                {
-                    foreach (var part in parts)
-                    {
-                        IClassifyEngine engine;
-                        engine = m_classifyEngine.GetIncClassifyEngine();
-                        r = engine.ClassifyIncA(part, steelTech);
-                    }
-                }
-            }
-
-            return r;
-        }
-        public static bool ClassifyCleannessA(List<COTSParticleClr> parts, string stdname)
-        {
-            bool r = true;
-            IClassifyEngine engine;
-            engine = m_classifyEngine.GetExpressionClassifyEngine(stdname);
-            if (stdname != "NoSTDDB")
-            {
-                foreach (var p in parts)
-                {
-
-                    r = engine.ClassifyByExpression(p);
-                }
-
-            }
-
-
-            return true;
-
-        }
-
-    }
-}

+ 16 - 458
OTSIncAReportApp/3-ServiceCenter/DataOperation/DataAccess/ParticleData.cs

@@ -7,8 +7,6 @@ using System;
 using System.Collections.Generic;
 using System.Data;
 using System.Data.SQLite;
-using System.Drawing;
-using System.Drawing.Imaging;
 using System.IO;
 using System.Linq;
 using static OTSDataType.otsdataconst;
@@ -420,7 +418,7 @@ namespace OTSIncAReportApp.DataOperation.DataAccess
         public List<Particle> GetParticleAllList()
         {
 
-            string sqlp = @"select * from INcAData";
+            string sqlp = @"select * from IncAData";
 
             DataTable DT = dbHelper.ExecuteDataTable(sqlp, null);
             List<Particle> listp = dbHelper.TableToList<Particle>(DT);
@@ -603,6 +601,14 @@ namespace OTSIncAReportApp.DataOperation.DataAccess
 
 
         }
+        public List<Segment> GetSegmentData(int fldId,int partId)
+        {
+            string strs = @"select *  from Segment where FieldId=" + fldId.ToString() + " and ParticleId=" + partId.ToString();
+            DataTable DTS = dbHelper.ExecuteDataTable(strs, null);
+            DataRow[] dd = DTS.Select();
+            List<Segment> flist = dbHelper.RowsToList<Segment>(dd);
+            return flist;
+        }
 
 
         public enum PARTCLE_TYPE
@@ -992,281 +998,15 @@ namespace OTSIncAReportApp.DataOperation.DataAccess
             dataTable_Particle.AcceptChanges();
         }
 
-        /// <summary>
-        /// 拼接颗粒图
-        /// </summary>
-        /// <param name="sub">拼接字符串</param>
-        /// <param name="xs">xs = pixw / ScanFieldSize</param>
-        /// <param name="path">报告文件路径</param>
-        /// <param name="picHeight">图像高</param>
-        /// <param name="picWidth">帧图宽</param>
-        /// <param name="X_AXIS_DIRECTION">电镜x轴正方向</param>
-        /// <param name="Y_AXIS_DIRECTION">电镜y轴正方向</param>
-        /// <returns></returns>
-        public Bitmap GetBitmapForBig(string sub, double xs, string path, int picHeight, int picWidth)
-        {
-            string vs = "," + sub.Replace(':', '-') + ",";
-
-            DataTable dataTable = GetParticleAllForBig(vs);
-            if (dataTable.Rows.Count == 0)
-            {
-                return null;
-            }
-            //内接矩形
-            double max_Y = -1;
-            double max_X = -1;
-            double min_Y = 99999999;
-
-            double min_X = 99999999;
-            //拼接field矩形
-            double B_Y = Convert.ToInt64(dataTable.Rows[0]["FieldPosY"]) * xs;
-            double R_X = Convert.ToInt64(dataTable.Rows[0]["FieldPosX"]) * xs;
-            double T_Y = B_Y;
-            double L_X = R_X;
-            foreach (DataRow item in dataTable.Rows)
-            {
-                double lefttopXH = Convert.ToInt64(item["FieldPosX"]) * xs;
-
-                if (lefttopXH > R_X)
-                {
-                    R_X = lefttopXH;
-                }
-                if (lefttopXH < L_X)
-                {
-                    L_X = lefttopXH;
-                }
-                double lrfttopYH = Convert.ToInt64(item["FieldPosY"]) * xs;
-
-                if (lrfttopYH < B_Y)
-                {
-                    B_Y = lrfttopYH;
-                }
-                if (lrfttopYH > T_Y)
-                {
-                    T_Y = lrfttopYH;
-                }
-            }
-            int WIDTH = Math.Abs(Convert.ToInt32(R_X - L_X)) + picWidth;
-            int HEIGHT = Math.Abs(Convert.ToInt32(B_Y - T_Y)) + picHeight;
-            //构造最终的图片白板
-            Bitmap tableChartImage = new Bitmap(WIDTH, HEIGHT);
-            Graphics graph = Graphics.FromImage(tableChartImage);
-            graph.DrawImage(tableChartImage, 0, 0);
-            foreach (DataRow item in dataTable.Rows)
-            {
-                string filePath = path + "\\FIELD_FILES\\";
-                string imagePath = filePath + "Field" + item["fieldid"].ToString() + ".bmp";
-                //然后将取出的数据,转换成Bitmap对象
-                Bitmap ls_bt = ReadImageFile(imagePath);
-                int x = Math.Abs(Convert.ToInt32(Convert.ToDouble(item["FieldPosX"]) * xs - L_X));
-                int y = Math.Abs(Convert.ToInt32(Convert.ToDouble(item["FieldPosY"]) * xs - T_Y));
-
-                graph.DrawImage(ls_bt, x, y);
-                //颗粒外接矩形
-                double lefttopX = x+Convert.ToInt64(item["RectLeft"]);
-                if (lefttopX < min_X)
-                {
-                    min_X = lefttopX;
-                }
-                if (lefttopX + Convert.ToInt64(item["RectWidth"]) > max_X)
-                {
-                    max_X = lefttopX + Convert.ToInt64(item["RectWidth"]);
-                }
-                double lrfttopY = y+ Convert.ToInt64(item["RectTop"]);
-                if (lrfttopY + Convert.ToInt64(item["RectHeight"]) > max_Y)
-                {
-                    max_Y = lrfttopY + Convert.ToInt64(item["RectHeight"]);
-                }
-                if ( lrfttopY< min_Y)
-                {
-                    min_Y = lrfttopY;
-                }
-            }
-            int width = Convert.ToInt32(max_X - min_X);
-            int height = Convert.ToInt32(max_Y - min_Y);
-            int X = Convert.ToInt32(min_X);
-            int Y = Convert.ToInt32(min_Y);
-            Rectangle rectangle = new Rectangle() { X = X, Y = Y, Width = width, Height = height };
-            Bitmap bmap = tableChartImage.Clone(rectangle, PixelFormat.Format8bppIndexed);
-            graph.DrawImage(tableChartImage, 0, 0);
-
-            return bmap;
-        }
-
-
-        /// <summary>
-        /// 拼接颗粒黑白图
-        /// </summary>
-        /// <param name="sub">拼接字符串</param>
-        /// <param name="xs">xs = pixw / ScanFieldSize</param>
-        /// <param name="path">报告文件路径</param>
-        /// <param name="picHeight">图像高</param>
-        /// <param name="picWidth">帧图宽</param>
-        /// <param name="X_AXIS_DIRECTION">电镜x轴正方向</param>
-        /// <param name="Y_AXIS_DIRECTION">电镜y轴正方向</param>
-        /// <returns></returns>
-        public Bitmap GetBitmapForBigBlackAndWhiteImage(string sub, double xs, string path, int picHeight, int picWidth)
-        {
-            string vs = "," + sub.Replace(':', '-') + ",";
-            DataTable dataTable = GetParticleAllForBig(vs);
-            if (dataTable.Rows.Count == 0)
-            {
-                return null;
-            }
-            //内接矩形
-            double max_Y = -1;
-            double max_X = -1;
-            double min_Y = 99999999;
-
-            double min_X = 99999999;
-            //拼接field矩形
-            double B_Y = Convert.ToInt64(dataTable.Rows[0]["FieldPosY"]) * xs;
-            double R_X = Convert.ToInt64(dataTable.Rows[0]["FieldPosX"]) * xs;
-            double T_Y = B_Y;
-            double L_X = R_X;
-            foreach (DataRow item in dataTable.Rows)
-            {
-                double lefttopXH = Convert.ToInt64(item["FieldPosX"]) * xs;
-
-                if (lefttopXH > R_X)
-                {
-                    R_X = lefttopXH;
-                }
-                if (lefttopXH < L_X)
-                {
-                    L_X = lefttopXH;
-                }
-                double lrfttopYH = Convert.ToInt64(item["FieldPosY"]) * xs;
-
-                if (lrfttopYH < B_Y)
-                {
-                    B_Y = lrfttopYH;
-                }
-                if (lrfttopYH > T_Y)
-                {
-                    T_Y = lrfttopYH;
-                }
-            }
-            int WIDTH = Math.Abs(Convert.ToInt32(R_X - L_X)) + picWidth;
-            int HEIGHT = Math.Abs(Convert.ToInt32(B_Y - T_Y)) + picHeight;
-            //构造最终的图片白板
-            Bitmap tableChartImage = new Bitmap(WIDTH, HEIGHT);
-            Graphics graph = Graphics.FromImage(tableChartImage);
-            graph.Clear(Color.White);
-            //初始化这个大图
-            graph.DrawImage(tableChartImage, 0, 0);
-            foreach (DataRow item in dataTable.Rows)
-            {
-                string strs = @"select *  from Segment where FieldId="+item["fieldid"].ToString()+" and ParticleId="+item["particleid"].ToString();
-                DataTable DTS = dbHelper.ExecuteDataTable(strs, null);
-                DataRow[] dd = DTS.Select();
-                List<Segment> flist = dbHelper.RowsToList<Segment>(dd);
-                int x = Math.Abs(Convert.ToInt32(Convert.ToDouble(item["FieldPosX"]) * xs - L_X));
-                int y = Math.Abs(Convert.ToInt32(Convert.ToDouble(item["FieldPosY"]) * xs - T_Y));
-                //颗粒外接矩形
-                double lefttopX = x + Convert.ToInt64(item["RectLeft"]);
-                if (lefttopX < min_X)
-                {
-                    min_X = lefttopX;
-                }
-                if (lefttopX + Convert.ToInt64(item["RectWidth"]) > max_X)
-                {
-                    max_X = lefttopX + Convert.ToInt64(item["RectWidth"]);
-                }
-                double lrfttopY = y + Convert.ToInt64(item["RectTop"]);
-                if (lrfttopY + Convert.ToInt64(item["RectHeight"]) > max_Y)
-                {
-                    max_Y = lrfttopY + Convert.ToInt64(item["RectHeight"]);
-                }
-                if (lrfttopY < min_Y)
-                {
-                    min_Y = lrfttopY;
-                }
-                foreach (Segment seg in flist)
-                {
-                    int f_length = seg.Length;
-                    for (int m = 0; m < f_length; m++)
-                    {
-                        int lsjs_x = seg.Start + m+ x;
-                        int lsjs_y = seg.Height+ y;
-                        tableChartImage.SetPixel(lsjs_x, lsjs_y, Color.Black);
-                    }
-                }
-            }
-            int width = Convert.ToInt32(max_X - min_X);
-            int height = Convert.ToInt32(max_Y - min_Y);
-            int X = Convert.ToInt32(min_X);
-            int Y = Convert.ToInt32(min_Y);
-            Rectangle rectangle = new Rectangle() { X = X, Y = Y, Width = width, Height = height };
-            Bitmap bmap = GetBitmapByParticle(tableChartImage, rectangle);
-            return bmap;
-        }
-
+     
 
-        /// <summary>
-        /// 通过FileStream 来打开文件,这样就可以实现不锁定Image文件,到时可以让多用户同时访问Image文件
-        /// </summary>
-        /// <param name="path"></param>
-        /// <returns></returns>
-        public Bitmap ReadImageFile(string path)
-        {
-            if (!File.Exists(path))
-            {
-                return null;//文件不存在
-            }
-            FileStream fs = File.OpenRead(path); //OpenRead
-            int filelength = 0;
-            filelength = (int)fs.Length; //获得文件长度 
-            Byte[] image = new Byte[filelength]; //建立一个字节数组 
-            fs.Read(image, 0, filelength); //按字节流读取 
-            System.Drawing.Image result = System.Drawing.Image.FromStream(fs);
-            fs.Close();
-            Bitmap bit = new Bitmap(result);
-            return bit;
-        }
 
-        /// <summary>
-        /// 传入单颗颗粒的particle类对象,返回从field中抠取出的bitmap对象,抠取单颗颗粒
-        /// </summary>
-        /// <param name="in_cotsparticleclr"></param>
-        /// <returns></returns>
-        public Bitmap GetBitmapByParticle(Bitmap ls_bt, Rectangle offset_rect)
-        {
-            //为了能把整个颗粒显示完整
-            offset_rect.X = offset_rect.X - 20;
-            offset_rect.Y = offset_rect.Y - 20;
-            offset_rect.Width = offset_rect.Width + 40;
-            offset_rect.Height = offset_rect.Height + 40;
-
-            //防止计算偏差后,有坐标溢出现象
-            if (offset_rect.X < 0)
-                offset_rect.X = 0;
-            if (offset_rect.Y < 0)
-                offset_rect.Y = 0;
-            if (offset_rect.X + offset_rect.Width > ls_bt.Width)
-            {
-                offset_rect.Width = ls_bt.Width - offset_rect.X;
-            }
-            if (offset_rect.Y + offset_rect.Height > ls_bt.Height)
-            {
-                offset_rect.Height = ls_bt.Height - offset_rect.Y;
-            }
+       
 
-            Bitmap new_ret_bp;
-            //防止为0后面计算出错
-            if (offset_rect.Width > 0 && offset_rect.Height > 0)
-            {
-                //最后通过list_showsegment组建成新的图片,进行返回
-                new_ret_bp = ls_bt.Clone(offset_rect, ls_bt.PixelFormat);
-            }
-            else
-            {
 
-                new_ret_bp = new Bitmap(offset_rect.Width, offset_rect.Height);
-            }
+      
 
-            return new_ret_bp;
-        }
+      
 
         public void InsertUpdate(List<int> particleID, List<string> particleData)
         {
@@ -1385,194 +1125,12 @@ namespace OTSIncAReportApp.DataOperation.DataAccess
 
 
 
-        #region 清洁度
+       
         public ParticleData()
         { 
 
         }
-		/// <summary>
-		/// 获得颗粒类别
-		/// </summary>
-
-		/// <param name="StandardLibraryAddress">标准库地址</param>
-		/// <returns></returns>
-		public DataTable ObtainParticleCategory_start(string StandardLibraryAddress)
-		{
-			DataTable dataTable = new DataTable();
-			dataTable.Columns.Add("GroupId");
-			dataTable.Columns.Add("GroupName");
-			dataTable.Columns.Add("inoId");
-			dataTable.Columns.Add("display");
-			DataTable get_dt = SelectStandardLibraryGrouping(StandardLibraryAddress);
-            if (get_dt.Rows.Count==0)
-            {
-				DataRow data = dataTable.NewRow();
-				data["inoId"] = 0;
-				data["GroupId"] = 0;
-				data["GroupName"] = "Default";
-				data["display"] = "0";
-				dataTable.Rows.Add(data);
-				return dataTable;
-			}
-			DataRow[] dataRow = get_dt.Select("", "iorder ASC");
-			int shul = 0;
-			string DefaultGroupId = "";
-			foreach (DataRow row in dataRow)
-			{
-				if (row.ItemArray[1].ToString() != "Default")
-				{
-					DataRow data = dataTable.NewRow();
-					data["inoId"] = shul;
-					data["GroupId"] = row.ItemArray[0].ToString();
-					data["GroupName"] = row.ItemArray[1].ToString();
-					data["display"] = "0";
-					dataTable.Rows.Add(data);
-					shul++;
-				}
-				else
-				{
-					DefaultGroupId = row.ItemArray[0].ToString();
-
-				}
-			}
-			DataRow data2 = dataTable.NewRow();
-			data2["inoId"] = shul;
-			data2["GroupId"] = DefaultGroupId;
-			data2["GroupName"] = "Default";
-			data2["display"] = "0";
-			dataTable.Rows.Add(data2);
-			return dataTable;
-		}
-		/// <summary>
-		/// 获取规则数据
-		/// </summary>
-		/// <param name="strings">组类别</param>
-		/// <param name="a_SelectedIndex">标准库地址</param>
-		/// <returns></returns>
-		public List<DataTable> ObtainRuleData_start(DataTable strings, string a_SelectedIndex)
-		{
-			List<DataTable> List_data = new List<DataTable>();
-			DataTable dt_stl = new DataTable();
-			SqLiteHelper sh = new SqLiteHelper("data source='" + a_SelectedIndex + "'");
-			dt_stl = sh.ExecuteQuery("select * from ClassifySTD");
-			dt_stl.Columns.Add("display");
-            if (dt_stl == null)
-            {
-                List_data.Add(dt_stl);
-				return List_data;
-			}
-			
-			for (int i = 0; i < strings.Rows.Count; i++)
-			{
-				DataTable table = dt_stl.Clone();
-				table.TableName = strings.Rows[i]["GroupId"].ToString();
-				for (int a = 0; a < dt_stl.Rows.Count; a++)
-				{
-					if (strings.Rows[i]["GroupId"].ToString() == dt_stl.Rows[a]["GroupId"].ToString())
-					{
-						dt_stl.Rows[a]["display"] = 0;
-						table.Rows.Add(dt_stl.Rows[a].ItemArray);
-					}
-				}
-
-				DataView dvs = table.DefaultView;
-				dvs.Sort = "ListNum ASC";
-				DataTable TemporaryDataGroup = dvs.ToTable();
-				List_data.Add(TemporaryDataGroup);
-			}
-
-			return List_data;
-		}
-		private DataTable SelectStandardLibraryGrouping(string a_SelectedIndex)
-		{
-			DataTable dt_stl = new DataTable();
-			SqLiteHelper sh = new SqLiteHelper("data source='" + a_SelectedIndex + "'");
-			dt_stl = sh.ExecuteQuery("select * from STDGroups");
-			return dt_stl;
-		}
-
-		/// <summary>
-		/// 获得颗粒类别
-		/// </summary>
-		/// <returns></returns>
-		public List<string> ObtainParticleCategory(OTSReport_Export m_otsreport_export, BasicData basicData)
-		{
-			List<string> ClassName = new List<string>();
-			if (m_otsreport_export.m_ReportApp.m_RptConfigFile.Systype != OTS_SysType_ID.IncA)
-			{
-				DataTable get_dt = ReadClassification(basicData);
-				DataTable getClass_dt = get_dt.Clone();
-				DataRow[] dataRow = get_dt.Select("", "iorder ASC");
-				foreach (DataRow row in dataRow)
-				{
-					if (row.ItemArray[1].ToString() != "Default")
-					{
-						getClass_dt.ImportRow(row);
-					}
-				}
-				for (int i = 0; i < getClass_dt.Rows.Count; i++)
-				{
-					ClassName.Add(getClass_dt.Rows[i][1].ToString());
-				}
-				ClassName.Add("Default");
-
-			}
-			else
-			{
-				DataTable getClass_dt = ReadClassification(basicData);
-				for (int i = 0; i < getClass_dt.Rows.Count; i++)
-				{
-					ClassName.Add(getClass_dt.Rows[i][1].ToString());
-
-				}
-
-				bool bl = false;
-				for (int i = 0; i < getClass_dt.Rows.Count; i++)
-				{
-					if (getClass_dt.Rows[i]["GroupName"].ToString() != "NOT_INCLUTION" && getClass_dt.Rows[i]["GroupName"].ToString() != "Invalid"
-					&& getClass_dt.Rows[i]["GroupName"].ToString() != "Not Identified")
-						if (getClass_dt.Rows[i]["GroupName"].ToString() == "")
-						{
-							if (!bl)
-							{
-								ClassName.Add("Default");
-								bl = true;
-							}
-						}
-						else
-						{
-							bool isDefault = false;
-
-							for (int a = 0; a < ClassName.Count; a++)
-							{
-								if (getClass_dt.Rows[i]["GroupName"].ToString() == "Default")
-								{
-									isDefault = true;
-								}
-							}
-							if (isDefault)
-							{
-								if (getClass_dt.Rows[i]["GroupName"].ToString() != "Default")
-								{
-									ClassName.Add(getClass_dt.Rows[i]["GroupName"].ToString());
-								}
-							}
-							else
-							{
-								ClassName.Add(getClass_dt.Rows[i]["GroupName"].ToString());
-							}
-						}
-				}
-			}
-			return ClassName;
-		}
-		public DataTable ReadClassification(BasicData basicData)
-		{
-			DataTable dt_stl = new DataTable();
-			SqLiteHelper sh = new SqLiteHelper("data source='" + basicData.GetFilePath() + "\\" + basicData.GetResfile() + "'");
-			dt_stl = sh.ExecuteQuery("select * from STDGroups");
-			return dt_stl;
-		}
-		#endregion
+		
+		
 	}
 }

+ 0 - 666
OTSIncAReportApp/3-ServiceCenter/DataOperation/DataAccess/XMLoperate.cs

@@ -1,666 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Data;
-using System.IO;
-using System.Linq;
-using System.Xml;
-
-namespace OTSIncAReportApp.DataOperation.DataAccess
-{
-    public class XMLoperate
-    {
-
-        #region 读取XML到DataSet
-
-        /// <summary>
-        /// 功能:读取XML到DataSet中
-        /// </summary>
-        /// <param name="XmlPath">xml路径</param>
-        /// <returns>DataSet</returns>
-        public static DataSet GetXml(string XmlPath)
-        {
-            DataSet ds = new DataSet();
-            ds.ReadXml(@XmlPath);
-            return ds;
-        }
-        #endregion
-
-        #region 读取xml文档并返回一个节点
-
-        /// <summary>
-        /// 读取xml文档并返回一个节点:适用于一级节点
-        /// </summary>
-        /// <param name="XmlPath">xml路径</param>
-        /// <param name="NodeName">节点</param>
-        /// <returns></returns>
-        public static string ReadXmlReturnNode(string XmlPath, string Node)
-        {
-            XmlDocument docXml = new XmlDocument();
-            docXml.Load(@XmlPath);
-            XmlNodeList xn = docXml.GetElementsByTagName(Node);
-            return xn.Item(0).InnerText.ToString();
-        }
-        #endregion
-
-        #region 查找数据,返回一个DataSet
-
-        /// <summary>
-        /// 查找数据,返回当前节点的所有下级节点,填充到一个DataSet中
-        /// </summary>
-        /// <param name="xmlPath">xml文档路径</param>
-        /// <param name="XmlPathNode">节点的路径:根节点/父节点/当前节点</param>
-        /// <returns></returns>
-        public static DataSet GetXmlData(string xmlPath, string XmlPathNode)
-        {
-            XmlDocument objXmlDoc = new XmlDocument();
-            objXmlDoc.Load(xmlPath);
-            DataSet ds = new DataSet();
-            StringReader read = new StringReader(objXmlDoc.SelectSingleNode(XmlPathNode).OuterXml);
-            ds.ReadXml(read);
-            return ds;
-        }
-        #endregion
-
-
-
-        //必须创建对象才能使用的类
-        private bool _alreadyDispose = false;
-        private XmlDocument xmlDoc = new XmlDocument();
-        //private XmlNode xmlNode;
-        //private XmlElement xmlElem;
-        private string _xmlPath;
-
-        #region 构造与释构
-        public XMLoperate()
-        {
-        }
-        public XMLoperate(string xmlPath)
-        {
-            _xmlPath = xmlPath;
-        }
-        ~XMLoperate()
-        {
-            Dispose();
-        }
-        protected virtual void Dispose(bool isDisposing)
-        {
-            if (_alreadyDispose) return;
-            if (isDisposing)
-            {
-                //
-            }
-            _alreadyDispose = true;
-        }
-        #endregion
-
-        #region IDisposable 成员
-        public void Dispose()
-        {
-            Dispose(true);
-            GC.SuppressFinalize(this);
-        }
-        #endregion
-
-        #region 根据父节点属性值读取子节点值
-
-        /// <summary>
-        /// 根据父节点属性读取字节点值
-        /// </summary>
-        /// <param name="XmlPath">xml路径</param>
-        /// <param name="FatherElenetName">父节点名</param>
-        /// <param name="AttributeName">属性值</param>
-        /// <param name="AttributeIndex">属性索引</param>
-        /// <param name="ArrayLength">要返回的节点数组长度</param>
-        /// <returns></returns>
-        public static System.Collections.ArrayList GetSubElementByAttribute(string XmlPath, string FatherElenetName, string AttributeName, int AttributeIndex, int ArrayLength)
-        {
-            System.Collections.ArrayList al = new System.Collections.ArrayList();
-            XmlDocument docXml = new XmlDocument();
-            docXml.Load(@XmlPath);
-            XmlNodeList xn = docXml.DocumentElement.ChildNodes;
-            //遍历第一层节点
-            foreach (XmlElement element in xn)
-            {
-                //判断父节点是否为指定节点
-                if (element.Name == FatherElenetName)
-                {
-                    //判断父节点属性的索引是否大于指定索引
-                    if (element.Attributes.Count < AttributeIndex)
-                        return null;
-                    //判断父节点的属性值是否等于指定属性
-                    if (element.Attributes[AttributeIndex].Value == AttributeName)
-                    {
-                        XmlNodeList xx = element.ChildNodes;
-                        if (xx.Count > 0)
-                        {
-                            for (int i = 0; i < ArrayLength & i < xx.Count; i++)
-                            {
-                                al.Add(xx[i].InnerText);
-                            }
-                        }
-                    }
-                }
-            }
-            return al;
-        }
-        #endregion
-
-        #region 根据节点属性读取子节点值(较省资源模式)
-
-        /// <summary>
-        /// 根据节点属性读取子节点值(较省资源模式)
-        /// </summary>
-        /// <param name="XmlPath">xml路径</param>
-        /// <param name="FatherElement">父节点值</param>
-        /// <param name="AttributeName">属性名称</param>
-        /// <param name="AttributeValue">属性值</param>
-        /// <param name="ArrayLength">返回的数组长度</param>
-        /// <returns></returns>
-        public static System.Collections.ArrayList GetSubElementByAttribute(string XmlPath, string FatherElement, string AttributeName, string AttributeValue, int ArrayLength)
-        {
-            System.Collections.ArrayList al = new System.Collections.ArrayList();
-            XmlDocument docXml = new XmlDocument();
-            docXml.Load(@XmlPath);
-            XmlNodeList xn;
-            xn = docXml.DocumentElement.SelectNodes("//" + FatherElement + "[" + @AttributeName + "='" + AttributeValue + "']");
-            XmlNodeList xx = xn.Item(0).ChildNodes;
-            for (int i = 0; i < ArrayLength & i < xx.Count; i++)
-            {
-                al.Add(xx.Item(i).InnerText);
-            }
-            return al;
-        }
-        #endregion
-
-        #region 根据父节点属性值读取子节点值
-
-        /// <summary>
-        /// 根据父节点属性读取字节点值
-        /// </summary>
-        /// <param name="XmlPath">xml路径</param>
-
-        /// <returns></returns>
-        public static Dictionary<string, object> GetXMLAllInfo(string XmlPath)
-        {
-            if (XmlPath == "")
-            {
-                return null;
-            }
-            Dictionary<string, object> suggestions = new Dictionary<string, object>();
-            XmlDocument docXml = new XmlDocument();
-            docXml.Load(@XmlPath);
-            XmlNodeList xn = docXml.DocumentElement.ChildNodes;
-            //遍历第一层节点
-            foreach (XmlElement element in xn)
-            {
-
-                string name = element.Name;
-                if ("Collection"!= name)
-                {
-                    int attributes = element.Attributes.Count;
-                    Dictionary<string, object> obj = new Dictionary<string, object>();
-                    string key = "";
-                    foreach (System.Xml.XmlAttribute item in element.Attributes)
-                    {
-                        if (item.Name == "RegName")
-                        {
-                            key = item.Value;
-                        }
-                        else
-                        {
-                            obj.Add(item.Name, item.Value);
-                        }
-                    }
-
-                    if (element.ChildNodes.Count > 0)
-                    {
-                        Dictionary<string, object> childList = GetChildInfo(element.ChildNodes);
-                        if (childList.Count > 0)
-                        {
-                            obj.Add("Members", childList);
-                        }
-                    }
-                    suggestions.Add(key, obj);
-                }
-               
-            }
-            return suggestions;
-        }
-        private static Dictionary<string, object> GetChildInfo(XmlNodeList childs)
-        {
-            Dictionary<string, object> child = new Dictionary<string, object>();
-            foreach (XmlElement element in childs)
-            {
-                if (element.Name != "Member")
-                    continue;
-                int attributes = element.Attributes.Count;
-                Dictionary<string, object> obj = new Dictionary<string, object>();
-                string key = "";
-                foreach (System.Xml.XmlAttribute item in element.Attributes)
-                {
-                    if (item.Name == "RegName")
-                    {
-                        key = item.Value;
-                    }
-                    else
-                    {
-                        obj.Add(item.Name, item.Value);
-                    }
-                }
-                if (element.ChildNodes.Count > 0)
-                {
-                    
-
-                    Dictionary<string, object> childList = GetChildInfo(element.ChildNodes);
-                    if (childList.Count > 0)
-                    {
-                        obj.Add("Members", childList);
-                    }
-                }
-                child.Add(key, obj);
-            }
-            return child;
-        }
-        #endregion
-
-        public static List<string> GetMember(string XmlPath, string tem)
-        {
-            if (XmlPath == "")
-            {
-                return null;
-            }
-            XmlDocument docXml = new XmlDocument();
-            docXml.Load(@XmlPath);
-            XmlNodeList xn = docXml.DocumentElement.ChildNodes[0].ChildNodes;
-            List<string> elem = new List<string>();
-            //遍历第一层节点
-            foreach (XmlElement element in xn)
-            {
-                foreach (System.Xml.XmlAttribute item in element.Attributes)
-                {
-                    if (item.Name == "TemplateName" && item.Value == tem)
-                    {
-                        elem.Add(element.ChildNodes[0].ChildNodes[0].Attributes["ElementName"].Value);
-                        elem.Add(element.ChildNodes[0].ChildNodes[1].Attributes["ElementName"].Value);
-                        elem.Add(element.ChildNodes[0].ChildNodes[2].Attributes["ElementName"].Value);
-                        return elem;
-                    }
-
-                }
-
-            }
-            return elem;
-        }
-        /// <summary>
-        /// 修改xml
-        /// </summary>
-        /// <param name="FilePath">文件地址</param>
-        /// <param name="RegName">节点名称</param>
-        /// <param name="Name">节点属性名称</param>
-        /// <param name="Value">节点属性值</param>
-        public static bool EditXmlInfo(string FilePath, string TagName, string Name, string Value)
-        {
-            try
-            {
-                XmlDocument xmlDoc = new XmlDocument();
-                xmlDoc.Load(FilePath);    //加载Xml文件  
-
-                XmlNodeList nodeList = xmlDoc.GetElementsByTagName("Member");
-
-                foreach (XmlNode node in nodeList)
-                {
-                    XmlElement ele = (XmlElement)node;
-                    if (ele.GetAttribute("RegName") == TagName)
-                    {
-                        ele.SetAttribute(Name, Value);
-                    }
-
-                }
-                xmlDoc.Save(FilePath);
-                return true;
-            }
-            catch /*(Exception e)*/
-            {
-                return false;
-            }
-
-
-        }
-        public static bool EditMemberXmlInfo(string FilePath, string TagName, string Name, string Value)
-        {
-            try
-            {
-                XmlDocument xmlDoc = new XmlDocument();
-
-                xmlDoc.Load(FilePath);    //加载Xml文件  
-
-                XmlNodeList nodeList = xmlDoc.GetElementsByTagName("Member");
-
-                foreach (XmlNode node in nodeList)
-                {
-                    XmlElement ele = (XmlElement)node;
-                    if (ele.GetAttribute("RegName") == TagName)
-                    {
-                        ele.SetAttribute(Name, Value);
-                    }
-
-                   
-
-
-                }
-                xmlDoc.Save(FilePath);
-                return true;
-            }
-            catch /*(Exception e)*/
-            {
-                return false;
-            }
-
-
-        }
-
-        /// <summary>
-        /// 获取XML节点参数
-        /// </summary>
-        /// <param name="Name">节点参数名称</param>
-        /// <returns>节点参数</returns>
-        public static string GetXMLInformations(string xmlFilePath, string Name)
-        {
-            try
-            {
-                string value = string.Empty;
-                XmlDocument doc = new XmlDocument();
-
-                doc.Load(xmlFilePath);    //加载Xml文件  
-
-                XmlElement root = doc.DocumentElement;   //获取根节点  
-
-                XmlNodeList mainNodes = root.GetElementsByTagName("parameter"); //获取子节点集合  
-
-                foreach (XmlNode node in mainNodes)
-                {
-                    //获取Name属性值
-                    string name = ((XmlElement)node).GetAttribute("Name");
-                    if (name.Equals(Name))
-                    {
-                        value = ((XmlElement)node).GetAttribute("Value");
-                    }
-                }
-                return value;
-            }
-            catch (Exception)
-            {
-                return "";
-            }
-        }
-
-        /// <summary>
-        /// 修改第二层节点数据
-        /// </summary>
-        /// <param name="XmlPath">XML路径</param>
-        /// <param name="AttributeName">所有需要修改的属性名称</param>
-        /// <param name="Value">需要修改的值</param>
-        /// <returns></returns>
-        public static bool UpdateByAttribute(string XmlPath, string[] AttributeName, string[] Value)
-        {
-            try
-            {
-                XmlDocument docXml = new XmlDocument();
-                docXml.Load(@XmlPath);
-                XmlNodeList xn = docXml.DocumentElement.ChildNodes;
-                //遍历第一层节点
-                foreach (XmlElement element in xn)
-                {
-                    if (element.Attributes[0].Value == Value[0])
-                    {
-                        for (int i = 0; i < element.Attributes.Count; i++)
-                        {
-                            for (int j = 0; j < AttributeName.Count(); j++)
-                            {
-                                //判断父节点的属性值是否等于指定属性
-                                if (element.Attributes[i].Name == AttributeName[j])
-                                {
-                                    element.SetAttribute(AttributeName[j], Value[j]);
-                                    break;
-                                }
-                            }
-                        }
-                        break;
-                    }
-                }
-                docXml.Save(@XmlPath);
-                return true;
-            }
-            catch /*(Exception e)*/
-            {
-                return false;
-            }
-
-
-        }
-        public static int InsertAttribute(string XmlPath, string[] AttributeName, string[] Value, string nodeName)
-        {
-            try
-            {
-                XmlDocument docXml = new XmlDocument();
-                docXml.Load(@XmlPath);
-                XmlNodeList xn = docXml.DocumentElement.ChildNodes;
-                foreach (XmlElement element in xn)
-                {
-                    if (element.Attributes[0].Value == Value[0])
-                    {
-                        return -1;
-                    }
-                }
-                XmlElement xe = docXml.CreateElement(nodeName);
-                for (int i = 0; i < AttributeName.Count(); i++)
-                {
-                    xe.SetAttribute(AttributeName[i], Value[i]);
-                }
-                docXml.DocumentElement.AppendChild(xe);
-                docXml.Save(@XmlPath);
-                return 1;
-            }
-            catch /*(Exception e)*/
-            {
-                return 0;
-            }
-        }
-        public static int DeleteByAttribute(string XmlPath, string AttributeName, string Value)
-        {
-            try
-            {
-                XmlDocument docXml = new XmlDocument();
-                docXml.Load(@XmlPath);
-                XmlNodeList xn = docXml.DocumentElement.ChildNodes;
-                foreach (XmlElement element in xn)
-                {
-                    if (element.Attributes[AttributeName].Value == Value)
-                    {
-                        element.ParentNode.RemoveChild(element);
-                        docXml.Save(@XmlPath);
-                        return 1;
-                    }
-                }
-                return 2;
-            }
-            catch /*(Exception e)*/
-            {
-                return 0;
-            }
-        }
-
-        #region 报告模板
-
-        /// <summary>
-        /// 写入配置,也可以用来修改
-        /// </summary>
-        /// <param name="value">写入的值</param>
-        /// <param name="nodes">节点</param>
-        public void Write(string value, params string[] nodes)
-        {
-            //初始化xml
-            XmlDocument xmlDoc = new XmlDocument();
-            if (File.Exists(_xmlPath))
-                xmlDoc.Load(_xmlPath);
-            else
-                xmlDoc.LoadXml("<XmlConfig />");
-            XmlNode xmlRoot = xmlDoc.ChildNodes[0];
-
-            //新增、编辑 节点
-            string xpath = string.Join("/", nodes);
-            XmlNode node = xmlDoc.SelectSingleNode(xpath);
-            if (node == null)    //新增节点
-            {
-                node = makeXPath(xmlDoc, xmlRoot, xpath);
-            }
-            node.InnerText = value;
-
-            //保存
-            xmlDoc.Save(_xmlPath);
-        }
-
-        /// <summary>
-        /// 设置节点上属性的值
-        /// </summary>
-        /// <param name="AttributeName">属性名</param>
-        /// <param name="AttributeValue">属性值</param>
-        /// <param name="nodes">选择节点</param>
-        public void SetAttribute(string AttributeName, string AttributeValue, params string[] nodes)
-        {
-            //初始化xml
-            XmlDocument xmlDoc = new XmlDocument();
-            if (File.Exists(_xmlPath))
-                xmlDoc.Load(_xmlPath);
-            else
-                xmlDoc.LoadXml("<XmlConfig />");
-            XmlNode xmlRoot = xmlDoc.ChildNodes[0];
-
-            //新增、编辑 节点
-            string xpath = string.Join("/", nodes);
-            XmlElement element = (XmlElement)xmlDoc.SelectSingleNode(xpath);
-            if (element == null)    //新增节点
-            {
-                element = (XmlElement)makeXPath(xmlDoc, xmlRoot, xpath);
-            }
-
-            //设置节点上属性的值
-            element.SetAttribute(AttributeName, AttributeValue);
-            //保存
-            xmlDoc.Save(_xmlPath);
-        }
-
-        public string GetAttribute(string AttributeName, params string[] nodes)
-        {
-            //初始化xml
-            XmlDocument xmlDoc = new XmlDocument();
-            if (File.Exists(_xmlPath))
-                xmlDoc.Load(_xmlPath);
-            else
-                xmlDoc.LoadXml("<XmlConfig />");
-            XmlNode xmlRoot = xmlDoc.ChildNodes[0];
-
-            //新增、编辑 节点
-            string xpath = string.Join("/", nodes);
-            XmlElement element = (XmlElement)xmlDoc.SelectSingleNode(xpath);
-            if (element == null)    //新增节点
-            {
-                element = (XmlElement)makeXPath(xmlDoc, xmlRoot, xpath);
-            }
-
-            //设置节点上属性的值
-            string retstr = element.GetAttribute(AttributeName);
-            //保存
-            xmlDoc.Save(_xmlPath);
-
-            return retstr;
-        }
-
-
-        /// <summary>
-        /// 读取配置
-        /// </summary>
-        /// <param name="nodes">节点</param>
-        /// <returns></returns>
-        public string Read(params string[] nodes)
-        {
-            XmlDocument xmlDoc = new XmlDocument();
-            if (File.Exists(_xmlPath) == false)
-                return null;
-            else
-                xmlDoc.Load(_xmlPath);
-
-            string xpath = string.Join("/", nodes);
-            XmlNode node = xmlDoc.SelectSingleNode("/XmlConfig/" + xpath);
-            if (node == null)
-                return null;
-
-            return node.InnerText;
-        }
-
-        /// <summary>
-        /// 删除节点
-        /// </summary>
-        /// <param name="nodes"></param>
-        public void RemoveNode(params string[] nodes)
-        {
-            XmlDocument xmlDoc = new XmlDocument();
-            if (File.Exists(_xmlPath) == false)
-                return;
-            else
-                xmlDoc.Load(_xmlPath);
-
-            string xpath = string.Join("/", nodes);
-            XmlNode node = xmlDoc.SelectSingleNode("/XmlConfig/" + xpath);
-
-            //取得父节点
-            string[] father_nodes = new string[nodes.Count() - 1];
-
-            //对父节点进行初始化
-            for (int i = 0; i < nodes.Count() - 1; i++)
-            {
-                father_nodes[i] = (string)nodes[i].Clone();
-            }
-
-
-            string fast_xpath = string.Join("/", father_nodes);
-            XmlNode fastnode = xmlDoc.SelectSingleNode("/XmlConfig/" + fast_xpath);
-
-            if (node == null)
-                return;
-            if (fastnode == null)
-                return;
-
-            //使用父节点删除子节点
-            fastnode.RemoveChild(node);
-
-            //保存
-            xmlDoc.Save(_xmlPath);
-        }
-
-
-
-        //递归根据 xpath 的方式进行创建节点
-        static private XmlNode makeXPath(XmlDocument doc, XmlNode parent, string xpath)
-        {
-
-            // 在XPath抓住下一个节点的名称;父级如果是空的则返回
-            string[] partsOfXPath = xpath.Trim('/').Split('/');
-            string nextNodeInXPath = partsOfXPath.First();
-            if (string.IsNullOrEmpty(nextNodeInXPath))
-                return parent;
-
-            // 获取或从名称创建节点
-            XmlNode node = parent.SelectSingleNode(nextNodeInXPath);
-            if (node == null)
-                node = parent.AppendChild(doc.CreateElement(nextNodeInXPath));
-
-            // 加入的阵列作为一个XPath表达式和递归余数
-            string rest = String.Join("/", partsOfXPath.Skip(1).ToArray());
-            return makeXPath(doc, node, rest);
-        }
-        #endregion
-
-    }
-
-}

+ 7 - 6
OTSIncAReportApp/OTSIncAReportApp.csproj

@@ -780,10 +780,10 @@
     <Compile Include="1-UI\OTSReportExport\Cleanness\OTSReport_Template_CleannessA.Designer.cs">
       <DependentUpon>OTSReport_Template_CleannessA.cs</DependentUpon>
     </Compile>
-    <Compile Include="2-CommonFunction\CommonClass\UserSTDDbData.cs" />
-    <Compile Include="2-CommonFunction\OTSRstMgrFunction\ResultFile.cs" />
-    <Compile Include="2-CommonFunction\OTSRstMgrFunction\RptConfigFile.cs" />
-    <Compile Include="3-ServiceCenter\COffLineClassifyLogic.cs" />
+    <Compile Include="3-ServiceCenter\DataOperation\DataAccess\UserSTDDbAccess.cs" />
+    <Compile Include="3-ServiceCenter\DataOperation\OTSRstXmlAccess\ResultFile.cs" />
+    <Compile Include="3-ServiceCenter\DataOperation\OTSRstXmlAccess\RptConfigFile.cs" />
+    <Compile Include="1-UI\COffLineClassifyLogic.cs" />
     <Compile Include="1-UI\OTSReportExport\Template\GBTemplate.cs">
       <SubType>Component</SubType>
     </Compile>
@@ -809,10 +809,11 @@
     <Compile Include="2-CommonFunction\CommonClass\XmlResourceData.cs" />
     <Compile Include="3-ServiceCenter\DataOperation\DataAccess\FeatureData.cs" />
     <Compile Include="3-ServiceCenter\DataOperation\DataAccess\FieldData.cs" />
+    <Compile Include="3-ServiceCenter\DataOperation\ImageAccess\FieldImage.cs" />
     <Compile Include="3-ServiceCenter\DataOperation\DataAccess\OtherDB.cs" />
     <Compile Include="3-ServiceCenter\DataOperation\DataAccess\ParticleData.cs" />
     <Compile Include="3-ServiceCenter\DataOperation\DataAccess\SqlHelper.cs" />
-    <Compile Include="3-ServiceCenter\DataOperation\DataAccess\XMLoperate.cs" />
+    <Compile Include="3-ServiceCenter\DataOperation\OTSRstXmlAccess\XMLoperate.cs" />
     <Compile Include="1-UI\OTSDisplaySourceGridData\ChangeGridCellValEvent.cs" />
     <Compile Include="1-UI\GBCalculate\ASTMStandardABCDDS.cs">
       <SubType>UserControl</SubType>
@@ -850,7 +851,7 @@
     <Compile Include="1-UI\OTSMgrInfo\frmPartSizeEditorNew.Designer.cs">
       <DependentUpon>frmPartSizeEditorNew.cs</DependentUpon>
     </Compile>
-    <Compile Include="2-CommonFunction\OTSRstMgrFunction\ResultDataMgr.cs" />
+    <Compile Include="3-ServiceCenter\DataOperation\OTSRstXmlAccess\ResultDataMgr.cs" />
     <Compile Include="1-UI\OTSDisplaySourceGridData\OTSSourceGrid.cs" />
     <Compile Include="1-UI\OTSMgrInfo\Triangulation_Edit.cs">
       <SubType>Form</SubType>