Browse Source

未过站文件批量解析,添加A面切换工单提示

章政 7 years ago
parent
commit
f72e6f848b
2 changed files with 273 additions and 48 deletions
  1. 59 46
      UAS_AutoPass/AutoAnalysisXml.Designer.cs
  2. 214 2
      UAS_AutoPass/AutoAnalysisXml.cs

+ 59 - 46
UAS_AutoPass/AutoAnalysisXml.Designer.cs

@@ -45,6 +45,7 @@
             this.Master = new System.Windows.Forms.ComboBox();
             this.AutoStart = new System.Windows.Forms.CheckBox();
             this.ma_code = new System.Windows.Forms.TextBox();
+            this.BatchAnalysus = new System.Windows.Forms.Button();
             ((System.ComponentModel.ISupportInitialize)(this.XmlWatcher)).BeginInit();
             this.SuspendLayout();
             // 
@@ -57,10 +58,10 @@
             // StartWatch
             // 
             this.StartWatch.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.StartWatch.Location = new System.Drawing.Point(145, 256);
-            this.StartWatch.Margin = new System.Windows.Forms.Padding(2);
+            this.StartWatch.Location = new System.Drawing.Point(193, 320);
+            this.StartWatch.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.StartWatch.Name = "StartWatch";
-            this.StartWatch.Size = new System.Drawing.Size(64, 28);
+            this.StartWatch.Size = new System.Drawing.Size(85, 35);
             this.StartWatch.TabIndex = 0;
             this.StartWatch.Text = "开始监控";
             this.StartWatch.UseVisualStyleBackColor = true;
@@ -70,10 +71,10 @@
             // 
             this.StopWatch.Enabled = false;
             this.StopWatch.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.StopWatch.Location = new System.Drawing.Point(249, 256);
-            this.StopWatch.Margin = new System.Windows.Forms.Padding(2);
+            this.StopWatch.Location = new System.Drawing.Point(332, 320);
+            this.StopWatch.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.StopWatch.Name = "StopWatch";
-            this.StopWatch.Size = new System.Drawing.Size(64, 28);
+            this.StopWatch.Size = new System.Drawing.Size(85, 35);
             this.StopWatch.TabIndex = 1;
             this.StopWatch.Text = "停止监控";
             this.StopWatch.UseVisualStyleBackColor = true;
@@ -83,29 +84,28 @@
             // 
             this.label1.AutoSize = true;
             this.label1.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label1.Location = new System.Drawing.Point(27, 139);
-            this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label1.Location = new System.Drawing.Point(36, 174);
             this.label1.Name = "label1";
-            this.label1.Size = new System.Drawing.Size(84, 20);
+            this.label1.Size = new System.Drawing.Size(107, 25);
             this.label1.TabIndex = 2;
             this.label1.Text = "监控文件夹";
             // 
             // FolderPath
             // 
             this.FolderPath.Enabled = false;
-            this.FolderPath.Location = new System.Drawing.Point(112, 139);
-            this.FolderPath.Margin = new System.Windows.Forms.Padding(2);
+            this.FolderPath.Location = new System.Drawing.Point(149, 174);
+            this.FolderPath.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.FolderPath.Name = "FolderPath";
-            this.FolderPath.Size = new System.Drawing.Size(220, 21);
+            this.FolderPath.Size = new System.Drawing.Size(292, 25);
             this.FolderPath.TabIndex = 3;
             // 
             // ChooseFolder
             // 
             this.ChooseFolder.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ChooseFolder.Location = new System.Drawing.Point(346, 139);
-            this.ChooseFolder.Margin = new System.Windows.Forms.Padding(2);
+            this.ChooseFolder.Location = new System.Drawing.Point(461, 174);
+            this.ChooseFolder.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.ChooseFolder.Name = "ChooseFolder";
-            this.ChooseFolder.Size = new System.Drawing.Size(78, 24);
+            this.ChooseFolder.Size = new System.Drawing.Size(104, 30);
             this.ChooseFolder.TabIndex = 6;
             this.ChooseFolder.Text = "选择文件夹";
             this.ChooseFolder.UseVisualStyleBackColor = true;
