callm 1 месяц назад
Родитель
Сommit
a440286b8a

+ 5 - 5
FileWatcher/AutoAnalysisDevice.cs

@@ -462,7 +462,7 @@ namespace FileWatcher
 
                 string boundary = DateTime.Now.Ticks.ToString("x");
 
-                byte[] boundarybytes = System.Text.Encoding.UTF8.GetBytes("--" + boundary + "\r\n");
+                byte[] boundarybytes = System.Text.Encoding.UTF8.GetBytes("--" + boundary + "");
 
                 HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url1);
                 request.Method = "POST";
@@ -471,9 +471,9 @@ namespace FileWatcher
 
                 Stream rs = request.GetRequestStream();
 
-                var endBoundaryBytes = Encoding.UTF8.GetBytes("--" + boundary + "--\r\n");
+                var endBoundaryBytes = Encoding.UTF8.GetBytes("--" + boundary + "--");
 
-                string formdataTemplate = "Content-Disposition: form-data; name=\"{0}\"\r\n" + "\r\n" + "{1}" + "\r\n";
+                string formdataTemplate = "Content-Disposition: form-data; name=\"{0}\"" + "" + "{1}" + "";
                 if (dic != null)
                 {
                     foreach (string key in dic.Keys)
@@ -489,7 +489,7 @@ namespace FileWatcher
 
                 }
 
-                string headerTemplate = "Content-Disposition: form-data; name=\"{0}\"; filename=\"{1}\"\r\n\r\n";
+                string headerTemplate = "Content-Disposition: form-data; name=\"{0}\"; filename=\"{1}\"";
                 {
                     rs.Write(boundarybytes, 0, boundarybytes.Length);
 
@@ -510,7 +510,7 @@ namespace FileWatcher
                             rs.Write(buffer, 0, bytesRead);
                         }
                     }
-                    var cr = Encoding.UTF8.GetBytes("\r\n");
+                    var cr = Encoding.UTF8.GetBytes("");
 
                     rs.Write(cr, 0, cr.Length);
                 }

+ 68 - 76
FileWatcher/AutoSMTRXY.Designer.cs

@@ -28,6 +28,7 @@
         /// </summary>
         private void InitializeComponent()
         {
+            this.components = new System.ComponentModel.Container();
             this.OperateResult = new System.Windows.Forms.RichTextBox();
             this.Clean = new System.Windows.Forms.Button();
             this.MakeCode_lable = new System.Windows.Forms.Label();
@@ -36,14 +37,13 @@
             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.RemindTimer = new System.Windows.Forms.Timer(this.components);
+            this.ms_sncode = new FileWatcher.EnterTextBox();
+            this.ma_code = new FileWatcher.SearchTextBox();
+            this.li_code = new FileWatcher.SearchTextBox();
+            this.RemindVoice = new System.Windows.Forms.CheckBox();
             this.SuspendLayout();
             // 
             // OperateResult
@@ -115,7 +115,7 @@
             // 
             // NowQTY
             // 
-            this.NowQTY.Location = new System.Drawing.Point(221, 360);
+            this.NowQTY.Location = new System.Drawing.Point(221, 286);
             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);
@@ -125,31 +125,13 @@
             // 
             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.Location = new System.Drawing.Point(51, 283);
             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;
@@ -160,6 +142,37 @@
             this.label5.TabIndex = 27;
             this.label5.Text = "线别";
             // 
+            // 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, 364);
+            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 = "录入框";
+            // 
+            // RemindTimer
+            // 
+            this.RemindTimer.Interval = 5000;
+            this.RemindTimer.Tick += new System.EventHandler(this.RemindTimer_Tick);
+            // 
+            // 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, 370);
+            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);
+            // 
             // ma_code
             // 
             this.ma_code.AllPower = null;
@@ -178,64 +191,44 @@
             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
+            // li_code
             // 
-            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);
+            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;
             // 
-            // label2
+            // RemindVoice
             // 
-            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 = "录入框";
+            this.RemindVoice.AutoSize = true;
+            this.RemindVoice.Checked = true;
+            this.RemindVoice.CheckState = System.Windows.Forms.CheckState.Checked;
+            this.RemindVoice.Location = new System.Drawing.Point(695, 131);
+            this.RemindVoice.Name = "RemindVoice";
+            this.RemindVoice.Size = new System.Drawing.Size(162, 28);
+            this.RemindVoice.TabIndex = 35;
+            this.RemindVoice.Text = "开启提示音";
+            this.RemindVoice.UseVisualStyleBackColor = true;
             // 
             // 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.RemindVoice);
             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);
