From 473e92f7c08f1210c60fb11df648bfc8a1f75b5b Mon Sep 17 00:00:00 2001 From: RCi <15089880081@163.com> Date: Fri, 30 Aug 2024 15:44:02 +0800 Subject: [PATCH] update --- Doc/交互逻辑.xls | Bin 69632 -> 70144 bytes .../HandleAiUi-new/algo/ALGO_Inspection.h | 2 +- HanddleAI/HandleAiUi-new/detProcess.hpp | 38 ++++++++++++++++-- HanddleAI/HandleAiUi-new/main.cpp | 8 +++- .../uiModule/uiModule_switchProduct.h | 7 +++- 5 files changed, 46 insertions(+), 9 deletions(-) diff --git a/Doc/交互逻辑.xls b/Doc/交互逻辑.xls index 0dfe195a5fa13d538f237c8d5207e5a76eb89af1..1c92403eb5a355dc2850d77e786a6f88fd953be6 100644 GIT binary patch delta 1002 zcmZ{jOGuPa6vxl`{F-k@$JbXz7V1Qj6;{*C2quzNzRDUOqqK-pjMSbOR-0mcRZ>c5 zw_(71jx|a}TDR0%q_}Y*lF=dvidEFD7Y`23b*1zg$b58}doRbom8y^N%;!z|P4H zQq>~=A%9JiMy@koMpk6>E}}p;-!GbcfE6q&GfnD~+%Jt-#%D4sP{!VI#R5*OE9v7?d`dW2&4@q>*8#u_7FO2uI1c->fK?y0Ti>x)wCM^2Qv zXYv*tL4ey}_UcQ=f0$R!_6k)nTgyd=(f_k4)NU>``YohPIfUYKe6as)G8YE_JxiH8 z+U08!Gw2{$3omnr+P6FQx2^ybnMABu%17rHr&yNJzu`b&k*n(xD>mDCLEAxgpQQ!u zg9mJmS#@{Y06ZR^aPt~UiSeAfK8I|y(jJ2$MjSs~LOAH92(bM_OXAHv_v9K2=pY=# z;X0*Yuz()Y0mja!FH#Z<7^t_K#zfDmkr_**H9$@WNUKI>E|E5k%vvIC0rGu-v}t7a z5}Bme26F(I#aoAa*kf-t?q$EcYeI7gc@4=hr~rIp@qOzQ8*HKy#&Y`BqL&@-%f(x4 z=RzJ^)_*#xj%e|>iF%3r%TybOBPINVyt@Cpj!@HR6mt%!*v?xAo+{X`38lj-c8Dx| zeE5(;u4yy@J6Y>M9(RvcDddWYn#081h=*&VVlX@z!*q0)hGX@Rj29JM?X{KkJcsK; H&?)}`cm7jx delta 687 zcmX|j5XWcs_I5Y5KduT!+^G~r(1YfqS10D_gNe%Bsdsvp5J6#zC-r7>Y8D7V z`jdVY6edxp*@ON-tHU1ZA*eT@B1;N`{@6vwNkkrM^IOQ@GW*$?`OYxEWukZ0=$Lxd zmDdLVNVc)Lxk<22bh<$x4hp+cjfRgxelq5>#Z;*pQO|CR)pejN`loqMt01%-tobSl4) zeexQr3*MpV8+?!Ya8@hTdc?`g4Oy&x)NS*?J@#<4RQquQV9y=#WpoIYwtUfjEs-g1 zj$c>V)B8PG!OCLQ2ai!@uaW^}pg=u9vb%g8q-O&kR8sCO9ENWiz$5k`wih$l>sS$n z*`HVqdPm}QY-FNyX6m`ubCL8frKO7 zuG4KP#&0X=L@%FLumF90Ny5+9B^tTIMrh(kB$|0hBET<51oG8pjuJ5FVhAPl7{*+!isiU_opf@M1}Jrr>=K#uH$>6oM;z`lW;N{5 QHTbZLc5JSHJNByo0I4wYl>h($ 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; }