优化设置页

This commit is contained in:
GukSang.Jin
2026-02-03 14:53:11 +08:00
parent 32be8c2081
commit e8e7d81ba8
5 changed files with 149 additions and 26 deletions

View File

@@ -134,8 +134,10 @@ namespace 全自动水压检测仪
this.uiLabel48 = new Sunny.UI.UILabel();
this.uiTextBox9 = new Sunny.UI.UITextBox();
this.uiLabel35 = new Sunny.UI.UILabel();
this.uiLabel49 = new Sunny.UI.UILabel();
this.uiLabel37 = new Sunny.UI.UILabel();
this.uiTextBox2 = new Sunny.UI.UITextBox();
this.uiTextBox10 = new Sunny.UI.UITextBox();
this.uiLabel46 = new Sunny.UI.UILabel();
this.uiTextBox4 = new Sunny.UI.UITextBox();
this.uiTextBox7 = new Sunny.UI.UITextBox();
@@ -1700,8 +1702,10 @@ namespace 全自动水压检测仪
this.uiPanel14.Controls.Add(this.uiLabel48);
this.uiPanel14.Controls.Add(this.uiTextBox9);
this.uiPanel14.Controls.Add(this.uiLabel35);
this.uiPanel14.Controls.Add(this.uiLabel49);
this.uiPanel14.Controls.Add(this.uiLabel37);
this.uiPanel14.Controls.Add(this.uiTextBox2);
this.uiPanel14.Controls.Add(this.uiTextBox10);
this.uiPanel14.Controls.Add(this.uiLabel46);
this.uiPanel14.Controls.Add(this.uiTextBox4);
this.uiPanel14.Controls.Add(this.uiTextBox7);
@@ -1732,11 +1736,15 @@ namespace 全自动水压检测仪
// uiButton8
//
this.uiButton8.Cursor = System.Windows.Forms.Cursors.Hand;
this.uiButton8.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiButton8.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(70)))), ((int)(((byte)(130)))), ((int)(((byte)(240)))));
this.uiButton8.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(90)))), ((int)(((byte)(150)))), ((int)(((byte)(255)))));
this.uiButton8.FillPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(120)))), ((int)(((byte)(220)))));
this.uiButton8.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiButton8.Location = new System.Drawing.Point(426, 122);
this.uiButton8.MinimumSize = new System.Drawing.Size(1, 1);
this.uiButton8.Name = "uiButton8";
this.uiButton8.Size = new System.Drawing.Size(58, 33);
this.uiButton8.Radius = 5;
this.uiButton8.Size = new System.Drawing.Size(62, 33);
this.uiButton8.TabIndex = 16;
this.uiButton8.Text = "写入";
this.uiButton8.TipsFont = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
@@ -1791,13 +1799,24 @@ namespace 全自动水压检测仪
//
this.uiLabel35.Font = new System.Drawing.Font("微软雅黑", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiLabel35.ForeColor = System.Drawing.Color.Red;
this.uiLabel35.Location = new System.Drawing.Point(62, 126);
this.uiLabel35.Location = new System.Drawing.Point(7, 126);
this.uiLabel35.Name = "uiLabel35";
this.uiLabel35.Size = new System.Drawing.Size(79, 30);
this.uiLabel35.Size = new System.Drawing.Size(90, 30);
this.uiLabel35.TabIndex = 2;
this.uiLabel35.Text = "条码:";
this.uiLabel35.Text = "联络单号:";
this.uiLabel35.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// uiLabel49
//
this.uiLabel49.Font = new System.Drawing.Font("微软雅黑", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiLabel49.ForeColor = System.Drawing.Color.Red;
this.uiLabel49.Location = new System.Drawing.Point(235, 126);
this.uiLabel49.Name = "uiLabel49";
this.uiLabel49.Size = new System.Drawing.Size(50, 30);
this.uiLabel49.TabIndex = 17;
this.uiLabel49.Text = "件号:";
this.uiLabel49.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// uiLabel37
//
this.uiLabel37.Font = new System.Drawing.Font("微软雅黑", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
@@ -1813,7 +1832,7 @@ namespace 全自动水压检测仪
//
this.uiTextBox2.Cursor = System.Windows.Forms.Cursors.IBeam;
this.uiTextBox2.Font = new System.Drawing.Font("微软雅黑", 10.5F);
this.uiTextBox2.Location = new System.Drawing.Point(141, 127);
this.uiTextBox2.Location = new System.Drawing.Point(100, 127);
this.uiTextBox2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiTextBox2.MinimumSize = new System.Drawing.Size(1, 16);
this.uiTextBox2.Name = "uiTextBox2";
@@ -1821,11 +1840,28 @@ namespace 全自动水压检测仪
this.uiTextBox2.Radius = 3;
this.uiTextBox2.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.uiTextBox2.ShowText = false;
this.uiTextBox2.Size = new System.Drawing.Size(278, 28);
this.uiTextBox2.Size = new System.Drawing.Size(128, 28);
this.uiTextBox2.TabIndex = 3;
this.uiTextBox2.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
this.uiTextBox2.Watermark = "";
//
// uiTextBox10
//
this.uiTextBox10.Cursor = System.Windows.Forms.Cursors.IBeam;
this.uiTextBox10.Font = new System.Drawing.Font("微软雅黑", 10.5F);
this.uiTextBox10.Location = new System.Drawing.Point(288, 127);
this.uiTextBox10.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiTextBox10.MinimumSize = new System.Drawing.Size(1, 16);
this.uiTextBox10.Name = "uiTextBox10";
this.uiTextBox10.Padding = new System.Windows.Forms.Padding(5);
this.uiTextBox10.Radius = 3;
this.uiTextBox10.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.uiTextBox10.ShowText = false;
this.uiTextBox10.Size = new System.Drawing.Size(131, 28);
this.uiTextBox10.TabIndex = 18;
this.uiTextBox10.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
this.uiTextBox10.Watermark = "";
//
// uiLabel46
//
this.uiLabel46.Font = new System.Drawing.Font("微软雅黑", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
@@ -2438,7 +2474,9 @@ namespace 全自动水压检测仪
private Sunny.UI.UILabel uiLabel36;
private Sunny.UI.UITextBox uiTextBox3;
private Sunny.UI.UILabel uiLabel35;
private Sunny.UI.UILabel uiLabel49;
private Sunny.UI.UITextBox uiTextBox2;
private Sunny.UI.UITextBox uiTextBox10;
private Sunny.UI.UILabel uiLabel37;
private Sunny.UI.UITextBox uiTextBox4;
private Sunny.UI.UILabel uiLabel46;

View File

@@ -939,9 +939,12 @@ namespace 全自动水压检测仪
uiTextBox6.Text = uiLabel22.Text;//压差
uiTextBox7.Text = uiLabel19.Text;//结束压力
// 组合联络单号和件号
string barcode = $"{uiTextBox2.Text.Trim()}-{uiTextBox10.Text.Trim()}";
CurrentReport.Add(new ConductivityTestData
{
barcode = uiTextBox2.Text,
barcode = barcode,
CreateTime = DateTime.Now,
diffpressure = uiTextBox6.Text.ToDouble(),
dwelltime = uiTextBox8.Text.ToDouble(),
@@ -953,7 +956,7 @@ namespace 全自动水压检测仪
_repository.InsertReportItems(new ConductivityTestData
{
barcode = uiTextBox2.Text,
barcode = barcode,
CreateTime = DateTime.Now,
diffpressure = uiTextBox6.Text.ToDouble(),
dwelltime = uiTextBox8.Text.ToDouble(),
@@ -964,6 +967,7 @@ namespace 全自动水压检测仪
});
uiTextBox2.Text = string.Empty;
uiTextBox10.Text = string.Empty;
});
isAddTag = true;
@@ -1279,22 +1283,36 @@ namespace 全自动水压检测仪
{
try
{
// 1. 获取条码输入确保在UI线程读取
string barcode = "";
// 1. 获取联络单号和件号输入确保在UI线程读取
string contactNumber = "";
string itemNumber = "";
SafeInvoke(() =>
{
barcode = uiTextBox2.Text.Trim();
contactNumber = uiTextBox2.Text.Trim();
itemNumber = uiTextBox10.Text.Trim();
});
if (string.IsNullOrEmpty(barcode))
if (string.IsNullOrEmpty(contactNumber))
{
SafeInvoke(() =>
{
MessageBox.Show("请输入条码");
MessageBox.Show("请输入联络单号");
});
return;
}
if (string.IsNullOrEmpty(itemNumber))
{
SafeInvoke(() =>
{
MessageBox.Show("请输入件号!");
});
return;
}
// 组合成完整的条码(联络单号-件号)
string barcode = $"{contactNumber}-{itemNumber}";
// 2. 从数据库查询数据
ScanData scanData = GetScanDataByBarcode(barcode);
@@ -1302,7 +1320,7 @@ namespace 全自动水压检测仪
{
SafeInvoke(() =>
{
MessageBox.Show($"未找到条码为 {barcode} 的记录!");
MessageBox.Show($"未找到联络单号 {contactNumber} 和件号 {itemNumber} 的记录!");
});
return;
}

View File

@@ -129,7 +129,7 @@ namespace 全自动水压检测仪
dataGridView.Columns.Add(new DataGridViewTextBoxColumn
{
Name = "barcode",
HeaderText = "条码",
HeaderText = "联络单号和件号",
Width = 280,
DataPropertyName = "Barcode", // 注意属性名大小写
SortMode = DataGridViewColumnSortMode.NotSortable,
@@ -430,7 +430,7 @@ namespace 全自动水压检测仪
using (StreamWriter writer = new StreamWriter(filePath, false, System.Text.Encoding.UTF8))
{
// 写入表头
writer.WriteLine("编号,条码,时间日期,初始压力(PSI),结束压力(PSI),压差(PSI),保压时间(h),温度模式");
writer.WriteLine("编号,联络单号和件号,时间日期,初始压力(PSI),结束压力(PSI),压差(PSI),保压时间(h),温度模式");
// 写入数据
foreach (var data in CurrentReport)
@@ -472,8 +472,8 @@ namespace 全自动水压检测仪
writer.WriteLine("=======================================================\n");
// 写入表头
writer.WriteLine(string.Format("{0,-8}{1,-15}{2,-20}{3,-12}{4,-12}{5,-12}{6,-12}{7,-10}",
"编号", "条码", "时间日期", "初始压力", "保压时间", "压差", "结束压力", "温度模式"));
writer.WriteLine(string.Format("{0,-8}{1,-20}{2,-20}{3,-12}{4,-12}{5,-12}{6,-12}{7,-10}",
"编号", "联络单号和件号", "时间日期", "初始压力", "保压时间", "压差", "结束压力", "温度模式"));
writer.WriteLine(new string('-', 120));
// 写入数据
@@ -481,7 +481,7 @@ namespace 全自动水压检测仪
{
string tempMode = GetTemperatureModeDisplay(data.Type);
writer.WriteLine(string.Format("{0,-8}{1,-15}{2,-20}{3,-12:F2}{4,-12:F1}{5,-12:F2}{6,-12:F2}{7,-10}",
writer.WriteLine(string.Format("{0,-8}{1,-20}{2,-20}{3,-12:F2}{4,-12:F1}{5,-12:F2}{6,-12:F2}{7,-10}",
data.Id,
data.barcode,
data.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"),
@@ -537,7 +537,7 @@ namespace 全自动水压检测仪
currentRow += 2;
// 表头
string[] headers = { "编号", "条码", "时间日期", "初始压力(PSI)", "结束压力(PSI)", "压差(PSI)", "保压时间(h)", "温度模式" };
string[] headers = { "编号", "联络单号和件号", "时间日期", "初始压力(PSI)", "结束压力(PSI)", "压差(PSI)", "保压时间(h)", "温度模式" };
for (int i = 0; i < headers.Length; i++)
{

View File

@@ -45,6 +45,9 @@
this.Column8 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.uiTextBox2 = new Sunny.UI.UITextBox();
this.uiTextBox11 = new Sunny.UI.UITextBox();
this.uiLabel50 = new Sunny.UI.UILabel();
this.uiLabel51 = new Sunny.UI.UILabel();
this.uiLabel48 = new Sunny.UI.UILabel();
this.uiTextBox9 = new Sunny.UI.UITextBox();
this.uiTextBox5 = new Sunny.UI.UITextBox();
@@ -178,7 +181,7 @@
// Column2
//
this.Column2.DataPropertyName = "barcode";
this.Column2.HeaderText = "条码";
this.Column2.HeaderText = "联络单号和件号";
this.Column2.MinimumWidth = 6;
this.Column2.Name = "Column2";
this.Column2.ReadOnly = true;
@@ -238,22 +241,61 @@
this.Column6.ReadOnly = true;
this.Column6.Width = 150;
//
// uiLabel50
//
this.uiLabel50.Font = new System.Drawing.Font("微软雅黑", 10.5F);
this.uiLabel50.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
this.uiLabel50.Location = new System.Drawing.Point(7, 27);
this.uiLabel50.Name = "uiLabel50";
this.uiLabel50.Size = new System.Drawing.Size(80, 30);
this.uiLabel50.TabIndex = 31;
this.uiLabel50.Text = "联络单号:";
this.uiLabel50.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// uiLabel51
//
this.uiLabel51.Font = new System.Drawing.Font("微软雅黑", 10.5F);
this.uiLabel51.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
this.uiLabel51.Location = new System.Drawing.Point(235, 27);
this.uiLabel51.Name = "uiLabel51";
this.uiLabel51.Size = new System.Drawing.Size(50, 30);
this.uiLabel51.TabIndex = 32;
this.uiLabel51.Text = "件号:";
this.uiLabel51.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// uiTextBox2
//
this.uiTextBox2.Cursor = System.Windows.Forms.Cursors.IBeam;
this.uiTextBox2.Font = new System.Drawing.Font("微软雅黑", 10.5F);
this.uiTextBox2.Location = new System.Drawing.Point(57, 24);
this.uiTextBox2.Location = new System.Drawing.Point(90, 24);
this.uiTextBox2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiTextBox2.MinimumSize = new System.Drawing.Size(1, 16);
this.uiTextBox2.Name = "uiTextBox2";
this.uiTextBox2.Padding = new System.Windows.Forms.Padding(8, 5, 8, 5);
this.uiTextBox2.RectSize = 2;
this.uiTextBox2.ShowText = false;
this.uiTextBox2.Size = new System.Drawing.Size(278, 35);
this.uiTextBox2.Size = new System.Drawing.Size(138, 35);
this.uiTextBox2.Style = Sunny.UI.UIStyle.Custom;
this.uiTextBox2.TabIndex = 12;
this.uiTextBox2.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
this.uiTextBox2.Watermark = "请输入条码";
this.uiTextBox2.Watermark = "请输入联络单号";
//
// uiTextBox11
//
this.uiTextBox11.Cursor = System.Windows.Forms.Cursors.IBeam;
this.uiTextBox11.Font = new System.Drawing.Font("微软雅黑", 10.5F);
this.uiTextBox11.Location = new System.Drawing.Point(288, 24);
this.uiTextBox11.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiTextBox11.MinimumSize = new System.Drawing.Size(1, 16);
this.uiTextBox11.Name = "uiTextBox11";
this.uiTextBox11.Padding = new System.Windows.Forms.Padding(8, 5, 8, 5);
this.uiTextBox11.RectSize = 2;
this.uiTextBox11.ShowText = false;
this.uiTextBox11.Size = new System.Drawing.Size(138, 35);
this.uiTextBox11.Style = Sunny.UI.UIStyle.Custom;
this.uiTextBox11.TabIndex = 33;
this.uiTextBox11.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
this.uiTextBox11.Watermark = "请输入件号";
//
// uiLabel48
//
@@ -495,8 +537,11 @@
//
// uiPanel2
//
this.uiPanel2.Controls.Add(this.uiLabel50);
this.uiPanel2.Controls.Add(this.uiLabel51);
this.uiPanel2.Controls.Add(this.uiLabel48);
this.uiPanel2.Controls.Add(this.uiTextBox2);
this.uiPanel2.Controls.Add(this.uiTextBox11);
this.uiPanel2.Controls.Add(this.uiCheckBox2);
this.uiPanel2.Controls.Add(this.uiTextBox9);
this.uiPanel2.Controls.Add(this.uiCheckBox1);
@@ -555,6 +600,9 @@
private Sunny.UI.UIButton save;
private Sunny.UI.UIDataGridView uiDataGridView1;
private Sunny.UI.UITextBox uiTextBox2;
private Sunny.UI.UITextBox uiTextBox11;
private Sunny.UI.UILabel uiLabel50;
private Sunny.UI.UILabel uiLabel51;
private Sunny.UI.UILabel uiLabel48;
private Sunny.UI.UITextBox uiTextBox9;
private Sunny.UI.UITextBox uiTextBox5;

View File

@@ -78,11 +78,29 @@ namespace 全自动水压检测仪
temperatureMode = "高温模式";
}
// 组合联络单号和件号
string contactNumber = uiTextBox2?.Text?.Trim() ?? "";
string itemNumber = uiTextBox11?.Text?.Trim() ?? "";
if (string.IsNullOrEmpty(contactNumber))
{
MessageBox.Show("请输入联络单号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
if (string.IsNullOrEmpty(itemNumber))
{
MessageBox.Show("请输入件号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
string barcode = $"{contactNumber}-{itemNumber}";
try
{
_repository.InsertScanItems(new ScanData
{
barcode = uiTextBox2?.Text ?? "",
barcode = barcode,
diffpressure = diffpressure,
exit_temperature = exit_temperature,
dwelltime = dwelltime,
@@ -109,6 +127,7 @@ namespace 全自动水压检测仪
{
if (uiTextBox1 != null) uiTextBox1.Text = "";
if (uiTextBox2 != null) uiTextBox2.Text = "";
if (uiTextBox11 != null) uiTextBox11.Text = "";
if (uiTextBox4 != null) uiTextBox4.Text = "";
if (uiTextBox5 != null) uiTextBox5.Text = "";
if (uiTextBox9 != null) uiTextBox9.Text = "";