|
|
|
|
|
#ifndef SMOKE_IDENTIFICATION_H
|
|
|
|
|
|
#define SMOKE_IDENTIFICATION_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <fstream>
|
|
|
|
|
|
|
|
|
|
|
|
#include <QtWidgets/QMainWindow>
|
|
|
|
|
|
#include <QtConcurrent/QtConcurrent>
|
|
|
|
|
|
#include".\xlsxdocument.h"
|
|
|
|
|
|
#include".\xlsxworkbook.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include <opencv2/core.hpp>
|
|
|
|
|
|
#include <opencv2/highgui.hpp>
|
|
|
|
|
|
|
|
|
|
|
|
#include "CameraControl.h"
|
|
|
|
|
|
#include "NetControl.h"
|
|
|
|
|
|
#include "ADModule.h"
|
|
|
|
|
|
#include "CategoryMatcher.h"
|
|
|
|
|
|
#include "lpSerialStation.h"
|
|
|
|
|
|
#include "CodeScanStation.h"
|
|
|
|
|
|
#include "dataPreprocessing.h"
|
|
|
|
|
|
#include "QNumTemplateBuild.h"
|
|
|
|
|
|
#include "ui_SmokeBoxIdentification.h"
|
|
|
|
|
|
|
|
|
|
|
|
enum MsgType
|
|
|
|
|
|
{
|
|
|
|
|
|
EmptyCheckResult = 0,
|
|
|
|
|
|
DataCollectionEndSC,
|
|
|
|
|
|
StockCheckResult,
|
|
|
|
|
|
IntoStockResult
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
enum WorkMode
|
|
|
|
|
|
{
|
|
|
|
|
|
Idle = 0,
|
|
|
|
|
|
EmptyCheck,
|
|
|
|
|
|
StockCheck,
|
|
|
|
|
|
IntoStock
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
enum StockCheckMode
|
|
|
|
|
|
{
|
|
|
|
|
|
NoVirtual = 0,
|
|
|
|
|
|
TypeVirtual, //Ʒ<><C6B7>ģ<EFBFBD><C4A3><EFBFBD>̵<EFBFBD>
|
|
|
|
|
|
NumVirtual, //<2F><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>̵<EFBFBD>
|
|
|
|
|
|
TypeNumVirtual //Ʒ<><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>̵<EFBFBD>
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct IntoStockInfo
|
|
|
|
|
|
{
|
|
|
|
|
|
QString streetName;
|
|
|
|
|
|
QString taskNum;
|
|
|
|
|
|
QString stockNum;
|
|
|
|
|
|
QStringList imagesPathList;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct EmptyCheckInfo
|
|
|
|
|
|
{
|
|
|
|
|
|
QString streetName;
|
|
|
|
|
|
QString taskNum;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct StockCheckInfo
|
|
|
|
|
|
{
|
|
|
|
|
|
// "SC&6&UL062015020111&6335&37010106&30&N>"
|
|
|
|
|
|
QString streetName; // <20><><EFBFBD><EFBFBD>6
|
|
|
|
|
|
QString taskNum; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>6335
|
|
|
|
|
|
QString stockNum; // <20><><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>UL062015020111 6<>ŶѶ<C5B6><D1B6><EFBFBD><EFBFBD><EFBFBD>2<EFBFBD><32><EFBFBD>ұߣ<D2B1>
|
|
|
|
|
|
QString smokeTypeNum; //<2F><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>37010106
|
|
|
|
|
|
QString smokeQuantity; //<2F><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><CDB5><EFBFBD><EFBFBD><EFBFBD>30
|
|
|
|
|
|
QString smokeTypeNumRlt; //<2F>̵<EFBFBD>ʶ<EFBFBD><CAB6><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
|
|
|
|
|
|
QString smokeQuantityRlt; //<2F>̵<EFBFBD>ʶ<EFBFBD><CAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
bool correctness; //<2F>̵<EFBFBD><CCB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>һ<EFBFBD><D2BB>
|
|
|
|
|
|
//void clear()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// streetName.clear();
|
|
|
|
|
|
// taskNum.clear();
|
|
|
|
|
|
// stockNum.clear();
|
|
|
|
|
|
// smokeTypeNum.clear();
|
|
|
|
|
|
// smokeQuantity.clear();
|
|
|
|
|
|
// smokeTypeNumRlt.clear();
|
|
|
|
|
|
// smokeQuantityRlt.clear();
|
|
|
|
|
|
// correctness = false;
|
|
|
|
|
|
//}
|
|
|
|
|
|
//StockCheckInfo &operator = (const StockCheckInfo& obj)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// this->streetName = obj.streetName;
|
|
|
|
|
|
// this->taskNum = obj.taskNum;
|
|
|
|
|
|
// this->stockNum = obj.stockNum;
|
|
|
|
|
|
// this->smokeTypeNum = obj.smokeTypeNum;
|
|
|
|
|
|
// this->smokeQuantity = obj.smokeQuantity;
|
|
|
|
|
|
// this->smokeTypeNumRlt = obj.smokeTypeNumRlt;
|
|
|
|
|
|
// this->smokeQuantityRlt = obj.smokeQuantityRlt;
|
|
|
|
|
|
// this->correctness = obj.correctness;
|
|
|
|
|
|
// return *this;
|
|
|
|
|
|
//}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class SmokeBoxIdentification : public QMainWindow
|
|
|
|
|
|
{
|
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
SmokeBoxIdentification(QWidget *parent = Q_NULLPTR);
|
|
|
|
|
|
~SmokeBoxIdentification();
|
|
|
|
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
|
void sgCapture(int cameraLocation);
|
|
|
|
|
|
void sgCategoryMatchFinished(QString smokeNum);
|
|
|
|
|
|
void sgShowImage(QLabel* labelPtr, const QImage& qImage);
|
|
|
|
|
|
//void sgSendData2AndAlgo();
|
|
|
|
|
|
//void sgSaveSensorData2Local(QString filePath);
|
|
|
|
|
|
void sgNumDataCollectStart(int sideId);
|
|
|
|
|
|
void sgNumDataCollectStop();
|
|
|
|
|
|
//void sgSendResults(int mode);
|
|
|
|
|
|
void sgStartEmptyPlaceCheck(QString streetName);
|
|
|
|
|
|
void sgStopEmptyPlaceCheck();
|
|
|
|
|
|
void sgControlSideLight(int);
|
|
|
|
|
|
void sgSendMsg(QString msg);
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
|
|
Q_SLOT void onDecodeMsg(const QString& msg);
|
|
|
|
|
|
Q_SLOT void onCapturedImage(const QVector<ImageInfo>& vecImageInfo, int camearLocation);
|
|
|
|
|
|
Q_SLOT void onNumStatistic(QString typeNum);
|
|
|
|
|
|
Q_SLOT void onShowImage(QLabel* labelPtr, const QImage& qImage);
|
|
|
|
|
|
Q_SLOT void onMonitorSensorTriggerStart(int);
|
|
|
|
|
|
Q_SLOT void onMonitorSensorTriggerStop(int);
|
|
|
|
|
|
|
|
|
|
|
|
Q_SLOT void onActionClicked();
|
|
|
|
|
|
Q_SLOT void onSendEmptyCheckResults(const QMap<QString, int>&);
|
|
|
|
|
|
Q_SLOT void onNewNumData(const QVector<QVector<double>>& vec, const QVector<QString>& strVec, int side);
|
|
|
|
|
|
|
|
|
|
|
|
void sendResults(int mode);
|
|
|
|
|
|
void saveData2File(const QVector<QString>& strVec, QString folderPath, int side);
|
|
|
|
|
|
void captureTop();
|
|
|
|
|
|
void captureSide();
|
|
|
|
|
|
void saveImage(const QVector<ImageInfo>& vecImageInfo, int workMode);
|
|
|
|
|
|
void saveImage(const cv::Mat& imgMat, const QString& filePath);
|
|
|
|
|
|
bool decodeSmokeInfoCsv(const QString& filePath);
|
|
|
|
|
|
bool matchSmokeNameAndTemplateFolderName(const QString& folderPath);
|
|
|
|
|
|
|
|
|
|
|
|
bool m_bEmptyCheckStart{ false };
|
|
|
|
|
|
//bool m_bStockCheckStart{ false };
|
|
|
|
|
|
bool m_bCaptureFinish{ false };
|
|
|
|
|
|
bool m_bDataCollection{ false };
|
|
|
|
|
|
//bool m_bCamerasInit{ false };
|
|
|
|
|
|
|
|
|
|
|
|
QMap<QString, QString> m_mapSmokeCode2Name;
|
|
|
|
|
|
QMap<QString, QString> m_mapSmokeName2TemplateFolderName;
|
|
|
|
|
|
|
|
|
|
|
|
QString m_currLeftRightJudge;
|
|
|
|
|
|
QVector<QString> m_vecStrHeightLeft;
|
|
|
|
|
|
QVector<QString> m_vecStrHeightRight;
|
|
|
|
|
|
|
|
|
|
|
|
std::shared_ptr<dataPreProcessing> m_pDataProcess;
|
|
|
|
|
|
WorkMode m_workMode;
|
|
|
|
|
|
NetControl* m_pNetControl;
|
|
|
|
|
|
CategoryMatcher* m_pCategoryMatcher;
|
|
|
|
|
|
IntoStockInfo m_currtIntoStockInfo;
|
|
|
|
|
|
StockCheckInfo m_currtStockCheckInfo;
|
|
|
|
|
|
EmptyCheckInfo m_currtEmptyCheckInfo;
|
|
|
|
|
|
QNumTemplateBuild* m_pNumTemplateBuild{ nullptr };
|
|
|
|
|
|
StockCheckMode m_stockCheckMode;
|
|
|
|
|
|
|
|
|
|
|
|
QThread* m_pTcpClientThread;
|
|
|
|
|
|
//QLabel* m_pShowRltImgLabel;
|
|
|
|
|
|
Ui::SmokeBoxIdentificationClass ui;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // !SMOKE_IDENTIFICATION_H
|