Browse Source

添加站位剩余物料提醒

callm 2 weeks ago
parent
commit
46782ce3e2

+ 280 - 0
FileWatcher/AutoSMTRXY.Designer.cs

@@ -0,0 +1,280 @@
+namespace FileWatcher
+{
+    partial class AutoSMTRXY
+    {
+        /// <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.OperateResult = new System.Windows.Forms.RichTextBox();
+            this.Clean = new System.Windows.Forms.Button();
+            this.MakeCode_lable = new System.Windows.Forms.Label();
+            this.Type = new System.Windows.Forms.ComboBox();
+            this.label1 = new System.Windows.Forms.Label();
+            this.AutoStart = new System.Windows.Forms.CheckBox();
+            this.NowQTY = new System.Windows.Forms.TextBox();
+            this.label4 = new System.Windows.Forms.Label();
+            this.li_code = new FileWatcher.SearchTextBox();
+            this.label5 = new System.Windows.Forms.Label();
+            this.ma_code = new FileWatcher.SearchTextBox();
+            this.label6 = new System.Windows.Forms.Label();
+            this.pr_pcbacount = new System.Windows.Forms.NumericUpDown();
+            this.ms_sncode = new FileWatcher.EnterTextBox();
+            this.label2 = new System.Windows.Forms.Label();
+            ((System.ComponentModel.ISupportInitialize)(this.pr_pcbacount)).BeginInit();
+            this.SuspendLayout();
+            // 
+            // OperateResult
+            // 
+            this.OperateResult.Location = new System.Drawing.Point(892, 22);
+            this.OperateResult.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+            this.OperateResult.Name = "OperateResult";
+            this.OperateResult.Size = new System.Drawing.Size(517, 535);
+            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(1096, 580);
+            this.Clean.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+            this.Clean.Name = "Clean";
+            this.Clean.Size = new System.Drawing.Size(112, 48);
+            this.Clean.TabIndex = 8;
+            this.Clean.Text = "清除";
+            this.Clean.UseVisualStyleBackColor = true;
+            this.Clean.Click += new System.EventHandler(this.Clean_Click);
+            // 
+            // MakeCode_lable
+            // 
+            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(51, 60);
+            this.MakeCode_lable.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.MakeCode_lable.Name = "MakeCode_lable";
+            this.MakeCode_lable.Size = new System.Drawing.Size(104, 38);
+            this.MakeCode_lable.TabIndex = 12;
+            this.MakeCode_lable.Text = "工单号";
+            // 
+            // Type
+            // 
+            this.Type.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+            this.Type.FormattingEnabled = true;
+            this.Type.Items.AddRange(new object[] {
+            "投入",
+            "产出"});
+            this.Type.Location = new System.Drawing.Point(221, 207);
+            this.Type.Name = "Type";
+            this.Type.Size = new System.Drawing.Size(436, 32);
+            this.Type.TabIndex = 18;
+            // 
+            // label1
+            // 
+            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(51, 201);
+            this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(75, 38);
+            this.label1.TabIndex = 19;
+            this.label1.Text = "类型";
+            // 
+            // AutoStart
+            // 
+            this.AutoStart.AutoSize = true;
+            this.AutoStart.Checked = true;
+            this.AutoStart.CheckState = System.Windows.Forms.CheckState.Checked;
+            this.AutoStart.Location = new System.Drawing.Point(695, 67);
+            this.AutoStart.Name = "AutoStart";
+            this.AutoStart.Size = new System.Drawing.Size(186, 28);
+            this.AutoStart.TabIndex = 20;
+            this.AutoStart.Text = "开机自动启动";
+            this.AutoStart.UseVisualStyleBackColor = true;
+            // 
+            // NowQTY
+            // 
+            this.NowQTY.Location = new System.Drawing.Point(221, 360);
+            this.NowQTY.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+            this.NowQTY.Name = "NowQTY";
+            this.NowQTY.Size = new System.Drawing.Size(146, 35);
+            this.NowQTY.TabIndex = 26;
+            // 
+            // label4
+            // 
+            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(51, 357);
+            this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label4.Name = "label4";
+            this.label4.Size = new System.Drawing.Size(133, 38);
+            this.label4.TabIndex = 25;
+            this.label4.Text = "当前计数";
+            // 
+            // li_code
+            // 
+            this.li_code.AllPower = null;
+            this.li_code.Caller = null;
+            this.li_code.Condition = null;
+            this.li_code.DBTitle = null;
+            this.li_code.FormName = null;
+            this.li_code.Location = new System.Drawing.Point(221, 131);
+            this.li_code.Name = "li_code";
+            this.li_code.Power = null;
+            this.li_code.ReturnData = null;
+            this.li_code.SelectField = null;
+            this.li_code.SetValueField = null;
+            this.li_code.Size = new System.Drawing.Size(436, 41);
+            this.li_code.TabIndex = 28;
+            this.li_code.TableName = null;
+            this.li_code.TextBoxEnable = false;
+            // 
+            // label5
+            // 
+            this.label5.AutoSize = true;
+            this.label5.Font = new System.Drawing.Font("微软雅黑", 12F);
+            this.label5.Location = new System.Drawing.Point(51, 131);
+            this.label5.Name = "label5";
+            this.label5.Size = new System.Drawing.Size(82, 41);
+            this.label5.TabIndex = 27;
+            this.label5.Text = "线别";
+            // 
+            // ma_code
+            // 
+            this.ma_code.AllPower = null;
+            this.ma_code.Caller = null;
+            this.ma_code.Condition = null;
+            this.ma_code.DBTitle = null;
+            this.ma_code.FormName = null;
+            this.ma_code.Location = new System.Drawing.Point(221, 54);
+            this.ma_code.Name = "ma_code";
+            this.ma_code.Power = null;
+            this.ma_code.ReturnData = null;
+            this.ma_code.SelectField = null;
+            this.ma_code.SetValueField = null;
+            this.ma_code.Size = new System.Drawing.Size(436, 41);
+            this.ma_code.TabIndex = 29;
+            this.ma_code.TableName = null;
+            this.ma_code.TextBoxEnable = false;
+            // 
+            // label6
+            // 
+            this.label6.AutoSize = true;
+            this.label6.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label6.Location = new System.Drawing.Point(51, 277);
+            this.label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label6.Name = "label6";
+            this.label6.Size = new System.Drawing.Size(104, 38);
+            this.label6.TabIndex = 30;
+            this.label6.Text = "拼版数";
+            // 
+            // pr_pcbacount
+            // 
+            this.pr_pcbacount.Location = new System.Drawing.Point(221, 280);
+            this.pr_pcbacount.Name = "pr_pcbacount";
+            this.pr_pcbacount.Size = new System.Drawing.Size(120, 35);
+            this.pr_pcbacount.TabIndex = 32;
+            this.pr_pcbacount.Value = new decimal(new int[] {
+            1,
+            0,
+            0,
+            0});
+            // 
+            // ms_sncode
+            // 
+            this.ms_sncode.AllPower = null;
+            this.ms_sncode.BackColor = System.Drawing.Color.White;
+            this.ms_sncode.ID = null;
+            this.ms_sncode.Location = new System.Drawing.Point(221, 460);
+            this.ms_sncode.Name = "ms_sncode";
+            this.ms_sncode.Power = null;
+            this.ms_sncode.Size = new System.Drawing.Size(333, 35);
+            this.ms_sncode.Str = null;
+            this.ms_sncode.Str1 = null;
+            this.ms_sncode.Str2 = null;
+            this.ms_sncode.TabIndex = 33;
+            this.ms_sncode.KeyDown += new System.Windows.Forms.KeyEventHandler(this.ms_sncode_KeyDown);
+            // 
+            // 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(51, 454);
+            this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label2.Name = "label2";
+            this.label2.Size = new System.Drawing.Size(104, 38);
+            this.label2.TabIndex = 34;
+            this.label2.Text = "录入框";
+            // 
+            // AutoSMTRXY
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(1443, 640);
+            this.Controls.Add(this.label2);
+            this.Controls.Add(this.ms_sncode);
+            this.Controls.Add(this.pr_pcbacount);
+            this.Controls.Add(this.label6);
+            this.Controls.Add(this.ma_code);
+            this.Controls.Add(this.li_code);
+            this.Controls.Add(this.label5);
+            this.Controls.Add(this.NowQTY);
+            this.Controls.Add(this.label4);
+            this.Controls.Add(this.AutoStart);
+            this.Controls.Add(this.label1);
+            this.Controls.Add(this.Type);
+            this.Controls.Add(this.MakeCode_lable);
+            this.Controls.Add(this.Clean);
+            this.Controls.Add(this.OperateResult);
+            this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+            this.MaximizeBox = false;
+            this.Name = "AutoSMTRXY";
+            this.Text = "UAS设备数据解析 2023-06-29  10:05";
+            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
+            this.Load += new System.EventHandler(this.Form1_Load);
+            ((System.ComponentModel.ISupportInitialize)(this.pr_pcbacount)).EndInit();
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+        private System.Windows.Forms.RichTextBox OperateResult;
+        private System.Windows.Forms.Button Clean;
+        private System.Windows.Forms.Label MakeCode_lable;
+        private System.Windows.Forms.ComboBox Type;
+        private System.Windows.Forms.Label label1;
+        private System.Windows.Forms.CheckBox AutoStart;
+        private System.Windows.Forms.TextBox NowQTY;
+        private System.Windows.Forms.Label label4;
+        private SearchTextBox li_code;
+        private System.Windows.Forms.Label label5;
+        private SearchTextBox ma_code;
+        private System.Windows.Forms.Label label6;
+        private System.Windows.Forms.NumericUpDown pr_pcbacount;
+        private EnterTextBox ms_sncode;
+        private System.Windows.Forms.Label label2;
+    }
+}
+