@@ -253,7 +246,6 @@
             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();
 
@@ -271,10 +263,10 @@
         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;
+        private System.Windows.Forms.Timer RemindTimer;
+        private System.Windows.Forms.CheckBox RemindVoice;
     }
 }
 

+ 33 - 1
FileWatcher/AutoSMTRXY.cs

@@ -86,6 +86,7 @@ namespace FileWatcher
                 li_code.Text = BaseUtil.GetCacheData("Line").ToString();
             }
             catch (Exception ex) { MessageBox.Show(ex.Message); }
+            RemindTimer.Start();
         }
 
         private void ConnectDB()
@@ -134,7 +135,33 @@ namespace FileWatcher
             SetAutoRun();
         }
 
-
+        //音频提示站位,料号,剩余数量信息
+        private void Remind()
+        {
+            if (RemindVoice.Checked)
+            {
+                sql.Clear();
+                sql.Append("SELECT 总需求数,余数,站位,料号 from(select bar_batchqty,dsl_barcode,dsl_prodcode 料号, " +
+                    "dsl_location  站位,dsl_baseqty 用量,(select sum(case when dsl_getqty=0 then 1 else dsl_getqty end)" +
+                    " from devsmtlocation T  where  T.dsl_location=devsmtlocation.dsl_location    and dsl_invalidtime is null) " +
+                    "上料数, (select max(to_char(dsl_indate ,'MM-DD hh24:mi:ss'))  from devsmtlocation  T  where " +
+                    "T.dsl_location=devsmtlocation.dsl_location  and  dsl_usable>0)接料时间,dsl_madeqty  料卷产出数, allmadeqty " +
+                    " 站位产出数,DSL_VALIDTIME, dsl_remainqty,(select sum(dsl_remainqty)from devsmtlocation T  where  " +
+                    "T.dsl_location=devsmtlocation.dsl_location    and dsl_invalidtime is null)余数,dsl_needqty 总需求数 " +
+                    " from devsmtlocation left  join    (select DSL_LINECODE alllincode,Dsl_Location allLocation, " +
+                    " sum(dsl_madeqty)allmadeqty from devsmtlocation    group by  DSL_LINECODE,Dsl_Location)A on  " +
+                    " alllincode=devsmtlocation.dsl_linecode and allLocation=dsl_location left join barcode  " +
+                    " on dsl_barcode = bar_code where  dsl_status=0 and dsl_usable=1)  ");
+                DataTable dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
+                for (int i = 0; i < dt.Rows.Count; i++)
+                {
+                    string 站位 = dt.Rows[i]["站位"].ToString();
+                    string 余数 = dt.Rows[i]["余数"].ToString();
+                    string 料号 = dt.Rows[i]["料号"].ToString();
+                    BaseUtil.PlaySound("站位" + 站位 + "物料" + 料号 + "数量剩余" + 余数 + "请及时接料");
+                }
+            }
+        }
 
         private void SetAutoRun()
         {
@@ -168,5 +195,10 @@ namespace FileWatcher
                 BaseUtil.PlaySound("站位SMT240011-5-6 当前物料数量剩余180");
             }
         }
+
+        private void RemindTimer_Tick(object sender, EventArgs e)
+        {
+            Remind();
+        }
     }
 }

+ 3 - 0
FileWatcher/AutoSMTRXY.resx

@@ -117,4 +117,7 @@
   <resheader name="writer">
     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
+  <metadata name="RemindTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>17, 17</value>
+  </metadata>
 </root>

+ 2 - 2
FileWatcher/BaseUtil.cs

@@ -41,7 +41,7 @@ namespace FileWatcher
         public static void PlaySound(string FileName)
         {
             SpVoice voice = new SpVoice();
-            voice.Speak(FileName, SpeechVoiceSpeakFlags.SVSFDefault);
+            voice.Speak(FileName, SpeechVoiceSpeakFlags.SVSFlagsAsync);
         }
 
         public static void SetFormValue(ControlCollection collection, DataTable dt)
@@ -341,7 +341,7 @@ namespace FileWatcher
                 }
             }
             catch (Exception e)
-            {   
+            {
                 Console.WriteLine(e.Message + e.StackTrace);
             }
             return "";

+ 2 - 2
FileWatcher/DataHelper.cs

@@ -21,9 +21,9 @@ namespace FileWatcher
 
 
         //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)));";
+        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=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)));";
+        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.6.253)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
 
 
         ////HY