@@ -113,20 +113,20 @@
             // 
             // OperateResult
             // 
-            this.OperateResult.Location = new System.Drawing.Point(446, 11);
-            this.OperateResult.Margin = new System.Windows.Forms.Padding(2);
+            this.OperateResult.Location = new System.Drawing.Point(595, 14);
+            this.OperateResult.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.OperateResult.Name = "OperateResult";
-            this.OperateResult.Size = new System.Drawing.Size(211, 270);
+            this.OperateResult.Size = new System.Drawing.Size(280, 336);
             this.OperateResult.TabIndex = 7;
             this.OperateResult.Text = "";
             // 
             // Clean
             // 
             this.Clean.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.Clean.Location = new System.Drawing.Point(524, 287);
-            this.Clean.Margin = new System.Windows.Forms.Padding(2);
+            this.Clean.Location = new System.Drawing.Point(699, 359);
+            this.Clean.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.Clean.Name = "Clean";
-            this.Clean.Size = new System.Drawing.Size(56, 24);
+            this.Clean.Size = new System.Drawing.Size(75, 30);
             this.Clean.TabIndex = 8;
             this.Clean.Text = "清除";
             this.Clean.UseVisualStyleBackColor = true;
@@ -135,10 +135,10 @@
             // ChooseBackUpFolder
             // 
             this.ChooseBackUpFolder.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ChooseBackUpFolder.Location = new System.Drawing.Point(346, 201);
-            this.ChooseBackUpFolder.Margin = new System.Windows.Forms.Padding(2);
+            this.ChooseBackUpFolder.Location = new System.Drawing.Point(461, 251);
+            this.ChooseBackUpFolder.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.ChooseBackUpFolder.Name = "ChooseBackUpFolder";
-            this.ChooseBackUpFolder.Size = new System.Drawing.Size(78, 24);
+            this.ChooseBackUpFolder.Size = new System.Drawing.Size(104, 30);
             this.ChooseBackUpFolder.TabIndex = 11;
             this.ChooseBackUpFolder.Text = "选择文件夹";
             this.ChooseBackUpFolder.UseVisualStyleBackColor = true;
@@ -147,20 +147,19 @@
             // BackUpFolderPath
             // 
             this.BackUpFolderPath.Enabled = false;
-            this.BackUpFolderPath.Location = new System.Drawing.Point(112, 201);
-            this.BackUpFolderPath.Margin = new System.Windows.Forms.Padding(2);
+            this.BackUpFolderPath.Location = new System.Drawing.Point(149, 251);
+            this.BackUpFolderPath.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.BackUpFolderPath.Name = "BackUpFolderPath";
-            this.BackUpFolderPath.Size = new System.Drawing.Size(220, 21);
+            this.BackUpFolderPath.Size = new System.Drawing.Size(292, 25);
             this.BackUpFolderPath.TabIndex = 10;
             // 
             // label2
             // 
             this.label2.AutoSize = true;
             this.label2.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label2.Location = new System.Drawing.Point(27, 201);
-            this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label2.Location = new System.Drawing.Point(36, 251);
             this.label2.Name = "label2";
-            this.label2.Size = new System.Drawing.Size(84, 20);
+            this.label2.Size = new System.Drawing.Size(107, 25);
             this.label2.TabIndex = 9;
             this.label2.Text = "备份文件夹";
             // 
@@ -168,10 +167,9 @@
             // 
             this.MakeCode_lable.AutoSize = true;
             this.MakeCode_lable.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.MakeCode_lable.Location = new System.Drawing.Point(27, 80);