+ 172 - 0
FileWatcher/AutoSMTRXY.cs

@@ -0,0 +1,172 @@
+using Microsoft.Win32;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.IO;
+using System.Threading;
+using System.Windows.Forms;
+using System.Text;
+using System.Net;
+using System.Net.Sockets;
+using System.IO.Ports;
+using System.Linq.Expressions;
+using System.Linq;
+
+namespace FileWatcher
+{
+    public partial class AutoSMTRXY : Form
+    {
+
+        DataHelper dh;
+
+        DataTable dt;
+
+        DataTable DB;
+
+        /// <summary>
+        /// 用户编号
+        /// </summary>
+        string iusercode;
+        /// <summary>
+        /// 岗位资源
+        /// </summary>
+        string isource;
+
+        Thread InitDB;
+        /// 当前工序
+        /// </summary>
+        string istepcode;
+        StringBuilder sql = new StringBuilder();
+        /// <summary>
+        /// 缓存的文件
+        /// </summary>
+        public static string CachePath = Environment.GetEnvironmentVariable("windir").Substring(0, 1) + @":/UAS_MES/XmlAnalysor/Cache.xml";
+        /// <summary>
+        /// 缓存的文件夹
+        /// </summary>
+        public static string CachePathFolder = Environment.GetEnvironmentVariable("windir").Substring(0, 1) + @":/UAS_MES/XmlAnalysor/";
+
+        ftpOperater ftp = new ftpOperater();
+
+        public AutoSMTRXY()
+        {
+            InitializeComponent();
+            StartPosition = FormStartPosition.CenterScreen;
+        }
+        DataTable Dbfind;
+
+        string IPAddress = "";
+        private void nr_rule_DBChange(object sender, EventArgs e)
+        {
+            Dbfind = li_code.ReturnData;
+            BaseUtil.SetFormValue(this.Controls, Dbfind);
+        }
+
+
+        private void Form1_Load(object sender, EventArgs e)
+        {
+            CheckForIllegalCrossThreadCalls = false;
+            FormBorderStyle = FormBorderStyle.FixedSingle;
+            InitDB = new Thread(ConnectDB);
+            //添加监控事件
+            SetLoadingWindow stw = new SetLoadingWindow(InitDB, "正在启动程序");
+            stw.StartPosition = FormStartPosition.CenterScreen;
+            stw.ShowDialog();
+            List<string> CacheInf = new List<string>();
+            IPHostEntry IpEntry = Dns.GetHostEntry(Dns.GetHostName());
+            for (int i = 0; i < IpEntry.AddressList.Length; i++)
+            {
+                if (IpEntry.AddressList[i].AddressFamily == AddressFamily.InterNetwork)
+                    IPAddress = IpEntry.AddressList[i].ToString();
+            }
+            //获取缓存信息
+            try
+            {
+                Type.Text = BaseUtil.GetCacheData("Type").ToString();
+                li_code.Text = BaseUtil.GetCacheData("Line").ToString();
+            }
+            catch (Exception ex) { MessageBox.Show(ex.Message); }
+        }
+
+        private void ConnectDB()
+        {
+            dh = new DataHelper();
+            SystemInf.dh = dh;
+
+            ma_code.TableName = "make";
+            ma_code.SelectField = "ma_code # 工单号";
+            ma_code.FormName = Name;
+            ma_code.DBTitle = "工单查询";
+            ma_code.SetValueField = new string[] { "ma_code" };
+            ma_code.Condition = "";
+            ma_code.DbChange += nr_rule_DBChange;
+
+            li_code.TableName = "line";
+            li_code.SelectField = "li_code # 线别编号,li_name # 线别名称";
+            li_code.FormName = Name;
+            li_code.DBTitle = "线别查询";
+            li_code.SetValueField = new string[] { "li_code" };
+            li_code.Condition = "";
+            li_code.DbChange += nr_rule_DBChange;
+        }
+        SerialPort serialPort1 = new SerialPort();
+
+        string nextLine;
+
+
+        private void Clean_Click(object sender, EventArgs e)
+        {
+            OperateResult.Clear();
+        }
+
+        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
+        {
+            string ExitConfirm = MessageBox.Show(this, "确认退出?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
+            if (ExitConfirm != "Yes")
+            {
+                WindowState = FormWindowState.Minimized;
+                e.Cancel = true;
+            }
+        }
+
+        private void AutoStart_CheckedChanged(object sender, EventArgs e)
+        {
+            SetAutoRun();
+        }
+
+
+
+        private void SetAutoRun()
+        {
+            if (AutoStart.Checked) //设置开机自启动  
+            {
+                string path = Application.ExecutablePath;
+                RegistryKey rk = Registry.LocalMachine;
+                RegistryKey rk2 = rk.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run");
+                rk2.SetValue("FileWatcher.exe", path);
+                rk2.Close();
+                rk.Close();
+            }
+            else //取消开机自启动  
+            {
+                string path = Application.ExecutablePath;
+                RegistryKey rk = Registry.LocalMachine;
+                RegistryKey rk2 = rk.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run");
+                rk2.DeleteValue("FileWatcher.exe", false);
+                rk2.Close();
+                rk.Close();
+            }
+        }
+
+        private void ms_sncode_KeyDown(object sender, KeyEventArgs e)
+        {
+            if (e.KeyCode == Keys.Enter)
+            {
+                BaseUtil.PlaySound("站位SMT240011-1-6 当前物料数量剩余100");
+                BaseUtil.PlaySound("站位SMT240011-2-5 当前物料数量剩余200");
+                BaseUtil.PlaySound("站位SMT240011-3-3 当前物料数量剩余160");
+                BaseUtil.PlaySound("站位SMT240011-5-6 当前物料数量剩余180");
+            }
+        }
+    }
+}

+ 120 - 0
FileWatcher/AutoSMTRXY.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>

+ 8 - 15
FileWatcher/BaseUtil.cs

@@ -1,4 +1,5 @@
-using System;
+using SpeechLib;
+using System;
 using System.Collections.Generic;
 using System.Data;
 using System.IO;
@@ -37,6 +38,12 @@ namespace FileWatcher
         }
 
 
