callm 1 giorno fa
parent
commit
fa3ae03375

+ 12 - 14
FileWatcher/AutoSMTRXY.Designer.cs

@@ -59,17 +59,17 @@
             // 
             // 
             // OperateResult
             // OperateResult
             // 
             // 
-            this.OperateResult.Location = new System.Drawing.Point(900, 23);
+            this.OperateResult.Location = new System.Drawing.Point(700, 23);
             this.OperateResult.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.OperateResult.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.OperateResult.Name = "OperateResult";
             this.OperateResult.Name = "OperateResult";
-            this.OperateResult.Size = new System.Drawing.Size(797, 535);
+            this.OperateResult.Size = new System.Drawing.Size(734, 535);
             this.OperateResult.TabIndex = 7;
             this.OperateResult.TabIndex = 7;
             this.OperateResult.Text = "";
             this.OperateResult.Text = "";
             // 
             // 
             // Clean
             // Clean
             // 
             // 
             this.Clean.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             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(1252, 564);
+            this.Clean.Location = new System.Drawing.Point(996, 580);
             this.Clean.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.Clean.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.Clean.Name = "Clean";
             this.Clean.Name = "Clean";
             this.Clean.Size = new System.Drawing.Size(112, 48);
             this.Clean.Size = new System.Drawing.Size(112, 48);
@@ -117,7 +117,7 @@
             this.AutoStart.AutoSize = true;
             this.AutoStart.AutoSize = true;
             this.AutoStart.Checked = true;
             this.AutoStart.Checked = true;
             this.AutoStart.CheckState = System.Windows.Forms.CheckState.Checked;
             this.AutoStart.CheckState = System.Windows.Forms.CheckState.Checked;
-            this.AutoStart.Location = new System.Drawing.Point(695, 127);
+            this.AutoStart.Location = new System.Drawing.Point(58, 39);
             this.AutoStart.Name = "AutoStart";
             this.AutoStart.Name = "AutoStart";
             this.AutoStart.Size = new System.Drawing.Size(186, 28);
             this.AutoStart.Size = new System.Drawing.Size(186, 28);
             this.AutoStart.TabIndex = 20;
             this.AutoStart.TabIndex = 20;
@@ -172,9 +172,7 @@
             // RemindVoice
             // RemindVoice
             // 
             // 
             this.RemindVoice.AutoSize = true;
             this.RemindVoice.AutoSize = true;
-            this.RemindVoice.Checked = true;
-            this.RemindVoice.CheckState = System.Windows.Forms.CheckState.Checked;
-            this.RemindVoice.Location = new System.Drawing.Point(695, 191);
+            this.RemindVoice.Location = new System.Drawing.Point(274, 39);
             this.RemindVoice.Name = "RemindVoice";
             this.RemindVoice.Name = "RemindVoice";
             this.RemindVoice.Size = new System.Drawing.Size(162, 28);
             this.RemindVoice.Size = new System.Drawing.Size(162, 28);
             this.RemindVoice.TabIndex = 35;
             this.RemindVoice.TabIndex = 35;
@@ -209,7 +207,7 @@
             // 
             // 
             this.StopWatch.Enabled = false;
             this.StopWatch.Enabled = false;
             this.StopWatch.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.StopWatch.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.StopWatch.Location = new System.Drawing.Point(357, 552);
+            this.StopWatch.Location = new System.Drawing.Point(208, 547);
             this.StopWatch.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.StopWatch.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.StopWatch.Name = "StopWatch";
             this.StopWatch.Name = "StopWatch";
             this.StopWatch.Size = new System.Drawing.Size(128, 56);
             this.StopWatch.Size = new System.Drawing.Size(128, 56);
@@ -221,7 +219,7 @@
             // StartWatch
             // StartWatch
             // 
             // 
             this.StartWatch.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.StartWatch.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.StartWatch.Location = new System.Drawing.Point(205, 552);
+            this.StartWatch.Location = new System.Drawing.Point(56, 547);
             this.StartWatch.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.StartWatch.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.StartWatch.Name = "StartWatch";
             this.StartWatch.Name = "StartWatch";
             this.StartWatch.Size = new System.Drawing.Size(128, 56);
             this.StartWatch.Size = new System.Drawing.Size(128, 56);
@@ -261,7 +259,7 @@
             // CleanData
             // CleanData
             // 
             // 
             this.CleanData.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.CleanData.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.CleanData.Location = new System.Drawing.Point(513, 552);
+            this.CleanData.Location = new System.Drawing.Point(364, 547);
             this.CleanData.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.CleanData.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.CleanData.Name = "CleanData";
             this.CleanData.Name = "CleanData";
             this.CleanData.Size = new System.Drawing.Size(128, 56);
             this.CleanData.Size = new System.Drawing.Size(128, 56);
@@ -273,7 +271,7 @@
             // Setting
             // Setting
             // 
             // 
             this.Setting.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.Setting.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.Setting.Location = new System.Drawing.Point(742, 23);
