|
|
|
@ -56,10 +56,15 @@ ASyncQueue<bool> *g_result_queue[NumberOfSupportedCameras]; //
|
|
|
|
|
bool g_debug_mode; //相机调试模式,工作模式必须暂停状态才能打开
|
|
|
|
|
SyncQueue<cv::Mat> *g_debug_queue[NumberOfSupportedCameras]; //相机调试模式图像队列
|
|
|
|
|
|
|
|
|
|
#ifdef __UDPSend
|
|
|
|
|
SyncQueue<_UDPSendInfo>* UDP_Info_queue;
|
|
|
|
|
//SyncQueue<_ExportDataInfo> *export_Data_Info_queue;
|
|
|
|
|
#endif
|
|
|
|
|
bool flag = false;
|
|
|
|
|
|
|
|
|
|
#ifdef __ExportData
|
|
|
|
|
SyncQueue<_XMLExportDataInfo>* export_XMLData_Info_queue;
|
|
|
|
|
ExportDataThread exportDataThread;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
bool g_admin_mode; //是否管理员模式
|
|
|
|
|
|
|
|
|
@ -82,7 +87,6 @@ int quantity_stop_count; //
|
|
|
|
|
int g_seconds;
|
|
|
|
|
int CurOpLabel;
|
|
|
|
|
bool onrestart = false;
|
|
|
|
|
bool flag = false;
|
|
|
|
|
|
|
|
|
|
VOID BeforeWork(int shoot[])
|
|
|
|
|
{
|
|
|
|
@ -136,14 +140,14 @@ Cigarette::Cigarette(QWidget *parent)
|
|
|
|
|
|
|
|
|
|
g_save_queue = new SyncQueue<std::pair<std::string, cv::Mat> >(Queue_Size);
|
|
|
|
|
g_save_queue->name = "save queue";
|
|
|
|
|
#ifdef __UDPSend
|
|
|
|
|
UDP_Info_queue = new SyncQueue<_UDPSendInfo>(Queue_Size);
|
|
|
|
|
UDP_Info_queue->name = "UDP Info queue";
|
|
|
|
|
|
|
|
|
|
//export_Data_Info_queue = new SyncQueue<_ExportDataInfo>(Queue_Size);
|
|
|
|
|
//export_Data_Info_queue->name = "Export Data Info queue";
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef __ExportData
|
|
|
|
|
export_XMLData_Info_queue = new SyncQueue<_XMLExportDataInfo>(Queue_Size);
|
|
|
|
|
export_XMLData_Info_queue->name = "Export Data Info queue";
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
last_shift = 256;
|
|
|
|
|
|
|
|
|
|
for(int i=0;i<NumberOfSupportedCameras;i++)
|
|
|
|
@ -454,7 +458,7 @@ Cigarette::Cigarette(QWidget *parent)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
connect(toolButton_cam_signalMapper, SIGNAL(mapped(int)), this, SLOT(OnToolButtonCamReleasedHub(int)));
|
|
|
|
|
connect(pTimer_Cam_signalMapper, SIGNAL(mapped(int)), this, SLOT(OpenCamTimeoutHub(int)));
|
|
|
|
|
//connect(pTimer_Cam_signalMapper, SIGNAL(mapped(int)), this, SLOT(OpenCamTimeoutHub(int)));
|
|
|
|
|
connect(image_lable_DBsignalMapper0, SIGNAL(mapped(int)), this, SLOT(OnDBClickHub(int)));
|
|
|
|
|
connect(image_lable_DBsignalMapper1, SIGNAL(mapped(int)), this, SLOT(OnDBClickHub(int)));
|
|
|
|
|
#ifdef DRAW_RECT
|
|
|
|
@ -867,31 +871,27 @@ void Cigarette::enable_shift()
|
|
|
|
|
ui.pushButton_clear->setEnabled(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef __UDPSend
|
|
|
|
|
void Cigarette::sendLatestData() {
|
|
|
|
|
// 连接UDP发送最新的数据
|
|
|
|
|
int dataport = g_sys_conf.MonitorPort;
|
|
|
|
|
|
|
|
|
|
_UDPSendInfo UDPSendInfo;
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < NumberOfSupportedCameras; i++)
|
|
|
|
|
{
|
|
|
|
|
UDPSendInfo.index = i;
|
|
|
|
|
UDPSendInfo.FrameID = ok_frame;
|
|
|
|
|
UDPSendInfo.ok[i] = ok[i];
|
|
|
|
|
#ifdef __UDPSend
|
|
|
|
|
UDP_Info_queue->put(UDPSendInfo);
|
|
|
|
|
#endif
|
|
|
|
|
UDPSendInfo.FrameID = ng_frame;
|
|
|
|
|
UDPSendInfo.ng[i] = ng[i];
|
|
|
|
|
#ifdef __UDPSend
|
|
|
|
|
UDP_Info_queue->put(UDPSendInfo);
|
|
|
|
|
#endif
|
|
|
|
|
UDPSendInfo.FrameID = total_frame;
|
|
|
|
|
UDPSendInfo.Total = production_number[i];
|
|
|
|
|
#ifdef __UDPSend
|
|
|
|
|
UDP_Info_queue->put(UDPSendInfo);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
void Cigarette::OnRotateReleasedHub(int Num)//旋转按钮
|
|
|
|
|
{
|
|
|
|
@ -1233,12 +1233,12 @@ void Cigarette::OnNotifyHub(int Num, int Cnt,cv::Mat m)
|
|
|
|
|
display_lable_mat[Num][Cnt]->setPixmap(QPixmap::fromImage(tempImage));
|
|
|
|
|
g_display_label_conf[Num].g_last_mat[Cnt] = m;
|
|
|
|
|
|
|
|
|
|
#ifdef __UDPSend
|
|
|
|
|
_UDPSendInfo UDPSendInfo;
|
|
|
|
|
UDPSendInfo.FrameID = image_frame;
|
|
|
|
|
UDPSendInfo.index = Num;
|
|
|
|
|
UDPSendInfo.cnt = Cnt;
|
|
|
|
|
UDPSendInfo.image = m.clone();
|
|
|
|
|
#ifdef __UDPSend
|
|
|
|
|
UDP_Info_queue->put(UDPSendInfo);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
@ -1255,11 +1255,11 @@ void Cigarette::OnDisplayCheckNumberHub(int Num, long no)
|
|
|
|
|
{
|
|
|
|
|
production_number[Num]++;
|
|
|
|
|
lcdNumber_total_mat[Num]->display(production_number[Num]);
|
|
|
|
|
#ifdef __UDPSend
|
|
|
|
|
_UDPSendInfo UDPSendInfo;
|
|
|
|
|
UDPSendInfo.FrameID = total_frame;
|
|
|
|
|
UDPSendInfo.index = Num;
|
|
|
|
|
UDPSendInfo.Total = production_number[Num];
|
|
|
|
|
#ifdef __UDPSend
|
|
|
|
|
UDP_Info_queue->put(UDPSendInfo);
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef __ExportData
|
|
|
|
@ -1279,11 +1279,11 @@ void Cigarette::OnDisplayJdNoHub(int Num, QString jd_no)
|
|
|
|
|
void Cigarette::OnOKHub(int Num)
|
|
|
|
|
{
|
|
|
|
|
ok[Num]++;
|
|
|
|
|
#ifdef __UDPSend
|
|
|
|
|
_UDPSendInfo UDPSendInfo;
|
|
|
|
|
UDPSendInfo.FrameID = ok_frame;
|
|
|
|
|
UDPSendInfo.index = Num;
|
|
|
|
|
UDPSendInfo.ok[Num] = ok[Num];
|
|
|
|
|
#ifdef __UDPSend
|
|
|
|
|
UDP_Info_queue->put(UDPSendInfo);
|
|
|
|
|
#endif
|
|
|
|
|
lcdNumber_ok_mat[Num]->display(ok[Num]);
|
|
|
|
@ -1297,11 +1297,11 @@ void Cigarette::OnOKHub(int Num)
|
|
|
|
|
void Cigarette::OnNGHub(int Num)
|
|
|
|
|
{
|
|
|
|
|
ng[Num]++;
|
|
|
|
|
#ifdef __UDPSend
|
|
|
|
|
_UDPSendInfo UDPSendInfo;
|
|
|
|
|
UDPSendInfo.FrameID = ng_frame;
|
|
|
|
|
UDPSendInfo.index = Num;
|
|
|
|
|
UDPSendInfo.ng[Num] = ng[Num];
|
|
|
|
|
#ifdef __UDPSend
|
|
|
|
|
UDP_Info_queue->put(UDPSendInfo);
|
|
|
|
|
#endif
|
|
|
|
|
lcdNumber_ng_mat[Num]->display(ng[Num]);
|
|
|
|
@ -1314,11 +1314,11 @@ void Cigarette::OnNGHub(int Num)
|
|
|
|
|
|
|
|
|
|
void Cigarette::updateStatisticsHub(const QString& statisticalData, int Num) {
|
|
|
|
|
label_cap_speed_mat[Num]->setText(statisticalData + QStringLiteral("个/秒"));
|
|
|
|
|
#ifdef __UDPSend
|
|
|
|
|
_UDPSendInfo UDPSendInfo;
|
|
|
|
|
UDPSendInfo.FrameID = speed_frame;
|
|
|
|
|
UDPSendInfo.index = Num;
|
|
|
|
|
UDPSendInfo.speed = statisticalData;
|
|
|
|
|
#ifdef __UDPSend
|
|
|
|
|
UDP_Info_queue->put(UDPSendInfo);
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef __ExportData
|
|
|
|
@ -1952,14 +1952,14 @@ void Cigarette::on_pushButton_clear_released()//
|
|
|
|
|
ng_rate = 0;
|
|
|
|
|
exportXMLDataInfo.PassRate = 1.0 - ng_rate;
|
|
|
|
|
|
|
|
|
|
int flag = 0;
|
|
|
|
|
int f = 0;
|
|
|
|
|
for (int i = 1; i < NumberOfSupportedCameras; i++) {
|
|
|
|
|
if (exportData[i].kick != exportData[0].kick) {
|
|
|
|
|
flag = 1;
|
|
|
|
|
f = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (flag == 1) {
|
|
|
|
|
if (f == 1) {
|
|
|
|
|
// Kick值不一致
|
|
|
|
|
for (int i = 0; i < NumberOfSupportedCameras; i++) {
|
|
|
|
|
exportXMLDataInfo.TotalKickNum += exportData[i].kick;
|
|
|
|
@ -1970,7 +1970,7 @@ void Cigarette::on_pushButton_clear_released()//
|
|
|
|
|
|
|
|
|
|
export_XMLData_Info_queue->put(exportXMLDataInfo);
|
|
|
|
|
}
|
|
|
|
|
flag = false;
|
|
|
|
|
//flag = false;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
//发送换班消息给PLC
|
|
|
|
@ -1999,29 +1999,25 @@ void Cigarette::on_pushButton_clear_released()//
|
|
|
|
|
lcdNumber_ok_mat[i]->display(ok[i]);
|
|
|
|
|
ng[i] = 0;
|
|
|
|
|
lcdNumber_ng_mat[i]->display(ng[i]);
|
|
|
|
|
|
|
|
|
|
#ifdef __UDPSend
|
|
|
|
|
_UDPSendInfo UDPSendInfo;
|
|
|
|
|
UDPSendInfo.index = i;
|
|
|
|
|
|
|
|
|
|
UDPSendInfo.index = i;
|
|
|
|
|
UDPSendInfo.FrameID = ok_frame;
|
|
|
|
|
UDPSendInfo.ok[i] = ok[i];
|
|
|
|
|
#ifdef __UDPSend
|
|
|
|
|
UDP_Info_queue->put(UDPSendInfo);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
UDPSendInfo.FrameID = ng_frame;
|
|
|
|
|
UDPSendInfo.ng[i] = ng[i];
|
|
|
|
|
#ifdef __UDPSend
|
|
|
|
|
UDP_Info_queue->put(UDPSendInfo);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
UDPSendInfo.FrameID = info_frame;
|
|
|
|
|
UDPSendInfo.timecost = QString::number(0);
|
|
|
|
|
UDPSendInfo.JD = QString("0,0,0");
|
|
|
|
|
#ifdef __UDPSend
|
|
|
|
|
UDP_Info_queue->put(UDPSendInfo);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
UDPSendInfo.FrameID = total_frame;
|
|
|
|
|
UDPSendInfo.Total = 0;
|
|
|
|
|
#ifdef __UDPSend
|
|
|
|
|
UDP_Info_queue->put(UDPSendInfo);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
@ -2760,7 +2756,7 @@ void Cigarette::init_plc_value()
|
|
|
|
|
|
|
|
|
|
void Cigarette::CreatWorkThread(int classid,int Num,Cigarette* classptr)
|
|
|
|
|
{
|
|
|
|
|
work_thread[Num].init(g_image_queue[Num],g_result_queue[Num],classid,Num);
|
|
|
|
|
work_thread[Num].init(g_image_queue[Num], g_result_queue[Num], classid, Num);
|
|
|
|
|
connect(&work_thread[Num], SIGNAL(notify(int,int,cv::Mat)), classptr, SLOT(OnNotifyHub(int,int,cv::Mat)));
|
|
|
|
|
connect(&work_thread[Num], SIGNAL(display_timecost(int,int)), classptr, SLOT(OnDisplayTimeCostHub(int,int)));
|
|
|
|
|
connect(&work_thread[Num], SIGNAL(display_check_total(int,long)), classptr, SLOT(OnDisplayCheckNumberHub(int,long)));
|
|
|
|
@ -3580,10 +3576,10 @@ void Cigarette::record_output_statistic(qint64 quantity, int Kick[NumberOfSuppor
|
|
|
|
|
last_shift = shift;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef __UDPSend
|
|
|
|
|
void Cigarette::recMsgFromUdp(QString data)
|
|
|
|
|
{
|
|
|
|
|
//std::cout << data.toStdString() << std::endl;
|
|
|
|
|
#ifdef __UDPSend
|
|
|
|
|
if (data == "START")
|
|
|
|
|
{
|
|
|
|
|
if (!g_admin_mode)
|
|
|
|
@ -3999,5 +3995,5 @@ void Cigarette::recMsgFromUdp(QString data)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|