+        public static void PlaySound(string FileName)
+        {
+            SpVoice voice = new SpVoice();
+            voice.Speak(FileName, SpeechVoiceSpeakFlags.SVSFDefault);
+        }
+
         public static void SetFormValue(ControlCollection collection, DataTable dt)
         {
             List<Control> ctl = new List<Control>();
@@ -508,20 +515,6 @@ namespace FileWatcher
         }
 
         //播放音频文件
-        public static void PlaySound(string FileName)
-        {
-            //要加载COM组件:Microsoft speech object Library    
-            if (!System.IO.File.Exists(FileName))
-            {
-                return;
-            }
-            //SpeechLib.SpVoiceClass pp = new SpeechLib.SpVoiceClass();
-            //SpeechLib.SpFileStreamClass spFs = new SpeechLib.SpFileStreamClass();
-            //spFs.Open(FileName, SpeechLib.SpeechStreamFileMode.SSFMOpenForRead, true);
-            //SpeechLib.ISpeechBaseStream Istream = spFs as SpeechLib.ISpeechBaseStream;
-            //pp.SpeakStream(Istream, SpeechLib.SpeechVoiceSpeakFlags.SVSFIsFilename);
-            //spFs.Close();
-        }
 
         public static void GetWriteInfo(string FilePath, out Dictionary<string, string> Dic)
         {

+ 8 - 8
FileWatcher/DataHelper.cs

@@ -20,10 +20,10 @@ namespace FileWatcher
         //public static string DBConnectionString = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=N_MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.10.6.28)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
 
 
-        ////HG
-        //private string ConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=HUAG;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=113.98.196.181)(PORT=1520)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
-        ////用户选择的数据库的连接字符串
-        //public static string DBConnectionString = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=HUAG;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=113.98.196.181)(PORT=1520)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+        //RXY
+        private string ConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=HUAG;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.6.253)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+        //用户选择的数据库的连接字符串
+        public static string DBConnectionString = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=HUAG;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.6.253)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
 
 
         ////HY
