This commit is contained in:
wxt
2026-02-05 16:13:18 +08:00
parent 63fa7d3972
commit 41e3ffd24e
4 changed files with 123 additions and 14 deletions

View File

@@ -1262,7 +1262,7 @@
this.uiTextBox4.Text = "0.00";
this.uiTextBox4.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
this.uiTextBox4.Watermark = "";
this.uiTextBox4.Click += new System.EventHandler(this.uiTextBox4_Click);
//this.uiTextBox4.Click += new System.EventHandler(this.uiTextBox4_Click);
//
// uiLabel4
//
@@ -1290,7 +1290,7 @@
this.uiTextBox18.Text = "0.00";
this.uiTextBox18.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
this.uiTextBox18.Watermark = "";
this.uiTextBox18.Click += new System.EventHandler(this.uiTextBox18_Click);
//this.uiTextBox18.Click += new System.EventHandler(this.uiTextBox18_Click);
//
// uiLabel18
//

View File

@@ -107,8 +107,8 @@ namespace 全自动水压检测仪
CreateRegisterConfig(2300, uiTextBox17, "F2",false), // 转速
CreateRegisterConfig(2402, uiTextBox16, "F2",false), // 温度
CreateRegisterConfig(3484, uiTextBox4, "F2",false), // 温度保护
CreateRegisterConfig(3134, uiTextBox18, "F2",false), // 压力保护
//CreateRegisterConfig(3484, uiTextBox4, "F2",false), // 温度保护
//CreateRegisterConfig(3134, uiTextBox18, "F2",false), // 压力保护
CreateRegisterConfig(2408, uiTextBox14, "0",true), // 稳压时间
CreateRegisterConfig(2406, uiTextBox15, "0",true), // 通水时间
@@ -536,15 +536,15 @@ namespace 全自动水压检测仪
}
}
//温度保护
private void uiTextBox4_Click(object sender, EventArgs e)
{
ma?.WriteToPLCForNew(uiTextBox2.Text.Trim(), 3484, Function.DataType.);
}
//压力保护
private void uiTextBox18_Click(object sender, EventArgs e)
{
ma?.WriteToPLCForNew(uiTextBox2.Text.Trim(), 3134, Function.DataType.);
}
////温度保护
//private void uiTextBox4_Click(object sender, EventArgs e)
//{
// ma?.WriteToPLCForNew(uiTextBox2.Text.Trim(), 3484, Function.DataType.浮点型);
//}
////压力保护
//private void uiTextBox18_Click(object sender, EventArgs e)
//{
// ma?.WriteToPLCForNew(uiTextBox2.Text.Trim(), 3134, Function.DataType.浮点型);
//}
}
}

View File

