1)将G100、G200和G300、G400的工位区分开

2)G100和G200的初检工位中加入烧录界面
This commit is contained in:
luoliangyi 2024-08-20 11:32:38 +08:00
parent 5b8a9fcd15
commit eb837ff167
13 changed files with 447 additions and 610 deletions

View File

@ -6,15 +6,14 @@
#include "app_cfg.h" #include "app_cfg.h"
#include "dialog_setlogpath.h" #include "dialog_setlogpath.h"
Dialog_InputSerialNum::Dialog_InputSerialNum(class MainWindow *mainWnd, Dialog_logIn::LogInType logInType, const QString &devName, const QString &profileName, Dialog_InputSerialNum::Dialog_InputSerialNum(class MainWindow *mainWnd, const QString &devName, const QString &deviceConfig,
const QString &accountName, SANE_Handle handle, const QString &serialNum, const QString &devType) : const QString &accountName, SANE_Handle handle, const QString &serialNum, const QString &devType, bool canSetSN)
QDialog(mainWnd), : QDialog(mainWnd),
ui(new Ui::Dialog_InputSerialNum), ui(new Ui::Dialog_InputSerialNum),
m_mainWnd(mainWnd), m_mainWnd(mainWnd),
m_logInType(logInType),
m_handle(handle), m_handle(handle),
m_valid(true), m_valid(true),
m_profileName(profileName), m_deviceConfig(deviceConfig),
m_accountName(accountName), m_accountName(accountName),
m_serialNum(serialNum), m_serialNum(serialNum),
m_devType(devType), m_devType(devType),
@ -26,6 +25,7 @@ Dialog_InputSerialNum::Dialog_InputSerialNum(class MainWindow *mainWnd, Dialog_l
{ {
ui->setupUi(this); ui->setupUi(this);
setWindowTitle(devName);
setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint); setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint);
QFont ft; QFont ft;
@ -35,7 +35,7 @@ Dialog_InputSerialNum::Dialog_InputSerialNum(class MainWindow *mainWnd, Dialog_l
QFont ft2; QFont ft2;
ft2.setPointSize(20); ft2.setPointSize(20);
if (m_logInType != Dialog_logIn::LogInType_InitTest) if (!canSetSN)
{ {
ui->lineEdit_sn->setEnabled(false); ui->lineEdit_sn->setEnabled(false);
ui->pbtn_setSn->setEnabled(false); ui->pbtn_setSn->setEnabled(false);
@ -115,7 +115,7 @@ void Dialog_InputSerialNum::Invalid(const QString &devName)
void Dialog_InputSerialNum::setSpeedMode() void Dialog_InputSerialNum::setSpeedMode()
{ {
AnalysisJson analysisJson(m_profileName); AnalysisJson analysisJson(m_deviceConfig);
AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal(); AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal();
LPWRITECFG lp = new WRITECFG; LPWRITECFG lp = new WRITECFG;
@ -132,7 +132,7 @@ void Dialog_InputSerialNum::setSpeedMode()
void Dialog_InputSerialNum::setSleepTime() void Dialog_InputSerialNum::setSleepTime()
{ {
AnalysisJson analysisJson(m_profileName); AnalysisJson analysisJson(m_deviceConfig);
AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal(); AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal();
LPWRITECFG lp = new WRITECFG; LPWRITECFG lp = new WRITECFG;
@ -149,7 +149,7 @@ void Dialog_InputSerialNum::setSleepTime()
void Dialog_InputSerialNum::setVidPid() void Dialog_InputSerialNum::setVidPid()
{ {
AnalysisJson analysisJson(m_profileName); AnalysisJson analysisJson(m_deviceConfig);
AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal(); AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal();
LPWRITECFG lp = new WRITECFG; LPWRITECFG lp = new WRITECFG;
@ -173,7 +173,7 @@ void Dialog_InputSerialNum::setVidPid()
void Dialog_InputSerialNum::setDevceModel() void Dialog_InputSerialNum::setDevceModel()
{ {
AnalysisJson analysisJson(m_profileName); AnalysisJson analysisJson(m_deviceConfig);
AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal(); AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal();
std::string deviceModel = jsonGlobal.device_model.toStdString(); std::string deviceModel = jsonGlobal.device_model.toStdString();
@ -314,7 +314,7 @@ void Dialog_InputSerialNum::updateTargetCfg()
{ {
ui->textBrowser_target->clear(); ui->textBrowser_target->clear();
AnalysisJson analysisJson(m_profileName); AnalysisJson analysisJson(m_deviceConfig);
AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal(); AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal();
int speedMode = jsonGlobal.speed_mode; int speedMode = jsonGlobal.speed_mode;
@ -362,7 +362,7 @@ void Dialog_InputSerialNum::updateCurDeviceCfg()
int vid_to = getDevVid(); int vid_to = getDevVid();
int pid_to = getDevPid(); int pid_to = getDevPid();
AnalysisJson analysisJson(m_profileName); AnalysisJson analysisJson(m_deviceConfig);
AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal(); AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal();
QString devideModel(""); QString devideModel("");
if (!jsonGlobal.device_model.isEmpty()) if (!jsonGlobal.device_model.isEmpty())
@ -505,7 +505,7 @@ void Dialog_InputSerialNum::on_pbtn_setSn_clicked()
void Dialog_InputSerialNum::on_pbtn_checkConfig_clicked() void Dialog_InputSerialNum::on_pbtn_checkConfig_clicked()
{ {
AnalysisJson analysisJson(m_profileName); AnalysisJson analysisJson(m_deviceConfig);
AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal(); AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal();
int speedMode_to = jsonGlobal.speed_mode; int speedMode_to = jsonGlobal.speed_mode;
@ -649,7 +649,7 @@ void Dialog_InputSerialNum::on_pbtn_enterTest_clicked()
void Dialog_InputSerialNum::on_pbtn_setConfig_clicked() void Dialog_InputSerialNum::on_pbtn_setConfig_clicked()
{ {
AnalysisJson analysisJson(m_profileName); AnalysisJson analysisJson(m_deviceConfig);
AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal(); AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal();
bool supportDevModel = false; bool supportDevModel = false;

View File

@ -16,8 +16,8 @@ class Dialog_InputSerialNum : public QDialog
Q_OBJECT Q_OBJECT
public: public:
explicit Dialog_InputSerialNum(class MainWindow *mainWnd, Dialog_logIn::LogInType logInType, const QString &devName, const QString &profileName, explicit Dialog_InputSerialNum(class MainWindow *mainWnd, const QString &devName, const QString &deviceConfig,
const QString &accountName, SANE_Handle handle, const QString &serialNum, const QString &devType); const QString &accountName, SANE_Handle handle, const QString &serialNum, const QString &devType, bool canSetSN);
~Dialog_InputSerialNum(); ~Dialog_InputSerialNum();
QString GetSn(); QString GetSn();
@ -81,15 +81,13 @@ private:
Ui::Dialog_InputSerialNum *ui; Ui::Dialog_InputSerialNum *ui;
class MainWindow *m_mainWnd; class MainWindow *m_mainWnd;
Dialog_logIn::LogInType m_logInType;
SANE_Handle m_handle; SANE_Handle m_handle;
bool m_valid; bool m_valid;
QString m_profileName; QString m_deviceConfig;
QString m_accountName; QString m_accountName;
QString m_serialNum; QString m_serialNum;
QString m_devType; QString m_devType;
QString m_devName; QString m_devName;
//HGPdtToolDbUserMgr m_pdtToolDbuserMgr;
hgscanner *m_hg; hgscanner *m_hg;
int m_curIndex; int m_curIndex;

View File

@ -11,16 +11,24 @@
#include "dialog_registeraccount.h" #include "dialog_registeraccount.h"
#include "app_cfg.h" #include "app_cfg.h"
Dialog_logIn::Dialog_logIn(QWidget *parent) : Dialog_logIn::Dialog_logIn(QWidget *parent)
QDialog(parent), : QDialog(parent)
ui(new Ui::Dialog_logIn) , ui(new Ui::Dialog_logIn)
, m_accountName("") , m_accountName("")
, m_profileName("") , m_deviceType(DeviceType_G100)
, m_deviceConfig("")
, m_loginType(LogInType_Station1)
{ {
ui->setupUi(this); ui->setupUi(this);
setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint); setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint);
ui->comboBox_deviceType->addItem("G100");
ui->comboBox_deviceType->addItem("G200");
ui->comboBox_deviceType->addItem("G300");
ui->comboBox_deviceType->addItem("G400");
ui->comboBox_deviceType->setCurrentIndex(getCfgValue("login", "devType", 0));
QFont ft; QFont ft;
ft.setPointSize(15); ft.setPointSize(15);
this->setFont(ft); this->setFont(ft);
@ -30,22 +38,21 @@ Dialog_logIn::Dialog_logIn(QWidget *parent) :
ui->lineEdit_password->setFont(ft2); ui->lineEdit_password->setFont(ft2);
ui->pbtn_login->setDefault(true); ui->pbtn_login->setDefault(true);
ui->radioButton_pressureTest->setVisible(false);
saveCfgValue("admin", "password", getCfgValue("admin", "password", QString("huagaoadmin"))); saveCfgValue("admin", "password", getCfgValue("admin", "password", QString("huagaoadmin")));
int type = getCfgValue("login", "station", 0); int type = getCfgValue("login", "station", 0);
if (LogInType_Burn == type) if (0 == type)
{ {
ui->radioButton_burn->setChecked(true); ui->radioButton_station1->setChecked(true);
} }
else if (LogInType_InitTest == type) else if (1 == type)
{ {
ui->radioButton_initTest->setChecked(true); ui->radioButton_station2->setChecked(true);
} }
else if (LogInType_ImageTest == type) else if (2 == type)
{ {
ui->radioButton_imageTest->setChecked(true); ui->radioButton_station3->setChecked(true);
} }
updateProfileFileList(); updateProfileFileList();
@ -68,27 +75,6 @@ Dialog_logIn::Dialog_logIn(QWidget *parent) :
ui->lineEdit_password->setText(cfgPassword); ui->lineEdit_password->setText(cfgPassword);
} }
} }
ui->stackedWidget->setCurrentIndex(0);
// 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");
// QString ftpHost("192.168.1.70");
// QString ftpPort("21");
// ui->lineEdit_dbHost->setText(getCfgValue("login", "dbHost", dbHost));
// ui->lineEdit_dbPort->setText(getCfgValue("login", "dbPort", dbPort));
// ui->lineEdit_ftpHost->setText(getCfgValue("login", "ftpHost", ftpHost));
// ui->lineEdit_ftpPort->setText(getCfgValue("login", "ftpPort", ftpPort));
} }
Dialog_logIn::~Dialog_logIn() Dialog_logIn::~Dialog_logIn()
@ -96,34 +82,24 @@ Dialog_logIn::~Dialog_logIn()
delete ui; delete ui;
} }
//HGPdtToolDbUserMgr Dialog_logIn::GetUserMgr()
//{
// return m_pdtToolDbuserMgr;
//}
QString Dialog_logIn::GetFtpHost()
{
return ui->lineEdit_ftpHost->text();
}
unsigned short Dialog_logIn::GetFtpPort()
{
return ui->lineEdit_ftpPort->text().toUShort();
}
Dialog_logIn::LogInType Dialog_logIn::GetLogInType()
{
return m_loginType;
}
QString Dialog_logIn::GetAccountName() QString Dialog_logIn::GetAccountName()
{ {
return m_accountName; return m_accountName;
} }
QString Dialog_logIn::GetProfileName() Dialog_logIn::DeviceType Dialog_logIn::GetDeviceType()
{ {
return m_profileName; return m_deviceType;
}
QString Dialog_logIn::GetDeviceConfig()
{
return m_deviceConfig;
}
Dialog_logIn::LogInType Dialog_logIn::GetLogInType()
{
return m_loginType;
} }
QString Dialog_logIn::getConfigFilePath() QString Dialog_logIn::getConfigFilePath()
@ -139,9 +115,9 @@ QString Dialog_logIn::getConfigFilePath()
void Dialog_logIn::updateProfileFileList() void Dialog_logIn::updateProfileFileList()
{ {
ui->comboBox_filenameList->clear(); ui->comboBox_deviceConfig->clear();
QString configFilePath = getConfigFilePath(); QString configFilePath = getConfigFilePath() + ui->comboBox_deviceType->currentText();
QDir dir(configFilePath); QDir dir(configFilePath);
if (dir.exists()) if (dir.exists())
{ {
@ -149,15 +125,15 @@ void Dialog_logIn::updateProfileFileList()
for (int i = 0; i < fileList.size(); ++i) for (int i = 0; i < fileList.size(); ++i)
{ {
QFileInfo file(fileList[i]); QFileInfo file(fileList[i]);
ui->comboBox_filenameList->addItem(file.baseName()); ui->comboBox_deviceConfig->addItem(file.baseName());
} }
} }
if (ui->comboBox_filenameList->count() > 0) if (ui->comboBox_deviceConfig->count() > 0)
{ {
QString fileName = getCfgValue("login", "profile", QString("")); QString fileName = getCfgValue("login", "profile", QString(""));
QFileInfo file(fileName); QFileInfo file(fileName);
ui->comboBox_filenameList->setCurrentText(file.baseName()); ui->comboBox_deviceConfig->setCurrentText(file.baseName());
} }
} }
@ -185,62 +161,36 @@ void Dialog_logIn::on_pbtn_login_clicked()
return; return;
} }
if (ui->comboBox_filenameList->currentText().isEmpty() && !ui->radioButton_burn->isChecked()) if (ui->comboBox_deviceConfig->currentText().isEmpty())
{ {
QMessageBox::information(this, tr("Prompt"), tr("Please select a profile first")); QMessageBox::information(this, tr("Prompt"), tr("Please select a profile first"));
return; return;
} }
if (ui->radioButton_burn->isChecked()) m_accountName = account;
m_loginType = LogInType_Burn;
else if (ui->radioButton_initTest->isChecked())
m_loginType = LogInType_InitTest;
else if (ui->radioButton_imageTest->isChecked())
m_loginType = LogInType_ImageTest;
else if (ui->radioButton_pressureTest->isChecked())
m_loginType = LogInType_PressureTest;
saveCfgValue("login", "account", account); saveCfgValue("login", "account", account);
saveCfgValue("login", "station", m_loginType);
saveCfgValue("login", "rememberPassword", ui->checkBox_rememberPswd->isChecked()); saveCfgValue("login", "rememberPassword", ui->checkBox_rememberPswd->isChecked());
saveCfgValue("login", "showPassword", ui->checkBox_showPswd->isChecked()); saveCfgValue("login", "showPassword", ui->checkBox_showPswd->isChecked());
m_profileName = getConfigFilePath() + ui->comboBox_filenameList->currentText() + ".json"; m_deviceType = (DeviceType)ui->comboBox_deviceType->currentIndex();
saveCfgValue("login", "profile", m_profileName); saveCfgValue("login", "devType", m_deviceType);
m_accountName = account; m_deviceConfig = getConfigFilePath() + ui->comboBox_deviceType->currentText() + "/" + ui->comboBox_deviceConfig->currentText() + ".json";
saveCfgValue("login", "profile", m_deviceConfig);
m_loginType = LogInType_Station1;
if (ui->radioButton_station2->isChecked())
m_loginType = LogInType_Station2;
else if (ui->radioButton_station3->isChecked())
m_loginType = LogInType_Station3;
saveCfgValue("login", "station", m_loginType);
accept(); accept();
// HGPdtToolDbUserMgr pdtToolDbuserMgr = nullptr;
// HGPdtToolDb_CreateUserMgr(dbHost.toStdString().c_str(), dbPort.toInt(), account.toStdString().c_str(), password.toStdString().c_str(),
// &pdtToolDbuserMgr);
// if (NULL != pdtToolDbuserMgr)
// {
// m_pdtToolDbuserMgr = pdtToolDbuserMgr;
// accept();
// }
// else
// {
// QMessageBox msg(QMessageBox::Question, tr("tips"), tr("Login failed, sure to enter offline mode?"), QMessageBox::Yes | QMessageBox::No, this);
// msg.setButtonText(QMessageBox::Yes, tr("yes"));
// msg.setButtonText(QMessageBox::No, tr("no"));
// msg.exec();
// if (msg.clickedButton() == msg.button(QMessageBox::Yes))
// {
// m_pdtToolDbuserMgr = nullptr;
// accept();
// }
// else
// {
// return;
// }
// }
} }
void Dialog_logIn::on_pbtn_register_clicked() void Dialog_logIn::on_pbtn_register_clicked()
{ {
Dialog_RegisterAccount dlg; Dialog_RegisterAccount dlg(this);
dlg.exec(); dlg.exec();
} }
@ -249,19 +199,19 @@ void Dialog_logIn::on_checkBox_showPswd_toggled(bool checked)
ui->lineEdit_password->setEchoMode(checked ? QLineEdit::Normal : QLineEdit::Password); ui->lineEdit_password->setEchoMode(checked ? QLineEdit::Normal : QLineEdit::Password);
} }
void Dialog_logIn::on_pushButton_updateFilename_clicked() void Dialog_logIn::on_pushButton_updateConfig_clicked()
{ {
updateProfileFileList(); updateProfileFileList();
} }
void Dialog_logIn::on_pushButton_viewDirectory_clicked() void Dialog_logIn::on_pushButton_viewDirectory_clicked()
{ {
QString configName = ui->comboBox_filenameList->currentText(); QString configName = ui->comboBox_deviceConfig->currentText();
QString fileName = getConfigFilePath(); QString fileName = getConfigFilePath();
if (!configName.isEmpty()) if (!configName.isEmpty())
{ {
fileName = getConfigFilePath() + configName.toLocal8Bit() + ".json"; fileName = getConfigFilePath() + ui->comboBox_deviceType->currentText() + "/" + configName.toLocal8Bit() + ".json";
} }
else else
{ {
@ -276,3 +226,21 @@ void Dialog_logIn::on_pushButton_viewDirectory_clicked()
if (!ret) if (!ret)
QMessageBox::information(this, tr("Prompt"), tr("Profile is not exsits")); QMessageBox::information(this, tr("Prompt"), tr("Profile is not exsits"));
} }
void Dialog_logIn::on_comboBox_deviceType_currentIndexChanged(const QString &arg1)
{
updateProfileFileList();
if ("G100" == arg1 || "G200" == arg1)
{
ui->radioButton_station1->setText(tr("init test"));
ui->radioButton_station2->setText(tr("image test"));
ui->radioButton_station3->setText(tr("finish test"));
}
else
{
ui->radioButton_station1->setText(tr("burn"));
ui->radioButton_station2->setText(tr("init test"));
ui->radioButton_station3->setText(tr("image test"));
}
}

View File

@ -2,7 +2,6 @@
#define DIALOG_LOGIN_H #define DIALOG_LOGIN_H
#include <QDialog> #include <QDialog>
//#include "HGPdtToolDb.h"
namespace Ui { namespace Ui {
class Dialog_logIn; class Dialog_logIn;
@ -16,20 +15,25 @@ public:
explicit Dialog_logIn(QWidget *parent = nullptr); explicit Dialog_logIn(QWidget *parent = nullptr);
~Dialog_logIn(); ~Dialog_logIn();
enum LogInType enum DeviceType
{ {
LogInType_Burn = 0, DeviceType_G100 = 0,
LogInType_InitTest = 1, DeviceType_G200 = 1,
LogInType_ImageTest = 2, DeviceType_G300 = 2,
LogInType_PressureTest = 3 DeviceType_G400 = 3
};
enum LogInType
{
LogInType_Station1 = 0, // 工位1
LogInType_Station2 = 1, // 工位2
LogInType_Station3 = 2, // 工位3
}; };
//HGPdtToolDbUserMgr GetUserMgr();
QString GetFtpHost();
unsigned short GetFtpPort();
LogInType GetLogInType();
QString GetAccountName(); QString GetAccountName();
QString GetProfileName(); DeviceType GetDeviceType();
QString GetDeviceConfig();
LogInType GetLogInType();
private: private:
QString getConfigFilePath(); QString getConfigFilePath();
@ -42,20 +46,19 @@ private slots:
void on_checkBox_showPswd_toggled(bool checked); void on_checkBox_showPswd_toggled(bool checked);
void on_pushButton_updateFilename_clicked(); void on_pushButton_updateConfig_clicked();
void on_pushButton_viewDirectory_clicked(); void on_pushButton_viewDirectory_clicked();
void on_comboBox_deviceType_currentIndexChanged(const QString &arg1);
private: private:
Ui::Dialog_logIn *ui; Ui::Dialog_logIn *ui;
//HGPdtToolDbUserMgr m_pdtToolDbuserMgr;
QPoint m_startPos;
QPoint m_endPos;
bool m_leftMousePressed;
LogInType m_loginType;
QString m_accountName; QString m_accountName;
QString m_profileName; DeviceType m_deviceType;
QString m_deviceConfig;
LogInType m_loginType;
}; };
#endif // DIALOG_LOGIN_H #endif // DIALOG_LOGIN_H

View File

@ -35,247 +35,53 @@
<attribute name="title"> <attribute name="title">
<string>Login</string> <string>Login</string>
</attribute> </attribute>
<widget class="QStackedWidget" name="stackedWidget"> <widget class="QRadioButton" name="radioButton_station1">
<property name="geometry">
<rect>
<x>60</x>
<y>0</y>
<width>421</width>
<height>141</height>
</rect>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="page">
<widget class="QLabel" name="label_user">
<property name="geometry">
<rect>
<x>80</x>
<y>30</y>
<width>48</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>account:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_account">
<property name="geometry">
<rect>
<x>140</x>
<y>30</y>
<width>161</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_password">
<property name="geometry">
<rect>
<x>80</x>
<y>90</y>
<width>54</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>password:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_password">
<property name="geometry">
<rect>
<x>140</x>
<y>90</y>
<width>161</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_rememberPswd">
<property name="geometry">
<rect>
<x>310</x>
<y>80</y>
<width>141</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>remember password</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_showPswd">
<property name="geometry">
<rect>
<x>310</x>
<y>100</y>
<width>141</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>show password</string>
</property>
</widget>
</widget>
<widget class="QWidget" name="page_2">
<widget class="QLabel" name="label_dbHost">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>111</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>dbHost:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_dbHost">
<property name="geometry">
<rect>
<x>150</x>
<y>20</y>
<width>171</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_dbPort">
<property name="geometry">
<rect>
<x>20</x>
<y>50</y>
<width>111</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>dbPort:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_dbPort">
<property name="geometry">
<rect>
<x>150</x>
<y>50</y>
<width>171</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_ftpHost">
<property name="geometry">
<rect>
<x>50</x>
<y>80</y>
<width>81</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>ftpHost:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_ftpHost">
<property name="geometry">
<rect>
<x>150</x>
<y>80</y>
<width>171</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_ftpPort">
<property name="geometry">
<rect>
<x>50</x>
<y>110</y>
<width>81</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>ftpPort:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_ftpPort">
<property name="geometry">
<rect>
<x>150</x>
<y>110</y>
<width>171</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QRadioButton" name="radioButton_pressureTest">
<property name="geometry">
<rect>
<x>80</x>
<y>40</y>
<width>151</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>PressureTest</string>
</property>
</widget>
</widget>
</widget>
<widget class="QRadioButton" name="radioButton_burn">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>40</x> <x>40</x>
<y>150</y> <y>220</y>
<width>131</width> <width>131</width>
<height>20</height> <height>20</height>
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>Burn</string> <string>station1</string>
</property> </property>
<property name="checked"> <property name="checked">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
<widget class="QRadioButton" name="radioButton_initTest"> <widget class="QRadioButton" name="radioButton_station2">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>190</x> <x>190</x>
<y>150</y> <y>220</y>
<width>141</width> <width>141</width>
<height>21</height> <height>21</height>
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>InitTest</string> <string>station2</string>
</property> </property>
</widget> </widget>
<widget class="QRadioButton" name="radioButton_imageTest"> <widget class="QRadioButton" name="radioButton_station3">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>340</x> <x>340</x>
<y>150</y> <y>220</y>
<width>151</width> <width>151</width>
<height>21</height> <height>21</height>
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>ImageTest</string> <string>station3</string>
</property> </property>
</widget> </widget>
<widget class="QPushButton" name="pbtn_login"> <widget class="QPushButton" name="pbtn_login">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>160</x> <x>160</x>
<y>210</y> <y>260</y>
<width>75</width> <width>75</width>
<height>31</height> <height>31</height>
</rect> </rect>
@ -294,7 +100,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>280</x> <x>280</x>
<y>210</y> <y>260</y>
<width>75</width> <width>75</width>
<height>31</height> <height>31</height>
</rect> </rect>
@ -303,58 +109,148 @@
<string>Register</string> <string>Register</string>
</property> </property>
</widget> </widget>
</widget> <widget class="QCheckBox" name="checkBox_showPswd">
<widget class="QWidget" name="tab_selectProfile">
<attribute name="title">
<string>Select Profile</string>
</attribute>
<widget class="QComboBox" name="comboBox_filenameList">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>20</x> <x>380</x>
<y>90</y> <y>80</y>
<width>481</width> <width>111</width>
<height>31</height> <height>21</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>20</x>
<y>40</y>
<width>251</width>
<height>31</height>
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>Select config file:</string> <string>show password</string>
</property> </property>
</widget> </widget>
<widget class="QPushButton" name="pushButton_updateFilename"> <widget class="QLineEdit" name="lineEdit_account">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>280</x> <x>140</x>
<y>160</y> <y>30</y>
<width>121</width> <width>191</width>
<height>41</height> <height>22</height>
</rect>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_rememberPswd">
<property name="geometry">
<rect>
<x>380</x>
<y>60</y>
<width>131</width>
<height>21</height>
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>Update</string> <string>remember password</string>
</property>
</widget>
<widget class="QLabel" name="label_user">
<property name="geometry">
<rect>
<x>70</x>
<y>30</y>
<width>48</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>account:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_password">
<property name="geometry">
<rect>
<x>140</x>
<y>70</y>
<width>191</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_password">
<property name="geometry">
<rect>
<x>70</x>
<y>70</y>
<width>54</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>password:</string>
</property>
</widget>
<widget class="QLabel" name="label_deviceType">
<property name="geometry">
<rect>
<x>50</x>
<y>130</y>
<width>81</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>device type:</string>
</property>
</widget>
<widget class="QComboBox" name="comboBox_deviceType">
<property name="geometry">
<rect>
<x>140</x>
<y>130</y>
<width>271</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_deviceConfig">
<property name="geometry">
<rect>
<x>40</x>
<y>170</y>
<width>91</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>device config:</string>
</property>
</widget>
<widget class="QComboBox" name="comboBox_deviceConfig">
<property name="geometry">
<rect>
<x>140</x>
<y>170</y>
<width>271</width>
<height>22</height>
</rect>
</property> </property>
</widget> </widget>
<widget class="QPushButton" name="pushButton_viewDirectory"> <widget class="QPushButton" name="pushButton_viewDirectory">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>60</x> <x>420</x>
<y>160</y> <y>150</y>
<width>171</width> <width>91</width>
<height>41</height> <height>23</height>
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>View directory</string> <string>view directory</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_updateConfig">
<property name="geometry">
<rect>
<x>420</x>
<y>180</y>
<width>91</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>update connfig</string>
</property> </property>
</widget> </widget>
</widget> </widget>

View File

@ -27,6 +27,8 @@ Form_BurnMode::Form_BurnMode(class MainWindow *mainwnd, QWidget *parent) :
Form_BurnMode::~Form_BurnMode() Form_BurnMode::~Form_BurnMode()
{ {
clearDevice();
delete ui; delete ui;
} }
@ -74,6 +76,22 @@ void Form_BurnMode::deleteDevice(QString devName)
updatetablewidget(); updatetablewidget();
} }
void Form_BurnMode::clearDevice()
{
for(int i = ui->tableWidget->rowCount() - 1; i >= 0; --i)
{
QTableWidgetItem *item = ui->tableWidget->item(i, 1);
if (item != nullptr)
{
DeviceManager *devManager = (DeviceManager*)item->data(Qt::UserRole).value<void*>();
delete devManager;
ui->tableWidget->removeRow(i);
}
}
m_curIndex = 0;
updatetablewidget();
}
DeviceManager *Form_BurnMode::getDevManager() DeviceManager *Form_BurnMode::getDevManager()
{ {
for(int i = 0; i < ui->tableWidget->rowCount(); i++) for(int i = 0; i < ui->tableWidget->rowCount(); i++)
@ -186,12 +204,12 @@ void Form_BurnMode::on_pbtn_enterBurnMode_clicked()
} }
DeviceManager::DeviceManager(class MainWindow *mainwnd, class Form_BurnMode *burnMode, SANE_Handle handle, DeviceManager::DeviceManager(class MainWindow *mainwnd, class Form_BurnMode *burnMode, SANE_Handle handle,
const QString &profileName, const QString & devName, const QString &serialNum) const QString &deviceConfig, const QString & devName, const QString &serialNum)
{ {
m_mainwnd = mainwnd; m_mainwnd = mainwnd;
m_burnMode = burnMode; m_burnMode = burnMode;
m_handle = handle; m_handle = handle;
m_profileName = profileName; m_deviceConfig = deviceConfig;
m_devName = devName; m_devName = devName;
m_serialNum = serialNum; m_serialNum = serialNum;
@ -230,7 +248,7 @@ void DeviceManager::setBurnMode()
void DeviceManager::setSpeedMode() void DeviceManager::setSpeedMode()
{ {
AnalysisJson analysisJson(m_profileName); AnalysisJson analysisJson(m_deviceConfig);
AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal(); AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal();
LPWRITECFG lp = new WRITECFG; LPWRITECFG lp = new WRITECFG;
@ -244,7 +262,7 @@ void DeviceManager::setSpeedMode()
void DeviceManager::setSleepTime() void DeviceManager::setSleepTime()
{ {
AnalysisJson analysisJson(m_profileName); AnalysisJson analysisJson(m_deviceConfig);
AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal(); AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal();
LPWRITECFG lp = new WRITECFG; LPWRITECFG lp = new WRITECFG;
@ -258,7 +276,7 @@ void DeviceManager::setSleepTime()
void DeviceManager::setVidPid() void DeviceManager::setVidPid()
{ {
AnalysisJson analysisJson(m_profileName); AnalysisJson analysisJson(m_deviceConfig);
AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal(); AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal();
LPWRITECFG lp = new WRITECFG; LPWRITECFG lp = new WRITECFG;

View File

@ -15,7 +15,7 @@ class DeviceManager
{ {
public: public:
DeviceManager(class MainWindow *mainwnd, class Form_BurnMode *burnMode, SANE_Handle handle, DeviceManager(class MainWindow *mainwnd, class Form_BurnMode *burnMode, SANE_Handle handle,
const QString &profileName, const QString &devName, const QString &serialNum); const QString &deviceConfig, const QString &devName, const QString &serialNum);
~DeviceManager(); ~DeviceManager();
QString getDevName(); QString getDevName();
@ -50,7 +50,7 @@ private:
class Form_BurnMode *m_burnMode; class Form_BurnMode *m_burnMode;
QString m_devName; QString m_devName;
QString m_serialNum; QString m_serialNum;
QString m_profileName; QString m_deviceConfig;
hgscanner *m_hg; hgscanner *m_hg;
}; };
@ -65,6 +65,7 @@ public:
void addDevice(DeviceManager *devManager); void addDevice(DeviceManager *devManager);
void deleteDevice(QString devName); void deleteDevice(QString devName);
void clearDevice();
DeviceManager *getDevManager(); DeviceManager *getDevManager();

View File

@ -15,14 +15,14 @@
#include "dialog_excepdesc.h" #include "dialog_excepdesc.h"
#include "huagao/hgscanner_error.h" #include "huagao/hgscanner_error.h"
Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn::LogInType logInType, const QString &profileName, const QString &accountName, SANE_Handle handle, Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, const QString &deviceConfig, const QString &accountName, SANE_Handle handle,
const QString &serialNum, const QString &devType, const QString &devName, const QString &devFwNum) const QString &serialNum, const QString &devType, const QString &devName, const QString &devFwNum,
const QString &logInTypeStr)
: QWidget(mainwnd) : QWidget(mainwnd)
, ui(new Ui::Form_mainInterface) , ui(new Ui::Form_mainInterface)
, m_mainwnd(mainwnd) , m_mainwnd(mainwnd)
, m_logInType(logInType)
, m_accountName(accountName) , m_accountName(accountName)
, m_profileName(profileName) , m_deviceConfig(deviceConfig)
, m_hg(nullptr) , m_hg(nullptr)
, m_handle(handle) , m_handle(handle)
, m_disconnect(false) , m_disconnect(false)
@ -30,6 +30,7 @@ Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn::
, m_devType(devType) , m_devType(devType)
, m_devName(devName) , m_devName(devName)
, m_devFwNum(devFwNum) , m_devFwNum(devFwNum)
, m_logInTypeStr(logInTypeStr)
, m_curItemName("") , m_curItemName("")
, m_isTesting(false) , m_isTesting(false)
, m_isCorrectNormal(true) , m_isCorrectNormal(true)
@ -90,13 +91,6 @@ Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn::
connect(m_view, SIGNAL(doubleClicked()), this, SLOT(on_viewerDblClick())); connect(m_view, SIGNAL(doubleClicked()), this, SLOT(on_viewerDblClick()));
initTableWidgetUi(); initTableWidgetUi();
// if(!m_devType.isEmpty())
// HGPdtToolDb_SetDeviceType(m_pdtToolDbDevice, m_devType.toStdString().c_str());
// if(!m_devFwNum.isEmpty())
// HGPdtToolDb_SetDeviceVersion(m_pdtToolDbDevice, m_devFwNum.toStdString().c_str());
// if(!m_devName.isEmpty())
// HGPdtToolDb_SetDeviceName(m_pdtToolDbDevice, m_devName.toStdString().c_str());
} }
Form_mainInterface::~Form_mainInterface() Form_mainInterface::~Form_mainInterface()
@ -361,7 +355,7 @@ void Form_mainInterface::on_testGetDevCfgInfo(int vid, int pid, int sleepTime, i
void Form_mainInterface::on_testGetDevCpuDisk(int cpu, int disk) void Form_mainInterface::on_testGetDevCpuDisk(int cpu, int disk)
{ {
AnalysisJson analysisJson(m_profileName); AnalysisJson analysisJson(m_deviceConfig);
AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal(); AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal();
float cpu_size = jsonGlobal.cpu_size; float cpu_size = jsonGlobal.cpu_size;
float disk_size = jsonGlobal.disk_size; float disk_size = jsonGlobal.disk_size;
@ -557,11 +551,7 @@ void Form_mainInterface::initTableWidgetUi()
ui->tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); ui->tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
ui->tableWidget->setStyleSheet("selection-background-color:rgb(193,210,240)"); ui->tableWidget->setStyleSheet("selection-background-color:rgb(193,210,240)");
//HGPdtToolDb_DownloadFile(m_pdtToolDbuserMgr, m_devType.toStdString().c_str(), cfgPath); AnalysisJson analysisJson(m_deviceConfig);
AnalysisJson analysisJson(m_profileName);
const QString stationStr[] = {"烧录工位", "初检工位", "图像测试工位", "压力测试工位"};
std::vector<AnalysisJson::json_node> list_jsonNode = analysisJson.GetNode(); std::vector<AnalysisJson::json_node> list_jsonNode = analysisJson.GetNode();
int count = list_jsonNode.size(); int count = list_jsonNode.size();
@ -572,10 +562,8 @@ void Form_mainInterface::initTableWidgetUi()
AnalysisJson::json_node node = list_jsonNode[i]; AnalysisJson::json_node node = list_jsonNode[i];
m_map_title_name.insert(node.title, node); m_map_title_name.insert(node.title, node);
if (stationStr[m_logInType] == node.station) if (m_logInTypeStr == node.station)
{ {
//HGPdtToolDb_SetEntryNameCnStr(m_pdtToolDbuserMgr, node.name.toStdString().c_str(), node.title.toStdString().c_str());
ui->tableWidget->setItem(index, 0, new QTableWidgetItem(QString::number(index+1))); ui->tableWidget->setItem(index, 0, new QTableWidgetItem(QString::number(index+1)));
ui->tableWidget->item(index, 0)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); ui->tableWidget->item(index, 0)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
ui->tableWidget->setItem(index, 1, new QTableWidgetItem(node.title)); ui->tableWidget->setItem(index, 1, new QTableWidgetItem(node.title));

View File

@ -21,8 +21,9 @@ class Form_mainInterface : public QWidget
Q_OBJECT Q_OBJECT
public: public:
explicit Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn::LogInType logInType, const QString &profileName, const QString &accountName, SANE_Handle handle, explicit Form_mainInterface(class MainWindow *mainwnd, const QString &deviceConfig, const QString &accountName, SANE_Handle handle,
const QString &serialNum, const QString &devType, const QString &devName, const QString &devFwNum); const QString &serialNum, const QString &devType, const QString &devName, const QString &devFwNum,
const QString &logInTypeStr);
~Form_mainInterface(); ~Form_mainInterface();
bool isTesting(); bool isTesting();
@ -122,9 +123,8 @@ private:
HGImgView *m_view; HGImgView *m_view;
class MainWindow *m_mainwnd; class MainWindow *m_mainwnd;
Dialog_logIn::LogInType m_logInType;
QString m_accountName; QString m_accountName;
QString m_profileName; QString m_deviceConfig;
hgscanner *m_hg; hgscanner *m_hg;
SANE_Handle m_handle; SANE_Handle m_handle;
bool m_disconnect; bool m_disconnect;
@ -134,6 +134,7 @@ private:
QString m_devType; QString m_devType;
QString m_devName; QString m_devName;
QString m_devFwNum; QString m_devFwNum;
QString m_logInTypeStr;
QString m_curItemName; QString m_curItemName;
bool m_isTesting; bool m_isTesting;
bool m_isCorrectNormal; bool m_isCorrectNormal;

View File

@ -18,7 +18,7 @@ int main(int argc, char *argv[])
Dialog_logIn login; Dialog_logIn login;
if (login.exec()) if (login.exec())
{ {
MainWindow w(login.GetLogInType(), login.GetProfileName(), login.GetAccountName(), login.GetFtpHost(), login.GetFtpPort()); MainWindow w(login.GetAccountName(), login.GetDeviceType(), login.GetDeviceConfig(), login.GetLogInType());
a.exec(); a.exec();
if (w.isExitApp()) if (w.isExitApp())
{ {

View File

@ -1,4 +1,4 @@
#include "mainwindow.h" #include "mainwindow.h"
#include "ui_mainwindow.h" #include "ui_mainwindow.h"
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QTimer> #include <QTimer>
@ -14,20 +14,22 @@
#include "dialog_inputserialnum.h" #include "dialog_inputserialnum.h"
#include "dialog_hgmessagebox.h" #include "dialog_hgmessagebox.h"
MainWindow::MainWindow(Dialog_logIn::LogInType loginType, const QString &profileName, const QString &accountName, const QString &ftpHost, unsigned short ftpPort, QWidget *parent) MainWindow::MainWindow(const QString &accountName, Dialog_logIn::DeviceType deviceType, const QString &deviceConfig,
Dialog_logIn::LogInType loginType, QWidget *parent)
: QMainWindow(parent) : QMainWindow(parent)
, ui(new Ui::MainWindow) , ui(new Ui::MainWindow)
, m_ftpHost(ftpHost)
, m_ftpPort(ftpPort)
, m_lock(nullptr) , m_lock(nullptr)
, m_testingRef(0) , m_testingRef(0)
, m_loginType(loginType)
, m_accountName(accountName) , m_accountName(accountName)
, m_profileName(profileName) , m_deviceType(deviceType)
, m_deviceConfig(deviceConfig)
, m_loginType(loginType)
, m_formBurnMode(nullptr) , m_formBurnMode(nullptr)
, m_top_splitter(nullptr) , m_top_splitter(nullptr)
, m_bot_splitter(nullptr) , m_bot_splitter(nullptr)
, m_isLogOut(false) , m_isLogOut(false)
, m_burnDlg(nullptr)
, m_burnForm(nullptr)
, m_inputSnDlg(nullptr) , m_inputSnDlg(nullptr)
, m_tmpDevType("") , m_tmpDevType("")
{ {
@ -57,11 +59,9 @@ MainWindow::MainWindow(Dialog_logIn::LogInType loginType, const QString &profile
connect(this, SIGNAL(sane_dev_remove(QString)), this, SLOT(on_sane_dev_remove(QString)), Qt::QueuedConnection); connect(this, SIGNAL(sane_dev_remove(QString)), this, SLOT(on_sane_dev_remove(QString)), Qt::QueuedConnection);
connect(this, &MainWindow::sane_create_interface, this, &MainWindow::on_sane_create_interface, Qt::QueuedConnection); connect(this, &MainWindow::sane_create_interface, this, &MainWindow::on_sane_create_interface, Qt::QueuedConnection);
if (m_loginType == Dialog_logIn::LogInType_Burn) if ((m_deviceType == Dialog_logIn::DeviceType_G300 || m_deviceType == Dialog_logIn::DeviceType_G400)
&& m_loginType == Dialog_logIn::LogInType_Station1)
{ {
setWindowTitle(tr("production tool-burn station"));
// ui->act_newDevice->setVisible(false);
m_formBurnMode = new Form_BurnMode(this, this); m_formBurnMode = new Form_BurnMode(this, this);
QVBoxLayout *vLayout = new QVBoxLayout; QVBoxLayout *vLayout = new QVBoxLayout;
@ -71,8 +71,6 @@ MainWindow::MainWindow(Dialog_logIn::LogInType loginType, const QString &profile
} }
else else
{ {
// ui->act_refreshDevice->setVisible(true);
m_top_splitter = new QSplitter(Qt::Horizontal); m_top_splitter = new QSplitter(Qt::Horizontal);
m_bot_splitter = new QSplitter(Qt::Horizontal); m_bot_splitter = new QSplitter(Qt::Horizontal);
m_top_splitter->setMinimumWidth(600); m_top_splitter->setMinimumWidth(600);
@ -90,24 +88,24 @@ MainWindow::MainWindow(Dialog_logIn::LogInType loginType, const QString &profile
showMaximized(); showMaximized();
} }
QTimer *timer = new QTimer(this); if (m_deviceType == Dialog_logIn::DeviceType_G300 || m_deviceType == Dialog_logIn::DeviceType_G400)
timer->start(1000); {
connect(timer, SIGNAL(timeout()), this, SLOT(on_update_userStatus())); if (m_loginType == Dialog_logIn::LogInType_Station1)
setWindowTitle(tr("production tool-burn station"));
HGUInt userType = 0; else if (m_loginType == Dialog_logIn::LogInType_Station2)
//HGPdtToolDb_GetUserType(m_pdtToolDbuserMgr, &userType);
// if (userType == HGPDTTOOLDB_USERTYPE_NORMAL)
// {
// ui->act_manage->setVisible(false);
// ui->act_upload->setVisible(false);
// }
if (m_loginType == Dialog_logIn::LogInType_InitTest)
setWindowTitle(tr("production tool-init test station")); setWindowTitle(tr("production tool-init test station"));
else if (m_loginType == Dialog_logIn::LogInType_ImageTest) else if (m_loginType == Dialog_logIn::LogInType_Station3)
setWindowTitle(tr("production tool-image test station")); setWindowTitle(tr("production tool-image test station"));
if (m_loginType == Dialog_logIn::LogInType_PressureTest) }
setWindowTitle(tr("production tool-pressure test station")); else
{
if (m_loginType == Dialog_logIn::LogInType_Station1)
setWindowTitle(tr("production tool-init test station"));
else if (m_loginType == Dialog_logIn::LogInType_Station2)
setWindowTitle(tr("production tool-image test station"));
else if (m_loginType == Dialog_logIn::LogInType_Station3)
setWindowTitle(tr("production tool-finish test station"));
}
SANE_Int v = 0; SANE_Int v = 0;
sane_init_ex(&v, sane_ex_callback, this); sane_init_ex(&v, sane_ex_callback, this);
@ -138,9 +136,6 @@ MainWindow::~MainWindow()
sane_exit(); sane_exit();
//HGPdtToolDb_DestroyUserMgr(m_pdtToolDbuserMgr);
//m_pdtToolDbuserMgr = nullptr;
delete m_formBurnMode; delete m_formBurnMode;
m_formBurnMode = nullptr; m_formBurnMode = nullptr;
@ -346,7 +341,7 @@ int MainWindow::sane_ex_callback(SANE_Handle hdev, int code, void *data, unsigne
} }
else if (SANE_EVENT_IMAGE_OK == code) else if (SANE_EVENT_IMAGE_OK == code)
{ {
if (p->m_loginType != Dialog_logIn::LogInType_Burn) if (nullptr == p->m_formBurnMode)
{ {
Form_mainInterface* mainInterface = p->FindInterface(hdev); Form_mainInterface* mainInterface = p->FindInterface(hdev);
if (nullptr != mainInterface) if (nullptr != mainInterface)
@ -433,74 +428,22 @@ QString MainWindow::getDevFwNum(SANE_Handle handle)
void MainWindow::on_sane_dev_arrive(QString devName) void MainWindow::on_sane_dev_arrive(QString devName)
{ {
//// QTime curTimer = QTime::currentTime().addMSecs(5000);
//// while (QTime::currentTime() < curTimer)
//// {
//// QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
//// }
// if (m_loginType == Dialog_logIn::LogInType_Burn)
// {
// SANE_Handle devHandle = nullptr;
// sane_open(devName.toStdString().c_str(), &devHandle);
// if (nullptr != devHandle)
// {
// DeviceManager *devManager = new DeviceManager(this, m_formBurnMode, devHandle, devName);
// m_formBurnMode->addDevice(devManager);
// }
// return;
// }
// // QString str = tr("Confirm whether the device is reset");
// // Dialog_HGMessageBox dlg(str, this);
// // if (!dlg.exec())
// // {
// // return;
// // }
// SANE_Handle devHandle = nullptr;
// sane_open(devName.toStdString().c_str(), &devHandle);
// 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;
// }
} }
void MainWindow::on_sane_dev_remove(QString devName) void MainWindow::on_sane_dev_remove(QString devName)
{ {
if (m_loginType == Dialog_logIn::LogInType_Burn) if (nullptr != m_formBurnMode)
{ {
m_formBurnMode->deleteDevice(devName); m_formBurnMode->deleteDevice(devName);
} }
else else
{ {
if (nullptr != m_burnForm)
{
m_burnForm->deleteDevice(devName);
}
if (nullptr != m_inputSnDlg) if (nullptr != m_inputSnDlg)
{ {
m_inputSnDlg->Invalid(devName); m_inputSnDlg->Invalid(devName);
@ -520,7 +463,7 @@ void MainWindow::on_sane_dev_remove(QString devName)
void MainWindow::on_sane_create_interface(SaneParams *saneParams) void MainWindow::on_sane_create_interface(SaneParams *saneParams)
{ {
if (m_loginType != Dialog_logIn::LogInType_Burn) if (nullptr == m_formBurnMode)
{ {
Form_mainInterface* mainInterface = FindInterface(saneParams->hdev); Form_mainInterface* mainInterface = FindInterface(saneParams->hdev);
if (nullptr != mainInterface) if (nullptr != mainInterface)
@ -555,58 +498,34 @@ void MainWindow::on_sane_create_interface(SaneParams *saneParams)
saneParams = nullptr; saneParams = nullptr;
} }
void MainWindow::on_update_userStatus() void MainWindow::on_burnmode_refresh_clicked()
{ {
QString tips; if (nullptr != m_burnForm)
HGUInt userStatus = 0;
//HGPdtToolDb_GetUserStatus(m_pdtToolDbuserMgr, &userStatus);
// switch (userStatus)
// {
// case HGPDTTOOLDB_USERSTATUS_CONFLICT:
// tips = tr("Account login elsewhere");
// break;
// case HGPDTTOOLDB_USERSTATUS_REFUSE:
// tips = tr("You have been forced offline by the administrator account");
// break;
// case HGPDTTOOLDB_USERSTATUS_DBERROR:
// tips = tr("Data base error");
// break;
// default:
// break;
// }
// if (!tips.isEmpty())
// {
// if (!isTesting())
// {
// QMessageBox::information(this, (tr("tips")), tips);
// m_isLogOut = true;
// close();
// }
// }
}
void MainWindow::on_act_newDevice_triggered()
{
m_inputSnDlg = new Dialog_InputSerialNum(this, m_loginType, "", m_profileName, m_accountName, nullptr, "", "");
if (m_inputSnDlg->exec())
{ {
//HGPdtToolDbDevice pdtToolDbDevice = nullptr; std::vector<std::string> name;
//HGPdtToolDb_OpenDevice(m_pdtToolDbuserMgr, m_inputSnDlg->GetSn().toStdString().c_str(), &pdtToolDbDevice); name = getDevices();
Form_mainInterface *mainInterface = new Form_mainInterface(this, m_loginType, m_profileName, m_accountName, nullptr, m_burnForm->clearDevice();
m_inputSnDlg->GetSn(), m_inputSnDlg->GetDevType(), nullptr, nullptr);
if (!AddInterface(mainInterface)) for (int i = 0; i < name.size(); ++i)
{ {
QMessageBox::information(this, tr("tips"), tr("cannot create more table")); SANE_Handle devHandle = nullptr;
delete mainInterface; sane_open(name[i].c_str(), &devHandle);
if (nullptr != devHandle)
{
DeviceManager *devManager = new DeviceManager(this, m_burnForm, devHandle, m_deviceConfig, name[i].c_str(), getDevSn(devHandle));
m_burnForm->addDevice(devManager);
}
} }
} }
delete m_inputSnDlg;
m_inputSnDlg = nullptr;
} }
void MainWindow::on_burnmode_ok_clicked()
{
if (nullptr != m_burnDlg)
m_burnDlg->accept();
}
void MainWindow::on_act_manage_triggered() void MainWindow::on_act_manage_triggered()
{ {
Dialog_accountManage dlg(this); Dialog_accountManage dlg(this);
@ -619,22 +538,6 @@ void MainWindow::on_act_changePwd_triggered()
dlg.exec(); dlg.exec();
} }
void MainWindow::on_act_export_triggered()
{
// QString filename = QFileDialog::getSaveFileName(this, tr("save"), "test.xls", tr("xls(*.xls)"));
// if (!filename.isEmpty())
// {
// if (HGBASE_ERR_OK == HGPdtToolDb_Export(m_pdtToolDbuserMgr, getStdString(filename).c_str()))
// {
// QMessageBox::information(this, tr("tips"), tr("export succeed"));
// }
// else
// {
// QMessageBox::information(this, tr("tips"), tr("export failed"));
// }
// }
}
void MainWindow::on_act_logOut_triggered() void MainWindow::on_act_logOut_triggered()
{ {
if (isTesting()) if (isTesting())
@ -658,33 +561,6 @@ void MainWindow::on_act_close_triggered()
close(); close();
} }
QString MainWindow::getLogInfo(HGResult ret)
{
QString str;
// if (HGPDTTOOLDB_ERR_INVALID_USER == ret)
// {
// str = tr("Illegal user");
// }
// else if (HGPDTTOOLDB_ERR_WRONG_PASSWORD == ret)
// {
// str = tr("Wrong password");
// }
// else if (HGPDTTOOLDB_ERR_DATABASE == ret)
// {
// str = tr("Database error");
// }
// else if (HGPDTTOOLDB_ERR_CONNECT == ret)
// {
// str = tr("connect error");
// }
// else
// {
// str = tr("Failed");
// }
return str;
}
void MainWindow::on_act_upload_triggered() void MainWindow::on_act_upload_triggered()
{ {
Dialog_uploadCfgFile dlg(this); Dialog_uploadCfgFile dlg(this);
@ -696,36 +572,128 @@ void MainWindow::on_act_refreshDevice_triggered()
std::vector<std::string> name; std::vector<std::string> name;
name = getDevices(); name = getDevices();
if (m_loginType == Dialog_logIn::LogInType_Burn) if (nullptr != m_formBurnMode)
{ {
m_formBurnMode->clearDevice();
for (int i = 0; i < name.size(); ++i) for (int i = 0; i < name.size(); ++i)
{ {
SANE_Handle devHandle = nullptr; SANE_Handle devHandle = nullptr;
sane_open(name[i].c_str(), &devHandle); sane_open(name[i].c_str(), &devHandle);
if (nullptr != devHandle) if (nullptr != devHandle)
{ {
DeviceManager *devManager = new DeviceManager(this, m_formBurnMode, devHandle, m_profileName, name[i].c_str(), getDevSn(devHandle)); DeviceManager *devManager = new DeviceManager(this, m_formBurnMode, devHandle, m_deviceConfig, name[i].c_str(), getDevSn(devHandle));
m_formBurnMode->addDevice(devManager); m_formBurnMode->addDevice(devManager);
} }
} }
return; return;
} }
if (m_top_splitter->count() > 0 || m_bot_splitter->count() > 0)
{
return;
}
// G100和G200的初检工位
if (m_loginType == Dialog_logIn::LogInType_Station1)
{
m_burnDlg = new QDialog(this);
m_burnDlg->setWindowTitle(tr("burn mode"));
m_burnDlg->setFixedSize(800, 600);
m_burnDlg->setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint);
QFont ft;
ft.setPointSize(15);
m_burnDlg->setFont(ft);
QVBoxLayout *vLayout = new QVBoxLayout(m_burnDlg);
m_burnForm = new Form_BurnMode(this, m_burnDlg);
vLayout->addWidget(m_burnForm);
QHBoxLayout *hLayout = new QHBoxLayout(m_burnDlg);
hLayout->addStretch();
QPushButton *refreshBtn = new QPushButton(tr("Refresh(F5)"));
refreshBtn->setFixedSize(186, 35);
refreshBtn->setShortcut(QKeySequence("F5"));
connect(refreshBtn, &QPushButton::clicked, this, &MainWindow::on_burnmode_refresh_clicked);
QPushButton *okBtn = new QPushButton(tr("Start Init Test"));
okBtn->setFixedSize(186, 35);
connect(okBtn, &QPushButton::clicked, this, &MainWindow::on_burnmode_ok_clicked);
hLayout->addWidget(refreshBtn);
hLayout->addWidget(okBtn);
vLayout->addLayout(hLayout);
m_burnDlg->setLayout(vLayout);
for (int i = 0; i < name.size(); ++i)
{
SANE_Handle devHandle = nullptr;
sane_open(name[i].c_str(), &devHandle);
if (nullptr != devHandle)
{
DeviceManager *devManager = new DeviceManager(this, m_burnForm, devHandle, m_deviceConfig, name[i].c_str(), getDevSn(devHandle));
m_burnForm->addDevice(devManager);
}
}
bool ok = true;
if (!m_burnDlg->exec())
ok = false;
delete m_burnForm;
m_burnForm = nullptr;
delete m_burnDlg;
m_burnDlg = nullptr;
if (!ok)
{
return;
}
}
for (int i = 0; i < name.size(); ++i) for (int i = 0; i < name.size(); ++i)
{ {
SANE_Handle devHandle = nullptr; SANE_Handle devHandle = nullptr;
sane_open(name[i].c_str(), &devHandle); sane_open(name[i].c_str(), &devHandle);
if (nullptr != devHandle) if (nullptr != devHandle)
{ {
m_inputSnDlg = new Dialog_InputSerialNum(this, m_loginType, name[i].c_str(), m_profileName, m_accountName, devHandle, getDevSn(devHandle), getDevType(devHandle)); bool canSetSN = false;
if (m_deviceType == Dialog_logIn::DeviceType_G300 || m_deviceType == Dialog_logIn::DeviceType_G400)
{
if (m_loginType == Dialog_logIn::LogInType_Station2)
canSetSN = true;
}
else
{
if (m_loginType == Dialog_logIn::LogInType_Station1)
canSetSN = true;
}
m_inputSnDlg = new Dialog_InputSerialNum(this, name[i].c_str(), m_deviceConfig, m_accountName,
devHandle, getDevSn(devHandle), getDevType(devHandle), canSetSN);
if (m_inputSnDlg->exec()) if (m_inputSnDlg->exec())
{ {
//HGPdtToolDbDevice pdtToolDbDevice = nullptr; QString logInTypeStr;
//HGPdtToolDb_OpenDevice(m_pdtToolDbuserMgr, m_inputSnDlg->GetSn().toStdString().c_str(), &pdtToolDbDevice); if (m_deviceType == Dialog_logIn::DeviceType_G300 || m_deviceType == Dialog_logIn::DeviceType_G400)
{
if (m_loginType == Dialog_logIn::LogInType_Station1)
logInTypeStr = QStringLiteral("烧录工位");
else if (m_loginType == Dialog_logIn::LogInType_Station2)
logInTypeStr = QStringLiteral("初检工位");
else if (m_loginType == Dialog_logIn::LogInType_Station3)
logInTypeStr = QStringLiteral("图像测试工位");
}
else
{
if (m_loginType == Dialog_logIn::LogInType_Station1)
logInTypeStr = QStringLiteral("初检工位");
else if (m_loginType == Dialog_logIn::LogInType_Station2)
logInTypeStr = QStringLiteral("图像测试工位");
else if (m_loginType == Dialog_logIn::LogInType_Station3)
logInTypeStr = QStringLiteral("成品检验工位");
}
Form_mainInterface *mainInterface = new Form_mainInterface(this, m_loginType, m_profileName, m_accountName, devHandle, Form_mainInterface *mainInterface = new Form_mainInterface(this, m_deviceConfig, m_accountName, devHandle,
m_inputSnDlg->GetSn(), m_inputSnDlg->GetDevType(), name[i].c_str(), getDevFwNum(devHandle)); m_inputSnDlg->GetSn(), m_inputSnDlg->GetDevType(), name[i].c_str(), getDevFwNum(devHandle), logInTypeStr);
if (!AddInterface(mainInterface)) if (!AddInterface(mainInterface))
{ {
QMessageBox::information(this, tr("tips"), tr("cannot create more table")); QMessageBox::information(this, tr("tips"), tr("cannot create more table"));

View File

@ -6,7 +6,6 @@
#include "form_maininterface.h" #include "form_maininterface.h"
#include <QtWidgets> #include <QtWidgets>
#include <QSplitter> #include <QSplitter>
//#include "HGPdtToolDb.h"
#include "sane/sane_ex.h" #include "sane/sane_ex.h"
#include "base/HGLock.h" #include "base/HGLock.h"
#include "hgscanner.h" #include "hgscanner.h"
@ -21,9 +20,9 @@ class MainWindow : public QMainWindow
Q_OBJECT Q_OBJECT
public: public:
MainWindow(Dialog_logIn::LogInType loginType, const QString &profileName, const QString &accountName, const QString &ftpHost, unsigned short ftpPort, QWidget *parent = nullptr); MainWindow(const QString &accountName, Dialog_logIn::DeviceType deviceType, const QString &deviceConfig,
Dialog_logIn::LogInType loginType, QWidget *parent = nullptr);
~MainWindow(); ~MainWindow();
static QString getLogInfo(HGResult ret);
bool isExitApp(); bool isExitApp();
void updateSplitter(); void updateSplitter();
@ -64,17 +63,15 @@ private slots:
void on_sane_dev_arrive(QString devName); void on_sane_dev_arrive(QString devName);
void on_sane_dev_remove(QString devName); void on_sane_dev_remove(QString devName);
void on_sane_create_interface(SaneParams *saneParams); void on_sane_create_interface(SaneParams *saneParams);
void on_update_userStatus(); void on_burnmode_refresh_clicked();
void on_burnmode_ok_clicked();
private slots: private slots:
void on_act_newDevice_triggered();
void on_act_manage_triggered(); void on_act_manage_triggered();
void on_act_changePwd_triggered(); void on_act_changePwd_triggered();
void on_act_export_triggered();
void on_act_logOut_triggered(); void on_act_logOut_triggered();
void on_act_close_triggered(); void on_act_close_triggered();
@ -95,19 +92,19 @@ private:
private: private:
Ui::MainWindow *ui; Ui::MainWindow *ui;
//HGPdtToolDbUserMgr m_pdtToolDbuserMgr;
HGLock m_lock; HGLock m_lock;
int m_testingRef; int m_testingRef;
Dialog_logIn::LogInType m_loginType;
QString m_accountName; QString m_accountName;
QString m_profileName; Dialog_logIn::DeviceType m_deviceType;
QString m_deviceConfig;
Dialog_logIn::LogInType m_loginType;
class QDialog *m_burnDlg;
Form_BurnMode *m_burnForm;
class Dialog_InputSerialNum *m_inputSnDlg; class Dialog_InputSerialNum *m_inputSnDlg;
Form_BurnMode *m_formBurnMode; Form_BurnMode *m_formBurnMode;
public: public:
QString m_ftpHost;
unsigned short m_ftpPort;
QString m_tmpDevType; QString m_tmpDevType;
}; };
#endif // MAINWINDOW_H #endif // MAINWINDOW_H

View File

@ -27,7 +27,6 @@
<property name="title"> <property name="title">
<string>menu_device</string> <string>menu_device</string>
</property> </property>
<addaction name="act_newDevice"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="act_refreshDevice"/> <addaction name="act_refreshDevice"/>
<addaction name="separator"/> <addaction name="separator"/>