区分工位模式
This commit is contained in:
parent
071b8c5e8f
commit
a1fac9e2a7
Binary file not shown.
|
@ -85,18 +85,18 @@
|
|||
<translation>取消</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="dialog_inputserialnum.cpp" line="51"/>
|
||||
<location filename="dialog_inputserialnum.cpp" line="57"/>
|
||||
<location filename="dialog_inputserialnum.cpp" line="55"/>
|
||||
<location filename="dialog_inputserialnum.cpp" line="71"/>
|
||||
<source>tips</source>
|
||||
<translation>提示</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="dialog_inputserialnum.cpp" line="51"/>
|
||||
<location filename="dialog_inputserialnum.cpp" line="55"/>
|
||||
<source>Serial num is empty</source>
|
||||
<translation>序列号为空</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="dialog_inputserialnum.cpp" line="57"/>
|
||||
<location filename="dialog_inputserialnum.cpp" line="71"/>
|
||||
<source>The device is testing</source>
|
||||
<translation>该设备正在进行测试</translation>
|
||||
</message>
|
||||
|
@ -563,7 +563,7 @@
|
|||
<message>
|
||||
<location filename="form_burnmode.ui" line="38"/>
|
||||
<source>Burn</source>
|
||||
<translation>全部烧录</translation>
|
||||
<translation>进入烧录模式</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_burnmode.ui" line="51"/>
|
||||
|
@ -571,38 +571,39 @@
|
|||
<translation>设置勾选项序列号</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_burnmode.cpp" line="83"/>
|
||||
<location filename="form_burnmode.cpp" line="98"/>
|
||||
<source>ID</source>
|
||||
<translation>序号</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_burnmode.cpp" line="83"/>
|
||||
<location filename="form_burnmode.cpp" line="98"/>
|
||||
<source>selected</source>
|
||||
<translation>选择</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_burnmode.cpp" line="83"/>
|
||||
<location filename="form_burnmode.cpp" line="98"/>
|
||||
<source>device</source>
|
||||
<translation>设备</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_burnmode.cpp" line="83"/>
|
||||
<location filename="form_burnmode.cpp" line="98"/>
|
||||
<source>serialNum</source>
|
||||
<translation>序列号</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_burnmode.cpp" line="147"/>
|
||||
<location filename="form_burnmode.cpp" line="161"/>
|
||||
<location filename="form_burnmode.cpp" line="83"/>
|
||||
<location filename="form_burnmode.cpp" line="162"/>
|
||||
<location filename="form_burnmode.cpp" line="167"/>
|
||||
<source>tips</source>
|
||||
<translation>提示</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_burnmode.cpp" line="147"/>
|
||||
<location filename="form_burnmode.cpp" line="167"/>
|
||||
<source>Please check single devices to set sn</source>
|
||||
<translation>请只勾选一台设备再进行设置序列号</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_burnmode.cpp" line="161"/>
|
||||
<location filename="form_burnmode.cpp" line="162"/>
|
||||
<source>Please check a devices to set sn at least</source>
|
||||
<translation>请至少勾选一台设备再设置序列号</translation>
|
||||
</message>
|
||||
|
@ -670,94 +671,94 @@
|
|||
<translation>下一步</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_maininterface.cpp" line="47"/>
|
||||
<location filename="form_maininterface.cpp" line="48"/>
|
||||
<source>Device has connected</source>
|
||||
<translation>设备已连接</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_maininterface.cpp" line="51"/>
|
||||
<location filename="form_maininterface.cpp" line="52"/>
|
||||
<source>Device hasnot connected</source>
|
||||
<translation>设备未连接</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_maininterface.cpp" line="52"/>
|
||||
<location filename="form_maininterface.cpp" line="53"/>
|
||||
<source>Device type:</source>
|
||||
<translation>设备型号:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_maininterface.cpp" line="52"/>
|
||||
<location filename="form_maininterface.cpp" line="53"/>
|
||||
<source> SerialNum:</source>
|
||||
<translation> 序列号:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_maininterface.cpp" line="53"/>
|
||||
<location filename="form_maininterface.cpp" line="115"/>
|
||||
<location filename="form_maininterface.cpp" line="54"/>
|
||||
<location filename="form_maininterface.cpp" line="116"/>
|
||||
<source> connect status:</source>
|
||||
<translation> 设备连接状态:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_maininterface.cpp" line="62"/>
|
||||
<location filename="form_maininterface.cpp" line="63"/>
|
||||
<source>load last image which uploaded last time</source>
|
||||
<translation>加载上一次上传的图片</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_maininterface.cpp" line="114"/>
|
||||
<location filename="form_maininterface.cpp" line="115"/>
|
||||
<source>Device has disconnected</source>
|
||||
<translation>设备已断开</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_maininterface.cpp" line="130"/>
|
||||
<location filename="form_maininterface.cpp" line="500"/>
|
||||
<location filename="form_maininterface.cpp" line="131"/>
|
||||
<location filename="form_maininterface.cpp" line="473"/>
|
||||
<source>tips</source>
|
||||
<translation>提示</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_maininterface.cpp" line="157"/>
|
||||
<location filename="form_maininterface.cpp" line="158"/>
|
||||
<source>yes</source>
|
||||
<translation>确定</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_maininterface.cpp" line="158"/>
|
||||
<location filename="form_maininterface.cpp" line="159"/>
|
||||
<source>no</source>
|
||||
<translation>取消</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_maininterface.cpp" line="277"/>
|
||||
<location filename="form_maininterface.cpp" line="278"/>
|
||||
<source>ID</source>
|
||||
<translation>序号</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_maininterface.cpp" line="277"/>
|
||||
<location filename="form_maininterface.cpp" line="278"/>
|
||||
<source>Test items</source>
|
||||
<translation>测试项</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_maininterface.cpp" line="277"/>
|
||||
<location filename="form_maininterface.cpp" line="278"/>
|
||||
<source>status</source>
|
||||
<translation>测试状态</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_maininterface.cpp" line="355"/>
|
||||
<location filename="form_maininterface.cpp" line="360"/>
|
||||
<source>not test</source>
|
||||
<translation>未测试</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_maininterface.cpp" line="355"/>
|
||||
<location filename="form_maininterface.cpp" line="360"/>
|
||||
<source>not pass</source>
|
||||
<translation>不通过</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_maininterface.cpp" line="355"/>
|
||||
<location filename="form_maininterface.cpp" line="360"/>
|
||||
<source>not support</source>
|
||||
<translation>不支持</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_maininterface.cpp" line="355"/>
|
||||
<location filename="form_maininterface.cpp" line="360"/>
|
||||
<source>pass</source>
|
||||
<translation>通过</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_maininterface.cpp" line="500"/>
|
||||
<location filename="form_maininterface.cpp" line="473"/>
|
||||
<source>no image</source>
|
||||
<translation>无图</translation>
|
||||
</message>
|
||||
|
@ -941,19 +942,19 @@
|
|||
<context>
|
||||
<name>QObject</name>
|
||||
<message>
|
||||
<location filename="hgscanner.cpp" line="67"/>
|
||||
<location filename="hgscanner.cpp" line="93"/>
|
||||
<source>success: </source>
|
||||
<oldsource>success</oldsource>
|
||||
<translation>成功: </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="hgscanner.cpp" line="48"/>
|
||||
<location filename="hgscanner.cpp" line="69"/>
|
||||
<location filename="hgscanner.cpp" line="58"/>
|
||||
<location filename="hgscanner.cpp" line="95"/>
|
||||
<source>failed: </source>
|
||||
<translation>失败: </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="hgscanner.cpp" line="40"/>
|
||||
<location filename="hgscanner.cpp" line="42"/>
|
||||
<source>Not find test item</source>
|
||||
<translation>没有找到该测试项</translation>
|
||||
</message>
|
||||
|
|
|
@ -37,7 +37,8 @@ std::vector<AnalysisJson::json_node> AnalysisJson::GetNode()
|
|||
obj[key].toObject()["name"].toString(),
|
||||
obj[key].toObject()["man"].toBool(),
|
||||
obj[key].toObject()["err-level"].toInt(),
|
||||
obj[key].toObject()["desc"].toString()});
|
||||
obj[key].toObject()["desc"].toString(),
|
||||
obj[key].toObject()["station"].toString()});
|
||||
}
|
||||
return nodes;
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ public:
|
|||
bool is_man;
|
||||
std::int32_t err_level;
|
||||
QString desc;
|
||||
QString station;
|
||||
};
|
||||
|
||||
struct json_global{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include "ui_dialog_inputserialnum.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
Dialog_InputSerialNum::Dialog_InputSerialNum(class MainWindow *mainWnd, const QString &serialNum, const QString &devType) :
|
||||
Dialog_InputSerialNum::Dialog_InputSerialNum(class MainWindow *mainWnd, SANE_Handle handle, const QString &serialNum, const QString &devType) :
|
||||
QDialog(mainWnd),
|
||||
ui(new Ui::Dialog_InputSerialNum),
|
||||
m_mainWnd(mainWnd),
|
||||
|
@ -18,14 +18,18 @@ Dialog_InputSerialNum::Dialog_InputSerialNum(class MainWindow *mainWnd, const QS
|
|||
this->setFont(ft);
|
||||
|
||||
ui->lineEdit_sn->setValidator(new QRegExpValidator(QRegExp("[a-zA-Z0-9]+$")));
|
||||
ui->lineEdit_sn->setText(m_serialNum);
|
||||
if (m_devType.isEmpty() || m_serialNum.isEmpty())
|
||||
ui->cbox_devType->setCurrentIndex(0);
|
||||
else
|
||||
|
||||
if (handle != nullptr)
|
||||
{
|
||||
ui->cbox_devType->setCurrentText(devType);
|
||||
ui->lineEdit_sn->setEnabled(false);
|
||||
ui->cbox_devType->setEnabled(false);
|
||||
ui->cbox_devType->setCurrentText(devType);
|
||||
ui->lineEdit_sn->setText(serialNum);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->cbox_devType->setCurrentIndex(0);
|
||||
ui->lineEdit_sn->setText("");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,6 +56,16 @@ void Dialog_InputSerialNum::on_pbtn_ok_clicked()
|
|||
return;
|
||||
}
|
||||
|
||||
// QString str = ui->lineEdit_sn->text();
|
||||
// for (int i = 0; i < str.size(); ++i)
|
||||
// {
|
||||
// if ((str.at(i) < '0' || str.at(i) > '9') || (str.at(i) < 'A' || str.at(i) > 'Z'))
|
||||
// {
|
||||
// QMessageBox::information(this, tr("tips"), tr("sn is illegal"));
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
|
||||
if (m_mainWnd->FindInterface(ui->lineEdit_sn->text()) != nullptr)
|
||||
{
|
||||
QMessageBox::information(this, tr("tips"), tr("The device is testing"));
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define DIALOG_INPUTSERIALNUM_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "sane/sane_ex.h"
|
||||
|
||||
namespace Ui {
|
||||
class Dialog_InputSerialNum;
|
||||
|
@ -12,7 +13,7 @@ class Dialog_InputSerialNum : public QDialog
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Dialog_InputSerialNum(class MainWindow *mainWnd, const QString &serialNum, const QString &devType);
|
||||
explicit Dialog_InputSerialNum(class MainWindow *mainWnd, SANE_Handle handle, const QString &serialNum, const QString &devType);
|
||||
~Dialog_InputSerialNum();
|
||||
|
||||
QString GetSn();
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
#include "dialog_setburnsn.h"
|
||||
#include "hgscanner.h"
|
||||
#include "mainwindow.h"
|
||||
#include "analysisjson.h"
|
||||
#include "base/HGBase.h"
|
||||
#include <QMessageBox>
|
||||
#include <QLineEdit>
|
||||
#include <QInputDialog>
|
||||
|
@ -132,8 +134,6 @@ void Form_BurnMode::on_cbox_selectAll_stateChanged(int arg1)
|
|||
|
||||
void Form_BurnMode::on_pbtn_burn_clicked()
|
||||
{
|
||||
ui->cbox_selectAll->setChecked(true);
|
||||
|
||||
for(int i = 0; i < ui->tableWidget->columnCount(); i++)
|
||||
{
|
||||
QTableWidgetItem *item = ui->tableWidget->item(i, 1);
|
||||
|
@ -180,6 +180,8 @@ void Form_BurnMode::on_pbtn_setSn_clicked()
|
|||
{
|
||||
DeviceManager *devManager = (DeviceManager*)item->data(Qt::UserRole).value<void*>();
|
||||
devManager->setSn(dlg.getSn());
|
||||
|
||||
item2->setText(devManager->getUpdatedSn());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -187,13 +189,16 @@ void Form_BurnMode::on_pbtn_setSn_clicked()
|
|||
}
|
||||
}
|
||||
|
||||
DeviceManager::DeviceManager(class MainWindow *mainwnd, class Form_BurnMode *burnMode, SANE_Handle handle, const QString & devName, const QString & sn)
|
||||
DeviceManager::DeviceManager(class MainWindow *mainwnd, HGPdtToolDbUserMgr pdtToolDbuserMgr, class Form_BurnMode *burnMode,
|
||||
SANE_Handle handle, const QString & devName, const QString & sn, const QString &devType)
|
||||
{
|
||||
m_mainwnd = mainwnd;
|
||||
m_pdtToolDbuserMgr = pdtToolDbuserMgr;
|
||||
m_burnMode = burnMode;
|
||||
m_handle = handle;
|
||||
m_devName = devName;
|
||||
m_sn = sn;
|
||||
m_mainwnd = mainwnd;
|
||||
m_burnMode = burnMode;
|
||||
m_devType = devType;
|
||||
|
||||
m_hg = new hgscanner(nullptr, m_burnMode, m_handle);
|
||||
}
|
||||
|
@ -233,9 +238,56 @@ void DeviceManager::setSn(QString sn)
|
|||
func_test_go(WRITE_CFG_NAME, (const wchar_t*)p, m_hg);
|
||||
m_mainwnd->addTestingRef();
|
||||
|
||||
setGlobalCfg();
|
||||
|
||||
delete p;
|
||||
}
|
||||
|
||||
QString DeviceManager::getUpdatedSn()
|
||||
{
|
||||
return m_mainwnd->getDevSn(m_handle);
|
||||
}
|
||||
|
||||
void DeviceManager::setGlobalCfg()
|
||||
{
|
||||
HGChar cfgPath[512] = {0};
|
||||
HGBase_GetConfigPath(cfgPath, 512);
|
||||
HGBase_CreateDir(cfgPath);
|
||||
strcat(cfgPath, m_devType.toStdString().c_str());
|
||||
strcat(cfgPath, ".json");
|
||||
|
||||
HGPdtToolDb_DownloadFile(m_pdtToolDbuserMgr, m_devType.toStdString().c_str(), cfgPath);
|
||||
|
||||
AnalysisJson analysisJson(QString::fromStdString(cfgPath));
|
||||
|
||||
assert(nullptr != m_hg);
|
||||
AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal();
|
||||
LPWRITECFG lp = new WRITECFG;
|
||||
|
||||
VIDPID vidpid;
|
||||
vidpid.VID = jsonGlobal.vid_to;
|
||||
vidpid.PID = jsonGlobal.pid_to;
|
||||
int vidpidValue = vidpid.Value;
|
||||
lp->cat = WRITE_CAT_VID_PID;
|
||||
lp->val = (void*)&vidpidValue;
|
||||
func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp, m_hg);
|
||||
m_mainwnd->addTestingRef();
|
||||
|
||||
int speedMode = jsonGlobal.speed_mode ;
|
||||
lp->cat = WRITE_CAT_SPEED;
|
||||
lp->val = (void*)&speedMode;
|
||||
func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp, m_hg);
|
||||
m_mainwnd->addTestingRef();
|
||||
|
||||
int sleepTime = jsonGlobal.sleep_time;
|
||||
lp->cat = WRITE_CAT_SLEEP;
|
||||
lp->val = (void*)&sleepTime;
|
||||
func_test_go(WRITE_CFG_NAME, (const wchar_t*)lp, m_hg);
|
||||
m_mainwnd->addTestingRef();
|
||||
|
||||
delete lp;
|
||||
}
|
||||
|
||||
void Form_BurnMode::on_tableWidget_itemDoubleClicked(QTableWidgetItem *item)
|
||||
{
|
||||
int row = item->row();
|
||||
|
@ -249,3 +301,5 @@ void Form_BurnMode::on_tableWidget_itemDoubleClicked(QTableWidgetItem *item)
|
|||
item2->setCheckState(Qt::Checked);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <QTableWidgetItem>
|
||||
#include "sane/sane_ex.h"
|
||||
#include "hgscanner.h"
|
||||
#include "HGPdtToolDb.h"
|
||||
|
||||
namespace Ui {
|
||||
class Form_BurnMode;
|
||||
|
@ -13,21 +14,36 @@ class Form_BurnMode;
|
|||
class DeviceManager
|
||||
{
|
||||
public:
|
||||
DeviceManager(class MainWindow *mainwnd, class Form_BurnMode *burnMode, SANE_Handle handle, const QString &devName, const QString &sn);
|
||||
DeviceManager(class MainWindow *mainwnd, HGPdtToolDbUserMgr pdtToolDbuserMgr, class Form_BurnMode *burnMode,
|
||||
SANE_Handle handle, const QString &devName, const QString &sn, const QString &devType);
|
||||
~DeviceManager();
|
||||
|
||||
QString getDevName();
|
||||
QString getSn();
|
||||
void setBurnMode();
|
||||
void setSn(QString sn);
|
||||
QString getUpdatedSn();
|
||||
SANE_Handle m_handle;
|
||||
void setGlobalCfg();
|
||||
|
||||
private:
|
||||
union VIDPID
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned short VID;
|
||||
unsigned short PID;
|
||||
};
|
||||
unsigned int Value;
|
||||
};
|
||||
|
||||
private:
|
||||
class MainWindow *m_mainwnd;
|
||||
HGPdtToolDbUserMgr m_pdtToolDbuserMgr;
|
||||
class Form_BurnMode *m_burnMode;
|
||||
QString m_devName;
|
||||
QString m_sn;
|
||||
|
||||
class MainWindow *m_mainwnd;
|
||||
class Form_BurnMode *m_burnMode;
|
||||
QString m_devType;
|
||||
hgscanner *m_hg;
|
||||
};
|
||||
|
||||
|
|
|
@ -14,11 +14,12 @@
|
|||
#include "dialog_excepdesc.h"
|
||||
#include "huagao/hgscanner_error.h"
|
||||
|
||||
Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, SANE_Handle handle, HGPdtToolDbUserMgr pdtToolDbuserMgr, HGPdtToolDbDevice pdtToolDbDevice,
|
||||
Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn::LogInType logInType, SANE_Handle handle, HGPdtToolDbUserMgr pdtToolDbuserMgr, HGPdtToolDbDevice pdtToolDbDevice,
|
||||
const QString &serialNum, const QString &devType, const QString &devName, const QString &devFwNum)
|
||||
: QWidget(mainwnd)
|
||||
, ui(new Ui::Form_mainInterface)
|
||||
, m_mainwnd(mainwnd)
|
||||
, m_logInType(logInType)
|
||||
, m_hg(nullptr)
|
||||
, m_handle(handle)
|
||||
, m_disconnect(false)
|
||||
|
@ -304,48 +305,53 @@ void Form_mainInterface::initTableWidgetUi()
|
|||
|
||||
AnalysisJson analysisJson(QString::fromStdString(cfgPath));
|
||||
|
||||
setGlobalCfg(analysisJson);
|
||||
const QString stationStr[] = {"烧录工位", "初检工位", "图像测试工位", "压力测试工位"};
|
||||
|
||||
std::vector<AnalysisJson::json_node> list_jsonNode = analysisJson.GetNode();
|
||||
int count = list_jsonNode.size();
|
||||
ui->tableWidget->setRowCount(count);
|
||||
int index = 0;
|
||||
for(int i = 0; i < count; ++i)
|
||||
{
|
||||
AnalysisJson::json_node node = list_jsonNode[i];
|
||||
m_map_title_name.insert(node.title, node);
|
||||
|
||||
HGPdtToolDb_SetEntryNameCnStr(m_pdtToolDbuserMgr, node.name.toStdString().c_str(), node.title.toStdString().c_str());
|
||||
|
||||
ui->tableWidget->setItem(i, 0, new QTableWidgetItem(QString::number(i+1)));
|
||||
ui->tableWidget->item(i, 0)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
ui->tableWidget->setItem(i, 1, new QTableWidgetItem(node.title));
|
||||
ui->tableWidget->item(i, 1)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
|
||||
std::string name = node.name.toStdString();
|
||||
HGUInt status = 0;
|
||||
HGPdtToolDb_GetDeviceEntryStatus(m_pdtToolDbDevice, name.c_str(), &status);
|
||||
QString statusStr = getItemStatusStr(status);
|
||||
ui->tableWidget->setItem(i, 2, new QTableWidgetItem(statusStr));
|
||||
ui->tableWidget->item(i, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
if (HGPDTTOOLDB_ENTRYSTATUS_NOTPASS == status)
|
||||
if (stationStr[m_logInType] == node.station)
|
||||
{
|
||||
ui->tableWidget->item(i, 2)->setBackgroundColor(QColor(255,0,0));
|
||||
}
|
||||
else if (HGPDTTOOLDB_ENTRYSTATUS_NOTSUPP == status)
|
||||
{
|
||||
ui->tableWidget->item(i, 2)->setBackgroundColor(QColor(255,255,0));
|
||||
}
|
||||
else if (HGPDTTOOLDB_ENTRYSTATUS_PASS == status)
|
||||
{
|
||||
ui->tableWidget->item(i, 2)->setBackgroundColor(QColor(0,255,0));
|
||||
}
|
||||
HGPdtToolDb_SetEntryNameCnStr(m_pdtToolDbuserMgr, node.name.toStdString().c_str(), node.title.toStdString().c_str());
|
||||
|
||||
HGChar desc[512] = {0};
|
||||
HGPdtToolDb_GetDeviceEntryExcepDesc(m_pdtToolDbDevice, name.c_str(), desc, 512);
|
||||
QTableWidgetItem *item = ui->tableWidget->item(i, 2);
|
||||
item->setToolTip(desc);
|
||||
ui->tableWidget->setItem(index, 0, new QTableWidgetItem(QString::number(index+1)));
|
||||
ui->tableWidget->item(index, 0)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
ui->tableWidget->setItem(index, 1, new QTableWidgetItem(node.title));
|
||||
ui->tableWidget->item(index, 1)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
|
||||
std::string name = node.name.toStdString();
|
||||
HGUInt status = 0;
|
||||
HGPdtToolDb_GetDeviceEntryStatus(m_pdtToolDbDevice, name.c_str(), &status);
|
||||
QString statusStr = getItemStatusStr(status);
|
||||
ui->tableWidget->setItem(index, 2, new QTableWidgetItem(statusStr));
|
||||
ui->tableWidget->item(index, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
if (HGPDTTOOLDB_ENTRYSTATUS_NOTPASS == status)
|
||||
{
|
||||
ui->tableWidget->item(index, 2)->setBackgroundColor(QColor(255,0,0));
|
||||
}
|
||||
else if (HGPDTTOOLDB_ENTRYSTATUS_NOTSUPP == status)
|
||||
{
|
||||
ui->tableWidget->item(index, 2)->setBackgroundColor(QColor(255,255,0));
|
||||
}
|
||||
else if (HGPDTTOOLDB_ENTRYSTATUS_PASS == status)
|
||||
{
|
||||
ui->tableWidget->item(index, 2)->setBackgroundColor(QColor(0,255,0));
|
||||
}
|
||||
|
||||
HGChar desc[512] = {0};
|
||||
HGPdtToolDb_GetDeviceEntryExcepDesc(m_pdtToolDbDevice, name.c_str(), desc, 512);
|
||||
QTableWidgetItem *item = ui->tableWidget->item(index, 2);
|
||||
item->setToolTip(desc);
|
||||
|
||||
++index;
|
||||
}
|
||||
}
|
||||
|
||||
ui->tableWidget->selectRow(0);
|
||||
}
|
||||
|
||||
|
@ -390,42 +396,6 @@ void Form_mainInterface::updateUiEnabled(bool enable)
|
|||
ui->pbtn_stop->setEnabled(enable);
|
||||
}
|
||||
|
||||
void Form_mainInterface::setGlobalCfg(AnalysisJson analysisJson)
|
||||
{
|
||||
assert(nullptr != m_hg);
|
||||
AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal();
|
||||
LPWRITECFG p = new WRITECFG;
|
||||
|
||||
VIDPID vidpid;
|
||||
vidpid.VID = jsonGlobal.vid_to;
|
||||
vidpid.PID = jsonGlobal.pid_to;
|
||||
int vidpidValue = vidpid.Value;
|
||||
p->cat = WRITE_CAT_VID_PID;
|
||||
p->val = (void*)&vidpidValue;
|
||||
func_test_go(WRITE_CFG_NAME, (const wchar_t*)p, m_hg);
|
||||
m_mainwnd->addTestingRef();
|
||||
|
||||
int speedMode = jsonGlobal.speed_mode ;
|
||||
p->cat = WRITE_CAT_SPEED;
|
||||
p->val = (void*)&speedMode;
|
||||
func_test_go(WRITE_CFG_NAME, (const wchar_t*)p, m_hg);
|
||||
m_mainwnd->addTestingRef();
|
||||
|
||||
int sleepTime = jsonGlobal.sleep_time;
|
||||
p->cat = WRITE_CAT_SLEEP;
|
||||
p->val = (void*)&sleepTime;
|
||||
func_test_go(WRITE_CFG_NAME, (const wchar_t*)p, m_hg);
|
||||
m_mainwnd->addTestingRef();
|
||||
|
||||
const wchar_t* sn = m_serialNum.toStdWString().c_str();
|
||||
p->cat = WRITE_CAT_SERIALNUM;
|
||||
p->val = (void*)sn;
|
||||
func_test_go(WRITE_CFG_NAME, (const wchar_t*)p, m_hg);
|
||||
m_mainwnd->addTestingRef();
|
||||
|
||||
delete p;
|
||||
}
|
||||
|
||||
void Form_mainInterface::on_tableWidget_currentItemChanged(QTableWidgetItem *current, QTableWidgetItem *previous)
|
||||
{
|
||||
(void)previous;
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "sane/sane_ex.h"
|
||||
#include "HGPdtToolDb.h"
|
||||
#include "hgscanner.h"
|
||||
#include "dialog_login.h"
|
||||
|
||||
namespace Ui {
|
||||
class Form_mainInterface;
|
||||
|
@ -20,7 +21,7 @@ class Form_mainInterface : public QWidget
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Form_mainInterface(class MainWindow *mainwnd, SANE_Handle handle, HGPdtToolDbUserMgr pdtToolDbuserMgr, HGPdtToolDbDevice pdtToolDbDevice,
|
||||
explicit Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn::LogInType logInType, SANE_Handle handle, HGPdtToolDbUserMgr pdtToolDbuserMgr, HGPdtToolDbDevice pdtToolDbDevice,
|
||||
const QString &serialNum, const QString &devType, const QString &devName, const QString &devFwNum);
|
||||
~Form_mainInterface();
|
||||
|
||||
|
@ -67,22 +68,11 @@ private slots:
|
|||
|
||||
void on_pbtn_rightRotate_clicked();
|
||||
|
||||
private:
|
||||
union VIDPID
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned short VID;
|
||||
unsigned short PID;
|
||||
};
|
||||
unsigned int Value;
|
||||
};
|
||||
void initTableWidgetUi();
|
||||
QString getItemStatusStr(HGUInt status);
|
||||
QString getCachePath();
|
||||
QString getCacheFileName();
|
||||
void updateUiEnabled(bool enable);
|
||||
void setGlobalCfg(AnalysisJson analysisJson);
|
||||
|
||||
private:
|
||||
Ui::Form_mainInterface *ui;
|
||||
|
@ -92,6 +82,7 @@ private:
|
|||
HGImgView *m_view;
|
||||
|
||||
class MainWindow *m_mainwnd;
|
||||
Dialog_logIn::LogInType m_logInType;
|
||||
hgscanner *m_hg;
|
||||
SANE_Handle m_handle;
|
||||
bool m_disconnect;
|
||||
|
|
|
@ -399,7 +399,7 @@ void MainWindow::on_sane_dev_arrive(QString devName)
|
|||
sane_open(devName.toStdString().c_str(), &devHandle);
|
||||
if (nullptr != devHandle)
|
||||
{
|
||||
DeviceManager *devManager = new DeviceManager(this, m_formBurnMode, devHandle, devName, getDevSn(devHandle));
|
||||
DeviceManager *devManager = new DeviceManager(this, m_pdtToolDbuserMgr, m_formBurnMode, devHandle, devName, getDevSn(devHandle), getDevType(devHandle));
|
||||
m_formBurnMode->addDevice(devManager);
|
||||
}
|
||||
}
|
||||
|
@ -417,13 +417,13 @@ void MainWindow::on_sane_dev_arrive(QString devName)
|
|||
sane_open(devName.toStdString().c_str(), &devHandle);
|
||||
if (nullptr != devHandle)
|
||||
{
|
||||
Dialog_InputSerialNum dlg(this, getDevSn(devHandle), getDevType(devHandle));
|
||||
Dialog_InputSerialNum dlg(this, devHandle, getDevSn(devHandle), getDevType(devHandle));
|
||||
if (dlg.exec())
|
||||
{
|
||||
HGPdtToolDbDevice pdtToolDbDevice = nullptr;
|
||||
HGPdtToolDb_OpenDevice(m_pdtToolDbuserMgr, dlg.GetSn().toStdString().c_str(), &pdtToolDbDevice);
|
||||
|
||||
Form_mainInterface *mainInterface = new Form_mainInterface(this, devHandle, m_pdtToolDbuserMgr, pdtToolDbDevice,
|
||||
Form_mainInterface *mainInterface = new Form_mainInterface(this, m_loginType, devHandle, m_pdtToolDbuserMgr, pdtToolDbDevice,
|
||||
dlg.GetSn(), dlg.GetDevType(), devName, getDevFwNum(devHandle));
|
||||
if (!AddInterface(mainInterface))
|
||||
{
|
||||
|
@ -498,13 +498,13 @@ void MainWindow::on_update_userStatus()
|
|||
|
||||
void MainWindow::on_act_newDevice_triggered()
|
||||
{
|
||||
Dialog_InputSerialNum dlg(this, "", "");
|
||||
Dialog_InputSerialNum dlg(this, nullptr, "", "");
|
||||
if (dlg.exec())
|
||||
{
|
||||
HGPdtToolDbDevice pdtToolDbDevice = nullptr;
|
||||
HGPdtToolDb_OpenDevice(m_pdtToolDbuserMgr, dlg.GetSn().toStdString().c_str(), &pdtToolDbDevice);
|
||||
|
||||
Form_mainInterface *mainInterface = new Form_mainInterface(this, nullptr, m_pdtToolDbuserMgr, pdtToolDbDevice, dlg.GetSn(), dlg.GetDevType(), nullptr, nullptr);
|
||||
Form_mainInterface *mainInterface = new Form_mainInterface(this, m_loginType, nullptr, m_pdtToolDbuserMgr, pdtToolDbDevice, dlg.GetSn(), dlg.GetDevType(), nullptr, nullptr);
|
||||
if (!AddInterface(mainInterface))
|
||||
{
|
||||
QMessageBox::information(this, tr("tips"), tr("cannot create more table"));
|
||||
|
|
|
@ -35,6 +35,7 @@ public:
|
|||
void addTestingRef();
|
||||
void releaseTesting();
|
||||
bool isTesting();
|
||||
QString getDevSn(SANE_Handle handle);
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *event);
|
||||
|
@ -42,7 +43,6 @@ private:
|
|||
static int sane_ex_callback(SANE_Handle hdev, int code, void* data, unsigned int* len, void* param);
|
||||
|
||||
std::vector<std::string> getDevices();
|
||||
QString getDevSn(SANE_Handle handle);
|
||||
QString getDevType(SANE_Handle handle);
|
||||
QString getDevFwNum(SANE_Handle handle);
|
||||
|
||||
|
|
Loading…
Reference in New Issue