Jack.Peng
2021-04-20 1c60d225cc7c1ccf17c3d1e6a84ca0d959550cf3
1.新增输出缺陷报表。
3个文件已修改
112 ■■■■ 已修改文件
P066.Data/Form1.Designer.cs 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
P066.Data/Form1.cs 74 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
P066.Data/WriteFile.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
P066.Data/Form1.Designer.cs
@@ -33,12 +33,15 @@
            this.btnAnalyze = new System.Windows.Forms.Button();
            this.btnLoadData2 = new System.Windows.Forms.Button();
            this.btnLoadData3 = new System.Windows.Forms.Button();
            this.butPictur = new System.Windows.Forms.Button();
            this.pictureBox1 = new System.Windows.Forms.PictureBox();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
            this.SuspendLayout();
            // 
            // btnLoadData1
            // 
            this.btnLoadData1.Location = new System.Drawing.Point(16, 15);
            this.btnLoadData1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
            this.btnLoadData1.Margin = new System.Windows.Forms.Padding(4);
            this.btnLoadData1.Name = "btnLoadData1";
            this.btnLoadData1.Size = new System.Drawing.Size(176, 29);
            this.btnLoadData1.TabIndex = 0;
@@ -49,7 +52,7 @@
            // btnAnalyze
            // 
            this.btnAnalyze.Location = new System.Drawing.Point(16, 88);
            this.btnAnalyze.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
            this.btnAnalyze.Margin = new System.Windows.Forms.Padding(4);
            this.btnAnalyze.Name = "btnAnalyze";
            this.btnAnalyze.Size = new System.Drawing.Size(176, 29);
            this.btnAnalyze.TabIndex = 1;
@@ -60,7 +63,7 @@
            // btnLoadData2
            // 
            this.btnLoadData2.Location = new System.Drawing.Point(16, 51);
            this.btnLoadData2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
            this.btnLoadData2.Margin = new System.Windows.Forms.Padding(4);
            this.btnLoadData2.Name = "btnLoadData2";
            this.btnLoadData2.Size = new System.Drawing.Size(199, 29);
            this.btnLoadData2.TabIndex = 1;
@@ -78,18 +81,39 @@
            this.btnLoadData3.UseVisualStyleBackColor = true;
            this.btnLoadData3.Click += new System.EventHandler(this.btnLoadData3_Click);
            // 
            // butPictur
            //
            this.butPictur.Location = new System.Drawing.Point(175, 216);
            this.butPictur.Name = "butPictur";
            this.butPictur.Size = new System.Drawing.Size(141, 35);
            this.butPictur.TabIndex = 3;
            this.butPictur.Text = "加载图片文件夹";
            this.butPictur.UseVisualStyleBackColor = true;
            this.butPictur.Click += new System.EventHandler(this.butPictur_Click);
            //
            // pictureBox1
            //
            this.pictureBox1.Location = new System.Drawing.Point(405, 134);
            this.pictureBox1.Name = "pictureBox1";
            this.pictureBox1.Size = new System.Drawing.Size(522, 245);
            this.pictureBox1.TabIndex = 4;
            this.pictureBox1.TabStop = false;
            //
            // Form1
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(1067, 562);
            this.Controls.Add(this.pictureBox1);
            this.Controls.Add(this.butPictur);
            this.Controls.Add(this.btnLoadData3);
            this.Controls.Add(this.btnAnalyze);
            this.Controls.Add(this.btnLoadData2);
            this.Controls.Add(this.btnLoadData1);
            this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
            this.Margin = new System.Windows.Forms.Padding(4);
            this.Name = "Form1";
            this.Text = "Form1";
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
            this.ResumeLayout(false);
        }
@@ -101,6 +125,8 @@
        private System.Windows.Forms.Button btnAnalyze;
        private System.Windows.Forms.Button btnLoadData2;
        private System.Windows.Forms.Button btnLoadData3;
        private System.Windows.Forms.Button butPictur;
        private System.Windows.Forms.PictureBox pictureBox1;
    }
}
P066.Data/Form1.cs
@@ -18,6 +18,8 @@
        DirectoryInfo directoryInfo1;
        DirectoryInfo directoryInfo2;
        DirectoryInfo directoryInfo3;
        DirectoryInfo directoryInfo4;
        private P066RunParam runparam = new P066RunParam();
        private ReadFile readfile = new ReadFile();
        private WriteFile writefile = new WriteFile();
@@ -44,6 +46,7 @@
                return;
            directoryInfo2 = new DirectoryInfo(folderBrowserDialog1.SelectedPath);
        }
        private void btnLoadData3_Click(object sender, EventArgs e)
