#ifndef SMOKE_IDENTIFICATION_H #define SMOKE_IDENTIFICATION_H #include #include #include #include"xlsxdocument.h" #include "xlsxworkbook.h" #include #include #include "CameraControl.h" #include "NetControl.h" #include "ADModule.h" #include "CategoryMatcher.h" #include "lpSerialStation.h" #include "dataPreprocessing.h" #include "ui_SmokeBoxIdentification.h" enum MsgType { EmptyCheckResult = 0, DataCollectionEndSC, StockCheckResult, IntoStockResult }; enum WorkMode { Idle = 0, EmptyCheck, StockCheck, IntoStock }; struct IntoStockInfo { QString streetName; QString taskNum; QString stockNum; QStringList imagesPathList; }; struct StockCheckInfo { QString streetName; QString taskNum; QString stockNum; QString smokeTypeNum; //上位机发送的品规号 QString smokeQuantity; //上位机发送的数量 QString smokeTypeNumRlt; //盘点识别的品规号 QString smokeQuantityRlt; //盘点识别的数量 bool correctness; //盘点结果是否与上位机一致 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; } }; struct FileInfo { QString baseName; QString suffix; QString name; }; class SmokeBoxIdentification : public QMainWindow { Q_OBJECT public: SmokeBoxIdentification(QWidget *parent = Q_NULLPTR); ~SmokeBoxIdentification(); bool readCameraConfig(); signals: void sgCapture(const QStringList serialNumberList); void sgCategoryMatchFinished(QString smokeNum); void sgShowImage(QLabel* labelPtr, const QImage& qImage); void sgSendData2AndAlgo(); void sgSaveSensorData2Local(QString filePath); void sgMonitorSensorTriggerStart(eSideID); void sgMonitorSensorTriggerStop(); void sgSendStockCheckMsg(int mode); private: bool initCamera(); void captureTop(); void captureSide(); void saveImage(const QVector& vecImageInfo, int workMode); void saveImage(const cv::Mat& imgMat, const QString& filePath); bool getSaveImgNameInfo(QString serialNumber, FileInfo& fileInfo); Q_SLOT void onSendStockCheckMsg(int mode); Q_SLOT void onDecodeMsg(const QString& msg); Q_SLOT void onCapturedImage(const QVector& vecImageInfo); Q_SLOT void onNumStatistic(QString typeNum); bool decodeSmokeInfoCsv(const QString& filePath); bool matchSmokeNameAndTemplateFolderName(const QString& folderPath); Q_SLOT void onShowImage(QLabel* labelPtr, const QImage& qImage); Q_SLOT void onMonitorSensorTriggerStart(eSideID); Q_SLOT void onMonitorSensorTriggerStop(eSideID); bool m_bEmptyCheckStart{ false }; //bool m_bStockCheckStart{ false }; bool m_bCaptureFinish{ false }; bool m_bDataCollection{ false }; bool m_bCamerasInit{ false }; QMap m_mapIdCameraInfoTop; QMap m_mapIdCameraInfoSide; QMap m_mapSerialNumberIdTop; QMap m_mapSerialNumberIdSide; QMap m_mapSmokeCode2Name; QMap m_mapSmokeName2TemplateFolderName; WorkMode m_workMode; std::shared_ptr m_pDataProcess; CameraControl* m_pCameraControl; NetControl* m_pNetControl; CategoryMatcher* m_pCategoryMatcher; IntoStockInfo m_currtIntoStockInfo; StockCheckInfo m_currtStockCheckInfo; QThread* m_pCaptureThread; QString m_currLeftRightJudge; QVector m_vecStrHeightLeft; QVector m_vecStrHeightRight; //QLabel* m_pShowRltImgLabel; Ui::SmokeBoxIdentificationClass ui; }; #endif // !SMOKE_IDENTIFICATION_H