瀏覽代碼

Merge branch 'master' of ssh://10.10.101.21/source/mes-client

章政 7 年之前
父節點
當前提交
26c9d88561
共有 2 個文件被更改,包括 44 次插入39 次删除
  1. 37 32
      UAS_AutoPass/AutoAnalysisXml.cs
  2. 7 7
      UAS_XmlAnalysor/Login.Designer.cs

+ 37 - 32
UAS_AutoPass/AutoAnalysisXml.cs

@@ -13,7 +13,7 @@ using System.Text;
 namespace UAS_AutoPass
 {
     public partial class AutoAnalysisXml : Form
-    {         
+    {
 
         DataHelper dh;
 
@@ -31,7 +31,7 @@ namespace UAS_AutoPass
         /// </summary>
         string isource;
 
-        Tip tipform ;
+        Tip tipform;
 
         Thread InitDB;
         /// <summary>
@@ -78,7 +78,7 @@ namespace UAS_AutoPass
 
         private void Form1_Load(object sender, EventArgs e)
         {
-            tipform.Show(); 
+            tipform.Show();
             CheckForIllegalCrossThreadCalls = false;
             FormBorderStyle = FormBorderStyle.FixedSingle;
             InitDB = new Thread(ConnectDB);
@@ -100,7 +100,7 @@ namespace UAS_AutoPass
                 Master.Text = BaseUtil.GetCacheData("Master").ToString();
                 AutoStart.Checked = (bool)BaseUtil.GetCacheData("AutoStart");
             }
-            catch (Exception ex) { Console.WriteLine(ex.Message); }
+            catch (Exception ex) { MessageBox.Show(ex.Message); }
             for (int i = 0; i < DB.Rows.Count; i++)
             {
                 if (Master.Text == DB.Rows[i]["ma_user"].ToString())
@@ -228,19 +228,29 @@ namespace UAS_AutoPass
                     test_date = myReader.GetAttribute("test_date");
                     imageurl = myReader.GetAttribute("imgurl");
                 }
-                if (myReader.NodeType == XmlNodeType.Text)
+                //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++;
+                //    }
+                //}
+                if (myReader.NodeType == XmlNodeType.Element && myReader.Name == "err_reason" && myReader.IsStartElement())
                 {
-                    if (code_or_location % 2 == 0)
-                    {
-                        badcode.Add(myReader.Value);
-                        code_or_location++;
-                    }
-                    else
-                    {
-                        badlocation.Add(myReader.Value);
-                        code_or_location++;
-                    }
+                    badcode.Add(myReader.ReadInnerXml() + " ");
                 }
+                if (myReader.NodeType == XmlNodeType.Element && myReader.Name == "err_location" && myReader.IsStartElement())
+                {
+                    badlocation.Add(myReader.ReadInnerXml() + " ");
+                }
+
+
             }
             myReader.Close();
             //获取文件名的序列号,如SA123456.xml,如果开头为-表示无条码需要自动获取
@@ -310,7 +320,7 @@ namespace UAS_AutoPass
                         NoteAlready = true;
                     }
                 }