@@ -54,7 +57,16 @@
            }
            directoryInfo3 = new DirectoryInfo(folderBrowserDialog1.SelectedPath);
        }
        private void butPictur_Click(object sender, EventArgs e)
        {
            if (folderBrowserDialog1.ShowDialog()!=DialogResult.OK)
            {
                return;
            }
            directoryInfo4 = new DirectoryInfo(folderBrowserDialog1.SelectedPath);
        }
        private void btnAnalyze_Click(object sender, EventArgs e)
        {
            var Start = DateTime.Now;
@@ -172,6 +184,50 @@
            });
            List<string> listPicyreSor = new List<string>();        //加载图片时间戳
            var directoties = directoryInfo4.GetDirectories();
            for (int i = 0; i < directoties.Length; i++)
            {
                listPicyreSor.Add(directoties[i].Name);
            }
            listPicyreSor.Sort();
            if (listPicyreSor.Count!=0)
            {
                Task.Run(() =>
                {
                    #region//将设备判断结果输出到CSV报表中
                    //ListReexaminationSum.AddRange(GetClassificationLens(fileInfo1, fileInfo2, DataTipsor));
                    var title12 = $"时间戳,相机序号,设备判断结果,缺陷类型,设备后处理结果,最大尺寸,位置,X,Y,R,角度";
                    var file12 = $"{directoryInfo1.Parent.FullName}\\{filenameDir + "设备检索结果"}.csv";
                    File.AppendAllText(file12, title12, Encoding.UTF8);
                    File.AppendAllText(file12, "\r\n");
                    foreach (var item in listPicyreSor)
                    {
                        var Lens1 = ListReexaminationSum.FindAll(a => a.TimeTip == item && a.Lensnumber == 1);
                        writefile.WriteJR(Lens1, item, 1, file12);
                        for (int i = 2; i < 5; i++)
                        {
                            var Lens = ListReexaminationSum.FindAll(a => a.TimeTip == item && a.Lensnumber == i);
                            writefile.WriteJR(Lens, "", i, file12);
                        }
                    }
                });
            }
            task3.Wait();
            var task6 = Task.Run(() =>
            {
@@ -244,7 +300,7 @@
                        var defectClearSum = listlensum1 - listlennoclearsum1;
                        var content1 = $"{i},{defectSum},{defectClearSum},{(double)(defectSum / defectSum)}";
                        var content1 = $"{i},{defectSum},{defectClearSum},{(double)(defectSum / defectClearSum)}";
                        File.AppendAllText(file1, content1, Encoding.UTF8);
                        File.AppendAllText(file1, "\r\n");
                    }
@@ -775,19 +831,19 @@
                int index = i;
                Task task = new Task(() => {
                    var list = CompareFile(fileInfo1[index], fileInfo2[index], DataTipsor);
                    if (fileInfo1[index].Name.Contains("白点"))
                    {
                    //if (fileInfo1[index].Name.Contains("白点"))
                    //{
                        //WhiteI++;
                        //list.ForEach(a => a.Lensnumber = WhiteI);
                        ListReexaminationSum.AddRange(list);
                    }
                    else if (fileInfo1[index].Name.Contains("刮白"))
                    {
                    //}
                    //else if (fileInfo1[index].Name.Contains("刮白"))
                    //{
                        //WhiteningI++;
                        //list.ForEach(a => a.Lensnumber = WhiteningI);
                        ListReexaminationSum.AddRange(list);
                        //ListReexaminationSum.AddRange(list);
                    }
                    //}
                    if (fileInfo1[index].Name.Contains("初检中框"))
                    {
                        list = GetMidLocation(list);
@@ -890,3 +946,5 @@
}
#endregion
P066.Data/WriteFile.cs
@@ -45,7 +45,7 @@
                if (lensWhite.Count!=0)
                {
                    var content = $"{""},{""},{""},{lensWhite[0].DefectType},{lensWhite[0].PostTreatmentResults}";
                    var content = $"{""},{""},{""},{lensWhite[0].DefectType+ lensWhite[0].JudgmentResult},{lensWhite[0].PostTreatmentResults}";
                    File.AppendAllText(file12, content, Encoding.UTF8);
                    File.AppendAllText(file12, "\r\n");
                    for (int i = 0; i < lensWhite.Count; i++)
@@ -58,7 +58,7 @@
                if (lensWhiten.Count!=0)
                {
                    var content = $"{""},{""},{""},{lensWhiten[0].DefectType},{lensWhiten[0].PostTreatmentResults}";
                    var content = $"{""},{""},{""},{lensWhiten[0].DefectType+ lensWhiten[0].JudgmentResult},{lensWhiten[0].PostTreatmentResults}";
                    File.AppendAllText(file12, content, Encoding.UTF8);
                    File.AppendAllText(file12, "\r\n");
                    for (int i = 0; i < lensWhiten.Count; i++)