new func write csv
This commit is contained in:
@@ -341,7 +341,7 @@ bool Hd_AI_tmp_module_savImg::readData(std::vector<cv::Mat>&vec_mat,QByteArray &
|
||||
//if (allNum++ % 2 == 0)
|
||||
// data = "2*3*2";// resByte.dequeue();
|
||||
//else
|
||||
data = "1*0*0";//1OK,2NG
|
||||
data = "1*1*1*1+1234+123666";//1OK,2NG
|
||||
resByte.clear();
|
||||
////之后根据结果类修改
|
||||
//if(resIfNg == true)
|
||||
|
||||
+1
-12
@@ -37,18 +37,7 @@ if(NE_DEVELOPER_DEFAULTS)
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/lib")
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/lib")
|
||||
SET(PROJECT_ROOT_PATH ${PROJECT_SOURCE_DIR})
|
||||
endif()
|
||||
if (MSVC_VERSION GREATER_EQUAL "1900")
|
||||
include(CheckCXXCompilerFlag)
|
||||
CHECK_CXX_COMPILER_FLAG("/std:c++17" _cpp_latest_flag_supported)
|
||||
if (_cpp_latest_flag_supported)
|
||||
add_compile_options("/std:c++17")
|
||||
else()
|
||||
message(WARNING "Compiler does not support C++17 standard.")
|
||||
endif()
|
||||
else()
|
||||
message(WARNING "MSVC version is not supported.")
|
||||
endif()
|
||||
endif()
|
||||
##################
|
||||
# 获取默认库路径
|
||||
# 记录 // include // lib // 子文件夹名
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "qfuture.h"
|
||||
#include "QtConcurrent/qtconcurrent"
|
||||
#include "qmessagebox.h"
|
||||
#include <base_Logic.h>
|
||||
|
||||
|
||||
QMutex log_mutex;
|
||||
void LogMsgOutput(QtMsgType type, const QMessageLogContext& context, const QString& msg)
|
||||
@@ -200,8 +200,7 @@ Logic_transfer::Logic_transfer()
|
||||
}
|
||||
}
|
||||
Sleep(50);
|
||||
//自动写Log日志功能;bin/Log
|
||||
//qInstallMessageHandler(LogMsgOutput);
|
||||
|
||||
}
|
||||
|
||||
void Logic_transfer::check_sendImgStruct()
|
||||
@@ -253,11 +252,11 @@ void Logic_transfer::decodeImage(QString key, cv::Mat mtx)
|
||||
try
|
||||
{
|
||||
if (!mtx.empty()) {
|
||||
if ((mtx.dataend - mtx.datastart) != mtx.cols * mtx.rows * mtx.channels()) //尝试能否解决mtx内容异常问题
|
||||
{
|
||||
qCritical() << __FUNCTION__ << " line:" << __LINE__ << " mtx.dataend - mtx.datastart err!!:";
|
||||
return;// false;
|
||||
}
|
||||
//if ((mtx.dataend - mtx.datastart) != mtx.cols * mtx.rows * mtx.channels()) //尝试能否解决mtx内容异常问题
|
||||
//{
|
||||
// qCritical() << __FUNCTION__ << " line:" << __LINE__ << " mtx.dataend - mtx.datastart err!!:";
|
||||
// return;// false;
|
||||
//}
|
||||
|
||||
cv::Mat rgb;
|
||||
//while (mtx.cols > 2000 && mtx.rows > 2000)
|
||||
@@ -365,6 +364,12 @@ bool Logic_transfer::checkJsonObject(QJsonObject obj, QString& errMessage)
|
||||
//3、传递配置文件到通用逻辑框架
|
||||
bool Logic_transfer::setJsonObject(QJsonObject obj)
|
||||
{
|
||||
QString saveLog = obj.value("是否写入日志").toString();
|
||||
if (saveLog == "true")
|
||||
{
|
||||
//自动写Log日志功能;bin/Log
|
||||
qInstallMessageHandler(LogMsgOutput);
|
||||
}
|
||||
if (Logic_ptr)
|
||||
return Logic_ptr->setJsonObject(obj);
|
||||
else return false;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
//通用逻辑接口
|
||||
#include "base_Logic.h"
|
||||
#include <qobject.h>
|
||||
|
||||
//无法用信号槽传递图像?
|
||||
//返回图片的结构体
|
||||
struct showImgStruct
|
||||
@@ -19,6 +19,7 @@ typedef void (*ReleaseFunction)(base_Logic* animal);
|
||||
class Logic_transfer : public base_Logic
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Logic_transfer();
|
||||
~Logic_transfer();
|
||||
|
||||
@@ -760,7 +760,7 @@ bool QtCameraDebug::initCamera(int cameraIndex)
|
||||
}
|
||||
|
||||
|
||||
bool QtCameraDebug::setData(int cameraIndex, const std::vector<cv::Mat>& ImgS, const QStringList& data)
|
||||
bool QtCameraDebug::setData(int cameraIndex, const vector<cv::Mat>& ImgS, const QStringList& data)
|
||||
{
|
||||
if (queue_MyPbGlobalObject.size() <= cameraIndex + 1)
|
||||
return false;
|
||||
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
bool initCamera(int cameraIndex);
|
||||
//4、设置
|
||||
//参数:相机序号、图像参数(不使用)、设置的相机参数
|
||||
bool setData(int cameraIndex, const std::vector<cv::Mat>&, const QStringList&);
|
||||
bool setData(int cameraIndex, const vector<cv::Mat>&, const QStringList&);
|
||||
//5、获取数据
|
||||
//参数:相机序号、获取的图像、获取的数据(实际无)
|
||||
bool data(int cameraIndex, std::vector<cv::Mat>&, QStringList&);
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
////OPT
|
||||
//#include "OPTApi.h" //OPT和海康有部分名称一样,OPT时使用海康
|
||||
//#pragma comment(lib,"./OPTSDK.lib")
|
||||
using namespace std;
|
||||
QtDefectSet::QtDefectSet(QMainWindow*parent)
|
||||
: QMainWindow(parent)
|
||||
{
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <Windows.h>
|
||||
#include <process.h>
|
||||
#include <time.h>
|
||||
#include "QHeaderView.h"
|
||||
|
||||
@@ -225,6 +225,9 @@ void QtParameterSettings::initWindow(QJsonObject program_Obj)
|
||||
//ui.tabWidget_camera->removeTab(0);
|
||||
currentPage_algorithmNum = 0;
|
||||
algorithmCfgWindowQueue.clear();
|
||||
old_cameraParameterMap.clear();
|
||||
old_AlgorithmParameterMap.clear();
|
||||
|
||||
|
||||
stationArray = current_programObj.value("工站列表").toArray();
|
||||
int allCameraNum = 0;
|
||||
@@ -437,6 +440,7 @@ void QtParameterSettings::setCameraTableWidget(int allNum, QString stationKey, Q
|
||||
currentPage_camera_queueAddButton.enqueue(myAddButton);
|
||||
currentPage_camera_queueDelButton.enqueue(mydelButton);*/
|
||||
|
||||
QMap<QString, QString> one_cameraParameterMap;
|
||||
QJsonArray ParameterArray = cameraObj.value("相机参数").toArray();
|
||||
for (int T = 0; T < ParameterArray.size(); T++)
|
||||
{
|
||||
@@ -460,8 +464,10 @@ void QtParameterSettings::setCameraTableWidget(int allNum, QString stationKey, Q
|
||||
}
|
||||
m_Item1->setText(ParameterValue);
|
||||
mytableWidget->setItem(rowNum - 1, 1, m_Item1);
|
||||
one_cameraParameterMap.insert(ParameterObj.value("参数名").toString(), ParameterValue);
|
||||
}
|
||||
int rowc=mytableWidget->rowCount();
|
||||
old_cameraParameterMap.insert(myCfgWindow.Name,one_cameraParameterMap);
|
||||
|
||||
QHBoxLayout* horizontalLayout_X = new QHBoxLayout();
|
||||
QPushButton* myAddButton = cameraCfgWindowQueue[currentPage_cameraNum - 1].myAddButton;
|
||||
@@ -632,6 +638,7 @@ void QtParameterSettings::setAlgorithmTableWidget(int allNum, QString stationKey
|
||||
currentPage_camera_queueAddButton.enqueue(myAddButton);
|
||||
currentPage_camera_queueDelButton.enqueue(mydelButton);*/
|
||||
|
||||
QMap<QString, QString> one_AlgorithmParameterMap;
|
||||
QJsonArray ParameterArray = AlgorithmObj.value("算法初始化参数").toArray();
|
||||
for (int T = 0; T < ParameterArray.size(); T++)
|
||||
{
|
||||
@@ -656,7 +663,9 @@ void QtParameterSettings::setAlgorithmTableWidget(int allNum, QString stationKey
|
||||
}
|
||||
m_Item1->setText(ParameterValue);
|
||||
mytableWidget->setItem(rowNum - 1, 1, m_Item1);
|
||||
one_AlgorithmParameterMap.insert(ParameterObj.value("算法参数名").toString(), ParameterValue);
|
||||
}
|
||||
old_AlgorithmParameterMap.insert(myCfgWindow.Name, one_AlgorithmParameterMap);
|
||||
|
||||
|
||||
QHBoxLayout* horizontalLayout_X = new QHBoxLayout();
|
||||
@@ -746,6 +755,9 @@ void QtParameterSettings::saveProgramObj()
|
||||
oldfile.write(olddata);
|
||||
oldfile.close();
|
||||
|
||||
//改变的列表
|
||||
QStringList changeList;
|
||||
QString nowTime = QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz");
|
||||
//相机:界面列表数据,写入
|
||||
for (int ccw = 0; ccw < cameraCfgWindowQueue.size(); ccw++)
|
||||
{
|
||||
@@ -755,13 +767,24 @@ void QtParameterSettings::saveProgramObj()
|
||||
{
|
||||
QJsonObject ParameterObj;
|
||||
QJsonArray ParameterValueArray;
|
||||
QString ParameterKey = cameraCfgWindowQueue[ccw].myTbleWidget->item(i, 0)->text();
|
||||
QString ParameterValue = cameraCfgWindowQueue[ccw].myTbleWidget->item(i, 1)->text();
|
||||
QStringList ParameterValueList = ParameterValue.split(",");
|
||||
for (int L = 0; L < ParameterValueList.size(); L++)
|
||||
ParameterValueArray.append(ParameterValueList[L]);
|
||||
ParameterObj.insert("参数名", cameraCfgWindowQueue[ccw].myTbleWidget->item(i, 0)->text());
|
||||
ParameterObj.insert("参数名", ParameterKey);
|
||||
ParameterObj.insert("相机参数值", ParameterValueArray);
|
||||
newParameterArray.append(ParameterObj);
|
||||
|
||||
if (old_cameraParameterMap.value(cameraCfgWindowQueue[ccw].Name).keys().contains(ParameterKey))
|
||||
{
|
||||
QString oldValue = old_cameraParameterMap.value(cameraCfgWindowQueue[ccw].Name).value(ParameterKey);
|
||||
if (oldValue != ParameterValue)
|
||||
{
|
||||
QString changeData = cameraCfgWindowQueue[ccw].Name + ",参数:" + ParameterKey + " 旧值:" + oldValue + " 修改为:" + ParameterValue;
|
||||
changeList.append(QString("[%1] [参数修改] %2").arg(nowTime).arg(changeData));
|
||||
}
|
||||
}
|
||||
}
|
||||
cameraCfgWindowQueue[ccw].obj.insert("相机参数", newParameterArray);
|
||||
}
|
||||
@@ -774,6 +797,7 @@ void QtParameterSettings::saveProgramObj()
|
||||
{
|
||||
QJsonObject ParameterObj;
|
||||
QJsonArray ParameterValueArray;
|
||||
QString ParameterKey = algorithmCfgWindowQueue[ccw].myTbleWidget->item(i, 0)->text();
|
||||
QString ParameterValue = algorithmCfgWindowQueue[ccw].myTbleWidget->item(i, 1)->text();
|
||||
QStringList ParameterValueList = ParameterValue.split(",");
|
||||
for (int L = 0; L < ParameterValueList.size(); L++)
|
||||
@@ -781,10 +805,25 @@ void QtParameterSettings::saveProgramObj()
|
||||
ParameterObj.insert("算法参数名", algorithmCfgWindowQueue[ccw].myTbleWidget->item(i, 0)->text());
|
||||
ParameterObj.insert("算法参数值", ParameterValueArray);
|
||||
newParameterArray.append(ParameterObj);
|
||||
|
||||
if (old_AlgorithmParameterMap.value(algorithmCfgWindowQueue[ccw].Name).keys().contains(ParameterKey))
|
||||
{
|
||||
QString oldValue = old_AlgorithmParameterMap.value(algorithmCfgWindowQueue[ccw].Name).value(ParameterKey);
|
||||
if (oldValue != ParameterValue)
|
||||
{
|
||||
QString changeData = algorithmCfgWindowQueue[ccw].Name + ",参数:" + ParameterKey + " 旧值:" + oldValue + " 修改为:" + ParameterValue;
|
||||
changeList.append(QString("[%1] [参数修改] %2").arg(nowTime).arg(changeData));
|
||||
}
|
||||
}
|
||||
}
|
||||
algorithmCfgWindowQueue[ccw].obj.insert("算法初始化参数", newParameterArray);
|
||||
}
|
||||
|
||||
if (changeList.size() > 0)
|
||||
{
|
||||
//保存log及界面打印
|
||||
emit dataChange(changeList);
|
||||
}
|
||||
QStringList moduleKeyList;
|
||||
QJsonArray newstationArray;
|
||||
for (int SA = 0; SA < stationArray.size(); SA++)
|
||||
|
||||
@@ -68,6 +68,10 @@ private:
|
||||
int currentPage_algorithmNum = 0;
|
||||
QQueue< CfgWindow> cameraCfgWindowQueue;
|
||||
QQueue< CfgWindow> algorithmCfgWindowQueue;
|
||||
|
||||
QMap<QString, QMap<QString, QString>> old_cameraParameterMap;
|
||||
QMap<QString, QMap<QString, QString>> old_AlgorithmParameterMap;
|
||||
|
||||
protected:
|
||||
void mouseMoveEvent(QMouseEvent* event) override;
|
||||
void mousePressEvent(QMouseEvent* event) override;
|
||||
@@ -87,5 +91,5 @@ private:
|
||||
|
||||
signals:
|
||||
void reLoadJsonSetParameter(QStringList moduleKeyList);
|
||||
|
||||
void dataChange(QStringList dataList);
|
||||
};
|
||||
|
||||
@@ -37,7 +37,7 @@ QtSaveImgSet::QtSaveImgSet(QWidget *parent)
|
||||
static int maxClickedNum = 1;
|
||||
setWindowFlags(Qt::FramelessWindowHint); //隐藏标题栏
|
||||
//this->showNormal();
|
||||
this->resize(screenWidth / 3, screenHeight / 3 + 100);
|
||||
this->resize(screenWidth / 2, screenHeight / 2 + 100);
|
||||
this->move(screenWidth / 4, screenHeight / 4);
|
||||
|
||||
|
||||
|
||||
+10
-3
@@ -59,7 +59,7 @@ QtSendPLC::QtSendPLC(QWidget *parent)
|
||||
setWindowFlags(Qt::FramelessWindowHint); //隐藏标题栏
|
||||
this->showNormal();
|
||||
|
||||
this->resize(140 * maxCol + 20, max_row * 45 + 230);
|
||||
this->resize(140 * maxCol + 200, max_row * 45 + 230);
|
||||
if (max_row >= 6 || maxCol >= 6)
|
||||
{
|
||||
this->move(screenWidth / 5, screenHeight / 8);
|
||||
@@ -145,13 +145,17 @@ void QtSendPLC::setData(QJsonArray qjsonArray)
|
||||
{
|
||||
sendPLCbuttonS[i]->disconnect();
|
||||
delete sendPLCbuttonS[i];
|
||||
delete sendPLCQLabelS[i];
|
||||
}
|
||||
sendPLCbuttonS.clear();
|
||||
sendPLCcmd.clear();
|
||||
sendPLCQLabelS.clear();
|
||||
buttonNum = 0;
|
||||
int m_row = 0;
|
||||
int m_col = 0;
|
||||
int startCol = 0;
|
||||
maxCol = 0;
|
||||
max_row = 0;
|
||||
|
||||
QJsonArray sendPLCArray = qjsonArray;// programObj.value("手动补信号").toArray();
|
||||
//for(int k=0;k<100;k++)
|
||||
@@ -179,6 +183,7 @@ void QtSendPLC::setData(QJsonArray qjsonArray)
|
||||
mylabel->setMinimumSize(QSize(80, 30));
|
||||
mylabel->setSizePolicy(sizePolicy4);
|
||||
ui.gridLayout->addWidget(mylabel, m_row, m_col++);
|
||||
sendPLCQLabelS.enqueue(mylabel);
|
||||
|
||||
QPushButton* myButton = new QPushButton(this);
|
||||
myButton->setText(sendName + "_" + detailName);
|
||||
@@ -211,7 +216,7 @@ void QtSendPLC::setData(QJsonArray qjsonArray)
|
||||
m_row++;
|
||||
|
||||
//每20行,换列
|
||||
if (m_row == 20)
|
||||
if (m_row == 15)
|
||||
{
|
||||
m_row = 0;
|
||||
startCol = maxCol + 1;
|
||||
@@ -226,8 +231,10 @@ void QtSendPLC::setData(QJsonArray qjsonArray)
|
||||
//设置窗口
|
||||
//if (max_row >= 6 || maxCol>=6)
|
||||
{
|
||||
this->resize(140 * maxCol + 20, max_row * 45 + 230);
|
||||
QScreen* screen = QGuiApplication::primaryScreen();
|
||||
this->resize(screen->size().width() / 4, screen->size().height() / 4);
|
||||
this->move(screen->size().width() / 4, screen->size().height() / 4);
|
||||
this->resize(140 * maxCol + 200, max_row * 45 + 230);
|
||||
if (max_row >= 6 || maxCol >= 6)
|
||||
{
|
||||
this->move(screen->size().width() / 5, screen->size().height() / 8);
|
||||
|
||||
@@ -30,6 +30,7 @@ private:
|
||||
Ui::QtSendPLCClass ui;
|
||||
|
||||
QQueue<QPushButton*> sendPLCbuttonS;
|
||||
QQueue<QLabel*> sendPLCQLabelS;
|
||||
QStringList sendPLCcmd;
|
||||
QMap< QPushButton*, int> sendPLCbuttonS_index;
|
||||
clock_t pressStart, pressStop;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "Qt_epWindow.h"
|
||||
#include "qapplication.h"
|
||||
|
||||
#include <rlib_writeCsv.hpp>
|
||||
#pragma execution_character_set("utf-8")
|
||||
|
||||
clock_t pressStart, pressStop;
|
||||
@@ -107,18 +107,18 @@ Qt_epWindow::Qt_epWindow(QWidget *parent)
|
||||
//ui.pushButton_max->setToolTip(tr("最大化"));
|
||||
setWindowFlags(Qt::FramelessWindowHint); //隐藏标题栏
|
||||
this->showNormal();
|
||||
this->resize(screenWidth / 4 * 3, screenHeight / 4 * 3);
|
||||
ui.frame_right->setMinimumSize(screenWidth / 4 * 3 / 5, 300);
|
||||
this->move(screenWidth / 8, screenHeight / 6);
|
||||
this->resize(screenWidth / 5 * 4, screenHeight / 5 * 4);
|
||||
ui.frame_right->setMinimumSize(screenWidth / 5 * 4 / 5, 300);
|
||||
this->move(screenWidth / 10, screenHeight / 10);
|
||||
maxClickedNum = 1;
|
||||
}
|
||||
qApp->processEvents();
|
||||
});
|
||||
setWindowFlags(Qt::FramelessWindowHint); //隐藏标题栏
|
||||
//this->showNormal();
|
||||
this->resize(screenWidth / 4 * 3, screenHeight / 4 * 3);
|
||||
ui.frame_right->setMinimumSize(screenWidth / 4 * 3 / 5, 300);
|
||||
this->move(screenWidth / 8, screenHeight / 6);
|
||||
this->resize(screenWidth / 5 * 4, screenHeight / 5 * 4);
|
||||
ui.frame_right->setMinimumSize(screenWidth / 5 * 4 / 5, 300);
|
||||
this->move(screenWidth / 10, screenHeight / 10);
|
||||
|
||||
//this->setStyleSheet("QMainWindow::titlebar{background: rgb(255, 0, 0);}"); // 设置背景颜色
|
||||
//setStyleSheet("QMainWindow::titlebar{background: rgb(255, 0, 0);}"); // 设置背景颜色
|
||||
@@ -1720,6 +1720,7 @@ QStringList offLineCameraKeyS;
|
||||
void Qt_epWindow::getTransferData(QString key, QString cameraName, QString snInfo, QByteArray byteArray)
|
||||
{
|
||||
QString myByte = byteArray;
|
||||
QString myByteCpy = byteArray;
|
||||
//ui.plainTextEdit->appendPlainText("key: " + key + " cameraName:" + cameraName + " snInfo:" + snInfo + " myByte:" + myByte + " sendNgInfo:" + sendNgInfo);
|
||||
//qApp->processEvents();
|
||||
|
||||
@@ -1976,9 +1977,9 @@ void Qt_epWindow::getTransferData(QString key, QString cameraName, QString snInf
|
||||
}
|
||||
|
||||
//更新缺陷统计表图
|
||||
if (myByte.contains("*")) //格式为:忽略段*缺陷类型1的是否有缺陷标志*缺陷类型2的是否有缺陷标志...
|
||||
if (myByteCpy.contains("&")) //格式为:忽略段&缺陷类型1的是否有缺陷标志&缺陷类型2的是否有缺陷标志...
|
||||
{
|
||||
QStringList myByteList = myByte.split("*");
|
||||
QStringList myByteList = myByteCpy.split("&");
|
||||
if (myByteList.size() > 1)
|
||||
for (int i = 1; i < myByteList.size(); i++)
|
||||
{
|
||||
@@ -2087,6 +2088,20 @@ void Qt_epWindow::getTransferData(QString key, QString cameraName, QString snInf
|
||||
}
|
||||
}
|
||||
|
||||
//写表格CSV
|
||||
if (myByteCpy.contains("+"))
|
||||
{
|
||||
QString ymd = QDateTime::currentDateTime().toString("yyyy-MM-dd");
|
||||
QString hms = QDateTime::currentDateTime().toString("hh:mm:ss");
|
||||
QStringList outDataList = myByteCpy.split("+");
|
||||
std::vector<std::string> strList;
|
||||
strList.push_back(hms.toStdString());// 时间
|
||||
strList.push_back(snInfo.toStdString());//SN
|
||||
strList.push_back(cameraName.toStdString());//相机名
|
||||
for (int cnt = 1; cnt < outDataList.size(); cnt++)
|
||||
strList.push_back(outDataList[cnt].toStdString());
|
||||
WriteToCsv("./csv/" + ymd.toStdString()+".csv", strList);
|
||||
}
|
||||
ui.plainTextEdit_run->appendPlainText(runLogList.last());
|
||||
//qApp->processEvents();
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
//struct LogListStruct
|
||||
//{
|
||||
// QString key, QString cameraName, QString snInfo, QByteArray byteArray
|
||||
// QString key, QString cameraName, QString snInfo, QByteArray byte
|
||||
//};
|
||||
|
||||
struct QPieSeriesData
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#ifndef __base_Logic_H__
|
||||
#ifndef __base_Logic_H__
|
||||
#define __base_Logic_H__
|
||||
|
||||
#include <iostream>
|
||||
@@ -56,8 +56,8 @@ public:
|
||||
virtual bool sendPLC(QString cmd) { return true; }
|
||||
virtual bool reLoadJsonSetParameter(QStringList moduleKeyList) { return true; }
|
||||
signals:
|
||||
virtual void Logic_sendTcpStatus(bool) ;
|
||||
virtual void Logic_writeData(QString, QString, QString, QByteArray) ;
|
||||
virtual void Logic_sendTcpStatus(bool);
|
||||
virtual void Logic_writeData(QString, QString, QString, QByteArray);
|
||||
virtual void Logic_cameraDisconnect(QString msg, bool status);
|
||||
virtual void Logic_CommunicationDisconnect(QString msg, bool status);
|
||||
private slots:
|
||||
|
||||
@@ -106,6 +106,7 @@ int main(int argc, char* argv[])
|
||||
*p = 1;*/
|
||||
QApplication a(argc, argv);
|
||||
|
||||
|
||||
////定制UI界面
|
||||
//QtWidgetsApplication3 w;
|
||||
//w.show();
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
#ifndef PBGLOBALOBJECT_H
|
||||
#ifndef PBGLOBALOBJECT_H
|
||||
#define PBGLOBALOBJECT_H
|
||||
|
||||
#include <QObject>
|
||||
#include<opencv2/opencv.hpp>
|
||||
#include <opencv.hpp>
|
||||
|
||||
using namespace std;
|
||||
|
||||
//type对应的相机、触发方式
|
||||
#define HIK_Hard 0 //海康
|
||||
@@ -38,7 +39,7 @@ public:
|
||||
|
||||
virtual QMap<QString,QString> parameters() = 0;
|
||||
virtual bool init() { return true; }
|
||||
virtual bool setData(const std::vector<cv::Mat> &, const QStringList &) { return true; }
|
||||
virtual bool setData(const vector<cv::Mat> &, const QStringList &) { return true; }
|
||||
virtual bool data(std::vector<cv::Mat> &, QStringList &) { return true; }
|
||||
public:
|
||||
//大类
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
#include <qfile.h>
|
||||
#include <string>
|
||||
#define CsvHeadStr "时间,条码,相机名,总结果,撕裂,翻折,极耳宽,极耳高,焊印1,焊印2\r\n"
|
||||
#define CRLF "\r\n"
|
||||
void WriteToCsv(std::string filePath,std::vector<std::string> strList)
|
||||
{
|
||||
QFile CsvFile(QString::fromStdString(filePath));
|
||||
bool FileExist = CsvFile.exists();
|
||||
CsvFile.open(QIODevice::ReadWrite);
|
||||
if (FileExist == false)
|
||||
CsvFile.write(CsvHeadStr);
|
||||
|
||||
QByteArray qstr;
|
||||
for (int cnt = 0; cnt <strList.size()-1;cnt++)
|
||||
qstr.append(QByteArray::fromStdString(strList[cnt])+",");
|
||||
qstr.append(QByteArray::fromStdString(strList[strList.size()-1]) + CRLF);
|
||||
CsvFile.write(qstr);
|
||||
CsvFile.close();
|
||||
}
|
||||
Reference in New Issue
Block a user