#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 "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, //品规模拟盘点 NumVirtual, //数量模拟盘点 TypeNumVirtual //品规数量模拟盘点 }; 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; // 巷道6 QString taskNum; // 工单号6335 QString stockNum; // 货架位置UL062015020111 6号堆垛机,2:右边; QString smokeTypeNum; //上位机发送的品规号37010106 QString smokeQuantity; //上位机发送的数量30 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; //} }; 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& 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&); Q_SLOT void onNewNumData(const QVector>& vec, const QVector& strVec, int side); void sendResults(int mode); void saveData2File(const QVector& strVec, QString folderPath, int side); void captureTop(); void captureSide(); void saveImage(const QVector& 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 m_mapSmokeCode2Name; QMap m_mapSmokeName2TemplateFolderName; QString m_currLeftRightJudge; QVector m_vecStrHeightLeft; QVector m_vecStrHeightRight; std::shared_ptr 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