2 Commits 2e0b93fe5f ... f17ed59455

Author SHA1 Message Date
  duanjianjun f17ed59455 Merge branch 'master' of http://gitz.zhixinhuixue.net:18880/zxhx-client-tool/pdfproject 2 years ago
  duanjianjun a7ecad74d5 1 2 years ago

BIN
MFCApplication1/MFCApplication1.rc


+ 53 - 2
MFCApplication1/MFCApplication1Dlg.cpp

@@ -90,7 +90,7 @@ END_MESSAGE_MAP()
 
 // CMFCApplication1Dlg 对话框
 
-
+vector<string> g_vecFileList;//扫描文件列表
 HANDLE _threadProcess = NULL;
 DWORD WINAPI ProcessThread(void *param)
 {
@@ -189,11 +189,59 @@ int IdentifyCallback(result::spinfo& pinfo, void* param)
 	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;
 char* g_strIdentifyMsg[7] = { "正常","内部error","批次号异常","保存路径异常","模板为空","图像列表异常","图像列表不是模板整数倍" };
 DWORD WINAPI ScanThread(void *param)
 {
+	g_vecFileList.clear();
+	GetImages(CConfig::Instance()->m_strImg);
+
 	CMFCApplication1Dlg* pWnd = (CMFCApplication1Dlg*)theApp.m_pMainWnd;
 	pWnd->FormatScanMsg("启动扫描线程......");
 	auto exitfun = [&]() {
@@ -215,7 +263,10 @@ DWORD WINAPI ScanThread(void *param)
 		exitfun();
 		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(),
 		temeplatInfo,
 		sujChiInfo,

+ 2 - 0
MFCApplication1/resource.h

@@ -20,6 +20,8 @@
 #define IDC_BTN_CUTPATH                 1011
 #define IDC_EDIT_CUTPATH                1012
 #define IDC_EDIT_SCANMSG                1013
+#define IDC_EDIT_CUTPATH2               1014
+#define IDC_EDIT_SCANPROCESS            1014
 
 // Next default values for new objects
 //