소스 검색

修改密码显示

callm 1 주 전
부모
커밋
0f72b00d6d
2개의 변경된 파일188개의 추가작업 그리고 108개의 파일을 삭제
  1. 147 107
      FileWatcher/AutoSMTRXY.Designer.cs
  2. 41 1
      FileWatcher/AutoSMTRXY.cs

+ 147 - 107
FileWatcher/AutoSMTRXY.Designer.cs

@@ -46,33 +46,35 @@
             this.StopWatch = new System.Windows.Forms.Button();
             this.StartWatch = new System.Windows.Forms.Button();
             this.BaudRate = new System.Windows.Forms.TextBox();
-            this.label3 = new System.Windows.Forms.Label();
-            this.label6 = new System.Windows.Forms.Label();
+            this.BaudRate_label = new System.Windows.Forms.Label();
+            this.ComPort_label = new System.Windows.Forms.Label();
             this.Timer = new System.Windows.Forms.Timer(this.components);
             this.pr_pcbacount = new System.Windows.Forms.NumericUpDown();
             this.label7 = new System.Windows.Forms.Label();
             this.Read = new System.Windows.Forms.TextBox();
-            this.label8 = new System.Windows.Forms.Label();
+            this.Read_label = new System.Windows.Forms.Label();
             this.Write = new System.Windows.Forms.TextBox();
-            this.label9 = new System.Windows.Forms.Label();
+            this.Write_label = new System.Windows.Forms.Label();
             this.ToZero = new System.Windows.Forms.TextBox();
-            this.label10 = new System.Windows.Forms.Label();
+            this.ToZero_label = new System.Windows.Forms.Label();
             this.CleanData = new System.Windows.Forms.Button();
             this.Setting = new System.Windows.Forms.Button();
-            this.label11 = new System.Windows.Forms.Label();
+            this.CountType_label = new System.Windows.Forms.Label();
             this.CountType = new System.Windows.Forms.ComboBox();
+            this.UseScan = new System.Windows.Forms.TextBox();
+            this.UseScan_label = new System.Windows.Forms.Label();
+            this.Password = new System.Windows.Forms.TextBox();
+            this.label3 = new System.Windows.Forms.Label();
             this.ComPort = new FileWatcher.SerialPortCombox();
             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();
             // 
             // OperateResult
             // 
-            this.OperateResult.Location = new System.Drawing.Point(1188, 23);
+            this.OperateResult.Location = new System.Drawing.Point(1208, 23);
             this.OperateResult.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.OperateResult.Name = "OperateResult";
             this.OperateResult.Size = new System.Drawing.Size(489, 535);
@@ -243,34 +245,37 @@
             // 
             // BaudRate
             // 
-            this.BaudRate.Location = new System.Drawing.Point(990, 222);
+            this.BaudRate.Location = new System.Drawing.Point(1020, 229);
             this.BaudRate.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.BaudRate.Name = "BaudRate";
             this.BaudRate.Size = new System.Drawing.Size(146, 35);
             this.BaudRate.TabIndex = 43;
             this.BaudRate.Text = "9600";
-            // 
-            // label3
-            // 
-            this.label3.AutoSize = true;
-            this.label3.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label3.Location = new System.Drawing.Point(866, 222);
-            this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
-            this.label3.Name = "label3";
-            this.label3.Size = new System.Drawing.Size(104, 38);
-            this.label3.TabIndex = 42;
-            this.label3.Text = "波特率";
-            // 
-            // 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(895, 170);
-            this.label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
-            this.label6.Name = "label6";
-            this.label6.Size = new System.Drawing.Size(75, 38);
-            this.label6.TabIndex = 41;
-            this.label6.Text = "串口";
+            this.BaudRate.Visible = false;
+            // 
+            // BaudRate_label
+            // 
+            this.BaudRate_label.AutoSize = true;
+            this.BaudRate_label.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.BaudRate_label.Location = new System.Drawing.Point(896, 229);
+            this.BaudRate_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.BaudRate_label.Name = "BaudRate_label";
+            this.BaudRate_label.Size = new System.Drawing.Size(104, 38);
+            this.BaudRate_label.TabIndex = 42;
+            this.BaudRate_label.Text = "波特率";
+            this.BaudRate_label.Visible = false;
+            // 
+            // ComPort_label
+            // 
+            this.ComPort_label.AutoSize = true;
+            this.ComPort_label.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.ComPort_label.Location = new System.Drawing.Point(925, 177);
+            this.ComPort_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.ComPort_label.Name = "ComPort_label";
+            this.ComPort_label.Size = new System.Drawing.Size(75, 38);
+            this.ComPort_label.TabIndex = 41;
+            this.ComPort_label.Text = "串口";
+            this.ComPort_label.Visible = false;
             // 
             // Timer
             // 
