Administrator
2021-03-12 1590c512210a2bd5a29a3bc0ad856872a1bd50d6
修复位置输出错误问题。
1个文件已修改
165 ■■■■■ 已修改文件
P066.Data/Form1.cs 165 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
P066.Data/Form1.cs
@@ -88,24 +88,24 @@
                        var distance = GetDistance(1050, 1050, listLensnumber1[k].X, listLensnumber1[k].Y);
                        if (distance <= 539.87)
                        if (distance <= 298.022)
                        {
                            listLensnumber1[k].location = "镜头";
                            listLensnumber1[k].R = distance;
                        }
                        else if (539.87 < distance && distance <= 777.11)
                       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 if (777.11 < distance && distance <= 919.88)
                        //{
                        //    listLensnumber1[k].location = "平面";
                        //    listLensnumber1[k].R = distance;
                        //}
                        else
                        {
                            listLensnumber1[k].location = "区域外";
                            listLensnumber1[k].location = "平面";
                            listLensnumber1[k].R = distance;
                        }
@@ -121,24 +121,24 @@
                        }
                        listLensnumber2[k].angle = lenAngle;
                        var distance = GetDistance(1050, 1050, listLensnumber2[k].X, listLensnumber2[k].Y);
                        if (distance <= 400)
                        if (distance <= 367.696)
                        {
                            listLensnumber2[k].location = "镜头";
                            listLensnumber2[k].R = distance;
                        }
                        else if (400 < distance && distance <= 772.18)
                       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 if (772.18 < distance && distance <= 873.38)
                        //{
                        //    listLensnumber2[k].location = "平面";
                        //    listLensnumber2[k].R = distance;
                        //}
                        else
                        {
                            listLensnumber2[k].location = "区域外";
                            listLensnumber2[k].location = "平面";
                            listLensnumber2[k].R = distance;
                        }
                    }
@@ -153,14 +153,19 @@
                        }
                        listLensnumber3[k].angle = lenAngle;
                        var distance = GetDistance(1050, 1050, listLensnumber3[k].X, listLensnumber3[k].Y);
                        if (distance <= 105.63)
                        if (distance <= 339.246)
                        {
                            listLensnumber3[k].location = "镜头";
                            listLensnumber3[k].R = distance;
                        }
                        else
                       else if (distance < 339.246&&distance<=520.584)
                        {
                            listLensnumber3[k].location = "斜面";
                            listLensnumber3[k].R = distance;
                        }
                        else
                        {
                            listLensnumber3[k].location = "平面";
                            listLensnumber3[k].R = distance;
                        }
                    }
@@ -175,24 +180,24 @@
                        }
                        listLensnumber4[k].angle = lenAngle;
                        var distance = GetDistance(1050, 1050, listLensnumber4[k].X, listLensnumber4[k].Y);
                        if (distance <= 339.88)
                        if (distance <= 104.895)
                        {
                            listLensnumber4[k].location = "镜头";
                            listLensnumber4[k].R = distance;
                        }
                        else if (339.88 < distance && distance <= 547.02)
                        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 if (547.02 < distance && distance <= 614.73)
                        //{
                        //    listLensnumber4[k].location = "平面";
                        //    listLensnumber4[k].R = distance;
                        //}
                        else
                        {
                            listLensnumber4[k].location = "区域外";
                            listLensnumber4[k].location = "平面";
                            listLensnumber4[k].R = distance;
                        }
                    }
@@ -218,25 +223,24 @@
                        listLensnumber1[k].angle = lenAngle;
                        var distance = GetDistance(1050, 1050, listLensnumber1[k].X, listLensnumber1[k].Y);
                        if (distance <= 539.87)
                        if (distance <= 298.022)
                        {
                            listLensnumber1[k].location = "镜头";
                            listLensnumber1[k].R = distance;
                        }
                        else if (539.87 < distance && distance <= 777.11)
                        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 if (777.11 < distance && distance <= 919.88)
                        //{
                        //    listLensnumber1[k].location = "平面";
                        //    listLensnumber1[k].R = distance;
                        //}
                        else
                        {
                            listLensnumber1[k].location = "区域外";
                            listLensnumber1[k].location = "平面";
                            listLensnumber1[k].R = distance;
                        }
