This commit is contained in:
@@ -131,10 +131,10 @@ namespace 材料热传导系数
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public float PressureDifference { get; set; }
|
public float PressureDifference { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
///// <summary>
|
||||||
/// 标准误差
|
///// 标准误差
|
||||||
/// </summary>
|
///// </summary>
|
||||||
public float StandardError { get; set; }
|
//public float StandardError { get; set; }
|
||||||
|
|
||||||
public DateTime CreateTime { get; set; }
|
public DateTime CreateTime { get; set; }
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ namespace 全自动水压检测仪
|
|||||||
|
|
||||||
private System.Windows.Forms.Timer _readTimer;
|
private System.Windows.Forms.Timer _readTimer;
|
||||||
private System.Windows.Forms.Timer _readTimerTwo; // 第二个定时器引用
|
private System.Windows.Forms.Timer _readTimerTwo; // 第二个定时器引用
|
||||||
|
private System.Windows.Forms.Timer _readTimetCompareResult; // 第二个定时器引用
|
||||||
private bool _isManualInput = false; // 手动输入标记
|
private bool _isManualInput = false; // 手动输入标记
|
||||||
private bool _isSwitchingWindow = false; // 窗口切换标记,避免并发
|
private bool _isSwitchingWindow = false; // 窗口切换标记,避免并发
|
||||||
|
|
||||||
@@ -99,7 +100,7 @@ namespace 全自动水压检测仪
|
|||||||
// 只创建定时器,不在构造器中启动,避免在 Load 前访问未初始化的资源
|
// 只创建定时器,不在构造器中启动,避免在 Load 前访问未初始化的资源
|
||||||
_readTimer = InitTimer(); // 保存引用
|
_readTimer = InitTimer(); // 保存引用
|
||||||
_readTimerTwo = InitTimerTwo(); // 保存第二个定时器引用
|
_readTimerTwo = InitTimerTwo(); // 保存第二个定时器引用
|
||||||
|
_readTimetCompareResult = InitTimerCompare();
|
||||||
// 初始化报警监控定时器
|
// 初始化报警监控定时器
|
||||||
_alarmMonitorTimer = InitAlarmMonitorTimer();
|
_alarmMonitorTimer = InitAlarmMonitorTimer();
|
||||||
|
|
||||||
@@ -373,6 +374,43 @@ namespace 全自动水压检测仪
|
|||||||
return timer;
|
return timer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool? isValid = null;
|
||||||
|
private System.Windows.Forms.Timer InitTimerCompare()
|
||||||
|
{
|
||||||
|
var timer = new System.Windows.Forms.Timer()
|
||||||
|
{
|
||||||
|
Interval = 1000
|
||||||
|
};
|
||||||
|
timer.Tick += async (s, e) =>
|
||||||
|
{
|
||||||
|
if (!_isManualInput && _modbusMaster != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//2
|
||||||
|
float settingValue = 0, currentValue = 0;
|
||||||
|
float.TryParse(uiTextBox11.Text, out settingValue);
|
||||||
|
float.TryParse(uiLabel22.Text, out currentValue);
|
||||||
|
if (currentValue > settingValue)
|
||||||
|
{
|
||||||
|
isValid = false;
|
||||||
|
|
||||||
|
_modbusMaster.WriteSingleCoil(1, 10082, true);
|
||||||
|
timer?.Stop();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
isValid = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// 不在此处 Start
|
||||||
|
return timer;
|
||||||
|
}
|
||||||
|
|
||||||
private async Task ReadLeakTestParametersAsync()
|
private async Task ReadLeakTestParametersAsync()
|
||||||
{
|
{
|
||||||
// 检查窗体状态
|
// 检查窗体状态
|
||||||
@@ -1052,14 +1090,14 @@ namespace 全自动水压检测仪
|
|||||||
Type = uiLight1.State == UILightState.On ? 1 : 0,
|
Type = uiLight1.State == UILightState.On ? 1 : 0,
|
||||||
|
|
||||||
//新增
|
//新增
|
||||||
kzh = string.Empty,
|
kzh = kzh,
|
||||||
jh = string.Empty,
|
jh = uiTextBox10.Text,
|
||||||
endtime = DateTime.Now,
|
endtime = DateTime.Now,
|
||||||
quantity = 0,
|
quantity = quantity,
|
||||||
lldh = string.Empty,
|
lldh = uiTextBox2.Text,
|
||||||
standarderror = 0,
|
standarderror = standarderror,
|
||||||
starttime = starttime,
|
starttime = starttime,
|
||||||
testresult = string.Empty
|
testresult = (isValid ?? false) ? "合格" : "不合格"
|
||||||
});
|
});
|
||||||
|
|
||||||
_repository.InsertReportItems(new ConductivityTestData
|
_repository.InsertReportItems(new ConductivityTestData
|
||||||
@@ -1081,6 +1119,7 @@ namespace 全自动水压检测仪
|
|||||||
});
|
});
|
||||||
|
|
||||||
isAddTag = true;
|
isAddTag = true;
|
||||||
|
_readTimetCompareResult?.Stop();
|
||||||
}
|
}
|
||||||
private bool TryReconnect()
|
private bool TryReconnect()
|
||||||
{
|
{
|
||||||
@@ -1375,6 +1414,7 @@ namespace 全自动水压检测仪
|
|||||||
// 清除图表数据,开始新的测试
|
// 清除图表数据,开始新的测试
|
||||||
_chartManager?.ClearData();
|
_chartManager?.ClearData();
|
||||||
Debug.WriteLine("[NormalTemperatureMode] 启动测试,清除图表数据");
|
Debug.WriteLine("[NormalTemperatureMode] 启动测试,清除图表数据");
|
||||||
|
_readTimetCompareResult.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
//停止测试
|
//停止测试
|
||||||
@@ -1512,7 +1552,9 @@ namespace 全自动水压检测仪
|
|||||||
private string _currentTemperatureMode = ""; // 保存当前温度模式
|
private string _currentTemperatureMode = ""; // 保存当前温度模式
|
||||||
private string _currentBarcode = ""; // 保存当前条码
|
private string _currentBarcode = ""; // 保存当前条码
|
||||||
|
|
||||||
|
string kzh = string.Empty;
|
||||||
|
int quantity = 0;
|
||||||
|
decimal standarderror = 0;
|
||||||
private void uiButton8_Click(object sender, EventArgs e)
|
private void uiButton8_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -1549,7 +1591,8 @@ namespace 全自动水压检测仪
|
|||||||
string zh = uiTextBox10.Text;
|
string zh = uiTextBox10.Text;
|
||||||
// 2. 从数据库查询数据
|
// 2. 从数据库查询数据
|
||||||
ScanData scanData = GetScanDataByBarcode(lldh, zh);
|
ScanData scanData = GetScanDataByBarcode(lldh, zh);
|
||||||
|
kzh = scanData.kzh;
|
||||||
|
quantity = scanData.quantity ?? 0;
|
||||||
if (scanData == null)
|
if (scanData == null)
|
||||||
{
|
{
|
||||||
SafeInvoke(() =>
|
SafeInvoke(() =>
|
||||||
|
|||||||
@@ -63,15 +63,15 @@ namespace 全自动水压检测仪
|
|||||||
SafeInvoke(() =>
|
SafeInvoke(() =>
|
||||||
{
|
{
|
||||||
float diffpressure = 0, exit_temperature = 0, dwelltime = 0, temperature = 0;
|
float diffpressure = 0, exit_temperature = 0, dwelltime = 0, temperature = 0;
|
||||||
float pressureDifference = 0, standardError = 0;
|
float pressureDifference = 0; decimal standardError = 0;
|
||||||
int quantity = 0;
|
int quantity = 0;
|
||||||
|
|
||||||
float.TryParse(uiTextBox4?.Text ?? "", out diffpressure);
|
float.TryParse(uiTextBox4?.Text ?? "", out diffpressure);
|
||||||
float.TryParse(uiTextBox9?.Text ?? "", out exit_temperature);
|
float.TryParse(uiTextBox9?.Text ?? "", out exit_temperature);
|
||||||
float.TryParse(uiTextBox5?.Text ?? "", out dwelltime);
|
float.TryParse(uiTextBox5?.Text ?? "", out dwelltime);
|
||||||
float.TryParse(uiTextBox1?.Text ?? "", out temperature);
|
float.TryParse(uiTextBox1?.Text ?? "", out temperature);
|
||||||
float.TryParse(uiTextBoxPressureDiff?.Text ?? "", out pressureDifference);
|
float.TryParse(uiTextBoxPressureDiff?.Text ?? "", out pressureDifference);
|
||||||
float.TryParse(uiTextBoxStandardError?.Text ?? "", out standardError);
|
decimal.TryParse(uiTextBoxStandardError?.Text ?? "", out standardError);
|
||||||
int.TryParse(uiTextBoxQuantity?.Text ?? "", out quantity);
|
int.TryParse(uiTextBoxQuantity?.Text ?? "", out quantity);
|
||||||
|
|
||||||
string temperatureMode = "";
|
string temperatureMode = "";
|
||||||
@@ -88,7 +88,7 @@ namespace 全自动水压检测仪
|
|||||||
string contactNumber = uiTextBox2?.Text?.Trim() ?? "";
|
string contactNumber = uiTextBox2?.Text?.Trim() ?? "";
|
||||||
string itemNumber = uiTextBox11?.Text?.Trim() ?? "";
|
string itemNumber = uiTextBox11?.Text?.Trim() ?? "";
|
||||||
string engravingNumber = uiTextBoxEngravingNumber?.Text?.Trim() ?? "";
|
string engravingNumber = uiTextBoxEngravingNumber?.Text?.Trim() ?? "";
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(contactNumber))
|
if (string.IsNullOrEmpty(contactNumber))
|
||||||
{
|
{
|
||||||
MessageBox.Show("请输入联络单号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
MessageBox.Show("请输入联络单号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||||
@@ -119,8 +119,16 @@ namespace 全自动水压检测仪
|
|||||||
IsHighMode = temperature > 0,
|
IsHighMode = temperature > 0,
|
||||||
temperature = temperature,
|
temperature = temperature,
|
||||||
PressureDifference = pressureDifference,
|
PressureDifference = pressureDifference,
|
||||||
StandardError = standardError,
|
|
||||||
TemperatureMode = temperatureMode
|
TemperatureMode = temperatureMode,
|
||||||
|
jh = uiTextBox11.Text,
|
||||||
|
CreateTime = DateTime.Now,
|
||||||
|
kzh = uiTextBoxEngravingNumber.Text,
|
||||||
|
lldh = uiTextBox2.Text,
|
||||||
|
pressuresetting = pressureDifference,
|
||||||
|
quantity = quantity,
|
||||||
|
standarderror = standardError
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// 重新加载数据
|
// 重新加载数据
|
||||||
|
|||||||
Reference in New Issue
Block a user