Browse Source

自动过站程序初始化

章政 8 years ago
parent
commit
a01ca2047c

+ 6 - 0
UAS_AutoPast/App.config

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+    <startup> 
+        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
+    </startup>
+</configuration>

+ 166 - 0
UAS_AutoPast/Form1.Designer.cs

@@ -0,0 +1,166 @@
+namespace UAS_AutoPast
+{
+    partial class Form1
+    {
+        /// <summary>
+        /// 必需的设计器变量。
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// 清理所有正在使用的资源。
+        /// </summary>
+        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows 窗体设计器生成的代码
+
+        /// <summary>
+        /// 设计器支持所需的方法 - 不要修改
+        /// 使用代码编辑器修改此方法的内容。
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.components = new System.ComponentModel.Container();
+            this.CollectNum = new System.Windows.Forms.NumericUpDown();
+            this.CollectNum_label = new System.Windows.Forms.Label();
+            this.label1 = new System.Windows.Forms.Label();
+            this.CollectData = new System.Windows.Forms.TextBox();
+            this.Start = new System.Windows.Forms.Button();
+            this.Stop = new System.Windows.Forms.Button();
+            this.AutoPastTimer = new System.Windows.Forms.Timer(this.components);
+            this.CollectTime_label = new System.Windows.Forms.Label();
+            this.CollectTime = new System.Windows.Forms.NumericUpDown();
+            this.Status_label = new System.Windows.Forms.Label();
+            ((System.ComponentModel.ISupportInitialize)(this.CollectNum)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.CollectTime)).BeginInit();
+            this.SuspendLayout();
+            // 
+            // CollectNum
+            // 
+            this.CollectNum.Location = new System.Drawing.Point(206, 55);
+            this.CollectNum.Name = "CollectNum";
+            this.CollectNum.Size = new System.Drawing.Size(163, 25);
+            this.CollectNum.TabIndex = 0;
+            // 
+            // CollectNum_label
+            // 
+            this.CollectNum_label.AutoSize = true;
+            this.CollectNum_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.CollectNum_label.Location = new System.Drawing.Point(98, 54);
+            this.CollectNum_label.Name = "CollectNum_label";
+            this.CollectNum_label.Size = new System.Drawing.Size(92, 27);
+            this.CollectNum_label.TabIndex = 1;
+            this.CollectNum_label.Text = "采集板数";
+            // 
+            // 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(98, 139);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(92, 27);
+            this.label1.TabIndex = 2;
+            this.label1.Text = "采集数据";
+            // 
+            // CollectData
+            // 
+            this.CollectData.Location = new System.Drawing.Point(206, 141);
+            this.CollectData.Name = "CollectData";
+            this.CollectData.Size = new System.Drawing.Size(163, 25);
+            this.CollectData.TabIndex = 3;
+            this.CollectData.KeyDown += new System.Windows.Forms.KeyEventHandler(this.CollectData_KeyDown);
+            // 
+            // Start
+            // 
+            this.Start.Location = new System.Drawing.Point(148, 215);
+            this.Start.Name = "Start";
+            this.Start.Size = new System.Drawing.Size(75, 37);
+            this.Start.TabIndex = 4;
+            this.Start.Text = "开始";
+            this.Start.UseVisualStyleBackColor = true;
+            this.Start.Click += new System.EventHandler(this.Start_Click);
+            // 
+            // Stop
+            // 
+            this.Stop.Location = new System.Drawing.Point(265, 215);
+            this.Stop.Name = "Stop";
+            this.Stop.Size = new System.Drawing.Size(75, 37);
+            this.Stop.TabIndex = 5;
+            this.Stop.Text = "结束";
+            this.Stop.UseVisualStyleBackColor = true;
+            this.Stop.Click += new System.EventHandler(this.Stop_Click);
+            // 
+            // CollectTime_label
+            // 
+            this.CollectTime_label.AutoSize = true;
+            this.CollectTime_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.CollectTime_label.Location = new System.Drawing.Point(98, 98);
+            this.CollectTime_label.Name = "CollectTime_label";
+            this.CollectTime_label.Size = new System.Drawing.Size(92, 27);
+            this.CollectTime_label.TabIndex = 6;
+            this.CollectTime_label.Text = "采集时长";
+            // 
+            // CollectTime
+            // 
+            this.CollectTime.Location = new System.Drawing.Point(206, 98);
+            this.CollectTime.Name = "CollectTime";
+            this.CollectTime.Size = new System.Drawing.Size(163, 25);
+            this.CollectTime.TabIndex = 7;
+            // 
+            // Status_label
+            // 
+            this.Status_label.AutoSize = true;
+            this.Status_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.Status_label.Location = new System.Drawing.Point(11, 10);
+            this.Status_label.Name = "Status_label";
+            this.Status_label.Size = new System.Drawing.Size(72, 27);
+            this.Status_label.TabIndex = 8;
+            this.Status_label.Text = "未开始";
+            // 
+            // Form1
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(468, 302);
+            this.Controls.Add(this.Status_label);
+            this.Controls.Add(this.CollectTime);
+            this.Controls.Add(this.CollectTime_label);
+            this.Controls.Add(this.Stop);
+            this.Controls.Add(this.Start);
+            this.Controls.Add(this.CollectData);
+            this.Controls.Add(this.label1);
+            this.Controls.Add(this.CollectNum_label);
+            this.Controls.Add(this.CollectNum);
+            this.Name = "Form1";
+            this.Text = "Form1";
+            this.Load += new System.EventHandler(this.Form1_Load);
+            ((System.ComponentModel.ISupportInitialize)(this.CollectNum)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.CollectTime)).EndInit();
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.NumericUpDown CollectNum;
+        private System.Windows.Forms.Label CollectNum_label;
+        private System.Windows.Forms.Label label1;
+        private System.Windows.Forms.TextBox CollectData;
+        private System.Windows.Forms.Button Start;
+        private System.Windows.Forms.Button Stop;
+        private System.Windows.Forms.Timer AutoPastTimer;
+        private System.Windows.Forms.Label CollectTime_label;
+        private System.Windows.Forms.NumericUpDown CollectTime;
+        private System.Windows.Forms.Label Status_label;
+    }
+}
+