@@ -252,24 +256,24 @@
                        }
                        listLensnumber2[k].angle = lenAngle;
                        var distance = GetDistance(1050, 1050, listLensnumber2[k].X, listLensnumber2[k].Y);
                        if (distance <= 400)
                        if (distance <= 367.696)
                        {
                            listLensnumber2[k].location = "镜头";
                            listLensnumber2[k].R = distance;
                        }
                        else if (400 < distance && distance <= 772.18)
                      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 if (772.18 < distance && distance <= 873.38)
                        //{
                        //    listLensnumber2[k].location = "平面";
                        //    listLensnumber2[k].R = distance;
                        //}
                        else
                        {
                            listLensnumber2[k].location = "区域外";
                            listLensnumber2[k].location = "平面";
                            listLensnumber2[k].R = distance;
                        }
                    }
@@ -284,14 +288,19 @@
                        }
                        listLensnumber3[k].angle = lenAngle;
                        var distance = GetDistance(1050, 1050, listLensnumber3[k].X, listLensnumber3[k].Y);
                        if (distance <= 105.63)
                        if (distance <= 339.246)
                        {
                            listLensnumber3[k].location = "镜头";
                            listLensnumber3[k].R = distance;
                        }
                        else
                       else  if (distance < 339.246 && distance <= 520.584)
                        {
                            listLensnumber3[k].location = "斜面";
                            listLensnumber3[k].R = distance;
                        }
                        else
                        {
                            listLensnumber3[k].location = "平面";
                            listLensnumber3[k].R = distance;
                        }
                    }
@@ -306,24 +315,24 @@
                        }
                        listLensnumber4[k].angle = lenAngle;
                        var distance = GetDistance(1050, 1050, listLensnumber4[k].X, listLensnumber4[k].Y);
                        if (distance <= 339.88)
                        if (distance <= 104.895)
                        {
                            listLensnumber4[k].location = "镜头";
                            listLensnumber4[k].R = distance;
                        }
                        else if (339.88 < distance && distance <= 547.02)
                        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 if (547.02 < distance && distance <= 614.73)
                        //{
                        //    listLensnumber4[k].location = "平面";
                        //    listLensnumber4[k].R = distance;
                        //}
                        else
                        {
                            listLensnumber4[k].location = "区域外";
                            listLensnumber4[k].location = "平面";
                            listLensnumber4[k].R = distance;
                        }
                    }
@@ -412,7 +421,7 @@
            dataListSum.Sort();
            var dataList = new List<ResultData>();
            var title12 = $"时间戳,相机序号,设备判断结果,缺陷类型,X,Y,最大尺寸,R,位置,角度";
            var title12 = $"时间戳,相机序号,设备判断结果,缺陷类型,最大尺寸,位置,X,Y,R,角度";
            var file12 = $"{directoryInfo1.Parent.FullName}\\{filename+"设备判断结果"}.csv";
            File.AppendAllText(file12, title12, Encoding.UTF8);
@@ -439,13 +448,13 @@
                        {
                            if (test11[i].DefectType=="刮白")
                            {
                                var content111 = $"{""},{""},{""},{""},{test11[i].X},{test11[i].Y},{test11[i].ex},{(int)(test11[i].R)},{test11[i].location},{(int)(test11[i].angle)}";
                                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].X},{test11[i].Y},{test11[i].ex},{(int)(test11[i].R)},{test11[i].location},{(int)(test11[i].angle)}";
                                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");
                            }
@@ -459,7 +468,7 @@
                        File.AppendAllText(file12, "\r\n");
                        for (int i = 0; i < test11.Count; i++)
                        {
                            var content111 = $"{""},{""},{""},{""},{test11[i].X},{test11[i].Y},{test11[i].ex},{(int)(test11[i].R)},{test11[i].location},{(int)(test11[i].angle)}";
                            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");
                        }