+            this.Setting.Location = new System.Drawing.Point(529, 23);
             this.Setting.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.Setting.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.Setting.Name = "Setting";
             this.Setting.Name = "Setting";
             this.Setting.Size = new System.Drawing.Size(128, 56);
             this.Setting.Size = new System.Drawing.Size(128, 56);
@@ -336,7 +334,7 @@
             // Start
             // Start
             // 
             // 
             this.Start.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.Start.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.Start.Location = new System.Drawing.Point(673, 552);
+            this.Start.Location = new System.Drawing.Point(524, 547);
             this.Start.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.Start.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.Start.Name = "Start";
             this.Start.Name = "Start";
             this.Start.Size = new System.Drawing.Size(128, 56);
             this.Start.Size = new System.Drawing.Size(128, 56);
@@ -349,7 +347,7 @@
             // 
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
             this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(1709, 640);
+            this.ClientSize = new System.Drawing.Size(1448, 640);
             this.Controls.Add(this.Start);
             this.Controls.Add(this.Start);
             this.Controls.Add(this.Setting);
             this.Controls.Add(this.Setting);
             this.Controls.Add(this.CleanData);
             this.Controls.Add(this.CleanData);
@@ -378,7 +376,7 @@
             this.Name = "AutoSMTRXY";
             this.Name = "AutoSMTRXY";
             this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
             this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
             this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
             this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
-            this.Text = "过站数据统计2026-10-19";
+            this.Text = "过站数据统计2026-10-21";
             this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
             this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
             this.Load += new System.EventHandler(this.Form1_Load);
             this.Load += new System.EventHandler(this.Form1_Load);
             ((System.ComponentModel.ISupportInitialize)(this.pr_pcbacount)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.pr_pcbacount)).EndInit();

+ 51 - 6
FileWatcher/AutoSMTRXY.cs

@@ -137,7 +137,7 @@ namespace FileWatcher
                     dh.ExecuteSql("insert into makehourcount(mhc_id,mhc_macode,mhc_indate,mhc_type,mhc_qty,mhc_linecode,mhc_pcbcount)" +
                     dh.ExecuteSql("insert into makehourcount(mhc_id,mhc_macode,mhc_indate,mhc_type,mhc_qty,mhc_linecode,mhc_pcbcount)" +
                              "values(makehourcount_seq.nextval,'" + ma_code.Text + "',sysdate,'" + Type.Text + "','" + (qty - lastqty) + "','" + li_code.Text + "','" + pr_pcbacount.Value + "')", "insert");
                              "values(makehourcount_seq.nextval,'" + ma_code.Text + "',sysdate,'" + Type.Text + "','" + (qty - lastqty) + "','" + li_code.Text + "','" + pr_pcbacount.Value + "')", "insert");
                 }
                 }
-                dt = (DataTable)dh.ExecuteSql("select nvl(sum(MHC_QTY* MHC_PCBCOUNT),0)MHC_QTY,max(nvl(ma_qty,0)+nvl(ma_boutqty,0))ma_qty from makehourcount left join make on ma_code=mhc_macode where mhc_macode='" + ma_code.Text + "'", "select");
+                dt = (DataTable)dh.ExecuteSql("select nvl(sum(MHC_QTY* MHC_PCBCOUNT),0)MHC_QTY,max(nvl(ma_qty,0)+nvl(ma_boutqty,0))ma_qty from makehourcount left join make on ma_code=mhc_macode where mhc_macode='" + ma_code.Text + "' and mhc_qty<10", "select");
                 if (dt.Rows.Count > 0)
                 if (dt.Rows.Count > 0)
                 {
                 {
                     int MHC_QTY = int.Parse(dt.Rows[0]["MHC_QTY"].ToString());
                     int MHC_QTY = int.Parse(dt.Rows[0]["MHC_QTY"].ToString());
@@ -149,8 +149,10 @@ namespace FileWatcher
                             OperateResult write = plc.Write(Stop, 1);
                             OperateResult write = plc.Write(Stop, 1);
                             if (write.IsSuccess)
                             if (write.IsSuccess)
                             {
                             {
-                                OperateResult.AppendText("通过,发送指令" + Stop + "写入1\n");
+                                OperateResult.AppendText("超出工单数量,发送指令" + Stop + "写入1\n");
                                 OperateResult.ScrollToCaret();
                                 OperateResult.ScrollToCaret();
+                                StopData = false;
+                                MessageBox.Show("超出工单数量");
                             }
                             }
                             else
                             else
                             {
                             {
@@ -158,7 +160,8 @@ namespace FileWatcher
                                 OperateResult.ScrollToCaret();
                                 OperateResult.ScrollToCaret();
                             }
                             }
                         }
                         }
-                        else {
+                        else
+                        {
                             OperateResult.AppendText("写入失败,未维护参数\n");
                             OperateResult.AppendText("写入失败,未维护参数\n");
                         }
                         }
                     }
                     }
