|
@@ -167,12 +167,10 @@ char* g_strIdentifyMsg[7] = { "正常","内部error","批次号异常","保存
|
|
|
DWORD WINAPI ScanThread(void *param)
|
|
|
{
|
|
|
CMFCApplication1Dlg* pWnd = (CMFCApplication1Dlg*)theApp.m_pMainWnd;
|
|
|
+ pWnd->FormatScanMsg("启动扫描线程......");
|
|
|
auto exitfun = [&]() {
|
|
|
- //通知发送消息到窗口
|
|
|
- CString strErrorMsg = L"";
|
|
|
- strErrorMsg.Format(L"扫描线程退出!\r\n");
|
|
|
- SendMessage(pWnd->m_hWnd, WM_SHOWSCANINFO, (WPARAM)strErrorMsg.GetBuffer(), 1);
|
|
|
- strErrorMsg.ReleaseBuffer();
|
|
|
+ pWnd->FormatScanMsg("扫描线程退出。");
|
|
|
+ SendMessage(pWnd->m_hWnd, WM_SHOWSCANINFO, 0, 1);
|
|
|
};
|
|
|
std::vector<std::string> imgPath; //图片本地路径(和上面url地址一一对应)
|
|
|
preinfo::templatesInfo temeplatInfo;
|
|
@@ -185,7 +183,7 @@ DWORD WINAPI ScanThread(void *param)
|
|
|
int nRet = PareseModeJson(temeplatInfo);
|
|
|
if (nRet)
|
|
|
{
|
|
|
- pWnd->FormatScanMsg("模板解析识别");
|
|
|
+ pWnd->FormatScanMsg("模板解析失败!");
|
|
|
exitfun();
|
|
|
return 0;
|
|
|
}
|
|
@@ -403,16 +401,17 @@ LRESULT CMFCApplication1Dlg::OnShowInfo(WPARAM wParam, LPARAM lParam)
|
|
|
|
|
|
LRESULT CMFCApplication1Dlg::OnShowScanInfo(WPARAM wParam, LPARAM lParam)
|
|
|
{
|
|
|
+ if (lParam == 1)
|
|
|
+ {
|
|
|
+ GetDlgItem(ID_BTN_SCAN)->EnableWindow(TRUE);
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
wchar_t* p = (wchar_t*)wParam;
|
|
|
CString str;
|
|
|
str.Format(_T("%s"), p);
|
|
|
m_strScanMsg += str;
|
|
|
UpdateData(FALSE);
|
|
|
|
|
|
- if (lParam == 1)
|
|
|
- {
|
|
|
- GetDlgItem(ID_BTN_SCAN)->EnableWindow(TRUE);
|
|
|
- }
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -586,8 +585,14 @@ void CMFCApplication1Dlg::FormatScanMsg(const char *szFmt, ...)
|
|
|
char* szLogMsg = buffer.GetBuf(nLength);
|
|
|
_vsnprintf(szLogMsg, nLength, szFmt, ap);
|
|
|
va_end(ap);
|
|
|
+ SYSTEMTIME st;
|
|
|
+ GetLocalTime(&st);
|
|
|
+ char chBuf[24] = { 0 };
|
|
|
+ sprintf(chBuf, "%02d-%02d-%02d %02d:%02d:%02d ",
|
|
|
+ st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
|
|
|
+
|
|
|
CString strMsg;
|
|
|
// 扫描异常
|
|
|
- strMsg.Format(L"%s\r\n", GB2312ToTstring(szLogMsg).c_str());
|
|
|
+ strMsg.Format(L"%s %s\r\n", GB2312ToTstring(chBuf).c_str(), GB2312ToTstring(szLogMsg).c_str());
|
|
|
SendMessage(WM_SHOWSCANINFO, (WPARAM)strMsg.GetBuffer(), 0);
|
|
|
}
|