From a1fac9e2a7540f19f11f8a5d6023c5b91bc310d1 Mon Sep 17 00:00:00 2001 From: yangjiaxuan <171295266@qq.com> Date: Wed, 4 Jan 2023 20:48:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=BA=E5=88=86=E5=B7=A5=E4=BD=8D=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/HGProductionTool/ProductionTool_zh_CN.qm | Bin 10833 -> 10837 bytes app/HGProductionTool/ProductionTool_zh_CN.ts | 75 ++++++------- app/HGProductionTool/analysisjson.cpp | 3 +- app/HGProductionTool/analysisjson.h | 1 + .../dialog_inputserialnum.cpp | 26 ++++- app/HGProductionTool/dialog_inputserialnum.h | 3 +- app/HGProductionTool/form_burnmode.cpp | 64 ++++++++++- app/HGProductionTool/form_burnmode.h | 24 +++- app/HGProductionTool/form_maininterface.cpp | 104 +++++++----------- app/HGProductionTool/form_maininterface.h | 15 +-- app/HGProductionTool/mainwindow.cpp | 10 +- app/HGProductionTool/mainwindow.h | 2 +- 12 files changed, 188 insertions(+), 139 deletions(-) diff --git a/app/HGProductionTool/ProductionTool_zh_CN.qm b/app/HGProductionTool/ProductionTool_zh_CN.qm index 8148e2ede5923398c0b0f00d1bb72c0574880058..afaea02384889709378e2ffd017ff4401f86b9f2 100644 GIT binary patch delta 718 zcmX9+Yey|B8*yUl=bloATsE5v_pg zmVDet!b5!Wi3&Sl9%FlCE^Z5ZBQsm7_@3u7Qj^8|5|aT-IzOVOjZw4wv?`YRAxtYb zR<{b#BpvmFy>pT3Z^5aYC7nlwha)!tLyz#Xobt1*ikwvs7#GFN`C4LZ z5bft{0K5=88ocDTKpadt2k0env~Mp(+9rNlx(;Zfm9i&vEv8y>{RFVox@ zD3wjL)1noL)j26tmvnp5K^J?NM{eed*=M;?daTN~rVzQFEmN<6g)5Ave$`O#W_r6z zs`rr++4-gpn!7?#)Us@a*}7ld@l{UpTh!k17$CSxJ#cY>=n~XJom2GsX7!NgDaGkf z&-A8|ylD-l>H*n;M(F&{G^~+E?^0NmnuJG$H_R}P!kDyEyTdz2Xqz^_fc{QIpY~WA zO~o1Q$=8H7mTDWnE6DtA?P_f%p_3WUn}htiC?7=-7_Tc{p$JT`SPCC!=+F%Z=hBW} sx{<@}gsChc)3Yosxeo#1J8(Dxi10bv%+e50?*S}v&Sz)dn}Q@8{mx6+lcHHy`W;l(pRas-4b$#>>p6TzPTyEkM;N zpBN$G>%H>HN(W#bV;Qn`E{VOBnPY4C=Yuj*vxgtqx&w$!=Y4A07#H9Jss!rmnO1JB zzagahkI}SLaFj2Sj%LB(TB5orR4HdkXMym@cO5YF2`|ejzt~?QXVU}5pqRDLNQ{?7 z$GHXoLt;;hhur3g!`8EaUJ}P&?4w9K#ZSMl0h)NF>!`oa8gLXTk!6*QmWUL841kkGiJl_08&0_fv|qOg%G@ zN%8_3OkD+JL5<-0&or!&#_v*C)tW7j32&HUZiO+$s@>_CBeY$cf8-3A7}OSZ(Nvt# zo_I}YqeI*JO+n_取消 - - + + tips 提示 - + Serial num is empty 序列号为空 - + The device is testing 该设备正在进行测试 @@ -563,7 +563,7 @@ Burn - 全部烧录 + 进入烧录模式 @@ -571,38 +571,39 @@ 设置勾选项序列号 - + ID 序号 - + selected 选择 - + device 设备 - + serialNum 序列号 - - + + + tips 提示 - + Please check single devices to set sn 请只勾选一台设备再进行设置序列号 - + Please check a devices to set sn at least 请至少勾选一台设备再设置序列号 @@ -670,94 +671,94 @@ 下一步 - + Device has connected 设备已连接 - + Device hasnot connected 设备未连接 - + Device type: 设备型号: - + SerialNum: 序列号: - - + + connect status: 设备连接状态: - + load last image which uploaded last time 加载上一次上传的图片 - + Device has disconnected 设备已断开 - - + + tips 提示 - + yes 确定 - + no 取消 - + ID 序号 - + Test items 测试项 - + status 测试状态 - + not test 未测试 - + not pass 不通过 - + not support 不支持 - + pass 通过 - + no image 无图 @@ -941,19 +942,19 @@ QObject - + success: success 成功: - - + + failed: 失败: - + Not find test item 没有找到该测试项 diff --git a/app/HGProductionTool/analysisjson.cpp b/app/HGProductionTool/analysisjson.cpp index 218f1fa..83a6c66 100644 --- a/app/HGProductionTool/analysisjson.cpp +++ b/app/HGProductionTool/analysisjson.cpp @@ -37,7 +37,8 @@ std::vector AnalysisJson::GetNode() obj[key].toObject()["name"].toString(), obj[key].toObject()["man"].toBool(), obj[key].toObject()["err-level"].toInt(), - obj[key].toObject()["desc"].toString()}); + obj[key].toObject()["desc"].toString(), + obj[key].toObject()["station"].toString()}); } return nodes; } diff --git a/app/HGProductionTool/analysisjson.h b/app/HGProductionTool/analysisjson.h index 2ef3608..93977ec 100644 --- a/app/HGProductionTool/analysisjson.h +++ b/app/HGProductionTool/analysisjson.h @@ -13,6 +13,7 @@ public: bool is_man; std::int32_t err_level; QString desc; + QString station; }; struct json_global{ diff --git a/app/HGProductionTool/dialog_inputserialnum.cpp b/app/HGProductionTool/dialog_inputserialnum.cpp index b158d37..166357b 100644 --- a/app/HGProductionTool/dialog_inputserialnum.cpp +++ b/app/HGProductionTool/dialog_inputserialnum.cpp @@ -2,7 +2,7 @@ #include "ui_dialog_inputserialnum.h" #include "mainwindow.h" -Dialog_InputSerialNum::Dialog_InputSerialNum(class MainWindow *mainWnd, const QString &serialNum, const QString &devType) : +Dialog_InputSerialNum::Dialog_InputSerialNum(class MainWindow *mainWnd, SANE_Handle handle, const QString &serialNum, const QString &devType) : QDialog(mainWnd), ui(new Ui::Dialog_InputSerialNum), m_mainWnd(mainWnd), @@ -18,14 +18,18 @@ Dialog_InputSerialNum::Dialog_InputSerialNum(class MainWindow *mainWnd, const QS this->setFont(ft); ui->lineEdit_sn->setValidator(new QRegExpValidator(QRegExp("[a-zA-Z0-9]+$"))); - ui->lineEdit_sn->setText(m_serialNum); - if (m_devType.isEmpty() || m_serialNum.isEmpty()) - ui->cbox_devType->setCurrentIndex(0); - else + + if (handle != nullptr) { - ui->cbox_devType->setCurrentText(devType); ui->lineEdit_sn->setEnabled(false); ui->cbox_devType->setEnabled(false); + ui->cbox_devType->setCurrentText(devType); + ui->lineEdit_sn->setText(serialNum); + } + else + { + ui->cbox_devType->setCurrentIndex(0); + ui->lineEdit_sn->setText(""); } } @@ -52,6 +56,16 @@ void Dialog_InputSerialNum::on_pbtn_ok_clicked() return; } +// QString str = ui->lineEdit_sn->text(); +// for (int i = 0; i < str.size(); ++i) +// { +// if ((str.at(i) < '0' || str.at(i) > '9') || (str.at(i) < 'A' || str.at(i) > 'Z')) +// { +// QMessageBox::information(this, tr("tips"), tr("sn is illegal")); +// return; +// } +// } + if (m_mainWnd->FindInterface(ui->lineEdit_sn->text()) != nullptr) { QMessageBox::information(this, tr("tips"), tr("The device is testing")); diff --git a/app/HGProductionTool/dialog_inputserialnum.h b/app/HGProductionTool/dialog_inputserialnum.h index bc8f5a7..23e9ff7 100644 --- a/app/HGProductionTool/dialog_inputserialnum.h +++ b/app/HGProductionTool/dialog_inputserialnum.h @@ -2,6 +2,7 @@ #define DIALOG_INPUTSERIALNUM_H #include +#include "sane/sane_ex.h" namespace Ui { class Dialog_InputSerialNum; @@ -12,7 +13,7 @@ class Dialog_InputSerialNum : public QDialog Q_OBJECT public: - explicit Dialog_InputSerialNum(class MainWindow *mainWnd, const QString &serialNum, const QString &devType); + explicit Dialog_InputSerialNum(class MainWindow *mainWnd, SANE_Handle handle, const QString &serialNum, const QString &devType); ~Dialog_InputSerialNum(); QString GetSn(); diff --git a/app/HGProductionTool/form_burnmode.cpp b/app/HGProductionTool/form_burnmode.cpp index d823a1a..d814c22 100644 --- a/app/HGProductionTool/form_burnmode.cpp +++ b/app/HGProductionTool/form_burnmode.cpp @@ -3,6 +3,8 @@ #include "dialog_setburnsn.h" #include "hgscanner.h" #include "mainwindow.h" +#include "analysisjson.h" +#include "base/HGBase.h" #include #include #include @@ -132,8 +134,6 @@ void Form_BurnMode::on_cbox_selectAll_stateChanged(int arg1) void Form_BurnMode::on_pbtn_burn_clicked() { - ui->cbox_selectAll->setChecked(true); - for(int i = 0; i < ui->tableWidget->columnCount(); i++) { QTableWidgetItem *item = ui->tableWidget->item(i, 1); @@ -180,6 +180,8 @@ void Form_BurnMode::on_pbtn_setSn_clicked() { DeviceManager *devManager = (DeviceManager*)item->data(Qt::UserRole).value(); devManager->setSn(dlg.getSn()); + + item2->setText(devManager->getUpdatedSn()); break; } } @@ -187,13 +189,16 @@ void Form_BurnMode::on_pbtn_setSn_clicked() } } -DeviceManager::DeviceManager(class MainWindow *mainwnd, class Form_BurnMode *burnMode, SANE_Handle handle, const QString & devName, const QString & sn) +DeviceManager::DeviceManager(class MainWindow *mainwnd, HGPdtToolDbUserMgr pdtToolDbuserMgr, class Form_BurnMode *burnMode, + SANE_Handle handle, const QString & devName, const QString & sn, const QString &devType) { + m_mainwnd = mainwnd; + m_pdtToolDbuserMgr = pdtToolDbuserMgr; + m_burnMode = burnMode; m_handle = handle; m_devName = devName; m_sn = sn; - m_mainwnd = mainwnd; - m_burnMode = burnMode; + m_devType = devType; m_hg = new hgscanner(nullptr, m_burnMode, m_handle); } @@ -233,9 +238,56 @@ void DeviceManager::setSn(QString sn) func_test_go(WRITE_CFG_NAME, (const wchar_t*)p, m_hg); m_mainwnd->addTestingRef(); + setGlobalCfg(); + delete p; } +QString DeviceManager::getUpdatedSn() +{ + return m_mainwnd->getDevSn(m_handle); +} + +void DeviceManager::setGlobalCfg() +{ + HGChar cfgPath[512] = {0}; + HGBase_GetConfigPath(cfgPath, 512); + HGBase_CreateDir(cfgPath); + strcat(cfgPath, m_devType.toStdString().c_str()); + strcat(cfgPath, ".json"); + + HGPdtToolDb_DownloadFile(m_pdtToolDbuserMgr, m_devType.toStdString().c_str(), cfgPath); + + AnalysisJson analysisJson(QString::fromStdString(cfgPath)); + + assert(nullptr != m_hg); + AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal(); + LPWRITECFG lp = new WRITECFG; + + VIDPID vidpid; + vidpid.VID = jsonGlobal.vid_to; + vidpid.PID = jsonGlobal.pid_to; + int vidpidValue = vidpid.Value; + lp->cat = WRITE_CAT_VID_PID; + lp->val = (void*)&vidpidValue; + func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp, m_hg); + m_mainwnd->addTestingRef(); + + int speedMode = jsonGlobal.speed_mode ; + lp->cat = WRITE_CAT_SPEED; + lp->val = (void*)&speedMode; + func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp, m_hg); + m_mainwnd->addTestingRef(); + + int sleepTime = jsonGlobal.sleep_time; + lp->cat = WRITE_CAT_SLEEP; + lp->val = (void*)&sleepTime; + func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp, m_hg); + m_mainwnd->addTestingRef(); + + delete lp; +} + void Form_BurnMode::on_tableWidget_itemDoubleClicked(QTableWidgetItem *item) { int row = item->row(); @@ -249,3 +301,5 @@ void Form_BurnMode::on_tableWidget_itemDoubleClicked(QTableWidgetItem *item) item2->setCheckState(Qt::Checked); } } + + diff --git a/app/HGProductionTool/form_burnmode.h b/app/HGProductionTool/form_burnmode.h index b2fd1d8..aef4d53 100644 --- a/app/HGProductionTool/form_burnmode.h +++ b/app/HGProductionTool/form_burnmode.h @@ -5,6 +5,7 @@ #include #include "sane/sane_ex.h" #include "hgscanner.h" +#include "HGPdtToolDb.h" namespace Ui { class Form_BurnMode; @@ -13,21 +14,36 @@ class Form_BurnMode; class DeviceManager { public: - DeviceManager(class MainWindow *mainwnd, class Form_BurnMode *burnMode, SANE_Handle handle, const QString &devName, const QString &sn); + DeviceManager(class MainWindow *mainwnd, HGPdtToolDbUserMgr pdtToolDbuserMgr, class Form_BurnMode *burnMode, + SANE_Handle handle, const QString &devName, const QString &sn, const QString &devType); ~DeviceManager(); QString getDevName(); QString getSn(); void setBurnMode(); void setSn(QString sn); + QString getUpdatedSn(); SANE_Handle m_handle; + void setGlobalCfg(); private: + union VIDPID + { + struct + { + unsigned short VID; + unsigned short PID; + }; + unsigned int Value; + }; + +private: + class MainWindow *m_mainwnd; + HGPdtToolDbUserMgr m_pdtToolDbuserMgr; + class Form_BurnMode *m_burnMode; QString m_devName; QString m_sn; - - class MainWindow *m_mainwnd; - class Form_BurnMode *m_burnMode; + QString m_devType; hgscanner *m_hg; }; diff --git a/app/HGProductionTool/form_maininterface.cpp b/app/HGProductionTool/form_maininterface.cpp index d185323..d3e2375 100644 --- a/app/HGProductionTool/form_maininterface.cpp +++ b/app/HGProductionTool/form_maininterface.cpp @@ -14,11 +14,12 @@ #include "dialog_excepdesc.h" #include "huagao/hgscanner_error.h" -Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, SANE_Handle handle, HGPdtToolDbUserMgr pdtToolDbuserMgr, HGPdtToolDbDevice pdtToolDbDevice, +Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn::LogInType logInType, SANE_Handle handle, HGPdtToolDbUserMgr pdtToolDbuserMgr, HGPdtToolDbDevice pdtToolDbDevice, const QString &serialNum, const QString &devType, const QString &devName, const QString &devFwNum) : QWidget(mainwnd) , ui(new Ui::Form_mainInterface) , m_mainwnd(mainwnd) + , m_logInType(logInType) , m_hg(nullptr) , m_handle(handle) , m_disconnect(false) @@ -304,48 +305,53 @@ void Form_mainInterface::initTableWidgetUi() AnalysisJson analysisJson(QString::fromStdString(cfgPath)); - setGlobalCfg(analysisJson); + const QString stationStr[] = {"烧录工位", "初检工位", "图像测试工位", "压力测试工位"}; std::vector list_jsonNode = analysisJson.GetNode(); int count = list_jsonNode.size(); ui->tableWidget->setRowCount(count); + int index = 0; for(int i = 0; i < count; ++i) { AnalysisJson::json_node node = list_jsonNode[i]; m_map_title_name.insert(node.title, node); - HGPdtToolDb_SetEntryNameCnStr(m_pdtToolDbuserMgr, node.name.toStdString().c_str(), node.title.toStdString().c_str()); - - ui->tableWidget->setItem(i, 0, new QTableWidgetItem(QString::number(i+1))); - ui->tableWidget->item(i, 0)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); - ui->tableWidget->setItem(i, 1, new QTableWidgetItem(node.title)); - ui->tableWidget->item(i, 1)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); - - std::string name = node.name.toStdString(); - HGUInt status = 0; - HGPdtToolDb_GetDeviceEntryStatus(m_pdtToolDbDevice, name.c_str(), &status); - QString statusStr = getItemStatusStr(status); - ui->tableWidget->setItem(i, 2, new QTableWidgetItem(statusStr)); - ui->tableWidget->item(i, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); - if (HGPDTTOOLDB_ENTRYSTATUS_NOTPASS == status) + if (stationStr[m_logInType] == node.station) { - ui->tableWidget->item(i, 2)->setBackgroundColor(QColor(255,0,0)); - } - else if (HGPDTTOOLDB_ENTRYSTATUS_NOTSUPP == status) - { - ui->tableWidget->item(i, 2)->setBackgroundColor(QColor(255,255,0)); - } - else if (HGPDTTOOLDB_ENTRYSTATUS_PASS == status) - { - ui->tableWidget->item(i, 2)->setBackgroundColor(QColor(0,255,0)); - } + HGPdtToolDb_SetEntryNameCnStr(m_pdtToolDbuserMgr, node.name.toStdString().c_str(), node.title.toStdString().c_str()); - HGChar desc[512] = {0}; - HGPdtToolDb_GetDeviceEntryExcepDesc(m_pdtToolDbDevice, name.c_str(), desc, 512); - QTableWidgetItem *item = ui->tableWidget->item(i, 2); - item->setToolTip(desc); + ui->tableWidget->setItem(index, 0, new QTableWidgetItem(QString::number(index+1))); + ui->tableWidget->item(index, 0)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); + ui->tableWidget->setItem(index, 1, new QTableWidgetItem(node.title)); + ui->tableWidget->item(index, 1)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); + + std::string name = node.name.toStdString(); + HGUInt status = 0; + HGPdtToolDb_GetDeviceEntryStatus(m_pdtToolDbDevice, name.c_str(), &status); + QString statusStr = getItemStatusStr(status); + ui->tableWidget->setItem(index, 2, new QTableWidgetItem(statusStr)); + ui->tableWidget->item(index, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); + if (HGPDTTOOLDB_ENTRYSTATUS_NOTPASS == status) + { + ui->tableWidget->item(index, 2)->setBackgroundColor(QColor(255,0,0)); + } + else if (HGPDTTOOLDB_ENTRYSTATUS_NOTSUPP == status) + { + ui->tableWidget->item(index, 2)->setBackgroundColor(QColor(255,255,0)); + } + else if (HGPDTTOOLDB_ENTRYSTATUS_PASS == status) + { + ui->tableWidget->item(index, 2)->setBackgroundColor(QColor(0,255,0)); + } + + HGChar desc[512] = {0}; + HGPdtToolDb_GetDeviceEntryExcepDesc(m_pdtToolDbDevice, name.c_str(), desc, 512); + QTableWidgetItem *item = ui->tableWidget->item(index, 2); + item->setToolTip(desc); + + ++index; + } } - ui->tableWidget->selectRow(0); } @@ -390,42 +396,6 @@ void Form_mainInterface::updateUiEnabled(bool enable) ui->pbtn_stop->setEnabled(enable); } -void Form_mainInterface::setGlobalCfg(AnalysisJson analysisJson) -{ - assert(nullptr != m_hg); - AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal(); - LPWRITECFG p = new WRITECFG; - - VIDPID vidpid; - vidpid.VID = jsonGlobal.vid_to; - vidpid.PID = jsonGlobal.pid_to; - int vidpidValue = vidpid.Value; - p->cat = WRITE_CAT_VID_PID; - p->val = (void*)&vidpidValue; - func_test_go(WRITE_CFG_NAME, (const wchar_t*)p, m_hg); - m_mainwnd->addTestingRef(); - - int speedMode = jsonGlobal.speed_mode ; - p->cat = WRITE_CAT_SPEED; - p->val = (void*)&speedMode; - func_test_go(WRITE_CFG_NAME, (const wchar_t*)p, m_hg); - m_mainwnd->addTestingRef(); - - int sleepTime = jsonGlobal.sleep_time; - p->cat = WRITE_CAT_SLEEP; - p->val = (void*)&sleepTime; - func_test_go(WRITE_CFG_NAME, (const wchar_t*)p, m_hg); - m_mainwnd->addTestingRef(); - - const wchar_t* sn = m_serialNum.toStdWString().c_str(); - p->cat = WRITE_CAT_SERIALNUM; - p->val = (void*)sn; - func_test_go(WRITE_CFG_NAME, (const wchar_t*)p, m_hg); - m_mainwnd->addTestingRef(); - - delete p; -} - void Form_mainInterface::on_tableWidget_currentItemChanged(QTableWidgetItem *current, QTableWidgetItem *previous) { (void)previous; diff --git a/app/HGProductionTool/form_maininterface.h b/app/HGProductionTool/form_maininterface.h index 25152a2..bd00a87 100644 --- a/app/HGProductionTool/form_maininterface.h +++ b/app/HGProductionTool/form_maininterface.h @@ -10,6 +10,7 @@ #include "sane/sane_ex.h" #include "HGPdtToolDb.h" #include "hgscanner.h" +#include "dialog_login.h" namespace Ui { class Form_mainInterface; @@ -20,7 +21,7 @@ class Form_mainInterface : public QWidget Q_OBJECT public: - explicit Form_mainInterface(class MainWindow *mainwnd, SANE_Handle handle, HGPdtToolDbUserMgr pdtToolDbuserMgr, HGPdtToolDbDevice pdtToolDbDevice, + explicit Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn::LogInType logInType, SANE_Handle handle, HGPdtToolDbUserMgr pdtToolDbuserMgr, HGPdtToolDbDevice pdtToolDbDevice, const QString &serialNum, const QString &devType, const QString &devName, const QString &devFwNum); ~Form_mainInterface(); @@ -67,22 +68,11 @@ private slots: void on_pbtn_rightRotate_clicked(); -private: - union VIDPID - { - struct - { - unsigned short VID; - unsigned short PID; - }; - unsigned int Value; - }; void initTableWidgetUi(); QString getItemStatusStr(HGUInt status); QString getCachePath(); QString getCacheFileName(); void updateUiEnabled(bool enable); - void setGlobalCfg(AnalysisJson analysisJson); private: Ui::Form_mainInterface *ui; @@ -92,6 +82,7 @@ private: HGImgView *m_view; class MainWindow *m_mainwnd; + Dialog_logIn::LogInType m_logInType; hgscanner *m_hg; SANE_Handle m_handle; bool m_disconnect; diff --git a/app/HGProductionTool/mainwindow.cpp b/app/HGProductionTool/mainwindow.cpp index 710a6d2..fce1e9a 100644 --- a/app/HGProductionTool/mainwindow.cpp +++ b/app/HGProductionTool/mainwindow.cpp @@ -399,7 +399,7 @@ void MainWindow::on_sane_dev_arrive(QString devName) sane_open(devName.toStdString().c_str(), &devHandle); if (nullptr != devHandle) { - DeviceManager *devManager = new DeviceManager(this, m_formBurnMode, devHandle, devName, getDevSn(devHandle)); + DeviceManager *devManager = new DeviceManager(this, m_pdtToolDbuserMgr, m_formBurnMode, devHandle, devName, getDevSn(devHandle), getDevType(devHandle)); m_formBurnMode->addDevice(devManager); } } @@ -417,13 +417,13 @@ void MainWindow::on_sane_dev_arrive(QString devName) sane_open(devName.toStdString().c_str(), &devHandle); if (nullptr != devHandle) { - Dialog_InputSerialNum dlg(this, getDevSn(devHandle), getDevType(devHandle)); + Dialog_InputSerialNum dlg(this, devHandle, getDevSn(devHandle), getDevType(devHandle)); if (dlg.exec()) { HGPdtToolDbDevice pdtToolDbDevice = nullptr; HGPdtToolDb_OpenDevice(m_pdtToolDbuserMgr, dlg.GetSn().toStdString().c_str(), &pdtToolDbDevice); - Form_mainInterface *mainInterface = new Form_mainInterface(this, devHandle, m_pdtToolDbuserMgr, pdtToolDbDevice, + Form_mainInterface *mainInterface = new Form_mainInterface(this, m_loginType, devHandle, m_pdtToolDbuserMgr, pdtToolDbDevice, dlg.GetSn(), dlg.GetDevType(), devName, getDevFwNum(devHandle)); if (!AddInterface(mainInterface)) { @@ -498,13 +498,13 @@ void MainWindow::on_update_userStatus() void MainWindow::on_act_newDevice_triggered() { - Dialog_InputSerialNum dlg(this, "", ""); + Dialog_InputSerialNum dlg(this, nullptr, "", ""); if (dlg.exec()) { HGPdtToolDbDevice pdtToolDbDevice = nullptr; HGPdtToolDb_OpenDevice(m_pdtToolDbuserMgr, dlg.GetSn().toStdString().c_str(), &pdtToolDbDevice); - Form_mainInterface *mainInterface = new Form_mainInterface(this, nullptr, m_pdtToolDbuserMgr, pdtToolDbDevice, dlg.GetSn(), dlg.GetDevType(), nullptr, nullptr); + Form_mainInterface *mainInterface = new Form_mainInterface(this, m_loginType, nullptr, m_pdtToolDbuserMgr, pdtToolDbDevice, dlg.GetSn(), dlg.GetDevType(), nullptr, nullptr); if (!AddInterface(mainInterface)) { QMessageBox::information(this, tr("tips"), tr("cannot create more table")); diff --git a/app/HGProductionTool/mainwindow.h b/app/HGProductionTool/mainwindow.h index 0226156..c20349f 100644 --- a/app/HGProductionTool/mainwindow.h +++ b/app/HGProductionTool/mainwindow.h @@ -35,6 +35,7 @@ public: void addTestingRef(); void releaseTesting(); bool isTesting(); + QString getDevSn(SANE_Handle handle); protected: void closeEvent(QCloseEvent *event); @@ -42,7 +43,6 @@ private: static int sane_ex_callback(SANE_Handle hdev, int code, void* data, unsigned int* len, void* param); std::vector getDevices(); - QString getDevSn(SANE_Handle handle); QString getDevType(SANE_Handle handle); QString getDevFwNum(SANE_Handle handle);