@@ -36,10 +36,10 @@ namespace FileWatcher
         ////用户选择的数据库的连接字符串
         //public static string DBConnectionString = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=N_MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.3.7)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
 
-        ////ZZ
-        private string ConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=N_MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=172.22.100.2)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
-        //用户选择的数据库的连接字符串
-        public static string DBConnectionString = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=N_MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=172.22.100.2)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+        //////ZZ
+        //private string ConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=N_MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=172.22.100.2)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+        ////用户选择的数据库的连接字符串
+        //public static string DBConnectionString = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=N_MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=172.22.100.2)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
 
         //private string ConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=N_MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=39.165.240.186)(PORT=61521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
         ////用户选择的数据库的连接字符串

+ 13 - 0
FileWatcher/FileWatcher.csproj

@@ -65,6 +65,10 @@
     <Reference Include="ExcelNumberFormat, Version=1.1.0.0, Culture=neutral, PublicKeyToken=23c6f5d73be07eca, processorArchitecture=MSIL">
       <HintPath>..\packages\ExcelNumberFormat.1.1.0\lib\net20\ExcelNumberFormat.dll</HintPath>
     </Reference>
+    <Reference Include="Interop.SpeechLib">
+      <HintPath>..\UAS_MES_XCX\Tool\Interop.SpeechLib.dll</HintPath>
+      <EmbedInteropTypes>True</EmbedInteropTypes>
+    </Reference>
     <Reference Include="Microsoft.Bcl.HashCode, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
       <HintPath>..\packages\Microsoft.Bcl.HashCode.1.1.1\lib\net461\Microsoft.Bcl.HashCode.dll</HintPath>
     </Reference>