@@ -485,13 +494,13 @@
                        {
                            if (test12[i].DefectType == "刮白")
                            {
                                var content111 = $"{""},{""},{""},{""},{test12[i].X},{test12[i].Y},{test12[i].ex},{(int)(test12[i].R)},{test12[i].location},{(int)(test12[i].angle)}";
                                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].X},{test12[i].Y},{test12[i].ex},{(int)(test12[i].R)},{test12[i].location},{(int)(test12[i].angle)}";
                                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");
                            }
@@ -507,7 +516,7 @@
                        File.AppendAllText(file12, "\r\n");
                        for (int i = 0; i < test12.Count; i++)
                        {
                            var content111 = $"{""},{""},{""},{""},{test12[i].X},{test12[i].Y},{test12[i].ex},{(int)(test12[i].R)},{test12[i].location},{(int)(test12[i].angle)}";
                            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");
                        }
@@ -532,13 +541,13 @@
                        {
                            if (test13[i].DefectType == "刮白")
                            {
                                var content111 = $"{""},{""},{""},{""},{test13[i].X},{test13[i].Y},{test13[i].ex},{(int)(test13[i].R)},{test13[i].location},{(int)(test13[i].angle)}";
                                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].X},{test13[i].Y},{test13[i].ex},{(int)(test13[i].R)},{test13[i].location},{(int)(test13[i].angle)}";
                                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");
                            }
@@ -553,7 +562,7 @@
                        File.AppendAllText(file12, "\r\n");
                        for (int i = 0; i < test13.Count; i++)
                        {
                            var content111 = $"{""},{""},{""},{""},{test13[i].X},{test13[i].Y},{test13[i].ex},{(int)(test13[i].R)},{test13[i].location},{(int)(test13[i].angle)}";
                            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");
                        }
@@ -578,13 +587,13 @@
                        {
                            if (test14[i].DefectType == "刮白")
                            {
                                var content111 = $"{""},{""},{""},{""},{test14[i].X},{test14[i].Y},{test14[i].ex},{(int)(test14[i].R)},{test14[i].location},{(int)(test14[i].angle)}";
                                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].X},{test14[i].Y},{test14[i].ex},{(int)(test14[i].R)},{test14[i].location},{(int)(test14[i].angle)}";
                                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");
                            }
@@ -598,7 +607,7 @@
                        File.AppendAllText(file12, "\r\n");
                        for (int i = 0; i < test14.Count; i++)
                        {
                            var content111 = $"{""},{""},{""},{""},{test14[i].X},{test14[i].Y},{test14[i].ex},{(int)(test14[i].R)},{test14[i].location},{(int)(test14[i].angle)}";
                            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");
                        }
@@ -971,12 +980,24 @@
            var dataList = new List<ResultData>();
            var nametemp = allLines[1].Split(',')[0];
            var resulttemp = allLines[1].Split(',')[1];
            //var Ptr = allLines[1].Split(',')[10];
            string Ptr = "";
            //if (allLines[1].Split(',')[10].Length>3)
            //{
            //     Ptr = allLines[1].Split(',')[10];
            //}
            for (int i = 1; i < allLines.Length; i++)
            {
                var data = allLines[i].Split(',');
                if (data.Length>10)
                {
                    Ptr = data[10];
                }
                if (data[6]=="-")
                {
@@ -985,7 +1006,7 @@
                string defectType = "";
                string bbb = "";
                string Ptr = "";
                //string Ptr = "";
                if (data[0] == "")
                {
                    data[0] = nametemp;
@@ -1004,10 +1025,7 @@
                    defectType = "白点";
                    bbb = data[1];
                    
                    if (data.Length>10)
                    {
                        Ptr = data[10];
                    }
                }
                var data6 = data[6].Split('#').ToList();
                data6.Remove("");
@@ -1054,6 +1072,7 @@
                nametemp = data[0];
                resulttemp= data[1];
                //Ptr = data[10];
             
            }