|
|
|
@@ -2029,19 +2029,36 @@ namespace MaiMuAOI.SysCtrl |
|
|
|
public double TensionGetValueNewStep()
|
|
|
|
{
|
|
|
|
double tensionValue = 0;
|
|
|
|
for (int i = 0; i < 10; i++)
|
|
|
|
for (int cnt = 0; cnt < 2; cnt++)
|
|
|
|
{
|
|
|
|
tensionValue = tensionDev.GetValue() + confMgr.SysConfigParams.Tension_Offset;//加入张力偏差
|
|
|
|
tensionValue = Math.Round(tensionValue, 2);//保留2位小数
|
|
|
|
for (int i = 0; i < 10; i++)
|
|
|
|
{
|
|
|
|
tensionValue = tensionDev.GetValue() + confMgr.SysConfigParams.Tension_Offset;//加入张力偏差
|
|
|
|
tensionValue = Math.Round(tensionValue, 2);//保留2位小数
|
|
|
|
if (tensionValue >= 0)
|
|
|
|
break;
|
|
|
|
Thread.Sleep(50);
|
|
|
|
}
|
|
|
|
//成功读取跳出循环
|
|
|
|
if (tensionValue >= 0)
|
|
|
|
break;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//重连
|
|
|
|
tensionDev.CloseDev();
|
|
|
|
Thread.Sleep(100);
|
|
|
|
if (tensionDev.OpenDevByCom(confMgr.SysConfigParams.TensionCom, confMgr.SysConfigParams.TensionComBaud) < 0)
|
|
|
|
{
|
|
|
|
Log("张力传感器重连失败!", "重连", WarningEnum.High);
|
|
|
|
return -10;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (tensionValue < 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return tensionValue;
|
|
|
|
}
|
|
|
|
public class TensionResult
|
|
|
|
@@ -2631,7 +2648,7 @@ namespace MaiMuAOI.SysCtrl |
|
|
|
Log("张力传感器初始化失败!", "初始化", WarningEnum.High);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
InitLog("初始化张力传感器成功!");
|
|
|
|
//InitLog("初始化张力传感器成功!");
|
|
|
|
|
|
|
|
//镜头电机初始化
|
|
|
|
Log("复位", "镜头电机初始化");
|
|
|
|
@@ -4276,7 +4293,10 @@ namespace MaiMuAOI.SysCtrl |
|
|
|
tensionValue = TensionGetValueNewStep();
|
|
|
|
if (tensionValue < 0)
|
|
|
|
{
|
|
|
|
Log("张力读取", "张力读取失败,忽略此次测试!");
|
|
|
|
if(tensionValue == -1)
|
|
|
|
Log("张力读取", "张力读取失败,忽略此次测试!");
|
|
|
|
else
|
|
|
|
Log("张力读取", "张力读取失败且处理失败,忽略此次测试!");
|
|
|
|
ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.触发张力按钮灯), GetIOBitIndex((int)DOName.触发张力按钮灯), false);
|
|
|
|
return stepIndex;
|
|
|
|
}
|
|
|
|
@@ -5083,75 +5103,24 @@ namespace MaiMuAOI.SysCtrl |
|
|
|
attachmentFile = model.AttachmentList.FirstOrDefault(x => x.Type == 0);
|
|
|
|
Log($"{stepIndex + 1}-{processName}", $"比对图像,{model.AttachmentList.Count}|{(attachmentFile == null ? "null" : attachmentFile.NameTimestamp + attachmentFile.ExtendName)}");
|
|
|
|
|
|
|
|
if (testParam.AutoMark)
|
|
|
|
//自动点位数计算
|
|
|
|
if (attachmentFile != null)
|
|
|
|
{
|
|
|
|
//自动点位数计算
|
|
|
|
if (attachmentFile != null)
|
|
|
|
{
|
|
|
|
gbxBmpPath = confMgr.ProjectDir + $"\\{attachmentFile.NameTimestamp}";
|
|
|
|
if (!File.Exists(gbxBmpPath + attachmentFile.ExtendName))
|
|
|
|
gbxBmpPath = "";
|
|
|
|
}
|
|
|
|
if (gbxBmpPath == "")
|
|
|
|
{
|
|
|
|
Log($"{stepIndex + 1}-{processName}", $"比对图像,图纸不存在!", WarningEnum.High);
|
|
|
|
return stepIndex;
|
|
|
|
}
|
|
|
|
gbxBmpPath = confMgr.ProjectDir + $"\\{attachmentFile.NameTimestamp}";
|
|
|
|
if (!File.Exists(gbxBmpPath + attachmentFile.ExtendName))
|
|
|
|
gbxBmpPath = "";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (gbxBmpPath == "")
|
|
|
|
{
|
|
|
|
Log($"{stepIndex + 1}-{processName}", $"比对图像,图纸不存在!", WarningEnum.High);
|
|
|
|
return stepIndex;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!testParam.AutoMark)
|
|
|
|
{
|
|
|
|
//自动点位数计算
|
|
|
|
if (attachmentFile != null)
|
|
|
|
{
|
|
|
|
gbxBmpPath = confMgr.ProjectDir + $"\\{attachmentFile.NameTimestamp}";
|
|
|
|
if (!File.Exists(gbxBmpPath + attachmentFile.ExtendName))
|
|
|
|
gbxBmpPath = "";
|
|
|
|
}
|
|
|
|
if (gbxBmpPath == "")
|
|
|
|
{
|
|
|
|
Log($"{stepIndex + 1}-{processName}", $"比对图像,图纸不存在!", WarningEnum.High);
|
|
|
|
return stepIndex;
|
|
|
|
}
|
|
|
|
//手动点位数计算
|
|
|
|
CurrAdaqter = new int[testLabels.Count];
|
|
|
|
CurrAdaqter[(int)testParam.TestType] = testParam.PointCnt;
|
|
|
|
#if OLD_Invalid
|
|
|
|
switch (testParam.TestType)
|
|
|
|
{
|
|
|
|
case PointTestType.Y轴方向PT值检测:
|
|
|
|
CurrAdaqter[0] = testParam.PointCnt;
|
|
|
|
break;
|
|
|
|
case PointTestType.线宽正面:
|
|
|
|
CurrAdaqter[1] = testParam.PointCnt;
|
|
|
|
break;
|
|
|
|
case PointTestType.反面检测:
|
|
|
|
CurrAdaqter[2] = testParam.PointCnt;
|
|
|
|
break;
|
|
|
|
case PointTestType.X轴方向PT值检测:
|
|
|
|
CurrAdaqter[3] = testParam.PointCnt;
|
|
|
|
break;
|
|
|
|
case PointTestType.主栅连接线检测:
|
|
|
|
CurrAdaqter[4] = testParam.PointCnt;
|
|
|
|
break;
|
|
|
|
case PointTestType.主栅宽度检测:
|
|
|
|
CurrAdaqter[5] = testParam.PointCnt;
|
|
|
|
break;
|
|
|
|
case PointTestType.主栅间距:
|
|
|
|
CurrAdaqter[6] = testParam.PointCnt;
|
|
|
|
break;
|
|
|
|
case PointTestType.细栅间距检测:
|
|
|
|
CurrAdaqter[7] = testParam.PointCnt;
|
|
|
|
break;
|
|
|
|
case PointTestType.背极宽度:
|
|
|
|
CurrAdaqter[8] = testParam.PointCnt;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
Log($"{stepIndex + 1}-{processName}", $"参数不支持!", WarningEnum.High);
|
|
|
|
OnAutoRuning(new RunEventArgs(liStatocStepIndex, $"参数不支持!", 4, false));
|
|
|
|
return stepIndex;
|
|
|
|
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
//自动寻点
|
|
|
|
if ((testParam.AutoMark)|| (testParam.DefPos))
|
|
|
|
@@ -5197,10 +5166,17 @@ namespace MaiMuAOI.SysCtrl |
|
|
|
}
|
|
|
|
int posIndex = this.CurrPoinntCount;
|
|
|
|
//手动顺寻
|
|
|
|
if (!testParam.SelectPoint)
|
|
|
|
if( (!testParam.SelectPoint)&&(testParam.Indexs.Count >= testParam.PointCnt))
|
|
|
|
{
|
|
|
|
posIndex = testParam.Indexs[this.CurrPoinntCount];
|
|
|
|
}
|
|
|
|
else if (!testParam.SelectPoint)
|
|
|
|
{
|
|
|
|
Log($"{stepIndex + 1}-{processName}",
|
|
|
|
$"手动测试点位顺序范围错误:{testParam.Indexs.Count}!", WarningEnum.High);
|
|
|
|
return stepIndex;
|
|
|
|
}
|
|
|
|
|
|
|
|
//判断是否一点完成
|
|
|
|
bool IsOverDef = true;
|
|
|
|
|
|
|
|
@@ -5817,7 +5793,42 @@ namespace MaiMuAOI.SysCtrl |
|
|
|
+ this.CurrAdaqter[14] + this.CurrAdaqter[15] + this.CurrAdaqter[16] + this.CurrAdaqter[17]
|
|
|
|
+ this.CurrAdaqter[18] + this.CurrAdaqter[19] + 4 * posIndex + 3]);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PointTestType.SP2主栅宽度:
|
|
|
|
IsOverDef = false;
|
|
|
|
TestCnt = testParam.PointCnt;
|
|
|
|
t = model.TestDefectPointsList.Where(q => q.PointCode == "SP2主栅宽度").ToList();
|
|
|
|
if (testParam.AutoMark)
|
|
|
|
if (testParam.PointCnt > t.Count)
|
|
|
|
{
|
|
|
|
Log($"{stepIndex + 1}-{processName}", $"SP2主栅宽度参数,点数大于产品配置点数!", WarningEnum.High);
|
|
|
|
return stepIndex;
|
|
|
|
}
|
|
|
|
//走位计算
|
|
|
|
TestPosTagPPUValue[0] = double.Parse(TestPos[this.CurrAdaqter[0] * 4 + this.CurrAdaqter[1]
|
|
|
|
+ this.CurrAdaqter[2] + this.CurrAdaqter[3] * 4 + this.CurrAdaqter[4] + this.CurrAdaqter[5]
|
|
|
|
+ this.CurrAdaqter[6] + this.CurrAdaqter[7] + this.CurrAdaqter[8] + this.CurrAdaqter[9]
|
|
|
|
+ this.CurrAdaqter[10] + this.CurrAdaqter[11] + this.CurrAdaqter[12] + this.CurrAdaqter[13]
|
|
|
|
+ this.CurrAdaqter[14] + this.CurrAdaqter[15] + this.CurrAdaqter[16] + this.CurrAdaqter[17]
|
|
|
|
+ this.CurrAdaqter[18] + this.CurrAdaqter[19] + this.CurrAdaqter[20] + 4 * posIndex]);
|
|
|
|
TestPosTagPPUValue[1] = double.Parse(TestPos[this.CurrAdaqter[0] * 4 + this.CurrAdaqter[1]
|
|
|
|
+ this.CurrAdaqter[2] + this.CurrAdaqter[3] * 4 + this.CurrAdaqter[4] + this.CurrAdaqter[5]
|
|
|
|
+ this.CurrAdaqter[6] + this.CurrAdaqter[7] + this.CurrAdaqter[8] + this.CurrAdaqter[9]
|
|
|
|
+ this.CurrAdaqter[10] + this.CurrAdaqter[11] + this.CurrAdaqter[12] + this.CurrAdaqter[13]
|
|
|
|
+ this.CurrAdaqter[14] + this.CurrAdaqter[15] + this.CurrAdaqter[16] + this.CurrAdaqter[17]
|
|
|
|
+ this.CurrAdaqter[18] + this.CurrAdaqter[19] + this.CurrAdaqter[20] + 4 * posIndex + 1]);
|
|
|
|
TestPosTagPPUValue[2] = double.Parse(TestPos[this.CurrAdaqter[0] * 4 + this.CurrAdaqter[1]
|
|
|
|
+ this.CurrAdaqter[2] + this.CurrAdaqter[3] * 4 + this.CurrAdaqter[4] + this.CurrAdaqter[5]
|
|
|
|
+ this.CurrAdaqter[6] + this.CurrAdaqter[7] + this.CurrAdaqter[8] + this.CurrAdaqter[9]
|
|
|
|
+ this.CurrAdaqter[10] + this.CurrAdaqter[11] + this.CurrAdaqter[12] + this.CurrAdaqter[13]
|
|
|
|
+ this.CurrAdaqter[14] + this.CurrAdaqter[15] + this.CurrAdaqter[16] + this.CurrAdaqter[17]
|
|
|
|
+ this.CurrAdaqter[18] + this.CurrAdaqter[19] + this.CurrAdaqter[20] + 4 * posIndex + 2]);
|
|
|
|
TestPosTagPPUValue[3] = double.Parse(TestPos[this.CurrAdaqter[0] * 4 + this.CurrAdaqter[1]
|
|
|
|
+ this.CurrAdaqter[2] + this.CurrAdaqter[3] * 4 + this.CurrAdaqter[4] + this.CurrAdaqter[5]
|
|
|
|
+ this.CurrAdaqter[6] + this.CurrAdaqter[7] + this.CurrAdaqter[8] + this.CurrAdaqter[9]
|
|
|
|
+ this.CurrAdaqter[10] + this.CurrAdaqter[11] + this.CurrAdaqter[12] + this.CurrAdaqter[13]
|
|
|
|
+ this.CurrAdaqter[14] + this.CurrAdaqter[15] + this.CurrAdaqter[16] + this.CurrAdaqter[17]
|
|
|
|
+ this.CurrAdaqter[18] + this.CurrAdaqter[19] + this.CurrAdaqter[20] + 4 * posIndex + 3]);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
Log($"{stepIndex + 1}-{processName}", $"参数不支持!", WarningEnum.High);
|
|
|
|
OnAutoRuning(new RunEventArgs(liStatocStepIndex, $"参数不支持!", 4, false));
|
|
|
|
@@ -7478,6 +7489,22 @@ namespace MaiMuAOI.SysCtrl |
|
|
|
}
|
|
|
|
testName = "焊点间隔检测";
|
|
|
|
break;
|
|
|
|
case 9902:
|
|
|
|
Log($"SP2主栅宽度值", $"SP2主栅宽度{lstTestData.Count}:{Math.Round(data + testParam.OffsetValue, 4)}");
|
|
|
|
//if (order != null)
|
|
|
|
// order.WeldingSpotDisValue = aveData;
|
|
|
|
if (testParam.OpenUseLimit)
|
|
|
|
{
|
|
|
|
PtUpper = testParam.StandardValues + testParam.MaxLimit;
|
|
|
|
PtLower = testParam.StandardValues - testParam.MinLimit;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
PtUpper = 0;
|
|
|
|
PtLower = 0;
|
|
|
|
}
|
|
|
|
testName = "SP2主栅宽度检测";
|
|
|
|
break;
|
|
|
|
#endregion
|
|
|
|
}
|
|
|
|
|
|
|
|
@@ -7647,6 +7674,12 @@ namespace MaiMuAOI.SysCtrl |
|
|
|
else
|
|
|
|
testindex = 9802;
|
|
|
|
break;
|
|
|
|
case PointTestType.SP2主栅宽度:
|
|
|
|
if (!isPtLastPoint)
|
|
|
|
testindex = 9901;
|
|
|
|
else
|
|
|
|
testindex = 9902;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
Log($"{stepIndex + 1}-{processName}", $"参数不支持!", WarningEnum.High);
|
|
|
|
return false;
|
|
|
|
@@ -7688,7 +7721,7 @@ namespace MaiMuAOI.SysCtrl |
|
|
|
|| (res.index == 8502) || (res.index == 8602) || (res.index == 8702) || (res.index == 8802)
|
|
|
|
|| (res.index == 8902) || (res.index == 9102) || (res.index == 9202) || (res.index == 9302)
|
|
|
|
|| (res.index == 9402) || (res.index == 9502) || (res.index == 9602) || (res.index == 9702)
|
|
|
|
|| (res.index == 9802))
|
|
|
|
|| (res.index == 9802) || (res.index == 9902))
|
|
|
|
{
|
|
|
|
//PT测量 等两点测量
|
|
|
|
lock (lstTestData)
|
|
|
|
@@ -7905,7 +7938,7 @@ namespace MaiMuAOI.SysCtrl |
|
|
|
|| (res.index == 8502) || (res.index == 8602) || (res.index == 8702) || (res.index == 8802)
|
|
|
|
|| (res.index == 8902) || (res.index == 9102) || (res.index == 9202) || (res.index == 9302)
|
|
|
|
|| (res.index == 9402) || (res.index == 9502) || (res.index == 9602) || (res.index == 9702)
|
|
|
|
|| (res.index == 9802))
|
|
|
|
|| (res.index == 9802) || (res.index == 9902))
|
|
|
|
{
|
|
|
|
//PT测量
|
|
|
|
lock (lstTestData)
|
|
|
|
@@ -8935,7 +8968,7 @@ namespace MaiMuAOI.SysCtrl |
|
|
|
{
|
|
|
|
double pos = GetAxisPosValueMM(axisno);
|
|
|
|
camDevFront.ClearImageQueue();
|
|
|
|
Acquisition acq = camDevFront.Snap(1, 1000);
|
|
|
|
Acquisition acq = camDevFront.Snap(1, 5000);
|
|
|
|
if (acq.GrabStatus == "GrabPass")
|
|
|
|
{
|
|
|
|
//显示
|
|
|
|
@@ -8967,6 +9000,11 @@ namespace MaiMuAOI.SysCtrl |
|
|
|
}
|
|
|
|
//Log("自动找方向", $"步进次数:{cnt},位置:{z_hpos - cnt * dir_step}, 反馈:{dir}");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Log("自动找方向", $"拍照失败!");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if((DateTime.Now - dt).TotalMilliseconds > Timeout)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
@@ -9005,6 +9043,15 @@ namespace MaiMuAOI.SysCtrl |
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Log("自动找方向", $"拍照失败!");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if ((DateTime.Now - alldt).TotalMilliseconds > Timeout)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|