@@ -144,6 +148,12 @@
     <Compile Include="AutoAnalysisDeviceKS.Designer.cs">
       <DependentUpon>AutoAnalysisDeviceKS.cs</DependentUpon>
     </Compile>
+    <Compile Include="AutoSMTRXY.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="AutoSMTRXY.Designer.cs">
+      <DependentUpon>AutoSMTRXY.cs</DependentUpon>
+    </Compile>
     <Compile Include="SOP_PNE.cs">
       <SubType>Form</SubType>
     </Compile>
@@ -317,6 +327,9 @@
     <EmbeddedResource Include="AutoAnalysisDeviceKS.resx">
       <DependentUpon>AutoAnalysisDeviceKS.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="AutoSMTRXY.resx">
+      <DependentUpon>AutoSMTRXY.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="SOP_PNE.resx">
       <DependentUpon>SOP_PNE.cs</DependentUpon>
     </EmbeddedResource>

+ 2 - 2
FileWatcher/Program.cs

@@ -47,8 +47,8 @@ namespace FileWatcher
                 if (principal.IsInRole(WindowsBuiltInRole.Administrator))
                 {
                     //Application.Run(new UploadMakePlan());
-                    Application.Run(new AutoAnalysisXmlByStep());
-                    //Application.Run(new AutoMakeQTY());
+                    //Application.Run(new AutoAnalysisXmlByStep());
+                    Application.Run(new AutoSMTRXY());
                 }
                 else
                 {