Browse Source

自动过站增加提示

Hcsy 7 years ago
parent
commit
bde627821b
4 changed files with 314 additions and 2 deletions
  1. 11 2
      UAS_AutoPass/AutoAnalysisXml.cs
  2. 69 0
      UAS_AutoPass/Form2.Designer.cs
  3. 114 0
      UAS_AutoPass/Form2.cs
  4. 120 0
      UAS_AutoPass/Form2.resx

+ 11 - 2
UAS_AutoPass/AutoAnalysisXml.cs

@@ -13,7 +13,7 @@ using System.Text;
 namespace UAS_AutoPass
 {
     public partial class AutoAnalysisXml : Form
-    {
+    {         
 
         DataHelper dh;
 
@@ -31,6 +31,8 @@ namespace UAS_AutoPass
         /// </summary>
         string isource;
 
+        Tip tipform ;
+
         Thread InitDB;
         /// <summary>
         /// 线别
@@ -60,12 +62,14 @@ namespace UAS_AutoPass
 
         public AutoAnalysisXml()
         {
+            tipform = new Tip();
             InitializeComponent();
             StartPosition = FormStartPosition.CenterScreen;
         }
 
         public AutoAnalysisXml(string iUserName, string iSource)
         {
+            tipform = new Tip();
             InitializeComponent();
             iusercode = iUserName;
             isource = iSource;
@@ -74,6 +78,7 @@ namespace UAS_AutoPass
 
         private void Form1_Load(object sender, EventArgs e)
         {
+            tipform.Show(); 
             CheckForIllegalCrossThreadCalls = false;
             FormBorderStyle = FormBorderStyle.FixedSingle;
             InitDB = new Thread(ConnectDB);
@@ -332,8 +337,10 @@ namespace UAS_AutoPass
                                 if (!LogicHandler.SetStepResult(makecode, isource, sncode, "自动过站采集", test_result, iusercode, out oErrMessage))
                                 {
                                     OperateResult.AppendText(oErrMessage + "\n");
+                                    tipform.startthread(oErrMessage, test_result);
                                     return;
                                 }
+                                tipform.startthread("序列号 " + sncode + "通过检测", test_result);
                                 break;
                             case "NG":
                                 RecordBadInfo(sncode, makecode, e.Name, "", badcode.ToArray(), badlocation.ToArray());
@@ -341,8 +348,10 @@ namespace UAS_AutoPass
                                 if (!LogicHandler.SetTestNGDetail(sncode, makecode, iusercode, isource, test_result, out oErrMessage))
                                 {
                                     OperateResult.AppendText(oErrMessage + "\n");
+                                    tipform.startthread(oErrMessage, test_result);
                                     return;
                                 }
+                                tipform.startthread("序列号 " + sncode + "未通过检测", test_result);
                                 break;
                             default:
                                 break;
@@ -366,7 +375,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]))

+ 69 - 0
UAS_AutoPass/Form2.Designer.cs

@@ -0,0 +1,69 @@
+namespace UAS_AutoPass
+{
+    partial class Tip
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.label1 = new System.Windows.Forms.Label();
+            this.SuspendLayout();
+            // 
+            // label1
+            // 
+            this.label1.AutoSize = true;
+            this.label1.BackColor = System.Drawing.SystemColors.Menu;
+            this.label1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label1.ForeColor = System.Drawing.Color.Black;
+            this.label1.Location = new System.Drawing.Point(75, 18);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(0, 21);
+            this.label1.TabIndex = 0;
+            // 
+            // Tip
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.BackColor = System.Drawing.SystemColors.Menu;
+            this.ClientSize = new System.Drawing.Size(312, 59);
+            this.Controls.Add(this.label1);
+            this.ForeColor = System.Drawing.Color.White;
+            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
+            this.Name = "Tip";
+            this.Text = "Form2";
+            this.TopMost = true;
+            this.Load += new System.EventHandler(this.Form2_Load);
+            this.MouseEnter += new System.EventHandler(this.Form2_MouseEnter);
+            this.MouseLeave += new System.EventHandler(this.Form2_MouseLeave);
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.Label label1;
+    }
+}

+ 114 - 0
UAS_AutoPass/Form2.cs

@@ -0,0 +1,114 @@
+using System;
+using System.ComponentModel;
+using System.Threading;
+using System.Windows.Forms;
+
+namespace UAS_AutoPass
+{
+    public partial class Tip : Form
+    {
+        int state;
+
+        private DoWorkEventArgs e;
+
+        public Tip()
+        {
+            InitializeComponent();
+        }
+        private void Form2_Load(object sender, EventArgs e)
+        {
+            this.ShowInTaskbar = false;
+            this.Left = Screen.PrimaryScreen.WorkingArea.Width - this.Width;
+            this.Top = this.Height;
+            state = 0;
+            label1.Text = DateTime.Now.ToString();
+        }
+
+        public void startthread(string filename,string type)
+        {
+            label1.Text = filename;
+            if(type  == "OK")
+            label1.ForeColor = System.Drawing.Color.Green;
+            if(type == "NG")
+            label1.ForeColor = System.Drawing.Color.Red;
+                  
+            //thread.Start();
+            using (BackgroundWorker bw = new BackgroundWorker())
+            {
+                bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted);
+                bw.DoWork += new DoWorkEventHandler(bw_DoWork);
+                bw.RunWorkerAsync("Tank");
+            }
+        }
+
+        private void bw_DoWork(object sender, DoWorkEventArgs e)
+        {
+
+        }
+        private void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
+        {
+            aa();
+            Thread.Sleep(1000);
+            bb();
+        }
+        public void aa()
+        {
+            if (state == 0)
+            {
+                state = 1;
+                int t = this.Left;
+                for (int i = t; i >= Screen.PrimaryScreen.WorkingArea.Width - this.Width; i--)
+                {
+                    this.Left = i;
+                    Application.DoEvents();
+                }
+                state = 0;
+            }
+        }
+
+        public void bb()
+        {
+            if (this.Left <= Screen.PrimaryScreen.WorkingArea.Width - 10 && state == 0)
+            {
+                state = 1;
+                int t = this.Left;
+                for (int i = t; i < Screen.PrimaryScreen.WorkingArea.Width - 10; i++)
+                {
+                    this.Left = i;
+                    Application.DoEvents();
+                }
+                state = 0;
+            }
+        }
+
+        private void Form2_MouseEnter(object sender, EventArgs e)
+        {
+            if (state == 0)
+            {
+                state = 1;
+                int t = this.Left;
+                for (int i = t; i >= Screen.PrimaryScreen.WorkingArea.Width - this.Width; i=i-2)
+                {
+                    this.Left = i;
+                    Application.DoEvents();
+                }
+                state = 0;
+            }
+        }
+
+        private void Form2_MouseLeave(object sender, EventArgs e)
+        {
+            if (this.Left <= Screen.PrimaryScreen.WorkingArea.Width - 10 && state == 0)
+            {
+                state = 1;
+                int t = this.Left;
+                for (int i = t; i < Screen.PrimaryScreen.WorkingArea.Width - 10; i=i+2)
+                {
+                    this.Left = i;
+                    Application.DoEvents();
+                }
+                state = 0;
+            }
+        }
+    }
+}

+ 120 - 0
UAS_AutoPass/Form2.resx

@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>