@@ -167,6 +167,10 @@ namespace 全自动水压检测仪
this.uiPanel2 = new Sunny.UI.UIPanel();
this.uiLabel1 = new Sunny.UI.UILabel();
this.uiLight1 = new Sunny.UI.UILight();
this.uiLabel24 = new Sunny.UI.UILabel();
this.uiTextBox12 = new Sunny.UI.UITextBox();
this.uiLabel25 = new Sunny.UI.UILabel();
this.uiTextBox13 = new Sunny.UI.UITextBox();
this.uiTableLayoutPanel1.SuspendLayout();
this.uiPanel1.SuspendLayout();
this.uiPanel4.SuspendLayout();
@@ -1444,6 +1448,10 @@ namespace 全自动水压检测仪
//
// uiPanel14
//
this.uiPanel14.Controls.Add(this.uiLabel25);
this.uiPanel14.Controls.Add(this.uiTextBox13);
this.uiPanel14.Controls.Add(this.uiLabel24);
this.uiPanel14.Controls.Add(this.uiTextBox12);
this.uiPanel14.Controls.Add(this.uiLabel11);
this.uiPanel14.Controls.Add(this.uiTextBox11);
this.uiPanel14.Controls.Add(this.uiButton8);
@@ -2310,6 +2318,64 @@ namespace 全自动水压检测仪
this.uiLight1.TabIndex = 1;
this.uiLight1.Text = "uiLight1";
//
// uiLabel24
//
this.uiLabel24.Font = new System.Drawing.Font("微软雅黑", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiLabel24.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
this.uiLabel24.Location = new System.Drawing.Point(278, 55);
this.uiLabel24.Name = "uiLabel24";
this.uiLabel24.Size = new System.Drawing.Size(112, 30);
this.uiLabel24.TabIndex = 21;
this.uiLabel24.Text = "温度上限:";
this.uiLabel24.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// uiTextBox12
//
this.uiTextBox12.Cursor = System.Windows.Forms.Cursors.IBeam;
this.uiTextBox12.Font = new System.Drawing.Font("微软雅黑", 10.5F);
this.uiTextBox12.Location = new System.Drawing.Point(395, 55);
this.uiTextBox12.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiTextBox12.MinimumSize = new System.Drawing.Size(1, 16);
this.uiTextBox12.Name = "uiTextBox12";
this.uiTextBox12.Padding = new System.Windows.Forms.Padding(5);
this.uiTextBox12.Radius = 3;
this.uiTextBox12.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.uiTextBox12.ShowText = false;
this.uiTextBox12.Size = new System.Drawing.Size(91, 28);
this.uiTextBox12.TabIndex = 22;
this.uiTextBox12.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
this.uiTextBox12.Watermark = "";
this.uiTextBox12.Click += new System.EventHandler(this.uiTextBox12_Click);
//
// uiLabel25
//
this.uiLabel25.Font = new System.Drawing.Font("微软雅黑", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiLabel25.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
this.uiLabel25.Location = new System.Drawing.Point(278, 97);
this.uiLabel25.Name = "uiLabel25";
this.uiLabel25.Size = new System.Drawing.Size(112, 30);
this.uiLabel25.TabIndex = 23;
this.uiLabel25.Text = "压力上限:";
this.uiLabel25.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// uiTextBox13
//
this.uiTextBox13.Cursor = System.Windows.Forms.Cursors.IBeam;
this.uiTextBox13.Font = new System.Drawing.Font("微软雅黑", 10.5F);
this.uiTextBox13.Location = new System.Drawing.Point(395, 97);
this.uiTextBox13.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiTextBox13.MinimumSize = new System.Drawing.Size(1, 16);
this.uiTextBox13.Name = "uiTextBox13";
this.uiTextBox13.Padding = new System.Windows.Forms.Padding(5);
this.uiTextBox13.Radius = 3;
this.uiTextBox13.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.uiTextBox13.ShowText = false;
this.uiTextBox13.Size = new System.Drawing.Size(91, 28);
this.uiTextBox13.TabIndex = 24;
this.uiTextBox13.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
this.uiTextBox13.Watermark = "";
this.uiTextBox13.Click += new System.EventHandler(this.uiTextBox13_Click);
//
// NormalTemperatureMode
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@@ -2520,6 +2586,10 @@ namespace 全自动水压检测仪
private Sunny.UI.UIButton uiButton1;
private Sunny.UI.UILabel uiLabel11;
private Sunny.UI.UITextBox uiTextBox11;
private Sunny.UI.UILabel uiLabel25;
private Sunny.UI.UITextBox uiTextBox13;
private Sunny.UI.UILabel uiLabel24;
private Sunny.UI.UITextBox uiTextBox12;
}
}

View File

@@ -447,6 +447,10 @@ namespace 全自动水压检测仪
Real10 = SafelyReadRegisters(1, 3480, 2),// 箱体温度
Real11 = SafelyReadRegisters(1, 3180, 2),// 出口温度
Real12 = SafelyReadRegisters(1, 2400, 2),// 压力设定值
Real13 = SafelyReadRegisters(1, 3484, 2),// 温度保护
Real14 = SafelyReadRegisters(1, 3134, 2),// 压力保护
CurrentTime = DateTime.Now
};
}
@@ -596,6 +600,23 @@ namespace 全自动水压检测仪
Debug.WriteLine($"图表更新异常: {chartEx.Message}");
}
}
// 温度保护
if (uiTextBox12 != null && !uiTextBox12.IsDisposed &&
modbusData.Real13 != null && modbusData.Real13.Length >= 2)
{
var protemp = c.UshortToFloat(modbusData.Real13[1], modbusData.Real13[0]);
uiTextBox12.Text = protemp.ToString("F1");
}
// 压力保护
if (uiTextBox13 != null && !uiTextBox13.IsDisposed &&
modbusData.Real14 != null && modbusData.Real14.Length >= 2)
{
var propre = c.UshortToFloat(modbusData.Real14[1], modbusData.Real14[0]);
uiTextBox13.Text = propre.ToString("F1");
}
}
catch (Exception uiEx)
{
@@ -1898,5 +1919,23 @@ namespace 全自动水压检测仪
try { this.ResumeLayout(true); } catch { }
}
}
//温度保护
private void uiTextBox12_Click(object sender, EventArgs e)
{
SafeInvoke(() =>
{
ma?.WriteToPLCForNew(uiTextBox12.Text.Trim(), 3484, Function.DataType.);
});
}
//压力保护
private void uiTextBox13_Click(object sender, EventArgs e)
{
SafeInvoke(() =>
{
ma?.WriteToPLCForNew(uiTextBox13.Text.Trim(), 3134, Function.DataType.);
});
}
}
}