生产工具动态校正流程中,如果其中一项失败,则在子项中提示为红色

This commit is contained in:
yangjiaxuan 2024-07-25 15:45:41 +08:00
parent e3013c9e7d
commit a579da892e
1 changed files with 40 additions and 7 deletions

View File

@ -472,14 +472,14 @@ static int sane_ex_callback(SANE_Handle hdev, int code, void* data, unsigned int
wcscpy(buf, L"单张测试失败, 原因--->"); wcscpy(buf, L"单张测试失败, 原因--->");
} }
} }
else if (wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_CORRECTION_GRAY_200DPI) == 0 else if (wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_CORRECTION_RGB_200DPI) == 0
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_CORRECTION_GRAY_200DPI) == 0 || wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_CORRECTION_GRAY_200DPI) == 0
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_CORRECTION_RGB_300DPI) == 0 || wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_CORRECTION_RGB_300DPI) == 0
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_CORRECTION_GRAY_300DPI) == 0 || wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_CORRECTION_GRAY_300DPI) == 0
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_CORRECTION_RGB_600DPI) == 0 || wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_CORRECTION_RGB_600DPI) == 0
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_CORRECTION_GRAY_600DPI) == 0) || wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_CORRECTION_GRAY_600DPI) == 0)
{ {
if (strcmp((char*)data, STATU_DESC_SCANNER_ERR_IMAGE_CORRECTION_FAIL) == 0) if (strcmp((char*)data, STATU_DESC_SCANNER_ERR_IMAGE_CORRECTION_FINISHED) != 0)
{ {
type = false; type = false;
} }
@ -494,9 +494,30 @@ static int sane_ex_callback(SANE_Handle hdev, int code, void* data, unsigned int
if (wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_CORRECTION) == 0) if (wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_CORRECTION) == 0)
{ {
if (g_dynamicCorrectStatus == SCANNER_ERR_IMAGE_CORRECTION_FAIL || g_currentCorrectType == 6) if (g_currentCorrectType == 7)
{ {
h->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)buf, type); while (1)
{
int count = 0;
if (g_dynamicCorrectStatus == SCANNER_ERR_IMAGE_CORRECTION_FAIL)
{
type = false;
h->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)buf, type);
break;
}
else if (g_dynamicCorrectStatus == SCANNER_ERR_IMAGE_CORRECTION_FINISHED)
{
type = true;
h->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)buf, type);
break;
}
else if (count == 30000) //30s
{
break;
}
std::this_thread::sleep_for(std::chrono::milliseconds(1));
count++;
}
} }
} }
else else
@ -695,8 +716,10 @@ void test::thread_dynamic_correct(std::string correctData)
if (g_currentCorrectType > 1) if (g_currentCorrectType > 1)
m_waitCorrect.wait(lock); m_waitCorrect.wait(lock);
if (g_dynamicCorrectStatus == SCANNER_ERR_IMAGE_CORRECTION_FAIL) if (g_currentCorrectType == 0)
break; {
return;
}
CorrectMode correctMode = m_correctModeMap.at(g_currentCorrectType); CorrectMode correctMode = m_correctModeMap.at(g_currentCorrectType);
int dpi = correctMode.dpi; int dpi = correctMode.dpi;
@ -1833,8 +1856,18 @@ DECL_API(int) func_test_correct(bool isSuccess, int *currentIndex)
{ {
if (!isSuccess) if (!isSuccess)
{ {
g_dynamicCorrectStatus = SCANNER_ERR_IMAGE_CORRECTION_FAIL;
*currentIndex = g_currentCorrectType - 1; *currentIndex = g_currentCorrectType - 1;
if (g_currentCorrectType == 7)
{
g_dynamicCorrectStatus = SCANNER_ERR_IMAGE_CORRECTION_FAIL;
}
}
else
{
if (g_currentCorrectType == 7)
{
g_dynamicCorrectStatus = SCANNER_ERR_IMAGE_CORRECTION_FINISHED;
}
} }
test_->m_waitCorrect.notify_all(); test_->m_waitCorrect.notify_all();