浏览代码

XML解析工具修改

Hcsy 7 年之前
父节点
当前提交
2a0fc185e3
共有 3 个文件被更改,包括 115 次插入40 次删除
  1. 38 23
      UAS_XmlAnalysor/Form1.cs
  2. 65 17
      UAS_XmlAnalysor/Login.Designer.cs
  3. 12 0
      UAS_XmlAnalysor/Login.cs

+ 38 - 23
UAS_XmlAnalysor/Form1.cs

@@ -222,7 +222,6 @@ namespace UAS_XmlAnalysor
             }
             }
 
 
             string test_result = "";
             string test_result = "";
-            string oMSID = "";
             string oErrMessage = "";
             string oErrMessage = "";
 
 
             string testDate = "";
             string testDate = "";
@@ -361,29 +360,35 @@ namespace UAS_XmlAnalysor
                     switch (test_result)
                     switch (test_result)
                     {
                     {
                         case "OK":
                         case "OK":
-                            if (ms_status == "3")
+                            if(BaseUtil.GetCacheData("Status").ToString() != "offline")
                             {
                             {
-                                string nextstepcode = dh.getFieldDataByCondition("craft left join craftdetail on cr_id=cd_crid ", "cd_nextstepcode", "cr_code='" + ms_craftcode + "' and cr_prodcode='" + ms_prodcode + "' and cd_stepcode='" + istepcode + "'").ToString();
-                                dh.UpdateByCondition("makeserial", "ms_status=1,ms_nextstepcode='" + nextstepcode + "'", "ms_sncode='" + sncode + "' and ms_makecode='" + makecode + "'");
-                                dh.UpdateByCondition("makebad", "mb_status=-1", "mb_sncode='" + sncode + "' and mb_makecode='" + makecode + "'");
-                            }
-
-                            if (!LogicHandler.SetStepResult(makecode, isource, sncode, "自动过站采集", test_result, iusercode, out oErrMessage))
-                            {
-                                OperateResult.AppendText(oErrMessage + "\n");
-                                tipform.startthread(oErrMessage, test_result);
-                                return;
+                                if (ms_status == "3")
+                                {
+                                    string nextstepcode = dh.getFieldDataByCondition("craft left join craftdetail on cr_id=cd_crid ", "cd_nextstepcode", "cr_code='" + ms_craftcode + "' and cr_prodcode='" + ms_prodcode + "' and cd_stepcode='" + istepcode + "'").ToString();
+                                    dh.UpdateByCondition("makeserial", "ms_status=1,ms_nextstepcode='" + nextstepcode + "'", "ms_sncode='" + sncode + "' and ms_makecode='" + makecode + "'");
+                                    dh.UpdateByCondition("makebad", "mb_status=-1", "mb_sncode='" + sncode + "' and mb_makecode='" + makecode + "'");
+                                }
+
+                                if (!LogicHandler.SetStepResult(makecode, isource, sncode, "自动过站采集", test_result, iusercode, out oErrMessage))
+                                {
+                                    OperateResult.AppendText(oErrMessage + "\n");
+                                    tipform.startthread(oErrMessage, test_result);
+                                    return;
+                                }
                             }
                             }
                             tipform.startthread("序列号 " + sncode + "通过检测,OK", test_result);
                             tipform.startthread("序列号 " + sncode + "通过检测,OK", test_result);
                             break;
                             break;
                         case "NG":
                         case "NG":
-                            RecordBadInfo(sncode, makecode, e.Name, "");
-                            //所有的序列号均采集为良品
-                            if (!LogicHandler.SetTestNGDetail(sncode, makecode, iusercode, isource, test_result, out oErrMessage))
+                            if (BaseUtil.GetCacheData("Status").ToString() != "offline")
                             {
                             {
-                                OperateResult.AppendText(oErrMessage + "\n");
-                                tipform.startthread(oErrMessage, test_result);
-                                return;
+                                RecordBadInfo(sncode, makecode, e.Name, "");
+                                //所有的序列号均采集为良品
+                                if (!LogicHandler.SetTestNGDetail(sncode, makecode, iusercode, isource, test_result, out oErrMessage))
+                                {
+                                    OperateResult.AppendText(oErrMessage + "\n");
+                                    tipform.startthread(oErrMessage, test_result);
+                                    return;
+                                }
                             }
                             }
                             tipform.startthread("序列号 " + sncode + "未通过检测,NG", test_result);
                             tipform.startthread("序列号 " + sncode + "未通过检测,NG", test_result);
                             break;
                             break;
@@ -399,11 +404,21 @@ namespace UAS_XmlAnalysor
                 tipform.startthread(oErrMessage, "NG");
                 tipform.startthread(oErrMessage, "NG");
                 return;
                 return;
             }
             }
