From 3acb2e7960631fba7933c221b6abc42aa6c690fa Mon Sep 17 00:00:00 2001 From: yangjiaxuan <171295266@qq.com> Date: Sat, 31 Dec 2022 12:43:02 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=83=AD=E6=8B=94?= =?UTF-8?q?=E6=8F=92=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/HGProductionTool/ProductionTool_zh_CN.qm | Bin 9330 -> 9455 bytes app/HGProductionTool/ProductionTool_zh_CN.ts | 166 ++++++++++--------- app/HGProductionTool/form_maininterface.cpp | 21 ++- app/HGProductionTool/form_maininterface.h | 2 + app/HGProductionTool/form_maininterface.ui | 7 + app/HGProductionTool/mainwindow.cpp | 37 +++-- 6 files changed, 143 insertions(+), 90 deletions(-) diff --git a/app/HGProductionTool/ProductionTool_zh_CN.qm b/app/HGProductionTool/ProductionTool_zh_CN.qm index 665de748b94533598e74e34bfa36c8a52cc950bd..a5af882226835f63212a0a045cfc8fbd9ff03b1e 100644 GIT binary patch delta 767 zcmX|8X-HII6g_X|&3p6S%rm!foY7ejmyAfIwB?6dWLXemTDWB5GL2F$G>&bEni-W# z$%kN(KQcjZu*|U^5hH|1DcT}ZnW9935JhG}){p9f(2tM9<(_-ax%XR5|90qBurvtp zGeB@}hb4KB@eCkl0M=pPXdfU%0y$Kv*5Oyh00z!`$+pY#=;>jd3xiE_I3Z z4j@gd-;Y!HV4Zr-BRs2`0W5n(E;ASiN)pq)HUj1;(OKI7;HlW( zGD`ez@p)nm5b#r+897MTSk$T>QQJ1DO}R;nnT|;nbG;NTRbowUiuy*nJ6{c`Z0qcZ z+Gy&NZGN3Jo+Zb7hRN=`oR^tMv5vDkwJo7reqj9#D7hQBX|p`!zeJ{-Jn z?Gl;A=mM6mP{>g>r8d>~e^k=~v%0a1D-@_gH{n^JkIvCe_{bq_NRNdZ6ktU!c*x13 z=%tw+LZ3c!oofFN`c^CT<-_`A1M!0{DM_Q`DYPkh`Df_>P>Q-E=|{qpQ!j`YIH0tC z<_Rm6zl~|6Q_BkYXq7?Bn)z*_c~?1Lk7D-%E#7y$Gss%7>KG`5mM#Q=o^ijUw!Fk) zFDr7{OUqsCMCcZ8a;Tr0eF;@$snk)MRZ~>sb}`Nz?#&3>$w%mmvkK8Nk}KvWv_<`w W3CyT=RN9G7S}Z@p;(cxF;r{`Y!N{}# delta 736 zcmX9*ZAep57=G?{ckk}KyEb)mo6}9fX;zd``okX?1N;18)-1Jbl-i7}NoGa;P*JO; zR&uiz#h-MbFqL`&&(`zlI31z=C6xzpEArOS>n`% zw)=oEuKqAe<|BjZPvssU`jMhhT~S$9ltz`wV%3ap*b2lLHSZ;&itX2Y5gk-#m4M1r z>E*Ue7E#y9dAvW!fQ$3^DI3!eSE2n%2J^WgZ;1LKp2;?lL>iwtTTK!V0Dn9Iqbi*C^#)=WeP#1wxo*{l`wvs3BC-;_GFz0x5*xBUj>yw$p9t=O%fCc8dy z>}4{b=@ZA}1d92U6h2)`b}vg=rR~H%FS#a&O`4Mqc?ru2((t7PQgcXS{wezYTxl#o zeQTx;Q`Z62f{yc(YD|kx2(^-neY)(Qgq`}2x&|8!h|p|Z zkX1f0Lj8yi`Kt3aj4C{&P zxnmAf_k^tJtSzj5AdfFtEbegQ=2YQREoBLgmeo~K99N{c&C$w1yS`^{+!OXcFkr-Z diff --git a/app/HGProductionTool/ProductionTool_zh_CN.ts b/app/HGProductionTool/ProductionTool_zh_CN.ts index e4f69be..c021f6d 100644 --- a/app/HGProductionTool/ProductionTool_zh_CN.ts +++ b/app/HGProductionTool/ProductionTool_zh_CN.ts @@ -124,12 +124,12 @@ - + OK 确定 - + Cancel 取消 @@ -286,32 +286,32 @@ - + account: 账户: - + password: 密码: - + dbHost: 数据库地址: - + dbPort: 数据库端口: - + ftpHost: FTP地址: - + ftpPort: FTP端口: @@ -324,12 +324,12 @@ 端口号: - + LOG IN 登录 - + EXIT 退出 @@ -349,17 +349,17 @@ 关闭 - + LogIn 登录 - + tips 提示 - + Login failed: 登录失败: @@ -500,133 +500,145 @@ - + + devStatus + + + + Privious Step 上一步 - + PASS 通过 - + FAIL 不通过 - + START 开始测试 - + LeftRotate 左旋转 - + RightRotate 右旋转 - + STOP 关闭 - + SHOWIMG 加载图片 - + Next Step 下一步 - + + 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 无图 @@ -692,7 +704,7 @@ 上传配置文件 - + Account login elsewhere 账户在其他地方登录 @@ -701,104 +713,108 @@ 网络连接断开 - + You have been forced offline by the administrator account 你已被管理员账户强制下线 - + Data base error 数据库错误 - - - - - - - - - - + + + + + + + + + + tips 提示 - - - + + + Is testing, do not close! 测试中,请勿关闭! - + Are you sure to connect the new device 检测到设备连接,是否启动测试? - + yes 确定 - + no 取消 - - + + cannot create more table 不能创建更多项目 - The device has disconnected - 设备已断开连接 + 设备已断开连接 - + + Open device failed + 打开设备失败 + + + save 保存 - + xls(*.xls) xls表格(*.xls) - + export succeed 导出成功 - + export failed 导出失败 - + Illegal user 非法的用户 - + Wrong password 密码错误 - + Database error 数据库错误 - + connect error 连接错误 - + Failed 错误 @@ -806,14 +822,14 @@ QObject - + success: success 成功: - - + + failed: 失败: diff --git a/app/HGProductionTool/form_maininterface.cpp b/app/HGProductionTool/form_maininterface.cpp index 1d9d519..01c25f0 100644 --- a/app/HGProductionTool/form_maininterface.cpp +++ b/app/HGProductionTool/form_maininterface.cpp @@ -65,6 +65,7 @@ Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, SANE_Handle ha , m_mainwnd(mainwnd) , m_hg(nullptr) , m_handle(handle) + , m_disconnect(false) , m_pdtToolDbuserMgr(pdtToolDbuserMgr) , m_pdtToolDbDevice(pdtToolDbDevice) , m_serialNum(serialNum) @@ -89,7 +90,8 @@ Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, SANE_Handle ha str = tr("Device has connected"); else str = tr("Device hasnot connected"); - ui->label_sn->setText(tr("Device type:") + m_devType + tr(" SerialNum:") + m_serialNum + tr(" connect status:") + str); + ui->label_sn->setText(tr("Device type:") + m_devType + tr(" SerialNum:") + m_serialNum); + ui->label_devStatus->setText(tr(" connect status:") + str); setMinimumWidth(500); ui->tableWidget->setMinimumWidth(400); @@ -150,6 +152,13 @@ hgscanner *Form_mainInterface::getScanner() return m_hg; } +void Form_mainInterface::setDevDisconnect() +{ + QString str = tr("Device has disconnected"); + ui->label_devStatus->setText(tr(" connect status:") + str); + m_disconnect = true; +} + void Form_mainInterface::paintEvent(QPaintEvent *event) { (void)event; @@ -166,6 +175,11 @@ void Form_mainInterface::on_testResult(QString text) updateUiEnabled(true); m_isTesting = false; m_mainwnd->releaseTesting(); + + if (m_disconnect) + { + m_mainwnd->RemoveInterface(this); + } } void Form_mainInterface::on_testResultImg(void *img) @@ -195,6 +209,11 @@ void Form_mainInterface::on_testDistortion(QString name, void *data) updateUiEnabled(true); m_isTesting = false; m_mainwnd->releaseTesting(); + + if (m_disconnect) + { + m_mainwnd->RemoveInterface(this); + } } } diff --git a/app/HGProductionTool/form_maininterface.h b/app/HGProductionTool/form_maininterface.h index 2d5e851..ffb4f08 100644 --- a/app/HGProductionTool/form_maininterface.h +++ b/app/HGProductionTool/form_maininterface.h @@ -29,6 +29,7 @@ public: QString getDevName(); SANE_Handle getDevHandle(); hgscanner *getScanner(); + void setDevDisconnect(); protected: void paintEvent(QPaintEvent *event) override; @@ -87,6 +88,7 @@ private: class MainWindow *m_mainwnd; hgscanner *m_hg; SANE_Handle m_handle; + bool m_disconnect; HGPdtToolDbUserMgr m_pdtToolDbuserMgr; HGPdtToolDbDevice m_pdtToolDbDevice; QString m_serialNum; diff --git a/app/HGProductionTool/form_maininterface.ui b/app/HGProductionTool/form_maininterface.ui index ece8e75..ee4b6c6 100644 --- a/app/HGProductionTool/form_maininterface.ui +++ b/app/HGProductionTool/form_maininterface.ui @@ -23,6 +23,13 @@ + + + + devStatus + + + diff --git a/app/HGProductionTool/mainwindow.cpp b/app/HGProductionTool/mainwindow.cpp index 8c814ba..2c12a31 100644 --- a/app/HGProductionTool/mainwindow.cpp +++ b/app/HGProductionTool/mainwindow.cpp @@ -374,24 +374,30 @@ void MainWindow::on_sane_dev_arrive(QString devName) { SANE_Handle devHandle = nullptr; sane_open(devName.toStdString().c_str(), &devHandle); - - Dialog_InputSerialNum dlg(this, getDevSn(devHandle), getDevType(devHandle)); - if (dlg.exec()) + if (nullptr != devHandle) { - HGPdtToolDbDevice pdtToolDbDevice = nullptr; - HGPdtToolDb_OpenDevice(m_pdtToolDbuserMgr, dlg.GetSn().toStdString().c_str(), &pdtToolDbDevice); - - Form_mainInterface *mainInterface = new Form_mainInterface(this, devHandle, m_pdtToolDbuserMgr, pdtToolDbDevice, - dlg.GetSn(), dlg.GetDevType(), devName, getDevFwNum(devHandle)); - if (!AddInterface(mainInterface)) + Dialog_InputSerialNum dlg(this, getDevSn(devHandle), getDevType(devHandle)); + if (dlg.exec()) { - QMessageBox::information(this, tr("tips"), tr("cannot create more table")); - delete mainInterface; + HGPdtToolDbDevice pdtToolDbDevice = nullptr; + HGPdtToolDb_OpenDevice(m_pdtToolDbuserMgr, dlg.GetSn().toStdString().c_str(), &pdtToolDbDevice); + + Form_mainInterface *mainInterface = new Form_mainInterface(this, devHandle, m_pdtToolDbuserMgr, pdtToolDbDevice, + dlg.GetSn(), dlg.GetDevType(), devName, getDevFwNum(devHandle)); + if (!AddInterface(mainInterface)) + { + QMessageBox::information(this, tr("tips"), tr("cannot create more table")); + delete mainInterface; + } + } + else + { + sane_close(devHandle); } } else { - sane_close(devHandle); + QMessageBox::information(this, tr("tips"), tr("Open device failed")); } } } @@ -401,8 +407,11 @@ void MainWindow::on_sane_dev_remove(QString devName) Form_mainInterface *interface = FindInterfaceByDevName(devName); if (interface != nullptr) { - QMessageBox::information(this, tr("tips"), tr("The device has disconnected")); - RemoveInterface(interface); + interface->setDevDisconnect(); + if (!interface->isTesting()) + { + RemoveInterface(interface); + } } } From a467f07dbd3742555b7c64e1fa049a1d4ec2fd8f Mon Sep 17 00:00:00 2001 From: yangjiaxuan <171295266@qq.com> Date: Sat, 31 Dec 2022 14:18:08 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/HGProductionTool/dialog_login.cpp | 11 +++++++++-- app/HGProductionTool/dialog_login.ui | 12 ++++++------ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/app/HGProductionTool/dialog_login.cpp b/app/HGProductionTool/dialog_login.cpp index 02c6496..00237fd 100644 --- a/app/HGProductionTool/dialog_login.cpp +++ b/app/HGProductionTool/dialog_login.cpp @@ -26,6 +26,13 @@ Dialog_logIn::Dialog_logIn(QWidget *parent) : ui->label_title->setText(tr("LogIn")); ui->lineEdit_password->setEchoMode(QLineEdit::EchoMode::Password); + QString ipStr = "\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b"; + QString portStr = "[0-9]+$"; + ui->lineEdit_dbHost->setValidator(new QRegExpValidator(QRegExp(ipStr))); + ui->lineEdit_ftpHost->setValidator(new QRegExpValidator(QRegExp(ipStr))); + ui->lineEdit_dbPort->setValidator(new QRegExpValidator(QRegExp(portStr))); + ui->lineEdit_ftpPort->setValidator(new QRegExpValidator(QRegExp(portStr))); + QString account("root"); QString dbHost("192.168.1.70"); QString dbPort("3306"); @@ -33,7 +40,6 @@ Dialog_logIn::Dialog_logIn(QWidget *parent) : QString ftpPort("21"); ui->lineEdit_account->setText(getCfgValue("login", "account", account)); - ui->lineEdit_dbHost->setText(getCfgValue("login", "dbHost", dbHost)); ui->lineEdit_dbPort->setText(getCfgValue("login", "dbPort", dbPort)); ui->lineEdit_ftpHost->setText(getCfgValue("login", "ftpHost", ftpHost)); @@ -161,7 +167,8 @@ QString Dialog_logIn::getCfgValue(const char *appName, const char *key, const QS HGBase_GetConfigPath(cfgPath, 512); strcat(cfgPath, "config.ini"); + std::string def2 = getStdString(def); HGChar value[512] = {0}; - HGBase_GetProfileString(cfgPath, appName, key, getStdString(def).c_str(), value, 512); + HGBase_GetProfileString(cfgPath, appName, key, def2.c_str(), value, 512); return StdStringToUtf8(value).c_str(); } diff --git a/app/HGProductionTool/dialog_login.ui b/app/HGProductionTool/dialog_login.ui index 58a65b6..e86a8ac 100644 --- a/app/HGProductionTool/dialog_login.ui +++ b/app/HGProductionTool/dialog_login.ui @@ -6,7 +6,7 @@ 0 0 - 455 + 473 278 @@ -146,7 +146,7 @@ QPushButton#pbtn_close::hover 40 40 - 381 + 411 141 @@ -220,7 +220,7 @@ QPushButton#pbtn_close::hover 150 20 - 151 + 171 20 @@ -243,7 +243,7 @@ QPushButton#pbtn_close::hover 150 50 - 151 + 171 20 @@ -266,7 +266,7 @@ QPushButton#pbtn_close::hover 150 80 - 151 + 171 20 @@ -289,7 +289,7 @@ QPushButton#pbtn_close::hover 150 110 - 151 + 171 20 From 76c1f6770620b280a8d597a3c7f5c57c86b9918c Mon Sep 17 00:00:00 2001 From: yangjiaxuan <171295266@qq.com> Date: Sat, 31 Dec 2022 14:38:59 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/HGProductionTool/form_maininterface.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/HGProductionTool/form_maininterface.cpp b/app/HGProductionTool/form_maininterface.cpp index 01c25f0..d0c271e 100644 --- a/app/HGProductionTool/form_maininterface.cpp +++ b/app/HGProductionTool/form_maininterface.cpp @@ -508,7 +508,7 @@ void Form_mainInterface::updateUiEnabled(bool enable) void Form_mainInterface::setGlobalCfg(AnalysisJson analysisJson) { AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal(); - LPWRITECFG p; + LPWRITECFG p = new WRITECFG; p->cat = WRITE_CAT_VID; p->val = &jsonGlobal.vid_to; @@ -529,6 +529,8 @@ void Form_mainInterface::setGlobalCfg(AnalysisJson analysisJson) p->cat = WRITE_CAT_SERIALNUM; p->val = &m_serialNum; func_test_go((const wchar_t*)WRITE_CFG_NAME, (const wchar_t*)p, m_hg); + + delete p; } void Form_mainInterface::on_tableWidget_currentItemChanged(QTableWidgetItem *current, QTableWidgetItem *previous) From b231a3c7520e2823d105f6680b28da69430e3b04 Mon Sep 17 00:00:00 2001 From: yangjiaxuan <171295266@qq.com> Date: Sat, 31 Dec 2022 15:14:34 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E8=B0=83=E6=95=B4json=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cfg-tools/solution/Release/config/stored.txt | Bin 5800 -> 6002 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/cfg-tools/solution/Release/config/stored.txt b/cfg-tools/solution/Release/config/stored.txt index 63451f266d01251d938e058840c8679396c45c66..88128cbb886fb80603cbb531e6b2106df382aa59 100644 GIT binary patch delta 385 zcmZ3X`$=!Z9O2E6goPNn6&Ms4LW33Jy>qWl-Y6(P`GF|McKG2&lR{Grp)v8!DT^P{5Em`Jkx0ByQQ4qVhvw4QF7^7f3 zgCST+Xs|-Ockb10!^wuC@?3Bp!{jaz6`&#`6h%fTii}{2j8POBqbM?FnEXIQP5|VZ b?%>%$AghcR^7=t8nj9d?!2;&+h^GMnR3JCy From b41abffba4c4edecaae347a0b35b081f6bdbc452 Mon Sep 17 00:00:00 2001 From: yangjiaxuan <171295266@qq.com> Date: Sat, 31 Dec 2022 16:36:16 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E8=B0=83=E6=95=B4json?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cfg-tools/solution/Release/config/stored.txt | Bin 6002 -> 6002 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/cfg-tools/solution/Release/config/stored.txt b/cfg-tools/solution/Release/config/stored.txt index 88128cbb886fb80603cbb531e6b2106df382aa59..4bcedb90cd325b1e1c729e624a8f6bedf099d684 100644 GIT binary patch delta 50 wcmeyQ_epPqiYRkDgVE%TqUMw1L<1P(C$AUnhKd+Y&J&9Oix>l0Y?H)`0JupIl>h($ delta 54 zcmeyQ_epPqiseWYcm*4-Y9A~IZrHN@;@<