+ 76 - 0
UAS_AutoPast/Form1.cs

@@ -0,0 +1,76 @@
+using System;
+using System.Windows.Forms;
+using BenQGuru.eMES.DLLService;
+using System.Collections.Generic;
+
+namespace UAS_AutoPast
+{
+    public partial class Form1 : Form
+    {
+        MESHelper helper;
+
+        DataHelper dh;
+
+        List<string> Data = new List<string>();
+        //Queue<string> que = new Queue<string>();
+        /// <summary>
+        /// 一次采集运行的时间
+        /// </summary>
+        int SecondCount = 0;
+        /// <summary>
+        /// 设置是否开始采集
+        /// </summary>
+        bool StartCount = false;
+
+        public Form1()
+        {
+            InitializeComponent();
+        }
+
+        private void Form1_Load(object sender, EventArgs e)
+        {
+            //dh = new DataHelper();
+            helper = new MESHelper();
+            AutoPastTimer.Interval = 1000;
+            AutoPastTimer.Tick += AutoPastTimer_Tick;
+        }
+
+        private void AutoPastTimer_Tick(object sender, EventArgs e)
+        {
+            //从采集到第一个数据开始计算秒数
+            if (StartCount)
+            {
+                SecondCount = SecondCount + 1;
+            }
+        }
+
+        private void CollectData_KeyDown(object sender, KeyEventArgs e)
+        {
+            if (e.KeyCode == Keys.Enter)
+            {
+                //设置开始计时本次采集
+                if (Data.Count == 0)
+                {
+                    StartCount = true;
+                }
+                if (Data.Count < CollectNum.Value)
+                {
+                    if (CollectData.Text != "")
+                        Data.Add(CollectData.Text);
+                }
+            }
+        }
+
+        private void Start_Click(object sender, EventArgs e)
+        {
+            AutoPastTimer.Start();
+            Status_label.Text = "运行中";
+        }
+
+        private void Stop_Click(object sender, EventArgs e)
+        {
+            AutoPastTimer.Stop();
+            Status_label.Text = "未开始";
+        }
+    }
+}

