diff --git a/3part/tadpole/include/tpBase/lpbengine.h b/3part/tadpole/include/tpBase/lpbengine.h index 0f129e5..767271a 100644 Binary files a/3part/tadpole/include/tpBase/lpbengine.h and b/3part/tadpole/include/tpBase/lpbengine.h differ diff --git a/runner17/algorithmLib/caliCenterd.dll b/runner17/algorithmLib/caliCenterd.dll index 2505ee9..92bd381 100644 Binary files a/runner17/algorithmLib/caliCenterd.dll and b/runner17/algorithmLib/caliCenterd.dll differ diff --git a/runner17/algorithmLib/caliCenterd.ilk b/runner17/algorithmLib/caliCenterd.ilk deleted file mode 100644 index 5f347b3..0000000 Binary files a/runner17/algorithmLib/caliCenterd.ilk and /dev/null differ diff --git a/runner17/algorithmLib/caliValved.dll b/runner17/algorithmLib/caliValved.dll index c404e9c..9b06f10 100644 Binary files a/runner17/algorithmLib/caliValved.dll and b/runner17/algorithmLib/caliValved.dll differ diff --git a/runner17/algorithmLib/valveDetectord.dll b/runner17/algorithmLib/valveDetectord.dll index e1b30a0..9d76a6e 100644 Binary files a/runner17/algorithmLib/valveDetectord.dll and b/runner17/algorithmLib/valveDetectord.dll differ diff --git a/runner17/algorithmLib/valveDetectord.ilk b/runner17/algorithmLib/valveDetectord.ilk deleted file mode 100644 index 724d7f4..0000000 Binary files a/runner17/algorithmLib/valveDetectord.ilk and /dev/null differ diff --git a/runner17/config/camera.json b/runner17/config/camera.json index 27a9404..a6a98de 100644 --- a/runner17/config/camera.json +++ b/runner17/config/camera.json @@ -5,7 +5,26 @@ "board_num": 0, "board_type": 0, "exposure": 100000, - "folder": "H:\\新建文件夹\\7\\", + "folder": "F:\\ValueProject\\TestImage\\A1\\", + "format": "GRAY8", + "gain": 8, + "height": 1200, + "id": 1, + "loop": 1, + "rely_on_camera": "", + "save": 0, + "save_img_suffix": ".BMP", + "showname": "工位1", + "type": 100, + "width": 2048, + "zoom": 1 + }, + "MV-CA050-10GC 10784638609": { + "algorithm": 0, + "board_num": 0, + "board_type": 0, + "exposure": 100000, + "folder": "F:\\ValueProject\\TestImage\\B2\\", "format": "GRAY8", "gain": 8, "height": 1200, diff --git a/runner17/dbLog.db b/runner17/dbLog.db deleted file mode 100644 index 3955b17..0000000 Binary files a/runner17/dbLog.db and /dev/null differ diff --git a/runner17/lpMaind.dll b/runner17/lpMaind.dll index 1349f52..cac22b5 100644 Binary files a/runner17/lpMaind.dll and b/runner17/lpMaind.dll differ diff --git a/runner17/lpMaind.ilk b/runner17/lpMaind.ilk deleted file mode 100644 index 191ea4b..0000000 Binary files a/runner17/lpMaind.ilk and /dev/null differ diff --git a/runner17/lpbengined.dll b/runner17/lpbengined.dll index 42bec45..6100ad3 100644 Binary files a/runner17/lpbengined.dll and b/runner17/lpbengined.dll differ diff --git a/runner17/lpbengined.ilk b/runner17/lpbengined.ilk deleted file mode 100644 index 6a11e71..0000000 Binary files a/runner17/lpbengined.ilk and /dev/null differ diff --git a/runner17/lpdesignerd.dll b/runner17/lpdesignerd.dll index 5099f02..bf2ada6 100644 Binary files a/runner17/lpdesignerd.dll and b/runner17/lpdesignerd.dll differ diff --git a/runner17/lpdesignerd.ilk b/runner17/lpdesignerd.ilk deleted file mode 100644 index 414367a..0000000 Binary files a/runner17/lpdesignerd.ilk and /dev/null differ diff --git a/src/lpMain/IStation.h b/src/lpMain/IStation.h index e0e4d6c..ae4a0f9 100644 --- a/src/lpMain/IStation.h +++ b/src/lpMain/IStation.h @@ -49,7 +49,7 @@ signals: void sgPrint2Window(QString &); void sgUpdateLable(); void sgShowImage(const QImage &img); - void sgShowModeName(int, QString); + void sgShowModeName(QString, QString); protected: ISerialPortTool *m_pPort{ nullptr }; }; diff --git a/src/lpMain/Station.cpp b/src/lpMain/Station.cpp index 2678434..a88453f 100644 --- a/src/lpMain/Station.cpp +++ b/src/lpMain/Station.cpp @@ -156,8 +156,7 @@ bool Station::updateCurrentModel2Label() strText = strText.arg("color:#ff0000;").arg(QObject::tr("工位")) .arg(nId).arg(m_strCurrentModel == "" ? "?" : m_strCurrentModel) .arg(bCali == true ? QObject::tr("已标定") : QObject::tr("未标定")); - - emit sgShowModeName(nId, strText); + emit sgShowModeName(strSolutionName, strText); return true; } diff --git a/src/lpMain/WfCtrl.cpp b/src/lpMain/WfCtrl.cpp index 831127e..02d427b 100644 --- a/src/lpMain/WfCtrl.cpp +++ b/src/lpMain/WfCtrl.cpp @@ -240,11 +240,6 @@ bool CWfCtrl::ISelModel(QString nStation, QString strModel) IStation *pStation = IGetStationByKey(nStation); if (pStation) { pStation->setCurrentModel(strModel); -// if (m_pColossus) { -// //需要测试 -// m_pColossus->selModel(nStation, strModel); -// //m_pColossus->ReSetModifyState(); -// } } return true; diff --git a/tpvs17/caliCenter/x64/Debug/algEg.obj b/tpvs17/caliCenter/x64/Debug/algEg.obj deleted file mode 100644 index c3b94a0..0000000 Binary files a/tpvs17/caliCenter/x64/Debug/algEg.obj and /dev/null differ diff --git a/tpvs17/caliCenter/x64/Debug/caliCenter.obj b/tpvs17/caliCenter/x64/Debug/caliCenter.obj deleted file mode 100644 index ac6d88f..0000000 Binary files a/tpvs17/caliCenter/x64/Debug/caliCenter.obj and /dev/null differ diff --git a/tpvs17/caliCenter/x64/Debug/caliCenter.tlog/caliCenter.write.1u.tlog b/tpvs17/caliCenter/x64/Debug/caliCenter.tlog/caliCenter.write.1u.tlog deleted file mode 100644 index f37868b..0000000 Binary files a/tpvs17/caliCenter/x64/Debug/caliCenter.tlog/caliCenter.write.1u.tlog and /dev/null differ diff --git a/tpvs17/caliCenter/x64/Debug/caliCenter.tlog/link.read.1.tlog b/tpvs17/caliCenter/x64/Debug/caliCenter.tlog/link.read.1.tlog deleted file mode 100644 index a614df3..0000000 Binary files a/tpvs17/caliCenter/x64/Debug/caliCenter.tlog/link.read.1.tlog and /dev/null differ diff --git a/tpvs17/caliValve/x64/Debug/algEg.obj b/tpvs17/caliValve/x64/Debug/algEg.obj deleted file mode 100644 index 25a1d66..0000000 Binary files a/tpvs17/caliValve/x64/Debug/algEg.obj and /dev/null differ diff --git a/tpvs17/caliValve/x64/Debug/caliValve.obj b/tpvs17/caliValve/x64/Debug/caliValve.obj deleted file mode 100644 index 11b7e00..0000000 Binary files a/tpvs17/caliValve/x64/Debug/caliValve.obj and /dev/null differ diff --git a/tpvs17/caliValve/x64/Debug/caliValve.tlog/caliValve.write.1u.tlog b/tpvs17/caliValve/x64/Debug/caliValve.tlog/caliValve.write.1u.tlog deleted file mode 100644 index d4e4f7a..0000000 Binary files a/tpvs17/caliValve/x64/Debug/caliValve.tlog/caliValve.write.1u.tlog and /dev/null differ diff --git a/tpvs17/caliValve/x64/Debug/caliValve.tlog/link.read.1.tlog b/tpvs17/caliValve/x64/Debug/caliValve.tlog/link.read.1.tlog deleted file mode 100644 index 5ef9fa5..0000000 Binary files a/tpvs17/caliValve/x64/Debug/caliValve.tlog/link.read.1.tlog and /dev/null differ diff --git a/tpvs17/caliValve/x64/Debug/vc141.pdb b/tpvs17/caliValve/x64/Debug/vc141.pdb deleted file mode 100644 index 356c1e7..0000000 Binary files a/tpvs17/caliValve/x64/Debug/vc141.pdb and /dev/null differ diff --git a/tpvs17/lpMain/CMainWin.cpp b/tpvs17/lpMain/CMainWin.cpp index ae3abba..f5af7b8 100644 --- a/tpvs17/lpMain/CMainWin.cpp +++ b/tpvs17/lpMain/CMainWin.cpp @@ -13,6 +13,7 @@ #include "lpGlobalConfig.h" #define LEAPER_LOGO ":/leaper/Resource/app.png" +#define WINDOWS_ICON ":/leaper/Resource/app.png" #define DELETE_POINTER(p) if (p) {delete p; p = NULL;} #pragma execution_character_set("utf-8") @@ -80,10 +81,11 @@ CMainWin::CMainWin(QWidget *parent) onInitSerial(); onInitUser(); onInitUI(); + onInitStatus(); lpSysLog::instance()->Init(); lpSysConfig::instance()->readConfig(); lpSysConfig::instance()->writeConfig(); - + lpGlobalConfig::instance()->readConfig(); SYSLOG_STATUS << "系统启动"; { QString strPath = QCoreApplication::applicationDirPath(); @@ -96,7 +98,7 @@ CMainWin::CMainWin(QWidget *parent) m_pCameraTrig = new AutoTrigger; connect(m_pCameraTrig, SIGNAL(sgTrig()), this, SLOT(onTrigImage())); - onInitStatus(); + connect(&m_devMgrWid, SIGNAL(sgChangeLanguage(QString)), this, SLOT(onLanguageChange(QString))); connect(&m_testWid, SIGNAL(sgTestMode(int)), this, SLOT(onTestMode(int))); @@ -105,6 +107,22 @@ CMainWin::CMainWin(QWidget *parent) m_pWfCtrl->onInit(); m_mangeWid.onInitModelList(m_pWfCtrl); + QStringList strList = m_pWfCtrl->IGetStationKeys(); + foreach(QString str, strList) { + IStation *pS = m_pWfCtrl->IGetStationByKey(str); + connect(pS, SIGNAL(sgShowModeName(QString, QString)), this, SLOT(onShowName(QString, QString))); + } + + { + if (m_pDetectorEngine) + { + QStringList Names = m_pDetectorEngine->getSolutionMgr()->GetAllSolutions().keys(); + + } + } + + m_pWfCtrl->ISelModel(lpGlobalConfig::instance()->m_StationSolution_1, lpGlobalConfig::instance()->m_StationRunModel_1); + m_pWfCtrl->ISelModel(lpGlobalConfig::instance()->m_StationSolution_2, lpGlobalConfig::instance()->m_StationRunModel_2); } CMainWin::~CMainWin() @@ -160,29 +178,46 @@ CMainWin::~CMainWin() void CMainWin::INewCameraImage(const QString& camKey, QImage img) { emit sgShowSrcImg(camKey, img); + + QString solutionName; + QString strRunModel; + int stationID = 0; + if (camKey == lpGlobalConfig::instance()->m_StationCamKey_1) + { + solutionName = lpGlobalConfig::instance()->m_StationSolution_1; + strRunModel = lpGlobalConfig::instance()->m_StationRunModel_1; + stationID = 1; + } + else if (camKey == lpGlobalConfig::instance()->m_StationCamKey_2) + { + solutionName = lpGlobalConfig::instance()->m_StationSolution_2; + strRunModel = lpGlobalConfig::instance()->m_StationRunModel_2; + stationID = 2; + } + onShowImage(stationID, img); - QString solutionName = lpGlobalConfig::instance()->m_CamKeySolution.value(camKey); if (solutionName.isEmpty()) { } else { - QString strMode = lpGlobalConfig::instance()->m_curRunModel.value(solutionName); + QString strMode = strRunModel; cv::Mat srcMat = QImageToMat(img); AlgResultCallBack func = std::bind(&CMainWin::IEngineResult, this, std::placeholders::_1); m_pDetectorEngine->detectByName(srcMat, solutionName, strMode, func); } + } //算法结果接收 void CMainWin::IVariantMapToUI(const QString& camKey, const QVariantMap& vMap) { - return; - QImage srcImg = vMap.value("srcImage").value(); - cv::Mat srcMat = QImageToMat(srcImg); - QString strMode;// = pResult->m_strModel; - AlgResultCallBack func = std::bind(&CMainWin::IEngineResult, this, std::placeholders::_1); - m_pDetectorEngine->detect(srcMat, strMode, func); +// return; +// QImage srcImg = vMap.value("srcImage").value(); +// cv::Mat srcMat = QImageToMat(srcImg); +// QString strMode;// = pResult->m_strModel; +// AlgResultCallBack func = std::bind(&CMainWin::IEngineResult, this, std::placeholders::_1); +// m_pDetectorEngine->detect(srcMat, strMode, func); @@ -581,6 +616,12 @@ Q_SLOT void CMainWin::onActionClicked() m_devMgrWid.setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint); m_devMgrWid.setWindowModality(Qt::ApplicationModal); m_devMgrWid.setAttribute(Qt::WA_ShowModal, true); + + + QStringList camkeys = m_pCoreCtrl->ICameraKeys(); + QStringList solutions = m_pDetectorEngine->getSolutionMgr()->GetAllSolutions().keys(); + m_devMgrWid.setSystemConfig(camkeys, solutions); + m_devMgrWid.show(); } else if ("main_Login_action" == strObj) {//用户登陆 @@ -994,13 +1035,16 @@ Q_SLOT void CMainWin::onMainFrameClose() Q_SLOT void CMainWin::onSnapImage(int nCamera /*= -1*/) { -/* IStation *pStation = m_pWfCtrl->IGetStationById(nCamera); - if (!pStation) { - return; + if (nCamera == 1) + { + QString camKey = lpGlobalConfig::instance()->m_StationCamKey_1; + m_pCoreCtrl->ISnapImage(QStringList() << camKey); + } + else if (nCamera == 2) + { + QString camKey = lpGlobalConfig::instance()->m_StationCamKey_2; + m_pCoreCtrl->ISnapImage(QStringList() << camKey); } - else { - pStation->trigImage(); - }*/ } Q_SLOT void CMainWin::onTrigImage() @@ -1109,12 +1153,12 @@ Q_SLOT void CMainWin::onShowImage(int ID, QImage img) } } //展示正在检测的型号名 -Q_SLOT void CMainWin::onShowName(int ID, QString strName) +Q_SLOT void CMainWin::onShowName(QString ID, QString strName) { - if (ID == 1) { + if (ID == lpGlobalConfig::instance()->m_StationSolution_1) { ui.wf_lb_station_name_1->setText(strName); } - else if (ID == 2) { + else if (ID == lpGlobalConfig::instance()->m_StationSolution_2) { ui.wf_lb_station_name_2->setText(strName); } } @@ -1132,19 +1176,27 @@ Q_SLOT void CMainWin::onShowLog(int nID, QString strMsg) Q_SLOT void CMainWin::onPopMenu(const QPoint& pt) { /*根据UI名判断是哪个工位需要设置相机*/ -/* int nStationID = 1; + QString strCamKey; QString strObj = sender()->objectName(); if ("wf_lb_image_show_1" == strObj) - nStationID = 1; + { + strCamKey = lpGlobalConfig::instance()->m_StationCamKey_1; + } else if ("wf_lb_image_show_2" == strObj) - nStationID = 2; + { + strCamKey = lpGlobalConfig::instance()->m_StationCamKey_2; + } - IStation *pStation = m_pWfCtrl->IGetStationById(nStationID); - if (!pStation) { - //相机没配置,需要处理 添加相机 - return; + QStringList camkeys = m_pCoreCtrl->ICameraKeys(); + if (!camkeys.contains(strCamKey) || strCamKey.isEmpty()) + { + QMessageBox infobox(QMessageBox::Critical, tr("提示"), tr("请对该工位的相机进行绑定!"), QMessageBox::Yes, this); + infobox.setWindowIcon(QIcon(WINDOWS_ICON)); + infobox.setButtonText(QMessageBox::Yes, tr("确认")); + infobox.exec(); + return ; } - QString strCamKey = pStation->stationKey(); + QMenu menu; QAction *pSetAction = menu.addAction(tr("相机属性配置")); pSetAction->setObjectName("setAction"); @@ -1167,7 +1219,6 @@ Q_SLOT void CMainWin::onPopMenu(const QPoint& pt) m_camSetWid.show(); } menu.clear(); - */ } Q_SLOT void CMainWin::onSlotAddNewModel(QString strName) @@ -1199,11 +1250,11 @@ Q_SLOT void CMainWin::onSlotDelOldModel(QString strName) } } - void CMainWin::IEngineResult(QVariantMap vMap) { QImage srcImg = vMap.value("originImage").value(); bool taskCali = vMap.value("taskCali").toBool(); + QString solutionName = vMap.value("solutionName").toString(); if (taskCali == false)//模板未标定 { // ui.main_value_Result->setText("该型号未标定"); @@ -1243,18 +1294,29 @@ void CMainWin::IEngineResult(QVariantMap vMap) // valueRlt.pixmap = QPixmap::fromImage(srcImg); // valueRlt.resultType = 3;//识别出型号 但未标定 // onSaveValveResult(valueRlt); + + int stationID = 0; + if (solutionName == lpGlobalConfig::instance()->m_StationSolution_1) + { + stationID = 1; + } + else if (solutionName == lpGlobalConfig::instance()->m_StationSolution_2) + { + stationID = 2; + } + onShowImage(stationID, srcImg); } else { -// QVariantMap algResult = vMap.value("AlgoResult").toMap(); -// -// double dAngle = algResult.contains("angle") ? algResult.value("angle").toDouble() : 365; -// int errorType = algResult.contains("error") ? algResult.value("error").toInt() : 16; -// double matchScore = algResult.value("score").toDouble() * 100; -// QImage maskImg = algResult.value("image").value(); -// QString str = algResult.value("resultTip").toString(); -// QPointF centerPoint = algResult.value("centerPoint").toPointF(); -// QString taskName = vMap.value("taskName").toString(); -// double taskTime = vMap.value("tasktime").toDouble(); + QVariantMap algResult = vMap.value("AlgoResult").toMap(); + + double dAngle = algResult.contains("angle") ? algResult.value("angle").toDouble() : 365; + int errorType = algResult.contains("error") ? algResult.value("error").toInt() : 16; + double matchScore = algResult.value("score").toDouble() * 100; + QImage maskImg = algResult.value("image").value(); + QString str = algResult.value("resultTip").toString(); + QPointF centerPoint = algResult.value("centerPoint").toPointF(); + QString taskName = vMap.value("taskName").toString(); + double taskTime = vMap.value("tasktime").toDouble(); // ui.main_label_angle->setText(QString("%1").arg(dAngle)); // // ValueResult valueRlt; @@ -1297,6 +1359,16 @@ void CMainWin::IEngineResult(QVariantMap vMap) // if (!maskImg.isNull()) // m_ImgViewer->setImg(maskImg); // } + int stationID = 0; + if (solutionName == lpGlobalConfig::instance()->m_StationSolution_1) + { + stationID = 1; + } + else if (solutionName == lpGlobalConfig::instance()->m_StationSolution_2) + { + stationID = 2; + } + onShowImage(stationID, maskImg); } } diff --git a/tpvs17/lpMain/CMainWin.h b/tpvs17/lpMain/CMainWin.h index 6ceb43e..d333e80 100644 --- a/tpvs17/lpMain/CMainWin.h +++ b/tpvs17/lpMain/CMainWin.h @@ -93,8 +93,7 @@ private: Q_SLOT void onLogInOut(QString strName, int level, int state); Q_SLOT void onTestMode(int); Q_SLOT void onShowImage(int ID, QImage img); - Q_SLOT void onShowName(int ID, QString strName); - + Q_SLOT void onShowName(QString ID, QString strName); Q_SLOT void onLanguageChange(QString strLanguage);//Ӣл private: Ui::CMainWin ui; diff --git a/tpvs17/lpMain/CMainWin.ui b/tpvs17/lpMain/CMainWin.ui index da69095..2732dd8 100644 --- a/tpvs17/lpMain/CMainWin.ui +++ b/tpvs17/lpMain/CMainWin.ui @@ -319,6 +319,9 @@ 工位配置 + + 系统配置 + diff --git a/tpvs17/lpMain/QDeviceMgrUI.cpp b/tpvs17/lpMain/QDeviceMgrUI.cpp index c174d61..65302c9 100644 --- a/tpvs17/lpMain/QDeviceMgrUI.cpp +++ b/tpvs17/lpMain/QDeviceMgrUI.cpp @@ -1,13 +1,15 @@ #include "QDeviceMgrUI.h" #include "lpSysConfig.h" #include "QTipWidget.h" +#include "lpGlobalConfig.h" + #pragma execution_character_set("utf-8") QDeviceMgrUI::QDeviceMgrUI(QWidget *parent) : QWidget(parent) { ui.setupUi(this); connect(ui.m_pbOK, SIGNAL(clicked()), this, SLOT(onButtonClicked())); - + connect(ui.pushButton, SIGNAL(clicked()), this, SLOT(onButtonClicked())); } QDeviceMgrUI::~QDeviceMgrUI() @@ -17,9 +19,21 @@ QDeviceMgrUI::~QDeviceMgrUI() Q_SLOT void QDeviceMgrUI::onButtonClicked() { - getParam(); - lpSysConfig::instance()->writeConfig(); - ShowMessage(QObject::tr("ѱ")); + QString strObj = sender()->objectName(); + if (strObj == "m_pbOK") { + getParam(); + lpSysConfig::instance()->writeConfig(); + ShowMessage(QObject::tr("ѱ")); + } + else if (strObj == "pushButton") + { + lpGlobalConfig::instance()->m_StationCamKey_1 = ui.comboBox_cam1->currentText(); + lpGlobalConfig::instance()->m_StationCamKey_2 = ui.comboBox_cam2->currentText(); + + lpGlobalConfig::instance()->m_StationSolution_1 = ui.comboBox_solution1->currentText(); + lpGlobalConfig::instance()->m_StationSolution_2 = ui.comboBox_solution2->currentText(); + lpGlobalConfig::instance()->writeConfig(); + } } void QDeviceMgrUI::setParam() @@ -56,3 +70,27 @@ void QDeviceMgrUI::showEvent(QShowEvent *event) { setParam(); } + +void QDeviceMgrUI::setSystemConfig(QStringList camkeys, QStringList solutions) +{ + ui.comboBox_cam1->clear(); + ui.comboBox_cam2->clear(); + ui.comboBox_solution1->clear(); + ui.comboBox_solution2->clear(); + + ui.comboBox_cam1->addItem(""); + ui.comboBox_cam2->addItem(""); + ui.comboBox_solution1->addItem(""); + ui.comboBox_solution2->addItem(""); + + ui.comboBox_cam1->addItems(camkeys); + ui.comboBox_cam2->addItems(camkeys); + ui.comboBox_solution1->addItems(solutions); + ui.comboBox_solution2->addItems(solutions); + + ui.comboBox_cam1->setCurrentText(lpGlobalConfig::instance()->m_StationCamKey_1); + ui.comboBox_cam2->setCurrentText(lpGlobalConfig::instance()->m_StationCamKey_2); + + ui.comboBox_solution1->setCurrentText(lpGlobalConfig::instance()->m_StationSolution_1); + ui.comboBox_solution2->setCurrentText(lpGlobalConfig::instance()->m_StationSolution_2); +} diff --git a/tpvs17/lpMain/QDeviceMgrUI.h b/tpvs17/lpMain/QDeviceMgrUI.h index 7ab02db..e622c5b 100644 --- a/tpvs17/lpMain/QDeviceMgrUI.h +++ b/tpvs17/lpMain/QDeviceMgrUI.h @@ -12,11 +12,13 @@ public: QDeviceMgrUI(QWidget *parent = Q_NULLPTR); ~QDeviceMgrUI(); - Q_SLOT void onButtonClicked(); void setParam(); void getParam(); virtual void showEvent(QShowEvent *event); + + void setSystemConfig(QStringList camkeys, QStringList solutions); + private: Ui::QDeviceMgrUI ui; }; diff --git a/tpvs17/lpMain/QDeviceMgrUI.ui b/tpvs17/lpMain/QDeviceMgrUI.ui index 75da7c2..c7224fe 100644 --- a/tpvs17/lpMain/QDeviceMgrUI.ui +++ b/tpvs17/lpMain/QDeviceMgrUI.ui @@ -6,315 +6,371 @@ 0 0 - 470 - 280 + 438 + 387 - 11 + 12 - 设备管理 + 系统配置 - - - - - 11 - + + + + 0 - - 通讯设备配置: - - - - - - - 12 - - - - - - - - - 12 - - - - 波特率: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 12 - - - - 串口名: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 12 - - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 100 - 30 - - - - - 11 - - - - 确定并应用 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - 图像保存: - - - - - - - 12 - - - - 保存工位1结果图 - - - - - - - - 12 - - - - 保存工位2结果图 - - - - - - - - 12 - - - - 保存工位1原图 - - - - - - - - 12 - - - - 保存工位2原图 - - - - - - - - - - - 0 - 0 - - - - - 11 - - - - 维护相关: - - - - - - - 12 - - - - 是否启用原图定期删除功能 - - - - - - - - - - 12 - - - - 超期天数: - - - Qt::AlignCenter - - - - - - - - 12 - - - - - - - 1 - - - 360 - - - - - - - - - - - - 12 - - - - 预留磁盘大小: - - - Qt::AlignCenter - - - - - - - - 12 - - - - G - - - 1 - - - 10000 - - - - - - - - - - 12 - - - - 是否启用结果图定期删除功能 - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - + + + Tab 1 + + + + + + 相机绑定: + + + + + + + + + + + + 工位1: + + + + + + + 工位2: + + + + + + + + + + 解决方案绑定: + + + + + + + + + 工位1: + + + + + + + + + + 工位2: + + + + + + + + + + 应用 + + + + + + + + Tab 2 + + + + + + + 11 + + + + 通讯设备配置: + + + + + + + 12 + + + + + + + + + 12 + + + + 波特率: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 12 + + + + 串口名: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 12 + + + + + + + + + + + + 0 + 0 + + + + + 11 + + + + 维护相关: + + + + + + + 12 + + + + 是否启用原图定期删除功能 + + + + + + + + + + 12 + + + + 超期天数: + + + Qt::AlignCenter + + + + + + + + 12 + + + + + + + 1 + + + 360 + + + + + + + + + + + + 12 + + + + 预留磁盘大小: + + + Qt::AlignCenter + + + + + + + + 12 + + + + G + + + 1 + + + 10000 + + + + + + + + + + 12 + + + + 是否启用结果图定期删除功能 + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + 图像保存: + + + + + + + 12 + + + + 保存工位1结果图 + + + + + + + + 12 + + + + 保存工位2结果图 + + + + + + + + 12 + + + + 保存工位1原图 + + + + + + + + 12 + + + + 保存工位2原图 + + + + + + + + + + + 100 + 30 + + + + + 11 + + + + 确定并应用 + + + + + diff --git a/tpvs17/lpMain/QModelMangerUI.cpp b/tpvs17/lpMain/QModelMangerUI.cpp index 240333b..b5391b9 100644 --- a/tpvs17/lpMain/QModelMangerUI.cpp +++ b/tpvs17/lpMain/QModelMangerUI.cpp @@ -7,6 +7,7 @@ #include "QAddModeUI.h" #include "IStation.h" #include "IWfCtrl.h" +#include "lpGlobalConfig.h" #define LP_WF_PLC_MAX_INDEX 1000 #pragma execution_character_set("utf-8") QModelMangerUI::QModelMangerUI(QWidget *parent) @@ -28,17 +29,28 @@ Q_SLOT void QModelMangerUI::onButtonClicked() { QString strObj = sender()->objectName(); if ("wf_model_select_button" == strObj) { -// if (!m_pCtrl->IOnlineMode()) { -// IStation *pStation = getStation(); -// if (pStation) { -// QString strModel = pStation->currentSelectModel(); -// if (!strModel.isEmpty()) { -// m_pCtrl->ISelModel(currentTab(), strModel); -// ui.mLblModelState->setText(tr("current %1 OK!").arg(strModel)); -// m_pCtrl->ISetModifyModel(true); -// } -// } -// } + if (!m_pCtrl->IOnlineMode()) { + QString nStaionID = currentTab(); + IStation *pStation = m_pCtrl->IGetStationByKey(nStaionID); + if (pStation) { + QString strModel = pStation->currentSelectModel(); + if (!strModel.isEmpty()) { + m_pCtrl->ISelModel(currentTab(), strModel); + ui.mLblModelState->setText(tr("current %1 OK!").arg(strModel)); + m_pCtrl->ISetModifyModel(true); + + if (nStaionID == lpGlobalConfig::instance()->m_StationSolution_1) + { + lpGlobalConfig::instance()->m_StationRunModel_1 = strModel; + } + else if (nStaionID == lpGlobalConfig::instance()->m_StationSolution_2) + { + lpGlobalConfig::instance()->m_StationRunModel_2 = strModel; + } + lpGlobalConfig::instance()->writeConfig(); + } + } + } } else if ("wf_model_add_button" == strObj) { diff --git a/tpvs17/lpMain/lpGlobalConfig.cpp b/tpvs17/lpMain/lpGlobalConfig.cpp index 1eddd32..72858ca 100644 --- a/tpvs17/lpMain/lpGlobalConfig.cpp +++ b/tpvs17/lpMain/lpGlobalConfig.cpp @@ -1,8 +1,14 @@ #include "lpGlobalConfig.h" +#include +#include +#include +#include +#include lpGlobalConfig::lpGlobalConfig(QObject *parent) : QObject(parent) { + m_rootPath = QApplication::applicationDirPath(); } lpGlobalConfig::~lpGlobalConfig() @@ -11,10 +17,47 @@ lpGlobalConfig::~lpGlobalConfig() void lpGlobalConfig::readConfig() { - + QString strPath = m_rootPath + "/user/globalConfig.json"; + QFile file(strPath); + if (true == file.open(QIODevice::ReadOnly)) + { + QByteArray readData = file.readAll(); + QJsonObject rootObj = QJsonDocument::fromJson(readData).object(); + if (!rootObj.isEmpty()) + { + QString strCam1 = rootObj.value("station_camkey_1").toString(); + QString strCam2 = rootObj.value("station_camkey_2").toString(); + QString strSolution1 = rootObj.value("station_solution_1").toString(); + QString strSolution2 = rootObj.value("station_solution_2").toString(); + QString strRunModel1 = rootObj.value("station_runModel_1").toString(); + QString strRunModel2 = rootObj.value("station_runModel_2").toString(); + m_StationCamKey_1 = strCam1; + m_StationCamKey_2 = strCam2; + m_StationSolution_1 = strSolution1; + m_StationSolution_2 = strSolution2; + m_StationRunModel_1 = strRunModel1; + m_StationRunModel_2 = strRunModel2; + } + } + file.close(); } void lpGlobalConfig::writeConfig() { - + QString strPath = m_rootPath + "/user/globalConfig.json"; + QFile file(strPath); + if (true == file.open(QIODevice::WriteOnly)) + { + QJsonObject rootObj; + rootObj.insert("station_camkey_1", m_StationCamKey_1); + rootObj.insert("station_camkey_2", m_StationCamKey_2); + rootObj.insert("station_solution_1", m_StationSolution_1); + rootObj.insert("station_solution_2", m_StationSolution_2); + rootObj.insert("station_runModel_1", m_StationRunModel_1); + rootObj.insert("station_runModel_2", m_StationRunModel_2); + QJsonDocument doc(rootObj); + QByteArray writeData = doc.toJson(); + file.write(writeData); + } + file.close(); } diff --git a/tpvs17/lpMain/lpGlobalConfig.h b/tpvs17/lpMain/lpGlobalConfig.h index 704954f..894bdc3 100644 --- a/tpvs17/lpMain/lpGlobalConfig.h +++ b/tpvs17/lpMain/lpGlobalConfig.h @@ -16,8 +16,15 @@ public: void readConfig(); void writeConfig(); - QMap m_CamKeySolution; - QMap m_curRunModel; + QString m_StationCamKey_1;//λ + QString m_StationCamKey_2;//λ + QString m_StationSolution_1;//λsolution + QString m_StationSolution_2;//λsolution + + QString m_StationRunModel_1; + QString m_StationRunModel_2; + + QString m_rootPath; }; #endif