Browse Source

优化测试

callm 3 days ago
parent
commit
ffe74b74b1
2 changed files with 43 additions and 8 deletions
  1. 27 2
      FileWatcher/AutoSMTRXY.Designer.cs
  2. 16 6
      FileWatcher/AutoSMTRXY.cs

+ 27 - 2
FileWatcher/AutoSMTRXY.Designer.cs

@@ -65,6 +65,8 @@
             this.ms_sncode = new FileWatcher.EnterTextBox();
             this.ma_code = new FileWatcher.SearchTextBox();
             this.li_code = new FileWatcher.SearchTextBox();
+            this.UseScan = new System.Windows.Forms.TextBox();
+            this.label12 = new System.Windows.Forms.Label();
             ((System.ComponentModel.ISupportInitialize)(this.pr_pcbacount)).BeginInit();
             this.SuspendLayout();
             // 
@@ -384,7 +386,7 @@
             // 
             this.label11.AutoSize = true;
             this.label11.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label11.Location = new System.Drawing.Point(850, 439);
+            this.label11.Location = new System.Drawing.Point(850, 484);
             this.label11.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label11.Name = "label11";
             this.label11.Size = new System.Drawing.Size(133, 38);
@@ -398,7 +400,7 @@
             this.CountType.Items.AddRange(new object[] {
             "PLC",
             "计数器"});
-            this.CountType.Location = new System.Drawing.Point(990, 445);
+            this.CountType.Location = new System.Drawing.Point(990, 490);
             this.CountType.Name = "CountType";
             this.CountType.Size = new System.Drawing.Size(137, 32);
             this.CountType.TabIndex = 54;
@@ -462,11 +464,32 @@
             this.li_code.TableName = null;
             this.li_code.TextBoxEnable = false;
             // 
+            // UseScan
+            // 
+            this.UseScan.Location = new System.Drawing.Point(988, 438);
+            this.UseScan.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+            this.UseScan.Name = "UseScan";
+            this.UseScan.Size = new System.Drawing.Size(146, 35);
+            this.UseScan.TabIndex = 57;
+            // 
+            // label12
+            // 
+            this.label12.AutoSize = true;
+            this.label12.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label12.Location = new System.Drawing.Point(847, 435);
+            this.label12.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label12.Name = "label12";
+            this.label12.Size = new System.Drawing.Size(133, 38);
+            this.label12.TabIndex = 56;
+            this.label12.Text = "启用扫描";
+            // 
             // AutoSMTRXY
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(1710, 640);
+            this.Controls.Add(this.UseScan);
+            this.Controls.Add(this.label12);
             this.Controls.Add(this.label11);
             this.Controls.Add(this.CountType);
             this.Controls.Add(this.Setting);
@@ -552,6 +575,8 @@
         private System.Windows.Forms.Button Setting;
         private System.Windows.Forms.Label label11;
         private System.Windows.Forms.ComboBox CountType;
+        private System.Windows.Forms.TextBox UseScan;
+        private System.Windows.Forms.Label label12;
     }
 }
 

+ 16 - 6
FileWatcher/AutoSMTRXY.cs

@@ -84,13 +84,14 @@ namespace FileWatcher
             //获取缓存信息
             try
             {
-                ComPort.Text= BaseUtil.GetCacheData("ComPort").ToString();
+                ComPort.Text = BaseUtil.GetCacheData("ComPort").ToString();
                 Type.Text = BaseUtil.GetCacheData("Type").ToString();
                 li_code.Text = BaseUtil.GetCacheData("Line").ToString();
                 Read.Text = BaseUtil.GetCacheData("Read").ToString();
                 Write.Text = BaseUtil.GetCacheData("Write").ToString();
                 ToZero.Text = BaseUtil.GetCacheData("ToZero").ToString();
-                CountType.Text= BaseUtil.GetCacheData("CountType").ToString();
+                CountType.Text = BaseUtil.GetCacheData("CountType").ToString();
+                UseScan.Text = BaseUtil.GetCacheData("UseScan").ToString();
             }
             catch (Exception ex) { OperateResult.AppendText(ex.Message); }
             RemindTimer.Start();
@@ -129,7 +130,10 @@ namespace FileWatcher
                     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");
                 }
-                LogicHandler.CS_SetResultRXY(ma_code.Text, li_code.Text, "", qty.ToString(), li_code.Text, "OK", out error);
+                if (Counter.Checked)
+                {
+                    LogicHandler.CS_SetResultRXY(ma_code.Text, li_code.Text, "", qty.ToString(), li_code.Text, "OK", out error);
+                }
                 lastqty = qty;
             }
         }
@@ -265,7 +269,7 @@ namespace FileWatcher
                         if (LogicHandler.CS_SetResultRXY(ma_code.Text, li_code.Text, MainSN, "0", li_code.Text, "OK", out error))
                         {
                             OperateResult.AppendText("SN:" + MainSN + "采集成功\n");
-                            OperateResult. ScrollToCaret();
+                            OperateResult.ScrollToCaret();
                             ms_sncode.Clear();
                         }
                         else
@@ -295,6 +299,9 @@ namespace FileWatcher
             BaseUtil.SetCacheData("ToZero", ToZero.Text);
             BaseUtil.SetCacheData("Type", Type.Text);
             BaseUtil.SetCacheData("CountType", CountType.Text);
+            BaseUtil.SetCacheData("UseScan", UseScan.Text);
+
+
             if (!dh.CheckExist("Make", "ma_code='" + ma_code.Text + "'"))
             {
                 OperateResult.AppendText("工单号不能为空\n");
@@ -366,10 +373,10 @@ namespace FileWatcher
         {
             StartWatch.Enabled = true;
             ma_code.Enabled = true;
-
             StopWatch.Enabled = false;
             OperateResult.AppendText("停止执行监控\n");
         }
+
         bool realwritedata = false;
 
         private void Timer_Tick(object sender, EventArgs e)
@@ -418,7 +425,10 @@ namespace FileWatcher
                             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");
                         }
-                        LogicHandler.CS_SetResultRXY(ma_code.Text, li_code.Text, "", qty.ToString(), li_code.Text, "OK", out error);
+                        if (Counter.Checked)
+                        {
+                            LogicHandler.CS_SetResultRXY(ma_code.Text, li_code.Text, "", qty.ToString(), li_code.Text, "OK", out error);
+                        }
                         lastqty = qty;
                     }
                 }