diff --git a/app/HGProductionTool/ProductionTool_zh_CN.qm b/app/HGProductionTool/ProductionTool_zh_CN.qm index a3cd089..59cc1a5 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 0fdf699..63b6fa1 100644 --- a/app/HGProductionTool/ProductionTool_zh_CN.ts +++ b/app/HGProductionTool/ProductionTool_zh_CN.ts @@ -130,35 +130,35 @@ 取消 - - + - + + tips 提示 - + Speed mode 速度模式 - + Failed! 失败! - + Succeed! 成功! - + Sleep time 休眠时间 - + Vid and Pid Vid和Pid @@ -171,32 +171,32 @@ 检测到配置%1不一致,已重新配置,请再次检查 - + Consistent configuration 配置一致! - + device is lost 设备已丢失 - + Serial num is empty 序列号为空 - + sn is illegal 序列号不合法 - + The device is testing 该设备正在进行测试 - + set sn failed 设置序列号失败 @@ -215,15 +215,15 @@ - - + + Speep mode: %1PPM Speep mode: %1PPM 速度模式: %1PPM - + Pass Pass @@ -238,8 +238,8 @@ - - + + Sleep time: %1minute Sleep time: %1minute @@ -248,8 +248,8 @@ - - + + Vid: %1 Pid: %2 Vid: %1 Pid: %2 @@ -258,42 +258,42 @@ - - + + Device model: %1 设备型号: %1 - + Current Configration of device: 当前设备配置: - + Fail Fail - - - + + + Set serial number: %1 设置序列号: %1 - + Device model 设备型号 - - + + Detected that the current device's vid-pid and device object are not consistent. 检测到当前设备的vid-pid和设备对象不一致. - - + + Please reboot device to update. 请重启设备刷新. @@ -314,24 +314,24 @@ 测试结果:成功! - - + + Inconsistent configuration %1detected, please reconfigure, and check again 检测到配置 %1不一致,请重新配置后再次检查 - + Inconsistent configuration %1detected, please reboot and reconfigure, and check again 检测到配置 %1不一致,请重启后再次检查 - + Set configuration to device 将目标配置设置到设备 - + Test content: 测试内容: @@ -342,19 +342,19 @@ - - + + Sleep time: Not sleeping 休眠时间: 不休眠 - - + + Tester: %1, Test item: %2 测试员: %1, 测试项: %2 - + set sn succeed 设置序列号成功 @@ -1386,7 +1386,7 @@ - + Not sleeping 不休眠 @@ -1413,21 +1413,21 @@ 设备序列号: %1, 测试项: %2, 测试结果: 通过! - - + + device history scan count: 设备历史扫描张数: - - - - + + + + Prompt 提示 - + please verify the size of the device's cpu and disk: 请验证设备内存和硬盘容量大小: @@ -1444,32 +1444,32 @@ - + Tester: %1, Test item: %2, Test result: Failed! Reason: %3 测试员: %1, 测试项: %2, 测试结果: 不通过! 原因: %3 - + Tester: %1, Test item: %2, Test result: Pass! 测试员: %1, 测试项: %2, 测试结果: 通过! - + No paper 无纸 - + Device is sleeping 设备处于休眠模式 - + Counting mode 设备处于计数模式 - + Other error 其他错误 @@ -1478,39 +1478,54 @@ 设备序列号:%1 - + ID 序号 - + Test items 测试项 - + status 测试状态 - + not test 未测试 - - + + not pass 不通过 - + + Actual cpu size:%1 + 实际内存容量:%1 + + + + Warning + 警告 + + + + Device hard drive or memory detected to be too small! + 检测到设备硬盘或内存过小! + + + not support 不支持 - - + + pass 通过 @@ -1536,14 +1551,14 @@ Pid: - - + + device roller count: 设备滚轴张数: - + image pixel: 标准圆:宽 * 高: @@ -1568,27 +1583,28 @@ - - Target cpu size:%1 - 目标内存大小:%1 + + Target cpu size:>%1 + Target cpu size:%1 + 目标内存大小:>%1 - - Target disk size:%1 - 目标硬盘容量:%1 + + Target disk size:>%1 + Target disk size:%1 + 目标硬盘容量:>%1 - Actual pu size:%1 - 实际内存大小:%1 + 实际内存大小:%1 - + Actual disk size:%1 实际硬盘容量:%1 - + minute 分钟 @@ -1709,38 +1725,38 @@ 数据库错误 - - - - - + + + + + tips 提示 - + production tool-burn station 华高生产工具-烧录工位 - + production tool-init test station 华高生产工具-初检工位 - + production tool-image test station 华高生产工具-图像测试工位 - + production tool-pressure test station 华高生产工具-压力测试工位 - - - + + + Is testing, do not close! 测试中,请勿关闭! @@ -1762,8 +1778,8 @@ 取消 - - + + cannot create more table 不能创建更多项目 diff --git a/app/HGProductionTool/analysisjson.cpp b/app/HGProductionTool/analysisjson.cpp index a4b5e39..53aaeec 100644 --- a/app/HGProductionTool/analysisjson.cpp +++ b/app/HGProductionTool/analysisjson.cpp @@ -57,8 +57,8 @@ AnalysisJson::json_global AnalysisJson::GetGlobal() obj["speed-mode"].toInt(), obj["sleep-time"].toInt(), obj["device-model"].toString(), - obj["cpu-size"].toString(), - obj["disk-size"].toString()}; + obj["cpu-size"].toInt(), + obj["disk-size"].toInt()}; } diff --git a/app/HGProductionTool/analysisjson.h b/app/HGProductionTool/analysisjson.h index ac0abe9..87b0ece 100644 --- a/app/HGProductionTool/analysisjson.h +++ b/app/HGProductionTool/analysisjson.h @@ -26,8 +26,8 @@ public: std::int32_t speed_mode; std::int32_t sleep_time; QString device_model; - QString cpu_size; - QString disk_size; + std::int32_t cpu_size; + std::int32_t disk_size; }; AnalysisJson() = delete ; diff --git a/app/HGProductionTool/form_maininterface.cpp b/app/HGProductionTool/form_maininterface.cpp index 66e4a04..a99810a 100644 --- a/app/HGProductionTool/form_maininterface.cpp +++ b/app/HGProductionTool/form_maininterface.cpp @@ -59,7 +59,7 @@ Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn:: connect(this, SIGNAL(testCorrectInfo(QString)), this, SLOT(on_testCorrectInfo(QString)), Qt::QueuedConnection); connect(this, SIGNAL(testGetDevCfgInfo(int,int,int,int,QString,QString,QString)), this, SLOT(on_testGetDevCfgInfo(int,int,int,int,QString,QString,QString)), Qt::QueuedConnection); connect(this, SIGNAL(testOpenCacheFile(QString)), this, SLOT(on_testOpenCacheFile(QString)), Qt::QueuedConnection); - connect(this, SIGNAL(testGetDevCpuDisk(QString,QString)), this, SLOT(on_testGetDevCpuDisk(QString,QString)), Qt::QueuedConnection); + connect(this, SIGNAL(testGetDevCpuDisk(int,int)), this, SLOT(on_testGetDevCpuDisk(int,int)), Qt::QueuedConnection); if (m_handle) { @@ -277,20 +277,33 @@ void Form_mainInterface::on_testGetDevCfgInfo(int vid, int pid, int sleepTime, i m_textTips->setViewContent(str); } -void Form_mainInterface::on_testGetDevCpuDisk(QString cpu, QString disk) +void Form_mainInterface::on_testGetDevCpuDisk(int cpu, int disk) { AnalysisJson analysisJson(m_profileName); AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal(); - QString cpu_size = jsonGlobal.cpu_size; - QString disk_size = jsonGlobal.disk_size; + int cpu_size = jsonGlobal.cpu_size; + int disk_size = jsonGlobal.disk_size; + + float devCpuSize = (float)cpu / 1024 / 1024; + char buf[10] = { 0 }; + sprintf(buf, "%.2f", devCpuSize); + + float devDiskSize = (float)disk / 1024 / 1024; + char buf2[10] = { 0 }; + sprintf(buf2, "%.2f", devDiskSize); QString str = (tr("please verify the size of the device's cpu and disk:") + "\n\n\t"); - str.append(tr("Target cpu size:%1").arg(cpu_size) + "\n\t"); - str.append(tr("Target disk size:%1").arg(disk_size) + "\n\n\t"); + str.append(tr("Target cpu size:>%1").arg(QString::number(cpu_size)) + "GB\n\t"); + str.append(tr("Target disk size:>%1").arg(QString::number(disk_size)) + "GB\n\n\t"); - str.append(tr("Actual pu size:%1").arg(cpu) + "\n\t"); - str.append(tr("Actual disk size:%1").arg(disk) + "\n\t"); + str.append(tr("Actual cpu size:%1").arg(buf) + "GB\n\t"); + str.append(tr("Actual disk size:%1").arg(buf2) + "GB\n\t"); m_textTips->setViewContent(str); + + if (cpu_size * 1024 * 1024 > cpu || disk_size * 1024 * 1024 > disk) + { + QMessageBox::warning(this, tr("Warning"), tr("Device hard drive or memory detected to be too small!")); + } } void Form_mainInterface::on_testOpenCacheFile(QString name) diff --git a/app/HGProductionTool/form_maininterface.h b/app/HGProductionTool/form_maininterface.h index acf9d62..575fe6c 100644 --- a/app/HGProductionTool/form_maininterface.h +++ b/app/HGProductionTool/form_maininterface.h @@ -41,7 +41,7 @@ signals: void testDistortion(SANE_DISTORTION_VAL data); void testCorrectInfo(QString info); void testGetDevCfgInfo(int vid, int pid, int sleepTime, int speedMode, QString devSn, QString devFw, QString devModel); - void testGetDevCpuDisk(QString cpu, QString disk); + void testGetDevCpuDisk(int cpu, int disk); void testOpenCacheFile(QString name); private slots: @@ -50,7 +50,7 @@ private slots: void on_testDistortion(SANE_DISTORTION_VAL data); void on_testCorrectInfo(QString info); void on_testGetDevCfgInfo(int vid, int pid, int sleepTime, int speedMode, QString devSn, QString devFw, QString devModel); - void on_testGetDevCpuDisk(QString cpu, QString disk); + void on_testGetDevCpuDisk(int cpu, int disk); void on_testOpenCacheFile(QString name); void on_viewerDblClick(); diff --git a/app/HGProductionTool/hgscanner.cpp b/app/HGProductionTool/hgscanner.cpp index ba94e53..136d5be 100644 --- a/app/HGProductionTool/hgscanner.cpp +++ b/app/HGProductionTool/hgscanner.cpp @@ -17,8 +17,8 @@ hgscanner::hgscanner(Form_mainInterface *form, Form_BurnMode *burnMode, Dialog_I , m_devSn("") , m_devFw("") , m_devModel("") - , m_cpu("") - , m_disk("") + , m_cpu(0) + , m_disk(0) { cb_ = nullptr; } @@ -75,11 +75,11 @@ void hgscanner::test_callback(const wchar_t* name, test_event ev, void* data, si if(ev == TEST_EVEB_GET_DEVICE_DEVS_CPU) { - m_cpu = QString::fromStdWString((const wchar_t*)data); + m_cpu = *(int*)data; } else if (ev == TEST_EVEB_GET_DEVICE_DEVS_DISK) { - m_disk = QString::fromStdWString((const wchar_t*)data); + m_disk = *(int*)data; } if (ev == TEST_EVENT_TIPS) diff --git a/app/HGProductionTool/hgscanner.h b/app/HGProductionTool/hgscanner.h index 0d51cee..acd90ea 100644 --- a/app/HGProductionTool/hgscanner.h +++ b/app/HGProductionTool/hgscanner.h @@ -47,7 +47,7 @@ private: QString m_devSn; QString m_devFw; QString m_devModel; - QString m_cpu; - QString m_disk; + int m_cpu; + int m_disk; }; diff --git a/app/HGProductionTool/mainwindow.cpp b/app/HGProductionTool/mainwindow.cpp index 61a4763..3baa837 100644 --- a/app/HGProductionTool/mainwindow.cpp +++ b/app/HGProductionTool/mainwindow.cpp @@ -280,22 +280,27 @@ bool MainWindow::RemoveInterface(Form_mainInterface * mainInterface) delete mainInterface; mainInterface = nullptr; m_testingRef = 0; + updateActionStatus(true); //HGBase_LeaveLock(m_lock); updateSplitter(); return true; } +void MainWindow::updateActionStatus(bool enable) +{ + ui->act_refreshDevice->setEnabled(enable); + ui->act_close->setEnabled(enable); + ui->act_manage->setEnabled(enable); + ui->act_logOut->setEnabled(enable); + ui->act_changePwd->setEnabled(enable); + ui->act_export->setEnabled(enable); + ui->act_upload->setEnabled(enable); +} + void MainWindow::addTestingRef() { ++m_testingRef; - - ui->act_refreshDevice->setEnabled(false); - ui->act_close->setEnabled(false); - ui->act_manage->setEnabled(false); - ui->act_logOut->setEnabled(false); - ui->act_changePwd->setEnabled(false); - ui->act_export->setEnabled(false); - ui->act_upload->setEnabled(false); + updateActionStatus(false); } void MainWindow::releaseTesting() @@ -304,13 +309,7 @@ void MainWindow::releaseTesting() if (0 == m_testingRef) { - ui->act_refreshDevice->setEnabled(true); - ui->act_close->setEnabled(true); - ui->act_manage->setEnabled(true); - ui->act_logOut->setEnabled(true); - ui->act_changePwd->setEnabled(true); - ui->act_export->setEnabled(true); - ui->act_upload->setEnabled(true); + updateActionStatus(true); } } diff --git a/app/HGProductionTool/mainwindow.h b/app/HGProductionTool/mainwindow.h index 470756f..890f551 100644 --- a/app/HGProductionTool/mainwindow.h +++ b/app/HGProductionTool/mainwindow.h @@ -32,6 +32,7 @@ public: Form_mainInterface* FindInterface(SANE_Handle handle); bool AddInterface(Form_mainInterface * mainInterface); bool RemoveInterface(Form_mainInterface *mainInterface); + void updateActionStatus(bool enable); void addTestingRef(); void releaseTesting(); bool isTesting(); diff --git a/code/base/test_base.cpp b/code/base/test_base.cpp index c32bd6a..57c5eac 100644 --- a/code/base/test_base.cpp +++ b/code/base/test_base.cpp @@ -47,7 +47,8 @@ static struct Test_Map {HGPDTTOOLDB_NAME_DORMANCY ,HGPDTTOOLDB_TITLE_DORMANCY}, {HGPDTTOOLDB_NAME_GET_DEVICE_CONFIG ,HGPDTTOOLDB_TITLE_GET_DEVICE_CONFIG}, {HGPDTTOOLDB_NAME_GET_DEVICE_CPU_DISK ,HGPDTTOOLDB_TITLE_GET_DEVICE_CPU_DISK}, - {HGPDTTOOLDB_NAME_BACKUP ,HGPDTTOOLDB_TITLE_BACKUP} + {HGPDTTOOLDB_NAME_BACKUP ,HGPDTTOOLDB_TITLE_BACKUP}, + {HGPDTTOOLDB_NAME_SHUTDOWN ,HGPDTTOOLDB_TITLE_SHUTDOWN} }; static std::string StringToUtf(std::string strValue) @@ -571,12 +572,12 @@ public: test_map_[HGPDTTOOLDB_NAME_GET_DISTORTION_VAL] = &test::test_get_auto_distortion; test_map_[HGPDTTOOLDB_NAME_SET_DISTORTION_VAL] = &test::test_set_auto_distortion; - test_map_[HGPDTTOOLDB_NAME_CONFIRM_DISTORTION_VAL] = &test::test_confirm_auto_distortion; + test_map_[HGPDTTOOLDB_NAME_CONFIRM_DISTORTION_VAL] = &test::test_confirm_auto_distortion; test_map_[HGPDTTOOLDB_NAME_DORMANCY] = &test::test_dormancy; test_map_[HGPDTTOOLDB_NAME_PAPER_SEPARATION_STRENGTH] = &test::test_paper_separation_strength; test_map_[HGPDTTOOLDB_NAME_MECH_PAPER_FEEDING_INCLINATION] = &test::test_mech_paper_feeding_inclination; test_map_[HGPDTTOOLDB_NAME_CLEAR_ROLLER_COUNT] = &test::test_clear_roller_count; - test_map_[HGPDTTOOLDB_NAME_CLEAR_HISTORY_COUNT] = &test::test_clear_history_count; + test_map_[HGPDTTOOLDB_NAME_CLEAR_HISTORY_COUNT] = &test::test_clear_history_count; test_map_[HGPDTTOOLDB_NAME_COVER_SENSOR] = &test::test_single_page_test; test_map_[HGPDTTOOLDB_NAME_SINGLE_PAGE_TEST] = &test::test_single_page_test; @@ -593,6 +594,7 @@ public: test_map_[HGPDTTOOLDB_NAME_GET_DEVICE_CONFIG] = &test::test_get_device_config; test_map_[HGPDTTOOLDB_NAME_GET_DEVICE_CPU_DISK] = &test::test_get_device_cpu_disk; test_map_[HGPDTTOOLDB_NAME_BACKUP] = &test::test_backup; + test_map_[HGPDTTOOLDB_NAME_SHUTDOWN] = &test::test_shutdown; } int set_test(const wchar_t* name,const wchar_t* oper) { @@ -1481,43 +1483,33 @@ public: /*获取设备内存和硬盘容量大小*/ int test_get_device_cpu_disk(void* data) { - std::string cpu; + int cpu = 0; unsigned len = 0; - std::wstring wstr; - size_t size = 0; - int ret = helper_->io_control(IO_CTRL_CODE_GET_DEVS_CPU, &cpu[0], &len); - ret = str_to_wchar(cpu.c_str(), (wchar_t*)wstr.c_str(), &size); - if (ret == ERROR_INSUFFICIENT_BUFFER) - { - wstr.resize(size); - ret = str_to_wchar(cpu.c_str(), (wchar_t*)wstr.c_str(), &size); - } - helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVEB_GET_DEVICE_DEVS_CPU, (void*)wstr.c_str(), true); + int ret = helper_->io_control(IO_CTRL_CODE_GET_DEVS_CPU, &cpu, &len); - std::string disk; + if (0 != cpu) + { + helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVEB_GET_DEVICE_DEVS_CPU, (void*)&cpu, true); + } + + int disk = 0; unsigned len2 = 0; - std::wstring wstr2; - size_t size2 = 0; - ret = helper_->io_control(IO_CTRL_CODE_GET_DEVS_DISK, &disk[0], &len2); - ret = str_to_wchar(disk.c_str(), (wchar_t*)wstr2.c_str(), &size2); - if (ret == ERROR_INSUFFICIENT_BUFFER) - { - wstr2.resize(size2); - ret = str_to_wchar(disk.c_str(), (wchar_t*)wstr2.c_str(), &size2); - } - helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVEB_GET_DEVICE_DEVS_CPU, (void*)wstr2.c_str(), true); + ret = helper_->io_control(IO_CTRL_CODE_GET_DEVS_DISK, &disk, &len2); - helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVEB_GET_DEVICE_DEVS_CPU, wstr.empty() ? (void*)L"获取失败,设备不支持" : (void*)wstr.c_str(), wstr.empty() ? false : true); - helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVEB_GET_DEVICE_DEVS_DISK, wstr2.empty() ? (void*)L"获取失败,设备不支持" : (void*)wstr2.c_str(), wstr2.empty() ? false : true); - if (wstr.empty() || wstr2.empty()) + if (0 != disk) { - helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)(L"获取失败"), false); + helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVEB_GET_DEVICE_DEVS_DISK, (void*)&disk, true); + } + + if (0 == cpu || 0 == disk) + { + helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, nullptr, false); return -1; } else { - helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)(L"获取完成"), true); - return - 1; + helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, nullptr, true); + return -1; } return ret; @@ -1539,7 +1531,14 @@ public: } return ret; } - + /* 关机 */ + int test_shutdown(void *data) + { + int val = 0; + unsigned int len = 0; + int ret = helper_->io_control(IO_CTRL_CODE_SET_DEVS_SHUTDOWN, &val, &len); + return ret; + } /*设置设备型号*/ int test_set_devs_model(void* data) { diff --git a/code/base/test_base.h b/code/base/test_base.h index 372aade..ef683b4 100644 --- a/code/base/test_base.h +++ b/code/base/test_base.h @@ -89,11 +89,13 @@ /*压力测试灰色+600dpi*/ #define HGPDTTOOLDB_TITLE_PRESSUER_TEST_GRAY_600DPI L"压力测试灰色_600dpi" /*获取设备配置*/ -#define HGPDTTOOLDB_TITLE_GET_DEVICE_CONFIG L"获取设备配置" +#define HGPDTTOOLDB_TITLE_GET_DEVICE_CONFIG L"获取设备配置" /*获取设备内存和硬盘容量大小*/ -#define HGPDTTOOLDB_TITLE_GET_DEVICE_CPU_DISK L"获取设备内存和硬盘容量大小" +#define HGPDTTOOLDB_TITLE_GET_DEVICE_CPU_DISK L"获取设备内存和硬盘容量大小" /*备份设备配置*/ -#define HGPDTTOOLDB_TITLE_BACKUP L"备份设备配置" +#define HGPDTTOOLDB_TITLE_BACKUP L"备份设备配置" +/*关机*/ +#define HGPDTTOOLDB_TITLE_SHUTDOWN L"关机" //////////////////////////////////////NAME////////////////////////////////////// #define WRITE_CFG_NAME L"write-cfg" /* 设置json序列号 */ @@ -194,6 +196,8 @@ #define HGPDTTOOLDB_NAME_GET_DEVICE_CPU_DISK L"GET_DEVICE_CPU_DISK" /*备份设备配置*/ #define HGPDTTOOLDB_NAME_BACKUP L"BACKUP" +/*关机*/ +#define HGPDTTOOLDB_NAME_SHUTDOWN L"SHUTDOWN" #define TEST_DLL #ifdef TEST_DLL