Browse Source

选择颗粒改版2

CXS 3 năm trước cách đây
mục cha
commit
38447ae104

+ 2 - 2
OTSIncAReportApp/1-UI/Control_ECharts/EChart_ParticlesComposition.cs

@@ -229,7 +229,7 @@ namespace OTSIncAReportApp.Control_ECharts
                 }
             }
 
-            DataTable dt = particledata.GetParticleListByIncA("area", filedAndParticl);
+            DataTable dt = particledata.GetParticleListByIncA("area");
             //设置标签名称
             List<string> listName = new List<string>();
             //ListName
@@ -543,7 +543,7 @@ namespace OTSIncAReportApp.Control_ECharts
 
                         case "PComponent":
                             //创建新的图形数据源
-                            dt = particledata.GetParticleListByIncA("area", filedAndParticl);
+                            dt = particledata.GetParticleListByIncA("area");
                             //设置标签名称
                             for (int j = 0; j < dt.Rows.Count; j++)
                             {

+ 9 - 5
OTSIncAReportApp/1-UI/Control_Graph/Controls/Control_DrawDistrbutionImageAndBSE.cs

@@ -1269,18 +1269,22 @@ namespace OTSIncAReportGraph.Controls
         private void ToolStripMenuItem_selected_Click(object sender, EventArgs e)
         {
             List<DisplayParticle> selectedParts = new List<DisplayParticle>();
-            foreach (var dp  in m_list_allDPart)
+            List<Particle> Particles = new List<Particle>();
+            foreach (var dp in m_list_allDPart)
             {
                 if (dp.IsSelect)
                 {
                     selectedParts.Add((DisplayParticle)dp);
-                  
+                    Particle particle = new Particle();
+                    particle.FieldId = ((OTSIncAReportGraph.DisplayParticle)dp).FieldId;
+                    particle.ParticleId = ((OTSIncAReportGraph.DisplayParticle)dp).ParticleId;
+                    Particles.Add(particle);
                 }
-              
+
             }
 
-            frmReportApp.selectedRegion = m_SelectTool.Rect; 
-           
+            m_ReportApp.SetSelectedParticles(Particles);
+
             SendSelectParticleListToReportFrame(selectedParts);
         }
 

+ 111 - 17
OTSIncAReportApp/1-UI/Control_Grids/CompositionDistributionGrid.cs

@@ -18,7 +18,15 @@ namespace OTSIncAReportGrids
         #region 设置变量
         //设置模拟数据表
         public DataTable m_dt = new DataTable();
+        DataTable SelectParticlesListConvertToTable(List<OTSIncAReportApp.DataOperation.Model.Particle> selectParticles)
+        {
+            DataTable dataTable = new DataTable();
+
+
 
+
+            return dataTable;
+        }
         //国际化
         Language lan;
         Hashtable table;
@@ -36,7 +44,9 @@ namespace OTSIncAReportGrids
         /// </summary>
         public void BindDataGridView(string path, int num, string filename)
         {
-            
+            List<int> FLID = new List<int>() { 0, 1, 2, 4, 6, 7, 8, 9 };
+            List<string> NameList = new List<string>() { table["partcletype0"].ToString(), table["partcletype1"].ToString(), table["partcletype2"].ToString(), table["partcletype4"].ToString(), table["partcletype6"].ToString(), table["partcletype7"].ToString(), table["partcletype8"].ToString(), table["partcletype9"].ToString() };
+            DataTable dt;
             OTSGridView gridView = new OTSGridView();
 
             OTSIncAReportApp.DataOperation.DataAccess.ParticleData particledata = new OTSIncAReportApp.DataOperation.DataAccess.ParticleData(path);
@@ -97,35 +107,97 @@ namespace OTSIncAReportGrids
                     gridView.Columns.Add("max", str7);
                     break;
             }
-            double totalarea = 0;
+            double totalArea = 0;
 
             //int idx = m_ReportApp.m_DataMgrFun.GetPropIndexByPropItemName(m_ReportApp.SourceGridData.ConditionItemList, OTSIncAReportApp.OTSSampleReportInfo.OTS_REPORT_PROP_GRID_ITEMS.DATA_SOURCE_TYPE);
             //int sel = m_ReportApp.m_conditionChoose.m_SourceGridData.GetPropIndexByPropItemName(OTS_REPORT_PROP_GRID_ITEMS.DATA_SOURCE_TYPE);
             int sel = m_ReportApp.m_conditionChoose.m_SourceGridData.GetComboDownListIndexByItemName(OTS_REPORT_PROP_GRID_ITEMS.DATA_SOURCE_TYPE);
-            string filedAndParticl = "";
             if (sel == 1)
             {
                 List<OTSIncAReportApp.DataOperation.Model.Particle> selectParticles = m_ReportApp.GetSelectedParticles();
-                foreach (var item in selectParticles)
+
+
+                Dictionary<int,List<OTSIncAReportApp.DataOperation.Model.Particle>> selectNameGroup = new Dictionary<int, List<OTSIncAReportApp.DataOperation.Model.Particle>>();
+                for(int i=0;i< selectParticles.Count;i++)
                 {
-                    filedAndParticl = filedAndParticl + "," + (item.FieldId.ToString() + "-" + item.ParticleId.ToString());
+                    if(!selectNameGroup.ContainsKey(selectParticles[i].TypeId))
+                    {
+                        List<OTSIncAReportApp.DataOperation.Model.Particle> particles = new List<OTSIncAReportApp.DataOperation.Model.Particle>();
+                        selectNameGroup.Add(selectParticles[i].TypeId, particles);
+                    }
+                    else
+                    {
+                        selectNameGroup[selectParticles[i].TypeId].Add(selectParticles[i]);
+                    }
                 }
-                if (filedAndParticl != "")
+
+                double particlesCount = 0, areaSum = 0,avg = 0,max = 0;
+                DataTable dtUelect = new DataTable();
+                dtUelect.Columns.Add("typeid");
+                dtUelect.Columns.Add("TypeName");
+                dtUelect.Columns.Add("TypeColor");
+                dtUelect.Columns.Add("con");
+                dtUelect.Columns.Add("Area");
+                dtUelect.Columns.Add("av");
+                dtUelect.Columns.Add("max");
+                foreach (KeyValuePair<int, List<OTSIncAReportApp.DataOperation.Model.Particle>> kv in selectNameGroup)
                 {
-                    filedAndParticl = filedAndParticl + ",";
+                    particlesCount = areaSum = avg = max = 0;
+                    particlesCount = kv.Value.Count;
+                    for(int i=0;i< kv.Value.Count;i++)
+                    {
+                        areaSum += kv.Value[i].Area;
+                        switch (con)
+                        {
+                            case "DMAX":
+                                avg += kv.Value[i].DMAX;
+                                if(kv.Value[i].DMAX> max)
+                                {
+                                    max = kv.Value[i].DMAX;
+                                }
+                                break;
+                            case "DMIN":
+                                avg += kv.Value[i].DMIN;
+                                if (kv.Value[i].DMIN > max)
+                                {
+                                    max = kv.Value[i].DMIN;
+                                }
+                                break;
+                            case "CIRCLE":
+                                avg += kv.Value[i].Area;
+                                if (kv.Value[i].Area > max)
+                                {
+                                    max = kv.Value[i].Area;
+                                }
+                                break;
+                            case "FERET":
+                                avg += kv.Value[i].FERET;
+                                if (kv.Value[i].FERET > max)
+                                {
+                                    max = kv.Value[i].FERET;
+                                }
+                                break;
+                        }
+                    }
+                    avg = avg / particlesCount;
+                    dtUelect.Rows.Add(kv.Key, kv.Value[0].TypeName, kv.Value[0].TypeColor, kv.Value[0].TypeName, areaSum, avg, max);
                 }
-                totalarea = OTSIncAReportApp.frmReportApp.selectedRegion.Width * OTSIncAReportApp.frmReportApp.selectedRegion.Height;
+
+                totalArea = OTSIncAReportApp.frmReportApp.selectedRegion.Width * OTSIncAReportApp.frmReportApp.selectedRegion.Height;
+                dt = dtUelect.Clone();
             }
             else
             {
-                double ScanFieldSize = Convert.ToDouble(((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)result.ResultInfo["Sample"])["Members"])["SEMDataMsr"])["ScanFieldSize"]);
-                double ImagePixelSize = Convert.ToDouble(((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)result.ResultInfo["Sample"])["Members"])["MsrParams"])["Members"])["ImageScanParam"])["ImagePixelSize"]);
-                int filedCount = Convert.ToInt32(((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)result.ResultInfo["Sample"])["Members"])["SEMDataMsr"])["TotalFields"]);
-                totalarea = ScanFieldSize * ScanFieldSize / ImagePixelSize * filedCount;
+                Dictionary<string, object> sampleMembers = ((Dictionary<string, object>)((Dictionary<string, object>)result.ResultInfo["Sample"])["Members"]);
+                Dictionary<string, object> semDataMsr = (Dictionary<string, object>)sampleMembers["SEMDataMsr"];
+                double scanFieldSize = Convert.ToDouble(semDataMsr["ScanFieldSize"]);
+                Dictionary<string, object> imageScanParam = (Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)sampleMembers["MsrParams"])["Members"])["ImageScanParam"];
+                string ImageResolution = imageScanParam["ImageResolution"].ToString();
+                double wide = Convert.ToDouble(ImageResolution.Split('_')[2]);
+                int filedCount = Convert.ToInt32(semDataMsr["TotalFields"]);
+                totalArea = scanFieldSize * wide * filedCount;
+                dt = particledata.GetParticleListByIncA(po);
             }
