现场修复2
This commit is contained in:
@@ -244,6 +244,7 @@ static cv::Mat apexHandleAiAlgo(std::shared_ptr<detData>data, cv::Mat& src, hand
|
||||
}
|
||||
if (finalOK == false)
|
||||
{
|
||||
data->halconOK = false;
|
||||
data->aiDetOK = false;
|
||||
data->aiNgCount++;
|
||||
}
|
||||
|
||||
@@ -101,8 +101,8 @@ void appConfig::parsingProductData(std::string path)
|
||||
if (result.size() != 4)
|
||||
{
|
||||
fancyWarnWindow* warn = new fancyWarnWindow
|
||||
(fancyWarnWindow::Warning, QString("在%1中的clsResultHandle发现格式错误").arg(QString::fromStdString(fileManager::getFileName(file))),
|
||||
QString("%1").arg(QString::fromStdString(it.value())));
|
||||
(fancyWarnWindow::Warning, QString("在%1中的clsResultHandle发现格式错误").arg(QString::fromStdString(fileManager::getFileName(file)), true),
|
||||
QString("%1").arg(QString::fromStdString(it.value())), true);
|
||||
continue;
|
||||
}
|
||||
detResultHandle.clsResultHandle.insert(std::make_pair(std::stoi(it.key()), std::make_pair(result[0], cv::Scalar(std::stoi(result[3]), std::stoi(result[2]), std::stoi(result[1])))));
|
||||
@@ -128,12 +128,12 @@ void appConfig::parsingProductData(std::string path)
|
||||
if (e.id == 302)
|
||||
fancyWarnWindow* warn = new fancyWarnWindow
|
||||
(fancyWarnWindow::Warning, QString("%1损坏").arg(QString::fromStdString(fileManager::getFileName(file))),
|
||||
"");
|
||||
"", true);
|
||||
else
|
||||
{
|
||||
fancyWarnWindow* warn = new fancyWarnWindow
|
||||
(fancyWarnWindow::Warning, QString("在读取%1中出现未知错误").arg(QString::fromStdString(fileManager::getFileName(file))),
|
||||
e.what());
|
||||
e.what(), true);
|
||||
std::cerr << "Exception: " << e.what() << std::endl;
|
||||
qDebug() << "Exception: " << e.what();
|
||||
}
|
||||
@@ -142,7 +142,7 @@ void appConfig::parsingProductData(std::string path)
|
||||
{
|
||||
fancyWarnWindow* warn = new fancyWarnWindow
|
||||
(fancyWarnWindow::Warning, QString("在读取%1中出现严重错误").arg(QString::fromStdString(fileManager::getFileName(file))),
|
||||
"请联系厂商处理");
|
||||
"请联系厂商处理", true);
|
||||
}
|
||||
}
|
||||
_switchProductWidgetDataPtr.mutex = &productDatasMutex;
|
||||
|
||||
@@ -32,5 +32,7 @@ signals:
|
||||
|
||||
void simpleSiemensTcp_Write100True();
|
||||
void simpleSiemensTcp_Write100False();
|
||||
|
||||
void uiModuleHistoryListWidget_reset();
|
||||
};
|
||||
#pragma once
|
||||
@@ -25,6 +25,7 @@ public:
|
||||
void initialization(detProcess* _appCore);
|
||||
void run()
|
||||
{
|
||||
emit _core._qtFunc.uiModuleHistoryListWidget_reset();
|
||||
std::vector<std::shared_ptr<cv::Mat>> mats;
|
||||
std::vector<std::string>files;
|
||||
fileManager::getAllFiles(imgPathStr, files, "jpg");
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <triggerManager.h>
|
||||
#include <qthread.h>
|
||||
#include <simpleSiemensTcp.hpp>
|
||||
|
||||
class detProcess : public QThread
|
||||
{
|
||||
public:
|
||||
@@ -57,6 +58,7 @@ public:
|
||||
//检测程序是否在运行
|
||||
bool armIsRunning = false;
|
||||
int backArmIndex = -1;
|
||||
bool currentBack = false;
|
||||
//激光校准数据缓存 //SN 数据
|
||||
correctionStruct laserDataCache;
|
||||
//总流程开始,机器人发送1至寄存器259
|
||||
@@ -66,6 +68,7 @@ public:
|
||||
//检测启动 259
|
||||
void startDetection(QByteArray& byteArray)
|
||||
{
|
||||
emit _core._qtFunc.uiModuleHistoryListWidget_reset();
|
||||
_lightSourceManager.getLightSourcePtr("COM9")->setValue(lightSourceChannel::DChannel, 0);
|
||||
_triggerManager.sendFinsMsg("write_short_259_0");//触发信号清零
|
||||
_triggerManager.sendFinsMsg("write_short_260_1");//开始检测信号
|
||||
@@ -230,7 +233,9 @@ public:
|
||||
_simpleSiemensTcp.writeDM100FALSE();
|
||||
_lightSourceManager.getLightSourcePtr("COM9")->setValue(lightSourceChannel::DChannel, 0);
|
||||
int currentProductIndex = _core._appConfig._switchProductWidgetDataPtr.currentProductIndex;
|
||||
if (_core._appConfig.productDatas[currentProductIndex].isBackExist == true)
|
||||
if (currentBack == true)
|
||||
currentBack = false;
|
||||
else if (_core._appConfig.productDatas[currentProductIndex].isBackExist == true)
|
||||
{
|
||||
backArmIndex = _core._appConfig.productDatas[currentProductIndex].backArmIndex;
|
||||
emit emit _core._qtFunc.uiModuleBackContinueDetDialog_show();
|
||||
@@ -260,8 +265,7 @@ public:
|
||||
for (auto showMat : data->resultImgs)
|
||||
{
|
||||
//打包发送
|
||||
QPixmap pixmap;
|
||||
cvMatToQPixMap(showMat, pixmap);
|
||||
QPixmap pixmap = cvMatToQPixMap(showMat);
|
||||
showImgPack* pack = new showImgPack();
|
||||
pack->img = pixmap;
|
||||
pack->type = imgWidgetRes;
|
||||
@@ -277,6 +281,7 @@ public:
|
||||
_historyPack.text.push_back(it->second.sign);
|
||||
emit _core._qtFunc.addHistoryDataSignal((data->aiDetOK == true && data->halconOK == true), _historyPack);
|
||||
cnt++;
|
||||
pixmap = QPixmap();
|
||||
}
|
||||
}
|
||||
//发送检测结果发送到界面
|
||||
@@ -298,6 +303,8 @@ public:
|
||||
}
|
||||
}
|
||||
auto productData = _core._productDataCache.get(currentSn);
|
||||
if (finalOk = false)
|
||||
productData->ngCount++;
|
||||
perConnector _perConnectorData;
|
||||
_perConnectorData.aiOk = data->aiDetOK;
|
||||
_perConnectorData.halconOk = data->halconOK;
|
||||
@@ -339,6 +346,7 @@ public slots:
|
||||
{
|
||||
if (backArmIndex != -1)
|
||||
{
|
||||
currentBack = true;
|
||||
_triggerManager.sendFinsMsg("write_short_350_" + QString::number(backArmIndex));//清零
|
||||
_triggerManager.sendFinsMsg("write_short_351_1");
|
||||
}
|
||||
|
||||
@@ -119,6 +119,10 @@ static void cvMatToQPixMap(cv::Mat& src,QPixmap& pixmap)
|
||||
{
|
||||
pixmap = QPixmap::fromImage(cvMatToQImage(src));
|
||||
}
|
||||
static QPixmap cvMatToQPixMap(cv::Mat& src)
|
||||
{
|
||||
return QPixmap::fromImage(cvMatToQImage(src));
|
||||
}
|
||||
static std::string getCurrentDateTime() {
|
||||
|
||||
// 获取当前时间点
|
||||
|
||||
@@ -120,6 +120,10 @@ void connectSignalAndSlots(MainWindow* front, appCore* _core, detProcess* _detPr
|
||||
QObject::connect(&_core->_qtFunc, &qtFunction::uiModuleBackContinueDetDialog_hide,
|
||||
front, [=]() {front->_backContinueDetDialog->hide(); });
|
||||
|
||||
QObject::connect(&_core->_qtFunc, &qtFunction::uiModuleHistoryListWidget_reset,
|
||||
front, [=]() {front->_displayWidget->historyImgs->reset(); });
|
||||
|
||||
|
||||
QObject::connect(&_core->_qtFunc, &qtFunction::simpleSiemensTcp_Write100True, &_detProcess->_simpleSiemensTcp, &simpleSiemensTcp::writeDM100TRUE);
|
||||
QObject::connect(&_core->_qtFunc, &qtFunction::simpleSiemensTcp_Write100False, &_detProcess->_simpleSiemensTcp, &simpleSiemensTcp::writeDM100FALSE);
|
||||
|
||||
@@ -134,6 +138,8 @@ void connectSignalAndSlots(MainWindow* front, appCore* _core, detProcess* _detPr
|
||||
QObject::connect(front->_loadingWidget.retryBtn, &QPushButton::clicked,
|
||||
_detProcess, [=]() {_detProcess->start(); });
|
||||
QObject::connect(front->_displayWidget->_switchProductWidget, &switchProductWidget::startArmProgramSignal,
|
||||
front->_productDetDoubleCheck, &productDetDoubleCheck::showAndSetText);
|
||||
QObject::connect(front->_productDetDoubleCheck, &productDetDoubleCheck::continueClickedSignal,
|
||||
_detProcess, &detProcess::writeArmStartSignal);
|
||||
|
||||
QObject::connect(front->_backContinueDetDialog, &backContinueDetDialog::continueClickedSignal,
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <uiModule_backContinueDetDialog.h>
|
||||
#include <uiModule_productDetDoubleCheck.h>
|
||||
#pragma execution_character_set("utf-8")
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@@ -62,6 +63,7 @@ public:
|
||||
//人工复判窗口
|
||||
imageDoubleCheckQdialog* _imageDoubleCheckQdialog = new imageDoubleCheckQdialog();
|
||||
backContinueDetDialog* _backContinueDetDialog = new backContinueDetDialog();
|
||||
productDetDoubleCheck* _productDetDoubleCheck = new productDetDoubleCheck();
|
||||
private:
|
||||
Ui::MainWindow* ui;
|
||||
fbBridge* fbBridgePtr;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
class fancyWarnWindow :public QDialog
|
||||
{
|
||||
public:
|
||||
QLabel* detailLabel;
|
||||
enum type
|
||||
{
|
||||
Warning,
|
||||
@@ -16,7 +17,7 @@ public:
|
||||
};
|
||||
QPushButton* closeBtn = new QPushButton(this);
|
||||
fancyButtonText* continueBtn = new fancyButtonText(120,60,"继续","继续");
|
||||
fancyWarnWindow(type typeIn,QString title,QString detail)
|
||||
fancyWarnWindow(type typeIn,QString title,QString detail,bool Show)
|
||||
{
|
||||
QPalette paletteWhite, paletteRed, paletteGreen;
|
||||
paletteWhite.setColor(QPalette::WindowText, Qt::white);
|
||||
@@ -100,7 +101,7 @@ public:
|
||||
titleLabel->setWordWrap(true);
|
||||
layout->addWidget(titleLabel, 1, 0);
|
||||
|
||||
QLabel* detailLabel = new QLabel(detail);
|
||||
detailLabel = new QLabel(detail);
|
||||
detailLabel->setFont(font3);
|
||||
detailLabel->setPalette(paletteWhite);
|
||||
detailLabel->setAlignment(Qt::AlignCenter);
|
||||
@@ -113,7 +114,14 @@ public:
|
||||
|
||||
QObject::connect(continueBtn, &QPushButton::clicked, this, &QDialog::close);
|
||||
this->setWindowFlags(this->windowFlags() | Qt::WindowStaysOnTopHint);
|
||||
this->show();
|
||||
if (Show == true)
|
||||
this->show();
|
||||
else
|
||||
this->hide();
|
||||
}
|
||||
void setDetailText(QString text)
|
||||
{
|
||||
detailLabel->setText(text);
|
||||
}
|
||||
void disableHideAfterClicked()
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@ public:
|
||||
backContinueDetDialog()
|
||||
{
|
||||
timer = new QTimer(this);
|
||||
_fancyWarnWindow = new fancyWarnWindow(fancyWarnWindow::tip, "是否继续背面检测", "");
|
||||
_fancyWarnWindow = new fancyWarnWindow(fancyWarnWindow::tip, "是否继续背面检测", "", true);
|
||||
_fancyWarnWindow->disableHideAfterClicked();
|
||||
_fancyWarnWindow->hide();
|
||||
QObject::connect(_fancyWarnWindow->continueBtn, &QPushButton::clicked, this, &backContinueDetDialog::continueClicked);
|
||||
|
||||
@@ -173,7 +173,7 @@ public slots:
|
||||
}
|
||||
void reset()
|
||||
{
|
||||
|
||||
showDataListWidget->clear();
|
||||
}
|
||||
private slots:
|
||||
void itemClick(QListWidgetItem* item)
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
//用于有背面检测的提示框
|
||||
#include <components/fancyDialog.h>
|
||||
#include <qtimer.h>
|
||||
|
||||
class productDetDoubleCheck : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
fancyWarnWindow* _fancyWarnWindow;
|
||||
QTimer* timer;
|
||||
productDetDoubleCheck()
|
||||
{
|
||||
timer = new QTimer(this);
|
||||
_fancyWarnWindow = new fancyWarnWindow(fancyWarnWindow::tip, "确认检测产品型号", "",false);
|
||||
_fancyWarnWindow->disableHideAfterClicked();
|
||||
_fancyWarnWindow->hide();
|
||||
QObject::connect(_fancyWarnWindow->continueBtn, &QPushButton::clicked, this, &productDetDoubleCheck::continueClicked);
|
||||
|
||||
}
|
||||
private:
|
||||
int productType = 0;
|
||||
QString SN;
|
||||
public slots:
|
||||
void continueClicked()
|
||||
{
|
||||
//timer->start(10000);
|
||||
emit continueClickedSignal(productType, SN);
|
||||
_fancyWarnWindow->hide();
|
||||
//_fancyWarnWindow->continueBtn->setDisabled(true);
|
||||
//QObject::connect(timer, &QTimer::timeout, this, [=]() {_fancyWarnWindow->continueBtn->setEnabled(true); });
|
||||
}
|
||||
void showAndSetText(int productTypeIn, QString SNin)
|
||||
{
|
||||
_fancyWarnWindow->show();
|
||||
_fancyWarnWindow->setDetailText(QString::fromStdString(_core._appConfig.productDatas[productTypeIn].name));
|
||||
productType = productTypeIn;
|
||||
SN = SNin;
|
||||
}
|
||||
void hide()
|
||||
{
|
||||
_fancyWarnWindow->hide();
|
||||
}
|
||||
signals:
|
||||
void continueClickedSignal(int,QString);
|
||||
};
|
||||
#pragma once
|
||||
@@ -170,6 +170,9 @@ public slots:
|
||||
void resetAllValue()
|
||||
{
|
||||
resultLabel->setText("待读取");
|
||||
QPalette palette;
|
||||
palette.setColor(QPalette::WindowText, Qt::white);
|
||||
resultLabel->setPalette(palette);
|
||||
for (auto dashBoard : dashBoardWidgets)
|
||||
dashBoard->reset();
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ public:
|
||||
{
|
||||
fancyWarnWindow* warn = new fancyWarnWindow
|
||||
(fancyWarnWindow::Warning, "找不到任何产品配置文件",
|
||||
QString("请查看%1中是否正确存放配置文件").arg(QString::fromStdString(fileDir)));
|
||||
QString("请查看%1中是否正确存放配置文件").arg(QString::fromStdString(fileDir)), true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user