diff --git a/Cigarette/cigarette.cpp b/Cigarette/cigarette.cpp index f263da7..fb9bc06 100644 --- a/Cigarette/cigarette.cpp +++ b/Cigarette/cigarette.cpp @@ -278,8 +278,10 @@ Cigarette::Cigarette(QWidget* parent) //保存图片线程 saveThread.init();//初始化 +#ifdef __TCPSend #ifdef __ExportData - connect(&saveThread, &SaveThread::sendDataToExport, &exportDataThread, &ExportDataThread::GetDataFromSaveThread); + connect(&sync_work_thread, &SyncWorkThread::sendDataToCompress, &exportDataThread, &ExportDataThread::GetDataFromSaveThread); +#endif #endif saveThread.start_work(); #ifdef __UDPSend diff --git a/Cigarette/exportData.cpp b/Cigarette/exportData.cpp index 087593c..c99ef8a 100644 --- a/Cigarette/exportData.cpp +++ b/Cigarette/exportData.cpp @@ -328,7 +328,7 @@ void ExportDataThread::run() } if ((b_quit || (!timer->isActive() && !readyToSendZip)) && (!tmpListToZip.isEmpty())) { - listToZip += tmpListToZip; + listToZip.unite(tmpListToZip); tmpListToZip.clear(); zipTimeStamp.append(lastTimeStamp[0]); lastTimeStamp.clear(); @@ -377,17 +377,16 @@ void ExportDataThread::run() argsOk.append("a"); argsOk.append(zipFilePaths[1]); + // create zip file - for (int i = 0; i < listToZip.size(); i++) { - QStringList strList = listToZip[i].split("_"); - strList = strList[strList.size() - 1].split("."); - int index = listToZip[i].lastIndexOf("/\\", 0); - if (strList[0] == okStr) { - okStream << listToZip[i] << endl; + QMapIterator iterator(listToZip); + while (iterator.hasNext()) { + iterator.next(); + if (iterator.value()) { + ngStream << iterator.key() << endl; } else { - - ngStream << listToZip[i] << endl; + okStream << iterator.key() << endl; } } argsNg.append("-i@" + fileList[0]); @@ -515,7 +514,7 @@ void ExportDataThread::ConnectServer(QString srcPath, QString destPath) { } } -void ExportDataThread::GetDataFromSaveThread(QString filePath) { +void ExportDataThread::GetDataFromSaveThread(QString filePath, bool Ng) { QString remotePath; QStringList currentTimeStamp; QRegExp rx("((([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8]))))|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00))-02-29))_([0-1]?[0-9]|2[0-3])-([0-5][0-9])"); @@ -534,7 +533,7 @@ void ExportDataThread::GetDataFromSaveThread(QString filePath) { if (lastTimeStamp.isEmpty() || (currentTimeStamp[0] != lastTimeStamp[0])) { if (!tmpListToZip.isEmpty()) { - listToZip = tmpListToZip; + listToZip.unite(tmpListToZip); tmpListToZip.clear(); } if (!listToZip.isEmpty()) { @@ -546,7 +545,7 @@ void ExportDataThread::GetDataFromSaveThread(QString filePath) { timer->stop(); timer->start(1000 * (60 * 1 + 10)); } - tmpListToZip.append(filePath); + tmpListToZip.insert(filePath, Ng); } } diff --git a/Cigarette/exportData.h b/Cigarette/exportData.h index 028cedf..5b5ed71 100644 --- a/Cigarette/exportData.h +++ b/Cigarette/exportData.h @@ -1,5 +1,7 @@ #pragma once #include +#include +#include #include "ui_output_statistic.h" #include #include @@ -11,9 +13,10 @@ #include "common.h" #include "cigarette.h" #include "qdebug.h" -#define EXPORTDATA_FILE "camera%1_data_info.xml" #include +#define EXPORTDATA_FILE "camera%1_data_info.xml" + using namespace tinyxml2; class _XMLExportDataInfo { @@ -116,8 +119,9 @@ public: wait(); } QTimer* timer; - QStringList listToZip; - QStringList tmpListToZip; + + QMap listToZip; + QMap tmpListToZip; BOOLEAN readyToSendZip; @@ -145,7 +149,7 @@ public: public slots: void EDrecMsgFromCigarette(); - void GetDataFromSaveThread(QString filePath); + void GetDataFromSaveThread(QString filePath, bool Ng); private: diff --git a/Cigarette/syncworkthread.cpp b/Cigarette/syncworkthread.cpp index 894acd7..333ede9 100644 --- a/Cigarette/syncworkthread.cpp +++ b/Cigarette/syncworkthread.cpp @@ -337,16 +337,6 @@ void SyncWorkThread::run() roi = cv::Rect(j * m.cols, index * m.rows, m.cols, m.rows); m.copyTo(merge_image(roi)); if (merge_index == work_camera_nums * unit_count) { - - if (!IsNG) - { - ngReason = 1; - } - else - { - ngReason = 0; - } - //条盒TJ 小盒BJ file_name = g_conf_path.save_pics_path + "/" + now_ts.toString("yyyy-MM-dd") + "/"+"416_BJ_01_" @@ -357,6 +347,7 @@ void SyncWorkThread::run() QString sendName = "416_BJ_01_" + now_ts.toString("yyyy-MM-dd_HH-mm-ss.zzz"); TCPSendInfo.pics_name = sendName.toLocal8Bit().constData(); TCP_Info_queue->put(TCPSendInfo); + sendDataToCompress(file_name, IsNG); #endif } } diff --git a/Cigarette/syncworkthread.h b/Cigarette/syncworkthread.h index 879c0ac..02266e3 100644 --- a/Cigarette/syncworkthread.h +++ b/Cigarette/syncworkthread.h @@ -22,6 +22,10 @@ signals: void event_ok(int Num); void event_ng(int Num); #endif +#ifdef __TCPSend +signals: + void sendDataToCompress(QString filePath, bool Ng); +#endif public: SyncWorkThread(QObject* parent = 0) : QThread(parent)