|
@@ -90,7 +90,7 @@ END_MESSAGE_MAP()
|
|
|
|
|
|
// CMFCApplication1Dlg 对话框
|
|
// CMFCApplication1Dlg 对话框
|
|
|
|
|
|
-
|
|
|
|
|
|
+vector<string> g_vecFileList;//扫描文件列表
|
|
HANDLE _threadProcess = NULL;
|
|
HANDLE _threadProcess = NULL;
|
|
DWORD WINAPI ProcessThread(void *param)
|
|
DWORD WINAPI ProcessThread(void *param)
|
|
{
|
|
{
|
|
@@ -189,11 +189,59 @@ int IdentifyCallback(result::spinfo& pinfo, void* param)
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+enum EnumSearFileType {
|
|
|
|
+ file,//扫描文件
|
|
|
|
+ dir,//扫描文件夹
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+void GetImages(CString strPath)
|
|
|
|
+{
|
|
|
|
+ queue<CString> queuePath;
|
|
|
|
+ queuePath.push(strPath);
|
|
|
|
+ EnumSearFileType serchType = file;
|
|
|
|
+ CFileFind finder;
|
|
|
|
+ do
|
|
|
|
+ {
|
|
|
|
+ bool bFinished = finder.FindFile(queuePath.front() + _T("\\*.JPG"));
|
|
|
|
+ while (serchType == file && bFinished)
|
|
|
|
+ {
|
|
|
|
+ bFinished = finder.FindNextFile();
|
|
|
|
+ if (finder.IsDirectory())continue;
|
|
|
|
+ CString strPath = finder.GetFilePath();
|
|
|
|
+ g_vecFileList.push_back(UnicodeToGB2312(strPath));
|
|
|
|
+ }
|
|
|
|
+ serchType = dir;
|
|
|
|
+ bFinished = finder.FindFile(queuePath.front() + _T("\\*.*"));
|
|
|
|
+ while (bFinished)
|
|
|
|
+ {
|
|
|
|
+ bFinished = finder.FindNextFile();
|
|
|
|
+ if (finder.IsDirectory() && !finder.IsDots())
|
|
|
|
+ {
|
|
|
|
+ queuePath.push(finder.GetFilePath());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ queuePath.pop();
|
|
|
|
+ serchType = file;
|
|
|
|
+ } while (queuePath.size() > 0);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+string GetBatchId()
|
|
|
|
+{
|
|
|
|
+ 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);
|
|
|
|
+ return chBuf;
|
|
|
|
+}
|
|
|
|
|
|
HANDLE _threadScan = NULL;
|
|
HANDLE _threadScan = NULL;
|
|
char* g_strIdentifyMsg[7] = { "正常","内部error","批次号异常","保存路径异常","模板为空","图像列表异常","图像列表不是模板整数倍" };
|
|
char* g_strIdentifyMsg[7] = { "正常","内部error","批次号异常","保存路径异常","模板为空","图像列表异常","图像列表不是模板整数倍" };
|
|
DWORD WINAPI ScanThread(void *param)
|
|
DWORD WINAPI ScanThread(void *param)
|
|
{
|
|
{
|
|
|
|
+ g_vecFileList.clear();
|
|
|
|
+ GetImages(CConfig::Instance()->m_strImg);
|
|
|
|
+
|
|
CMFCApplication1Dlg* pWnd = (CMFCApplication1Dlg*)theApp.m_pMainWnd;
|
|
CMFCApplication1Dlg* pWnd = (CMFCApplication1Dlg*)theApp.m_pMainWnd;
|
|
pWnd->FormatScanMsg("启动扫描线程......");
|
|
pWnd->FormatScanMsg("启动扫描线程......");
|
|
auto exitfun = [&]() {
|
|
auto exitfun = [&]() {
|
|
@@ -215,7 +263,10 @@ DWORD WINAPI ScanThread(void *param)
|
|
exitfun();
|
|
exitfun();
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
- nRet = api_processing_images("123456",
|
|
|
|
|
|
+ //生成批次号
|
|
|
|
+ string strBatchId = GetBatchId();
|
|
|
|
+ pWnd->FormatScanMsg("创建批次id:%s", strBatchId.c_str());
|
|
|
|
+ nRet = api_processing_images(strBatchId.c_str(),
|
|
strTempDir.c_str(),
|
|
strTempDir.c_str(),
|
|
temeplatInfo,
|
|
temeplatInfo,
|
|
sujChiInfo,
|
|
sujChiInfo,
|