|
|
|
@ -7,7 +7,7 @@
|
|
|
|
|
#include <QtCore\qcryptographichash.h>
|
|
|
|
|
#include <QtCore\qprocess.h>
|
|
|
|
|
#include "exportData.h"
|
|
|
|
|
#include <FtpManager.h>
|
|
|
|
|
#include <Windows.h>
|
|
|
|
|
|
|
|
|
|
int g_op_time; //操作员权限时长(默认300秒)
|
|
|
|
|
int g_admin_time; //管理员操作权限时长(默认300秒)
|
|
|
|
@ -60,7 +60,6 @@ SyncQueue<_UDPSendInfo>* UDP_Info_queue;
|
|
|
|
|
//SyncQueue<_ExportDataInfo> *export_Data_Info_queue;
|
|
|
|
|
SyncQueue<_XMLExportDataInfo>* export_XMLData_Info_queue;
|
|
|
|
|
ExportDataThread exportDataThread;
|
|
|
|
|
FtpManager ftpManager;
|
|
|
|
|
|
|
|
|
|
bool g_admin_mode; //是否管理员模式
|
|
|
|
|
|
|
|
|
@ -872,7 +871,6 @@ void Cigarette::sendLatestData() {
|
|
|
|
|
// 连接UDP发送最新的数据
|
|
|
|
|
int dataport = g_sys_conf.MonitorPort;
|
|
|
|
|
_UDPSendInfo UDPSendInfo;
|
|
|
|
|
//UDP_Info_queue->take(UDPSendInfo);
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < NumberOfSupportedCameras; i++)
|
|
|
|
|
{
|
|
|
|
@ -880,19 +878,16 @@ void Cigarette::sendLatestData() {
|
|
|
|
|
UDPSendInfo.FrameID = ok_frame;
|
|
|
|
|
UDPSendInfo.ok[i] = ok[i];
|
|
|
|
|
#ifdef __UDPSend
|
|
|
|
|
//sThread.sendData(("4_" + to_string(ok[i])).c_str(), dataport + UDPSendInfo.index);
|
|
|
|
|
UDP_Info_queue->put(UDPSendInfo);
|
|
|
|
|
#endif
|
|
|
|
|
UDPSendInfo.FrameID = ng_frame;
|
|
|
|
|
UDPSendInfo.ng[i] = ng[i];
|
|
|
|
|
#ifdef __UDPSend
|
|
|
|
|
//sThread.sendData(("5_" + to_string(ng[i])).c_str(), dataport + UDPSendInfo.index);
|
|
|
|
|
UDP_Info_queue->put(UDPSendInfo);
|
|
|
|
|
#endif
|
|
|
|
|
UDPSendInfo.FrameID = total_frame;
|
|
|
|
|
UDPSendInfo.Total = production_number[i];
|
|
|
|
|
#ifdef __UDPSend
|
|
|
|
|
//sThread.sendData(("7_" + to_string(production_number[i])).c_str(), dataport + UDPSendInfo.index);
|
|
|
|
|
UDP_Info_queue->put(UDPSendInfo);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
@ -1251,14 +1246,15 @@ void Cigarette::OnNotifyHub(int Num, int Cnt,cv::Mat m)
|
|
|
|
|
void Cigarette::OnDisplayTimeCostHub(int Num, int ms)
|
|
|
|
|
{
|
|
|
|
|
label_timecost_mat[Num]->setText(QString::number(ms) + "ms");
|
|
|
|
|
#ifdef __ExportData
|
|
|
|
|
exportData[Num].detectTime = QString::number(ms) + "ms";
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Cigarette::OnDisplayCheckNumberHub(int Num, long no)
|
|
|
|
|
{
|
|
|
|
|
production_number[Num]++;
|
|
|
|
|
lcdNumber_total_mat[Num]->display(production_number[Num]);
|
|
|
|
|
exportData[Num].checkNum = production_number[Num];
|
|
|
|
|
_UDPSendInfo UDPSendInfo;
|
|
|
|
|
UDPSendInfo.FrameID = total_frame;
|
|
|
|
|
UDPSendInfo.index = Num;
|
|
|
|
@ -1266,6 +1262,9 @@ void Cigarette::OnDisplayCheckNumberHub(int Num, long no)
|
|
|
|
|
#ifdef __UDPSend
|
|
|
|
|
UDP_Info_queue->put(UDPSendInfo);
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef __ExportData
|
|
|
|
|
exportData[Num].checkNum = production_number[Num];
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Cigarette::OnDisplayJdNoHub(int Num, QString jd_no)
|
|
|
|
@ -1290,8 +1289,9 @@ void Cigarette::OnOKHub(int Num)
|
|
|
|
|
lcdNumber_ok_mat[Num]->display(ok[Num]);
|
|
|
|
|
label_reslut_mat[Num]->setText("OK");
|
|
|
|
|
label_reslut_mat[Num]->setStyleSheet(tr("background-color: rgb(0, 255, 0);"));
|
|
|
|
|
|
|
|
|
|
#ifdef __ExportData
|
|
|
|
|
exportData[Num].okNum = ok[Num];
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Cigarette::OnNGHub(int Num)
|
|
|
|
@ -1307,8 +1307,9 @@ void Cigarette::OnNGHub(int Num)
|
|
|
|
|
lcdNumber_ng_mat[Num]->display(ng[Num]);
|
|
|
|
|
label_reslut_mat[Num]->setText("NG");
|
|
|
|
|
label_reslut_mat[Num]->setStyleSheet(tr("background-color: rgb(255, 0, 0);"));
|
|
|
|
|
|
|
|
|
|
#ifdef __ExportData
|
|
|
|
|
exportData[Num].ngNum = ng[Num];
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Cigarette::updateStatisticsHub(const QString& statisticalData, int Num) {
|
|
|
|
@ -1320,7 +1321,9 @@ void Cigarette::updateStatisticsHub(const QString& statisticalData, int Num) {
|
|
|
|
|
#ifdef __UDPSend
|
|
|
|
|
UDP_Info_queue->put(UDPSendInfo);
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef __ExportData
|
|
|
|
|
exportData[Num].acquisitionTime = statisticalData + QStringLiteral("个/秒");
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//不剔除模式
|
|
|
|
@ -1412,6 +1415,31 @@ void Cigarette::on_checkBox_debug_clicked(bool checked)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Cigarette::on_pushButton_wintab_clicked(bool checked) {
|
|
|
|
|
INPUT inputs[4] = {};
|
|
|
|
|
ZeroMemory(inputs, sizeof(inputs));
|
|
|
|
|
|
|
|
|
|
inputs[0].type = INPUT_KEYBOARD;
|
|
|
|
|
inputs[0].ki.wVk = VK_LWIN;
|
|
|
|
|
|
|
|
|
|
inputs[1].type = INPUT_KEYBOARD;
|
|
|
|
|
inputs[1].ki.wVk = VK_TAB;
|
|
|
|
|
|
|
|
|
|
inputs[2].type = INPUT_KEYBOARD;
|
|
|
|
|
inputs[2].ki.wVk = VK_TAB;
|
|
|
|
|
inputs[2].ki.dwFlags = KEYEVENTF_KEYUP;
|
|
|
|
|
|
|
|
|
|
inputs[3].type = INPUT_KEYBOARD;
|
|
|
|
|
inputs[3].ki.wVk = VK_LWIN;
|
|
|
|
|
inputs[3].ki.dwFlags = KEYEVENTF_KEYUP;
|
|
|
|
|
|
|
|
|
|
UINT uSent = SendInput(ARRAYSIZE(inputs), inputs, sizeof(INPUT));
|
|
|
|
|
if (uSent != ARRAYSIZE(inputs))
|
|
|
|
|
{
|
|
|
|
|
qDebug() << "SendInput failed" << HRESULT_FROM_WIN32(GetLastError());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//打开PLC配置对话框
|
|
|
|
|
void Cigarette::on_toolButton_plc_released()
|
|
|
|
|
{
|
|
|
|
@ -1773,30 +1801,7 @@ void Cigarette::handleTimeout()
|
|
|
|
|
ui.label_alarm->setStyleSheet(tr("background-color: rgb(0, 170, 0);"));
|
|
|
|
|
ui.label_alarm->setText(QStringLiteral("无报警"));
|
|
|
|
|
}
|
|
|
|
|
//if (alarm_info.alarm_code == 7) {
|
|
|
|
|
// ui.label_alarm->setStyleSheet(tr("background-color: rgb(0, 170, 0);"));
|
|
|
|
|
// ui.label_alarm->setText(QStringLiteral("重连1#相机"));
|
|
|
|
|
// //重连1#相机
|
|
|
|
|
// ReconnectCamHub(0);
|
|
|
|
|
// //清除报警标志
|
|
|
|
|
// if (g_modbus_conf.alarm > 0)
|
|
|
|
|
// {
|
|
|
|
|
// uint16_t dest16[2] = {0,0};
|
|
|
|
|
// int ret = m_PLCDevice->write_short_2_plc(g_modbus_conf.alarm, 2, dest16);
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
//if (alarm_info.alarm_code == 8) {
|
|
|
|
|
// ui.label_alarm->setStyleSheet(tr("background-color: rgb(0, 170, 0);"));
|
|
|
|
|
// ui.label_alarm->setText(QStringLiteral("重连2#相机"));
|
|
|
|
|
// //重连2#相机
|
|
|
|
|
// ReconnectCamHub(1);
|
|
|
|
|
// //清除报警标志
|
|
|
|
|
// if (g_modbus_conf.alarm > 0)
|
|
|
|
|
// {
|
|
|
|
|
// uint16_t dest16[2] = {0,0};
|
|
|
|
|
// int ret = m_PLCDevice->write_short_2_plc(g_modbus_conf.alarm, 2, dest16);
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
#ifdef __UDPSend
|
|
|
|
|
QString str;
|
|
|
|
|
str = QString("alarm") + '_' + QString::number(alarm_info.alarm_code);
|
|
|
|
@ -2024,7 +2029,6 @@ void Cigarette::on_pushButton_clear_released()//
|
|
|
|
|
#ifdef __UDPSend
|
|
|
|
|
sThread.sendData("total_" + QString::number(0), g_sys_conf.FeedbackPort);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//读取系统管理员密码
|
|
|
|
|