From 402de0ed045ae483fc67a994ddddb605a6464268 Mon Sep 17 00:00:00 2001
From: Jack.Peng <jack.peng@broconcentric.com>
Date: 星期五, 12 三月 2021 23:01:40 +0800
Subject: [PATCH] 将计算位置、写设备判断结果生成方法。

---
 P066.Data/Form1.cs |  633 +++++++++++++++-----------------------------------------
 1 files changed, 172 insertions(+), 461 deletions(-)

diff --git a/P066.Data/Form1.cs b/P066.Data/Form1.cs
index f55baf9..674e712 100644
--- a/P066.Data/Form1.cs
+++ b/P066.Data/Form1.cs
@@ -70,275 +70,10 @@
                     JudgeListSum.AddRange(judgeList);
 
                 }
-
-                var group = judgeList.GroupBy(a => a.TimeTip);
-   
-                foreach (var item in group)
-                {
-                    //璁$畻闀滃ご1缂洪櫡浣嶇疆鍙婅搴�
-                    var listLensnumber1 = judgeList.FindAll(a => a.TimeTip == item.Key && a.Lensnumber == 1);
-                    for (int k = 0; k < listLensnumber1.Count; k++)
-                    {
-                        var lenAngle = GetAngle(listLensnumber1[k].X, listLensnumber1[k].Y);
-                        if (lenAngle < 0)
-                        {
-                            lenAngle = 360 + lenAngle;
-                        }
-                        listLensnumber1[k].angle = lenAngle;
-
-                        var distance = GetDistance(1050, 1050, listLensnumber1[k].X, listLensnumber1[k].Y);
-
-                        if (distance <= 298.022)
-                        {
-                            listLensnumber1[k].location = "闀滃ご";
-                            listLensnumber1[k].R = distance;
-                        }
-                       else if (298.022 < distance && distance <= 521.171)
-                        {
-                            listLensnumber1[k].location = "鏂滈潰";
-                            listLensnumber1[k].R = distance;
-                        }
-                        //else if (777.11 < distance && distance <= 919.88)
-                        //{
-                        //    listLensnumber1[k].location = "骞抽潰";
-                        //    listLensnumber1[k].R = distance;
-                        //}
-                        else
-                        {
-                            listLensnumber1[k].location = "骞抽潰";
-                            listLensnumber1[k].R = distance;
-                        }
-
-                    }
-                    //璁$畻闀滃ご2浣嶇疆鍙婅搴�
-                    var listLensnumber2 = judgeList.FindAll(a => a.TimeTip == item.Key && a.Lensnumber == 2);
-                    for (int k = 0; k < listLensnumber2.Count; k++)
-                    {
-                        var lenAngle = GetAngle(listLensnumber2[k].X, listLensnumber2[k].Y);
-                        if (lenAngle < 0)
-                        {
-                            lenAngle = 360 + lenAngle;
-                        }
-                        listLensnumber2[k].angle = lenAngle;
-                        var distance = GetDistance(1050, 1050, listLensnumber2[k].X, listLensnumber2[k].Y);
-                        if (distance <= 367.696)
-                        {
-                            listLensnumber2[k].location = "闀滃ご";
-                            listLensnumber2[k].R = distance;
-                        }
-                       else if (367.696 < distance && distance <= 653.911)
-                        {
-                            listLensnumber2[k].location = "鏂滈潰";
-                            listLensnumber2[k].R = distance;
-                        }
-                        //else if (772.18 < distance && distance <= 873.38)
-                        //{
-                        //    listLensnumber2[k].location = "骞抽潰";
-                        //    listLensnumber2[k].R = distance;
-                        //}
-                        else
-                        {
-                            listLensnumber2[k].location = "骞抽潰";
-                            listLensnumber2[k].R = distance;
-                        }
-                    }
-                    //璁$畻闀滃ご3浣嶇疆鍙婅搴�
-                    var listLensnumber3 = judgeList.FindAll(a => a.TimeTip == item.Key && a.Lensnumber == 3);
-                    for (int k = 0; k < listLensnumber3.Count; k++)
-                    {
-                        var lenAngle = GetAngle(listLensnumber3[k].X, listLensnumber3[k].Y);
-                        if (lenAngle < 0)
-                        {
-                            lenAngle = 360 + lenAngle;
-                        }
-                        listLensnumber3[k].angle = lenAngle;
-                        var distance = GetDistance(1050, 1050, listLensnumber3[k].X, listLensnumber3[k].Y);
-                        if (distance <= 339.246)
-                        {
-                            listLensnumber3[k].location = "闀滃ご";
-                            listLensnumber3[k].R = distance;
-                        }
-                       else if (distance < 339.246&&distance<=520.584)
-                        {
-                            listLensnumber3[k].location = "鏂滈潰";
-                            listLensnumber3[k].R = distance;
-                        }
-                        else
-                        {
-                            listLensnumber3[k].location = "骞抽潰";
-                            listLensnumber3[k].R = distance;
-                        }
-                    }
-                    //璁$畻闀滃ご4浣嶇疆鍙婅搴�
-                    var listLensnumber4 = judgeList.FindAll(a => a.TimeTip == item.Key && a.Lensnumber == 4);
-                    for (int k = 0; k < listLensnumber4.Count; k++)
-                    {
-                        var lenAngle = GetAngle(listLensnumber4[k].X, listLensnumber4[k].Y);
-                        if (lenAngle < 0)
-                        {
-                            lenAngle = 360 + lenAngle;
-                        }
-                        listLensnumber4[k].angle = lenAngle;
-                        var distance = GetDistance(1050, 1050, listLensnumber4[k].X, listLensnumber4[k].Y);
-                        if (distance <= 104.895)
-                        {
-                            listLensnumber4[k].location = "闀滃ご";
-                            listLensnumber4[k].R = distance;
-                        }
-                        else if (104.895 < distance && distance <= 239.48)
-                        {
-                            listLensnumber4[k].location = "鏂滈潰";
-                            listLensnumber4[k].R = distance;
-                        }
-                        //else if (547.02 < distance && distance <= 614.73)
-                        //{
-                        //    listLensnumber4[k].location = "骞抽潰";
-                        //    listLensnumber4[k].R = distance;
-                        //}
-                        else
-                        {
-                            listLensnumber4[k].location = "骞抽潰";
-                            listLensnumber4[k].R = distance;
-                        }
-                    }
-
-                }
-
-
-
-                #region//缁欓暅澶村尯鍒嗕綅缃強瑙掑害
-                var group11 = list.GroupBy(a => a.TimeTip);
+                judgeList = GetLocation(judgeList);
+                //缁欓暅澶村尯鍒嗕綅缃強瑙掑害
+                list = GetLocation(list);
                 string currPath = "";