-            this.MakeCode_lable.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.MakeCode_lable.Location = new System.Drawing.Point(36, 100);
             this.MakeCode_lable.Name = "MakeCode_lable";
-            this.MakeCode_lable.Size = new System.Drawing.Size(54, 20);
+            this.MakeCode_lable.Size = new System.Drawing.Size(69, 25);
             this.MakeCode_lable.TabIndex = 12;
             this.MakeCode_lable.Text = "工单号";
             // 
@@ -179,10 +177,9 @@
             // 
             this.label4.AutoSize = true;
             this.label4.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label4.Location = new System.Drawing.Point(27, 23);
-            this.label4.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label4.Location = new System.Drawing.Point(36, 29);
             this.label4.Name = "label4";
-            this.label4.Size = new System.Drawing.Size(69, 20);
+            this.label4.Size = new System.Drawing.Size(88, 25);
             this.label4.TabIndex = 14;
             this.label4.Text = "账套选择";
             // 
@@ -190,17 +187,19 @@
             // 
             this.Master.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
             this.Master.FormattingEnabled = true;
-            this.Master.Location = new System.Drawing.Point(112, 23);
+            this.Master.Location = new System.Drawing.Point(149, 29);
+            this.Master.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.Master.Name = "Master";
-            this.Master.Size = new System.Drawing.Size(220, 20);
+            this.Master.Size = new System.Drawing.Size(292, 23);
             this.Master.TabIndex = 15;
             // 
             // AutoStart
             // 
             this.AutoStart.AutoSize = true;
-            this.AutoStart.Location = new System.Drawing.Point(343, 26);
+            this.AutoStart.Location = new System.Drawing.Point(457, 32);
+            this.AutoStart.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.AutoStart.Name = "AutoStart";
-            this.AutoStart.Size = new System.Drawing.Size(96, 16);
+            this.AutoStart.Size = new System.Drawing.Size(119, 19);
             this.AutoStart.TabIndex = 16;
             this.AutoStart.Text = "开机自动启动";
             this.AutoStart.UseVisualStyleBackColor = true;
@@ -208,17 +207,30 @@
             // 
             // ma_code
             // 
-            this.ma_code.Location = new System.Drawing.Point(112, 80);
-            this.ma_code.Margin = new System.Windows.Forms.Padding(2);
+            this.ma_code.Location = new System.Drawing.Point(149, 100);
+            this.ma_code.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.ma_code.Name = "ma_code";
-            this.ma_code.Size = new System.Drawing.Size(220, 21);
+            this.ma_code.Size = new System.Drawing.Size(292, 25);
             this.ma_code.TabIndex = 17;
             // 
+            // BatchAnalysus
+            // 
+            this.BatchAnalysus.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.BatchAnalysus.Location = new System.Drawing.Point(461, 98);
+            this.BatchAnalysus.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.BatchAnalysus.Name = "BatchAnalysus";
+            this.BatchAnalysus.Size = new System.Drawing.Size(104, 30);
+            this.BatchAnalysus.TabIndex = 18;
+            this.BatchAnalysus.Text = "批量解析";
+            this.BatchAnalysus.UseVisualStyleBackColor = true;
+            this.BatchAnalysus.Click += new System.EventHandler(this.BatchAnalysus_Click);
+            // 
             // AutoAnalysisXml
             // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(665, 316);
+            this.ClientSize = new System.Drawing.Size(887, 395);
+            this.Controls.Add(this.BatchAnalysus);
             this.Controls.Add(this.ma_code);
             this.Controls.Add(this.AutoStart);
             this.Controls.Add(this.Master);
@@ -234,7 +246,7 @@
             this.Controls.Add(this.label1);
             this.Controls.Add(this.StopWatch);
             this.Controls.Add(this.StartWatch);
-            this.Margin = new System.Windows.Forms.Padding(2);
+            this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.MaximizeBox = false;
             this.Name = "AutoAnalysisXml";
             this.Text = "UAS自动过站解析器";
