This commit is contained in:
16
Program.cs
16
Program.cs
@@ -23,8 +23,8 @@ namespace P_RTU_TEST_WinForm
|
|||||||
private IModbusMaster _master;
|
private IModbusMaster _master;
|
||||||
private TcpClient _client = new TcpClient();
|
private TcpClient _client = new TcpClient();
|
||||||
// 在类开头部分添加
|
// 在类开头部分添加
|
||||||
private string _productModel = ""; // 存储产品型号
|
private string _productModel = ""; // 存储产品批号
|
||||||
private TextBox txtProductModel; // 产品型号输入框
|
private TextBox txtProductModel; // 产品批号输入框
|
||||||
// 在类开头部分添加
|
// 在类开头部分添加
|
||||||
|
|
||||||
private int _calculationCount = 1; // 默认计算1次
|
private int _calculationCount = 1; // 默认计算1次
|
||||||
@@ -54,10 +54,10 @@ namespace P_RTU_TEST_WinForm
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
|
||||||
// 添加产品型号标签和输入框
|
// 添加产品批号标签和输入框
|
||||||
Label lblProductModel = new Label()
|
Label lblProductModel = new Label()
|
||||||
{
|
{
|
||||||
Text = "产品型号:",
|
Text = "产品批号:",
|
||||||
Location = new Point(366, 15),
|
Location = new Point(366, 15),
|
||||||
Size = new Size(68, 15)
|
Size = new Size(68, 15)
|
||||||
};
|
};
|
||||||
@@ -596,7 +596,7 @@ namespace P_RTU_TEST_WinForm
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取产品型号
|
// 获取产品批号
|
||||||
string productModel = string.IsNullOrWhiteSpace(txtProductModel.Text)
|
string productModel = string.IsNullOrWhiteSpace(txtProductModel.Text)
|
||||||
? "未命名产品"
|
? "未命名产品"
|
||||||
: txtProductModel.Text.Trim();
|
: txtProductModel.Text.Trim();
|
||||||
@@ -626,7 +626,7 @@ namespace P_RTU_TEST_WinForm
|
|||||||
{
|
{
|
||||||
sw.WriteLine("=== 测试报表 ===");
|
sw.WriteLine("=== 测试报表 ===");
|
||||||
sw.WriteLine($"生成时间: {DateTime.Now:yyyy-MM-dd HH:mm:ss}");
|
sw.WriteLine($"生成时间: {DateTime.Now:yyyy-MM-dd HH:mm:ss}");
|
||||||
sw.WriteLine($"产品型号: {productModel}");
|
sw.WriteLine($"产品批号: {productModel}");
|
||||||
sw.WriteLine($"测试时间: {txtTestTime.Text} 秒");
|
sw.WriteLine($"测试时间: {txtTestTime.Text} 秒");
|
||||||
sw.WriteLine($"计算次数: 1 次");
|
sw.WriteLine($"计算次数: 1 次");
|
||||||
sw.WriteLine($"数据总数: {_distanceValues.Count}");
|
sw.WriteLine($"数据总数: {_distanceValues.Count}");
|
||||||
@@ -656,7 +656,7 @@ namespace P_RTU_TEST_WinForm
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取产品型号
|
// 获取产品批号
|
||||||
string productModel = string.IsNullOrWhiteSpace(txtProductModel.Text)
|
string productModel = string.IsNullOrWhiteSpace(txtProductModel.Text)
|
||||||
? "未命名产品"
|
? "未命名产品"
|
||||||
: txtProductModel.Text.Trim();
|
: txtProductModel.Text.Trim();
|
||||||
@@ -684,7 +684,7 @@ namespace P_RTU_TEST_WinForm
|
|||||||
{
|
{
|
||||||
sw.WriteLine("=== 多次测试报表 ===");
|
sw.WriteLine("=== 多次测试报表 ===");
|
||||||
sw.WriteLine($"生成时间: {DateTime.Now:yyyy-MM-dd HH:mm:ss}");
|
sw.WriteLine($"生成时间: {DateTime.Now:yyyy-MM-dd HH:mm:ss}");
|
||||||
sw.WriteLine($"产品型号: {productModel}");
|
sw.WriteLine($"产品批号: {productModel}");
|
||||||
sw.WriteLine($"单次测试时间: {txtTestTime.Text} 秒");
|
sw.WriteLine($"单次测试时间: {txtTestTime.Text} 秒");
|
||||||
sw.WriteLine($"计算次数: {_calculationCount} 次");
|
sw.WriteLine($"计算次数: {_calculationCount} 次");
|
||||||
sw.WriteLine($"总数据量: {_allTestResults.Sum(list => list.Count)}");
|
sw.WriteLine($"总数据量: {_allTestResults.Sum(list => list.Count)}");
|
||||||
|
|||||||
Reference in New Issue
Block a user