From 2f92f84f6af2f9a65e7c6e04ccb3792433233a1e Mon Sep 17 00:00:00 2001
From: Administrator <Administrator@DESKTOP-1VKMM8S>
Date: 星期五, 19 三月 2021 14:33:09 +0800
Subject: [PATCH] 1.修复脏污、划伤有时无法写入报表中。

---
 P066.Data/P066RunParam.cs |  105 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 105 insertions(+), 0 deletions(-)

diff --git a/P066.Data/P066RunParam.cs b/P066.Data/P066RunParam.cs
index 5cb4ab1..5ad24ce 100644
--- a/P066.Data/P066RunParam.cs
+++ b/P066.Data/P066RunParam.cs
@@ -26,4 +26,109 @@
         public double BkLens4R1;
         //public double BkLens4R2;
     }
+    public class P066ReadFile
+    {
+        public List<ResultData1> GetWhiteFile(string[] allLines)
+        {
+            var dataList = new List<ResultData1>();
+            var nametemp = allLines[1].Split(',')[0];
+            var resulttemp = allLines[1].Split(',')[1];
+            string Ptr = "";
+            string deTy = "";
+            for (int i = 1; i < allLines.Length; i++)
+            {
+                var data = allLines[i].Split(',');
+                if (data[0] == "")
+                {
+                    data[0] = nametemp;
+                    data[1] = resulttemp;
+                }
+                if (data[6] == "-")
+                {
+
+                    dataList.Add(new ResultData1()
+                    {
+                        TimeTip = data[0].Split('-')[0],
+                        ImageFileName = data[0],
+                        JudgmentResult = data[1] == "OK" ? "OK" : "NG",
+                        Result = data[3] == "OK",
+
+                    }); ; ;
+
+                    continue;
+
+                }
+                //灏嗗湴7銆�8鍒椾腑閫夋渶澶у儚绱犵偣
+                data[6] = SelectMaxPiont(data[6]);
+                data[7] = SelectMaxPiont(data[7]);
+
+                dataList.Add(new ResultData1()
+                {
+                    TimeTip = data[0].Split('-')[0],
+                    ImageFileName = data[0],
+                    JudgmentResult = data[1] == "OK" ? "OK" : "NG",
+                    Result = data[3] == "OK",
+                    Probability = Convert.ToDouble(data[4]),
+                    Uncertainty = Convert.ToDouble(data[5]),
+                    //Height = Convert.ToDouble(data[6].Replace("#", "").Replace("-", "")),
+                    //Width = Convert.ToDouble(data[7].Replace("#", "").Replace("-", "")),
+                    Height = Convert.ToDouble(data[6]),
+                    Width = Convert.ToDouble(data[7]),
+                    X = Convert.ToDouble(data[8].Replace("#", "").Replace("-", "")),
+                    Y = Convert.ToDouble(data[9].Replace("#", "").Replace("-", "")),
+                    DefectType = deTy,
+                    PostTreatmentResults = Ptr,
+
+                }); ; ;
+
+                nametemp = data[0];
+                resulttemp = data[1];
+
+            }
+            
+            return dataList;
+        }
+
+
+        private string SelectMaxPiont(string Data)
+        {
+            var data = Data.Split('#').ToList();
+            data.Remove("");
+            var temp = Convert.ToInt32(data[0]);
+            for (int i = 0; i < data.Count; i++)
+            {
+                if (Convert.ToInt32(data[i]) > temp)
+                {
+                    temp = Convert.ToInt32(data[i]);
+                }
+            }
+            return Convert.ToString(temp);
+        }
+
+
+    }
+
+    public class ResultData1
+    {
+        public string TimeTip = "";
+        public string JudgmentResult = "";
+        public string ImageFileName = "";
+        public bool Result = true;
+        public int Lensnumber = 0;
+        public double Probability = 0;
+        public double Uncertainty = 0;
+        public double Height = 0;
+        public double Width = 0;
+        public double X = 0;
+        public double Y = 0;
+        public double ex = 0;
+        public string location = "";
+        public double angle = 0;
+        public double R = 0;
+        public string DefectType = "";
+        public string PostTreatmentResults = "";
+
+
+    }
 }
+

--
Gitblit v1.8.0