From 29da442fcf16280f1798230b25cdf099241e31fd Mon Sep 17 00:00:00 2001 From: yangjiaxuan <171295266@qq.com> Date: Tue, 10 Jan 2023 11:56:10 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=AE=BE=E5=A4=87=E5=88=B0?= =?UTF-8?q?=E8=BE=BE=E5=BB=B6=E6=97=B6=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/HGProductionTool/HGProductionTool.pro | 3 + app/HGProductionTool/ProductionTool_zh_CN.qm | Bin 12328 -> 12412 bytes app/HGProductionTool/ProductionTool_zh_CN.ts | 100 +++++++++------ app/HGProductionTool/dialog_hgmessagebox.cpp | 34 +++++ app/HGProductionTool/dialog_hgmessagebox.h | 27 ++++ app/HGProductionTool/dialog_hgmessagebox.ui | 127 +++++++++++++++++++ app/HGProductionTool/mainwindow.cpp | 86 +++++++------ 7 files changed, 298 insertions(+), 79 deletions(-) create mode 100644 app/HGProductionTool/dialog_hgmessagebox.cpp create mode 100644 app/HGProductionTool/dialog_hgmessagebox.h create mode 100644 app/HGProductionTool/dialog_hgmessagebox.ui diff --git a/app/HGProductionTool/HGProductionTool.pro b/app/HGProductionTool/HGProductionTool.pro index 9355e0b..a03b84c 100644 --- a/app/HGProductionTool/HGProductionTool.pro +++ b/app/HGProductionTool/HGProductionTool.pro @@ -62,6 +62,7 @@ SOURCES += \ dialog_accountmanage.cpp \ dialog_changepwd.cpp \ dialog_excepdesc.cpp \ + dialog_hgmessagebox.cpp \ dialog_inputserialnum.cpp \ dialog_login.cpp \ dialog_rootfuntion.cpp \ @@ -84,6 +85,7 @@ HEADERS += \ dialog_accountmanage.h \ dialog_changepwd.h \ dialog_excepdesc.h \ + dialog_hgmessagebox.h \ dialog_inputserialnum.h \ dialog_login.h \ dialog_rootfuntion.h \ @@ -101,6 +103,7 @@ FORMS += \ dialog_accountmanage.ui \ dialog_changepwd.ui \ dialog_excepdesc.ui \ + dialog_hgmessagebox.ui \ dialog_inputserialnum.ui \ dialog_login.ui \ dialog_rootfuntion.ui \ diff --git a/app/HGProductionTool/ProductionTool_zh_CN.qm b/app/HGProductionTool/ProductionTool_zh_CN.qm index 7c33111a521916fdeb1ce3ec4e09a2b568aadcfa..595235ac9d7722c189fad5c4afe03e87c95ef641 100644 GIT binary patch delta 1748 zcmZvddr;I>6vxkR_xIS}V_9Gq5nWM;)gTcyKua9W5lv?Zu{BLh9~HsF z`ZC=~M|1kN+%4aJF2Z^u^RxP2ClHB5#J3Uk6&S7QL_!>qG!`6#!)!)wKBMj~qZq^} zPHlwK=j5g9G-xo5sv#AgRMk27Z8Qj6JP!= zk?|2@=yKvKhZE^WFrCX*?43kTf5OM&yxHcA6+UiKM+%M13Misx3gZZ!?NV z7!9Ks)s>9KR>q(QjD2Rg*&<9~j5x;_J&$Cuh)6S#Ev1mCUkcf3{4A!aiQAE|jWKi| zO`DWVWNM~Y)4Rb0nzdmm63w8w57E9sIaG9d9+bVsEnC<{6f%fg(Wf4Xw{qXvd7>zH z9@lxVmPmQbb#~i{YysS@Tu5%n(VZGrf(zBUpI(`UeWkABS}@Tw>vg`;VMIf``g!3y z(2_9yhC|;I4XoDx+>BQCKdHZ5;6z}({5}&Y#QSdTK!HjY|qxKqOKq_N! zXD{7k8Nr{`9Y$s8{Kc_Di1eQd^8QLld`U2GYlozYka}}2(X+8axuXK-xx$fSIw(*p zG!Ko3Vs8oORY*A`MYy8az;!}b@+$ZZWE7Lc=xj)Dz9)_xyA1wk#pk_H!nRXPIGT_8 zh0&tZ^#HwU5}nl#Fk^=AX%Q+o@9q!_a!dPf?2pNy)ge< z+>4aP&v^&?Iw|?~S`<fP{(= zs{H~U2ppl#bouvA^+Vr__!a!C?(%9-ut=@Cs)wTY)zgLdkYK6WQjONipQ!GZdR&aE zP_NaEL&g~zwU?lGe`;d2KhrKvZu=b4-_V|`i9#T+mi7qtkbEs8%m2VhZA&=(ja#)H zO-s?5IIS}T@%oR{y0THZ^)Ic<6@!Oe#>7SxBDWc5r!RrRe;BhqMm#0kZOlE30AcaQ zq94{k@{PtVzw_wPabwTgWIS9E;OKo|CZl;xK4^Rn_?&Wx8Qr#K1lgmCga1Q$u4c}!GS6voe+dCRw8o9v z3Z}%Owy0nM>w>A;N?XL0+PVanR@A5jqzToaHlRfNjW_X+$?x4W_ug~9@0{G;`TOR( z#vEJZ*YvP_+aJLJzs~=z{?{k}^?fPz6b4r-{PPkW^JoWSdRW!DVpk2&3?j zQOaXf4l(LHqgNE8?JF1i@SDUKEHZ|7k}R$!QYTW_)Iy@Z>nLo$nP z5+}zI877*Z`hv(Kmu9Y8jzY_5-V=eS{|;JxIt{jma0QEdhoCJLRxbvR(Tw8M02$VMD!HC_E65$ju~)_Yc>ka|;Z@erax4s)7) zJCQccysqvNk-gP?<2+i~@45NrvJ6~2#@v>OxZKW14oAFiEFW`f5s|f!U(u0H6z1T| z-aCOd!?af)9M8zNF^U0J~<(L0+z zXF38QrTq1=gOK0!mmq(SN%XJ^-ley}NkYPdc~E#%C{N!>WZEVC_>&21n{YmABpj*| zE~>C@;9=p85(c&lJ#iml-%LiKK#W)jtGy${5n~IWloQ`#Z;wGs_`wpF1_0J4ChIy`Ijk}iCF3H-crm?i^X&Z z+au~Nu0=$l1j#65oa)v38Jwt76P8qC|6(=y z8WI`V>I|oQ{jK_S@7r)PM%~?_!O7!l^<6U@8?2r#d<19Cs7*C!vE_!^RF885uB)zl z$H$}RWg6YyNMw%G#2Qo_HbRq|D^PK~Hh6z19w3{R)Qz~$UhTsLND%m3+ib^vtx4N{ zb~(;vYV9^$*l)4cvk(ph4AFX=ktk%J9@7XRvaZig%}1-k^aVR`pZtyPIEV9oIWB$m zMtMzM*}uvZ%md4;H?*7)5v4HeEc zF3#CQ请输入异常说明: + + Dialog_HGMessageBox + + + Dialog + 警告 + + + + TextLabel + 警告 + + + + OK + 确定 + + + + Cancel + 取消 + + Dialog_InputSerialNum @@ -939,7 +962,7 @@ 刷新设备列表 - + Account login elsewhere 账户在其他地方登录 @@ -948,63 +971,62 @@ 网络连接断开 - + You have been forced offline by the administrator account 你已被管理员账户强制下线 - + Data base error 数据库错误 - - - - - - - - - - + + + + + + + + + + tips 提示 - + production tool-burn station 华高生产工具-烧录工位 - + production tool-init test station 华高生产工具-初检工位 - + production tool-image test station 华高生产工具-图像测试工位 - + production tool-pressure test station 华高生产工具-压力测试工位 - - - + + + Is testing, do not close! 测试中,请勿关闭! - warning - 警告 + 警告 - + Confirm whether the device is reset Are you sure to connect the new device 检测到设备,请先确认是否已经复位,否则有可能导致获取序列号失败! @@ -1014,14 +1036,13 @@ 确定 - no - 取消 + 取消 - - - + + + cannot create more table 不能创建更多项目 @@ -1030,57 +1051,56 @@ 设备已断开连接 - confirm - 已复位 + 已复位 - + Open device failed 打开设备失败 - + save 保存 - + xls(*.xls) xls表格(*.xls) - + export succeed 导出成功 - + export failed 导出失败 - + Illegal user 非法的用户 - + Wrong password 密码错误 - + Database error 数据库错误 - + connect error 连接错误 - + Failed 错误 diff --git a/app/HGProductionTool/dialog_hgmessagebox.cpp b/app/HGProductionTool/dialog_hgmessagebox.cpp new file mode 100644 index 0000000..4ff5046 --- /dev/null +++ b/app/HGProductionTool/dialog_hgmessagebox.cpp @@ -0,0 +1,34 @@ +#include "dialog_hgmessagebox.h" +#include "ui_dialog_hgmessagebox.h" + +Dialog_HGMessageBox::Dialog_HGMessageBox(const QString &text, QWidget *parent) : + QDialog(parent), + ui(new Ui::Dialog_HGMessageBox) +{ + ui->setupUi(this); + + setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint); + + QFont ft; + ft.setPointSize(15); + ft.setBold(true); + ui->label->setFont(ft); + + ui->label->setText(text); + ui->label->setStyleSheet("color:red;"); +} + +Dialog_HGMessageBox::~Dialog_HGMessageBox() +{ + delete ui; +} + +void Dialog_HGMessageBox::on_pbtn_ok_clicked() +{ + accept(); +} + +void Dialog_HGMessageBox::on_pbtn_cancel_clicked() +{ + reject(); +} diff --git a/app/HGProductionTool/dialog_hgmessagebox.h b/app/HGProductionTool/dialog_hgmessagebox.h new file mode 100644 index 0000000..997a586 --- /dev/null +++ b/app/HGProductionTool/dialog_hgmessagebox.h @@ -0,0 +1,27 @@ +#ifndef DIALOG_HGMESSAGEBOX_H +#define DIALOG_HGMESSAGEBOX_H + +#include + +namespace Ui { +class Dialog_HGMessageBox; +} + +class Dialog_HGMessageBox : public QDialog +{ + Q_OBJECT + +public: + explicit Dialog_HGMessageBox(const QString &text, QWidget *parent = nullptr); + ~Dialog_HGMessageBox(); + +private slots: + void on_pbtn_ok_clicked(); + + void on_pbtn_cancel_clicked(); + +private: + Ui::Dialog_HGMessageBox *ui; +}; + +#endif // DIALOG_HGMESSAGEBOX_H diff --git a/app/HGProductionTool/dialog_hgmessagebox.ui b/app/HGProductionTool/dialog_hgmessagebox.ui new file mode 100644 index 0000000..0c99200 --- /dev/null +++ b/app/HGProductionTool/dialog_hgmessagebox.ui @@ -0,0 +1,127 @@ + + + Dialog_HGMessageBox + + + + 0 + 0 + 462 + 168 + + + + Dialog + + + + + + Qt::Vertical + + + + 20 + 52 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + TextLabel + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 51 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 30 + + + + OK + + + + + + + + 0 + 30 + + + + Cancel + + + + + + + + + + diff --git a/app/HGProductionTool/mainwindow.cpp b/app/HGProductionTool/mainwindow.cpp index 525ac9e..60faf07 100644 --- a/app/HGProductionTool/mainwindow.cpp +++ b/app/HGProductionTool/mainwindow.cpp @@ -9,6 +9,7 @@ #include "dialog_accountmanage.h" #include "dialog_uploadcfgfile.h" #include "dialog_inputserialnum.h" +#include "dialog_hgmessagebox.h" MainWindow::MainWindow(HGPdtToolDbUserMgr pdtToolDbuserMgr, Dialog_logIn::LogInType loginType, const QString &ftpHost, unsigned short ftpPort, QWidget *parent) : QMainWindow(parent) @@ -319,7 +320,6 @@ int MainWindow::sane_ex_callback(SANE_Handle hdev, int code, void *data, unsigne { SANE_Device_Ex* sane_dev = (SANE_Device_Ex*)data; - Sleep(5000); emit p->sane_dev_arrive(sane_dev->name); } else if (SANE_EVENT_DEVICE_LEFT == code) @@ -406,6 +406,14 @@ QString MainWindow::getDevFwNum(SANE_Handle handle) void MainWindow::on_sane_dev_arrive(QString devName) { + ui->act_refreshDevice->setEnabled(false); + QTime curTimer = QTime::currentTime().addMSecs(5000); + while (QTime::currentTime() < curTimer) + { + QCoreApplication::processEvents(QEventLoop::AllEvents, 100); + } + ui->act_refreshDevice->setEnabled(true); + if (m_loginType == Dialog_logIn::LogInType_Burn) { SANE_Handle devHandle = nullptr; @@ -415,48 +423,48 @@ void MainWindow::on_sane_dev_arrive(QString devName) DeviceManager *devManager = new DeviceManager(this, m_formBurnMode, devHandle, devName); m_formBurnMode->addDevice(devManager); } + + return; } - else + + QString str = tr("Confirm whether the device is reset"); + Dialog_HGMessageBox dlg(str, this); + if (!dlg.exec()) { - QMessageBox msg(QMessageBox::Warning, tr("warning"), - tr("Confirm whether the device is reset"), - QMessageBox::Yes | QMessageBox::No, this); - msg.setButtonText(QMessageBox::Yes, tr("confirm")); - msg.setButtonText(QMessageBox::No, tr("no")); - msg.exec(); - if (msg.clickedButton() == msg.button(QMessageBox::Yes)) - { - SANE_Handle devHandle = nullptr; - sane_open(devName.toStdString().c_str(), &devHandle); - if (nullptr != devHandle) - { - m_inputSnDlg = new Dialog_InputSerialNum(this, devName, m_pdtToolDbuserMgr, devHandle, getDevSn(devHandle), getDevType(devHandle)); - if (m_inputSnDlg->exec()) - { - HGPdtToolDbDevice pdtToolDbDevice = nullptr; - HGPdtToolDb_OpenDevice(m_pdtToolDbuserMgr, m_inputSnDlg->GetSn().toStdString().c_str(), &pdtToolDbDevice); + return; + } - Form_mainInterface *mainInterface = new Form_mainInterface(this, m_loginType, devHandle, m_pdtToolDbuserMgr, pdtToolDbDevice, - m_inputSnDlg->GetSn(), m_inputSnDlg->GetDevType(), devName, getDevFwNum(devHandle)); - if (!AddInterface(mainInterface)) - { - QMessageBox::information(this, tr("tips"), tr("cannot create more table")); - delete mainInterface; - } - } - else - { - sane_close(devHandle); - } + SANE_Handle devHandle = nullptr; + sane_open(devName.toStdString().c_str(), &devHandle); - delete m_inputSnDlg; - m_inputSnDlg = nullptr; - } - else - { - QMessageBox::information(this, tr("tips"), tr("Open device failed")); - } - } + if (nullptr == devHandle) + { + QMessageBox::information(this, tr("tips"), tr("Open device failed")); + return; + } + + m_inputSnDlg = new Dialog_InputSerialNum(this, devName, m_pdtToolDbuserMgr, devHandle, getDevSn(devHandle), getDevType(devHandle)); + if (!m_inputSnDlg->exec()) + { + sane_close(devHandle); + return ; + } + + HGPdtToolDbDevice pdtToolDbDevice = nullptr; + HGPdtToolDb_OpenDevice(m_pdtToolDbuserMgr, m_inputSnDlg->GetSn().toStdString().c_str(), &pdtToolDbDevice); + + Form_mainInterface *mainInterface = new Form_mainInterface(this, m_loginType, devHandle, m_pdtToolDbuserMgr, pdtToolDbDevice, + m_inputSnDlg->GetSn(), m_inputSnDlg->GetDevType(), devName, getDevFwNum(devHandle)); + if (!AddInterface(mainInterface)) + { + QMessageBox::information(this, tr("tips"), tr("cannot create more table")); + delete mainInterface; + } + + if (m_inputSnDlg != nullptr) + { + delete m_inputSnDlg; + m_inputSnDlg = nullptr; } }