|
|
|
|
|
#pragma execution_character_set("utf-8")
|
|
|
|
|
|
#include "SmokeBoxIdentification.h"
|
|
|
|
|
|
|
|
|
|
|
|
SmokeBoxIdentification::SmokeBoxIdentification(QWidget *parent)
|
|
|
|
|
|
: QMainWindow(parent)
|
|
|
|
|
|
{
|
|
|
|
|
|
qRegisterMetaType<QVector<ImageInfo> >("QVector<ImageInfo>");
|
|
|
|
|
|
qRegisterMetaType<QMap<QString, int> >("QMap<QString,int>");
|
|
|
|
|
|
qRegisterMetaType<lightCtrl>("lightCtrl");
|
|
|
|
|
|
ui.setupUi(this);
|
|
|
|
|
|
this->setWindowTitle(tr("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ"));
|
|
|
|
|
|
//m_pShowRltImgLabel = ui.label_showImg;
|
|
|
|
|
|
//m_pCameraControl = new CameraControl();
|
|
|
|
|
|
//m_pCaptureThread = new QThread();
|
|
|
|
|
|
//m_pCameraControl->moveToThread(m_pCaptureThread);
|
|
|
|
|
|
|
|
|
|
|
|
connect(this, &SmokeBoxIdentification::sgCapture, CameraControl::instance(), &CameraControl::onCapture);
|
|
|
|
|
|
connect(CameraControl::instance(), &CameraControl::sgCapturedImage, this, &SmokeBoxIdentification::onCapturedImage);
|
|
|
|
|
|
//connect(m_pCaptureThread, &QThread::finished, m_pCameraControl, &QObject::deleteLater);
|
|
|
|
|
|
//m_pCaptureThread->start();
|
|
|
|
|
|
|
|
|
|
|
|
QString applicationDirPath = QCoreApplication::applicationDirPath();
|
|
|
|
|
|
QtConcurrent::run([=]()
|
|
|
|
|
|
{
|
|
|
|
|
|
//readCameraConfig();
|
|
|
|
|
|
//m_bCamerasInit = initCamera();
|
|
|
|
|
|
if (decodeSmokeInfoCsv(applicationDirPath + SMOKEINFO_XLSX_CONFIG))
|
|
|
|
|
|
matchSmokeNameAndTemplateFolderName(applicationDirPath + NUM_TEMPLATE_PATH);
|
|
|
|
|
|
m_pNumTemplateBuild = new QNumTemplateBuild();
|
|
|
|
|
|
m_pDataProcess = std::make_shared<dataPreProcessing>();
|
|
|
|
|
|
if (m_pDataProcess)
|
|
|
|
|
|
{
|
|
|
|
|
|
//dataPreProcessing * t = (dataPreProcessing*)m_pDataProcess.get();
|
|
|
|
|
|
m_pDataProcess->getFileDir(applicationDirPath + NUM_TEMPLATE_PATH);
|
|
|
|
|
|
m_pDataProcess->transmitFilePathForSampleWithItsCorresLabel();
|
|
|
|
|
|
m_pDataProcess->setWinSize(170);
|
|
|
|
|
|
ADModule::instance()->setDataProcessObj(m_pDataProcess);
|
|
|
|
|
|
m_pNumTemplateBuild->setDataProcessObj(m_pDataProcess);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
QString filePath = applicationDirPath + NET_CONFIG;
|
|
|
|
|
|
m_pNetControl = new NetControl(filePath, true);
|
|
|
|
|
|
connect(m_pNetControl, &NetControl::sgReceiveData, this, &SmokeBoxIdentification::onDecodeMsg);
|
|
|
|
|
|
ADModule::instance()->loadParameters(filePath);
|
|
|
|
|
|
filePath = applicationDirPath + COM_CONFIG;
|
|
|
|
|
|
lpSerialStation::instance()->loadParameters(filePath);
|
|
|
|
|
|
CodeScanStation::instance()->loadParameters(filePath);
|
|
|
|
|
|
lpSerialStation::instance()->openComs();
|
|
|
|
|
|
CodeScanStation::instance()->openComs();
|
|
|
|
|
|
m_pCategoryMatcher = new CategoryMatcher();
|
|
|
|
|
|
connect(CodeScanStation::instance(), &CodeScanStation::sgNewCodeScanData, lpSerialStation::instance()
|
|
|
|
|
|
, &lpSerialStation::onNewCodeScanResults);
|
|
|
|
|
|
connect(this, &SmokeBoxIdentification::sgCategoryMatchFinished, this, &SmokeBoxIdentification::onNumStatistic);
|
|
|
|
|
|
connect(lpSerialStation::instance(), &lpSerialStation::sgMonitorSensorTriggerStart, this
|
|
|
|
|
|
, &SmokeBoxIdentification::onMonitorSensorTriggerStart);
|
|
|
|
|
|
connect(lpSerialStation::instance(), &lpSerialStation::sgMonitorSensorTriggerStop, this
|
|
|
|
|
|
, &SmokeBoxIdentification::onMonitorSensorTriggerStop);
|
|
|
|
|
|
connect(lpSerialStation::instance(), &lpSerialStation::sgNewEmptyCheckResults, this
|
|
|
|
|
|
, &SmokeBoxIdentification::onSendEmptyCheckResults);
|
|
|
|
|
|
connect(this, &SmokeBoxIdentification::sgControlSideLight, lpSerialStation::instance()
|
|
|
|
|
|
, &lpSerialStation::onControlSideLight);
|
|
|
|
|
|
connect(this, &SmokeBoxIdentification::sgStartEmptyPlaceCheck, lpSerialStation::instance()
|
|
|
|
|
|
, &lpSerialStation::onStartEmptyPlaceCheck);
|
|
|
|
|
|
connect(this, &SmokeBoxIdentification::sgStopEmptyPlaceCheck, lpSerialStation::instance()
|
|
|
|
|
|
, &lpSerialStation::onStopEmptyPlaceCheck);
|
|
|
|
|
|
connect(this, &SmokeBoxIdentification::sgMonitorSensorTriggerStart, ADModule::instance()
|
|
|
|
|
|
, &ADModule::onDataRequestStart);
|
|
|
|
|
|
connect(this, &SmokeBoxIdentification::sgMonitorSensorTriggerStop, ADModule::instance()
|
|
|
|
|
|
, &ADModule::onDataRequestStop);
|
|
|
|
|
|
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(ui.action_templateNum, SIGNAL(triggered()), this, SLOT(onActionClicked()));
|
|
|
|
|
|
emit sgControlSideLight(lightCtrl::emTurnOnLight);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SmokeBoxIdentification::~SmokeBoxIdentification()
|
|
|
|
|
|
{
|
|
|
|
|
|
emit sgControlSideLight(lightCtrl::emTurnOffLight);
|
|
|
|
|
|
DELETE_POINTER(m_pNetControl);
|
|
|
|
|
|
//m_pCaptureThread->quit();
|
|
|
|
|
|
//m_pCaptureThread->wait();
|
|
|
|
|
|
//DELETE_POINTER(m_pCaptureThread);
|
|
|
|
|
|
//DELETE_POINTER(m_pCameraControl);
|
|
|
|
|
|
DELETE_POINTER(m_pCategoryMatcher);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//bool SmokeBoxIdentification::readCameraConfig()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// m_mapIdCameraInfoSide.clear();
|
|
|
|
|
|
// m_mapIdCameraInfoTop.clear();
|
|
|
|
|
|
// m_mapSerialNumberIdSide.clear();
|
|
|
|
|
|
// m_mapSerialNumberIdTop.clear();
|
|
|
|
|
|
// QString filePath = QCoreApplication::applicationDirPath() + CAMERA_CONFIG;
|
|
|
|
|
|
// QFile file(filePath);
|
|
|
|
|
|
// if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
|
|
|
|
|
|
// {
|
|
|
|
|
|
// qWarning() << "<22><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>";
|
|
|
|
|
|
// return false;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// QByteArray arr = file.readAll();
|
|
|
|
|
|
// file.close();
|
|
|
|
|
|
// if (arr.isEmpty())
|
|
|
|
|
|
// {
|
|
|
|
|
|
// qWarning() << "<22><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>";
|
|
|
|
|
|
// return false;
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// QJsonParseError err;
|
|
|
|
|
|
// QJsonDocument doc = QJsonDocument::fromJson(arr, &err);
|
|
|
|
|
|
// if (doc.isEmpty())
|
|
|
|
|
|
// {
|
|
|
|
|
|
// qWarning() << err.errorString(); //<2F><>ӡʧ<D3A1><CAA7><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
|
// return false;
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// QJsonObject jsonObj = doc.object();
|
|
|
|
|
|
// auto getCameraType = [](int type)-> CameraType
|
|
|
|
|
|
// {
|
|
|
|
|
|
// CameraType cameraType;
|
|
|
|
|
|
// switch (type)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// case 100:
|
|
|
|
|
|
// cameraType = CameraType::Virtual;
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// case 140:
|
|
|
|
|
|
// cameraType = CameraType::Hik;
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// case 190:
|
|
|
|
|
|
// cameraType = CameraType::Basler;
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// default:
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// return cameraType;
|
|
|
|
|
|
// };
|
|
|
|
|
|
// QJsonObject topObj = jsonObj.value("top").toObject();
|
|
|
|
|
|
// int topStartId, topEndId;
|
|
|
|
|
|
// if (!topObj.isEmpty())
|
|
|
|
|
|
// {
|
|
|
|
|
|
// topStartId = topObj.value("startID").toInt();
|
|
|
|
|
|
// topEndId = topObj.value("endID").toInt();
|
|
|
|
|
|
// }
|
|
|
|
|
|
// else
|
|
|
|
|
|
// {
|
|
|
|
|
|
// qWarning() << "top id error";
|
|
|
|
|
|
// return false;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// QJsonObject sideObj = jsonObj.value("side").toObject();
|
|
|
|
|
|
// int sideStartId, sideEndId;
|
|
|
|
|
|
// if (!sideObj.isEmpty())
|
|
|
|
|
|
// {
|
|
|
|
|
|
// sideStartId = sideObj.value("startID").toInt();
|
|
|
|
|
|
// sideEndId = sideObj.value("endID").toInt();
|
|
|
|
|
|
// }
|
|
|
|
|
|
// else
|
|
|
|
|
|
// {
|
|
|
|
|
|
// qWarning() << "side id error";
|
|
|
|
|
|
// return false;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// QJsonObject devicesObj = jsonObj.value("devices").toObject();
|
|
|
|
|
|
// if (!devicesObj.isEmpty()) {
|
|
|
|
|
|
// CameraInfo cameraInfo;
|
|
|
|
|
|
// QStringList devicesLabelList = devicesObj.keys();
|
|
|
|
|
|
// for each (QString deviceLabel in devicesLabelList)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// cameraInfo.cameraLabel = deviceLabel;
|
|
|
|
|
|
// QStringList strList = deviceLabel.split(' ');
|
|
|
|
|
|
// if (strList.length() != 2)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// qWarning() << "Device label: " << deviceLabel << " syntax error!";
|
|
|
|
|
|
// continue;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// cameraInfo.modelName = strList.at(0);
|
|
|
|
|
|
// cameraInfo.serialNumber = strList.at(1);
|
|
|
|
|
|
// QJsonObject deviceObj = devicesObj.value(deviceLabel).toObject();
|
|
|
|
|
|
// if (!deviceObj.isEmpty())
|
|
|
|
|
|
// {
|
|
|
|
|
|
// cameraInfo.cameraType = getCameraType(deviceObj.value("type").toInt());
|
|
|
|
|
|
// cameraInfo.exposure = deviceObj.value("exposure").toDouble();
|
|
|
|
|
|
// cameraInfo.imageHeight = deviceObj.value("height").toInt();
|
|
|
|
|
|
// cameraInfo.imageWidth = deviceObj.value("width").toInt();
|
|
|
|
|
|
// cameraInfo.saveImgSuffix = deviceObj.value("save_img_suffix").toString();
|
|
|
|
|
|
// int id = deviceObj.value("id").toInt();
|
|
|
|
|
|
// if (id >= topStartId && id <= topEndId)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// m_mapIdCameraInfoTop[id] = cameraInfo;
|
|
|
|
|
|
// m_mapSerialNumberIdTop[cameraInfo.serialNumber] = id;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// else if (id >= sideStartId && id <= sideEndId)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// m_mapIdCameraInfoSide[id] = cameraInfo;
|
|
|
|
|
|
// m_mapSerialNumberIdSide[cameraInfo.serialNumber] = id;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// return true;
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
//bool SmokeBoxIdentification::initCamera()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// QList<CameraInfo> cameraInfoList = m_mapIdCameraInfoSide.values();
|
|
|
|
|
|
// cameraInfoList.append(m_mapIdCameraInfoTop.values());
|
|
|
|
|
|
// if (!m_pCameraControl->loadCamera(cameraInfoList))
|
|
|
|
|
|
// {
|
|
|
|
|
|
// qWarning() << "Load camera failed";
|
|
|
|
|
|
// return false;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// else {
|
|
|
|
|
|
// QStringList serialNumberList = m_mapSerialNumberIdSide.keys();
|
|
|
|
|
|
// serialNumberList.append(m_mapSerialNumberIdTop.keys());
|
|
|
|
|
|
// if (!m_pCameraControl->openCamera(serialNumberList))
|
|
|
|
|
|
// {
|
|
|
|
|
|
// qWarning() << "Open camera failed";
|
|
|
|
|
|
// return false;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// else {
|
|
|
|
|
|
// if (!m_pCameraControl->startCamera(serialNumberList))
|
|
|
|
|
|
// {
|
|
|
|
|
|
// qWarning() << "Start camera failed";
|
|
|
|
|
|
// return false;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// else {
|
|
|
|
|
|
// if (!m_pCameraControl->setSoftwareTrigger(serialNumberList))
|
|
|
|
|
|
// {
|
|
|
|
|
|
// qWarning() << "Set software trigger failed";
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// return true;
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
Q_SLOT void SmokeBoxIdentification::onActionClicked()
|
|
|
|
|
|
{
|
|
|
|
|
|
QString strObj = sender()->objectName();
|
|
|
|
|
|
if (strObj == "action_templateNum")
|
|
|
|
|
|
{
|
|
|
|
|
|
m_pNumTemplateBuild->setParent(this);
|
|
|
|
|
|
m_pNumTemplateBuild->setWindowTitle(tr("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD>"));
|
|
|
|
|
|
m_pNumTemplateBuild->setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint);
|
|
|
|
|
|
m_pNumTemplateBuild->setWindowModality(Qt::ApplicationModal);
|
|
|
|
|
|
m_pNumTemplateBuild->setAttribute(Qt::WA_ShowModal, true);
|
|
|
|
|
|
m_pNumTemplateBuild->show();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SmokeBoxIdentification::captureTop()
|
|
|
|
|
|
{
|
|
|
|
|
|
emit sgCapture(eCameraLocation::emTop);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SmokeBoxIdentification::captureSide()
|
|
|
|
|
|
{
|
|
|
|
|
|
emit sgCapture(eCameraLocation::emSide);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//bool SmokeBoxIdentification::getSaveImgNameInfo(QString serialNumber, FileInfo& fileInfo)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// QString imgSaveBaseName;
|
|
|
|
|
|
// auto iter = m_mapSerialNumberIdSide.find(serialNumber);
|
|
|
|
|
|
// if (iter == m_mapSerialNumberIdSide.end())
|
|
|
|
|
|
// {
|
|
|
|
|
|
// iter = m_mapSerialNumberIdTop.find(serialNumber);
|
|
|
|
|
|
// if (iter != m_mapSerialNumberIdTop.end())
|
|
|
|
|
|
// {
|
|
|
|
|
|
// int id = iter.value();
|
|
|
|
|
|
// QString suffix = m_mapIdCameraInfoTop.value(id).saveImgSuffix;
|
|
|
|
|
|
// fileInfo.suffix = suffix;
|
|
|
|
|
|
// fileInfo.baseName = QString::number(id);
|
|
|
|
|
|
// fileInfo.name = fileInfo.baseName + suffix;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// else
|
|
|
|
|
|
// {
|
|
|
|
|
|
// qWarning() << "Can not find " << serialNumber;
|
|
|
|
|
|
// return false;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// else
|
|
|
|
|
|
// {
|
|
|
|
|
|
// int id = iter.value();
|
|
|
|
|
|
// QString suffix = m_mapIdCameraInfoSide.value(id).saveImgSuffix;
|
|
|
|
|
|
// fileInfo.suffix = suffix;
|
|
|
|
|
|
// fileInfo.baseName = QString::number(id);
|
|
|
|
|
|
// fileInfo.name = fileInfo.baseName + suffix;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// return true;
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
void SmokeBoxIdentification::saveImage(const cv::Mat& imgMat, const QString& filePath)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (imgMat.empty())
|
|
|
|
|
|
{
|
|
|
|
|
|
qWarning() << "Image is empty";
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
cv::imwrite(filePath.toStdString(), imgMat);
|
|
|
|
|
|
qDebug() << "Save image: " << filePath;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SmokeBoxIdentification::saveImage(const QVector<ImageInfo>& vecImageInfo, int workMode)
|
|
|
|
|
|
{
|
|
|
|
|
|
QString dataSaveFolderPath;
|
|
|
|
|
|
switch (workMode)
|
|
|
|
|
|
{
|
|
|
|
|
|
case WorkMode::StockCheck:
|
|
|
|
|
|
dataSaveFolderPath = QString("%1\\%2\\%3").arg(FILE_STORAGE_PATH).arg(m_currtStockCheckInfo.stockNum)
|
|
|
|
|
|
.arg(m_currtStockCheckInfo.taskNum);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case WorkMode::IntoStock:
|
|
|
|
|
|
dataSaveFolderPath =QString("%1\\%2\\%3\\%4").arg(FILE_STORAGE_PATH).arg(INTOSTOCK_IMAGE_FOLDER)
|
|
|
|
|
|
.arg(m_currtIntoStockInfo.stockNum).arg(m_currtIntoStockInfo.taskNum);
|
|
|
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
|
|
|
qDebug() << "Mode: " << workMode << "do not save Image";
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
QDir folder(dataSaveFolderPath);
|
|
|
|
|
|
if (!folder.exists())
|
|
|
|
|
|
{
|
|
|
|
|
|
QDir dir;
|
|
|
|
|
|
if (dir.mkpath(dataSaveFolderPath))
|
|
|
|
|
|
{
|
|
|
|
|
|
qDebug() << "Create folder: " << dataSaveFolderPath << " successfully.";
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
qDebug() << "Create folder:" << dataSaveFolderPath << " failed.";
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
for (int i = 0; i < vecImageInfo.size(); ++i)
|
|
|
|
|
|
{
|
|
|
|
|
|
FileInfo fileInfo = vecImageInfo.at(i).saveImgInfo;
|
|
|
|
|
|
QString filePath = QString("%1\\%2").arg(dataSaveFolderPath).arg(fileInfo.name);
|
|
|
|
|
|
if (workMode == WorkMode::IntoStock)
|
|
|
|
|
|
{
|
|
|
|
|
|
QString filePathSend = QString("%1/%2/%3/%4").arg(INTOSTOCK_IMAGE_FOLDER)
|
|
|
|
|
|
.arg(m_currtIntoStockInfo.stockNum).arg(m_currtIntoStockInfo.taskNum).arg(fileInfo.name);
|
|
|
|
|
|
m_currtIntoStockInfo.imagesPathList.push_back(filePathSend);
|
|
|
|
|
|
}
|
|
|
|
|
|
saveImage(vecImageInfo.at(i).image, filePath);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Q_SLOT void SmokeBoxIdentification::onCapturedImage(const QVector<ImageInfo>& vecImageInfo, int cameraLocation)
|
|
|
|
|
|
{
|
|
|
|
|
|
QString serialNumber = vecImageInfo.last().cameraSn;
|
|
|
|
|
|
if (cameraLocation == eCameraLocation::emTop)
|
|
|
|
|
|
{
|
|
|
|
|
|
qDebug() << "top captured";
|
|
|
|
|
|
QtConcurrent::run([=] {
|
|
|
|
|
|
saveImage(vecImageInfo, m_workMode);
|
|
|
|
|
|
if (m_workMode == WorkMode::StockCheck)
|
|
|
|
|
|
{
|
|
|
|
|
|
emit sgSendStockCheckMsg(MsgType::DataCollectionEndSC);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (m_workMode = WorkMode::IntoStock)
|
|
|
|
|
|
{
|
|
|
|
|
|
emit sgSendStockCheckMsg(MsgType::IntoStockResult);
|
|
|
|
|
|
}
|
|
|
|
|
|
m_workMode = WorkMode::Idle;
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (cameraLocation == eCameraLocation::emSide)
|
|
|
|
|
|
{
|
|
|
|
|
|
qDebug() << "side captured";
|
|
|
|
|
|
QtConcurrent::run([=] {
|
|
|
|
|
|
saveImage(vecImageInfo, m_workMode);
|
|
|
|
|
|
bool bRlt = false;
|
|
|
|
|
|
QString typeNum = m_currtStockCheckInfo.smokeTypeNum;
|
|
|
|
|
|
cv::Mat imgRltMat;
|
|
|
|
|
|
QString dataSaveFolder = QString("%1\\%2\\%3").arg(FILE_STORAGE_PATH)
|
|
|
|
|
|
.arg(m_currtStockCheckInfo.stockNum).arg(m_currtStockCheckInfo.taskNum);
|
|
|
|
|
|
for each (const ImageInfo& imgInfo in vecImageInfo)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (m_pCategoryMatcher->smokeMatch(typeNum, imgInfo.image, imgRltMat))
|
|
|
|
|
|
{
|
|
|
|
|
|
bRlt = true;
|
|
|
|
|
|
FileInfo fileInfo = imgInfo.saveImgInfo;
|
|
|
|
|
|
QString fileName = QString("%1_%2_rlt%3").arg(fileInfo.strId)
|
|
|
|
|
|
.arg(m_currtStockCheckInfo.smokeTypeNum).arg(fileInfo.suffix);
|
|
|
|
|
|
QString filePath = QString("%1\\%2").arg(dataSaveFolder).arg(fileName);
|
|
|
|
|
|
saveImage(imgRltMat, filePath);
|
|
|
|
|
|
qDebug() << "Match successful";
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!bRlt)
|
|
|
|
|
|
{
|
|
|
|
|
|
QString filePath = dataSaveFolder + QString("\\%1_error.PNG")
|
|
|
|
|
|
.arg(m_currtStockCheckInfo.smokeTypeNum);
|
|
|
|
|
|
saveImage(imgRltMat, filePath);
|
|
|
|
|
|
}
|
|
|
|
|
|
QString typeNumRlt = bRlt ? typeNum : "0";
|
|
|
|
|
|
m_currtStockCheckInfo.smokeTypeNumRlt = typeNumRlt;
|
|
|
|
|
|
qDebug() << "typeNumRlt: " << typeNumRlt;
|
|
|
|
|
|
emit sgCategoryMatchFinished(typeNumRlt);
|
|
|
|
|
|
//if (!imgRltMat.empty())
|
|
|
|
|
|
//{
|
|
|
|
|
|
// cv::cvtColor(imgRltMat, imgRltMat, cv::COLOR_BGR2RGB);
|
|
|
|
|
|
// QImage resultQImg((const unsigned char*)imgRltMat.data, imgRltMat.cols, imgRltMat.rows, imgRltMat.step, QImage::Format_RGB888);
|
|
|
|
|
|
// emit sgShowImage(m_pShowRltImgLabel, resultQImg);
|
|
|
|
|
|
//}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Q_SLOT void SmokeBoxIdentification::onDecodeMsg(const QString& msg)
|
|
|
|
|
|
{
|
|
|
|
|
|
QString msgContent = msg;
|
|
|
|
|
|
if (msgContent.right(1) == END_SYMBOL)
|
|
|
|
|
|
{
|
|
|
|
|
|
msgContent.chop(1);
|
|
|
|
|
|
}
|
|
|
|
|
|
qDebug() << "msg: " << msg << " content: " << msgContent;
|
|
|
|
|
|
QStringList strList = msgContent.split(SPLIT_RULE);
|
|
|
|
|
|
qDebug() << "strlist length: " << strList.length() << " head: " << strList.at(0);
|
|
|
|
|
|
if (strList[0] == EMPTY_CHECK_HEAD)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (strList.length() == 4)
|
|
|
|
|
|
{
|
|
|
|
|
|
EmptyCheckInfo emptyCheckInfo;
|
|
|
|
|
|
emptyCheckInfo.streetName = strList[1];
|
|
|
|
|
|
emptyCheckInfo.taskNum = strList[2];
|
|
|
|
|
|
m_currtEmptyCheckInfo = emptyCheckInfo;
|
|
|
|
|
|
if (strList[3] == "START")
|
|
|
|
|
|
{
|
|
|
|
|
|
m_workMode = WorkMode::EmptyCheck;
|
|
|
|
|
|
emit sgStartEmptyPlaceCheck(m_currtEmptyCheckInfo.streetName);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (strList[3] == "END")
|
|
|
|
|
|
{
|
|
|
|
|
|
if (m_workMode == WorkMode::EmptyCheck)
|
|
|
|
|
|
{
|
|
|
|
|
|
emit sgStopEmptyPlaceCheck();
|
|
|
|
|
|
m_workMode = WorkMode::Idle;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (strList.at(0) == STOCK_CHECK_HEAD)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (strList.length() == 7)
|
|
|
|
|
|
{
|
|
|
|
|
|
qDebug() << "<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>λ<EFBFBD>̵<EFBFBD>";
|
|
|
|
|
|
m_workMode = WorkMode::StockCheck;
|
|
|
|
|
|
StockCheckInfo stockCheckInfo;
|
|
|
|
|
|
stockCheckInfo.streetName = strList.at(1);
|
|
|
|
|
|
stockCheckInfo.stockNum = strList.at(2);
|
|
|
|
|
|
stockCheckInfo.taskNum = strList.at(3);
|
|
|
|
|
|
stockCheckInfo.smokeTypeNum = strList.at(4);
|
|
|
|
|
|
stockCheckInfo.smokeQuantity = strList.at(5);
|
|
|
|
|
|
m_currtStockCheckInfo = stockCheckInfo;
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (strList.length() == 3)
|
|
|
|
|
|
{
|
|
|
|
|
|
qDebug() << "ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ";
|
|
|
|
|
|
QString taskNum = strList.at(2);
|
|
|
|
|
|
QString currentTaskNum = m_currtStockCheckInfo.taskNum;
|
|
|
|
|
|
if (m_workMode == WorkMode::StockCheck)
|
|
|
|
|
|
{
|
|
|
|
|
|
captureSide();
|
|
|
|
|
|
captureTop();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (strList.at(0) == INTO_STOCK_HEAD)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (strList.length() == 4)
|
|
|
|
|
|
{
|
|
|
|
|
|
qDebug() << "<EFBFBD><EFBFBD><EFBFBD>ⶥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
|
|
|
|
|
|
m_workMode = WorkMode::IntoStock;
|
|
|
|
|
|
IntoStockInfo intoStockInfo;
|
|
|
|
|
|
intoStockInfo.streetName = strList.at(1);
|
|
|
|
|
|
intoStockInfo.taskNum = strList.at(2);
|
|
|
|
|
|
intoStockInfo.stockNum = strList.at(3);
|
|
|
|
|
|
m_currtIntoStockInfo = intoStockInfo;
|
|
|
|
|
|
captureTop();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (strList.at(0) == LIGHT_CONTROL_HEAD)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (strList.length() == 3)
|
|
|
|
|
|
{
|
|
|
|
|
|
qDebug() << "<EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>";
|
|
|
|
|
|
if (strList.at(2) == "0")
|
|
|
|
|
|
{
|
|
|
|
|
|
emit sgControlSideLight(lightCtrl::emTurnOffLight);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (strList.at(2) == "1")
|
|
|
|
|
|
{
|
|
|
|
|
|
emit sgControlSideLight(lightCtrl::emTurnOnLight);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Q_SLOT void SmokeBoxIdentification::onNumStatistic(QString typeNum)
|
|
|
|
|
|
{
|
|
|
|
|
|
qDebug() << "start num statistic";
|
|
|
|
|
|
if (!m_bDataCollection)
|
|
|
|
|
|
{
|
|
|
|
|
|
qDebug() << "typeNum: " << typeNum;
|
|
|
|
|
|
if (typeNum == "0")
|
|
|
|
|
|
{
|
|
|
|
|
|
m_currtStockCheckInfo.smokeQuantityRlt = "0";
|
|
|
|
|
|
m_currtStockCheckInfo.correctness = false;
|
|
|
|
|
|
emit sgSendStockCheckMsg(MsgType::StockCheckResult);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
QString smokeCnName = m_mapSmokeCode2Name.value(typeNum);
|
|
|
|
|
|
QString templateName;
|
|
|
|
|
|
if (m_mapSmokeName2TemplateFolderName.contains(smokeCnName))
|
|
|
|
|
|
{
|
|
|
|
|
|
templateName = m_mapSmokeName2TemplateFolderName.value(smokeCnName);
|
|
|
|
|
|
QtConcurrent::run([=]() {
|
|
|
|
|
|
dataPreProcessing::QStandardnormFileMapLabelSsample m = m_pDataProcess->getDataStructure();
|
|
|
|
|
|
int matchLabel = -2;
|
|
|
|
|
|
if (m.contains(templateName))
|
|
|
|
|
|
{
|
|
|
|
|
|
qDebug() << "template find " << templateName;
|
|
|
|
|
|
matchLabel = m_pDataProcess->dataRepeatMatch(templateName);
|
|
|
|
|
|
qDebug() << "match label: " << matchLabel;
|
|
|
|
|
|
m_pDataProcess->clearComData();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
qWarning() << "template not find " << templateName;
|
|
|
|
|
|
m_pDataProcess->clearComData();
|
|
|
|
|
|
matchLabel = -1;
|
|
|
|
|
|
}
|
|
|
|
|
|
int quantityReceive = m_currtStockCheckInfo.smokeQuantity.toInt();
|
|
|
|
|
|
if (matchLabel < 0 || matchLabel != quantityReceive)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_currtStockCheckInfo.smokeQuantityRlt = "0";
|
|
|
|
|
|
m_currtStockCheckInfo.correctness = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
m_currtStockCheckInfo.smokeQuantityRlt = QString::number(matchLabel);
|
|
|
|
|
|
m_currtStockCheckInfo.correctness = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
emit sgSendStockCheckMsg(MsgType::StockCheckResult);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
qWarning() << "Template folder not find: " << smokeCnName;
|
|
|
|
|
|
m_currtStockCheckInfo.smokeQuantityRlt = "0";
|
|
|
|
|
|
m_currtStockCheckInfo.correctness = false;
|
|
|
|
|
|
emit sgSendStockCheckMsg(MsgType::StockCheckResult);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SmokeBoxIdentification::onSendStockCheckResults(int mode)
|
|
|
|
|
|
{
|
|
|
|
|
|
QString resultInfoMsg;
|
|
|
|
|
|
switch (mode)
|
|
|
|
|
|
{
|
|
|
|
|
|
case EmptyCheckResult:
|
|
|
|
|
|
break;
|
|
|
|
|
|
case DataCollectionEndSC:
|
|
|
|
|
|
resultInfoMsg.append(STOCK_CHECK_HEAD).append(SPLIT_RULE).append(m_currtStockCheckInfo.streetName)
|
|
|
|
|
|
.append(SPLIT_RULE).append(m_currtStockCheckInfo.taskNum).append(END_SYMBOL);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case StockCheckResult:
|
|
|
|
|
|
resultInfoMsg.append(STOCK_CHECK_HEAD).append(SPLIT_RULE)
|
|
|
|
|
|
.append(m_currtStockCheckInfo.streetName).append(SPLIT_RULE)
|
|
|
|
|
|
.append(m_currtStockCheckInfo.stockNum).append(SPLIT_RULE)
|
|
|
|
|
|
.append(m_currtStockCheckInfo.taskNum).append(SPLIT_RULE)
|
|
|
|
|
|
.append(m_currtStockCheckInfo.smokeTypeNum).append(SPLIT_RULE)
|
|
|
|
|
|
.append(m_currtStockCheckInfo.smokeQuantity).append(SPLIT_RULE)
|
|
|
|
|
|
.append(m_currtStockCheckInfo.smokeTypeNumRlt).append(SPLIT_RULE)
|
|
|
|
|
|
.append(m_currtStockCheckInfo.smokeQuantityRlt).append(SPLIT_RULE)
|
|
|
|
|
|
.append(QString::number(m_currtStockCheckInfo.correctness)).append(END_SYMBOL);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case IntoStockResult:
|
|
|
|
|
|
{
|
|
|
|
|
|
resultInfoMsg.append(INTO_STOCK_HEAD).append(SPLIT_RULE)
|
|
|
|
|
|
.append(m_currtIntoStockInfo.streetName).append(SPLIT_RULE)
|
|
|
|
|
|
.append(m_currtIntoStockInfo.taskNum).append(SPLIT_RULE)
|
|
|
|
|
|
.append(m_currtIntoStockInfo.stockNum).append(SPLIT_RULE);
|
|
|
|
|
|
QStringList imagesPathList = m_currtIntoStockInfo.imagesPathList;
|
|
|
|
|
|
for (int i = 0; i < imagesPathList.length() - 1; ++i)
|
|
|
|
|
|
{
|
|
|
|
|
|
resultInfoMsg.append(imagesPathList.at(i)).append(CONTENT_SPLIT);
|
|
|
|
|
|
}
|
|
|
|
|
|
resultInfoMsg.append(imagesPathList.last()).append(END_SYMBOL);
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
m_pNetControl->sendMsg(resultInfoMsg);
|
|
|
|
|
|
qDebug() << "send msg: " << resultInfoMsg;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Q_SLOT void SmokeBoxIdentification::onShowImage(QLabel* labelPtr, const QImage& qImage)
|
|
|
|
|
|
{
|
|
|
|
|
|
qDebug() << "Showing image";;
|
|
|
|
|
|
QRect rect = labelPtr->rect();
|
|
|
|
|
|
if (qImage.isNull())
|
|
|
|
|
|
{
|
|
|
|
|
|
qWarning() << "QImage is empty";
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
QImage imgShow = qImage.scaled(QSize(rect.size()));
|
|
|
|
|
|
labelPtr->setPixmap(QPixmap::fromImage(imgShow));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Q_SLOT void SmokeBoxIdentification::onMonitorSensorTriggerStart(eSideID sideId)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (m_workMode == WorkMode::StockCheck)
|
|
|
|
|
|
{
|
|
|
|
|
|
qDebug() << "start collect data";
|
|
|
|
|
|
emit sgMonitorSensorTriggerStart(sideId);
|
|
|
|
|
|
m_bDataCollection = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Q_SLOT void SmokeBoxIdentification::onMonitorSensorTriggerStop(eSideID)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (m_workMode == WorkMode::StockCheck)
|
|
|
|
|
|
{
|
|
|
|
|
|
qDebug() << "stop collect data";
|
|
|
|
|
|
emit sgMonitorSensorTriggerStop();
|
|
|
|
|
|
m_bDataCollection = false;
|
|
|
|
|
|
emit sgSendData2AndAlgo();
|
|
|
|
|
|
QString dataSaveFolder = QString("%1\\%2\\%3\\%4").arg(FILE_STORAGE_PATH)
|
|
|
|
|
|
.arg(m_currtStockCheckInfo.stockNum).arg(m_currtStockCheckInfo.taskNum)
|
|
|
|
|
|
.arg(m_currtStockCheckInfo.smokeQuantity);
|
|
|
|
|
|
dataPreProcessing::mkDir(dataSaveFolder);
|
|
|
|
|
|
emit sgSaveSensorData2Local(dataSaveFolder);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool SmokeBoxIdentification::decodeSmokeInfoCsv(const QString& filePath)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_mapSmokeCode2Name.clear();
|
|
|
|
|
|
QXlsx::Document* pXlsxDoc = new QXlsx::Document(filePath);
|
|
|
|
|
|
if (pXlsxDoc == NULL)
|
|
|
|
|
|
{
|
|
|
|
|
|
qWarning() << "Load " << filePath << " error";
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
QString currentSheetName;
|
|
|
|
|
|
QStringList sheetNames = pXlsxDoc->sheetNames();
|
|
|
|
|
|
if (sheetNames.length() == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
qWarning() << "The quantity of xlsx's sheet is 0";
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
QXlsx::AbstractSheet* currentSheet = pXlsxDoc->sheet(sheetNames.at(0));
|
|
|
|
|
|
if (currentSheet == NULL)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
// get full cells of current sheet
|
|
|
|
|
|
currentSheet->workbook()->setActiveSheet(0);
|
|
|
|
|
|
QXlsx::Worksheet* wsheet = (QXlsx::Worksheet*)currentSheet->workbook()->activeSheet();
|
|
|
|
|
|
if (wsheet == NULL)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
QXlsx::CellRange cellRange = wsheet->dimension();
|
|
|
|
|
|
int rowStart = cellRange.firstRow();
|
|
|
|
|
|
int colStart = cellRange.firstColumn();
|
|
|
|
|
|
|
|
|
|
|
|
int rowEnd = cellRange.lastRow();
|
|
|
|
|
|
int colEnd = cellRange.lastColumn();
|
|
|
|
|
|
for (int i = rowStart + 1; i <= rowEnd; ++i)
|
|
|
|
|
|
{
|
|
|
|
|
|
QString smokeCode = wsheet->read(i, colStart).toString();
|
|
|
|
|
|
QString smokeName = wsheet->read(i, colStart + 1).toString();
|
|
|
|
|
|
m_mapSmokeCode2Name.insert(smokeCode, smokeName);
|
|
|
|
|
|
}
|
|
|
|
|
|
qDebug() << "Decode smokeInfo from " << filePath << " successed";
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool SmokeBoxIdentification::matchSmokeNameAndTemplateFolderName(const QString& folderPath)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_mapSmokeName2TemplateFolderName.clear();
|
|
|
|
|
|
QDir fileDir(folderPath);
|
|
|
|
|
|
if (!fileDir.exists())
|
|
|
|
|
|
{
|
|
|
|
|
|
qWarning() << folderPath << " is not exist";
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (m_mapSmokeCode2Name.empty())
|
|
|
|
|
|
{
|
|
|
|
|
|
qWarning() << "Decode smokeInfo csv first!";
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
QStringList smokeCNNameList = m_mapSmokeCode2Name.values();
|
|
|
|
|
|
QFileInfoList listInfoList = fileDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
|
|
|
|
|
|
if (listInfoList.empty())
|
|
|
|
|
|
{
|
|
|
|
|
|
qDebug() << folderPath << " has not folder";
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
for each (QFileInfo typeFolder in listInfoList)
|
|
|
|
|
|
{
|
|
|
|
|
|
QString typeFolderName = typeFolder.fileName();
|
|
|
|
|
|
bool bFind = false;
|
|
|
|
|
|
for (int i = 0; i < smokeCNNameList.length(); ++i)
|
|
|
|
|
|
{
|
|
|
|
|
|
QString smokeCNName = smokeCNNameList.at(i);
|
|
|
|
|
|
if (typeFolderName.contains(smokeCNName))
|
|
|
|
|
|
{
|
|
|
|
|
|
m_mapSmokeName2TemplateFolderName.insert(smokeCNName, typeFolderName);
|
|
|
|
|
|
smokeCNNameList.removeAt(i);
|
|
|
|
|
|
bFind = true;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!bFind)
|
|
|
|
|
|
{
|
|
|
|
|
|
qDebug() << "Not find: " << typeFolderName << "in excel";
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
qDebug() << "match smokeName and templateFolderName successed";
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Q_SLOT void SmokeBoxIdentification::onSendEmptyCheckResults(const QMap<QString, int>& mapEmptyCheckResults)
|
|
|
|
|
|
{
|
|
|
|
|
|
QString emptyAll;
|
|
|
|
|
|
for each (QString code in mapEmptyCheckResults.keys())
|
|
|
|
|
|
{
|
|
|
|
|
|
int emptyStatus = mapEmptyCheckResults[code];
|
|
|
|
|
|
emptyAll.append(code).append(CODE_CONTENT_SPLIT).append(QString::number(emptyStatus))
|
|
|
|
|
|
.append(CONTENT_SPLIT);
|
|
|
|
|
|
}
|
|
|
|
|
|
QString emptyResult;
|
|
|
|
|
|
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);
|
|
|
|
|
|
qDebug() << "send msg: " << emptyResult;
|
|
|
|
|
|
}
|