@@ -302,60 +307,66 @@
             // 
             // Read
             // 
-            this.Read.Location = new System.Drawing.Point(988, 279);
+            this.Read.Location = new System.Drawing.Point(1018, 286);
             this.Read.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.Read.Name = "Read";
             this.Read.Size = new System.Drawing.Size(146, 35);
             this.Read.TabIndex = 47;
+            this.Read.Visible = false;
             // 
-            // label8
+            // Read_label
             // 
-            this.label8.AutoSize = true;
-            this.label8.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label8.Location = new System.Drawing.Point(905, 273);
-            this.label8.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
-            this.label8.Name = "label8";
-            this.label8.Size = new System.Drawing.Size(75, 38);
-            this.label8.TabIndex = 46;
-            this.label8.Text = "读取";
+            this.Read_label.AutoSize = true;
+            this.Read_label.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.Read_label.Location = new System.Drawing.Point(935, 280);
+            this.Read_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.Read_label.Name = "Read_label";
+            this.Read_label.Size = new System.Drawing.Size(75, 38);
+            this.Read_label.TabIndex = 46;
+            this.Read_label.Text = "读取";
+            this.Read_label.Visible = false;
             // 
             // Write
             // 
-            this.Write.Location = new System.Drawing.Point(988, 331);
+            this.Write.Location = new System.Drawing.Point(1018, 338);
             this.Write.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.Write.Name = "Write";
             this.Write.Size = new System.Drawing.Size(146, 35);
             this.Write.TabIndex = 49;
+            this.Write.Visible = false;
             // 
-            // label9
+            // Write_label
             // 
-            this.label9.AutoSize = true;
-            this.label9.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label9.Location = new System.Drawing.Point(905, 328);
-            this.label9.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
-            this.label9.Name = "label9";
-            this.label9.Size = new System.Drawing.Size(75, 38);
-            this.label9.TabIndex = 48;
-            this.label9.Text = "回写";
+            this.Write_label.AutoSize = true;
+            this.Write_label.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.Write_label.Location = new System.Drawing.Point(935, 335);
+            this.Write_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.Write_label.Name = "Write_label";
+            this.Write_label.Size = new System.Drawing.Size(75, 38);
+            this.Write_label.TabIndex = 48;
+            this.Write_label.Text = "回写";
+            this.Write_label.Visible = false;
             // 
             // ToZero
             // 
-            this.ToZero.Location = new System.Drawing.Point(988, 387);
+            this.ToZero.Location = new System.Drawing.Point(1018, 394);
             this.ToZero.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.ToZero.Name = "ToZero";
             this.ToZero.Size = new System.Drawing.Size(146, 35);
             this.ToZero.TabIndex = 51;
+            this.ToZero.Visible = false;
             // 
-            // label10
+            // ToZero_label
             // 
-            this.label10.AutoSize = true;
-            this.label10.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label10.Location = new System.Drawing.Point(905, 384);
-            this.label10.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
-            this.label10.Name = "label10";
-            this.label10.Size = new System.Drawing.Size(75, 38);
-            this.label10.TabIndex = 50;
-            this.label10.Text = "清零";
+            this.ToZero_label.AutoSize = true;
+            this.ToZero_label.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.ToZero_label.Location = new System.Drawing.Point(935, 391);
+            this.ToZero_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.ToZero_label.Name = "ToZero_label";
+            this.ToZero_label.Size = new System.Drawing.Size(75, 38);
+            this.ToZero_label.TabIndex = 50;
+            this.ToZero_label.Text = "清零";
+            this.ToZero_label.Visible = false;
             // 
             // CleanData
             // 
@@ -373,7 +384,7 @@
             // Setting
             // 
             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(961, 83);
+            this.Setting.Location = new System.Drawing.Point(973, 23);
             this.Setting.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.Setting.Name = "Setting";
             this.Setting.Size = new System.Drawing.Size(128, 56);
@@ -382,16 +393,17 @@
             this.Setting.UseVisualStyleBackColor = true;
             this.Setting.Click += new System.EventHandler(this.Setting_Click);
             // 