@@ -247,8 +250,10 @@ namespace FileWatcher
                         OperateResult write = plc.Write(Stop, 1);
                         OperateResult write = plc.Write(Stop, 1);
                         if (write.IsSuccess)
                         if (write.IsSuccess)
                         {
                         {
-                            OperateResult.AppendText("通过,发送指令" + Stop + "写入1\n");
+                            OperateResult.AppendText("缺料预警,发送指令" + Stop + "写入1\n");
                             OperateResult.ScrollToCaret();
                             OperateResult.ScrollToCaret();
+                            MessageBox.Show("缺料预警");
+                            StopData = false;
                         }
                         }
                         else
                         else
                         {
                         {
@@ -413,6 +418,15 @@ namespace FileWatcher
                         {
                         {
                             OperateResult.AppendText("写入失败\n");
                             OperateResult.AppendText("写入失败\n");
                         }
                         }
+                        write = plc.Write(Stop, 0);
+                        if (write.IsSuccess)
+                        {
+                            OperateResult.AppendText("通过,发送指令" + Stop + "写入0\n");
+                        }
+                        else
+                        {
+                            OperateResult.AppendText("写入失败\n");
+                        }
                     }
                     }
                     else
                     else
                     {
                     {
@@ -454,7 +468,7 @@ namespace FileWatcher
             OperateResult.AppendText("停止执行监控\n");
             OperateResult.AppendText("停止执行监控\n");
         }
         }
 
 
-        bool realwritedata = false;
+        bool StopData = true;
 
 
         private void Timer_Tick(object sender, EventArgs e)
         private void Timer_Tick(object sender, EventArgs e)
         {
         {
@@ -507,6 +521,37 @@ namespace FileWatcher
                             LogicHandler.CS_SetResultRXY(ma_code.Text, li_code.Text, "", qty.ToString(), li_code.Text, "OK", out error);
                             LogicHandler.CS_SetResultRXY(ma_code.Text, li_code.Text, "", qty.ToString(), li_code.Text, "OK", out error);
                         }
                         }
                         lastqty = qty;
                         lastqty = qty;
+                        dt = (DataTable)dh.ExecuteSql("select nvl(sum(MHC_QTY* MHC_PCBCOUNT),0)MHC_QTY,max(nvl(ma_qty,0)+nvl(ma_boutqty,0))ma_qty from makehourcount left join make on ma_code=mhc_macode where mhc_macode='" + ma_code.Text + "' and  mhc_qty<10", "select");
+                        if (dt.Rows.Count > 0)
+                        {
+                            int MHC_QTY = int.Parse(dt.Rows[0]["MHC_QTY"].ToString());
+                            int ma_qty = int.Parse(dt.Rows[0]["ma_qty"].ToString());
+                            if (MHC_QTY >= ma_qty)
+                            {
+                                if (Stop != "" && StopData)
+                                {
+                                    OperateResult write = plc.Write(Stop, 1);
+                                    if (write.IsSuccess)
+                                    {
+                                        OperateResult.AppendText("超出工单数量,发送指令" + Stop + "写入1\n");
+                                        OperateResult.ScrollToCaret();
+                                        StopData = false;
+                                        MessageBox.Show("超出工单数量");
+
+                                    }
+                                    else
+                                    {
+                                        OperateResult.AppendText("写入失败\n");
+                                        OperateResult.ScrollToCaret();
+                                    }
+                                }
+                                else
+                                {
+                                    OperateResult.AppendText("写入失败,未维护参数\n");
+                                }
+                            }
+                        }
+                       
                     }
                     }
                 }
                 }
                 else
                 else
@@ -661,7 +706,6 @@ namespace FileWatcher
                     Counter.Checked = true;
                     Counter.Checked = true;
                 }
                 }
             }
             }
-
         }
         }
 
 
         private void Start_Click(object sender, EventArgs e)
         private void Start_Click(object sender, EventArgs e)
@@ -672,6 +716,7 @@ namespace FileWatcher
                 if (write.IsSuccess)
                 if (write.IsSuccess)
                 {
                 {
                     OperateResult.AppendText("通过,发送指令" + Stop + "写入0\n");
                     OperateResult.AppendText("通过,发送指令" + Stop + "写入0\n");
+                    StopData = true;
                 }
                 }
                 else
                 else
                 {
                 {

+ 2 - 2
FileWatcher/AutoSMTRXYSetting.Designer.cs

@@ -232,7 +232,7 @@
             "PLC",
             "PLC",
             "计数器"});
             "计数器"});
             this.CountType.Location = new System.Drawing.Point(356, 500);
             this.CountType.Location = new System.Drawing.Point(356, 500);
-            this.CountType.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
+            this.CountType.Margin = new System.Windows.Forms.Padding(6);
             this.CountType.Name = "CountType";
             this.CountType.Name = "CountType";
             this.CountType.Size = new System.Drawing.Size(300, 46);
             this.CountType.Size = new System.Drawing.Size(300, 46);
             this.CountType.TabIndex = 17;
             this.CountType.TabIndex = 17;
@@ -265,7 +265,7 @@
             // 
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
             this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(716, 650);
+            this.ClientSize = new System.Drawing.Size(716, 681);
             this.Controls.Add(this.label3);
             this.Controls.Add(this.label3);
             this.Controls.Add(this.Password);
             this.Controls.Add(this.Password);
             this.Controls.Add(this.ComPort_label);
             this.Controls.Add(this.ComPort_label);