@@ -265,6 +277,7 @@
         private System.Windows.Forms.Label label4;
         private System.Windows.Forms.CheckBox AutoStart;
         private System.Windows.Forms.TextBox ma_code;
+        private System.Windows.Forms.Button BatchAnalysus;
     }
 }
 

+ 214 - 2
UAS_AutoPass/AutoAnalysisXml.cs

@@ -264,7 +264,7 @@ namespace UAS_AutoPass
                 if (LogicHandler.CheckStepSNAndMacode(ma_code.Text == "" ? makecode : ma_code.Text, isource, sncode, iusercode, out makecode, out oMSID, out oErrMessage))
                 {
                     //插入日志
-                    LogicHandler.AutoPassLog(sncode, isource, makecode, test_date, istepcode, ilinecode, e.Name, test_result == "NG" ? "-1" : "0","-1");
+                    LogicHandler.AutoPassLog(sncode, isource, makecode, test_date, istepcode, ilinecode, e.Name, test_result == "NG" ? "-1" : "0", "-1");
                     //如果是不良品记录日志,用于测试采集判负
                     if (test_result == "NG")
                     {
@@ -286,6 +286,7 @@ namespace UAS_AutoPass
             {
                 string status = "";
                 string errmessage = "";
+                bool NoteAlready = false;
                 LogicHandler.GetMakeInfo(sncode, out makecode, out status, out errmessage);
                 if (ma_code.Text != makecode && makecode != "" && ma_code.Text != "" && status != "2")
                 {
@@ -295,9 +296,30 @@ namespace UAS_AutoPass
                     {
                         makecode = ma_code.Text;
                     }
+                    else
+                    {
+                        NoteAlready = true;
+                    }
                 }
                 if (LogicHandler.CheckStepSNAndMacode(makecode, isource, sncode, iusercode, out makecode, out oMSID, out oErrMessage))
                 {
+                    if (!NoteAlready)
+                    {
+                        if (makecode != ma_code.Text && ma_code.Text != "")
+                        {
+                            string ChangeMakeCode = MessageBox.Show(this.ParentForm, "序列号所属工单不同,是否切换?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
+                            //如果选择不切换赋值当前界面工单
+                            if (ChangeMakeCode == "Yes")
+                            {
+                                ma_code.Text = makecode;
+                            }
+                            else
+                            {
+                                OperateResult.AppendText(">>请重新采集序列号\n");
+                                return;
+                            }
+                        }
+                    }
                     //获取序列号ID最大的工单
                     dt = (DataTable)dh.ExecuteSql("select ms_makecode,ms_id from makeserial where ms_sncode='" + sncode + "' order by ms_id desc", "select");
                     if (dt.Rows.Count > 0)
@@ -325,7 +347,7 @@ namespace UAS_AutoPass
                             default:
                                 break;
                         }
-                        LogicHandler.AutoPassLog(sncode, isource, makecode, test_date, istepcode, ilinecode, e.Name, test_result == "NG" ? "1" : "0","0");
+                        LogicHandler.AutoPassLog(sncode, isource, makecode, test_date, istepcode, ilinecode, e.Name, test_result == "NG" ? "1" : "0", "0");
                     }
                 }
                 else
@@ -461,5 +483,195 @@ namespace UAS_AutoPass
                 rk.Close();
             }
         }
