diff --git a/app/HGProductionTool/HGProductionTool.pro b/app/HGProductionTool/HGProductionTool.pro
index c570384..6719b36 100644
--- a/app/HGProductionTool/HGProductionTool.pro
+++ b/app/HGProductionTool/HGProductionTool.pro
@@ -74,7 +74,7 @@ win32 {
}
SOURCES += \
- HGString.cpp \
+ ../../../code_app/utility/HGString.cpp \
app_cfg.cpp \
HGImgView.cpp \
HGUIGlobal.cpp \
@@ -99,7 +99,7 @@ SOURCES += \
ui_helper.cpp
HEADERS += \
- HGString.h \
+ ../../../code_app/utility/HGString.h \
app_cfg.h \
HGImgView.h \
HGUIGlobal.h \
diff --git a/app/HGProductionTool/ProductionTool_zh_CN.qm b/app/HGProductionTool/ProductionTool_zh_CN.qm
index 09e182e..b5688e1 100644
Binary files a/app/HGProductionTool/ProductionTool_zh_CN.qm and b/app/HGProductionTool/ProductionTool_zh_CN.qm differ
diff --git a/app/HGProductionTool/ProductionTool_zh_CN.ts b/app/HGProductionTool/ProductionTool_zh_CN.ts
index 8e03d34..258786a 100644
--- a/app/HGProductionTool/ProductionTool_zh_CN.ts
+++ b/app/HGProductionTool/ProductionTool_zh_CN.ts
@@ -434,8 +434,9 @@
-
- 显示密码
+
+ Show password
+ 记住密码
@@ -458,22 +459,22 @@
FTP端口:
-
+
烧录工位
-
+
初检工位
-
+
图像测试工位
-
+
压力测试工位
@@ -530,35 +531,35 @@
登录
-
-
-
-
+
+
+
+
提示
-
+
账户不存在
-
+
密码不能为空
-
+
密码错误
-
+
请先选择配置文件
-
+
选择配置文件
@@ -714,52 +715,195 @@
烧录模式
-
-
- 全选
+
+
+ 进入烧录模式
+
+
+
+
+ 确认烧录完成并重启
+
+
+
+
+ 检查配置是否一致
+
+
+
+
+ 完成
+
+
+
+
+ 异常退出
+
+
+
+ 全选
-
- 进入烧录模式
+ 进入烧录模式
设置勾选项序列号
-
- 关闭设备
+ 关闭设备
-
+
序号
-
+
选择
-
+
设备
+
+
+
+ 目标配置:
+
+
+
+
+
+ 速度模式: %1PPM
+
+
+
+
+
+ 休眠时间: %1分钟
+
+
+
+
+
+ 休眠时间: 不休眠
+
+
+
+
+
+ Vid: %1 Pid: %2
+
+
+
+
+
+ 当前设备配置:
+
+
+
+
+
+ 速度模式: %1PPM
+
+
+
+
+
+ 休眠时间: %1分钟
+
+
+
+
+
+ 休眠时间: 不休眠
+
+
+
+
+
+ Vid: %1 Pid: %2
+
+
+
+
+ Complete burning and configure device parameters:
+ 完成烧录并且配置设备参数:
+
+
+
+
+ Speed time
+ 速度模式
+
+
+
+
+ 测试员: %1, 测试项: 烧录, 测试完成!
+
+
+
+
+ 测试员: %1, 测试项: 烧录, 测试失败! 原因:%2
+
+
+
+
+ 测试员: %1, 测试项: 烧录, 测试内容: %2
+
+
+
+ 当前设备配置:
+
+
+
+
+
+ 休眠时间
+
+
+
+
+ Vid和Pid
+
+
+
+
+
+ 提示
+
+
+
+
+ 检测到配置%1不一致,已重新配置,请再次检查
+
+
+
+
+ 配置一致!
+
序列号
-
-
+
提示
-
-
+
请至少勾选一台设备
@@ -1013,7 +1157,7 @@
-
+
不休眠
@@ -1040,46 +1184,46 @@
设备序列号: %1, 测试项: %2, 测试结果: 通过!
-
-
+
+
设备历史扫描张数:
-
-
-
-
+
+
+
+
提示
-
+
测试员: %1, 测试项: %2, 测试结果: 不通过! 原因: %3
-
+
测试员: %1, 测试项: %2, 测试结果: 通过!
-
+
无纸
-
+
设备处于休眠模式
-
+
设备处于计数模式
-
+
其他错误
@@ -1088,37 +1232,39 @@
设备序列号:%1
-
+
序号
-
+
测试项
-
+
测试状态
-
+
未测试
-
+
+
不通过
-
+
不支持
-
+
+
通过
@@ -1144,14 +1290,14 @@
Pid:
-
-
+
+
设备滚轴张数:
-
+
标准圆:宽 * 高:
@@ -1176,7 +1322,7 @@
-
+
分钟
@@ -1213,7 +1359,7 @@
- 设备
+ F5-刷新设备列表
diff --git a/app/HGProductionTool/app_cfg.cpp b/app/HGProductionTool/app_cfg.cpp
index 8740d94..10b4d3c 100644
--- a/app/HGProductionTool/app_cfg.cpp
+++ b/app/HGProductionTool/app_cfg.cpp
@@ -17,27 +17,27 @@ QString getCfgValue(const char *appName, const char *key, const QString &def)
return StdStringToUtf8(value).c_str();
}
-//int getCfgValue(const char *appName, const char *key, int def)
-//{
-// HGChar cfgPath[512];
-// HGBase_GetConfigPath(cfgPath, 512);
-// strcat(cfgPath, "config.ini");
+int getCfgValue(const char *appName, const char *key, int def)
+{
+ HGChar cfgPath[512];
+ HGBase_GetConfigPath(cfgPath, 512);
+ strcat(cfgPath, "config.ini");
-// HGInt value = 0;
-// HGBase_GetProfileInt(cfgPath, appName, key, def, &value);
-// return value;
-//}
+ HGInt value = 0;
+ HGBase_GetProfileInt(cfgPath, appName, key, def, &value);
+ return value;
+}
-//bool getCfgValue(const char *appName, const char *key, bool def)
-//{
-// HGChar cfgPath[512];
-// HGBase_GetConfigPath(cfgPath, 512);
-// strcat(cfgPath, "config.ini");
+bool getCfgValue(const char *appName, const char *key, bool def)
+{
+ HGChar cfgPath[512];
+ HGBase_GetConfigPath(cfgPath, 512);
+ strcat(cfgPath, "config.ini");
-// HGInt value = 0;
-// HGBase_GetProfileInt(cfgPath, appName, key, (HGInt)def, &value);
-// return (bool)value;
-//}
+ HGInt value = 0;
+ HGBase_GetProfileInt(cfgPath, appName, key, (HGInt)def, &value);
+ return (bool)value;
+}
void saveCfgValue(const char *appName, const char *key, const QString &value)
{
@@ -49,22 +49,22 @@ void saveCfgValue(const char *appName, const char *key, const QString &value)
HGBase_SetProfileString(cfgPath, appName, key, getStdString(value).c_str());
}
-//void saveCfgValue(const char *appName, const char *key, int value)
-//{
-// HGChar cfgPath[512];
-// HGBase_GetConfigPath(cfgPath, 512);
-// HGBase_CreateDir(cfgPath);
-// strcat(cfgPath, "config.ini");
+void saveCfgValue(const char *appName, const char *key, int value)
+{
+ HGChar cfgPath[512];
+ HGBase_GetConfigPath(cfgPath, 512);
+ HGBase_CreateDir(cfgPath);
+ strcat(cfgPath, "config.ini");
-// HGBase_SetProfileInt(cfgPath, appName, key, value);
-//}
+ HGBase_SetProfileInt(cfgPath, appName, key, value);
+}
-//void saveCfgValue(const char *appName, const char *key, bool value)
-//{
-// HGChar cfgPath[512];
-// HGBase_GetConfigPath(cfgPath, 512);
-// HGBase_CreateDir(cfgPath);
-// strcat(cfgPath, "config.ini");
+void saveCfgValue(const char *appName, const char *key, bool value)
+{
+ HGChar cfgPath[512];
+ HGBase_GetConfigPath(cfgPath, 512);
+ HGBase_CreateDir(cfgPath);
+ strcat(cfgPath, "config.ini");
-// HGBase_SetProfileInt(cfgPath, appName, key, (HGInt)value);
-//}
+ HGBase_SetProfileInt(cfgPath, appName, key, (HGInt)value);
+}
diff --git a/app/HGProductionTool/app_cfg.h b/app/HGProductionTool/app_cfg.h
index 4299390..0b5d122 100644
--- a/app/HGProductionTool/app_cfg.h
+++ b/app/HGProductionTool/app_cfg.h
@@ -4,11 +4,11 @@
#include
QString getCfgValue(const char *appName, const char *key, const QString &def);
-//int getCfgValue(const char *appName, const char *key, int def);
-//bool getCfgValue(const char *appName, const char *key, bool def);
+int getCfgValue(const char *appName, const char *key, int def);
+bool getCfgValue(const char *appName, const char *key, bool def);
void saveCfgValue(const char *appName, const char *key, const QString &value);
-//void saveCfgValue(const char *appName, const char *key, int value);
-//void saveCfgValue(const char *appName, const char *key, bool value);
+void saveCfgValue(const char *appName, const char *key, int value);
+void saveCfgValue(const char *appName, const char *key, bool value);
#endif /* __APP_CFG_H__ */
diff --git a/app/HGProductionTool/dialog_inputserialnum.cpp b/app/HGProductionTool/dialog_inputserialnum.cpp
index 7bc2773..611203e 100644
--- a/app/HGProductionTool/dialog_inputserialnum.cpp
+++ b/app/HGProductionTool/dialog_inputserialnum.cpp
@@ -101,30 +101,30 @@ void Dialog_InputSerialNum::setSpeedAndSleep(bool updateSleep)
return;
}
- 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;
- m_mainWnd->addTestingRef();
- func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp, m_hg);
+// 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;
+// m_mainWnd->addTestingRef();
+// func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp, m_hg);
- int speedMode = jsonGlobal.speed_mode ;
- lp->cat = WRITE_CAT_SPEED;
- lp->val = (void*)&speedMode;
- m_mainWnd->addTestingRef();
- func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp, m_hg);
+// int speedMode = jsonGlobal.speed_mode ;
+// lp->cat = WRITE_CAT_SPEED;
+// lp->val = (void*)&speedMode;
+// m_mainWnd->addTestingRef();
+// func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp, m_hg);
- QString device_model = jsonGlobal.device_model;
- if (!device_model.isEmpty())
- {
- std::wstring devModel = device_model.toStdWString();
- lp->cat = WRITE_CAT_DEVS_MODEL;
- lp->val = (void*)devModel.c_str();
- m_mainWnd->addTestingRef();
- func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp, m_hg);
- }
+// QString device_model = jsonGlobal.device_model;
+// if (!device_model.isEmpty())
+// {
+// std::wstring devModel = device_model.toStdWString();
+// lp->cat = WRITE_CAT_DEVS_MODEL;
+// lp->val = (void*)devModel.c_str();
+// m_mainWnd->addTestingRef();
+// func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp, m_hg);
+// }
delete lp;
}
diff --git a/app/HGProductionTool/dialog_login.cpp b/app/HGProductionTool/dialog_login.cpp
index 5cc03e6..8cd38e9 100644
--- a/app/HGProductionTool/dialog_login.cpp
+++ b/app/HGProductionTool/dialog_login.cpp
@@ -26,6 +26,8 @@ Dialog_logIn::Dialog_logIn(QWidget *parent) :
ui->pbtn_setting->setVisible(false);
ui->radioButton_pressureTest->setVisible(false);
+ saveCfgValue("admin", "password", getCfgValue("admin", "password", QString("huagaoadmin")));
+
ui->pbtn_setting->setToolTip(tr("Set host and port"));
ui->pbtn_minum->setToolTip(tr("Minimize"));
ui->pbtn_close->setToolTip(tr("Close"));
@@ -34,7 +36,24 @@ Dialog_logIn::Dialog_logIn(QWidget *parent) :
ui->lineEdit_profilePath->setReadOnly(true);
m_profileName = getCfgValue("login", "profile", m_profileName);
+ ui->lineEdit_account->setText(getCfgValue("login", "account", QString("")));
ui->lineEdit_profilePath->setText(m_profileName);
+ ui->checkBox_rememberPswd->setChecked(getCfgValue("login", "rememberPassword", false));
+ if (ui->lineEdit_account->text() == "admin")
+ ui->checkBox_rememberPswd->setChecked(false);
+
+ if (ui->checkBox_rememberPswd->isChecked())
+ {
+ QString account = ui->lineEdit_account->text();
+ QString cfgPassword = getCfgValue(account.toStdString().c_str(), "password", QString(""));
+
+ if (!cfgPassword.isEmpty())
+ {
+ ui->lineEdit_password->setText(getCfgValue(account.toStdString().c_str(), "password", QString("")));
+ }
+ }
+
+ 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]+$";
@@ -49,13 +68,11 @@ Dialog_logIn::Dialog_logIn(QWidget *parent) :
// QString ftpHost("192.168.1.70");
// QString ftpPort("21");
- ui->lineEdit_account->setText(getCfgValue("login", "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));
// ui->lineEdit_ftpPort->setText(getCfgValue("login", "ftpPort", ftpPort));
-
- ui->stackedWidget->setCurrentIndex(0);
}
Dialog_logIn::~Dialog_logIn()
@@ -124,7 +141,7 @@ void Dialog_logIn::on_pbtn_login_clicked()
QString account = ui->lineEdit_account->text();
QString password = ui->lineEdit_password->text();
- QString cfgPassword = getCfgValue(account.toStdString().c_str(), "password", "");
+ QString cfgPassword = getCfgValue(account.toStdString().c_str(), "password", QString(""));
if (cfgPassword.isEmpty())
{
QMessageBox::information(this, tr("Prompt"), tr("Account dose not exist"));
@@ -227,7 +244,7 @@ void Dialog_logIn::on_pbtn_selectCfgFile_clicked()
saveCfgValue("login", "profile", m_profileName);
}
-void Dialog_logIn::on_checkBox_showPassword_toggled(bool checked)
+void Dialog_logIn::on_checkBox_rememberPswd_toggled(bool checked)
{
- ui->lineEdit_password->setEchoMode(checked ? QLineEdit::Normal : QLineEdit::Password);
+ saveCfgValue("login", "rememberPassword", checked);
}
diff --git a/app/HGProductionTool/dialog_login.h b/app/HGProductionTool/dialog_login.h
index b295799..b894648 100644
--- a/app/HGProductionTool/dialog_login.h
+++ b/app/HGProductionTool/dialog_login.h
@@ -48,7 +48,7 @@ private slots:
void on_pbtn_selectCfgFile_clicked();
- void on_checkBox_showPassword_toggled(bool checked);
+ void on_checkBox_rememberPswd_toggled(bool checked);
private:
Ui::Dialog_logIn *ui;
diff --git a/app/HGProductionTool/dialog_login.ui b/app/HGProductionTool/dialog_login.ui
index 78dcf2f..9e5d080 100644
--- a/app/HGProductionTool/dialog_login.ui
+++ b/app/HGProductionTool/dialog_login.ui
@@ -216,17 +216,17 @@ QPushButton#pbtn_close::hover
-
+
310
90
- 111
+ 121
21
- Show password
+ remember password
diff --git a/app/HGProductionTool/dialog_registeraccount.cpp b/app/HGProductionTool/dialog_registeraccount.cpp
index 811c79e..388f64f 100644
--- a/app/HGProductionTool/dialog_registeraccount.cpp
+++ b/app/HGProductionTool/dialog_registeraccount.cpp
@@ -36,7 +36,7 @@ void Dialog_RegisterAccount::on_pushButton_register_clicked()
return;
}
- QString account = getCfgValue(ui->lineEdit_account->text().toStdString().c_str(), "password", "");
+ QString account = getCfgValue(ui->lineEdit_account->text().toStdString().c_str(), "password", QString(""));
if (!account.isEmpty())
{
QMessageBox::information(this, tr("Prompt"), tr("User already exists"));
diff --git a/app/HGProductionTool/form_burnmode.cpp b/app/HGProductionTool/form_burnmode.cpp
index 6d345c3..d5f35af 100644
--- a/app/HGProductionTool/form_burnmode.cpp
+++ b/app/HGProductionTool/form_burnmode.cpp
@@ -6,19 +6,29 @@
#include "analysisjson.h"
#include "base/HGBase.h"
#include "HGUIGlobal.h"
+#include "dialog_excepdesc.h"
#include
#include
#include
-Form_BurnMode::Form_BurnMode(class MainWindow *mainwnd, QWidget *parent) :
+Form_BurnMode::Form_BurnMode(class MainWindow *mainwnd, const QString &profileName, const QString &accountName, QWidget *parent) :
QWidget(parent),
m_curIndex(0),
+ m_profileName(profileName),
+ m_accountName(accountName),
m_mainwnd(mainwnd),
+ m_hg(nullptr),
ui(new Ui::Form_BurnMode)
{
ui->setupUi(this);
- ui->pbtn_close->setVisible(false);
+ ui->textEdit_target->setReadOnly(true);
+ ui->textEdit_curConfig->setReadOnly(true);
+
+ ui->pbtn_enterBurnMode->setEnabled(true);
+ ui->pbtn_confirmFinishBurn->setEnabled(false);
+ ui->pbtn_checkConfig->setEnabled(false);
+ ui->pbtn_complete->setEnabled(false);
connect(this, SIGNAL(testResult(bool)), this, SLOT(on_testResult(bool)), Qt::QueuedConnection);
@@ -48,6 +58,8 @@ void Form_BurnMode::addDevice(DeviceManager *devManager)
item->setData(Qt::UserRole, var);
updatetablewidget();
+ updateTargetCfg();
+ updateCurDeviceCfg();
m_curIndex++;
}
@@ -72,11 +84,28 @@ void Form_BurnMode::deleteDevice(QString devName)
}
}
updatetablewidget();
+ updateTargetCfg();
+ updateCurDeviceCfg();
+}
+
+DeviceManager *Form_BurnMode::getDevManager()
+{
+ for(int i = 0; i < ui->tableWidget->rowCount(); i++)
+ {
+ QTableWidgetItem *item = ui->tableWidget->item(i, 1);
+ if (item != nullptr && Qt::Checked == item->checkState())
+ {
+ DeviceManager *devManager = (DeviceManager*)item->data(Qt::UserRole).value();
+ return devManager;
+ }
+ }
+
+ return nullptr;
}
void Form_BurnMode::on_testResult(bool setStatus)
{
- m_mainwnd->releaseTesting();
+ //m_mainwnd->releaseTesting();
}
void Form_BurnMode::initTableWidget()
@@ -108,7 +137,7 @@ void Form_BurnMode::initTableWidget()
ui->tableWidget->clearContents();
}
-void Form_BurnMode::updatetablewidget()
+void Form_BurnMode:: updatetablewidget()
{
for(int i = 0; i < ui->tableWidget->rowCount(); i++)
{
@@ -121,28 +150,119 @@ void Form_BurnMode::updatetablewidget()
if (item != nullptr)
item->setCheckState(Qt::Checked);
}
- ui->cbox_selectAll->setChecked(true);
+ //ui->cbox_selectAll->setChecked(true);
}
-void Form_BurnMode::on_cbox_selectAll_stateChanged(int arg1)
+void Form_BurnMode::updateTargetCfg()
{
- (void)arg1;
- bool check = ui->cbox_selectAll->isChecked();
+ ui->textEdit_target->clear();
- for(int i = 0; i < ui->tableWidget->rowCount(); i++)
- {
- QTableWidgetItem *item = ui->tableWidget->item(i, 1);
- if (item != nullptr)
- {
- if (check)
- item->setCheckState(Qt::Checked);
- else
- item->setCheckState(Qt::Unchecked);
- }
- }
+ AnalysisJson analysisJson(m_profileName);
+ AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal();
+
+ int speedMode = jsonGlobal.speed_mode;
+ int sleepTime = jsonGlobal.sleep_time;
+ int vid_to = jsonGlobal.vid_to;
+ int pid_to = jsonGlobal.pid_to;
+
+ char buf[10];
+ sprintf(buf, "%x", vid_to);
+
+ char buf2[10];
+ sprintf(buf2, "%x", pid_to);
+
+ QString content;
+ content += tr("Target Configration:\n\t");
+ content += tr("Speep mode: %1PPM\n\t").arg(QString::number(speedMode));
+ content.append(sleepTime > 0 ? tr("Sleep time: %1minute\n\t").arg(QString::number(sleepTime)) : tr("Sleep time: Not sleeping\n\t"));
+ content += tr("Vid: %1 Pid: %2\n\t").arg(QString::fromStdString(buf)).arg(QString::fromStdString(buf2));
+
+ ui->textEdit_target->setText(content);
}
-void Form_BurnMode::on_pbtn_burn_clicked()
+void Form_BurnMode::updateCurDeviceCfg()
+{
+ ui->textEdit_curConfig->clear();
+
+ DeviceManager *devManager = getDevManager();
+ if (devManager == nullptr)
+ return;
+
+ int speedMode = devManager->getSpeedMode();
+ int sleepTime = devManager->getSleepTime();
+ int vid_to = devManager->getDevVid();
+ int pid_to = devManager->getDevPid();
+
+ char buf[10];
+ sprintf(buf, "%x", vid_to);
+
+ char buf2[10];
+ sprintf(buf2, "%x", pid_to);
+
+ QString content;
+ content.append(tr("Current Configration of device:") + "\n\t");
+ content.append(tr("Speep mode: %1PPM").arg(QString::number(speedMode)) + "\n\t");
+ content.append(sleepTime > 0 ? tr("Sleep time: %1minute").arg(QString::number(sleepTime)) : tr("Sleep time: Not sleeping") + "\n\t");
+ content.append(tr("Vid: %1 Pid: %2").arg(QString::fromStdString(buf)).arg(QString::fromStdString(buf2)) + "\n\t");
+
+ ui->textEdit_curConfig->setText(content);
+}
+
+QString Form_BurnMode::getLogPath()
+{
+ HGChar cachePath[512];
+ HGBase_GetDocumentsPath(cachePath, 512);
+ HGChar procName[512];
+ HGBase_GetProcessName(procName, 512);
+ strcat(cachePath, procName);
+ strcat(cachePath, "/Test_Log/");
+
+ return getStdFileName(cachePath);
+}
+
+void Form_BurnMode::writeTestLog(QString logContent)
+{
+ QString logPath = getLogPath();
+ HGBase_CreateDir(getStdString(logPath).c_str());
+
+ DeviceManager *devManager = getDevManager();
+ QString serialNum = devManager->getSerialNum();
+ QString fileName = logPath + serialNum + ".log";
+ QFile file(fileName);
+ if(!file.open(QIODevice::ReadWrite | QIODevice::Append))
+ {
+ return;
+ }
+
+ QDateTime dateTime= QDateTime::currentDateTime();
+ QString curTime = dateTime .toString("yyyy-MM-dd hh:mm:ss");
+ QString content = "[" + curTime + "] ";
+ content += logContent;
+
+ QTextStream txtOutput(&file);
+ txtOutput << content << endl;
+ file.close();
+}
+
+//void Form_BurnMode::on_cbox_selectAll_stateChanged(int arg1)
+//{
+// (void)arg1;
+// bool check = ui->cbox_selectAll->isChecked();
+
+// for(int i = 0; i < ui->tableWidget->rowCount(); i++)
+// {
+// QTableWidgetItem *item = ui->tableWidget->item(i, 1);
+// if (item != nullptr)
+// {
+// if (check)
+// item->setCheckState(Qt::Checked);
+// else
+// item->setCheckState(Qt::Unchecked);
+// }
+// }
+//}
+
+void Form_BurnMode::on_pbtn_enterBurnMode_clicked()
{
int select = 0;
for(int i = 0; i < ui->tableWidget->rowCount(); i++)
@@ -166,16 +286,25 @@ void Form_BurnMode::on_pbtn_burn_clicked()
{
DeviceManager *devManager = (DeviceManager*)item->data(Qt::UserRole).value();
devManager->setBurnMode();
+
+ ui->pbtn_confirmFinishBurn->setEnabled(true);
+ ui->pbtn_checkConfig->setEnabled(false);
+ ui->pbtn_complete->setEnabled(false);
+
+ m_mainwnd->setLogOutStatus(false);
}
}
}
-DeviceManager::DeviceManager(class MainWindow *mainwnd, class Form_BurnMode *burnMode, SANE_Handle handle, const QString & devName)
+DeviceManager::DeviceManager(class MainWindow *mainwnd, class Form_BurnMode *burnMode, SANE_Handle handle,
+ const QString &profileName, const QString & devName, const QString &serialNum)
{
m_mainwnd = mainwnd;
m_burnMode = burnMode;
m_handle = handle;
+ m_profileName = profileName;
m_devName = devName;
+ m_serialNum = serialNum;
m_hg = new hgscanner(nullptr, m_burnMode, nullptr, m_handle);
}
@@ -193,14 +322,149 @@ QString DeviceManager::getDevName()
return m_devName;
}
+QString DeviceManager::getSerialNum()
+{
+ return m_serialNum;
+}
+
void DeviceManager::setBurnMode()
{
const wchar_t *p = L"1";
- m_mainwnd->addTestingRef();
+// m_mainwnd->addTestingRef();
func_test_go(HGPDTTOOLDB_NAME_REBOOT_DEVICE, p, m_hg);
}
+void DeviceManager::setSpeedMode()
+{
+ AnalysisJson analysisJson(m_profileName);
+ AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal();
+ LPWRITECFG lp = new WRITECFG;
+
+ 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);
+
+ delete lp;
+}
+
+void DeviceManager::setSleepTime()
+{
+ AnalysisJson analysisJson(m_profileName);
+ AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal();
+ LPWRITECFG lp = new WRITECFG;
+
+ 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);
+
+ delete lp;
+}
+
+void DeviceManager::setVidPid()
+{
+ AnalysisJson analysisJson(m_profileName);
+ 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);
+
+ delete lp;
+}
+
+void DeviceManager::rebootDevice()
+{
+ const wchar_t *p = L"0";
+ func_test_go(HGPDTTOOLDB_NAME_REBOOT_DEVICE, p, m_hg);
+}
+
+QString DeviceManager::getDevType()
+{
+ std::string firmWareNum;
+ unsigned int firmWareNumLen = 0;
+ if(SANE_STATUS_NO_MEM == sane_io_control(m_handle, IO_CTRL_CODE_GET_HARDWARE_VERSION, nullptr, &firmWareNumLen) && firmWareNumLen)
+ {
+ firmWareNum.resize(firmWareNumLen);
+ sane_io_control(m_handle, IO_CTRL_CODE_GET_HARDWARE_VERSION, &firmWareNum[0], &firmWareNumLen);
+ }
+
+ QString str = QString::fromStdString(firmWareNum.c_str());
+ return str.left(2) + "00";
+}
+
+int DeviceManager::getSpeedMode()
+{
+ SANE_Int speedMode = 0;
+ unsigned int len = sizeof(SANE_Int);
+ sane_io_control(m_handle, IO_CTRL_CODE_GET_SPEED_MODE, &speedMode, &len);
+
+ const wchar_t G100[6] = { 70,80,90,110 };
+ const wchar_t G200[6] = { 100,110,120,130 };
+ const wchar_t G300[6] = { 40,50,60,70 };
+ const wchar_t G400[6] = { 40,50,60,70,80 };
+
+ QString devType = getDevType();
+ int speed = 0;
+
+ if ((int)speedMode >= 40)
+ speed = (int)speedMode;
+ else
+ {
+ if (devType == "G100")
+ speed = G100[(int)speedMode - 1];
+ else if (devType == "G200")
+ speed = G200[(int)speedMode - 1];
+ else if (devType == "G300")
+ speed = G300[(int)speedMode - 1];
+ else if (devType == "G400")
+ speed = G400[(int)speedMode - 1];
+ }
+
+ return speed;
+}
+
+int DeviceManager::getSleepTime()
+{
+ int sleepTime = SANE_POWER_FIRST;
+ unsigned int len2 = sizeof(int);
+ sane_io_control(m_handle, IO_CTRL_CODE_GET_POWER_LEVEL, &sleepTime, &len2);
+
+ if (sleepTime > 99999 || sleepTime == -1)
+ return 0;
+
+ return (sleepTime / 60);
+}
+
+int DeviceManager::getDevVid()
+{
+ VIDPID vidpid;
+ int vidpid_val;
+ unsigned int len = sizeof(int);
+ sane_io_control(m_handle, IO_CTRL_CODE_GET_VIDPID, &vidpid_val, &len);
+ vidpid.Value = vidpid_val;
+ int vid = vidpid.VID;
+ return vid;
+}
+
+int DeviceManager::getDevPid()
+{
+ VIDPID vidpid;
+ int vidpid_val;
+ unsigned int len = sizeof(int);
+ sane_io_control(m_handle, IO_CTRL_CODE_GET_VIDPID, &vidpid_val, &len);
+ vidpid.Value = vidpid_val;
+ int pid = vidpid.PID;
+ return pid;
+}
+
void Form_BurnMode::on_tableWidget_itemDoubleClicked(QTableWidgetItem *item)
{
int row = item->row();
@@ -215,36 +479,157 @@ void Form_BurnMode::on_tableWidget_itemDoubleClicked(QTableWidgetItem *item)
}
}
-void Form_BurnMode::on_pbtn_close_clicked()
+//void Form_BurnMode::on_pbtn_close_clicked()
+//{
+// int select = 0;
+// for(int i = 0; i < ui->tableWidget->rowCount(); i++)
+// {
+// QTableWidgetItem *item = ui->tableWidget->item(i, 1);
+// if (item != nullptr && Qt::Checked == item->checkState())
+// {
+// select++;
+// }
+// }
+// if (select == 0)
+// {
+// QMessageBox::information(this, tr("tips"), tr("Please check a devices at least"));
+// return;
+// }
+
+// int rowCount = ui->tableWidget->rowCount();
+// for (int i = rowCount - 1; i >= 0; --i)
+// {
+// QTableWidgetItem *item = ui->tableWidget->item(i, 1);
+// if (item != nullptr && Qt::Checked == item->checkState())
+// {
+// DeviceManager *devManager = (DeviceManager*)item->data(Qt::UserRole).value();
+// delete devManager;
+
+// ui->tableWidget->removeRow(i);
+// m_curIndex--;
+// }
+// }
+
+// updatetablewidget();
+//}
+
+void Form_BurnMode::on_pbtn_confirmFinishBurn_clicked()
{
- int select = 0;
- for(int i = 0; i < ui->tableWidget->rowCount(); i++)
- {
- QTableWidgetItem *item = ui->tableWidget->item(i, 1);
- if (item != nullptr && Qt::Checked == item->checkState())
- {
- select++;
- }
- }
- if (select == 0)
- {
- QMessageBox::information(this, tr("tips"), tr("Please check a devices at least"));
+ DeviceManager *devManager = getDevManager();
+ if (devManager == nullptr)
return;
- }
- int rowCount = ui->tableWidget->rowCount();
- for (int i = rowCount - 1; i >= 0; --i)
- {
- QTableWidgetItem *item = ui->tableWidget->item(i, 1);
- if (item != nullptr && Qt::Checked == item->checkState())
- {
- DeviceManager *devManager = (DeviceManager*)item->data(Qt::UserRole).value();
- delete devManager;
+ devManager->setSpeedMode();
+ devManager->setSleepTime();
+ devManager->setVidPid();
+ devManager->rebootDevice();
- ui->tableWidget->removeRow(i);
- m_curIndex--;
- }
- }
+ AnalysisJson analysisJson(m_profileName);
+ AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal();
+ int speedMode_to = jsonGlobal.speed_mode;
+ int sleepTime_to = jsonGlobal.sleep_time;
+ int vid_to = jsonGlobal.vid_to;
+ int pid_to = jsonGlobal.pid_to;
- updatetablewidget();
+ char buf[10];
+ sprintf(buf, "%x", vid_to);
+
+ char buf2[10];
+ sprintf(buf2, "%x", pid_to);
+
+ QString content;
+ content.append(tr("Complete burning and configure device parameters: "));
+ content.append(tr("Speep mode: %1PPM").arg(QString::number(speedMode_to)) + " ");
+ content.append(sleepTime_to > 0 ? tr("Sleep time: %1minute").arg(QString::number(sleepTime_to)) : tr("Sleep time: Not sleeping") + " ");
+ content.append(tr("Vid: %1 Pid: %2").arg(QString::fromStdString(buf)).arg(QString::fromStdString(buf2)) + " ");
+ writeTestLog(tr("Tester: %1, Test item: Burn, Test contents: %2").arg(m_accountName).arg(content));
+
+ ui->pbtn_checkConfig->setEnabled(true);
+}
+
+void Form_BurnMode::on_pbtn_checkConfig_clicked()
+{
+ AnalysisJson analysisJson(m_profileName);
+ AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal();
+
+ int speedMode_to = jsonGlobal.speed_mode;
+ int sleepTime_to = jsonGlobal.sleep_time;
+ int vid_to = jsonGlobal.vid_to;
+ int pid_to = jsonGlobal.pid_to;
+
+ DeviceManager *devManager = getDevManager();
+ if (devManager == nullptr)
+ return;
+
+ int speedMode = devManager->getSpeedMode();
+ int sleepTime = devManager->getSleepTime();
+ int vid = devManager->getDevVid();
+ int pid = devManager->getDevPid();
+
+ QString item;
+ bool right = true;
+ LPWRITECFG lp = new WRITECFG;
+ if (speedMode_to != speedMode)
+ {
+ item.append(tr("Speed mode"));
+ item.append(" ");
+ right = false;
+ devManager->setSpeedMode();
+ }
+
+ if (sleepTime_to != sleepTime)
+ {
+ item.append(tr("Sleep time"));
+ item.append(" ");
+ right = false;
+ devManager->setSleepTime();
+ }
+
+ if (vid != vid_to || pid != pid_to)
+ {
+ item.append(tr("Vid and Pid"));
+ item.append(" ");
+ right = false;
+ devManager->setVidPid();
+ }
+
+ if (!right)
+ {
+ QMessageBox::information(this, tr("Prompt"), tr("Inconsistent configuration %1detected, reconfigured, please check again").arg(item));
+ }
+ else
+ {
+ QMessageBox::information(this, tr("Prompt"), tr("Consistent configuration"));
+
+ ui->pbtn_complete->setEnabled(true);
+ }
+
+ delete lp;
+
+ updateTargetCfg();
+ updateCurDeviceCfg();
+}
+
+void Form_BurnMode::on_pbtn_complete_clicked()
+{
+ writeTestLog(tr("Tester: %1, Test item: Burn, Test completed").arg(m_accountName));
+ ui->pbtn_enterBurnMode->setEnabled(true);
+ ui->pbtn_confirmFinishBurn->setEnabled(false);
+ ui->pbtn_checkConfig->setEnabled(false);
+ ui->pbtn_complete->setEnabled(false);
+
+ m_mainwnd->setLogOutStatus(true);
+}
+
+void Form_BurnMode::on_pbtn_abnormal_clicked()
+{
+ Dialog_ExcepDesc dlg;
+ if (dlg.exec())
+ {
+ QString str = dlg.getExcepDesc();
+ writeTestLog(tr("Tester: %1, Test item: Burn, Test result: Failed! Reason: %2")
+ .arg(m_accountName).arg(str));
+ }
+
+ m_mainwnd->setLogOutStatus(true);
}
diff --git a/app/HGProductionTool/form_burnmode.h b/app/HGProductionTool/form_burnmode.h
index 770e2b3..0db4447 100644
--- a/app/HGProductionTool/form_burnmode.h
+++ b/app/HGProductionTool/form_burnmode.h
@@ -14,11 +14,24 @@ class Form_BurnMode;
class DeviceManager
{
public:
- DeviceManager(class MainWindow *mainwnd, class Form_BurnMode *burnMode, SANE_Handle handle, const QString &devName);
+ DeviceManager(class MainWindow *mainwnd, class Form_BurnMode *burnMode, SANE_Handle handle,
+ const QString &profileName, const QString &devName, const QString &serialNum);
~DeviceManager();
QString getDevName();
+ QString getSerialNum();
void setBurnMode();
+ void setSpeedMode();
+ void setSleepTime();
+ void setVidPid();
+ void rebootDevice();
+
+ QString getDevType();
+ int getSpeedMode();
+ int getSleepTime();
+ int getDevVid();
+ int getDevPid();
+
SANE_Handle m_handle;
private:
@@ -36,6 +49,8 @@ private:
class MainWindow *m_mainwnd;
class Form_BurnMode *m_burnMode;
QString m_devName;
+ QString m_serialNum;
+ QString m_profileName;
hgscanner *m_hg;
};
@@ -45,12 +60,25 @@ class Form_BurnMode : public QWidget
Q_OBJECT
public:
- explicit Form_BurnMode(class MainWindow *mainwnd, QWidget *parent = nullptr);
+ explicit Form_BurnMode(class MainWindow *mainwnd, const QString &profileName, const QString &accountName, QWidget *parent = nullptr);
~Form_BurnMode();
void addDevice(DeviceManager *devManager);
void deleteDevice(QString devName);
+ DeviceManager *getDevManager();
+
+private:
+ union VIDPID
+ {
+ struct
+ {
+ unsigned short VID;
+ unsigned short PID;
+ };
+ unsigned int Value;
+ };
+
signals:
void testResult(bool setStatus);
@@ -58,25 +86,38 @@ private slots:
void on_testResult(bool setStatus);
private slots:
- void on_cbox_selectAll_stateChanged(int arg1);
+ //void on_cbox_selectAll_stateChanged(int arg1);
- void on_pbtn_burn_clicked();
-
-// void on_pbtn_setSn_clicked();
+ void on_pbtn_enterBurnMode_clicked();
void on_tableWidget_itemDoubleClicked(QTableWidgetItem *item);
- void on_pbtn_close_clicked();
+ //void on_pbtn_close_clicked();
+
+ void on_pbtn_confirmFinishBurn_clicked();
+
+ void on_pbtn_checkConfig_clicked();
+
+ void on_pbtn_complete_clicked();
+
+ void on_pbtn_abnormal_clicked();
private:
void initTableWidget();
void updatetablewidget();
+ void updateTargetCfg();
+ void updateCurDeviceCfg();
+ QString getLogPath();
+ void writeTestLog(QString logContent);
private:
Ui::Form_BurnMode *ui;
class MainWindow *m_mainwnd;
+ hgscanner *m_hg;
int m_curIndex;
+ QString m_profileName;
+ QString m_accountName;
};
#endif // FORM_BURNMODE_H
diff --git a/app/HGProductionTool/form_burnmode.ui b/app/HGProductionTool/form_burnmode.ui
index 13045db..df71c6a 100644
--- a/app/HGProductionTool/form_burnmode.ui
+++ b/app/HGProductionTool/form_burnmode.ui
@@ -6,60 +6,306 @@
0
0
- 527
- 321
+ 735
+ 718
Form
-
+
-
-
+
+
+
+ 16777215
+ 180
+
+
+
-
-
-
-
- Select All
+
+
+ -
+
+
+ Qt::Vertical
-
-
-
-
- 91
- 31
-
-
-
- Burn
-
-
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 33
+
+
+
+
+ -
+
+
-
+
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+
+ 190
+ 40
+
+
+
+
+ 190
+ 40
+
+
+
+ Qt::LeftToRight
+
+
+ Entering burning mode
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
-
-
-
+
+
+ Qt::Vertical
+
+
- 91
- 31
+ 20
+ 13
-
- Close
-
-
+
-
-
-
+
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+
+ 190
+ 40
+
+
+
+
+ 190
+ 40
+
+
+
+ Confirm completion of burning
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
- 43
- 23
+ 20
+ 13
+
+
+ -
+
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+
+ 190
+ 40
+
+
+
+
+ 190
+ 40
+
+
+
+ Qt::LeftToRight
+
+
+ Check configuration
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 13
+
+
+
+
+ -
+
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+
+ 190
+ 40
+
+
+
+
+ 190
+ 40
+
+
+
+ Qt::LeftToRight
+
+
+ Complete
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+
+
+ -
+
+
-
+
Qt::Horizontal
@@ -71,6 +317,25 @@
+ -
+
+
+
+ 141
+ 41
+
+
+
+
+ 141
+ 41
+
+
+
+ Abnormal exit
+
+
+
diff --git a/app/HGProductionTool/form_maininterface.cpp b/app/HGProductionTool/form_maininterface.cpp
index c0d6c1b..a5c74eb 100644
--- a/app/HGProductionTool/form_maininterface.cpp
+++ b/app/HGProductionTool/form_maininterface.cpp
@@ -336,6 +336,7 @@ void Form_mainInterface::on_pbtn_fail_clicked()
//ui->tableWidget->setItem(row, 2, new QTableWidgetItem(getItemStatusStr(HGPDTTOOLDB_ENTRYSTATUS_NOTPASS)));
ui->tableWidget->item(row, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
ui->tableWidget->item(row, 2)->setBackgroundColor(QColor(255,0,0));
+ ui->tableWidget->item(row, 2)->setText(tr("not pass"));
QString str = dlg.getExcepDesc();
std::string name = m_map_title_name.value(title).name.toStdString();
@@ -365,6 +366,7 @@ void Form_mainInterface::on_pbtn_pass_clicked()
//ui->tableWidget->setItem(row, 2, new QTableWidgetItem(getItemStatusStr(HGPDTTOOLDB_ENTRYSTATUS_PASS)));
ui->tableWidget->item(row, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
ui->tableWidget->item(row, 2)->setBackgroundColor(QColor(0,255,0));
+ ui->tableWidget->item(row, 2)->setText(tr("pass"));
QTableWidgetItem *item2 = ui->tableWidget->item(row, 2);
item2->setToolTip("");
diff --git a/app/HGProductionTool/mainwindow.cpp b/app/HGProductionTool/mainwindow.cpp
index 0439934..fb64350 100644
--- a/app/HGProductionTool/mainwindow.cpp
+++ b/app/HGProductionTool/mainwindow.cpp
@@ -34,6 +34,10 @@ MainWindow::MainWindow(Dialog_logIn::LogInType loginType, const QString &profile
ui->act_manage->setVisible(false);
ui->act_export->setVisible(false);
ui->act_upload->setVisible(false);
+ ui->act_openLog->setVisible(false);
+
+ if (m_accountName == "admin")
+ ui->act_openLog->setVisible(true);
ui->act_refreshDevice->setShortcut(QKeySequence("F5"));
@@ -54,7 +58,7 @@ MainWindow::MainWindow(Dialog_logIn::LogInType loginType, const QString &profile
// ui->act_newDevice->setVisible(false);
- m_formBurnMode = new Form_BurnMode(this, this);
+ m_formBurnMode = new Form_BurnMode(this, m_profileName, m_accountName, this);
QVBoxLayout *vLayout = new QVBoxLayout;
vLayout->addWidget(m_formBurnMode);
@@ -385,6 +389,11 @@ QString MainWindow::getDevSn(SANE_Handle handle)
return QString::fromStdString(serialNum.c_str());
}
+void MainWindow::setLogOutStatus(bool show)
+{
+ ui->act_logOut->setVisible(show);
+}
+
QString MainWindow::getDevType(SANE_Handle handle)
{
std::string firmWareNum;
@@ -648,7 +657,7 @@ void MainWindow::on_act_refreshDevice_triggered()
sane_open(name[i].c_str(), &devHandle);
if (nullptr != devHandle)
{
- DeviceManager *devManager = new DeviceManager(this, m_formBurnMode, devHandle, name[i].c_str());
+ DeviceManager *devManager = new DeviceManager(this, m_formBurnMode, devHandle, m_profileName, name[i].c_str(), getDevSn(devHandle));
m_formBurnMode->addDevice(devManager);
}
}
diff --git a/app/HGProductionTool/mainwindow.h b/app/HGProductionTool/mainwindow.h
index e0b02d3..9673e08 100644
--- a/app/HGProductionTool/mainwindow.h
+++ b/app/HGProductionTool/mainwindow.h
@@ -36,6 +36,7 @@ public:
void releaseTesting();
bool isTesting();
QString getDevSn(SANE_Handle handle);
+ void setLogOutStatus(bool show);
protected:
void closeEvent(QCloseEvent *event);