-            // label11
+            // CountType_label
             // 
-            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, 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);
-            this.label11.TabIndex = 55;
-            this.label11.Text = "计数方式";
+            this.CountType_label.AutoSize = true;
+            this.CountType_label.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.CountType_label.Location = new System.Drawing.Point(880, 491);
+            this.CountType_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.CountType_label.Name = "CountType_label";
+            this.CountType_label.Size = new System.Drawing.Size(133, 38);
+            this.CountType_label.TabIndex = 55;
+            this.CountType_label.Text = "计数方式";
+            this.CountType_label.Visible = false;
             // 
             // CountType
             // 
@@ -400,18 +412,61 @@
             this.CountType.Items.AddRange(new object[] {
             "PLC",
             "计数器"});
-            this.CountType.Location = new System.Drawing.Point(990, 490);
+            this.CountType.Location = new System.Drawing.Point(1020, 497);
             this.CountType.Name = "CountType";
             this.CountType.Size = new System.Drawing.Size(137, 32);
             this.CountType.TabIndex = 54;
+            this.CountType.Visible = false;
+            // 
+            // UseScan
+            // 
+            this.UseScan.Location = new System.Drawing.Point(1018, 445);
+            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;
+            this.UseScan.Visible = false;
+            // 
+            // UseScan_label
+            // 
+            this.UseScan_label.AutoSize = true;
+            this.UseScan_label.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.UseScan_label.Location = new System.Drawing.Point(877, 442);
+            this.UseScan_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.UseScan_label.Name = "UseScan_label";
+            this.UseScan_label.Size = new System.Drawing.Size(133, 38);
+            this.UseScan_label.TabIndex = 56;
+            this.UseScan_label.Text = "启用扫描";
+            this.UseScan_label.Visible = false;
+            // 
+            // Password
+            // 
+            this.Password.Location = new System.Drawing.Point(1018, 127);
+            this.Password.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+            this.Password.Name = "Password";
+            this.Password.PasswordChar = '*';
+            this.Password.Size = new System.Drawing.Size(146, 35);
+            this.Password.TabIndex = 59;
+            // 
+            // label3
+            // 
+            this.label3.AutoSize = true;
+            this.label3.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label3.Location = new System.Drawing.Point(923, 124);
+            this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label3.Name = "label3";
+            this.label3.Size = new System.Drawing.Size(75, 38);
+            this.label3.TabIndex = 58;
+            this.label3.Text = "密码";
             // 
             // ComPort
             // 
-            this.ComPort.Location = new System.Drawing.Point(988, 174);
+            this.ComPort.Location = new System.Drawing.Point(1018, 181);
             this.ComPort.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
             this.ComPort.Name = "ComPort";
             this.ComPort.Size = new System.Drawing.Size(148, 40);
             this.ComPort.TabIndex = 40;
+            this.ComPort.Visible = false;
             // 
             // ms_sncode
             // 
@@ -464,47 +519,30 @@
             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.Password);
+            this.Controls.Add(this.label3);
             this.Controls.Add(this.UseScan);
-            this.Controls.Add(this.label12);
-            this.Controls.Add(this.label11);
+            this.Controls.Add(this.UseScan_label);
+            this.Controls.Add(this.CountType_label);
             this.Controls.Add(this.CountType);
             this.Controls.Add(this.Setting);
             this.Controls.Add(this.CleanData);
             this.Controls.Add(this.ToZero);
-            this.Controls.Add(this.label10);
+            this.Controls.Add(this.ToZero_label);
             this.Controls.Add(this.Write);
-            this.Controls.Add(this.label9);
+            this.Controls.Add(this.Write_label);
             this.Controls.Add(this.Read);
-            this.Controls.Add(this.label8);
+            this.Controls.Add(this.Read_label);
             this.Controls.Add(this.pr_pcbacount);
             this.Controls.Add(this.label7);
             this.Controls.Add(this.BaudRate);
-            this.Controls.Add(this.label3);
-            this.Controls.Add(this.label6);
+            this.Controls.Add(this.BaudRate_label);
+            this.Controls.Add(this.ComPort_label);
             this.Controls.Add(this.ComPort);
             this.Controls.Add(this.StopWatch);
             this.Controls.Add(this.StartWatch);
@@ -559,24 +597,26 @@
         private System.Windows.Forms.Button StopWatch;
         private System.Windows.Forms.Button StartWatch;
         private System.Windows.Forms.TextBox BaudRate;