-            string sql = "insert into STEPTESTDETAIL(std_id,std_makecode,std_sn,std_subclass1,std_subclass2,std_subclass3,std_testresult,std_indate,";
-            sql += "std_rescode,std_testdate,std_testtime,std_date) values(STEPTESTDETAIL_seq.nextval, '" + makecode + "', ";
-            sql += "'" + sncode + "',:std_subclass1,:std_subclass2,:std_subclass3,:std_testresult, sysdate,'" + isource + "',to_char(to_date('" + testDate + "','YYYY/MM/DD'), 'YYYYMMDD'),";
-            sql += "to_char(to_date('" + testTime + "','hh24:mi:ss'), 'hh24miss'),to_date('" + test_date + "','YYYY/MM/DD hh24:mi:ss'))";
-            dh.BatchInsert(sql, new string[] { "std_subclass1", "std_subclass2", "std_subclass3", "std_testresult" }, name.ToArray(), class2.ToArray(), class3.ToArray(),result.ToArray());
+            if (BaseUtil.GetCacheData("Mode").ToString() != "SPI")
+            {
+                string sql = "insert into STEPTESTDETAIL(std_id,std_makecode,std_sn,std_subclass1,std_subclass2,std_subclass3,std_testresult,std_indate,";
+                sql += "std_rescode,std_testdate,std_testtime,std_date) values(STEPTESTDETAIL_seq.nextval, '" + makecode + "', ";
+                sql += "'" + sncode + "',:std_subclass1,:std_subclass2,:std_subclass3,:std_testresult, sysdate,'" + isource + "',to_char(to_date('" + testDate + "','YYYY/MM/DD'), 'YYYYMMDD'),";
+                sql += "to_char(to_date('" + testTime + "','hh24:mi:ss'), 'hh24miss'),to_date('" + test_date + "','YYYY/MM/DD hh24:mi:ss'))";
+                dh.BatchInsert(sql, new string[] { "std_subclass1", "std_subclass2", "std_subclass3", "std_testresult" }, name.ToArray(), class2.ToArray(), class3.ToArray(), result.ToArray());
+            }
+            else {
+                string sql = "insert into SPIDATA(SPI_ID,SPI_SNCODE,SPI_ITEM,SPI_RESULT,SPI_DATE,SPI_TESTDATE) values(SPIDATA_SEQ.nextval, ";
+                sql += "'" + sncode + "',:std_subclass1,:std_testresult, sysdate,";
+                sql += "to_date('" + test_date + "','YYYY/MM/DD hh24:mi:ss'))";
+                dh.BatchInsert(sql, new string[] { "std_subclass1", "std_testresult" }, name.ToArray(), result.ToArray());
+            }
+
             FileInfo file = new FileInfo(FolderPath.Text + @"\" + e.Name);
             FileInfo file = new FileInfo(FolderPath.Text + @"\" + e.Name);
             if (file.Exists)
             if (file.Exists)
             {
             {

+ 65 - 17
UAS_XmlAnalysor/Login.Designer.cs

@@ -35,75 +35,119 @@
             this.Source = new System.Windows.Forms.TextBox();
             this.Source = new System.Windows.Forms.TextBox();
             this.Source_label = new System.Windows.Forms.Label();
             this.Source_label = new System.Windows.Forms.Label();
             this.CheckLogin = new System.Windows.Forms.Button();
             this.CheckLogin = new System.Windows.Forms.Button();
+            this.label1 = new System.Windows.Forms.Label();
+            this.Equipment = new System.Windows.Forms.TextBox();
+            this.onlinebutton = new System.Windows.Forms.CheckBox();
             this.SuspendLayout();
             this.SuspendLayout();
             // 
             // 
             // UserName
             // UserName
             // 
             // 
-            this.UserName.Location = new System.Drawing.Point(206, 53);
+            this.UserName.Location = new System.Drawing.Point(154, 42);
+            this.UserName.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
             this.UserName.Name = "UserName";
             this.UserName.Name = "UserName";
-            this.UserName.Size = new System.Drawing.Size(163, 25);
+            this.UserName.Size = new System.Drawing.Size(123, 21);
             this.UserName.TabIndex = 5;
             this.UserName.TabIndex = 5;
             // 
             // 
             // UserName_lable
             // UserName_lable
             // 
             // 
             this.UserName_lable.AutoSize = true;
             this.UserName_lable.AutoSize = true;
             this.UserName_lable.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.UserName_lable.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.UserName_lable.Location = new System.Drawing.Point(122, 51);
+            this.UserName_lable.Location = new System.Drawing.Point(92, 41);
+            this.UserName_lable.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
             this.UserName_lable.Name = "UserName_lable";
             this.UserName_lable.Name = "UserName_lable";
-            this.UserName_lable.Size = new System.Drawing.Size(72, 27);
+            this.UserName_lable.Size = new System.Drawing.Size(58, 21);
             this.UserName_lable.TabIndex = 4;
             this.UserName_lable.TabIndex = 4;
             this.UserName_lable.Text = "用户名";
             this.UserName_lable.Text = "用户名";
             // 
             // 
             // PassWord
             // PassWord
             // 
             // 
-            this.PassWord.Location = new System.Drawing.Point(206, 110);
+            this.PassWord.Location = new System.Drawing.Point(154, 88);
+            this.PassWord.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
             this.PassWord.Name = "PassWord";
             this.PassWord.Name = "PassWord";
             this.PassWord.PasswordChar = '*';
             this.PassWord.PasswordChar = '*';
-            this.PassWord.Size = new System.Drawing.Size(163, 25);
+            this.PassWord.Size = new System.Drawing.Size(123, 21);
             this.PassWord.TabIndex = 7;
             this.PassWord.TabIndex = 7;
             // 
             // 
             // PassWord_label
             // PassWord_label
             // 
             // 
             this.PassWord_label.AutoSize = true;
             this.PassWord_label.AutoSize = true;
             this.PassWord_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.PassWord_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.PassWord_label.Location = new System.Drawing.Point(122, 108);
+            this.PassWord_label.Location = new System.Drawing.Point(92, 86);
+            this.PassWord_label.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
             this.PassWord_label.Name = "PassWord_label";
             this.PassWord_label.Name = "PassWord_label";
-            this.PassWord_label.Size = new System.Drawing.Size(52, 27);
+            this.PassWord_label.Size = new System.Drawing.Size(42, 21);
             this.PassWord_label.TabIndex = 6;
             this.PassWord_label.TabIndex = 6;
             this.PassWord_label.Text = "密码";
             this.PassWord_label.Text = "密码";
             // 
             // 
             // Source
             // Source
             // 
             // 
-            this.Source.Location = new System.Drawing.Point(206, 169);
+            this.Source.Location = new System.Drawing.Point(154, 126);
+            this.Source.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
             this.Source.Name = "Source";
             this.Source.Name = "Source";
-            this.Source.Size = new System.Drawing.Size(163, 25);
+            this.Source.Size = new System.Drawing.Size(123, 21);
             this.Source.TabIndex = 9;
             this.Source.TabIndex = 9;
             // 
             // 
             // Source_label
             // Source_label
             // 
             // 
             this.Source_label.AutoSize = true;
             this.Source_label.AutoSize = true;
             this.Source_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.Source_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.Source_label.Location = new System.Drawing.Point(122, 169);
+            this.Source_label.Location = new System.Drawing.Point(92, 126);
+            this.Source_label.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
             this.Source_label.Name = "Source_label";
             this.Source_label.Name = "Source_label";
-            this.Source_label.Size = new System.Drawing.Size(52, 27);
+            this.Source_label.Size = new System.Drawing.Size(42, 21);
             this.Source_label.TabIndex = 8;
             this.Source_label.TabIndex = 8;
             this.Source_label.Text = "资源";
             this.Source_label.Text = "资源";
             // 
             // 
             // CheckLogin
             // CheckLogin
             // 
             // 
-            this.CheckLogin.Location = new System.Drawing.Point(220, 224);
+            this.CheckLogin.Location = new System.Drawing.Point(164, 194);
+            this.CheckLogin.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
             this.CheckLogin.Name = "CheckLogin";
             this.CheckLogin.Name = "CheckLogin";
-            this.CheckLogin.Size = new System.Drawing.Size(75, 30);
+            this.CheckLogin.Size = new System.Drawing.Size(56, 24);
             this.CheckLogin.TabIndex = 10;
             this.CheckLogin.TabIndex = 10;
             this.CheckLogin.Text = "登陆";
             this.CheckLogin.Text = "登陆";
             this.CheckLogin.UseVisualStyleBackColor = true;
             this.CheckLogin.UseVisualStyleBackColor = true;
             this.CheckLogin.Click += new System.EventHandler(this.CheckLogin_Click);
             this.CheckLogin.Click += new System.EventHandler(this.CheckLogin_Click);
             // 
             // 
+            // label1
+            // 
+            this.label1.AutoSize = true;
+            this.label1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label1.Location = new System.Drawing.Point(92, 161);
+            this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(42, 21);
+            this.label1.TabIndex = 12;
+            this.label1.Text = "设备";
+            // 
+            // Equipment
+            // 
+            this.Equipment.Location = new System.Drawing.Point(154, 161);
+            this.Equipment.Margin = new System.Windows.Forms.Padding(2);
+            this.Equipment.Name = "Equipment";
+            this.Equipment.Size = new System.Drawing.Size(123, 21);
+            this.Equipment.TabIndex = 13;
+            // 
+            // onlinebutton
+            // 
+            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.Name = "onlinebutton";
+            this.onlinebutton.Size = new System.Drawing.Size(72, 16);
+            this.onlinebutton.TabIndex = 14;
+            this.onlinebutton.Text = "过站操作";
+            this.onlinebutton.UseVisualStyleBackColor = true;
+            // 
             // Login
             // Login
             // 
             // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(508, 286);
+            this.ClientSize = new System.Drawing.Size(381, 229);
+            this.Controls.Add(this.onlinebutton);
+            this.Controls.Add(this.Equipment);
+            this.Controls.Add(this.label1);
             this.Controls.Add(this.CheckLogin);
             this.Controls.Add(this.CheckLogin);
             this.Controls.Add(this.Source);
             this.Controls.Add(this.Source);
             this.Controls.Add(this.Source_label);
             this.Controls.Add(this.Source_label);
@@ -111,10 +155,11 @@
             this.Controls.Add(this.PassWord_label);
             this.Controls.Add(this.PassWord_label);
             this.Controls.Add(this.UserName);
             this.Controls.Add(this.UserName);
             this.Controls.Add(this.UserName_lable);
             this.Controls.Add(this.UserName_lable);
+            this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
             this.Name = "Login";
             this.Name = "Login";
             this.Text = "Login";
             this.Text = "Login";
             this.Load += new System.EventHandler(this.Login_Load);
             this.Load += new System.EventHandler(this.Login_Load);
-            this.ResumeLayout(false);
+            this.ResumeLayout(true);
             this.PerformLayout();
             this.PerformLayout();
 
 
         }
         }
@@ -128,5 +173,8 @@
         private System.Windows.Forms.TextBox Source;
         private System.Windows.Forms.TextBox Source;
         private System.Windows.Forms.Label Source_label;
         private System.Windows.Forms.Label Source_label;
         private System.Windows.Forms.Button CheckLogin;
         private System.Windows.Forms.Button CheckLogin;
+        private System.Windows.Forms.Label label1;
+        private System.Windows.Forms.TextBox Equipment;
+        private System.Windows.Forms.CheckBox onlinebutton;
     }
     }
 }
 }