-            DataTable dt = particledata.GetParticleListByIncA(po, filedAndParticl);
-            List<int> FLID = new List<int>() { 0, 1, 2, 4, 6, 7, 8, 9 };
-            List<string> NameList = new List<string>() { table["partcletype0"].ToString(), table["partcletype1"].ToString(), table["partcletype2"].ToString(), table["partcletype4"].ToString(), table["partcletype6"].ToString(), table["partcletype7"].ToString(), table["partcletype8"].ToString(), table["partcletype9"].ToString() };
 
             for (int i = 0; i < dt.Rows.Count; i++)
             {
@@ -161,9 +233,18 @@ namespace OTSIncAReportGrids
                         }
                         gridView.Rows[add_rowindex].Cells[k].Style.BackColor = Color.Azure;
                     }
-                    else if (gridView.Columns[k].Name.ToLower() == "AreaRadio")
+                    else if (gridView.Columns[k].Name.ToLower() == "arearadio")
                     {
-                        gridView.Rows[add_rowindex].Cells[k].Value = dt.Rows[i]["Area"].ToString();
+                        if (totalArea == 0)
+                        {
+                            gridView.Rows[add_rowindex].Cells[k].Value = 0;
+                        }
+                        else
+                        { 
+                            gridView.Rows[add_rowindex].Cells[k].Value = Math.Round(Convert.ToDouble(dt.Rows[i]["Area"]) * 100 / totalArea, 3);
+                        }
+                        gridView.Rows[add_rowindex].Cells[k].Style.BackColor = Color.Azure;
+
 
                     }
                     else