-                if (LogicHandler.CheckStepSNAndMacode(makecode, isource, sncode, iusercode, out makecode, out oMSID, out oErrMessage))
+                if (LogicHandler.CheckStepSNAndMacode(ma_code.Text == "" ? makecode : ma_code.Text, isource, sncode, iusercode, out makecode, out oMSID, out oErrMessage))
                 {
                     if (!NoteAlready)
                     {
@@ -381,7 +391,7 @@ namespace UAS_AutoPass
                         if (!File.Exists(BackUpFolderPath.Text + @"\" + e.Name))
                         {
                             file.MoveTo(BackUpFolderPath.Text + @"\" + e.Name);
-                            OperateResult.AppendText("成功解析文件" + e.Name + "\n"); 
+                            OperateResult.AppendText("成功解析文件" + e.Name + "\n");
                             break;
                         }
                         else if (!File.Exists(BackUpFolderPath.Text + @"\" + e.Name.Split('.')[0] + "(" + i + ")" + "." + e.Name.Split('.')[1]))
@@ -412,11 +422,11 @@ namespace UAS_AutoPass
             string[] ID = dh.GetSEQ("makebad_seq", badcode.Length);
             sql.Clear();
             sql.Append("insert into makebad(mb_id,mb_makecode,mb_mscode,mb_sncode,mb_inman,mb_indate,mb_stepcode");
-            sql.Append(",mb_sourcecode,mb_badcode,mb_bgcode,mb_badtable,mb_status,mb_badremark,mb_stauts) select :ID");
+            sql.Append(",mb_sourcecode,mb_badcode,mb_bgcode,mb_badtable,mb_status,mb_badremark) select :ID");
             sql.Append(",ma_code,ms_code,ms_sncode,'" + iusercode + "',sysdate,'" + istepcode + "','" + isource + "',");
-            sql.Append(":bc_code,'" + ibadgroup + "','','0',:location,'-1' from make left join makeSerial on ms_makecode=ma_code ");
+            sql.Append(":bc_code,'" + ibadgroup + "','','0',:location from make left join makeSerial on ms_makecode=ma_code ");
             sql.Append("where ms_sncode='" + sncode + "' and ms_makecode='" + makecode + "'");
-            dh.BatchInsert(sql.ToString(), new string[] {"ID", "bc_code", "location" }, ID, badcode, badlocation);
+            dh.BatchInsert(sql.ToString(), new string[] { "ID", "bc_code", "location" }, ID, badcode, badlocation);
             sql.Clear();
             sql.Append("update makebad set mb_badname=(select DISTINCT bc_name from badcode where bc_code=mb_badcode),mb_bgname=(select DISTINCT bg_name from badgroup where bg_code=mb_bgcode) ");
             sql.Append("where mb_id=:ID");
@@ -509,7 +519,7 @@ namespace UAS_AutoPass
             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 fileName = Xml.Substring(Xml.LastIndexOf(@"\") + 1, Xml.Length - Xml.LastIndexOf(@"\") - 1);
                 string test_date = "";
                 string test_result = "";
                 string test_sn = "";
@@ -532,18 +542,13 @@ namespace UAS_AutoPass
                         test_date = myReader.GetAttribute("test_date");
                         imageurl = myReader.GetAttribute("imgurl");
                     }
-                    if (myReader.NodeType == XmlNodeType.Text)
+                    if (myReader.NodeType == XmlNodeType.Element && myReader.Name == "err_reason" && myReader.IsStartElement())
                     {
-                        if (code_or_location % 2 == 0)
-                        {
-                            badcode.Add(myReader.Value);
-                            code_or_location++;
-                        }
-                        else
-                        {
-                            badlocation.Add(myReader.Value);
-                            code_or_location++;
-                        }
+                        badcode.Add(myReader.ReadInnerXml() + " ");
+                    }
+                    if (myReader.NodeType == XmlNodeType.Element && myReader.Name == "err_location" && myReader.IsStartElement())
+                    {
+                        badlocation.Add(myReader.ReadInnerXml() + " ");
                     }
                 }
                 myReader.Close();

+ 7 - 7
UAS_XmlAnalysor/Login.Designer.cs

@@ -43,7 +43,7 @@
             // UserName
             // 
             this.UserName.Location = new System.Drawing.Point(154, 42);
-            this.UserName.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.UserName.Margin = new System.Windows.Forms.Padding(2);
             this.UserName.Name = "UserName";
             this.UserName.Size = new System.Drawing.Size(123, 21);
             this.UserName.TabIndex = 5;
@@ -62,7 +62,7 @@
             // PassWord
             // 
             this.PassWord.Location = new System.Drawing.Point(154, 88);
-            this.PassWord.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.PassWord.Margin = new System.Windows.Forms.Padding(2);
             this.PassWord.Name = "PassWord";
             this.PassWord.PasswordChar = '*';
             this.PassWord.Size = new System.Drawing.Size(123, 21);
@@ -82,7 +82,7 @@
             // Source
             // 
             this.Source.Location = new System.Drawing.Point(154, 126);
-            this.Source.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.Source.Margin = new System.Windows.Forms.Padding(2);
             this.Source.Name = "Source";
             this.Source.Size = new System.Drawing.Size(123, 21);
             this.Source.TabIndex = 9;
@@ -101,7 +101,7 @@
             // CheckLogin
             // 
             this.CheckLogin.Location = new System.Drawing.Point(164, 194);
-            this.CheckLogin.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.CheckLogin.Margin = new System.Windows.Forms.Padding(2);
             this.CheckLogin.Name = "CheckLogin";
             this.CheckLogin.Size = new System.Drawing.Size(56, 24);
             this.CheckLogin.TabIndex = 10;
@@ -133,11 +133,11 @@
             this.onlinebutton.AutoSize = true;
             this.onlinebutton.Checked = true;
             this.onlinebutton.CheckState = System.Windows.Forms.CheckState.Checked;
-            this.onlinebutton.Location = new System.Drawing.Point(282, 44);
+            this.onlinebutton.Location = new System.Drawing.Point(282, 163);
             this.onlinebutton.Name = "onlinebutton";
             this.onlinebutton.Size = new System.Drawing.Size(72, 16);
             this.onlinebutton.TabIndex = 14;
-            this.onlinebutton.Text = "过站操作";
+            this.onlinebutton.Text = "在线模式";
             this.onlinebutton.UseVisualStyleBackColor = true;
             // 
             // Login
@@ -155,7 +155,7 @@
             this.Controls.Add(this.PassWord_label);
             this.Controls.Add(this.UserName);
             this.Controls.Add(this.UserName_lable);
-            this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.Margin = new System.Windows.Forms.Padding(2);
             this.Name = "Login";
             this.Text = "Login";
             this.Load += new System.EventHandler(this.Login_Load);