+ 22 - 0
UAS_AutoPast/Program.cs

@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace UAS_AutoPast
+{
+    static class Program
+    {
+        /// <summary>
+        /// 应用程序的主入口点。
+        /// </summary>
+        [STAThread]
+        static void Main()
+        {
+            Application.EnableVisualStyles();
+            Application.SetCompatibleTextRenderingDefault(false);
+            Application.Run(new Form1());
+        }
+    }
+}

+ 36 - 0
UAS_AutoPast/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 有关程序集的一般信息由以下
+// 控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("UAS_AutoPast")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("UAS_AutoPast")]
+[assembly: AssemblyCopyright("Copyright ©  2017")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+//将 ComVisible 设置为 false 将使此程序集中的类型
+//对 COM 组件不可见。  如果需要从 COM 访问此程序集中的类型,
+//请将此类型的 ComVisible 特性设置为 true。
+[assembly: ComVisible(false)]
+
+// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
+[assembly: Guid("00071ca1-0410-4e55-bc92-2ff6b160c3ac")]
+
+// 程序集的版本信息由下列四个值组成: 
+//
+//      主版本
+//      次版本
+//      生成号
+//      修订号
+//
+//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
+// 方法是按如下所示使用“*”: :
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 71 - 0
UAS_AutoPast/Properties/Resources.Designer.cs

@@ -0,0 +1,71 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     此代码由工具生成。
+//     运行时版本: 4.0.30319.42000
+//
+//     对此文件的更改可能导致不正确的行为,如果
+//     重新生成代码,则所做更改将丢失。
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace UAS_AutoPast.Properties
+{
+
+
+    /// <summary>
+    ///   强类型资源类,用于查找本地化字符串等。
+    /// </summary>
+    // 此类是由 StronglyTypedResourceBuilder
+    // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
+    // 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
+    // (以 /str 作为命令选项),或重新生成 VS 项目。
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    internal class Resources
+    {
+
+        private static global::System.Resources.ResourceManager resourceMan;
+
+        private static global::System.Globalization.CultureInfo resourceCulture;
+
+        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+        internal Resources()
+        {
+        }
+
+        /// <summary>
+        ///   返回此类使用的缓存 ResourceManager 实例。
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Resources.ResourceManager ResourceManager
+        {
+            get
+            {
+                if ((resourceMan == null))
+                {
+                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("UAS_AutoPast.Properties.Resources", typeof(Resources).Assembly);
+                    resourceMan = temp;
+                }
+                return resourceMan;
+            }
+        }
+
+        /// <summary>
+        ///   覆盖当前线程的 CurrentUICulture 属性
+        ///   使用此强类型的资源类的资源查找。
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Globalization.CultureInfo Culture
+        {
+            get
+            {
+                return resourceCulture;
+            }
+            set
+            {
+                resourceCulture = value;
+            }
+        }
+    }
+}

+ 117 - 0
UAS_AutoPast/Properties/Resources.resx

@@ -0,0 +1,117 @@
+<?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.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: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" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+            </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" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+            </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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>

+ 30 - 0
UAS_AutoPast/Properties/Settings.Designer.cs

@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//     Runtime Version:4.0.30319.42000
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace UAS_AutoPast.Properties
+{
+
+
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
+    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+    {
+
+        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+        public static Settings Default
+        {
+            get
+            {
+                return defaultInstance;
+            }
+        }
+    }
+}

+ 7 - 0
UAS_AutoPast/Properties/Settings.settings

@@ -0,0 +1,7 @@
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
+  <Profiles>
+    <Profile Name="(Default)" />
+  </Profiles>
+  <Settings />
+</SettingsFile>