|
|
#ifndef COMMON_DEFINE_H
|
|
|
#define COMMON_DEFINE_H
|
|
|
|
|
|
#include <QtCore\qthread.h>
|
|
|
#include <QtCore\qmap.h>
|
|
|
#include <QtCore\qstring.h>
|
|
|
#include <QtWidgets\qtablewidget.h>
|
|
|
#include <QtWidgets\qdialog.h>
|
|
|
#include <QtGui\qevent.h>
|
|
|
#include <QtCore\qtimer.h>
|
|
|
#include <QtWidgets/QApplication>
|
|
|
#include <QDebug>
|
|
|
|
|
|
#include "QZkJsonParser.h"
|
|
|
#include "lp_singleton.h"
|
|
|
|
|
|
#include "LPVCore.h"
|
|
|
#include "LPVGeom.h"
|
|
|
#include "LPVPat.h"
|
|
|
#include "LPVImgProc.h"
|
|
|
#include "DisplayHelper.h"
|
|
|
#include "LPVDisplay.h"
|
|
|
#include "LPVCalib.h"
|
|
|
|
|
|
#define DELETE_POINTER(p) if (p) {delete p; p = NULL;}
|
|
|
|
|
|
//#define IMAGEDRAWING OPENCV
|
|
|
#define IMAGEDRAWING LPV
|
|
|
|
|
|
#define MODULE_CONFIG "\\config\\module.json"
|
|
|
#define CAMERA_CONFIG "\\config\\camera.json"
|
|
|
#define NET_CONFIG "\\config\\netSetting.json"
|
|
|
#define COM_CONFIG "\\config\\comSetting.json"
|
|
|
#define MATCHER_CONFIG "\\config\\match.json"
|
|
|
|
|
|
|
|
|
#define SMOKEINFO_XLSX_CONFIG "\\user\\smokeInfo.xlsx"
|
|
|
#define FILE_STORAGE_PATH ".\\fileData"
|
|
|
#define FILE_INPUTSTORE_PATH ".\\storeData"
|
|
|
#define INTOSTOCK_IMAGE_FOLDER "intoStock"
|
|
|
#define ORIGIN_IMAGE_FOLDER "Origin"
|
|
|
#define TYPE_TEMPLATE_PATH ".\\templateImg"
|
|
|
//#define NUM_TEMPLATE_PATH ".\\templateNum"
|
|
|
#define LOCAL_MODEL_PATH "\\localModel"
|
|
|
|
|
|
#define HEARTBEAT_HEAD "HB"
|
|
|
#define CREATE_CONNECT_HEAD "CE"
|
|
|
#define EMPTY_CHECK_HEAD "EC"
|
|
|
#define STOCK_CHECK_HEAD "SC"
|
|
|
#define INTO_STOCK_HEAD "IS"
|
|
|
#define LIGHT_CONTROL_HEAD "LC"
|
|
|
#define TAKE_PHOTO_HEAD "TP"
|
|
|
#define SPLIT_RULE "&"
|
|
|
#define CODE_CONTENT_SPLIT ","
|
|
|
#define CONTENT_SPLIT ";"
|
|
|
#define END_SYMBOL ">"
|
|
|
#define START_CAPTURE "GPS" // 到位取图开始
|
|
|
#define END_CAPTURE "GPE" // 到位取图结束
|
|
|
#define START_CALCULATE "RTS" // 开始品规和数量计算
|
|
|
#define RETURN_CALCULATE "RTE" // 品规计算结果返回
|
|
|
|
|
|
#define LP_COLOR_CONTROL 0x88
|
|
|
#define LP_D1TOD80 0x86
|
|
|
#define LP_D81TOD140 0x87
|
|
|
#define LP_SIDELIGHT_SWITCH 0x85
|
|
|
#define LP_SIDELIGHT_CONFIGURATION 0x88
|
|
|
#define LP_RESTART_LIGHT 0xFE
|
|
|
#define LP_DATA_FULL_BITS 16
|
|
|
#define TPI_DEMARCATING_DIALOG "demarcating_tpi"
|
|
|
|
|
|
#define TPI_BUTTON_CLEAR_RESULT "tpi_btn_clear_result"
|
|
|
|
|
|
#define TPI_RESULT_OK "tpi_result_ok"//正常
|
|
|
#define TPI_RESULT_MISS_NAIL "tpi_result_miss_nail"//缺钉
|
|
|
#define TPI_RESULT_MISS_BEAD "tpi_result_miss_bead"//缺珠
|
|
|
#define TPI_RESULT_CONNECT "tpi_result_connect"//轴承与编辑粘连
|
|
|
#define TPI_RESULT_BLANK "tpi_result_blank"//没有轴承
|
|
|
#define TPI_RESULT_OTHERS "tpi_result_others"//其它情况
|
|
|
#define TP_SERVER_CONNECTION "tp_connection" //建立网络连接
|
|
|
#define ACTION_LOGION "actionLogin" //用户登陆
|
|
|
#define ACTION_SYSTEM "actionSystem" //系统设置
|
|
|
#define ACTION_PARAMS "actionParams"
|
|
|
#define ACTION_DATA_CHECK "actionDataCheck"
|
|
|
#define ACTION_TEST "actionTest"
|
|
|
#define ACTION_MANGEMENT "actionMangement"
|
|
|
#define ACTION_NET "actionNetTrigger"
|
|
|
#define ACTION_IMAGE_CALI "action_image_cali"
|
|
|
#define SMOKE_TYPE_LABEL "typeLabel"
|
|
|
#define SMOKE_NUM_LABEL "numberLabel"
|
|
|
#define SMOKE_POS_LABEL "positionLabel"
|
|
|
|
|
|
const int monitorNum = 4;
|
|
|
|
|
|
struct rstData
|
|
|
{
|
|
|
QString s_typeStr;
|
|
|
QString s_num;
|
|
|
QString s_planeStr;
|
|
|
QImage s_typeImg;
|
|
|
//QImage s_numImg;
|
|
|
};
|
|
|
|
|
|
struct outputData
|
|
|
{
|
|
|
outputData()
|
|
|
{
|
|
|
mStrTypeName = "";
|
|
|
}
|
|
|
QImage mTypeImage;
|
|
|
QString mStrTypeName;
|
|
|
QString mSurffixType;
|
|
|
QString mStrChineseName;
|
|
|
QString snapSignal;
|
|
|
double bestScore;
|
|
|
};
|
|
|
|
|
|
struct COMbody
|
|
|
{
|
|
|
COMbody() {
|
|
|
deviceName = "";
|
|
|
comName = "";
|
|
|
bauRate = "";
|
|
|
}
|
|
|
QString deviceName;
|
|
|
QString comName;
|
|
|
QString bauRate;
|
|
|
};
|
|
|
|
|
|
struct debugMsg
|
|
|
{
|
|
|
QString msEmpty_1;
|
|
|
QString msEmpty_2;
|
|
|
QString msPlane_1;
|
|
|
QString msPlane_2;
|
|
|
QString msAD_1;
|
|
|
QString msAD_2;
|
|
|
};
|
|
|
|
|
|
enum StockCheckMode
|
|
|
{
|
|
|
NoVirtual = 0,
|
|
|
TypeVirtual, //品规模拟盘点
|
|
|
NumVirtual, //数量模拟盘点
|
|
|
TypeNumVirtual //品规数量模拟盘点
|
|
|
};
|
|
|
|
|
|
struct IntoStockInfo
|
|
|
{
|
|
|
QString streetName; // 巷道号
|
|
|
QString taskNum; // 任务号-工单号
|
|
|
QString stockNum; //货架位置UL062015020111 6号堆垛机,2:右边;
|
|
|
QString id = 0;
|
|
|
QString stockLocation = 0; // 方向:1左,2右;0保留为之前规则
|
|
|
QString smokeTypeNum; //上位机发送的品规号37010106
|
|
|
QString smokeQuantity; //上位机发送的数量30
|
|
|
int Floor = 1; //层数,表示现在拍的货物在高架库的第几层
|
|
|
int row = 0; //列数,表示现在拍的货物在高架库的第几列
|
|
|
QStringList imagesPathList;
|
|
|
|
|
|
|
|
|
QString pcdSrc; //盘点识别文件
|
|
|
bool correctness =1; //拍照成功
|
|
|
};
|
|
|
|
|
|
struct EmptyCheckInfo
|
|
|
{
|
|
|
QString streetName;
|
|
|
QString taskNum;
|
|
|
};
|
|
|
|
|
|
struct StockCheckInfo
|
|
|
{
|
|
|
// "SC&6&UL062015020111&6335&37010106&30&N>"
|
|
|
// 新规则:GP&111&6&2121&1&S001&25>
|
|
|
// 111:ID号
|
|
|
// 6:巷道号
|
|
|
// 2121:任务号-工单号
|
|
|
// 1:方向,1左,2右
|
|
|
// S001:品规号-上位机发送的品规号
|
|
|
//
|
|
|
QString streetName; // 巷道6
|
|
|
QString taskNum; // 工单号6335
|
|
|
QString stockNum; // 货架位置UL062015020111 6号堆垛机,2:右边;
|
|
|
QString id = 0;
|
|
|
QString stockLocation = 0; // 方向:1左,2右;0保留为之前规则
|
|
|
QString smokeTypeNum; //上位机发送的品规号37010106
|
|
|
QString smokeQuantity; //上位机发送的数量30
|
|
|
QString smokeTypeNumRlt; //盘点识别的品规号
|
|
|
QString smokeQuantityRlt; //盘点识别的数量
|
|
|
bool correctness; //盘点结果是否与上位机一致
|
|
|
QStringList imagesPathList;
|
|
|
|
|
|
QString pcdSrc; //盘点识别文件
|
|
|
|
|
|
int Floor = 1; //层数,表示现在拍的货物在高架库的第几层
|
|
|
int row = 0; //列数,表示现在拍的货物在高架库的第几列
|
|
|
//void clear()
|
|
|
//{
|
|
|
// streetName.clear();
|
|
|
// taskNum.clear();
|
|
|
// stockNum.clear();
|
|
|
// smokeTypeNum.clear();
|
|
|
// smokeQuantity.clear();
|
|
|
// smokeTypeNumRlt.clear();
|
|
|
// smokeQuantityRlt.clear();
|
|
|
// correctness = false;
|
|
|
//}
|
|
|
//StockCheckInfo &operator = (const StockCheckInfo& obj)
|
|
|
//{
|
|
|
// this->streetName = obj.streetName;
|
|
|
// this->taskNum = obj.taskNum;
|
|
|
// this->stockNum = obj.stockNum;
|
|
|
// this->smokeTypeNum = obj.smokeTypeNum;
|
|
|
// this->smokeQuantity = obj.smokeQuantity;
|
|
|
// this->smokeTypeNumRlt = obj.smokeTypeNumRlt;
|
|
|
// this->smokeQuantityRlt = obj.smokeQuantityRlt;
|
|
|
// this->correctness = obj.correctness;
|
|
|
// return *this;
|
|
|
//}
|
|
|
};
|
|
|
|
|
|
|
|
|
enum eCommunicationRules
|
|
|
{
|
|
|
emNJ = 0, // 南京
|
|
|
emSJZ // 石家庄
|
|
|
};
|
|
|
|
|
|
enum eCameraLocation
|
|
|
{
|
|
|
emSide=0, // 代表真正有效采集的相机
|
|
|
emTop, // 代表闲置的相机
|
|
|
};
|
|
|
|
|
|
enum eSideID {
|
|
|
em_LEFT = 0,
|
|
|
em_RIGHT,
|
|
|
|
|
|
MAX_SIDES
|
|
|
};
|
|
|
|
|
|
enum loopDataLogicRef
|
|
|
{
|
|
|
emDatalogic1 = 0,
|
|
|
emDatalogic2
|
|
|
};
|
|
|
|
|
|
enum lightCtrl
|
|
|
{
|
|
|
emTurnOnLight = 1,
|
|
|
emTurnOffLight
|
|
|
};
|
|
|
|
|
|
enum emEptyPlateMonitorSelection
|
|
|
{
|
|
|
emEmptyMonitorTrigger_1 = 1,
|
|
|
emEmptyMonitorTrigger_2
|
|
|
};
|
|
|
|
|
|
enum StockCheckTrigger
|
|
|
{
|
|
|
emMonitorTriggerStart = 1,
|
|
|
emMonitorTriggerStop
|
|
|
};
|
|
|
|
|
|
namespace myBody {
|
|
|
enum stationRef
|
|
|
{
|
|
|
emSTATION_EMPTY_1,
|
|
|
emSTATION_EMPTY_2,
|
|
|
emSTATION_PLANE_1,
|
|
|
emSTATION_PLANE_2,
|
|
|
emSTATION_AD_1,
|
|
|
emSTATION_AD_2,
|
|
|
emSTATION_NUM,
|
|
|
};
|
|
|
}
|
|
|
|
|
|
using matGroup = struct dataGroup
|
|
|
{
|
|
|
public:
|
|
|
dataGroup() {
|
|
|
vec.resize(monitorNum);
|
|
|
}
|
|
|
void clear() {
|
|
|
for (int i = 0; i < vec.size(); ++i)
|
|
|
{
|
|
|
vec[i].clear();
|
|
|
}
|
|
|
};
|
|
|
QVector<QVector<double>> vec;
|
|
|
using PTR = std::shared_ptr<dataGroup>;
|
|
|
};
|
|
|
|
|
|
|
|
|
#endif // !COMMON_DEFINE_H
|