This commit is contained in:
xyy
2026-01-24 14:09:40 +08:00
parent b6ecb4e670
commit e3a5620872
2 changed files with 128 additions and 92 deletions

View File

@@ -697,7 +697,8 @@ namespace 全自动水压检测仪
{
try
{
string plcIp = "192.168.1.10";
//string plcIp = "192.168.1.10";
string plcIp = "127.0.0.1";
bool initSuccess = Data.ModbusResourceManager.Instance.Init(plcIp, 502);
if (initSuccess)
{

View File

@@ -28,13 +28,19 @@
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
this.save = new Sunny.UI.UIButton();
this.uiDataGridView1 = new Sunny.UI.UIDataGridView();
this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.uiTextBox2 = new Sunny.UI.UITextBox();
this.uiLabel48 = new Sunny.UI.UILabel();
this.uiTextBox9 = new Sunny.UI.UITextBox();
@@ -42,13 +48,9 @@
this.uiLabel41 = new Sunny.UI.UILabel();
this.uiLabel4 = new Sunny.UI.UILabel();
this.uiTextBox4 = new Sunny.UI.UITextBox();
this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.uiButton1 = new Sunny.UI.UIButton();
this.uiLabel1 = new Sunny.UI.UILabel();
this.uiTextBox1 = new Sunny.UI.UITextBox();
((System.ComponentModel.ISupportInitialize)(this.uiDataGridView1)).BeginInit();
this.SuspendLayout();
//
@@ -56,7 +58,7 @@
//
this.save.Cursor = System.Windows.Forms.Cursors.Hand;
this.save.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.save.Location = new System.Drawing.Point(521, 42);
this.save.Location = new System.Drawing.Point(304, 84);
this.save.MinimumSize = new System.Drawing.Size(1, 1);
this.save.Name = "save";
this.save.Size = new System.Drawing.Size(100, 35);
@@ -67,18 +69,18 @@
//
// uiDataGridView1
//
dataGridViewCellStyle6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
this.uiDataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle6;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
this.uiDataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
this.uiDataGridView1.BackgroundColor = System.Drawing.Color.White;
this.uiDataGridView1.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
dataGridViewCellStyle7.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle7.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle7.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle7.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.uiDataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle7;
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
dataGridViewCellStyle2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle2.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.uiDataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
this.uiDataGridView1.ColumnHeadersHeight = 32;
this.uiDataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
this.uiDataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
@@ -88,37 +90,85 @@
this.Column4,
this.Column5,
this.Column6});
dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle8.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle8.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle8.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle8.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle8.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.uiDataGridView1.DefaultCellStyle = dataGridViewCellStyle8;
dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.uiDataGridView1.DefaultCellStyle = dataGridViewCellStyle3;
this.uiDataGridView1.EnableHeadersVisualStyles = false;
this.uiDataGridView1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiDataGridView1.GridColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.uiDataGridView1.Location = new System.Drawing.Point(12, 83);
this.uiDataGridView1.Location = new System.Drawing.Point(12, 125);
this.uiDataGridView1.Name = "uiDataGridView1";
dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle9.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
dataGridViewCellStyle9.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle9.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
dataGridViewCellStyle9.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
dataGridViewCellStyle9.SelectionForeColor = System.Drawing.Color.White;
dataGridViewCellStyle9.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.uiDataGridView1.RowHeadersDefaultCellStyle = dataGridViewCellStyle9;
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
dataGridViewCellStyle4.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
dataGridViewCellStyle4.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
dataGridViewCellStyle4.SelectionForeColor = System.Drawing.Color.White;
dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.uiDataGridView1.RowHeadersDefaultCellStyle = dataGridViewCellStyle4;
this.uiDataGridView1.RowHeadersWidth = 51;
dataGridViewCellStyle10.BackColor = System.Drawing.Color.White;
dataGridViewCellStyle10.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle10;
dataGridViewCellStyle5.BackColor = System.Drawing.Color.White;
dataGridViewCellStyle5.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle5;
this.uiDataGridView1.RowTemplate.Height = 27;
this.uiDataGridView1.SelectedIndex = -1;
this.uiDataGridView1.Size = new System.Drawing.Size(958, 598);
this.uiDataGridView1.Size = new System.Drawing.Size(958, 556);
this.uiDataGridView1.StripeOddColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
this.uiDataGridView1.TabIndex = 1;
//
// Column1
//
this.Column1.DataPropertyName = "Id";
this.Column1.HeaderText = "序号";
this.Column1.MinimumWidth = 6;
this.Column1.Name = "Column1";
this.Column1.Width = 60;
//
// Column2
//
this.Column2.DataPropertyName = "barcode";
this.Column2.HeaderText = "条码";
this.Column2.MinimumWidth = 6;
this.Column2.Name = "Column2";
this.Column2.Width = 180;
//
// Column3
//
this.Column3.DataPropertyName = "diffpressure";
this.Column3.HeaderText = "压力";
this.Column3.MinimumWidth = 6;
this.Column3.Name = "Column3";
this.Column3.Width = 70;
//
// Column4
//
this.Column4.DataPropertyName = "temperature";
this.Column4.HeaderText = "进气温度";
this.Column4.MinimumWidth = 6;
this.Column4.Name = "Column4";
this.Column4.Width = 125;
//
// Column5
//
this.Column5.DataPropertyName = "dwelltime";
this.Column5.HeaderText = "保压时间";
this.Column5.MinimumWidth = 6;
this.Column5.Name = "Column5";
this.Column5.Width = 125;
//
// Column6
//
this.Column6.DataPropertyName = "CreateTime";
this.Column6.HeaderText = "录入时间";
this.Column6.MinimumWidth = 6;
this.Column6.Name = "Column6";
this.Column6.Width = 125;
//
// uiTextBox2
//
this.uiTextBox2.Cursor = System.Windows.Forms.Cursors.IBeam;
@@ -220,58 +270,11 @@
this.uiTextBox4.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
this.uiTextBox4.Watermark = "";
//
// Column1
//
this.Column1.DataPropertyName = "Id";
this.Column1.HeaderText = "序号";
this.Column1.MinimumWidth = 6;
this.Column1.Name = "Column1";
this.Column1.Width = 60;
//
// Column2
//
this.Column2.DataPropertyName = "barcode";
this.Column2.HeaderText = "条码";
this.Column2.MinimumWidth = 6;
this.Column2.Name = "Column2";
this.Column2.Width = 180;
//
// Column3
//
this.Column3.DataPropertyName = "diffpressure";
this.Column3.HeaderText = "压力";
this.Column3.MinimumWidth = 6;
this.Column3.Name = "Column3";
this.Column3.Width = 70;
//
// Column4
//
this.Column4.DataPropertyName = "temperature";
this.Column4.HeaderText = "进气温度";
this.Column4.MinimumWidth = 6;
this.Column4.Name = "Column4";
//
// Column5
//
this.Column5.DataPropertyName = "dwelltime";
this.Column5.HeaderText = "保压时间";
this.Column5.MinimumWidth = 6;
this.Column5.Name = "Column5";
this.Column5.Width = 125;
//
// Column6
//
this.Column6.DataPropertyName = "CreateTime";
this.Column6.HeaderText = "录入时间";
this.Column6.MinimumWidth = 6;
this.Column6.Name = "Column6";
this.Column6.Width = 125;
//
// uiButton1
//
this.uiButton1.Cursor = System.Windows.Forms.Cursors.Hand;
this.uiButton1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiButton1.Location = new System.Drawing.Point(639, 42);
this.uiButton1.Location = new System.Drawing.Point(419, 84);
this.uiButton1.MinimumSize = new System.Drawing.Size(1, 1);
this.uiButton1.Name = "uiButton1";
this.uiButton1.Size = new System.Drawing.Size(100, 35);
@@ -279,11 +282,41 @@
this.uiButton1.Text = "返回";
this.uiButton1.TipsFont = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
//
// uiLabel1
//
this.uiLabel1.Font = new System.Drawing.Font("微软雅黑", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiLabel1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
this.uiLabel1.Location = new System.Drawing.Point(517, 47);
this.uiLabel1.Name = "uiLabel1";
this.uiLabel1.Size = new System.Drawing.Size(83, 30);
this.uiLabel1.TabIndex = 34;
this.uiLabel1.Text = "温度(℃):";
this.uiLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// uiTextBox1
//
this.uiTextBox1.Cursor = System.Windows.Forms.Cursors.IBeam;
this.uiTextBox1.Font = new System.Drawing.Font("微软雅黑", 10.5F);
this.uiTextBox1.Location = new System.Drawing.Point(708, 49);
this.uiTextBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiTextBox1.MinimumSize = new System.Drawing.Size(1, 16);
this.uiTextBox1.Name = "uiTextBox1";
this.uiTextBox1.Padding = new System.Windows.Forms.Padding(5);
this.uiTextBox1.Radius = 3;
this.uiTextBox1.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.uiTextBox1.ShowText = false;
this.uiTextBox1.Size = new System.Drawing.Size(118, 28);
this.uiTextBox1.TabIndex = 35;
this.uiTextBox1.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
this.uiTextBox1.Watermark = "";
//
// ScanImport
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(982, 693);
this.Controls.Add(this.uiLabel1);
this.Controls.Add(this.uiTextBox1);
this.Controls.Add(this.uiButton1);
this.Controls.Add(this.uiLabel48);
this.Controls.Add(this.uiTextBox9);
@@ -320,5 +353,7 @@
private System.Windows.Forms.DataGridViewTextBoxColumn Column5;
private System.Windows.Forms.DataGridViewTextBoxColumn Column6;
private Sunny.UI.UIButton uiButton1;
private Sunny.UI.UILabel uiLabel1;
private Sunny.UI.UITextBox uiTextBox1;
}
}