调整数据库传参改用英文
This commit is contained in:
parent
cb0a5c5809
commit
a6139f2adc
|
@ -14,50 +14,6 @@
|
|||
#include "dialog_excepdesc.h"
|
||||
#include "huagao/hgscanner_error.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const wchar_t *title;
|
||||
HGUInt entryName;
|
||||
}RELA;
|
||||
|
||||
static const RELA Rela[] = {
|
||||
{HGPDTTOOLDB_TITLE_DIAL_SWITCH, HGPDTTOOLDB_ENTRYNAME_DIAL_SWITCH},
|
||||
{HGPDTTOOLDB_TITLE_ROCKER_SWITCH, HGPDTTOOLDB_ENTRYNAME_ROCKER_SWITCH},
|
||||
{HGPDTTOOLDB_TITLE_BOOT_STATUS, HGPDTTOOLDB_ENTRYNAME_BOOT_STATUS},
|
||||
{HGPDTTOOLDB_TITLE_LCD_DISPLAY, HGPDTTOOLDB_ENTRYNAME_LCD_DISPLAY},
|
||||
{HGPDTTOOLDB_TITLE_CLEAR_PAPER_PATH, HGPDTTOOLDB_ENTRYNAME_CLEAR_PAPER_PATH},
|
||||
{HGPDTTOOLDB_TITLE_KEY_FUNCTION, HGPDTTOOLDB_ENTRYNAME_KEY_FUNCTION},
|
||||
{HGPDTTOOLDB_TITLE_COUNTING_MODE, HGPDTTOOLDB_ENTRYNAME_COUNTING_MODE},
|
||||
{HGPDTTOOLDB_TITLE_SKEW_DETECTION, HGPDTTOOLDB_ENTRYNAME_SKEW_DETECTION},
|
||||
{HGPDTTOOLDB_TITLE_SEPARATER_MOTOR, HGPDTTOOLDB_ENTRYNAME_SEPARATER_MOTOR},
|
||||
{HGPDTTOOLDB_TITLE_CIS_ORIGINAL_IMAGE, HGPDTTOOLDB_ENTRYNAME_CIS_ORIGINAL_IMAGE},
|
||||
{HGPDTTOOLDB_TITLE_HOST_FAN, HGPDTTOOLDB_ENTRYNAME_HOST_FAN},
|
||||
{HGPDTTOOLDB_TITLE_ULTRASONIC_MODULE, HGPDTTOOLDB_ENTRYNAME_ULTRASONIC_MODULE},
|
||||
{HGPDTTOOLDB_TITLE_LED_LIGHT, HGPDTTOOLDB_ENTRYNAME_LED_LIGHT},
|
||||
{HGPDTTOOLDB_TITLE_RESET, HGPDTTOOLDB_ENTRYNAME_RESET},
|
||||
{HGPDTTOOLDB_TITLE_PAPER_FEED, HGPDTTOOLDB_ENTRYNAME_PAPER_FEED},
|
||||
{HGPDTTOOLDB_TITLE_COVER_SENSOR, HGPDTTOOLDB_ENTRYNAME_COVER_SENSOR},
|
||||
{HGPDTTOOLDB_TITLE_SCANNING_SENSOR, HGPDTTOOLDB_ENTRYNAME_SCANNING_SENSOR},
|
||||
{HGPDTTOOLDB_TITLE_CONFIGURE_SPEED_MODE, HGPDTTOOLDB_ENTRYNAME_CONFIGURE_SPEED_MODE},
|
||||
{HGPDTTOOLDB_TITLE_PLACE_CORRECTION_PAPER, HGPDTTOOLDB_ENTRYNAME_PLACE_CORRECTION_PAPER},
|
||||
{HGPDTTOOLDB_TITLE_AUTO_FLAT_FIELD, HGPDTTOOLDB_ENTRYNAME_AUTO_FLAT_FIELD},
|
||||
{HGPDTTOOLDB_TITLE_REBOOT_DEVICE, HGPDTTOOLDB_ENTRYNAME_REBOOT_DEVICE},
|
||||
{HGPDTTOOLDB_TITLE_IMAGE_QUALITY, HGPDTTOOLDB_ENTRYNAME_IMAGE_QUALITY},
|
||||
{HGPDTTOOLDB_TITLE_COLORCARD_IMAGEING_QUALITY, HGPDTTOOLDB_ENTRYNAME_COLORCARD_IMAGEING_QUALITY},
|
||||
{HGPDTTOOLDB_TITLE_COLORCARD_BIAS_IMAGEING_QUALITY, HGPDTTOOLDB_ENTRYNAME_COLORCARD_BIAS_IMAGEING_QUALITY},
|
||||
{HGPDTTOOLDB_TITLE_CLARITY_QUALITY, HGPDTTOOLDB_ENTRYNAME_CLARITY_QUALITY},
|
||||
{HGPDTTOOLDB_TITLE_DISTORTION, HGPDTTOOLDB_ENTRYNAME_DISTORTION},
|
||||
{HGPDTTOOLDB_TITLE_DORMANCY, HGPDTTOOLDB_ENTRYNAME_DORMANCY},
|
||||
{HGPDTTOOLDB_TITLE_SKEW_GEAR, HGPDTTOOLDB_ENTRYNAME_SKEW_GEAR},
|
||||
{HGPDTTOOLDB_TITLE_PAPER_SEPARATION_STRENGTH, HGPDTTOOLDB_ENTRYNAME_PAPER_SEPARATION_STRENGTH},
|
||||
{HGPDTTOOLDB_TITLE_MECH_PAPER_FEEDING_INCLINATION, HGPDTTOOLDB_ENTRYNAME_MECH_PAPER_FEEDING_INCLINATION},
|
||||
{HGPDTTOOLDB_TITLE_SINGLE_PAGE_TEST_1, HGPDTTOOLDB_ENTRYNAME_SINGLE_PAGE_TEST_1},
|
||||
//{HGPDTTOOLDB_TITLE_SINGLE_PAGE_TEST_2, HGPDTTOOLDB_ENTRYNAME_SINGLE_PAGE_TEST_2},
|
||||
//{HGPDTTOOLDB_TITLE_SINGLE_PAGE_TEST_3, HGPDTTOOLDB_ENTRYNAME_SINGLE_PAGE_TEST_3},
|
||||
//{HGPDTTOOLDB_TITLE_PRESSUER_TEST, HGPDTTOOLDB_ENTRYNAME_PRESSUER_TEST},
|
||||
{HGPDTTOOLDB_TITLE_CLEAR_ROLLER_COUNT, HGPDTTOOLDB_ENTRYNAME_CLEAR_ROLLER_COUNT}
|
||||
};
|
||||
|
||||
Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, SANE_Handle handle, HGPdtToolDbUserMgr pdtToolDbuserMgr, HGPdtToolDbDevice pdtToolDbDevice,
|
||||
const QString &serialNum, const QString &devType, const QString &devName, const QString &devFwNum)
|
||||
: QWidget(mainwnd)
|
||||
|
@ -87,7 +43,10 @@ Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, SANE_Handle ha
|
|||
|
||||
QString str;
|
||||
if (m_handle)
|
||||
{
|
||||
str = tr("Device has connected");
|
||||
m_hg = new hgscanner(this, m_handle);
|
||||
}
|
||||
else
|
||||
str = tr("Device hasnot connected");
|
||||
ui->label_sn->setText(tr("Device type:") + m_devType + tr(" SerialNum:") + m_serialNum);
|
||||
|
@ -110,8 +69,6 @@ Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, SANE_Handle ha
|
|||
HGPdtToolDb_SetDeviceVersion(m_pdtToolDbDevice, m_devFwNum.toStdString().c_str());
|
||||
if(!m_devName.isEmpty())
|
||||
HGPdtToolDb_SetDeviceName(m_pdtToolDbDevice, m_devName.toStdString().c_str());
|
||||
|
||||
m_hg = new hgscanner(this, m_handle);
|
||||
}
|
||||
|
||||
Form_mainInterface::~Form_mainInterface()
|
||||
|
@ -254,8 +211,9 @@ void Form_mainInterface::on_pbtn_fail_clicked()
|
|||
ui->tableWidget->item(row, 2)->setBackgroundColor(QColor(255,0,0));
|
||||
|
||||
QString str = dlg.getExcepDesc();
|
||||
setTestItemStatus(title, HGPDTTOOLDB_ENTRYSTATUS_NOTPASS);
|
||||
HGPdtToolDb_SetDeviceEntryExcepDesc(m_pdtToolDbDevice, getTestItem(title), str.toStdString().c_str());
|
||||
std::string name = m_map_title_name.value(title).name.toStdString();
|
||||
HGPdtToolDb_SetDeviceEntryStatus(m_pdtToolDbDevice, name.c_str(), HGPDTTOOLDB_ENTRYSTATUS_NOTPASS);
|
||||
HGPdtToolDb_SetDeviceEntryExcepDesc(m_pdtToolDbDevice, name.c_str(), str.toStdString().c_str());
|
||||
|
||||
QTableWidgetItem *item2 = ui->tableWidget->item(row, 2);
|
||||
item2->setToolTip(str);
|
||||
|
@ -267,14 +225,14 @@ void Form_mainInterface::on_pbtn_pass_clicked()
|
|||
int row = ui->tableWidget->currentRow();
|
||||
QTableWidgetItem *item = ui->tableWidget->item(row, 1);
|
||||
QString title = item->text();
|
||||
setTestItemStatus(title, HGPDTTOOLDB_ENTRYSTATUS_PASS);
|
||||
std::string name = m_map_title_name.value(title).name.toStdString();
|
||||
HGPdtToolDb_SetDeviceEntryStatus(m_pdtToolDbDevice, name.c_str(), HGPDTTOOLDB_ENTRYSTATUS_PASS);
|
||||
HGPdtToolDb_SetDeviceEntryExcepDesc(m_pdtToolDbDevice, name.c_str(), "");
|
||||
|
||||
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));
|
||||
|
||||
HGPdtToolDb_SetDeviceEntryExcepDesc(m_pdtToolDbDevice, getTestItem(title), "");
|
||||
|
||||
QTableWidgetItem *item2 = ui->tableWidget->item(row, 2);
|
||||
item2->setToolTip("");
|
||||
|
||||
|
@ -290,9 +248,8 @@ void Form_mainInterface::on_pbtn_pass_clicked()
|
|||
int row = ui->tableWidget->currentRow();
|
||||
QTableWidgetItem *item = ui->tableWidget->item(row, 1);
|
||||
QString title = item->text();
|
||||
HGUInt entryName = getTestItem(title);
|
||||
|
||||
ret = HGPdtToolDb_UploadDeviceEntryImage(m_pdtToolDbDevice, entryName, m_mainwnd->m_ftpHost.toStdString().c_str(),
|
||||
std::string name = m_map_title_name.value(title).name.toStdString();
|
||||
ret = HGPdtToolDb_UploadDeviceEntryImage(m_pdtToolDbDevice, name.c_str(), m_mainwnd->m_ftpHost.toStdString().c_str(),
|
||||
m_mainwnd->m_ftpPort, fileName.toStdString().c_str());
|
||||
QFile file(fileName);
|
||||
file.remove();
|
||||
|
@ -348,14 +305,6 @@ void Form_mainInterface::initTableWidgetUi()
|
|||
|
||||
setGlobalCfg(analysisJson);
|
||||
|
||||
std::map<HGUInt, bool> dbEntryItems;
|
||||
for (int i = HGPDTTOOLDB_ENTRYNAME_DIAL_SWITCH; i <= HGPDTTOOLDB_ENTRYNAME_SCANNING_SENSOR; ++i)
|
||||
dbEntryItems[i] = false;
|
||||
for (int i = HGPDTTOOLDB_ENTRYNAME_CONFIGURE_SPEED_MODE; i <= HGPDTTOOLDB_ENTRYNAME_MECH_PAPER_FEEDING_INCLINATION; ++i)
|
||||
dbEntryItems[i] = false;
|
||||
for (int i = HGPDTTOOLDB_ENTRYNAME_SINGLE_PAGE_TEST_1; i <= HGPDTTOOLDB_ENTRYNAME_CLEAR_ROLLER_COUNT; ++i)
|
||||
dbEntryItems[i] = false;
|
||||
|
||||
std::vector<AnalysisJson::json_node> list_jsonNode = analysisJson.GetNode();
|
||||
int count = list_jsonNode.size();
|
||||
ui->tableWidget->setRowCount(count);
|
||||
|
@ -370,7 +319,9 @@ void Form_mainInterface::initTableWidgetUi()
|
|||
ui->tableWidget->setItem(i, 1, new QTableWidgetItem(node.title));
|
||||
ui->tableWidget->item(i, 1)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
|
||||
HGUInt status = getTestItemStatus(node.title);
|
||||
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);
|
||||
|
@ -387,81 +338,15 @@ void Form_mainInterface::initTableWidgetUi()
|
|||
ui->tableWidget->item(i, 2)->setBackgroundColor(QColor(0,255,0));
|
||||
}
|
||||
|
||||
HGUInt entry = getTestItem(node.title);
|
||||
std::map<HGUInt, bool>::iterator iter;
|
||||
for (iter = dbEntryItems.begin(); iter != dbEntryItems.end(); ++iter)
|
||||
{
|
||||
if (entry == iter->first)
|
||||
{
|
||||
iter->second = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
HGChar desc[512] = {0};
|
||||
HGPdtToolDb_GetDeviceEntryExcepDesc(m_pdtToolDbDevice, getTestItem(node.title), desc, 512);
|
||||
HGPdtToolDb_GetDeviceEntryExcepDesc(m_pdtToolDbDevice, name.c_str(), desc, 512);
|
||||
QTableWidgetItem *item = ui->tableWidget->item(i, 2);
|
||||
item->setToolTip(desc);
|
||||
}
|
||||
|
||||
std::map<HGUInt, bool>::iterator iter;
|
||||
for (iter = dbEntryItems.begin(); iter != dbEntryItems.end(); ++iter)
|
||||
{
|
||||
if (!iter->second)
|
||||
{
|
||||
HGPdtToolDb_SetDeviceEntryStatus(m_pdtToolDbDevice, iter->first, HGPDTTOOLDB_ENTRYSTATUS_NOTSUPP);
|
||||
}
|
||||
}
|
||||
|
||||
ui->tableWidget->selectRow(0);
|
||||
}
|
||||
|
||||
HGUInt Form_mainInterface::getTestItem(const QString &title)
|
||||
{
|
||||
HGUInt entry = 0;
|
||||
for (int i = 0; i < sizeof(Rela) / sizeof(RELA); ++i)
|
||||
{
|
||||
if (0 == wcscmp(title.toStdWString().c_str(), Rela[i].title))
|
||||
{
|
||||
entry = Rela[i].entryName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
HGUInt Form_mainInterface::getTestItemStatus(const QString &title)
|
||||
{
|
||||
HGUInt status = 0;
|
||||
for (int i = 0; i < sizeof(Rela) / sizeof(RELA); ++i)
|
||||
{
|
||||
if (0 == wcscmp(title.toStdWString().c_str(), Rela[i].title))
|
||||
{
|
||||
HGPdtToolDb_GetDeviceEntryStatus(m_pdtToolDbDevice, Rela[i].entryName, &status);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
bool Form_mainInterface::setTestItemStatus(const QString &title, HGUInt status)
|
||||
{
|
||||
bool ret = false;
|
||||
for (int i = 0; i < sizeof(Rela) / sizeof(RELA); ++i)
|
||||
{
|
||||
if (0 == wcscmp(title.toStdWString().c_str(), Rela[i].title))
|
||||
{
|
||||
if (HGBASE_ERR_OK == HGPdtToolDb_SetDeviceEntryStatus(m_pdtToolDbDevice, Rela[i].entryName, status))
|
||||
ret = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
QString Form_mainInterface::getItemStatusStr(HGUInt status)
|
||||
{
|
||||
static const QString statusStr[] = {tr("not test"), tr("not pass"), tr("not support"), tr("pass") };
|
||||
|
@ -505,28 +390,28 @@ void Form_mainInterface::updateUiEnabled(bool 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;
|
||||
p->cat = WRITE_CAT_VID_PID;
|
||||
p->val = &vidpid.Value;
|
||||
func_test_go((const wchar_t*)WRITE_CFG_NAME, (const wchar_t*)p, m_hg);
|
||||
func_test_go(WRITE_CFG_NAME, (const wchar_t*)p, m_hg);
|
||||
|
||||
p->cat = WRITE_CAT_SPEED;
|
||||
p->val = &jsonGlobal.speed_mode;
|
||||
func_test_go((const wchar_t*)WRITE_CFG_NAME, (const wchar_t*)p, m_hg);
|
||||
func_test_go(WRITE_CFG_NAME, (const wchar_t*)p, m_hg);
|
||||
|
||||
p->cat = WRITE_CAT_SLEEP;
|
||||
p->val = &jsonGlobal.sleep_time;
|
||||
func_test_go((const wchar_t*)WRITE_CFG_NAME, (const wchar_t*)p, m_hg);
|
||||
func_test_go(WRITE_CFG_NAME, (const wchar_t*)p, m_hg);
|
||||
|
||||
p->cat = WRITE_CAT_SERIALNUM;
|
||||
p->val = &m_serialNum;
|
||||
func_test_go((const wchar_t*)WRITE_CFG_NAME, (const wchar_t*)p, m_hg);
|
||||
func_test_go(WRITE_CFG_NAME, (const wchar_t*)p, m_hg);
|
||||
|
||||
delete p;
|
||||
}
|
||||
|
@ -545,15 +430,24 @@ void Form_mainInterface::on_tableWidget_currentItemChanged(QTableWidgetItem *cur
|
|||
QTableWidgetItem *item2 = ui->tableWidget->item(row, 1);
|
||||
QString title = item2->text();
|
||||
|
||||
bool man = m_map_title_name.value(title).is_man;
|
||||
ui->pbtn_start->setEnabled(!man);
|
||||
if (nullptr == m_handle)
|
||||
{
|
||||
ui->pbtn_start->setVisible(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
bool man = m_map_title_name.value(title).is_man;
|
||||
ui->pbtn_start->setEnabled(!man);
|
||||
}
|
||||
|
||||
m_textTips->setViewContent(m_map_title_name.value(title).desc);
|
||||
ui->stackedWidget->setCurrentWidget(m_textTips);
|
||||
m_view->clearImage();
|
||||
|
||||
HGUInt entryName = getTestItem(title);
|
||||
if (HGBASE_ERR_OK == HGPdtToolDb_CheckDeviceEntryImage(m_pdtToolDbDevice, entryName))
|
||||
std::string name = m_map_title_name.value(title).name.toStdString();
|
||||
HGUInt imageCount = 0;
|
||||
HGPdtToolDb_GetDeviceEntryImageCount(m_pdtToolDbDevice, name.c_str(), &imageCount);
|
||||
if (imageCount > 0)
|
||||
{
|
||||
ui->pbtn_showImg->setVisible(true);
|
||||
}
|
||||
|
@ -565,7 +459,8 @@ void Form_mainInterface::on_pbtn_start_clicked()
|
|||
QTableWidgetItem *item = ui->tableWidget->item(row, 1);
|
||||
QString title = item->text();
|
||||
QString name = m_map_title_name.value(title).name;
|
||||
func_test_go(name.toStdWString().c_str(), L"null", m_hg);
|
||||
if (m_hg != nullptr)
|
||||
func_test_go(name.toStdWString().c_str(), L"null", m_hg);
|
||||
|
||||
updateUiEnabled(false);
|
||||
m_isTesting = true;
|
||||
|
@ -579,8 +474,9 @@ void Form_mainInterface::on_pbtn_showImg_clicked()
|
|||
int row = ui->tableWidget->currentRow();
|
||||
QTableWidgetItem *item = ui->tableWidget->item(row, 1);
|
||||
QString title = item->text();
|
||||
HGResult ret = HGPdtToolDb_DownloadDeviceEntryImage(m_pdtToolDbDevice, getTestItem(title), m_mainwnd->m_ftpHost.toStdString().c_str(),
|
||||
m_mainwnd->m_ftpPort, fileName.toStdString().c_str());
|
||||
std::string name = m_map_title_name.value(title).name.toStdString();
|
||||
HGResult ret = HGPdtToolDb_DownloadDeviceEntryImage(m_pdtToolDbDevice, name.c_str(), m_mainwnd->m_ftpHost.toStdString().c_str(),
|
||||
m_mainwnd->m_ftpPort, 0, fileName.toStdString().c_str());
|
||||
if(ret == HGBASE_ERR_OK)
|
||||
{
|
||||
ui->pbtn_leftRotate->setVisible(true);
|
||||
|
|
|
@ -78,9 +78,6 @@ private:
|
|||
unsigned int Value;
|
||||
};
|
||||
void initTableWidgetUi();
|
||||
HGUInt getTestItem(const QString &title);
|
||||
HGUInt getTestItemStatus(const QString &title);
|
||||
bool setTestItemStatus(const QString &title, HGUInt status);
|
||||
QString getItemStatusStr(HGUInt status);
|
||||
QString getCachePath();
|
||||
QString getCacheFileName();
|
||||
|
|
Loading…
Reference in New Issue