diff --git a/C-Windows-1/Form1.Designer.cs b/C-Windows-1/Form1.Designer.cs index c54b881..4f0680d 100644 --- a/C-Windows-1/Form1.Designer.cs +++ b/C-Windows-1/Form1.Designer.cs @@ -99,7 +99,6 @@ this.Leak = new System.Windows.Forms.Label(); this.ChkCSV = new System.Windows.Forms.CheckBox(); this.Timer11 = new System.Windows.Forms.Timer(this.components); - this.Baudrate = new System.Windows.Forms.TextBox(); this.checkBox1 = new System.Windows.Forms.CheckBox(); this.codecheck = new System.Windows.Forms.TextBox(); this.label9 = new System.Windows.Forms.Label(); @@ -111,8 +110,6 @@ this.Sunzong = new System.Windows.Forms.Label(); this.label28 = new System.Windows.Forms.Label(); this.CodePort1 = new System.IO.Ports.SerialPort(this.components); - this.timerbar = new System.Windows.Forms.Timer(this.components); - this.progressBar1 = new System.Windows.Forms.ProgressBar(); this.button2 = new System.Windows.Forms.Button(); this.zhanhao = new System.Windows.Forms.TextBox(); this.groupBox2 = new System.Windows.Forms.GroupBox(); @@ -187,6 +184,8 @@ this.label6 = new System.Windows.Forms.Label(); this.UDPRead = new System.Windows.Forms.Timer(this.components); this.UDPOverTime = new System.Windows.Forms.Timer(this.components); + this.bigLeak = new System.Windows.Forms.Label(); + this.label41 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.DataGridView1)).BeginInit(); this.menuStrip1.SuspendLayout(); this.groupBox1.SuspendLayout(); @@ -202,7 +201,7 @@ // // ReceiveText // - this.ReceiveText.Location = new System.Drawing.Point(486, 374); + this.ReceiveText.Location = new System.Drawing.Point(486, 393); this.ReceiveText.Multiline = true; this.ReceiveText.Name = "ReceiveText"; this.ReceiveText.Size = new System.Drawing.Size(185, 97); @@ -210,7 +209,7 @@ // // SendText // - this.SendText.Location = new System.Drawing.Point(486, 477); + this.SendText.Location = new System.Drawing.Point(486, 496); this.SendText.Multiline = true; this.SendText.Name = "SendText"; this.SendText.Size = new System.Drawing.Size(185, 63); @@ -253,7 +252,7 @@ this.Column17, this.Column14, this.Column15}); - this.DataGridView1.Location = new System.Drawing.Point(12, 357); + this.DataGridView1.Location = new System.Drawing.Point(5, 365); this.DataGridView1.Name = "DataGridView1"; this.DataGridView1.RowTemplate.Height = 23; this.DataGridView1.Size = new System.Drawing.Size(894, 248); @@ -347,7 +346,7 @@ // // progressBar2 // - this.progressBar2.Location = new System.Drawing.Point(204, 292); + this.progressBar2.Location = new System.Drawing.Point(206, 312); this.progressBar2.MarqueeAnimationSpeed = 50; this.progressBar2.Name = "progressBar2"; this.progressBar2.Size = new System.Drawing.Size(583, 31); @@ -358,9 +357,9 @@ // this.label36.AutoSize = true; this.label36.Font = new System.Drawing.Font("宋体", 12F); - this.label36.Location = new System.Drawing.Point(127, 307); + this.label36.Location = new System.Drawing.Point(129, 321); this.label36.Name = "label36"; - this.label36.Size = new System.Drawing.Size(71, 16); + this.label36.Size = new System.Drawing.Size(72, 16); this.label36.TabIndex = 89; this.label36.Text = "测试进度"; this.label36.Click += new System.EventHandler(this.label36_Click); @@ -371,7 +370,7 @@ this.Manual.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold); this.Manual.Location = new System.Drawing.Point(777, 5); this.Manual.Name = "Manual"; - this.Manual.Size = new System.Drawing.Size(16, 16); + this.Manual.Size = new System.Drawing.Size(17, 16); this.Manual.TabIndex = 63; this.Manual.TabStop = true; this.Manual.Text = "?"; @@ -398,7 +397,7 @@ // this.MachineStatus.AutoSize = true; this.MachineStatus.Font = new System.Drawing.Font("宋体", 40F); - this.MachineStatus.Location = new System.Drawing.Point(581, 104); + this.MachineStatus.Location = new System.Drawing.Point(591, 104); this.MachineStatus.Name = "MachineStatus"; this.MachineStatus.Size = new System.Drawing.Size(185, 54); this.MachineStatus.TabIndex = 47; @@ -408,7 +407,7 @@ // this.Tlight.AutoSize = true; this.Tlight.Font = new System.Drawing.Font("宋体", 80F); - this.Tlight.Location = new System.Drawing.Point(419, 108); + this.Tlight.Location = new System.Drawing.Point(429, 108); this.Tlight.Name = "Tlight"; this.Tlight.Size = new System.Drawing.Size(153, 107); this.Tlight.TabIndex = 42; @@ -418,17 +417,17 @@ // this.label31.AutoSize = true; this.label31.Font = new System.Drawing.Font("宋体", 18F); - this.label31.Location = new System.Drawing.Point(194, 160); + this.label31.Location = new System.Drawing.Point(194, 233); this.label31.Name = "label31"; - this.label31.Size = new System.Drawing.Size(82, 24); + this.label31.Size = new System.Drawing.Size(94, 24); this.label31.TabIndex = 83; - this.label31.Text = "泄漏量"; + this.label31.Text = "泄漏量:"; // // label33 // this.label33.AutoSize = true; this.label33.Font = new System.Drawing.Font("宋体", 18F); - this.label33.Location = new System.Drawing.Point(406, 72); + this.label33.Location = new System.Drawing.Point(416, 72); this.label33.Name = "label33"; this.label33.Size = new System.Drawing.Size(130, 24); this.label33.TabIndex = 85; @@ -443,6 +442,7 @@ this.PressureUnit.Size = new System.Drawing.Size(58, 24); this.PressureUnit.TabIndex = 116; this.PressureUnit.Text = "单位"; + this.PressureUnit.Visible = false; // // label30 // @@ -450,15 +450,15 @@ this.label30.Font = new System.Drawing.Font("宋体", 18F); this.label30.Location = new System.Drawing.Point(194, 74); this.label30.Name = "label30"; - this.label30.Size = new System.Drawing.Size(106, 24); + this.label30.Size = new System.Drawing.Size(118, 24); this.label30.TabIndex = 82; - this.label30.Text = "测试压力"; + this.label30.Text = "测试压力:"; // // label32 // this.label32.AutoSize = true; this.label32.Font = new System.Drawing.Font("宋体", 18F); - this.label32.Location = new System.Drawing.Point(586, 72); + this.label32.Location = new System.Drawing.Point(596, 72); this.label32.Name = "label32"; this.label32.Size = new System.Drawing.Size(130, 24); this.label32.TabIndex = 84; @@ -468,11 +468,12 @@ // this.LeakUnit.AutoSize = true; this.LeakUnit.Font = new System.Drawing.Font("宋体", 18F); - this.LeakUnit.Location = new System.Drawing.Point(325, 160); + this.LeakUnit.Location = new System.Drawing.Point(325, 233); this.LeakUnit.Name = "LeakUnit"; this.LeakUnit.Size = new System.Drawing.Size(58, 24); this.LeakUnit.TabIndex = 113; this.LeakUnit.Text = "单位"; + this.LeakUnit.Visible = false; // // Station // @@ -488,7 +489,7 @@ "08", "09", "10"}); - this.Station.Location = new System.Drawing.Point(677, 375); + this.Station.Location = new System.Drawing.Point(677, 394); this.Station.Name = "Station"; this.Station.Size = new System.Drawing.Size(61, 20); this.Station.TabIndex = 23; @@ -496,7 +497,7 @@ // label8 // this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(675, 360); + this.label8.Location = new System.Drawing.Point(675, 379); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(29, 12); this.label8.TabIndex = 24; @@ -526,7 +527,7 @@ // // CodeLength // - this.CodeLength.Location = new System.Drawing.Point(677, 410); + this.CodeLength.Location = new System.Drawing.Point(677, 429); this.CodeLength.Name = "CodeLength"; this.CodeLength.Size = new System.Drawing.Size(61, 21); this.CodeLength.TabIndex = 59; @@ -534,7 +535,7 @@ // label19 // this.label19.AutoSize = true; - this.label19.Location = new System.Drawing.Point(675, 395); + this.label19.Location = new System.Drawing.Point(675, 414); this.label19.Name = "label19"; this.label19.Size = new System.Drawing.Size(65, 12); this.label19.TabIndex = 71; @@ -637,7 +638,7 @@ // this.ChkMES.AutoSize = true; this.ChkMES.Font = new System.Drawing.Font("宋体", 9F); - this.ChkMES.Location = new System.Drawing.Point(677, 534); + this.ChkMES.Location = new System.Drawing.Point(677, 553); this.ChkMES.Name = "ChkMES"; this.ChkMES.Size = new System.Drawing.Size(78, 16); this.ChkMES.TabIndex = 133; @@ -647,7 +648,7 @@ // label35 // this.label35.AutoSize = true; - this.label35.Location = new System.Drawing.Point(675, 434); + this.label35.Location = new System.Drawing.Point(675, 453); this.label35.Name = "label35"; this.label35.Size = new System.Drawing.Size(29, 12); this.label35.TabIndex = 132; @@ -657,7 +658,7 @@ // this.ChkExcel.AutoSize = true; this.ChkExcel.Font = new System.Drawing.Font("宋体", 9F); - this.ChkExcel.Location = new System.Drawing.Point(677, 473); + this.ChkExcel.Location = new System.Drawing.Point(677, 492); this.ChkExcel.Name = "ChkExcel"; this.ChkExcel.Size = new System.Drawing.Size(90, 16); this.ChkExcel.TabIndex = 129; @@ -668,7 +669,7 @@ // this.ChkTXT.AutoSize = true; this.ChkTXT.Font = new System.Drawing.Font("宋体", 9F); - this.ChkTXT.Location = new System.Drawing.Point(677, 493); + this.ChkTXT.Location = new System.Drawing.Point(677, 512); this.ChkTXT.Name = "ChkTXT"; this.ChkTXT.Size = new System.Drawing.Size(78, 16); this.ChkTXT.TabIndex = 130; @@ -677,7 +678,7 @@ // // path // - this.path.Location = new System.Drawing.Point(677, 449); + this.path.Location = new System.Drawing.Point(677, 468); this.path.Name = "path"; this.path.Size = new System.Drawing.Size(61, 21); this.path.TabIndex = 127; @@ -686,7 +687,7 @@ // this.ChkSql.AutoSize = true; this.ChkSql.Font = new System.Drawing.Font("宋体", 9F); - this.ChkSql.Location = new System.Drawing.Point(677, 515); + this.ChkSql.Location = new System.Drawing.Point(677, 534); this.ChkSql.Name = "ChkSql"; this.ChkSql.Size = new System.Drawing.Size(114, 16); this.ChkSql.TabIndex = 131; @@ -697,7 +698,7 @@ // this.MESStatus.AutoSize = true; this.MESStatus.Font = new System.Drawing.Font("宋体", 40F); - this.MESStatus.Location = new System.Drawing.Point(586, 188); + this.MESStatus.Location = new System.Drawing.Point(596, 212); this.MESStatus.Name = "MESStatus"; this.MESStatus.Size = new System.Drawing.Size(131, 54); this.MESStatus.TabIndex = 135; @@ -707,7 +708,7 @@ // this.label7.AutoSize = true; this.label7.Font = new System.Drawing.Font("宋体", 18F); - this.label7.Location = new System.Drawing.Point(586, 158); + this.label7.Location = new System.Drawing.Point(596, 182); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(118, 24); this.label7.TabIndex = 136; @@ -717,7 +718,7 @@ // this.LeakPressure.AutoSize = true; this.LeakPressure.Font = new System.Drawing.Font("宋体", 36F); - this.LeakPressure.Location = new System.Drawing.Point(191, 98); + this.LeakPressure.Location = new System.Drawing.Point(191, 100); this.LeakPressure.Name = "LeakPressure"; this.LeakPressure.Size = new System.Drawing.Size(212, 48); this.LeakPressure.TabIndex = 137; @@ -727,7 +728,7 @@ // this.Leak.AutoSize = true; this.Leak.Font = new System.Drawing.Font("宋体", 36F); - this.Leak.Location = new System.Drawing.Point(191, 190); + this.Leak.Location = new System.Drawing.Point(191, 259); this.Leak.Name = "Leak"; this.Leak.Size = new System.Drawing.Size(212, 48); this.Leak.TabIndex = 138; @@ -737,7 +738,7 @@ // this.ChkCSV.AutoSize = true; this.ChkCSV.Font = new System.Drawing.Font("宋体", 9F); - this.ChkCSV.Location = new System.Drawing.Point(677, 551); + this.ChkCSV.Location = new System.Drawing.Point(677, 570); this.ChkCSV.Name = "ChkCSV"; this.ChkCSV.Size = new System.Drawing.Size(78, 16); this.ChkCSV.TabIndex = 139; @@ -748,14 +749,6 @@ // this.Timer11.Tick += new System.EventHandler(this.Timer11_Tick); // - // Baudrate - // - this.Baudrate.Location = new System.Drawing.Point(724, 328); - this.Baudrate.Name = "Baudrate"; - this.Baudrate.Size = new System.Drawing.Size(113, 21); - this.Baudrate.TabIndex = 140; - this.Baudrate.Visible = false; - // // checkBox1 // this.checkBox1.AutoSize = true; @@ -783,7 +776,7 @@ this.label9.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label9.Location = new System.Drawing.Point(903, 29); this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(87, 16); + this.label9.Size = new System.Drawing.Size(88, 16); this.label9.TabIndex = 143; this.label9.Text = "条形码长度"; // @@ -793,7 +786,7 @@ this.Scancode.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.Scancode.Location = new System.Drawing.Point(800, 38); this.Scancode.Name = "Scancode"; - this.Scancode.Size = new System.Drawing.Size(90, 20); + this.Scancode.Size = new System.Drawing.Size(91, 20); this.Scancode.TabIndex = 144; this.Scancode.Text = "扫码启动"; this.Scancode.UseVisualStyleBackColor = true; @@ -831,7 +824,7 @@ this.Passzong.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.Passzong.Location = new System.Drawing.Point(84, 99); this.Passzong.Name = "Passzong"; - this.Passzong.Size = new System.Drawing.Size(23, 16); + this.Passzong.Size = new System.Drawing.Size(24, 16); this.Passzong.TabIndex = 3; this.Passzong.Text = "10"; // @@ -851,7 +844,7 @@ this.Sunzong.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.Sunzong.Location = new System.Drawing.Point(84, 49); this.Sunzong.Name = "Sunzong"; - this.Sunzong.Size = new System.Drawing.Size(23, 16); + this.Sunzong.Size = new System.Drawing.Size(24, 16); this.Sunzong.TabIndex = 1; this.Sunzong.Text = "10"; this.Sunzong.Click += new System.EventHandler(this.label29_Click); @@ -871,19 +864,6 @@ // this.CodePort1.DataReceived += new System.IO.Ports.SerialDataReceivedEventHandler(this.CodePort1_DataReceived_1); // - // timerbar - // - this.timerbar.Interval = 200; - this.timerbar.Tick += new System.EventHandler(this.timerbar_Tick); - // - // progressBar1 - // - this.progressBar1.Location = new System.Drawing.Point(410, 258); - this.progressBar1.Name = "progressBar1"; - this.progressBar1.Size = new System.Drawing.Size(100, 23); - this.progressBar1.TabIndex = 146; - this.progressBar1.Visible = false; - // // button2 // this.button2.Location = new System.Drawing.Point(926, 457); @@ -918,7 +898,7 @@ this.labelyinjian.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.labelyinjian.Location = new System.Drawing.Point(6, 140); this.labelyinjian.Name = "labelyinjian"; - this.labelyinjian.Size = new System.Drawing.Size(95, 16); + this.labelyinjian.Size = new System.Drawing.Size(96, 16); this.labelyinjian.TabIndex = 24; this.labelyinjian.Text = "硬件版本号:"; // @@ -928,7 +908,7 @@ this.labelruanjian.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.labelruanjian.Location = new System.Drawing.Point(6, 71); this.labelruanjian.Name = "labelruanjian"; - this.labelruanjian.Size = new System.Drawing.Size(95, 16); + this.labelruanjian.Size = new System.Drawing.Size(96, 16); this.labelruanjian.TabIndex = 23; this.labelruanjian.Text = "软件版本号:"; // @@ -954,7 +934,7 @@ this.myGroupBox4.Controls.Add(this.label17); this.myGroupBox4.Controls.Add(this.FPlowlimit); this.myGroupBox4.Controls.Add(this.BLeakTPre); - this.myGroupBox4.Location = new System.Drawing.Point(344, 357); + this.myGroupBox4.Location = new System.Drawing.Point(344, 376); this.myGroupBox4.Name = "myGroupBox4"; this.myGroupBox4.Size = new System.Drawing.Size(141, 222); this.myGroupBox4.TabIndex = 122; @@ -1177,7 +1157,7 @@ this.myGroupBox3.Controls.Add(this.DelayTime1); this.myGroupBox3.Controls.Add(this.label39); this.myGroupBox3.Controls.Add(this.DelayTime2); - this.myGroupBox3.Location = new System.Drawing.Point(104, 357); + this.myGroupBox3.Location = new System.Drawing.Point(104, 376); this.myGroupBox3.Name = "myGroupBox3"; this.myGroupBox3.Size = new System.Drawing.Size(234, 222); this.myGroupBox3.TabIndex = 121; @@ -1594,21 +1574,41 @@ // this.UDPOverTime.Tick += new System.EventHandler(this.UDPOverTime_Tick); // + // bigLeak + // + this.bigLeak.AutoSize = true; + this.bigLeak.Font = new System.Drawing.Font("宋体", 36F); + this.bigLeak.Location = new System.Drawing.Point(192, 180); + this.bigLeak.Name = "bigLeak"; + this.bigLeak.Size = new System.Drawing.Size(212, 48); + this.bigLeak.TabIndex = 152; + this.bigLeak.Text = "11111111"; + // + // label41 + // + this.label41.AutoSize = true; + this.label41.Font = new System.Drawing.Font("宋体", 18F); + this.label41.Location = new System.Drawing.Point(195, 155); + this.label41.Name = "label41"; + this.label41.Size = new System.Drawing.Size(142, 24); + this.label41.TabIndex = 150; + this.label41.Text = "大漏泄漏量:"; + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1045, 617); + this.Controls.Add(this.bigLeak); + this.Controls.Add(this.label41); this.Controls.Add(this.groupBox2); this.Controls.Add(this.zhanhao); this.Controls.Add(this.button2); - this.Controls.Add(this.progressBar1); this.Controls.Add(this.groupBox1); this.Controls.Add(this.Scancode); this.Controls.Add(this.label9); this.Controls.Add(this.codecheck); this.Controls.Add(this.checkBox1); - this.Controls.Add(this.Baudrate); this.Controls.Add(this.DataGridView1); this.Controls.Add(this.ChkCSV); this.Controls.Add(this.Leak); @@ -1648,7 +1648,7 @@ this.Controls.Add(this.ReceiveText); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "Form1"; - this.Text = "20240819"; + this.Text = "LL-28_20250923"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing); this.Load += new System.EventHandler(this.Form1_Load); ((System.ComponentModel.ISupportInitialize)(this.DataGridView1)).EndInit(); @@ -1785,7 +1785,6 @@ public System.Windows.Forms.TextBox URL; public System.Windows.Forms.CheckBox ChkCSV; private System.Windows.Forms.Timer Timer11; - public System.Windows.Forms.TextBox Baudrate; private System.Windows.Forms.Label label9; private System.Windows.Forms.CheckBox Scancode; public System.Windows.Forms.TextBox codecheck; @@ -1814,8 +1813,6 @@ private System.Windows.Forms.DataGridViewTextBoxColumn Column17; private System.Windows.Forms.DataGridViewTextBoxColumn Column14; private System.Windows.Forms.DataGridViewTextBoxColumn Column15; - private System.Windows.Forms.Timer timerbar; - private System.Windows.Forms.ProgressBar progressBar1; private System.Windows.Forms.Button button2; private System.Windows.Forms.TextBox zhanhao; public System.Windows.Forms.TextBox Code; @@ -1827,5 +1824,7 @@ private System.Windows.Forms.Label labelruanjian; private System.Windows.Forms.Timer UDPRead; private System.Windows.Forms.Timer UDPOverTime; + private System.Windows.Forms.Label bigLeak; + private System.Windows.Forms.Label label41; } } \ No newline at end of file diff --git a/C-Windows-1/Form1.cs b/C-Windows-1/Form1.cs index b4d196a..bc6bd00 100644 --- a/C-Windows-1/Form1.cs +++ b/C-Windows-1/Form1.cs @@ -29,6 +29,7 @@ namespace C_Windows_1 { public partial class Form1 : Form { + public int liuliangVersion = 0; //流量版本 1 public int stage = 10; private int write = 0; private string timestamp; @@ -62,6 +63,9 @@ namespace C_Windows_1 private Timer timeoutTimer; // 定时器用于控制超时 public int connectflag = 0; + + string[] strPressureUnit = { "Pa", "KPa", "MPa", "bar","Psi", "kg/cm^2", "atm", "mmHg" }; + string[] strListLeakUnit = { "Pa", "KPa", "mbar", "atm", "sccm", "ccm3/s", "Pa/s" }; public Form1() { f1 = this; @@ -372,7 +376,6 @@ namespace C_Windows_1 if (operateResult21.IsSuccess == true) { int aaa; - timerbar.Start(); // grovalue = 100 / ((ReadData[1006] / 10) + (ReadData[1007] / 10) + (ReadData[1008] / 10) + (ReadData[1009] / 10)) ; //grovalueone = (float)(grovalue * 0.0003); //aaa = ReadData[1006] + ReadData[1007] + ReadData[1008] + ReadData[1009]; @@ -491,397 +494,6 @@ namespace C_Windows_1 // ))); } - public void MachineDisplay2()//UI层,吧相应的文本赋值.17.58 - { - switch (workstation) - { - case (int)yiqi.start: - - MachineStatus.Text = "开始测试"; - - break; - case (int)yiqi.rst: - MachineStatus.Text = "复位"; - LeakPressure.Text = ""; - Leak.Text = ""; - label2.Text = ""; - Tlight.Text = ""; - - break; - case (int)yiqi.standby://把状态文本改成文本 - MachineStatus.Text = "待机中"; - - // Tlight.Text = ""; - break; - - case (int)yiqi.prepare://把状态文本改成文本 - Tlight.Text = ""; - break; - - case (int)yiqi.test: - MachineStatus.Text = "测试中"; - - //判断单位 - switch (ReadData[41])// - { - case 1: - PressureUnit.Text = "KPa"; - - break; - case 2: - - PressureUnit.Text = "bar"; - - - break; - case 0: - PressureUnit.Text = "Pa"; - - break; - case 3: - - PressureUnit.Text = "atm"; - - - break; - case 4: - - PressureUnit.Text = "psi"; - - - break; - case 5: - - PressureUnit.Text = "mmHg"; - - - - break; - } - - switch (ReadData[40]) - { - case 0: - - LeakUnit.Text = "Pa"; - break; - - case 1: - - LeakUnit.Text = "Kpa"; - break; - - case 2: - - - LeakUnit.Text = "mbar"; - break; - - case 3: - - LeakUnit.Text = "atm"; - break; - - case 4: - - LeakUnit.Text = "sccm"; - break; - - case 5: - - LeakUnit.Text = "Pa·m3/s"; - - break; - - case 6: - - LeakUnit.Text = "Pa/s"; - break; - } - if (ReadData[9] == 2) - { - - Tlight.Text = "NG"; - Tlight.ForeColor = Color.Red; - } - if (ReadData[9] == 1) - { - Tlight.Text = "OK"; - Tlight.ForeColor = Color.Green; - } - //CH1文本框读取的压力和泄漏量 - LeakPressure.Text = TwoUInt16ToFloat(ReadData[17], ReadData[16]).ToString(); - Leak.Text = TwoUInt16ToFloat(ReadData[19], ReadData[18]).ToString("f1"); - - break; - - case (int)yiqi.finish: - progressBar2.Value = progressBar2.Maximum; - if (ReadData[9] == 2) - { - Tlight.Enabled = true; - Tlight.Visible = true; - Tlight.Text = "NG"; - Tlight.ForeColor = Color.Red; - } - // if(ReadData[60] == 1 && ReadData[61] == 1) - //{ - // Tlight.Text = "OK"; - // Tlight.ForeColor = Color.Green; - // Tlight2.Text = "OK"; - // Tlight2.ForeColor = Color.Green; - //} - if (ReadData[9] == 1) - { - Tlight.Text = "OK"; - Tlight.ForeColor = Color.Green; - } - LeakPressure.Text = TwoUInt16ToFloat(ReadData[17], ReadData[16]).ToString(); - Leak.Text = TwoUInt16ToFloat(ReadData[19], ReadData[18]).ToString("f1"); - MachineStatus.Text = "测试结束"; - - - break; - default: break; - - } - } - - public void machine()//主要负责测试数据读取,写入 - { - //Invoke((new System.Action(() => - //{ - - switch (workstation) - { - case (int)yiqi.start: - - operateResult22 = CH1.Write("540", true); - //MachineStatus.Text = "开始测试"; - ////Console.WriteLine("当前是启动状态"); - if (operateResult22.IsSuccess) - { - // operateResult22 = CH1.Write("85", false); - workstation = (int)yiqi.prepare; - } - break; - //return workstation; - - - - case (int)yiqi.rst: - - operateResult21 = CH1.Write("86", true); - - //点击复位进度条置为0 - progressBar2.Value = 0; - if (operateResult21.IsSuccess) - { - workstation = (int)yiqi.standby; - } - - - break; - //return workstation; - - - case (int)yiqi.prepare://读取检测时间,充气,平衡检测 //扫码枪处理 上传 - ReadData[9] = 0; - operateResult21 = Modbusread(25, 6, ReadData); - Tlight.Text = ""; - if (operateResult21.IsSuccess == true) - { - int aaa; - aaa = ReadData[25] + ReadData[26] + ReadData[27] + ReadData[28] + ReadData[30]; - progressBar2.Value = 0; - progressBar2.Maximum = aaa; - //进度条开始,满值是a,一秒进10; - // - workstation = (int)yiqi.test; - } - - break; - //return workstation; - - - - case (int)yiqi.test://读取检测数据以及判断仪器是否结束 - //operateResult21=Modbusread(170, 23, ReadData); - Modbusread(8, 2, ReadData); - Modbusread(16, 4, ReadData); - Modbusread(25, 24, ReadData); - Booltomath(8, ReadData); - Booltomath(9, ReadData); - int ba = progressBar2.Value + 2; - if (ba >= progressBar2.Maximum) - ba = progressBar2.Maximum; - progressBar2.Value = ba; - //MachineStatus.Text = "测试中"; - - ////判断单位 - //switch (ReadData[41]) - //{ - // case 1: - // PressureUnit.Text = "KPa"; - - // break; - // case 2: - - // PressureUnit.Text = "bar"; - - - // break; - // case 0: - // PressureUnit.Text = "Pa"; - - // break; - // case 3: - - // PressureUnit.Text = "atm"; - - - // break; - // case 4: - - // PressureUnit.Text = "psi"; - - - // break; - // case 5: - - // PressureUnit.Text = "mmHg"; - - - - // break; - //} - - //switch (ReadData[40]) - //{ - // case 0: - - // LeakUnit.Text = "Pa"; - // break; - - // case 1: - - // LeakUnit.Text = "Kpa"; - // break; - - // case 2: - - - // LeakUnit.Text = "mbar"; - // break; - - // case 3: - - // LeakUnit.Text = "atm"; - // break; - - // case 4: - - // LeakUnit.Text = "sccm"; - // break; - - // case 5: - - // LeakUnit.Text = "Pa·m3/s"; - - // break; - - // case 6: - - // LeakUnit.Text = "Pa/s"; - // break; - //} - //if (ReadData[9] == 2) - //{ - // Tlight.Enabled = true; - // Tlight.Visible = true; - // Tlight.Text = "NG"; - // Tlight.ForeColor = Color.Red; - //} - //if (ReadData[9] == 1) - //{ - // Tlight.Text = "OK"; - // Tlight.ForeColor = Color.Green; - //} - ////CH1文本框读取的压力和泄漏量 - //LeakPressure.Text = TwoUInt16ToFloat(ReadData[17], ReadData[16]).ToString(); - //Leak.Text = TwoUInt16ToFloat(ReadData[19], ReadData[18]).ToString("f3"); - if (ReadData[8] != 0 && (ReadData[9] == 1 || ReadData[9] == 2))//当仪器状态位不为0且有结果时 - { - workstation = (int)yiqi.finish; - - } - if (ReadData[8] == 0) - { - System.Threading.Thread.Sleep(300); - Modbusread(8, 2, ReadData); - Booltomath(9, ReadData); - if (ReadData[9] == 1 || ReadData[9] == 2) - { - workstation = (int)yiqi.finish; - } - else - { - progressBar2.Value = 0; - workstation = (int)yiqi.standby; - } - } - - break; - - - - case (int)yiqi.standby://读取仪器是否启动 - Modbusread(8, 2, ReadData); - Booltomath(8, ReadData); - Booltomath(9, ReadData); - //MachineStatus.Text = "待机中"; - if (ReadData[8] != 0 && ReadData[9] == 0) - { - workstation = (int)yiqi.prepare; - } - - - break; - - - - case (int)yiqi.finish: - Modbusread(8, 2, ReadData); - Booltomath(8, ReadData); - Booltomath(9, ReadData); - Modbusread(16, 4, ReadData); - progressBar2.Value = progressBar2.Maximum; - Display(); - CreateFile(); - //Passzong.Text = ChanPass.ToString(); - //Sunzong.Text = ChanSum.ToString(); - //string path = System.Environment.CurrentDirectory + "\\Config\\Config.ini"; - //ConfigINI config = new ConfigINI(path); - //config.IniWriteValue("Config", "Passzong", Passzong.Text); - //config.IniWriteValue("Config", "Sunzong", Sunzong.Text); - Code.Clear(); - workstation = (int)yiqi.standby; - - - // return workstation; - break; - - default: - break; - //return 0;break; - - - } - //} - // ))); - } - - public void MachineDisplay()//UI层,吧相应的文本赋值.17.58 { @@ -900,6 +512,7 @@ namespace C_Windows_1 Leak.Text = ""; label2.Text = ""; Tlight.Text = ""; + bigLeak.Text = ""; break; case (int)yiqi.standby://把状态文本改成文本 @@ -914,81 +527,8 @@ namespace C_Windows_1 case (int)yiqi.test: MachineStatus.Text = "测试中"; - - //判断单位 - switch (ReadData[1027])// - { - case 1: - PressureUnit.Text = "KPa"; - - break; - case 2: - - PressureUnit.Text = "bar"; - - - break; - case 0: - PressureUnit.Text = "Pa"; - - break; - case 3: - - PressureUnit.Text = "atm"; - - - break; - case 4: - - PressureUnit.Text = "psi"; - - - break; - case 5: - - PressureUnit.Text = "mmHg"; - - - - break; - } - - switch (ReadData[1028]) - { - case 0: - - LeakUnit.Text = "Pa"; - break; - - case 1: - - LeakUnit.Text = "Kpa"; - break; - - case 2: - - - LeakUnit.Text = "mbar"; - break; - - case 3: - - LeakUnit.Text = "atm"; - break; - - case 4: - - LeakUnit.Text = "sccm"; - break; - - case 5: - - LeakUnit.Text = "Pa/s"; - - break; - - - } + PressureUnit.Text = strPressureUnit[ReadData[1027]]; + LeakUnit.Text = strListLeakUnit[ReadData[1028]]; if (ReadData[1041] == 2) { Tlight.Enabled = true; @@ -1002,8 +542,9 @@ namespace C_Windows_1 Tlight.ForeColor = Color.Green; } //CH1文本框读取的压力和泄漏量 - LeakPressure.Text = TwoUInt16ToFloat(ReadData[1049], ReadData[1048]).ToString("f3"); - Leak.Text = TwoUInt16ToFloat(ReadData[1039], ReadData[1038]).ToString("f3"); + LeakPressure.Text = TwoUInt16ToFloat(ReadData[1049], ReadData[1048]).ToString("f3") + " " + strPressureUnit[ReadData[1027]]; + Leak.Text = TwoUInt16ToFloat(ReadData[1039], ReadData[1038]).ToString("f3") + " " + strListLeakUnit[ReadData[1028]]; + bigLeak.Text = TwoUInt16ToFloat(ReadData[1036], ReadData[1035]).ToString("f3") + " " + strListLeakUnit[4]; break; @@ -1024,15 +565,11 @@ namespace C_Windows_1 Tlight.Text = "OK"; Tlight.ForeColor = Color.Green; } - LeakPressure.Text = TwoUInt16ToFloat(ReadData[1049], ReadData[1048]).ToString("f3"); - Leak.Text = TwoUInt16ToFloat(ReadData[1039], ReadData[1038]).ToString("f3"); - - - + LeakPressure.Text = TwoUInt16ToFloat(ReadData[1049], ReadData[1048]).ToString("f3") + " " + strPressureUnit[ReadData[1027]]; + Leak.Text = TwoUInt16ToFloat(ReadData[1039], ReadData[1038]).ToString("f3") + " " + strListLeakUnit[ReadData[1028]]; + bigLeak.Text = TwoUInt16ToFloat(ReadData[1036], ReadData[1035]).ToString("f3") + " " + strListLeakUnit[4]; MachineStatus.Text = "测试结束"; - - break; default: break; @@ -1113,6 +650,7 @@ namespace C_Windows_1 Leak.Text = " "; LeakPressure.Text = " "; MESStatus.Text = ""; + bigLeak.Text = ""; //Scancode.Checked = true; //修改密码ToolStripMenuItem.Enabled = false; //串口设置ToolStripMenuItem.Enabled = false; @@ -1129,13 +667,11 @@ namespace C_Windows_1 //modbusClient.ReceiveTimeOut = 1000; - - - - - - - + if (liuliangVersion == 1) //流量版本 + { + label41.Text = "平衡流量:"; + label31.Text = "测试流量:"; + } Task.Run(() => { @@ -1390,603 +926,17 @@ namespace C_Windows_1 } Log log = new Log(); - //根据变量判断仪器过程,对读取的数据进行不同的转换 - private void Stagenum() - { - //try - //{ - // switch (stage) - // { - // case 0://利用定时器进入状态位读取 - // Timer1.Interval = 100; - // Timer1.Start(); - // // Timer2.Interval = 10; - // // Timer2.Start(); - // stage = 1; - // break; - // case 1://此时为状态位读取 - // string str1; - // str1 = ReceiveText.Text; - - // if (str1.Length >= 8 && str1.Substring(6, 2) == "01") - // { - // Timer1.Stop(); - // Timer2.Interval = 300; - // Timer2.Start(); - // MachineStatus.ForeColor = Color.Green; - // MachineStatus.Text = "启动中"; - // log.Logmsg(DateTime.Now.ToString("yyy-MM-dd HH:mm:ss")+"启动"); - // Tlight.Text = " "; - // BtnStart.Enabled = false; - // Code.Enabled = false; - // Leak.Text = ""; - // LeakPressure.Text = ""; - // MESStatus.Text = ""; - // progressBar2.Value = 0; - // 测试参数ToolStripMenuItem.Enabled = false; - // write = 0; - // // sum = 0; - // } - // break; - - // case 2://此时为读取参数并数据转换 - - // Timer2.Stop(); - // string str2; - // str2 = ReceiveText.Text; - // // str2 = str2.Replace(" ", ""); - - // if (str2.Length > 122) - // { - // string hexstring_full = str2.Substring(26, 4); - // string hexstring_balan = str2.Substring(30, 4); - // string hexstring_test = str2.Substring(34, 4); - // string hexstring_exhasut = str2.Substring(38, 4); - // string hexstring_bypass = str2.Substring(42, 4); - // string hexstring_delay1 = str2.Substring(46, 4); - // string hexstring_delay2 = str2.Substring(50, 4); - - // string hexstring_bleakbalan = str2.Substring(62, 4); - // string hexstring_sleakbalan = str2.Substring(66, 4); - // string hexstring_bleaktoppre = str2.Substring(70, 4); - // string hexstring_bleaklowpre = str2.Substring(74, 4); - - // // string hexstring_bleaktest = str2.Substring(124, 4); - - // string hexstring_lunit = str2.Substring(86, 4); - // string hexstring_punit = str2.Substring(90, 4); - - // //十六进制转十进制 - // int full = Int32.Parse(hexstring_full, System.Globalization.NumberStyles.HexNumber) / 10; - // int balan = Int32.Parse(hexstring_balan, System.Globalization.NumberStyles.HexNumber) / 10; - // int test = Int32.Parse(hexstring_test, System.Globalization.NumberStyles.HexNumber) / 10; - - // double exhaust = Convert.ToDouble(Convert.ToInt32(hexstring_exhasut, 16)) / 10; - - // int bypass = Int32.Parse(hexstring_bypass, System.Globalization.NumberStyles.HexNumber) / 10; - - // double delay1 = Int32.Parse(hexstring_delay1, System.Globalization.NumberStyles.HexNumber); - // double delay2 = Int32.Parse(hexstring_delay2, System.Globalization.NumberStyles.HexNumber); - // double delay11 = delay1 / 10; - // double delay22 = delay2 / 10; - - // int bleakbalan = Int32.Parse(hexstring_bleakbalan, System.Globalization.NumberStyles.HexNumber) / 10; - // int sleakbalan = Int32.Parse(hexstring_sleakbalan, System.Globalization.NumberStyles.HexNumber) / 10; - // int bleaktoppre = Int32.Parse(hexstring_bleaktoppre, System.Globalization.NumberStyles.HexNumber); - // int bleaklowpre = Int32.Parse(hexstring_bleaklowpre, System.Globalization.NumberStyles.HexNumber); - - // // int bleaktest = Int32.Parse(hexstring_bleaktest, System.Globalization.NumberStyles.HexNumber) / 10; - - // int lunit = Int32.Parse(hexstring_lunit, System.Globalization.NumberStyles.HexNumber); - // int punit = Int32.Parse(hexstring_punit, System.Globalization.NumberStyles.HexNumber); - - // delaytime = delay11 + delay22; - - // FullTime.Text = full.ToString(); - // BalanTime.Text = balan.ToString(); - // TestTime1.Text = test.ToString(); - // ExhaustTime.Text = exhaust.ToString(); - // BypassTIme.Text = bypass.ToString(); - // DelayTime1.Text = delay11.ToString(); - // DelayTime2.Text = delay22.ToString(); - - // BBalanTime.Text = bleakbalan.ToString(); - // SBalanTime.Text = sleakbalan.ToString(); - // // TestTime2 .Text = bleaktest.ToString(); - // BLeakTPre.Text = bleaktoppre.ToString(); - // if (bleaklowpre > 32767) - // { - // string bleaklowpre2 = "FFFFFFFFFFFF" + hexstring_bleaklowpre; - // long bleaklowpre3 = Convert.ToInt64(bleaklowpre2, 16); - // BLeakLPre.Text = bleaklowpre3.ToString(); - // } - // else - // { - // BLeakLPre.Text = bleaklowpre.ToString(); - // } - - // if (lunit < 6 && punit < 8) - // { - // LUnit.SelectedIndex = lunit; - // PUnit.SelectedIndex = punit; - // } - // else - // { - // Timer2.Interval = 300; - // Timer2.Start(); - // } - - // PressureUnit.Text = PUnit.Text; - - // LeakUnit.Text = LUnit.Text; - - // string hexstring_fptop1 = str2.Substring(54, 4); - // string hexstring_fptop2 = str2.Substring(58, 4); - // string hexstring_fptop = hexstring_fptop2 + hexstring_fptop1; - - // string hexstring_ltop1 = str2.Substring(78, 4); - // string hexstring_ltop2 = str2.Substring(82, 4); - // string hexstring_ltop = hexstring_ltop2 + hexstring_ltop1; - - // string hexstring_evol1 = str2.Substring(94, 4); - // string hexstringg_evol2 = str2.Substring(98, 4); - // string hexstringg_evol = hexstringg_evol2 + hexstring_evol1; - - // string hexstring_llow1 = str2.Substring(102, 4); - // string hexstring_llow2 = str2.Substring(106, 4); - // string hexstring_llow = hexstring_llow2 + hexstring_llow1; - - // string hexstring_fplow1 = str2.Substring(110, 4); - // string hexstring_fplow2 = str2.Substring(114, 4); - // string hexstring_fplow = hexstring_fplow2 + hexstring_fplow1; - - // string bleaktesttime = str2.Substring(118, 4); - // int testtime2 = Convert.ToInt32(bleaktesttime, 16) / 10; - // TestTime2.Text = testtime2.ToString(); - - // UInt32 x1 = Convert.ToUInt32(hexstring_fptop, 16);//字符串转16进制32位无符号整数 - // FPtoplimit.Text = BitConverter.ToSingle(BitConverter.GetBytes(x1), 0).ToString();//IEEE754 字节转换float - // UInt32 x2 = Convert.ToUInt32(hexstring_ltop, 16);//字符串转16进制32位无符号整数 - // Leaktoplimit.Text = BitConverter.ToSingle(BitConverter.GetBytes(x2), 0).ToString();//IEEE754 字节转换float - // UInt32 x3 = Convert.ToUInt32(hexstringg_evol, 16);//字符串转16进制32位无符号整数 - // Evolume.Text = BitConverter.ToSingle(BitConverter.GetBytes(x3), 0).ToString();//IEEE754 字节转换float - // UInt32 x4 = Convert.ToUInt32(hexstring_llow, 16);//字符串转16进制32位无符号整数 - // Leaklowlimit.Text = BitConverter.ToSingle(BitConverter.GetBytes(x4), 0).ToString();//IEEE754 字节转换float - // UInt32 x5 = Convert.ToUInt32(hexstring_fplow, 16);//字符串转16进制32位无符号整数 - // FPlowlimit.Text = BitConverter.ToSingle(BitConverter.GetBytes(x5), 0).ToString();//IEEE754 字节转换float - // // UInt32 x6 = Convert.ToUInt32(hexstring21, 16);//字符串转16进制32位无符号整数 - // // Leaktoplimit.Text = BitConverter.ToSingle(BitConverter.GetBytes(x6), 0).ToString();//IEEE754 字节转换float - - // int exhausttime = Convert.ToInt32(exhaust); - // int a = full + balan + test + testtime2 + exhausttime; - // if (a > 50) - // { - // progressBar2.Maximum = (full + balan + test + testtime2 + exhausttime - 2) * 10; - // } - // else - // { - // progressBar2.Maximum = (full + balan + test + testtime2 + exhausttime - 1) * 10; - // } - // Timer4.Interval = Convert.ToInt32((full + balan + test + testtime2 + exhaust) * 1000); - // Timer4.Start(); - // Timer8.Interval = Convert.ToInt32(delaytime * 1000 + 1); - // Timer8.Start(); - - // Timer3.Interval = 300; - // Timer3.Start(); - // } - // else - // { - // Timer2.Interval = 300; - // Timer2.Start(); - // } - - // break; - - // case 3://循环读取测试结果 - // string str4; - // str4 = ReceiveText.Text; - // // str4 = str4.Replace(" ", ""); - // Timer3.Stop(); - // if (str4.Length > 54 && str4.Substring(2, 2) == "03") - // { - // string status1 = str4.Substring(6, 4); - // int status = Convert.ToInt32(status1, 16); - // switch (status) - // { - // case 1: - // TestStatus.Text = "准备"; - // break; - - // case 2: - // TestStatus.Text = "充气"; - // fullpressure = LeakPressure.Text; - // break; - - // case 3: - // TestStatus.Text = "平衡"; - // balanpressure = LeakPressure.Text; - // break; - - // case 4: - // TestStatus.Text = "检测"; - // break; - - // case 5: - // TestStatus.Text = "排气"; - // break; - // } - - // string lp1 = str4.Substring(42, 4); - // string lp2 = str4.Substring(38, 4); - // string lp5 = lp1 + lp2; - // string lp3 = str4.Substring(50, 4); - // string lp4 = str4.Substring(46, 4); - // string lp6 = lp3 + lp4; - - // UInt32 b1 = Convert.ToUInt32(lp5, 16);//字符串转16进制32位无符号整数 - // LeakPressure.Text = BitConverter.ToSingle(BitConverter.GetBytes(b1), 0).ToString("F3");//IEEE754 字节转换float - // Debug.WriteLine("LeakPressure: " + LeakPressure.Text); - // UInt32 b2 = Convert.ToUInt32(lp6, 16);//字符串转16进制32位无符号整数 - // Leak.Text = BitConverter.ToSingle(BitConverter.GetBytes(b2), 0).ToString("F3");//IEEE754 字节转换float - // Debug.WriteLine("Leak: " + Leak.Text); - // string result1 = str4.Substring(10, 4); - // int result = Convert.ToInt32(result1, 16); - // if (result == 1) - // { - // DLeakPressure = LeakPressure.Text; - // DLeak = Leak.Text; - // Tlight.Text = "OK"; - // Tlight.ForeColor = Color.Green; - // Timer11.Start(); - // //SendText.Text = Station.Text + "05 02 1D FF 00"; - // //Send(); - // } - // else if (result == 2) - // { - // DLeakPressure = LeakPressure.Text; - // DLeak = Leak.Text; - // Tlight.Text = "NG"; - // SendText.Text = Station.Text + "05 02 1D FF 00"; - // Send(); - // Tlight.ForeColor = Color.Red; - - // if (delaytime > 0) - // { - // Timer9.Interval = Convert.ToInt32(Convert.ToDouble(ExhaustTime.Text) * 2000); - // Timer9.Start(); - // } - // else - // { - // Timer9.Interval = Convert.ToInt32(Convert.ToDouble(ExhaustTime.Text) * 1000); - // Timer9.Start(); - // } - - // Timer11.Start(); - // } - // else - // { - // Timer3.Interval = 150; - // Timer3.Start(); - // } - // } - // else - // { - // Timer3.Interval = 150; - // Timer3.Start(); - // } - - // break; - - // case 4: - // Timer1.Interval = 100; - // Timer1.Start(); - // stage = 5; - // break; - - // case 5: - - // //对仪器是否结束的判断 - // /* string str5; - // str5 = ReceiveText.Text; - // if (str5.Substring(6, 2) == "00") - // { - // Timer1.Stop(); - - // BtnStart.Enabled = true; - // Code.Enabled = true; - - // if (write == 0) - // { - // timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - - // CreateFile(); - // Display(); - // stage = 10; - // MachineStatus.ForeColor = Color.Red; - // MachineStatus.Text = "待机中"; - // } - // else - // { - // stage = 10; - // MachineStatus.ForeColor = Color.Red; - // MachineStatus.Text = "待机中"; - // } - // Code.ResetText(); - // Code.ScrollToCaret(); - // Code.Focus(); - // Timer1.Interval = 800; - // Timer1.Start(); - // stage = 1; - - // if (串口设置ToolStripMenuItem.Enabled is true) - // { - // 测试参数ToolStripMenuItem.Enabled = true; - // } - // } - // */ - - // string str5; - // str5 = ReceiveText.Text; - // //if (str5.Substring(6, 2) == "00") - // log.Logmsg("进入Case:5" +str5); - // if (str5.Length >= 78 && str5.StartsWith("020328")) - // { - // log.Logmsg("进入Case:5判断" + str5); - // Timer11.Stop(); - // string hex = str5.Substring(6, 74); - // string hexString = string.Join(" ", Regex.Matches(hex, @"..").Cast().ToList()); - // StringBuilder sbBuffer = new StringBuilder(); - // string strArr1; - // string strArr2; - - // for (int i = 0; i < hexString.Split(' ').Length - 1; i = i + 2) - // { - // strArr1 = hexString.Split(' ')[i]; - // strArr2 = hexString.Split(' ')[i + 1]; - // sbBuffer.Append(strArr2).Append(" ").Append(strArr1).Append(" "); - // } - // string hexStringNew = sbBuffer.ToString().TrimEnd(); - // string tempBarCode = (ToStringFromHexString(hexStringNew, Encoding.UTF8)); - // string stringNew = string.Empty; - - // if (tempBarCode.Contains("\0")) - // { - // stringNew = Regex.Unescape(tempBarCode); - // int index = stringNew.IndexOf("\0"); - // stringNew = stringNew.Remove(index); - // } - // else - // { - // stringNew = tempBarCode; - // } - // Debug.WriteLine("str:" + str5 + Environment.NewLine); - // Debug.WriteLine("hex:" + hex + Environment.NewLine); - // Debug.WriteLine("tempBarCode:" + tempBarCode + Environment.NewLine); - // Debug.WriteLine("stringNew:" + stringNew + Environment.NewLine); - // string barCode = stringNew.Replace("\0", "").Replace("\r", "").Replace("\n", "").Replace("\r\n", ""); - // Debug.WriteLine("barCode:" + barCode + Environment.NewLine); - // if (string.IsNullOrEmpty(barCode)) - // { - // //MessageBox.Show("录入条码为空"); - // } - // if (!string.IsNullOrEmpty(barCode)) - // { - // if (barCode.Length > Convert.ToInt32(CodeLength.Text)) - // { - // // MessageBox.Show("录入条码长度大于设置条码长度"); - // } - // } - // Code.Text = barCode; - // //BtnStart.Enabled = true; - // //Code.Enabled = true; - // //if (write == 0) - // //{ - // // timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - // // CreateFile(); - // // Display(); - // // stage = 10; - // // MachineStatus.ForeColor = Color.Red; - // // MachineStatus.Text = "待机中"; - // //} - // //else - // //{ - // // stage = 10; - // // MachineStatus.ForeColor = Color.Red; - // // MachineStatus.Text = "待机中"; - // //} - // //Code.ResetText(); - // //Code.ScrollToCaret(); - // //Code.Focus(); - // stage = 6; - - // //if (串口设置ToolStripMenuItem.Enabled is true) - // //{ - // // 测试参数ToolStripMenuItem.Enabled = true; - // //} - // } - // break; - - // case 6://读取条码 - // string str6; - // str6 = ReceiveText.Text; - // log.Logmsg("进入Case6:" + str6); - // if (str6.Length >= 8 && str6.Substring(6, 2) == "00") - // { - // Timer1.Stop(); - - // BtnStart.Enabled = true; - // Code.Enabled = true; - // log.Logmsg("设备待机"); - // if (write == 0) - // { - // timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - // CreateFile(); - // Display(); - // State(); - // stage = 1; - // MachineStatus.ForeColor = Color.Red; - // MachineStatus.Text = "待机中"; - // } - // else - // { - // State(); - // stage = 1; - // MachineStatus.ForeColor = Color.Red; - // MachineStatus.Text = "待机中"; - // } - // Code.ResetText(); - // Code.ScrollToCaret(); - // Code.Focus(); - // Timer1.Interval = 800; - // Timer1.Start(); - // stage = 1; - - // if (串口设置ToolStripMenuItem.Enabled is true) - // { - // 测试参数ToolStripMenuItem.Enabled = true; - // } - // } - // else - // { - // State(); - // stage = 6; - // MachineStatus.Text = "未复位"; - // MachineStatus.ForeColor = Color.Red; - - // } - // break; - // } - //} - //catch (Exception ex) - //{ - // MessageBox.Show(ex.Message); - //} - - } - - //发送过程 - private void Send() - { - //try - //{ - // //将CRC冗余码添加进指令中 - // String str = SendText.Text; - // byte[] byt = StrtoHexbyte(str); - // int str2; - // str2 = Crc16_Modbus(byt, byt.Length); - // //byte byte1 =(byte)((str2 >> 8)&0xff); - // string str3; - // // str3=(( str2 >> 8) & 0xff).ToString (); - // str3 = Convert.ToString((str2 >> 8) & 0xff, 16); - // string str4; - // str4 = Convert.ToString(str2 & 0xff, 16); - // // string str4; - // // str4 = (str2 & 0xff).ToString(); - // // string str3; - // if (str3.Length == 1) - // { - // str3 = "0" + str3; - // // textBox2.Text = textBox2.Text + str4 + str3; - // } - // if (str4.Length == 1) - // { - // str4 = "0" + str4; - // // textBox2.Text = textBox2.Text + str4 + str3; - // } - // SendText.Text = SendText.Text + str4 + str3; - // String str5 = SendText.Text; - // if (str5.Length > 0) - // { - // byte[] byt2 = StrtoHexbyte(str5); - // SerialPort1.Write(byt2, 0, byt2.Length);//发送数据 - // } - //} - //catch (Exception ex) - //{ - // Timer1.Stop(); - // Timer2.Stop(); - // Timer3.Stop(); - // Timer4.Stop(); - - // Timer8.Stop(); - // Timer9.Stop(); - // Timer10.Stop(); - // Timer11.Stop(); - // Timer16.Stop(); - // MessageBox.Show(ex.Message); - //} - } - - //计算CRC冗余码 - private int Crc16_Modbus(byte[] modbusdata, int length) - { - int i, j; - int crc = 0xffff;//0xffff or 0 - for (i = 0; i < length; i++) - { - crc ^= modbusdata[i] & 0xff; - for (j = 0; j < 8; j++) - { - if ((crc & 0x01) == 1) - { - crc = (crc >> 1) ^ 0xa001; - } - else - { - crc >>= 1; - } - } - } - - return crc; - } - - //将发送数据转为十六进制数据 - private static byte[] StrtoHexbyte(String hexstring) - { - int i; - hexstring = hexstring.Replace(" ", ""); - - byte[] returnBytes = new byte[(hexstring.Length) / 2]; - try - { - for (i = 0; i < returnBytes.Length; i++) - { - returnBytes[i] = Convert.ToByte(hexstring.Substring(i * 2, 2), 16); - } - } - catch (Exception ex) - { - MessageBox.Show(ex.Message); - return null; - } - return returnBytes; - } //启动仪器 private void BtnStart_Click(object sender, EventArgs e) { try { - //if (string.IsNullOrEmpty(Form1.f1.CodeLength.Text)) - //{ - // MessageBox.Show("请设定条码长度", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; - //} - //if (Convert.ToInt32(Form1.f1.CodeLength.Text) <= 2) - //{ - // MessageBox.Show("条码长度设置错误", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; - //} - modbusClient.Write("0", true); - - //workstation = (int)yiqi.start; - - - //workstation = (int)yiqi.start; - //Code.Focus(); - - + if (modbusClient != null) + { + modbusClient.Write("0", true); + } } catch (Exception ex) { @@ -2027,15 +977,6 @@ namespace C_Windows_1 } - //读参数 - private void Parameters() - { - SendText.Text = Station.Text + " 03 00 14 00 1D"; - // CrcNum(); - Send(); - stage = 2; - } - //读参数的定时器 private void Timer2_Tick(object sender, EventArgs e) { @@ -2695,14 +1636,6 @@ namespace C_Windows_1 checkBox1.Checked = Convert.ToBoolean(regName.GetValue("codelengthcheck").ToString()); } - if (regName.GetValue("Baudrate") is null) - { - Baudrate.Text = "9600"; - } - else - { - Baudrate.Text = regName.GetValue("Baudrate").ToString(); - } if (regName.GetValue("station") is null) { @@ -3006,15 +1939,6 @@ namespace C_Windows_1 } } - private void timerbar_Tick(object sender, EventArgs e) - { - Invoke(new Action(() => - { - progressBar1.Value += 1; - })); - - } - OperateResult changestation=new OperateResult(); public static string station; diff --git a/C-Windows-1/Form1.resx b/C-Windows-1/Form1.resx index 9848000..b7a264a 100644 --- a/C-Windows-1/Form1.resx +++ b/C-Windows-1/Form1.resx @@ -183,57 +183,6 @@ True - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - 670, 5 @@ -255,9 +204,6 @@ 1042, 6 - - 1159, 6 - 1264, 6 diff --git a/C-Windows-1/PortSetting.cs b/C-Windows-1/PortSetting.cs index 2337845..738890d 100644 --- a/C-Windows-1/PortSetting.cs +++ b/C-Windows-1/PortSetting.cs @@ -91,7 +91,6 @@ namespace C_Windows_1 Baudrate.Enabled = false; SetPort(); Form1.f1.PortNum.Text = PortNum.Text; - Form1.f1.Baudrate.Text = Baudrate.Text; } else diff --git a/C-Windows-1/Properties/AssemblyInfo.cs b/C-Windows-1/Properties/AssemblyInfo.cs index c95b25f..d611af6 100644 --- a/C-Windows-1/Properties/AssemblyInfo.cs +++ b/C-Windows-1/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ using System.Runtime.InteropServices; //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 //通过使用 "*",如下所示: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("1.0.0.1")] +[assembly: AssemblyFileVersion("1.0.0.1")] diff --git a/C-Windows-1/TestPara.Designer.cs b/C-Windows-1/TestPara.Designer.cs index 035af88..46de4e9 100644 --- a/C-Windows-1/TestPara.Designer.cs +++ b/C-Windows-1/TestPara.Designer.cs @@ -318,8 +318,9 @@ "Pa", "KPa", "mbar", + "atm", "sccm", - "ccm/s", + "ccm3/s", "Pa/s"}); this.LUnit.Location = new System.Drawing.Point(20, 222); this.LUnit.Name = "LUnit"; diff --git a/C-Windows-1/TestPara.cs b/C-Windows-1/TestPara.cs index f77f275..3bdb623 100644 --- a/C-Windows-1/TestPara.cs +++ b/C-Windows-1/TestPara.cs @@ -14,6 +14,15 @@ namespace C_Windows_1 public TestPara() { InitializeComponent(); + + if (Form1.f1.liuliangVersion == 1) + { + label44.Text = "平衡流量上限"; + label45.Text = "平衡流量下限"; + + label16.Text = "测试流量上限"; + label17.Text = "测试流量下限"; + } } @@ -371,8 +380,6 @@ namespace C_Windows_1 label25.Text = PUnit.Text; label28.Text = LUnit.Text; label29.Text = LUnit.Text; - - } diff --git a/C-Windows-1/bin/Debug/LL28-Control.exe b/C-Windows-1/bin/Debug/LL28-Control.exe index f7fee79..e150b96 100644 Binary files a/C-Windows-1/bin/Debug/LL28-Control.exe and b/C-Windows-1/bin/Debug/LL28-Control.exe differ diff --git a/C-Windows-1/obj/Debug/C-Windows-LL18.csproj.FileListAbsolute.txt b/C-Windows-1/obj/Debug/C-Windows-LL18.csproj.FileListAbsolute.txt index e9ebd50..d2facd0 100644 --- a/C-Windows-1/obj/Debug/C-Windows-LL18.csproj.FileListAbsolute.txt +++ b/C-Windows-1/obj/Debug/C-Windows-LL18.csproj.FileListAbsolute.txt @@ -1121,3 +1121,83 @@ C:\Users\Administrator\Desktop\git\ll-28\C-Windows-1\obj\Debug\C-Windows-LL18.cs C:\Users\Administrator\Desktop\git\ll-28\C-Windows-1\obj\Debug\C-Window.5B87B986.Up2Date C:\Users\Administrator\Desktop\git\ll-28\C-Windows-1\obj\Debug\LL28-Control.exe C:\Users\Administrator\Desktop\git\ll-28\C-Windows-1\obj\Debug\LL28-Control.pdb +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\LL28-Control.exe.config +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\LL28-Control.exe +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\LL28-Control.pdb +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\BouncyCastle.Cryptography.dll +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\Enums.NET.dll +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\ExtendedNumerics.BigDecimal.dll +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\HslCommunication.dll +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\ICSharpCode.SharpZipLib.dll +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\MathNet.Numerics.dll +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\Microsoft.IO.RecyclableMemoryStream.dll +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\Newtonsoft.Json.dll +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\NPOI.Core.dll +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\NPOI.OOXML.dll +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\NPOI.OpenXml4Net.dll +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\NPOI.OpenXmlFormats.dll +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\SixLabors.Fonts.dll +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\SixLabors.ImageSharp.dll +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\System.Buffers.dll +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\System.Memory.dll +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\System.Numerics.Vectors.dll +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\System.Runtime.CompilerServices.Unsafe.dll +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\System.Security.AccessControl.dll +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\System.Security.Cryptography.Pkcs.dll +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\System.Security.Cryptography.Xml.dll +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\System.Security.Principal.Windows.dll +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\System.Text.Encoding.CodePages.dll +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\System.ValueTuple.dll +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\ZXing.Net.Mobile.Core.dll +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\zxing.portable.dll +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\ZXingNetMobile.dll +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\BouncyCastle.Cryptography.xml +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\Enums.NET.pdb +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\Enums.NET.xml +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\ExtendedNumerics.BigDecimal.xml +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\HslCommunication.xml +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\ICSharpCode.SharpZipLib.pdb +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\ICSharpCode.SharpZipLib.xml +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\MathNet.Numerics.xml +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\Microsoft.IO.RecyclableMemoryStream.xml +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\Newtonsoft.Json.xml +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\NPOI.Core.pdb +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\NPOI.Core.xml +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\NPOI.OOXML.pdb +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\NPOI.OOXML.xml +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\NPOI.OpenXml4Net.pdb +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\NPOI.OpenXml4Net.xml +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\NPOI.OpenXmlFormats.pdb +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\NPOI.OpenXmlFormats.xml +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\SixLabors.Fonts.xml +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\SixLabors.ImageSharp.xml +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\System.Buffers.xml +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\System.Memory.xml +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\System.Numerics.Vectors.xml +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\System.Runtime.CompilerServices.Unsafe.xml +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\System.Security.AccessControl.xml +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\System.Security.Cryptography.Pkcs.xml +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\System.Security.Cryptography.Xml.xml +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\System.Security.Principal.Windows.xml +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\System.Text.Encoding.CodePages.xml +E:\platform\LL-28_liuliang\C-Windows-1\bin\Debug\System.ValueTuple.xml +E:\platform\LL-28_liuliang\C-Windows-1\obj\Debug\C-Windows-LL18.csproj.AssemblyReference.cache +E:\platform\LL-28_liuliang\C-Windows-1\obj\Debug\C_Windows_1.Config.resources +E:\platform\LL-28_liuliang\C-Windows-1\obj\Debug\C_Windows_1.configIP.resources +E:\platform\LL-28_liuliang\C-Windows-1\obj\Debug\C_Windows_1.Form1.resources +E:\platform\LL-28_liuliang\C-Windows-1\obj\Debug\C_Windows_1.Form2.resources +E:\platform\LL-28_liuliang\C-Windows-1\obj\Debug\C_Windows_1.Form3.resources +E:\platform\LL-28_liuliang\C-Windows-1\obj\Debug\C_Windows_1.Form4.resources +E:\platform\LL-28_liuliang\C-Windows-1\obj\Debug\C_Windows_1.LogOn.resources +E:\platform\LL-28_liuliang\C-Windows-1\obj\Debug\C_Windows_1.MESConfig.resources +E:\platform\LL-28_liuliang\C-Windows-1\obj\Debug\C_Windows_1.MyGroupBox.resources +E:\platform\LL-28_liuliang\C-Windows-1\obj\Debug\C_Windows_1.PortSetting.resources +E:\platform\LL-28_liuliang\C-Windows-1\obj\Debug\C_Windows_1.Properties.Resources.resources +E:\platform\LL-28_liuliang\C-Windows-1\obj\Debug\C_Windows_1.Save.resources +E:\platform\LL-28_liuliang\C-Windows-1\obj\Debug\C_Windows_1.TestPara.resources +E:\platform\LL-28_liuliang\C-Windows-1\obj\Debug\C_Windows_1.UserPassword.resources +E:\platform\LL-28_liuliang\C-Windows-1\obj\Debug\C-Windows-LL18.csproj.GenerateResource.cache +E:\platform\LL-28_liuliang\C-Windows-1\obj\Debug\C-Windows-LL18.csproj.CoreCompileInputs.cache +E:\platform\LL-28_liuliang\C-Windows-1\obj\Debug\C-Windows-LL18.csproj.CopyComplete +E:\platform\LL-28_liuliang\C-Windows-1\obj\Debug\LL28-Control.exe +E:\platform\LL-28_liuliang\C-Windows-1\obj\Debug\LL28-Control.pdb diff --git a/C-Windows-1/obj/Debug/LL28-Control.exe b/C-Windows-1/obj/Debug/LL28-Control.exe index f7fee79..e150b96 100644 Binary files a/C-Windows-1/obj/Debug/LL28-Control.exe and b/C-Windows-1/obj/Debug/LL28-Control.exe differ diff --git a/README.MD b/README.MD new file mode 100644 index 0000000..e72fb61 --- /dev/null +++ b/README.MD @@ -0,0 +1,2 @@ +流量版本:Form1中 liuliangVersion设置为1 +普通版本:Form1中 liuliangVersion设置为0 \ No newline at end of file