|
|
|
|
@ -789,7 +789,10 @@ int CameraCheckAnalysisy::CheckImgRun()
|
|
|
|
|
if (m_pCheck_Result->getImgPushComplate())
|
|
|
|
|
{
|
|
|
|
|
curcheckStep = Check_Step_Complete; // 进入到预图片检测阶段
|
|
|
|
|
m_pCheck_Result->SetCheckStep(curcheckStep);
|
|
|
|
|
// 注意:这里先不发布 Check_Step_Complete。
|
|
|
|
|
// 若提前发布,ALLImgCheckAnalysisy 线程会立刻把结果塞给 deal,
|
|
|
|
|
// 而本线程还在 InsertCameraLog() 里写 result->det_LogList,两边并发(读/写)竞争。
|
|
|
|
|
// 因此把 SetCheckStep(Check_Step_Complete) 挪到 InsertCameraLog() 之后。
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
@ -806,6 +809,8 @@ int CameraCheckAnalysisy::CheckImgRun()
|
|
|
|
|
m_pdetlog->AddCheckstr(PrintLevel_0, "CheckImgRun", "========came %s Check ALL end time %ld ms %s",
|
|
|
|
|
m_pCheck_Result->cameraBaseResult->strCameraName.c_str(), tend - m_pCheck_Result->time_start, strTimg.c_str());
|
|
|
|
|
InsertCameraLog();
|
|
|
|
|
// 日志拼接完成后再发布“检测完成”,避免 deal 提前读到正在写入的 det_LogList
|
|
|
|
|
m_pCheck_Result->SetCheckStep(Check_Step_Complete);
|
|
|
|
|
std::lock_guard<std::mutex> lock(mtx_WaiteImg);
|
|
|
|
|
m_bHaveImgeDet = false;
|
|
|
|
|
|
|
|
|
|
@ -850,8 +855,12 @@ int CameraCheckAnalysisy::InsertCameraLog()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 1、把图片的相关日志 写到 返回 日志中。
|
|
|
|
|
// 注意:DetLog 可能仍被实例线程写入,使用 GetLogs() 做加锁快照,避免并发遍历。
|
|
|
|
|
{
|
|
|
|
|
std::vector<std::string> imgLogs = pImageResult->detlog->GetLogs();
|
|
|
|
|
m_CheckResult_shareP->det_LogList.insert(m_CheckResult_shareP->det_LogList.end(),
|
|
|
|
|
pImageResult->detlog->logList.begin(), pImageResult->detlog->logList.end());
|
|
|
|
|
imgLogs.begin(), imgLogs.end());
|
|
|
|
|
}
|
|
|
|
|
std::string str = "";
|
|
|
|
|
char buffer[256];
|
|
|
|
|
// 2、把缺陷信息 写的 返回日志中。
|
|
|
|
|
@ -882,8 +891,9 @@ int CameraCheckAnalysisy::InsertCameraLog()
|
|
|
|
|
if (QX_info->result == QX_RESULT_TYPE_NG)
|
|
|
|
|
{
|
|
|
|
|
std::shared_ptr<DetLog> pQxLog = pDetResult->pQx_ErrorList->at(qxidx).detlog;
|
|
|
|
|
std::vector<std::string> qxLogs = pQxLog->GetLogs();
|
|
|
|
|
m_CheckResult_shareP->det_LogList.insert(m_CheckResult_shareP->det_LogList.end(),
|
|
|
|
|
pQxLog->logList.begin(), pQxLog->logList.end());
|
|
|
|
|
qxLogs.begin(), qxLogs.end());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -899,8 +909,9 @@ int CameraCheckAnalysisy::InsertCameraLog()
|
|
|
|
|
if (QX_info->result == QX_RESULT_TYPE_YS)
|
|
|
|
|
{
|
|
|
|
|
std::shared_ptr<DetLog> pQxLog = pDetResult->pQx_ErrorList->at(qxidx).detlog;
|
|
|
|
|
std::vector<std::string> qxLogs = pQxLog->GetLogs();
|
|
|
|
|
m_CheckResult_shareP->det_LogList.insert(m_CheckResult_shareP->det_LogList.end(),
|
|
|
|
|
pQxLog->logList.begin(), pQxLog->logList.end());
|
|
|
|
|
qxLogs.begin(), qxLogs.end());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -916,8 +927,9 @@ int CameraCheckAnalysisy::InsertCameraLog()
|
|
|
|
|
if (QX_info->result == QX_RESULT_TYPE_OK)
|
|
|
|
|
{
|
|
|
|
|
std::shared_ptr<DetLog> pQxLog = pDetResult->pQx_ErrorList->at(qxidx).detlog;
|
|
|
|
|
std::vector<std::string> qxLogs = pQxLog->GetLogs();
|
|
|
|
|
m_CheckResult_shareP->det_LogList.insert(m_CheckResult_shareP->det_LogList.end(),
|
|
|
|
|
pQxLog->logList.begin(), pQxLog->logList.end());
|
|
|
|
|
qxLogs.begin(), qxLogs.end());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -933,8 +945,9 @@ int CameraCheckAnalysisy::InsertCameraLog()
|
|
|
|
|
if (QX_info->result == QX_RESULT_TYPE_NoJduge)
|
|
|
|
|
{
|
|
|
|
|
std::shared_ptr<DetLog> pQxLog = pDetResult->pQx_ErrorList->at(qxidx).detlog;
|
|
|
|
|
std::vector<std::string> qxLogs = pQxLog->GetLogs();
|
|
|
|
|
m_CheckResult_shareP->det_LogList.insert(m_CheckResult_shareP->det_LogList.end(),
|
|
|
|
|
pQxLog->logList.begin(), pQxLog->logList.end());
|
|
|
|
|
qxLogs.begin(), qxLogs.end());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -946,8 +959,11 @@ int CameraCheckAnalysisy::InsertCameraLog()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 3、把相机的日志 写到 返回日志中。
|
|
|
|
|
{
|
|
|
|
|
std::vector<std::string> camLogs = m_pCheck_Result->detlog->GetLogs();
|
|
|
|
|
m_CheckResult_shareP->det_LogList.insert(m_CheckResult_shareP->det_LogList.end(),
|
|
|
|
|
m_pCheck_Result->detlog->logList.begin(), m_pCheck_Result->detlog->logList.end());
|
|
|
|
|
camLogs.begin(), camLogs.end());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
sprintf(buffer, " =====================Product Log =============================");
|
|
|
|
|
@ -955,8 +971,11 @@ int CameraCheckAnalysisy::InsertCameraLog()
|
|
|
|
|
m_CheckResult_shareP->det_LogList.push_back(str);
|
|
|
|
|
}
|
|
|
|
|
// 4、把产品相关日志 写到 返回日志中。
|
|
|
|
|
{
|
|
|
|
|
std::vector<std::string> productLogs = m_pCheck_Result->productBaseResult->detlog->GetLogs();
|
|
|
|
|
m_CheckResult_shareP->det_LogList.insert(m_CheckResult_shareP->det_LogList.end(),
|
|
|
|
|
m_pCheck_Result->productBaseResult->detlog->logList.begin(), m_pCheck_Result->productBaseResult->detlog->logList.end());
|
|
|
|
|
productLogs.begin(), productLogs.end());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|