-        private System.Windows.Forms.Label label3;
-        private System.Windows.Forms.Label label6;
+        private System.Windows.Forms.Label BaudRate_label;
+        private System.Windows.Forms.Label ComPort_label;
         private SerialPortCombox ComPort;
         private System.Windows.Forms.Timer Timer;
         private System.Windows.Forms.NumericUpDown pr_pcbacount;
         private System.Windows.Forms.Label label7;
         private System.Windows.Forms.TextBox Read;
-        private System.Windows.Forms.Label label8;
+        private System.Windows.Forms.Label Read_label;
         private System.Windows.Forms.TextBox Write;
-        private System.Windows.Forms.Label label9;
+        private System.Windows.Forms.Label Write_label;
         private System.Windows.Forms.TextBox ToZero;
-        private System.Windows.Forms.Label label10;
+        private System.Windows.Forms.Label ToZero_label;
         private System.Windows.Forms.Button CleanData;
         private System.Windows.Forms.Button Setting;
-        private System.Windows.Forms.Label label11;
+        private System.Windows.Forms.Label CountType_label;
         private System.Windows.Forms.ComboBox CountType;
         private System.Windows.Forms.TextBox UseScan;
-        private System.Windows.Forms.Label label12;
+        private System.Windows.Forms.Label UseScan_label;
+        private System.Windows.Forms.TextBox Password;
+        private System.Windows.Forms.Label label3;
     }
 }
 

+ 41 - 1
FileWatcher/AutoSMTRXY.cs

@@ -94,6 +94,11 @@ namespace FileWatcher
                 UseScan.Text = BaseUtil.GetCacheData("UseScan").ToString();
             }
             catch (Exception ex) { OperateResult.AppendText(ex.Message); }
+
+            ComPort.Visible = false; Read.Visible = false; Write.Visible = false;
+            BaudRate.Visible = false; ToZero.Visible = false; UseScan.Visible = false;
+            CountType.Visible = false;
+
             RemindTimer.Start();
             this.WindowState = FormWindowState.Normal;
             this.Size = new System.Drawing.Size(900, 400); // 替换为你需要的尺寸
@@ -155,7 +160,7 @@ namespace FileWatcher
             li_code.FormName = Name;
             li_code.DBTitle = "线别查询";
             li_code.SetValueField = new string[] { "li_code" };
-            li_code.Condition = "";
+            li_code.Condition = "li_wccode in ('SMT','AI')";
             li_code.DbChange += nr_rule_DBChange;
         }
 
@@ -350,6 +355,15 @@ namespace FileWatcher
                     pipe.SleepTime = 20;
                     pipe.ReceiveTimeOut = 5000;
                     plc.CommunicationPipe = pipe;
+                    OperateResult write = plc.Write(UseScan.Text, 1);
+                    if (write.IsSuccess)
+                    {
+                        OperateResult.AppendText("通过,发送指令" + UseScan.Text + "写入2\n");
+                    }
+                    else
+                    {
+                        OperateResult.AppendText("写入失败\n");
+                    }
                 }
                 else
                 {
@@ -483,7 +497,33 @@ namespace FileWatcher
 
         private void Setting_Click(object sender, EventArgs e)
         {
+            if (ComPort.Visible == true)
+            {
+                ComPort.Visible = false; Read.Visible = false; Write.Visible = false;
+                BaudRate.Visible = false; ToZero.Visible = false; UseScan.Visible = false;
+                CountType.Visible = false;
 
+                ComPort_label.Visible = false; Read_label.Visible = false; Write_label.Visible = false;
+                BaudRate_label.Visible = false; ToZero_label.Visible = false; UseScan_label.Visible = false;
+                CountType_label.Visible = false;
+            }
+            else
+            {
+                if (Password.Text == "1234")
+                {
+                    ComPort.Visible = true; Read.Visible = true; Write.Visible = true;
+                    BaudRate.Visible = true; ToZero.Visible = true; UseScan.Visible = true;
+                    CountType.Visible = true;
+
+                    ComPort_label.Visible = true; Read_label.Visible = true; Write_label.Visible = true;
+                    BaudRate_label.Visible = true; ToZero_label.Visible = true; UseScan_label.Visible = true;
+                    CountType_label.Visible = true;
+                }
+                else
+                {
+                    OperateResult.AppendText("密码不对\n");
+                }
+            }
         }
     }
 }