-                foreach (var item in group11)
-                {
-                    //璁$畻闀滃ご1缂洪櫡浣嶇疆鍙婅搴�
-                    var listLensnumber1 = list.FindAll(a => a.TimeTip == item.Key && a.Lensnumber == 1);
-                    for (int k = 0; k < listLensnumber1.Count; k++)
-                    {
-                        var lenAngle = GetAngle(listLensnumber1[k].X, listLensnumber1[k].Y);
-                        if (lenAngle<0)
-                        {
-                            lenAngle = 360 + lenAngle;
-                        }
-                        listLensnumber1[k].angle = lenAngle;
-
-                        var distance = GetDistance(1050, 1050, listLensnumber1[k].X, listLensnumber1[k].Y);
-                        if (distance <= 298.022)
-                        {
-                            listLensnumber1[k].location = "闀滃ご";
-                            listLensnumber1[k].R = distance;
-                        }
-                        else if (298.022 < distance && distance <= 521.171)
-                        {
-                            listLensnumber1[k].location = "鏂滈潰";
-                            listLensnumber1[k].R = distance;
-                        }
-                        //else if (777.11 < distance && distance <= 919.88)
-                        //{
-                        //    listLensnumber1[k].location = "骞抽潰";
-                        //    listLensnumber1[k].R = distance;
-                        //}
-                        else
-                        {
-                            listLensnumber1[k].location = "骞抽潰";
-                            listLensnumber1[k].R = distance;
-                        }
-
-                    }
-                    //璁$畻闀滃ご2浣嶇疆鍙婅搴�
-                    var listLensnumber2 = list.FindAll(a => a.TimeTip == item.Key && a.Lensnumber == 2);
-                    for (int k = 0; k < listLensnumber2.Count; k++)
-                    {
-                        var lenAngle = GetAngle(listLensnumber2[k].X, listLensnumber2[k].Y);
-                        if (lenAngle < 0)
-                        {
-                            lenAngle = 360 + lenAngle;
-                        }
-                        listLensnumber2[k].angle = lenAngle;
-                        var distance = GetDistance(1050, 1050, listLensnumber2[k].X, listLensnumber2[k].Y);
-                        if (distance <= 367.696)
-                        {
-                            listLensnumber2[k].location = "闀滃ご";
-                            listLensnumber2[k].R = distance;
-                        }
-                      else   if (367.696 < distance && distance <= 653.911)
-                        {
-                            listLensnumber2[k].location = "鏂滈潰";
-                            listLensnumber2[k].R = distance;
-                        }
-                        //else if (772.18 < distance && distance <= 873.38)
-                        //{
-                        //    listLensnumber2[k].location = "骞抽潰";
-                        //    listLensnumber2[k].R = distance;
-                        //}
-                        else
-                        {
-                            listLensnumber2[k].location = "骞抽潰";
-                            listLensnumber2[k].R = distance;
-                        }
-                    }
-                    //璁$畻闀滃ご3浣嶇疆鍙婅搴�
-                    var listLensnumber3 = list.FindAll(a => a.TimeTip == item.Key && a.Lensnumber == 3);
-                    for (int k = 0; k < listLensnumber3.Count; k++)
-                    {
-                        var lenAngle = GetAngle(listLensnumber3[k].X, listLensnumber3[k].Y);
-                        if (lenAngle < 0)
-                        {
-                            lenAngle = 360 + lenAngle;
-                        }
-                        listLensnumber3[k].angle = lenAngle;
-                        var distance = GetDistance(1050, 1050, listLensnumber3[k].X, listLensnumber3[k].Y);
-                        if (distance <= 339.246)
-                        {
-                            listLensnumber3[k].location = "闀滃ご";
-                            listLensnumber3[k].R = distance;
-                        }
-                       else  if (distance < 339.246 && distance <= 520.584)
-                        {
-                            listLensnumber3[k].location = "鏂滈潰";
-                            listLensnumber3[k].R = distance;
-                        }
-                        else
-                        {
-                            listLensnumber3[k].location = "骞抽潰";
-                            listLensnumber3[k].R = distance;
-                        }
-                    }
-                    //璁$畻闀滃ご4浣嶇疆鍙婅搴�
-                    var listLensnumber4 = list.FindAll(a => a.TimeTip == item.Key && a.Lensnumber == 4);
-                    for (int k = 0; k < listLensnumber4.Count; k++)
-                    {
-                        var lenAngle = GetAngle(listLensnumber4[k].X, listLensnumber4[k].Y);
-                        if (lenAngle < 0)
-                        {
-                            lenAngle = 360 + lenAngle;
-                        }
-                        listLensnumber4[k].angle = lenAngle;
-                        var distance = GetDistance(1050, 1050, listLensnumber4[k].X, listLensnumber4[k].Y);
-                        if (distance <= 104.895)
-                        {
-                            listLensnumber4[k].location = "闀滃ご";
-                            listLensnumber4[k].R = distance;
-                        }
-                        else if (104.895 < distance && distance <= 239.48)
-                        {
-                            listLensnumber4[k].location = "鏂滈潰";
-                            listLensnumber4[k].R = distance;
-                        }
-                        //else if (547.02 < distance && distance <= 614.73)
-                        //{
-                        //    listLensnumber4[k].location = "骞抽潰";
-                        //    listLensnumber4[k].R = distance;
-                        //}
-                        else
-                        {
-                            listLensnumber4[k].location = "骞抽潰";
-                            listLensnumber4[k].R = distance;
-                        }
-                    }
-
-                }
-                #endregion
                 #region//鍒ゆ柇鏄垵妫�鏂囦欢澶硅繕鏄妫�鏂囦欢澶�
                 if (fileinfos1[i].Name.Contains("鍒濇"))
                 {
@@ -429,201 +164,16 @@
  
             foreach (var item in dataListSum)
             {
-                var test11 = JudgeListSum.FindAll(a => a.TimeTip == item&&a.Lensnumber==1);
-                if (test11.Count==0)
-                {
+                var Lens1 = JudgeListSum.FindAll(a => a.TimeTip == item&&a.Lensnumber==1);
+                WriteJR(Lens1,item,file12);
+                var Lens2 = JudgeListSum.FindAll(a => a.TimeTip == item && a.Lensnumber == 2);
+                WriteJR(Lens2,item,file12);
+                var Lens3 = JudgeListSum.FindAll(a => a.TimeTip == item && a.Lensnumber == 3);
+                WriteJR(Lens3,item,file12);
+                var Lens4 = JudgeListSum.FindAll(a => a.TimeTip == item && a.Lensnumber == 4);
+                WriteJR(Lens4,item,file12);
 
-                    var content11 = $"{item},{1},{"OK"}";
-                    File.AppendAllText(file12, content11, Encoding.UTF8);
-                    File.AppendAllText(file12, "\r\n");
-                }
-                else
-                {
-                    if (test11[0].DefectType=="鍒櫧")
-                    {
-                        var content11 = $"{item},{1},{test11[0].JudgmentResult},{test11[0].DefectType}";
-                        File.AppendAllText(file12, content11, Encoding.UTF8);
-                        File.AppendAllText(file12, "\r\n");
-                        for (int i = 0; i < test11.Count; i++)
-                        {
-                            if (test11[i].DefectType=="鍒櫧")
-                            {
-                                var content111 = $"{""},{""},{""},{""},{test11[i].ex},{test11[i].location},{test11[i].X},{test11[i].Y},{(int)(test11[i].R)},{(int)(test11[i].angle)}";
-                                File.AppendAllText(file12, content111, Encoding.UTF8);
-                                File.AppendAllText(file12, "\r\n");
-                            }
-                            else
-                            {
-                                var content111 = $"{""},{""},{""},{test11[i].DefectType},{test11[i].ex},{test11[i].location},{test11[i].X},{test11[i].Y},{(int)(test11[i].R)},{(int)(test11[i].angle)}";
-                                File.AppendAllText(file12, content111, Encoding.UTF8);
-                                File.AppendAllText(file12, "\r\n");
-                            }
-
-                        }
-                    }
-                    else
-                    {
-                        var content11 = $"{item},{1},{test11[0].JudgmentResult},{test11[0].DefectType}";
-                        File.AppendAllText(file12, content11, Encoding.UTF8);
-                        File.AppendAllText(file12, "\r\n");
-                        for (int i = 0; i < test11.Count; i++)
-                        {
-                            var content111 = $"{""},{""},{""},{""},{test11[i].ex},{test11[i].location},{test11[i].X},{test11[i].Y},{(int)(test11[i].R)},{(int)(test11[i].angle)}";
-                            File.AppendAllText(file12, content111, Encoding.UTF8);
-                            File.AppendAllText(file12, "\r\n");
-                        }
-                    }
-
-                }
-                var test12 = JudgeListSum.FindAll(a => a.TimeTip == item && a.Lensnumber == 2);
-                if (test12.Count == 0)
-                {
-
-                    var content11 = $"{""},{2},{"OK"}";
-                    File.AppendAllText(file12, content11, Encoding.UTF8);
-                    File.AppendAllText(file12, "\r\n");
-                }
-                else
-                {
-                    if (test12[0].DefectType == "鍒櫧")
-                    {
-                        var content11 = $"{""},{2},{test12[0].JudgmentResult},{test12[0].DefectType}";
-                        File.AppendAllText(file12, content11, Encoding.UTF8);
-                        File.AppendAllText(file12, "\r\n");
-                        for (int i = 0; i < test12.Count; i++)
-                        {
-                            if (test12[i].DefectType == "鍒櫧")
-                            {
-                                var content111 = $"{""},{""},{""},{""},{test12[i].ex},{test12[i].location},{test12[i].X},{test12[i].Y},{(int)(test12[i].R)},{(int)(test12[i].angle)}";
-                                File.AppendAllText(file12, content111, Encoding.UTF8);
-                                File.AppendAllText(file12, "\r\n");
-                            }
-                            else
-                            {
-                                var content111 = $"{""},{""},{""},{test12[i].DefectType},{test12[i].ex},{test12[i].location},{test12[i].X},{test12[i].Y},{(int)(test12[i].R)},{(int)(test12[i].angle)}";
-                                File.AppendAllText(file12, content111, Encoding.UTF8);
-                                File.AppendAllText(file12, "\r\n");
-                            }
-
-                        }
-
-
-                    }
-                    else
-                    {
-                        var content11 = $"{""},{2},{test12[0].JudgmentResult},{test12[0].DefectType}";
-                        File.AppendAllText(file12, content11, Encoding.UTF8);
-                        File.AppendAllText(file12, "\r\n");
-                        for (int i = 0; i < test12.Count; i++)
-                        {
-                            var content111 = $"{""},{""},{""},{""},{test12[i].ex},{test12[i].location},{test12[i].X},{test12[i].Y},{(int)(test12[i].R)},{(int)(test12[i].angle)}";
-                            File.AppendAllText(file12, content111, Encoding.UTF8);
-                            File.AppendAllText(file12, "\r\n");
-                        }
-                    }
-                }
-                var test13 = JudgeListSum.FindAll(a => a.TimeTip == item && a.Lensnumber == 3);
-                if (test13.Count == 0)
-                {
-
-                    var content11 = $"{""},{3},{"OK"}";
-                    File.AppendAllText(file12, content11, Encoding.UTF8);
-                    File.AppendAllText(file12, "\r\n");
-                }
-                else
-                {
-                    if (test13[0].DefectType == "鍒櫧")
-                    {
-                        var content11 = $"{""},{3},{test13[0].JudgmentResult},{test13[0].DefectType}";
-                        File.AppendAllText(file12, content11, Encoding.UTF8);
-                        File.AppendAllText(file12, "\r\n");
-                        for (int i = 0; i < test13.Count; i++)
-                        {
-                            if (test13[i].DefectType == "鍒櫧")
-                            {
-                                var content111 = $"{""},{""},{""},{""},{test13[i].ex},{test13[i].location},{test13[i].X},{test13[i].Y},{(int)(test13[i].R)},{(int)(test13[i].angle)}";
-                                File.AppendAllText(file12, content111, Encoding.UTF8);
-                                File.AppendAllText(file12, "\r\n");
-                            }
-                            else
-                            {
-                                var content111 = $"{""},{""},{""},{test13[i].DefectType},{test13[i].ex},{test13[i].location},{test13[i].X},{test13[i].Y},{(int)(test13[i].R)},{(int)(test13[i].angle)}";
-                                File.AppendAllText(file12, content111, Encoding.UTF8);
-                                File.AppendAllText(file12, "\r\n");
-                            }
-
-                        }
-
-                        }
-                    else
-                    {
-                        var content11 = $"{""},{3},{test13[0].JudgmentResult},{test13[0].DefectType}";
-                        File.AppendAllText(file12, content11, Encoding.UTF8);
-                        File.AppendAllText(file12, "\r\n");
-                        for (int i = 0; i < test13.Count; i++)
-                        {
-                            var content111 = $"{""},{""},{""},{""},{test13[i].ex},{test13[i].location},{test13[i].X},{test13[i].Y},{(int)(test13[i].R)},{(int)(test13[i].angle)}";
-                            File.AppendAllText(file12, content111, Encoding.UTF8);
-                            File.AppendAllText(file12, "\r\n");
-                        }
-                    }
-                }
-                var test14 = JudgeListSum.FindAll(a => a.TimeTip == item && a.Lensnumber == 4);
-                if (test14.Count == 0)
-                {
-
-                    var content11 = $"{""},{4},{"OK"}";
-                    File.AppendAllText(file12, content11, Encoding.UTF8);
-                    File.AppendAllText(file12, "\r\n");
-                }
-                else
-                {
-                    if (test14[0].DefectType == "鍒櫧")
-                    {
-                        var content11 = $"{""},{4},{test14[0].JudgmentResult},{test14[0].DefectType}";
-                        File.AppendAllText(file12, content11, Encoding.UTF8);
-                        File.AppendAllText(file12, "\r\n");
-                        for (int i = 0; i < test14.Count; i++)
-                        {
-                            if (test14[i].DefectType == "鍒櫧")
-                            {
-                                var content111 = $"{""},{""},{""},{""},{test14[i].ex},{test14[i].location},{test14[i].X},{test14[i].Y},{(int)(test14[i].R)},{(int)(test14[i].angle)}";
-                                File.AppendAllText(file12, content111, Encoding.UTF8);
-                                File.AppendAllText(file12, "\r\n");
-                            }
-                            else
-                            {
-                                var content111 = $"{""},{""},{""},{test14[i].DefectType},{test14[i].ex},{test14[i].location},{test14[i].X},{test14[i].Y},{(int)(test14[i].R)},{(int)(test14[i].angle)}";
-                                File.AppendAllText(file12, content111, Encoding.UTF8);
-                                File.AppendAllText(file12, "\r\n");
-                            }
-
-                        }
-                    }
-                    else
-                    {
-                        var content11 = $"{""},{4},{test14[0].JudgmentResult},{test14[0].DefectType}";
-                        File.AppendAllText(file12, content11, Encoding.UTF8);
-                        File.AppendAllText(file12, "\r\n");
-                        for (int i = 0; i < test14.Count; i++)
-                        {
-                            var content111 = $"{""},{""},{""},{""},{test14[i].ex},{test14[i].location},{test14[i].X},{test14[i].Y},{(int)(test14[i].R)},{(int)(test14[i].angle)}";
-                            File.AppendAllText(file12, content111, Encoding.UTF8);
-                            File.AppendAllText(file12, "\r\n");
-                        }
-                    }
-                }
-                //var conrent12 = $"{item},{item}";
-                //File.AppendAllText(file12, conrent12, Encoding.UTF8);
-                //File.AppendAllText(file12, "\r\n");
             }
-
-
-
-
-
-
-
 
 
 
@@ -1112,6 +662,167 @@
         //    return dataList;
         //}
 
+        private List<ResultData> GetLocation(List<ResultData> list)
+        {
+            var group = list.GroupBy(a => a.TimeTip);
+            foreach (var item in group)
+            {
+                //璁$畻闀滃ご1缂洪櫡浣嶇疆鍙婅搴�
+                var listLensnumber1 = list.FindAll(a => a.TimeTip == item.Key && a.Lensnumber == 1);
+                for (int k = 0; k < listLensnumber1.Count; k++)
+                {
+                    var lenAngle = GetAngle(listLensnumber1[k].X, listLensnumber1[k].Y);
+                    if (lenAngle < 0)
+                    {
+                        lenAngle = 360 + lenAngle;
+                    }
+                    listLensnumber1[k].angle = lenAngle;
+
+                    var distance = GetDistance(1050, 1050, listLensnumber1[k].X, listLensnumber1[k].Y);
+                    if (distance <= 298.022)
+                    {
+                        listLensnumber1[k].location = "闀滃ご";
+                    }
+                    else if (298.022 < distance && distance <= 521.171)
+                    {
+                        listLensnumber1[k].location = "鏂滈潰";
+                    }
+                    else
+                    {
+                        listLensnumber1[k].location = "骞抽潰";
+                    }
+
+                }
+                //璁$畻闀滃ご2浣嶇疆鍙婅搴�
+                var listLensnumber2 = list.FindAll(a => a.TimeTip == item.Key && a.Lensnumber == 2);
+                for (int k = 0; k < listLensnumber2.Count; k++)
+                {
+                    var lenAngle = GetAngle(listLensnumber2[k].X, listLensnumber2[k].Y);
+                    if (lenAngle < 0)
+                    {
+                        lenAngle = 360 + lenAngle;
+                    }
+                    listLensnumber2[k].angle = lenAngle;
+                    var distance = GetDistance(1050, 1050, listLensnumber2[k].X, listLensnumber2[k].Y);
+                    if (distance <= 367.696)
+                    {
+                        listLensnumber2[k].location = "闀滃ご";
+                    }
+                    else if (367.696 < distance && distance <= 653.911)
+                    {
+                        listLensnumber2[k].location = "鏂滈潰";
+                    }
+                    else
+                    {
+                        listLensnumber2[k].location = "骞抽潰";
+                    }
+                }
+                //璁$畻闀滃ご3浣嶇疆鍙婅搴�
+                var listLensnumber3 = list.FindAll(a => a.TimeTip == item.Key && a.Lensnumber == 3);
+                for (int k = 0; k < listLensnumber3.Count; k++)
+                {
+                    var lenAngle = GetAngle(listLensnumber3[k].X, listLensnumber3[k].Y);
+                    if (lenAngle < 0)
+                    {
+                        lenAngle = 360 + lenAngle;
+                    }
+                    listLensnumber3[k].angle = lenAngle;
+                    var distance = GetDistance(1050, 1050, listLensnumber3[k].X, listLensnumber3[k].Y);
+                    if (distance <= 339.246)
+                    {
+                        listLensnumber3[k].location = "闀滃ご";
+                    }
+                    else if (distance < 339.246 && distance <= 520.584)
+                    {
+                        listLensnumber3[k].location = "鏂滈潰";
+                    }
+                    else
+                    {
+                        listLensnumber3[k].location = "骞抽潰";
+                    }
+                }
+                //璁$畻闀滃ご4浣嶇疆鍙婅搴�
+                var listLensnumber4 = list.FindAll(a => a.TimeTip == item.Key && a.Lensnumber == 4);
+                for (int k = 0; k < listLensnumber4.Count; k++)
+                {
+                    var lenAngle = GetAngle(listLensnumber4[k].X, listLensnumber4[k].Y);
+                    if (lenAngle < 0)
+                    {
+                        lenAngle = 360 + lenAngle;
+                    }
+                    listLensnumber4[k].angle = lenAngle;
+                    var distance = GetDistance(1050, 1050, listLensnumber4[k].X, listLensnumber4[k].Y);
+                    if (distance <= 104.895)
+                    {
+                        listLensnumber4[k].location = "闀滃ご";
+                    }
+                    else if (104.895 < distance && distance <= 239.48)
+                    {
+                        listLensnumber4[k].location = "鏂滈潰";
+                    }
+                    else
+                    {
+                        listLensnumber4[k].location = "骞抽潰";
+
+                    }
+                }
+
+            }
+            return list;
+        }
+
+
+        private void WriteJR(List<ResultData> Lens,string item, string file12)
+        {
+            if (Lens.Count == 0)
+            {
+
+                var content11 = $"{item},{1},{"OK"}";
+                File.AppendAllText(file12, content11, Encoding.UTF8);
+                File.AppendAllText(file12, "\r\n");
+            }
+            else
+            {
+                if (Lens[0].DefectType == "鍒櫧")
+                {
+                    var content11 = $"{item},{1},{Lens[0].JudgmentResult},{Lens[0].DefectType}";
+                    File.AppendAllText(file12, content11, Encoding.UTF8);
+                    File.AppendAllText(file12, "\r\n");
+                    for (int i = 0; i < Lens.Count; i++)
+                    {
+                        if (Lens[i].DefectType == "鍒櫧")
+                        {
+                            var content111 = $"{""},{""},{""},{""},{Lens[i].ex},{Lens[i].location},{Lens[i].X},{Lens[i].Y},{(int)(Lens[i].R)},{(int)(Lens[i].angle)}";
+                            File.AppendAllText(file12, content111, Encoding.UTF8);
+                            File.AppendAllText(file12, "\r\n");
+                        }
+                        else
+                        {
+                            var content111 = $"{""},{""},{""},{Lens[i].DefectType},{Lens[i].ex},{Lens[i].location},{Lens[i].X},{Lens[i].Y},{(int)(Lens[i].R)},{(int)(Lens[i].angle)}";
+                            File.AppendAllText(file12, content111, Encoding.UTF8);
+                            File.AppendAllText(file12, "\r\n");
+                        }
+
+                    }
+                }
+                else
+                {
+                    var content11 = $"{item},{1},{Lens[0].JudgmentResult},{Lens[0].DefectType}";
+                    File.AppendAllText(file12, content11, Encoding.UTF8);
+                    File.AppendAllText(file12, "\r\n");
+                    for (int i = 0; i < Lens.Count; i++)
+                    {
+                        var content111 = $"{""},{""},{""},{""},{Lens[i].ex},{Lens[i].location},{Lens[i].X},{Lens[i].Y},{(int)(Lens[i].R)},{(int)(Lens[i].angle)}";
+                        File.AppendAllText(file12, content111, Encoding.UTF8);
+                        File.AppendAllText(file12, "\r\n");
+                    }
+                }
+
+            }
+        }
+
+
+
         private double GetDistance(double x1, double y1, double x2, double y2)
         {
             return Math.Sqrt(Math.Pow((x2 - x1), 2) + Math.Pow((y2 - y1), 2));

--
Gitblit v1.8.0