|
|
#ifndef CIGARETTE_H
|
|
|
#define CIGARETTE_H
|
|
|
|
|
|
#include "ui_cigarette.h"
|
|
|
#include "dialogsetuppasswd.hpp"
|
|
|
#include "dialogin.hpp"
|
|
|
#include "dialogsetup.hpp"
|
|
|
#include "plcsetup.hpp"
|
|
|
#include "alg_jd.h"
|
|
|
#include "balluffcamera.h"
|
|
|
#include "baslercamera.h"
|
|
|
#include "hikcamera.h"
|
|
|
#include "workthread.h"
|
|
|
#include "db_label.h"
|
|
|
#include "common.h"
|
|
|
#include "modbus.h"
|
|
|
#include "plc_item.h"
|
|
|
#include "AlarmInfo.h"
|
|
|
#include "alarmdialog.hpp"
|
|
|
#include <apps/Common/qtIncludePrologue.h>
|
|
|
#include <apps/Common/qtIncludeEpilogue.h>
|
|
|
#include <Common/STLHelper.h>
|
|
|
|
|
|
#include "CaptureThread.h"
|
|
|
#include "CaptureThreadBasler.h"
|
|
|
#include "CaptureThreadHIK.h"
|
|
|
#include "debugthread.h"
|
|
|
#include "savethread.h"
|
|
|
#include "Logthread.h"
|
|
|
#include "threadSend.h"
|
|
|
#include "threadReceive.h"
|
|
|
#include "Cleanthread.h"
|
|
|
|
|
|
#include <QtWidgets/QMainWindow>
|
|
|
#include <QTimer>
|
|
|
#include <QCloseEvent>
|
|
|
#include <QThread>
|
|
|
#include <QString>
|
|
|
#include <QScreen>
|
|
|
#include <QMutex>
|
|
|
#include <QDir>
|
|
|
#include <QFileInfoList>
|
|
|
#include <Windows.h>
|
|
|
#include <QSignalMapper>
|
|
|
|
|
|
|
|
|
#include <QSharedPointer>
|
|
|
|
|
|
|
|
|
class QTimer;
|
|
|
#define OPEN true
|
|
|
#define CLOSE false
|
|
|
class Cigarette : public QMainWindow
|
|
|
{
|
|
|
Q_OBJECT
|
|
|
|
|
|
public:
|
|
|
Cigarette(QWidget *parent = 0);
|
|
|
~Cigarette();
|
|
|
|
|
|
static QImage cvMatToQImage(const cv::Mat& mat);
|
|
|
|
|
|
QString read_pswd();
|
|
|
QString read_op_pswd();
|
|
|
|
|
|
bool read_sys_config(SysConf &conf);
|
|
|
bool read_modbus_config(ModbusConf &conf);
|
|
|
void read_plc_items();
|
|
|
bool save_rotate_message();
|
|
|
bool read_rotate_message();
|
|
|
bool save_alarm_message(std::vector<AlarmInfo> &AlarmInfo_vect);
|
|
|
void init_plc_value();
|
|
|
void CreatWorkThread(int classid,int Num,Cigarette* classptr);
|
|
|
void InitPtrMat();
|
|
|
bool ControlCamOpenOrClose(int Num,bool OpenOrClose);
|
|
|
void EnumerateCameras(SingleCamInfoStruct *TempSingleCamInfo,bool showinfo,SysConf &conf);
|
|
|
private slots :
|
|
|
void on_btn_start_released();
|
|
|
void on_btn_pause_released();
|
|
|
void on_btn_lock_released();
|
|
|
void on_btn_setup_released();
|
|
|
void on_checkBox_debug_clicked(bool checked);
|
|
|
void on_checkBox_unkick_clicked(bool checked);
|
|
|
void on_toolButton_plc_released();
|
|
|
void on_toolButton_alarm_released();
|
|
|
void on_pushButton_clear_released();
|
|
|
void on_pushButton_Clear_Pic_released();
|
|
|
|
|
|
void enable_shift();
|
|
|
void OnNotifyHub(int Num, int Cnt, cv::Mat m);
|
|
|
void OnDisplayTimeCostHub(int Num, int ms);
|
|
|
void OnDisplayCheckNumberHub(int Num, long no);
|
|
|
void OnDisplayJdNoHub(int Num, QString jd_no);
|
|
|
void OnOKHub(int Num);
|
|
|
void OnNGHub(int Num);
|
|
|
void updateStatisticsHub(const QString& statisticalData, int Num);
|
|
|
void OnRotateReleasedHub(int Num);
|
|
|
void OnToolButtonCamReleasedHub(int Num);
|
|
|
void OpenCamTimeoutHub(int Num);
|
|
|
void OnDBClickHub(int Num_Cnt);
|
|
|
void OnDBClickNGHub(int Num);
|
|
|
void ReconnectCamHub(int Num);
|
|
|
|
|
|
void handleTimeout(); //<2F><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
|
|
|
void op_timeout(); //<2F><><EFBFBD><EFBFBD>Աʣ<D4B1><CAA3>ʱ<EFBFBD><CAB1>
|
|
|
void admin_timeout(); //<2F><><EFBFBD><EFBFBD>ԱȨ<D4B1><C8A8>ʣ<EFBFBD><CAA3>ʱ<EFBFBD><CAB1>
|
|
|
void FindFileForDelete(const QString& path);
|
|
|
void autoCleanImage();
|
|
|
void EnableDebugMode();
|
|
|
void DisableDebugMode();
|
|
|
|
|
|
void OnCancelAlarm(); //˫<><CBAB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
void on_pushButton_reset_released();//<2F><>λ
|
|
|
|
|
|
void OnOp();
|
|
|
void OnExit();
|
|
|
void OnRestart();
|
|
|
|
|
|
void OnAdmin();
|
|
|
private:
|
|
|
Ui::CigaretteClass ui;
|
|
|
DialogSetupPasswd *dialog_setup_passwd;
|
|
|
Dialogin *dialogin;
|
|
|
DialogSetup *dialog_setup;
|
|
|
PlcSetup * dialog_plc_setup;
|
|
|
std::vector<PlcItem> m_plc_items;
|
|
|
public:
|
|
|
QTimer *m_pTimer_Cam_mat[NumberOfSupportedCameras]; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
QLabel *label_cap_speed_mat[NumberOfSupportedCameras];
|
|
|
QLabel *cam_status_mat[NumberOfSupportedCameras];
|
|
|
QLabel *cam_work_mat[NumberOfSupportedCameras];
|
|
|
QToolButton *cam_toolButton_mat[NumberOfSupportedCameras];
|
|
|
db_label * display_lable_mat[NumberOfSupportedCameras][2];
|
|
|
QLabel *label_timecost_mat[NumberOfSupportedCameras];
|
|
|
QLCDNumber *lcdNumber_total_mat[NumberOfSupportedCameras];
|
|
|
QLabel *label_jd_no_mat[NumberOfSupportedCameras];
|
|
|
QLCDNumber *lcdNumber_ok_mat[NumberOfSupportedCameras];
|
|
|
QLCDNumber *lcdNumber_ng_mat[NumberOfSupportedCameras];
|
|
|
QLabel *label_reslut_mat[NumberOfSupportedCameras];
|
|
|
QToolButton *rotate_mat[NumberOfSupportedCameras];
|
|
|
QLabel *label_ng_mat[NumberOfSupportedCameras];
|
|
|
|
|
|
WorkThread work_thread[NumberOfSupportedCameras];
|
|
|
|
|
|
DebugThread debug_thread[NumberOfSupportedCameras];
|
|
|
|
|
|
SaveThread saveThread;
|
|
|
void record_output_statistic(qint64 cur_quantity, int shift);
|
|
|
|
|
|
QTimer *m_pTimer;
|
|
|
QTimer *m_delay; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD>
|
|
|
QTimer *m_op_delay; //<2F><><EFBFBD><EFBFBD>ԱȨ<D4B1><C8A8>ʣ<EFBFBD><CAA3>ʱ<EFBFBD><CAB1>
|
|
|
QTimer *m_admin_delay; //<2F><><EFBFBD><EFBFBD>ԱȨ<D4B1><C8A8>ʣ<EFBFBD><CAA3>ʱ<EFBFBD><CAB1>
|
|
|
QTimer *clean_pTimer; //<2F><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
QSignalMapper *image_lable_signalMapper0;
|
|
|
QSignalMapper *image_lable_signalMapper1;
|
|
|
QSignalMapper *label_ng_signalMapper;
|
|
|
QSignalMapper *pTimer_Cam_signalMapper;
|
|
|
QSignalMapper *toolButton_cam_signalMapper;
|
|
|
QSignalMapper *RotateReleased_signalMapper;
|
|
|
int total_production_number;
|
|
|
int production_number[NumberOfSupportedCameras];
|
|
|
int OpenWithUserID[NumberOfSupportedCameras];
|
|
|
int ok[NumberOfSupportedCameras], ng[NumberOfSupportedCameras];
|
|
|
cv::Mat g_last_mat[NumberOfSupportedCameras][2];
|
|
|
bool g_max[NumberOfSupportedCameras][2]; //<2F><>ͼ<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
#ifdef __UDPSend
|
|
|
private:
|
|
|
threadSend sThread;
|
|
|
threadReceive *rThread;
|
|
|
#endif
|
|
|
public slots:
|
|
|
void CleanThreadStart();
|
|
|
void CleanThreadStartAuto();
|
|
|
void recMsgFromUdp(QString data);
|
|
|
//void ClogThreadStart();
|
|
|
|
|
|
signals:
|
|
|
void sengMsgToClog(QString);
|
|
|
};
|
|
|
|
|
|
#endif // CIGARETTE_H
|