diff --git a/Doc/交互逻辑.xls b/Doc/交互逻辑.xls index 0dfe195a..1c92403e 100644 Binary files a/Doc/交互逻辑.xls and b/Doc/交互逻辑.xls differ diff --git a/HanddleAI/HandleAiUi-new/algo/ALGO_Inspection.h b/HanddleAI/HandleAiUi-new/algo/ALGO_Inspection.h index 32a155c8..36c55afd 100644 --- a/HanddleAI/HandleAiUi-new/algo/ALGO_Inspection.h +++ b/HanddleAI/HandleAiUi-new/algo/ALGO_Inspection.h @@ -34,7 +34,7 @@ std::vector getpinHandleAiEvaluateRect(std::shared_ptr targetRect.x + targetRect.width || diff --git a/HanddleAI/HandleAiUi-new/detProcess.hpp b/HanddleAI/HandleAiUi-new/detProcess.hpp index ddcaf033..14814b5c 100644 --- a/HanddleAI/HandleAiUi-new/detProcess.hpp +++ b/HanddleAI/HandleAiUi-new/detProcess.hpp @@ -87,6 +87,7 @@ public: manualDetThread _manualDetThread;//ÊÖ¶¯´¥·¢Ïß³Ì /////////////////////////////// + bool startDet = false; QMutex detMutex; std::string currentSn; void detProcessCallbackRegister() @@ -97,7 +98,8 @@ public: _triggerManager.registerCallback(361, 1, [this](QByteArray& byteArray) {detectionSwitch1(byteArray); }, "¼ì²â¿ªÊ¼"); _triggerManager.registerCallback(361, 2, [this](QByteArray& byteArray) {detectionSwitch2(byteArray); }, "¼ì²â½áÊø1"); _triggerManager.registerCallback(362, 1, [this](QByteArray& byteArray) {detectionEnd(byteArray); }, "¼ì²â½áÊø2"); - + _triggerManager.registerCallback(364, 1, [this](QByteArray& byteArray) {frontBackDet(); }, "¼ì²âÕý·´Ãæ"); + _threadManager.registerCallback([this](std::shared_ptrdata) {correctionResultHandle(data); }); _threadManager.registerCallback([this](std::shared_ptrdata) {detectionResultHandle(data); }); } @@ -228,6 +230,7 @@ public: //ÅÄÕÕ²¢¼ì²â 300 void captureImageAndDetection(QByteArray& byteArray) { + startDet = true; //detMutex.lock(); _lightSourceManager.getLightSourcePtr("COM9")->setValue(lightSourceChannel::DChannel, 255); QThread::msleep(2000);//ÑÓʱµÈ´ý»úе±ÛÍ£ÎÈ @@ -277,7 +280,7 @@ public: emit _core._qtFunc.simpleSiemensTcp_Write100True(); } } - //»úе±Û½áÊø + //¼ì²â³ÌÐò½áÊø½áÊø void detectionEnd(QByteArray& byteArray) { _simpleSiemensTcp.writeDM100FALSE(); @@ -326,12 +329,16 @@ public: int currentProductIndex = _core._appConfig._switchProductWidgetDataPtr.currentProductIndex; if (currentBack == true) currentBack = false; - else if (_core._appConfig.productDatas[currentProductIndex].isBackExist == true && result == true) + else if ( + _core._appConfig.productDatas[currentProductIndex].isBackExist == true + && result == true + && startDet == true) { backArmIndex = _core._appConfig.productDatas[currentProductIndex].backArmIndex; emit _core._qtFunc.uiModuleBackContinueDetDialog_show(); emit _core._qtFunc.uiModulestartDetBtn_disable(); } + startDet = false; } //У׼½á¹û´¦Àí void correctionResultHandle(std::shared_ptrdata) @@ -441,7 +448,30 @@ public: detDataManager* dManager = data->dManager; data->dManager->deleteDetData(data->timeCode); } - + //ʹÓõ㼤¹â²âÁ¿¼ì²âÊÇ·ñΪÕýÃæ£¬Ã»Êý¾Ý¾ÍÊÇÕýÃæ + void frontBackDet() + { + _triggerManager.sendFinsMsg("write_short_364_1"); + auto cameraPtr = _cameraManager.getCamera("181964"); + if (cameraPtr == nullptr) + return; + for (int i = 0; i < 10; i++)//ÆúÓà + { + cameraPtr->trigger(); + cameraPtr->getCameraValue(); + } + for (int i = 0; i < 100; i++)//¼ì²âÊÇ·ñÓÐÊý¾Ý + { + cameraPtr->trigger(); + if (cameraPtr->getCameraValue() > -100)//ÓÐÊý¾Ý ÊÇ·´Ãæ + { + _triggerManager.sendFinsMsg("write_short_365_2"); + break; + } + } + _triggerManager.sendFinsMsg("write_short_365_1");//ÎÞÊý¾Ý ÊÇÕýÃæ + //ÕýÃæ·´ÃæÊÇ·ñ¼ÌÐø¼ì²â£¬ÔÚ»úе±Û½Å±¾Öоö¶¨ + } public slots: void runBackDet() diff --git a/HanddleAI/HandleAiUi-new/main.cpp b/HanddleAI/HandleAiUi-new/main.cpp index 6ab37447..1cc20267 100644 --- a/HanddleAI/HandleAiUi-new/main.cpp +++ b/HanddleAI/HandleAiUi-new/main.cpp @@ -122,9 +122,13 @@ void connectSignalAndSlots(MainWindow* front, appCore* _core, detProcess* _detPr front, [=]() {front->_displayWidget->_summaryDataManager->resetAllValue(); }); QObject::connect(&_core->_qtFunc, &qtFunction::uiModulestartDetBtn_disable, - front, [=]() {front->_displayWidget->_switchProductWidget->startBtn->setDisabled(true); }); + front, [=]() {front->_displayWidget->_switchProductWidget->startBtn->setDisabled(true); + front->_displayWidget->_switchProductWidget->disableTextChange = true; + front->_displayWidget->_switchProductWidget->startBtn->setText(" "); }); QObject::connect(&_core->_qtFunc, &qtFunction::uiModulestartDetBtn_enable, - front, [=]() {front->_displayWidget->_switchProductWidget->startBtn->setEnabled(true); }); + front, [=]() {front->_displayWidget->_switchProductWidget->startBtn->setEnabled(true); + front->_displayWidget->_switchProductWidget->disableTextChange = false; + front->_displayWidget->_switchProductWidget->startBtn->setText("è¿�行"); }); QObject::connect(&_core->_qtFunc, &qtFunction::uiModuleBackContinueDetDialog_show, front, [=]() {front->_backContinueDetDialog->show(); }); diff --git a/HanddleAI/HandleAiUi-new/uiModule/uiModule_switchProduct.h b/HanddleAI/HandleAiUi-new/uiModule/uiModule_switchProduct.h index d0cb99b6..0e2c92ac 100644 --- a/HanddleAI/HandleAiUi-new/uiModule/uiModule_switchProduct.h +++ b/HanddleAI/HandleAiUi-new/uiModule/uiModule_switchProduct.h @@ -20,6 +20,7 @@ class switchProductWidget : public QWidget Q_OBJECT public: // + bool disableTextChange = false; QMutex mutex; std::vectorproductDatas; int* currentProductIndexPtr; @@ -137,14 +138,16 @@ public slots: if (status == true) { startBtn->toDefault(); - startBtn->setText("ÔËÐÐ"); + if(disableTextChange == false) + startBtn->setText("ÔËÐÐ"); snIntputLine->setDisabled(false); std::cout << "°´ÏÂÈí¼þÔËÐÐ" << std::endl; } else { startBtn->toRed(); - startBtn->setText("¼±Í£"); + if (disableTextChange == false) + startBtn->setText("¼±Í£"); snIntputLine->setDisabled(true); std::cout << "°´ÏÂÈí¼þ¼±Í£" << std::endl; }