+ 12 - 0
UAS_XmlAnalysor/Login.cs

@@ -21,6 +21,13 @@ namespace UAS_XmlAnalysor
                 {
                 {
                     BaseUtil.SetCacheData("UserName", UserName.Text);
                     BaseUtil.SetCacheData("UserName", UserName.Text);
                     BaseUtil.SetCacheData("Source", Source.Text);
                     BaseUtil.SetCacheData("Source", Source.Text);
+                    if (onlinebutton.Checked)
+                    {
+                        BaseUtil.SetCacheData("Status", "online");
+                    }
+                    else
+                        BaseUtil.SetCacheData("Status", "offline");
+                    BaseUtil.SetCacheData("Mode", Equipment.Text);
                     Form1 xml = new Form1(UserName.Text, Source.Text);
                     Form1 xml = new Form1(UserName.Text, Source.Text);
                     Hide();
                     Hide();
                     xml.ShowDialog();
                     xml.ShowDialog();
@@ -35,6 +42,11 @@ namespace UAS_XmlAnalysor
         {
         {
             UserName.Text = BaseUtil.GetCacheData("UserName").ToString();
             UserName.Text = BaseUtil.GetCacheData("UserName").ToString();
             Source.Text = BaseUtil.GetCacheData("Source").ToString();
             Source.Text = BaseUtil.GetCacheData("Source").ToString();
+            Equipment.Text = BaseUtil.GetCacheData("Mode").ToString();
+            if (BaseUtil.GetCacheData("Status").ToString() == "offline")
+            {
+                onlinebutton.Checked = false;
+            }
             if (UserName.Text != "")
             if (UserName.Text != "")
             {
             {
                 PassWord.Focus();
                 PassWord.Focus();