25111505 调整进度条;添加单产品测试总时长显示;添加密码;MES接口待改

This commit is contained in:
moxiliang
2025-11-17 09:34:27 +08:00
parent 59f3812c9e
commit 920ead4a18
37 changed files with 1408 additions and 722 deletions

View File

@@ -1345,6 +1345,19 @@ namespace SLC1_N
return CH1yiqiParam_P;
}
// 记录开始时间
private DateTime CH1start_time;
private DateTime CH2start_time;
private DateTime CH3start_time;
private DateTime CH4start_time;
// 是否刷新启动时间标志位
private bool bool_CH1start_time = false;
private bool bool_CH2start_time = false;
private bool bool_CH3start_time = false;
private bool bool_CH4start_time = false;
// 通道1状态机
public void CH1machine()
{
@@ -1366,6 +1379,8 @@ namespace SLC1_N
CH1testCount = 0; // 重置测试次数
CH1TestRecord.Reset();
bool_CH1start_time = false;
// 模式切回正压
CH1NowMode = "正压";
LL28CH1client.writeRegisters(1006, GetYiqiParam(1, "P").GetArray());
@@ -1382,6 +1397,14 @@ namespace SLC1_N
case (int)yiqi.prepare:
{
if(bool_CH1start_time == false)
{
bool_CH1start_time = true;
CH1start_time = DateTime.Now;
SetLabelText(lb_CH1testTime, $"");
}
// 准备超时处理
if (!prepareOutTime_Dictionary.ContainsKey(1))
{
@@ -1411,6 +1434,15 @@ namespace SLC1_N
if (LL28CH1client.ArrCoil[2])
{
prepareOutTime_Dictionary.Remove(1);
SetLabelText(lb_CH1ProcessTime1, (LL28CH1client.ArrRegister[6] / 10.0).ToString() + " s");
SetLabelText(lb_CH1ProcessTime2, (LL28CH1client.ArrRegister[7] / 10.0).ToString() + " s");
SetLabelText(lb_CH1ProcessTime3, (LL28CH1client.ArrRegister[8] / 10.0).ToString() + " s");
SetLabelText(lb_CH1ProcessTime4, (LL28CH1client.ArrRegister[9] / 10.0).ToString() + " s");
SetLabelText(lb_CH1TestPressureUp, LL28CH1client.readFloat(13));
SetLabelText(lb_CH1TestPressureDown, LL28CH1client.readFloat(15));
ch1workstation = (int)yiqi.test;
}
}
@@ -1458,17 +1490,17 @@ namespace SLC1_N
int lunit = Convert.ToInt32(LL28CH1client.ArrRegister[28]);
SetLUnit(1, lunit);
// 当前压力
string fNowpressure = LL28CH1client.readFloatF2(48);
SetLabelText(lb_CH1nowPressure, fNowpressure);
//// 当前压力
//string fNowpressure = LL28CH1client.readFloatF2(48);
//SetLabelText(lb_CH1nowPressure, fNowpressure);
// 充气压力(测试压力)
string fTestpressure = LL28CH1client.readFloatF2(57);
SetLabelText(lb_CH1_TestPressure, fTestpressure);
// 大漏(平衡压差)
string fBigLeak = LL28CH1client.readFloatF2(35);
SetLabelText(lb_CH1BigLeak, fBigLeak);
//// 大漏(平衡压差)
//string fBigLeak = LL28CH1client.readFloatF2(35);
//SetLabelText(lb_CH1BigLeak, fBigLeak);
// 微漏(泄漏量)
string fSmallLeak = LL28CH1client.readFloatF2(38);
@@ -1529,17 +1561,17 @@ namespace SLC1_N
SetLabelText(lb_CH1_Status, "完成");
CH1TestTime.stopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
// 当前压力
string fNowpressure = LL28CH1client.readFloatF2(48);
SetLabelText(lb_CH1nowPressure, fNowpressure);
//// 当前压力
//string fNowpressure = LL28CH1client.readFloatF2(48);
//SetLabelText(lb_CH1nowPressure, fNowpressure);
// 充气压力
string fTestpressure = LL28CH1client.readFloatF2(57);
SetLabelText(lb_CH1_TestPressure, fTestpressure);
//大漏
string fBigLeak = LL28CH1client.readFloatF2(35);
SetLabelText(lb_CH1BigLeak, fBigLeak);
////大漏
//string fBigLeak = LL28CH1client.readFloatF2(35);
//SetLabelText(lb_CH1BigLeak, fBigLeak);
//微漏
string fSmallLeak = LL28CH1client.readFloatF2(38);
@@ -1664,7 +1696,11 @@ namespace SLC1_N
// 测试完成并且正负压都完成则视为结束
if (testfinish && PorNfinish)
{
if(result)
bool_CH1start_time = false;
int time = (DateTime.Now - CH1start_time).Seconds;
SetLabelText(lb_CH1testTime, $"{time} s");
if (result)
{
m_production.AddOK();
}
@@ -1742,6 +1778,8 @@ namespace SLC1_N
CH2testCount = 0; // 重置测试次数
CH2TestRecord.Reset();
bool_CH2start_time = false;
// 模式切回正压
CH2NowMode = "正压";
LL28CH2client.writeRegisters(1006, GetYiqiParam(2, "P").GetArray());
@@ -1757,6 +1795,14 @@ namespace SLC1_N
case (int)yiqi.prepare:
{
if (bool_CH2start_time == false)
{
bool_CH2start_time = true;
CH2start_time = DateTime.Now;
SetLabelText(lb_CH2testTime, $"");
}
// 准备超时处理
if (!prepareOutTime_Dictionary.ContainsKey(2))
{
@@ -1786,6 +1832,15 @@ namespace SLC1_N
if (LL28CH2client.ArrCoil[2])
{
prepareOutTime_Dictionary.Remove(2);
SetLabelText(lb_CH2ProcessTime1, (LL28CH2client.ArrRegister[6] / 10.0).ToString() + " s");
SetLabelText(lb_CH2ProcessTime2, (LL28CH2client.ArrRegister[7] / 10.0).ToString() + " s");
SetLabelText(lb_CH2ProcessTime3, (LL28CH2client.ArrRegister[8] / 10.0).ToString() + " s");
SetLabelText(lb_CH2ProcessTime4, (LL28CH2client.ArrRegister[9] / 10.0).ToString() + " s");
SetLabelText(lb_CH2TestPressureUp, LL28CH2client.readFloat(13));
SetLabelText(lb_CH2TestPressureDown, LL28CH2client.readFloat(15));
ch2workstation = (int)yiqi.test;
}
}
@@ -1833,17 +1888,17 @@ namespace SLC1_N
int lunit = Convert.ToInt32(LL28CH2client.ArrRegister[28]);
SetLUnit(2, lunit);
// 当前压力
string fNowpressure = LL28CH2client.readFloatF2(48);
SetLabelText(lb_CH2nowPressure, fNowpressure);
//// 当前压力
//string fNowpressure = LL28CH2client.readFloatF2(48);
//SetLabelText(lb_CH2nowPressure, fNowpressure);
// 充气压力(测试压力)
string fTestpressure = LL28CH2client.readFloatF2(57);
SetLabelText(lb_CH2_TestPressure, fTestpressure);
// 大漏(平衡压差)
string fBigLeak = LL28CH2client.readFloatF2(35);
SetLabelText(lb_CH2BigLeak, fBigLeak);
//// 大漏(平衡压差)
//string fBigLeak = LL28CH2client.readFloatF2(35);
//SetLabelText(lb_CH2BigLeak, fBigLeak);
// 微漏(泄漏量)
string fSmallLeak = LL28CH2client.readFloatF2(38);
@@ -1904,17 +1959,17 @@ namespace SLC1_N
SetLabelText(lb_CH2_Status, "完成");
CH2TestTime.stopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
// 当前压力
string fNowpressure = LL28CH2client.readFloatF2(48);
SetLabelText(lb_CH2nowPressure, fNowpressure);
//// 当前压力
//string fNowpressure = LL28CH2client.readFloatF2(48);
//SetLabelText(lb_CH2nowPressure, fNowpressure);
// 充气压力
string fTestpressure = LL28CH2client.readFloatF2(57);
SetLabelText(lb_CH2_TestPressure, fTestpressure);
//大漏
string fBigLeak = LL28CH2client.readFloatF2(35);
SetLabelText(lb_CH2BigLeak, fBigLeak);
////大漏
//string fBigLeak = LL28CH2client.readFloatF2(35);
//SetLabelText(lb_CH2BigLeak, fBigLeak);
//微漏
string fSmallLeak = LL28CH2client.readFloatF2(38);
@@ -2039,6 +2094,10 @@ namespace SLC1_N
// 测试完成并且正负压都完成则视为结束
if (testfinish && PorNfinish)
{
bool_CH2start_time = false;
int time = (DateTime.Now - CH2start_time).Seconds;
SetLabelText(lb_CH2testTime, $"{time} s");
if (result)
{
m_production.AddOK();
@@ -2117,6 +2176,8 @@ namespace SLC1_N
CH3testCount = 0; // 重置测试次数
CH2TestRecord.Reset();
bool_CH3start_time = false;
// 模式切回正压
CH3NowMode = "正压";
LL28CH3client.writeRegisters(1006, GetYiqiParam(3, "P").GetArray());
@@ -2132,6 +2193,14 @@ namespace SLC1_N
case (int)yiqi.prepare:
{
if (bool_CH3start_time == false)
{
bool_CH3start_time = true;
CH3start_time = DateTime.Now;
SetLabelText(lb_CH3testTime, $"");
}
// 准备超时处理
if (!prepareOutTime_Dictionary.ContainsKey(3))
{
@@ -2161,6 +2230,15 @@ namespace SLC1_N
if (LL28CH3client.ArrCoil[2])
{
prepareOutTime_Dictionary.Remove(3);
SetLabelText(lb_CH3ProcessTime1, (LL28CH3client.ArrRegister[6] / 10.0).ToString() + " s");
SetLabelText(lb_CH3ProcessTime2, (LL28CH3client.ArrRegister[7] / 10.0).ToString() + " s");
SetLabelText(lb_CH3ProcessTime3, (LL28CH3client.ArrRegister[8] / 10.0).ToString() + " s");
SetLabelText(lb_CH3ProcessTime4, (LL28CH3client.ArrRegister[9] / 10.0).ToString() + " s");
SetLabelText(lb_CH3TestPressureUp, LL28CH3client.readFloat(13));
SetLabelText(lb_CH3TestPressureDown, LL28CH3client.readFloat(15));
ch3workstation = (int)yiqi.test;
}
}
@@ -2208,17 +2286,17 @@ namespace SLC1_N
int lunit = Convert.ToInt32(LL28CH3client.ArrRegister[28]);
SetLUnit(3, lunit);
// 当前压力
string fNowpressure = LL28CH3client.readFloatF2(48);
SetLabelText(lb_CH3nowPressure, fNowpressure);
//// 当前压力
//string fNowpressure = LL28CH3client.readFloatF2(48);
//SetLabelText(lb_CH3nowPressure, fNowpressure);
// 充气压力(测试压力)
string fTestpressure = LL28CH3client.readFloatF2(57);
SetLabelText(lb_CH3_TestPressure, fTestpressure);
// 大漏(平衡压差)
string fBigLeak = LL28CH3client.readFloatF2(35);
SetLabelText(lb_CH3BigLeak, fBigLeak);
//// 大漏(平衡压差)
//string fBigLeak = LL28CH3client.readFloatF2(35);
//SetLabelText(lb_CH3BigLeak, fBigLeak);
// 微漏(泄漏量)
string fSmallLeak = LL28CH3client.readFloatF2(38);
@@ -2279,17 +2357,17 @@ namespace SLC1_N
SetLabelText(lb_CH3_Status, "完成");
CH3TestTime.stopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
// 当前压力
string fNowpressure = LL28CH3client.readFloatF2(48);
SetLabelText(lb_CH3nowPressure, fNowpressure);
//// 当前压力
//string fNowpressure = LL28CH3client.readFloatF2(48);
//SetLabelText(lb_CH3nowPressure, fNowpressure);
// 充气压力
string fTestpressure = LL28CH3client.readFloatF2(57);
SetLabelText(lb_CH3_TestPressure, fTestpressure);
//大漏
string fBigLeak = LL28CH3client.readFloatF2(35);
SetLabelText(lb_CH3BigLeak, fBigLeak);
////大漏
//string fBigLeak = LL28CH3client.readFloatF2(35);
//SetLabelText(lb_CH3BigLeak, fBigLeak);
//微漏
string fSmallLeak = LL28CH3client.readFloatF2(38);
@@ -2415,6 +2493,10 @@ namespace SLC1_N
// 测试完成并且正负压都完成则视为结束
if (testfinish && PorNfinish)
{
bool_CH3start_time = false;
int time = (DateTime.Now - CH3start_time).Seconds;
SetLabelText(lb_CH3testTime, $"{time} s");
if (result)
{
m_production.AddOK();
@@ -2493,6 +2575,8 @@ namespace SLC1_N
CH4testCount = 0; // 重置测试次数
CH4TestRecord.Reset();
bool_CH4start_time = false;
// 模式切回正压
CH4NowMode = "正压";
LL28CH4client.writeRegisters(1006, GetYiqiParam(4, "P").GetArray());
@@ -2508,6 +2592,14 @@ namespace SLC1_N
case (int)yiqi.prepare:
{
if (bool_CH4start_time == false)
{
bool_CH4start_time = true;
CH4start_time = DateTime.Now;
SetLabelText(lb_CH4testTime, $"");
}
// 准备超时处理
if (!prepareOutTime_Dictionary.ContainsKey(4))
{
@@ -2537,6 +2629,15 @@ namespace SLC1_N
if (LL28CH4client.ArrCoil[2])
{
prepareOutTime_Dictionary.Remove(4);
SetLabelText(lb_CH4ProcessTime1, (LL28CH4client.ArrRegister[6] / 10.0).ToString() + " s");
SetLabelText(lb_CH4ProcessTime2, (LL28CH4client.ArrRegister[7] / 10.0).ToString() + " s");
SetLabelText(lb_CH4ProcessTime3, (LL28CH4client.ArrRegister[8] / 10.0).ToString() + " s");
SetLabelText(lb_CH4ProcessTime4, (LL28CH4client.ArrRegister[9] / 10.0).ToString() + " s");
SetLabelText(lb_CH4TestPressureUp, LL28CH4client.readFloat(13));
SetLabelText(lb_CH4TestPressureDown, LL28CH4client.readFloat(15));
ch4workstation = (int)yiqi.test;
}
}
@@ -2584,17 +2685,17 @@ namespace SLC1_N
int lunit = Convert.ToInt32(LL28CH4client.ArrRegister[28]);
SetLUnit(4, lunit);
// 当前压力
string fNowpressure = LL28CH4client.readFloatF2(48);
SetLabelText(lb_CH4nowPressure, fNowpressure);
//// 当前压力
//string fNowpressure = LL28CH4client.readFloatF2(48);
//SetLabelText(lb_CH4nowPressure, fNowpressure);
// 充气压力(测试压力)
string fTestpressure = LL28CH4client.readFloatF2(57);
SetLabelText(lb_CH4_TestPressure, fTestpressure);
// 大漏(平衡压差)
string fBigLeak = LL28CH4client.readFloatF2(35);
SetLabelText(lb_CH4BigLeak, fBigLeak);
//// 大漏(平衡压差)
//string fBigLeak = LL28CH4client.readFloatF2(35);
//SetLabelText(lb_CH4BigLeak, fBigLeak);
// 微漏(泄漏量)
string fSmallLeak = LL28CH4client.readFloatF2(38);
@@ -2655,17 +2756,17 @@ namespace SLC1_N
SetLabelText(lb_CH4_Status, "完成");
CH4TestTime.stopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
// 当前压力
string fNowpressure = LL28CH4client.readFloatF2(48);
SetLabelText(lb_CH4nowPressure, fNowpressure);
//// 当前压力
//string fNowpressure = LL28CH4client.readFloatF2(48);
//SetLabelText(lb_CH4nowPressure, fNowpressure);
// 充气压力
string fTestpressure = LL28CH4client.readFloatF2(57);
SetLabelText(lb_CH4_TestPressure, fTestpressure);
//大漏
string fBigLeak = LL28CH4client.readFloatF2(35);
SetLabelText(lb_CH4BigLeak, fBigLeak);
////大漏
//string fBigLeak = LL28CH4client.readFloatF2(35);
//SetLabelText(lb_CH4BigLeak, fBigLeak);
//微漏
string fSmallLeak = LL28CH4client.readFloatF2(38);
@@ -2793,6 +2894,10 @@ namespace SLC1_N
// 测试完成并且正负压都完成则视为结束
if (testfinish && PorNfinish)
{
bool_CH4start_time = false;
int time = (DateTime.Now - CH4start_time).Seconds;
SetLabelText(lb_CH4testTime, $"{time} s");
if (result)
{
m_production.AddOK();
@@ -2910,32 +3015,32 @@ namespace SLC1_N
case 1:
lb_CH1_PressureUnit.Invoke((MethodInvoker)delegate
{
lb_CH1BigLeakUnit.Text = PUnit;
lb_CH1_nowPressureUnit.Text = PUnit;
//lb_CH1BigLeakUnit.Text = PUnit;
//lb_CH1_nowPressureUnit.Text = PUnit;
lb_CH1_PressureUnit.Text = PUnit;
});
break;
case 2:
lb_CH2_PressureUnit.Invoke((MethodInvoker)delegate
{
lb_CH2BigLeakUnit.Text = PUnit;
lb_CH2_nowPressureUnit.Text = PUnit;
//lb_CH2BigLeakUnit.Text = PUnit;
//lb_CH2_nowPressureUnit.Text = PUnit;
lb_CH2_PressureUnit.Text = PUnit;
});
break;
case 3:
lb_CH3_PressureUnit.Invoke((MethodInvoker)delegate
{
lb_CH3BigLeakUnit.Text = PUnit;
lb_CH3_nowPressureUnit.Text = PUnit;
//lb_CH3BigLeakUnit.Text = PUnit;
//lb_CH3_nowPressureUnit.Text = PUnit;
lb_CH3_PressureUnit.Text = PUnit;
});
break;
case 4:
lb_CH4_PressureUnit.Invoke((MethodInvoker)delegate
{
lb_CH4BigLeakUnit.Text = PUnit;
lb_CH4_nowPressureUnit.Text = PUnit;
//lb_CH4BigLeakUnit.Text = PUnit;
//lb_CH4_nowPressureUnit.Text = PUnit;
lb_CH4_PressureUnit.Text = PUnit;
});
break;
@@ -3651,7 +3756,7 @@ namespace SLC1_N
//fileWriter.Write(ch2params.Leaklowlimit + ch2params.LUnit + ",");
fileWriter.Write(lb_CH2_Result.Text + ",");
//fileWriter.Write(CH2LeakPress.Text + ch2params.PUnit + ",");
fileWriter.Write(lb_CH2BigLeak.Text + ",");
//fileWriter.Write(lb_CH2BigLeak.Text + ",");
//fileWriter.Write(CH2SmallLeak.Text + ch2params.LUnit + ",");
fileWriter.Write(lb_CH2_Result.Text + "\n");
}