|
|
|
|
@ -38,6 +38,9 @@ SmokeBoxIdentification::SmokeBoxIdentification(QWidget *parent)
|
|
|
|
|
}
|
|
|
|
|
QString filePath = applicationDirPath + NET_CONFIG;
|
|
|
|
|
m_pNetControl = new NetControl(filePath, true);
|
|
|
|
|
m_pTcpClientThread = new QThread();
|
|
|
|
|
m_pNetControl->moveToThread(m_pTcpClientThread);
|
|
|
|
|
m_pTcpClientThread->start();
|
|
|
|
|
connect(m_pNetControl, &NetControl::sgReceiveData, this, &SmokeBoxIdentification::onDecodeMsg);
|
|
|
|
|
ADModule::instance()->loadParameters(filePath);
|
|
|
|
|
filePath = applicationDirPath + COM_CONFIG;
|
|
|
|
|
@ -68,7 +71,8 @@ SmokeBoxIdentification::SmokeBoxIdentification(QWidget *parent)
|
|
|
|
|
connect(ADModule::instance(), &ADModule::sgNewNumData, this, &SmokeBoxIdentification::onNewNumData);
|
|
|
|
|
//connect(this, &SmokeBoxIdentification::sgSendData2AndAlgo, ADModule::instance(), &ADModule::onSendData2Algo);
|
|
|
|
|
//connect(this, &SmokeBoxIdentification::sgSaveSensorData2Local, ADModule::instance(), &ADModule::onSaveData2File);
|
|
|
|
|
connect(this, &SmokeBoxIdentification::sgSendStockCheckMsg, this, &SmokeBoxIdentification::onSendStockCheckResults, Qt::QueuedConnection);
|
|
|
|
|
//connect(this, &SmokeBoxIdentification::sgSendResults, this, &SmokeBoxIdentification::onSendResults);
|
|
|
|
|
connect(this, &SmokeBoxIdentification::sgSendMsg, m_pNetControl, &NetControl::onSendMsg, Qt::QueuedConnection);
|
|
|
|
|
connect(ui.action_templateNum, SIGNAL(triggered()), this, SLOT(onActionClicked()));
|
|
|
|
|
emit sgControlSideLight(lightCtrl::emTurnOnLight);
|
|
|
|
|
}
|
|
|
|
|
@ -78,6 +82,12 @@ SmokeBoxIdentification::~SmokeBoxIdentification()
|
|
|
|
|
emit sgControlSideLight(lightCtrl::emTurnOffLight);
|
|
|
|
|
DELETE_POINTER(m_pNetControl);
|
|
|
|
|
DELETE_POINTER(m_pCategoryMatcher);
|
|
|
|
|
if (m_pTcpClientThread)
|
|
|
|
|
{
|
|
|
|
|
m_pTcpClientThread->quit();
|
|
|
|
|
m_pTcpClientThread->wait();
|
|
|
|
|
m_pTcpClientThread = nullptr;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Q_SLOT void SmokeBoxIdentification::onActionClicked()
|
|
|
|
|
@ -170,11 +180,11 @@ Q_SLOT void SmokeBoxIdentification::onCapturedImage(const QVector<ImageInfo>& ve
|
|
|
|
|
saveImage(vecImageInfo, m_workMode);
|
|
|
|
|
if (m_workMode == WorkMode::StockCheck)
|
|
|
|
|
{
|
|
|
|
|
emit sgSendStockCheckMsg(MsgType::DataCollectionEndSC);
|
|
|
|
|
sendResults(MsgType::DataCollectionEndSC);
|
|
|
|
|
}
|
|
|
|
|
else if (m_workMode = WorkMode::IntoStock)
|
|
|
|
|
{
|
|
|
|
|
emit sgSendStockCheckMsg(MsgType::IntoStockResult);
|
|
|
|
|
sendResults(MsgType::IntoStockResult);
|
|
|
|
|
}
|
|
|
|
|
m_workMode = WorkMode::Idle;
|
|
|
|
|
});
|
|
|
|
|
@ -323,7 +333,7 @@ Q_SLOT void SmokeBoxIdentification::onNumStatistic(QString typeNum)
|
|
|
|
|
{
|
|
|
|
|
m_currtStockCheckInfo.smokeQuantityRlt = "0";
|
|
|
|
|
m_currtStockCheckInfo.correctness = false;
|
|
|
|
|
emit sgSendStockCheckMsg(MsgType::StockCheckResult);
|
|
|
|
|
sendResults(MsgType::StockCheckResult);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
@ -359,7 +369,7 @@ Q_SLOT void SmokeBoxIdentification::onNumStatistic(QString typeNum)
|
|
|
|
|
m_currtStockCheckInfo.smokeQuantityRlt = QString::number(matchLabel);
|
|
|
|
|
m_currtStockCheckInfo.correctness = true;
|
|
|
|
|
}
|
|
|
|
|
emit sgSendStockCheckMsg(MsgType::StockCheckResult);
|
|
|
|
|
sendResults(MsgType::StockCheckResult);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
@ -367,13 +377,13 @@ Q_SLOT void SmokeBoxIdentification::onNumStatistic(QString typeNum)
|
|
|
|
|
qWarning() << "Template folder not find: " << smokeCnName;
|
|
|
|
|
m_currtStockCheckInfo.smokeQuantityRlt = "0";
|
|
|
|
|
m_currtStockCheckInfo.correctness = false;
|
|
|
|
|
emit sgSendStockCheckMsg(MsgType::StockCheckResult);
|
|
|
|
|
sendResults(MsgType::StockCheckResult);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SmokeBoxIdentification::onSendStockCheckResults(int mode)
|
|
|
|
|
void SmokeBoxIdentification::sendResults(int mode)
|
|
|
|
|
{
|
|
|
|
|
QString resultInfoMsg;
|
|
|
|
|
switch (mode)
|
|
|
|
|
@ -412,7 +422,7 @@ void SmokeBoxIdentification::onSendStockCheckResults(int mode)
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
m_pNetControl->sendMsg(resultInfoMsg);
|
|
|
|
|
emit sgSendMsg(resultInfoMsg);
|
|
|
|
|
qDebug() << "send msg: " << resultInfoMsg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -555,7 +565,7 @@ Q_SLOT void SmokeBoxIdentification::onSendEmptyCheckResults(const QMap<QString,
|
|
|
|
|
emptyResult.append(EMPTY_CHECK_HEAD).append(SPLIT_RULE).append(m_currtEmptyCheckInfo.streetName)
|
|
|
|
|
.append(SPLIT_RULE).append(m_currtEmptyCheckInfo.taskNum).append(SPLIT_RULE).append(emptyAll)
|
|
|
|
|
.append(END_SYMBOL);
|
|
|
|
|
m_pNetControl->sendMsg(emptyResult);
|
|
|
|
|
emit sgSendMsg(emptyResult);
|
|
|
|
|
qDebug() << "send msg: " << emptyResult;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|