+
+        private void BatchAnalysus_Click(object sender, EventArgs e)
+        {
+            var AllXmls = Directory.GetFiles(FolderPath.Text, "*.xml");
+            foreach (var Xml in AllXmls)
+            {
+                string fileName = Xml.Substring(Xml.LastIndexOf(@"\")+1, Xml.Length- Xml.LastIndexOf(@"\")-1);
+                string test_date = "";
+                string test_result = "";
+                string test_sn = "";
+                string imageurl = "";
+                string oMSID = "";
+                string oErrMessage = "";
+                XmlReader myReader = XmlReader.Create(FolderPath.Text + @"\" + fileName);
+                OperateResult.AppendText("读取文件" + fileName + "\n");
+                //获取采集的项目名称
+                List<string> badcode = new List<string>();
+                //获取采集项目的结果
+                List<string> badlocation = new List<string>();
+                int code_or_location = 0;
+                while (myReader.Read())
+                {
+                    if (myReader.NodeType == XmlNodeType.Element && myReader.Name == "test" && myReader.IsStartElement())
+                    {
+                        test_sn = myReader.GetAttribute("test_sn");
+                        test_result = myReader.GetAttribute("test_result");
+                        test_date = myReader.GetAttribute("test_date");
+                        imageurl = myReader.GetAttribute("imgurl");
+                    }
+                    if (myReader.NodeType == XmlNodeType.Text)
+                    {
+                        if (code_or_location % 2 == 0)
+                        {
+                            badcode.Add(myReader.Value);
+                            code_or_location++;
+                        }
+                        else
+                        {
+                            badlocation.Add(myReader.Value);
+                            code_or_location++;
+                        }
+                    }
+                }
+                myReader.Close();
+                //获取文件名的序列号,如SA123456.xml,如果开头为-表示无条码需要自动获取
+                string sncode = fileName.Substring(0, 1) == "-" ? "" : fileName.Split('.')[0];
+                string makecode = "";
+                //获取序列号ID最大的工单号,所有序列号都测试为良品
+                if (sncode == "")
+                {
+                    //获取资源,线别,工序相等,并且状态在线的序列号进行分配
+                    sql.Clear();
+                    sql.Append("select ms_sncode,ms_makecode from makeserial left join source on sc_code=ms_sccode where ");
+                    sql.Append("ms_linecode='" + ilinecode + "' and ms_nextstepcode='" + istepcode + "' and ms_status=1 order by ms_id");
+                    dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
+                    if (dt.Rows.Count > 0)
+                    {
+                        makecode = dt.Rows[0]["ms_makecode"].ToString();
+                        sncode = dt.Rows[0]["ms_sncode"].ToString();
+                    }
+                    else
+                    {
+                        OperateResult.AppendText("当前线别在" + istepcode + "无可分配序列号");
+                        continue;
+                    }
+                    //-2-NG2017/10/2514:46:29.xml取第二位版号
+                    string combinecode = fileName.Substring(1, 1);
+                    if (LogicHandler.CheckStepSNAndMacode(ma_code.Text == "" ? makecode : ma_code.Text, isource, sncode, iusercode, out makecode, out oMSID, out oErrMessage))
+                    {
+                        //插入日志
+                        LogicHandler.AutoPassLog(sncode, isource, makecode, test_date, istepcode, ilinecode, fileName, test_result == "NG" ? "-1" : "0", "-1");
+                        //如果是不良品记录日志,用于测试采集判负
+                        if (test_result == "NG")
+                        {
+                            RecordBadInfo(sncode, makecode, fileName, combinecode, badcode.ToArray(), badlocation.ToArray());
+                        }
+                        if (!LogicHandler.SetStepResult(makecode, isource, sncode, "自动过站采集", "OK", iusercode, out oErrMessage))
+                        {
+                            OperateResult.AppendText(oErrMessage + "\n");
+                            continue;
+                        }
+                    }
+                    else
+                    {
+                        OperateResult.AppendText(oErrMessage + "\n");
+                        continue;
+                    }
+                }
+                else
+                {
+                    string status = "";
+                    string errmessage = "";
+                    bool NoteAlready = false;
+                    LogicHandler.GetMakeInfo(sncode, out makecode, out status, out errmessage);
+                    if (ma_code.Text != makecode && makecode != "" && ma_code.Text != "" && status != "2")
+                    {
+                        string ChangeMakeCode = MessageBox.Show(this.ParentForm, "序列号" + sncode + "所属工单不同,是否切换?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
+                        //如果选择不切换赋值当前界面工单
+                        if (ChangeMakeCode != "Yes")
+                        {
+                            makecode = ma_code.Text;
+                        }
+                        else
+                        {
+                            NoteAlready = true;
+                        }
+                    }
+                    if (LogicHandler.CheckStepSNAndMacode(makecode, isource, sncode, iusercode, out makecode, out oMSID, out oErrMessage))
+                    {
+                        if (!NoteAlready)
+                        {
+                            if (makecode != ma_code.Text && ma_code.Text != "")
+                            {
+                                string ChangeMakeCode = MessageBox.Show(this.ParentForm, "序列号所属工单不同,是否切换?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
+                                //如果选择不切换赋值当前界面工单
+                                if (ChangeMakeCode == "Yes")
+                                {
+                                    ma_code.Text = makecode;
+                                }
+                                else
+                                {
+                                    OperateResult.AppendText(">>请重新采集序列号\n");
+                                    continue;
+                                }
+                            }
+                        }
+                        //获取序列号ID最大的工单
+                        dt = (DataTable)dh.ExecuteSql("select ms_makecode,ms_id from makeserial where ms_sncode='" + sncode + "' order by ms_id desc", "select");
+                        if (dt.Rows.Count > 0)
+                        {
+                            ma_code.Text = dt.Rows[0]["ms_makecode"].ToString();
+                            makecode = dt.Rows[0]["ms_makecode"].ToString();
+                            switch (test_result)
+                            {
+                                case "OK":
+                                    if (!LogicHandler.SetStepResult(makecode, isource, sncode, "自动过站采集", test_result, iusercode, out oErrMessage))
+                                    {
+                                        OperateResult.AppendText(oErrMessage + "\n");
+                                        continue;
+                                    }
+                                    continue;
+                                case "NG":
+                                    RecordBadInfo(sncode, makecode, fileName, "", badcode.ToArray(), badlocation.ToArray());
+                                    //所有的序列号均采集为良品
+                                    if (!LogicHandler.SetTestNGDetail(sncode, makecode, iusercode, isource, test_result, out oErrMessage))
+                                    {
+                                        OperateResult.AppendText(oErrMessage + "\n");
+                                        continue;
+                                    }
+                                    continue;
+                                default:
+                                    continue;
+                            }
+                            LogicHandler.AutoPassLog(sncode, isource, makecode, test_date, istepcode, ilinecode, fileName, test_result == "NG" ? "1" : "0", "0");
+                        }
+                    }
+                    else
+                    {
+                        OperateResult.AppendText(oErrMessage + "\n");
+                        continue;
+                    }
+                }
+                FileInfo file = new FileInfo(FolderPath.Text + @"\" + fileName);
+                if (file.Exists)
+                {
+                    try
+                    {
+                        for (int i = 1; i <= 20; i++)
+                        {
+                            if (!File.Exists(BackUpFolderPath.Text + @"\" + fileName))
+                            {
+                                file.MoveTo(BackUpFolderPath.Text + @"\" + fileName);
+                                OperateResult.AppendText("成功解析文件" + fileName + "\n");
+                                continue;
+                            }
+                            else if (!File.Exists(BackUpFolderPath.Text + @"\" + fileName.Split('.')[0] + "(" + i + ")" + "." + fileName.Split('.')[1]))
+                            {
+                                file.MoveTo(BackUpFolderPath.Text + @"\" + fileName.Split('.')[0] + "(" + i + ")" + "." + fileName.Split('.')[1]);
+                                OperateResult.AppendText("成功解析文件" + fileName + "\n");
+                                continue;
+                            }
+                        }
+                    }
+                    catch (Exception ex)
+                    {
+                        OperateResult.AppendText(fileName + ex.Message + "\n");
+                    }
+                }
+            }
+        }
     }
 }