diff --git a/doc/轮毂识别定位一体与PLC通讯协议.docx b/doc/轮毂识别定位一体与PLC通讯协议.docx index d172ddc..af55a20 100644 Binary files a/doc/轮毂识别定位一体与PLC通讯协议.docx and b/doc/轮毂识别定位一体与PLC通讯协议.docx differ diff --git a/src/algorithm/AlgorithmCompare.cpp b/src/algorithm/AlgorithmCompare.cpp index 8c6e0f8..5b14481 100644 --- a/src/algorithm/AlgorithmCompare.cpp +++ b/src/algorithm/AlgorithmCompare.cpp @@ -34,6 +34,7 @@ public: QStringList defectList; }; + static QImage cvMat2QImage(const cv::Mat& mat) { if (mat.type() == CV_8UC1) { QImage image(mat.cols, mat.rows, QImage::Format_Indexed8); diff --git a/src/lpbdesigner/MainFrame.cpp b/src/lpbdesigner/MainFrame.cpp index 5479ccd..91e7de1 100644 --- a/src/lpbdesigner/MainFrame.cpp +++ b/src/lpbdesigner/MainFrame.cpp @@ -2,6 +2,7 @@ #include "ui_MainFrame.h" #include "colossusbase.h" #include +#include "lpdesignerConfig.h" #pragma execution_character_set("utf-8") #define WINDOWS_ICON ":/resource/app.png" QString showVariant(const AlgoParamType type, const QVariant &var) { @@ -151,6 +152,9 @@ CMainFrame::CMainFrame(QWidget *parent) m_plablStatus = new QLabel(this);//菜单栏提示信息 ui->statusBar->addWidget(m_plablStatus); _pSaveStatus = ui->label_SaveStatus; + + lpdesignerConfig::instance()->readConfig(); + } CMainFrame::~CMainFrame() @@ -1512,7 +1516,7 @@ Q_SLOT void CMainFrame::onLoadImage() if (!currentTask()) return ; - QString strDefaultDirPath = m_pCurrentTask->GetTaskInfo()->strDirPath; + QString strDefaultDirPath = lpdesignerConfig::instance()->m_SaveImgDirPath+"/data/";// m_pCurrentTask->GetTaskInfo()->strDirPath; QStringList strFileNamesList = QFileDialog::getOpenFileNames(this, "open file", strDefaultDirPath, "Images (*.bmp *.png *.xpm *.jpg)"); if (strFileNamesList.size() <= 0) { diff --git a/src/tpMain/cryptokey/lpCryptokey.cpp b/src/tpMain/cryptokey/lpCryptokey.cpp index ff66ae0..aaa4b6f 100644 --- a/src/tpMain/cryptokey/lpCryptokey.cpp +++ b/src/tpMain/cryptokey/lpCryptokey.cpp @@ -78,13 +78,13 @@ bool lpCheckKey::checkLinese() std::string cpuID = lpHardwareInfo::instance()->getCpuID(); std::string BoardID = lpHardwareInfo::instance()->getMotherBoardID(); std::string macID = lpHardwareInfo::instance()->getMacAddress(); - if (hardDriveID.size() > 0) - { - m_SerialNo = lpCryptokey::genSerialNumber(QString(hardDriveID.c_str()) + QString(cpuID.c_str())); - } - else { - m_SerialNo = lpCryptokey::genSerialNumber(QString(BoardID.c_str()) + QString(macID.c_str())); - } +// if (hardDriveID.size() > 0) +// { +// m_SerialNo = lpCryptokey::genSerialNumber(QString(hardDriveID.c_str()) + QString(cpuID.c_str())); +// } +// else { + m_SerialNo = lpCryptokey::genSerialNumber(/*QString(BoardID.c_str()) +*/ QString(macID.c_str())); +// } QSettings settingKey("Leaper_Register"); QString strKey = settingKey.value("key").toString(); bool bRegister = settingKey.value("register", false).toBool(); diff --git a/tpvs17/lpdesigner/lpdesigner.vcxproj b/tpvs17/lpdesigner/lpdesigner.vcxproj index 18fe121..3e5d291 100644 --- a/tpvs17/lpdesigner/lpdesigner.vcxproj +++ b/tpvs17/lpdesigner/lpdesigner.vcxproj @@ -94,6 +94,16 @@ + + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing %(Identity)... + .\..\..\src\lpbdesigner\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\..\..\src\lpbdesigner\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_CORE_LIB -DLPDESIGNER_LIB -D%(PreprocessorDefinitions) "-I." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWebKit" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtWebkitWidgets" "-I.\GeneratedFiles\$(ConfigurationName)" "-I.\..\..\include\lpdesigner\algela" "-I.\..\..\include\lpdesigner" "-I.\..\..\src\lpbdesigner\GeneratedFiles" "-I.\..\..\src\ColossusBase" "-I.\..\..\3part\opencv3.4.1\include" "-I.\..\..\3part\opencv3.4.1\include\opencv" "-I.\..\..\3part\opencv3.4.1\include\opencv2" "-I.\..\..\src\lpbdesigner" "-I.\..\..\3part\tadpole\include\tpBase" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing %(Identity)... + .\..\..\src\lpbdesigner\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\..\..\src\lpbdesigner\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DLPDESIGNER_LIB -D%(PreprocessorDefinitions) "-I." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWebKit" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtWebkitWidgets" "-I.\GeneratedFiles\$(ConfigurationName)" "-I.\..\..\include\lpdesigner\algela" "-I.\..\..\include\lpdesigner" "-I.\..\..\src\lpbdesigner\GeneratedFiles" "-I.\..\..\src\ColossusBase" "-I.\..\..\3part\opencv3.4.1\include" "-I.\..\..\3part\opencv3.4.1\include\opencv" "-I.\..\..\3part\opencv3.4.1\include\opencv2" "-I.\..\..\src\lpbdesigner" "-I.\..\..\3part\tadpole\include\tpBase" + @@ -181,6 +191,9 @@ true + + true + true @@ -208,6 +221,9 @@ true + + true + true @@ -224,6 +240,7 @@ + diff --git a/tpvs17/lpdesigner/lpdesigner.vcxproj.filters b/tpvs17/lpdesigner/lpdesigner.vcxproj.filters index 541458c..a3fd515 100644 --- a/tpvs17/lpdesigner/lpdesigner.vcxproj.filters +++ b/tpvs17/lpdesigner/lpdesigner.vcxproj.filters @@ -120,6 +120,9 @@ Form Files + + Header Files + @@ -212,6 +215,15 @@ Source Files + + Generated Files\Debug + + + Generated Files\Release + + + Source Files + diff --git a/tpvs17/lpdesigner/lpdesignerConfig.cpp b/tpvs17/lpdesigner/lpdesignerConfig.cpp new file mode 100644 index 0000000..09121ed --- /dev/null +++ b/tpvs17/lpdesigner/lpdesignerConfig.cpp @@ -0,0 +1,33 @@ +#include "lpdesignerConfig.h" +#include +#include +#include +#include +lpdesignerConfig::lpdesignerConfig(QObject *parent) + : QObject(parent) +{ +} + +lpdesignerConfig::~lpdesignerConfig() +{ +} + +void lpdesignerConfig::readConfig() +{ + QString fileMyself = QApplication::applicationDirPath() + "\\user\\selfdefine.json"; + QFile file(fileMyself); + if (true == file.open(QIODevice::ReadOnly)) + { + QByteArray readData = file.readAll(); + QJsonObject rootObj = QJsonDocument::fromJson(readData).object(); + if (!rootObj.isEmpty()) + { + QJsonObject detectImage = rootObj.value("DetectImage").toObject(); + if (!detectImage.isEmpty()) + { + m_SaveImgDirPath = detectImage.value("SaveImgPath").toString(); + } + } + } + file.close(); +} diff --git a/tpvs17/lpdesigner/lpdesignerConfig.h b/tpvs17/lpdesigner/lpdesignerConfig.h new file mode 100644 index 0000000..4a3ef51 --- /dev/null +++ b/tpvs17/lpdesigner/lpdesignerConfig.h @@ -0,0 +1,18 @@ +#ifndef _LPDESIGNERCONFIG_H_ +#define _LPDESIGNERCONFIG_H_ + +#include +#include "lp_singleton_base.h" + +class lpdesignerConfig : public QObject,public lp_singleton_base +{ + Q_OBJECT + +public: + lpdesignerConfig(QObject *parent = 0); + ~lpdesignerConfig(); + void readConfig(); + QString m_SaveImgDirPath; +}; + +#endif diff --git a/tpvs17/tpMain/QModelMgrDlg.cpp b/tpvs17/tpMain/QModelMgrDlg.cpp index c799bae..a5b8688 100644 --- a/tpvs17/tpMain/QModelMgrDlg.cpp +++ b/tpvs17/tpMain/QModelMgrDlg.cpp @@ -13,6 +13,7 @@ #include "ICompareModel.h" #include +#include "lpGlobalConfig.h" #define WS_PICSIZE 129 //!>缩放大小 #define WS_PICSIZELIST_ITEM 100 @@ -142,7 +143,7 @@ Q_SLOT void QModelMgrDlg::onAddPic2Model() onMessageBox(QMessageBox::Information, tr("提示"), tr("请选择一个您要追加图像的型号!"), 0); return; } - QStringList lstFiles = FileOper::selectFiles(QString("%1 Add Picture").arg(strModel), "Picture(*.bmp *.jpg *.png)", m_strAddPicPath);// m_pCtrl->appRoot() + "//Data//"); + QStringList lstFiles = FileOper::selectFiles(QString("%1 Add Picture").arg(strModel), "Picture(*.bmp *.jpg *.png *.jpeg)", lpGlobalConfig::instance()->m_SaveImgDirPath+"/data/");// m_pCtrl->appRoot() + "//Data//"); if (lstFiles.empty()) { return; } @@ -844,7 +845,7 @@ bool QModelMgrDlg::appImage2Widget(QString strPath, QString strModel) if (dst.empty()) { return false; } - if (dst.rows >= 900 || dst.cols >= 900) + if (dst.rows >= 1900 || dst.cols >= 1900) return false; //显示 QString strFileName = strModel + "_" + hubBase::genDateTime("MMddhhmmzzz"); diff --git a/tpvs17/tpMain/lpMainWin.cpp b/tpvs17/tpMain/lpMainWin.cpp index a67a739..bb159c8 100644 --- a/tpvs17/tpMain/lpMainWin.cpp +++ b/tpvs17/tpMain/lpMainWin.cpp @@ -22,9 +22,9 @@ #include "databasesql.h" #include "lpCryptokey.h" -#define VERSION_HUB "3.0.1.8" +#define VERSION_HUB "3.0.1.9" #define VERSION_ALG "3.0.1.4" -#define UPDATE_TIME "2021-11-09" +#define UPDATE_TIME "2021-11-10" #pragma execution_character_set("utf-8") #define MODEL_UI_ICON_NONE ":/image/no-img" @@ -1363,6 +1363,7 @@ Q_SLOT void lpMainWin::onTriggerCam() { QString strMsg = QString("当前为停止检测状态,请按下开始检测再触发相机拍照"); emit sgShowDetectLog(strMsg); + onStrongButton(); return; } @@ -1511,16 +1512,16 @@ void lpMainWin::saveImage(Result2Ui* pRes) goodsourceDir += "\\Source"; goodsourceDir += "\\"; goodsourceDir += pRes->m_strModel; - QString resultpath = goodsourceDir + "\\" + filename + ".png"; - saveImage(pRes->m_pixSrc, goodsourceDir + "\\", filename + ".png"); + QString resultpath = goodsourceDir + "\\" + filename + ".jpg"; + saveImage(pRes->m_pixSrc, goodsourceDir + "\\", filename + ".jpg"); } QString goodtargetDir = fileSavePath + "\\Good"; if (lpGlobalConfig::instance()->bSaveCutOKImg == true) { goodtargetDir += "\\Target"; goodtargetDir += "\\"; goodtargetDir += pRes->m_strModel; - QString resultpath = goodtargetDir + "\\" + filename + "Res.png"; - saveImage(pRes->m_pixResult, goodtargetDir + "\\", filename + "Res.png"); + QString resultpath = goodtargetDir + "\\" + filename + "Res.jpg"; + saveImage(pRes->m_pixResult, goodtargetDir + "\\", filename + "Res.jpg"); } } else @@ -1531,17 +1532,17 @@ void lpMainWin::saveImage(Result2Ui* pRes) filename = filename + "_" + curExposureTimeStr; if (lpGlobalConfig::instance()->bSaveSrcNGImg == true) { errorSourceDir += "\\Source"; - QString resultpath = errorSourceDir + "\\" + filename + ".png"; - saveImage(pRes->m_pixSrc, errorSourceDir + "\\", filename + ".png"); + QString resultpath = errorSourceDir + "\\" + filename + ".jpg"; + saveImage(pRes->m_pixSrc, errorSourceDir + "\\", filename + ".jpg"); } QString errortargetDir = fileSavePath + "\\Error"; if (lpGlobalConfig::instance()->bSaveCutNGImg == true) { errortargetDir += "\\Target"; - QString resultpath = errortargetDir + "\\" + filename + "Res.png"; + QString resultpath = errortargetDir + "\\" + filename + "Res.jpg"; if (pRes->m_pixResult.isNull()) - saveImage(pRes->m_pixSrc, errortargetDir + "\\", filename + "Res.png"); + saveImage(pRes->m_pixSrc, errortargetDir + "\\", filename + "Res.jpg"); else - saveImage(pRes->m_pixResult, errortargetDir + "\\", filename + "Res.png"); + saveImage(pRes->m_pixResult, errortargetDir + "\\", filename + "Res.jpg"); } } } diff --git a/tpvs17/wheel.sln b/tpvs17/wheel.sln index a460894..ec508a2 100644 --- a/tpvs17/wheel.sln +++ b/tpvs17/wheel.sln @@ -25,7 +25,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lpCoreCtrl", "lpCoreCtrl\lp EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Enchanter", "Enchanter\Enchanter.vcxproj", "{7B76D75A-0E01-451E-880E-FB9AC63A914B}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestTransform", "TestTransform\TestTransform.vcxproj", "{0AB1DDAD-DC20-4A2C-B1FE-1D122125FEE2}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tpCamHik", "tpCamHik\tpCamHik.vcxproj", "{64C9A32D-82E8-4C36-9AA6-52D58B23F687}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -105,18 +105,20 @@ Global {7B76D75A-0E01-451E-880E-FB9AC63A914B}.Release|x64.ActiveCfg = Release|x64 {7B76D75A-0E01-451E-880E-FB9AC63A914B}.Release|x64.Build.0 = Release|x64 {7B76D75A-0E01-451E-880E-FB9AC63A914B}.Release|x86.ActiveCfg = Release|x64 - {0AB1DDAD-DC20-4A2C-B1FE-1D122125FEE2}.Debug|x64.ActiveCfg = Debug|x64 - {0AB1DDAD-DC20-4A2C-B1FE-1D122125FEE2}.Debug|x64.Build.0 = Debug|x64 - {0AB1DDAD-DC20-4A2C-B1FE-1D122125FEE2}.Debug|x86.ActiveCfg = Debug|x64 - {0AB1DDAD-DC20-4A2C-B1FE-1D122125FEE2}.Release|x64.ActiveCfg = Release|x64 - {0AB1DDAD-DC20-4A2C-B1FE-1D122125FEE2}.Release|x64.Build.0 = Release|x64 - {0AB1DDAD-DC20-4A2C-B1FE-1D122125FEE2}.Release|x86.ActiveCfg = Release|x64 + {64C9A32D-82E8-4C36-9AA6-52D58B23F687}.Debug|x64.ActiveCfg = Debug|x64 + {64C9A32D-82E8-4C36-9AA6-52D58B23F687}.Debug|x64.Build.0 = Debug|x64 + {64C9A32D-82E8-4C36-9AA6-52D58B23F687}.Debug|x86.ActiveCfg = Debug|Win32 + {64C9A32D-82E8-4C36-9AA6-52D58B23F687}.Debug|x86.Build.0 = Debug|Win32 + {64C9A32D-82E8-4C36-9AA6-52D58B23F687}.Release|x64.ActiveCfg = Release|x64 + {64C9A32D-82E8-4C36-9AA6-52D58B23F687}.Release|x64.Build.0 = Release|x64 + {64C9A32D-82E8-4C36-9AA6-52D58B23F687}.Release|x86.ActiveCfg = Release|Win32 + {64C9A32D-82E8-4C36-9AA6-52D58B23F687}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {CD365F32-5EAC-4A16-AD47-BFB1D8E5511A} Qt5Version = qt5.9.4-msvc2017-x64 + SolutionGuid = {CD365F32-5EAC-4A16-AD47-BFB1D8E5511A} EndGlobalSection EndGlobal