@@ -215,6 +296,19 @@ namespace OTSIncAReportGrids
                         gridView.Rows[add_rowindex].Cells[k].Value = name;
                         gridView.Rows[add_rowindex].Cells[k].Style.BackColor = Color.Azure;
                     }
+                    else if (gridView.Columns[k].Name.ToLower() == "arearadio")
+                    {
+                        if (totalArea == 0)
+                        {
+                            gridView.Rows[add_rowindex].Cells[k].Value = 0;
+                        }
+                        else
+                        { 
+                            gridView.Rows[add_rowindex].Cells[k].Value = Math.Round((double)(dt.Rows[i]["Area"]) * 100/ totalArea, 5); 
+                        }
+                        gridView.Rows[add_rowindex].Cells[k].Style.BackColor = Color.Azure;
+
+                    }
                     else
                     {
                         gridView.Rows[add_rowindex].Cells[k].Value = dt.Rows[i][gridView.Columns[k].Name];

+ 1 - 1
OTSIncAReportApp/1-UI/Control_Grids/ResultGrid.cs

@@ -127,7 +127,7 @@ namespace OTSIncAReportGrids
 
             double ScanFieldSize = Convert.ToDouble(((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)resfile.ResultInfo["Sample"])["Members"])["SEMDataMsr"])["ScanFieldSize"]);
             double ImagePixelSize= Convert.ToDouble(((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)resfile.ResultInfo["Sample"])["Members"])["MsrParams"])["Members"])["ImageScanParam"])["ImagePixelSize"]);
-            double filedsArea = ScanFieldSize * ScanFieldSize / ImagePixelSize * filedCount;
+            double filedsArea = Math.Round(ScanFieldSize * ScanFieldSize / ImagePixelSize * filedCount,2);
             int particleArea = fielddata.GetparticleArea();
 
             double ratio = particleArea / filedsArea;

+ 1 - 1
OTSIncAReportApp/3-ServiceCenter/DataOperation/DataAccess/ParticleData.cs

@@ -104,7 +104,7 @@ namespace OTSIncAReportApp.DataOperation.DataAccess
         /// </summary>
         /// <param name="model">Feature</param>
         /// <returns></returns>
-        public DataTable GetParticleListByIncA(string con, string fieldAndPartic)
+        public DataTable GetParticleListByIncA(string con)
         {
             string sqlp = @"select TypeId,TypeName,TypeColor,count(1) as con,sum(Area) as Area,avg(" + con
                 + ") as av,max(" + con