删除一些注释以及添加模拟win+tab按钮

main
seiyu 1 year ago
parent 4c319c9ae5
commit 3f6c64d10c

@ -133,7 +133,7 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType> <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp14</LanguageStandard> <LanguageStandard>stdcpp14</LanguageStandard>
<Optimization>MaxSpeed</Optimization> <Optimization>Disabled</Optimization>
<SupportJustMyCode>false</SupportJustMyCode> <SupportJustMyCode>false</SupportJustMyCode>
<DisableSpecificWarnings>4819;%(DisableSpecificWarnings)</DisableSpecificWarnings> <DisableSpecificWarnings>4819;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile> </ClCompile>
@ -141,7 +141,7 @@
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile> <OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>$(QTDIR)\lib;$(ProjectDir)OpenCV455Simple\win64\vc15\lib;$(ProjectDir)Pylon6.2\lib\Win64;$(ProjectDir)MvIMPACT\lib\win64;$(ProjectDir)MVS3.2.1\lib\win64;$(ProjectDir)modbus;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(QTDIR)\lib;$(ProjectDir)OpenCV455Simple\win64\vc15\lib;$(ProjectDir)Pylon6.2\lib\Win64;$(ProjectDir)MvIMPACT\lib\win64;$(ProjectDir)MVS3.2.1\lib\win64;$(ProjectDir)modbus;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>false</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>qtmain.lib;Qt5Core.lib;Qt5Widgets.lib;Qt5Gui.lib;opencv_world455.lib;modbus.lib;mvDeviceManager.lib;MvCameraControl.lib;Qt5Network.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>qtmain.lib;Qt5Core.lib;Qt5Widgets.lib;Qt5Gui.lib;opencv_world455.lib;modbus.lib;mvDeviceManager.lib;MvCameraControl.lib;Qt5Network.lib;%(AdditionalDependencies)</AdditionalDependencies>
<IgnoreSpecificDefaultLibraries> <IgnoreSpecificDefaultLibraries>
</IgnoreSpecificDefaultLibraries> </IgnoreSpecificDefaultLibraries>

@ -7,7 +7,7 @@
#include <QtCore\qcryptographichash.h> #include <QtCore\qcryptographichash.h>
#include <QtCore\qprocess.h> #include <QtCore\qprocess.h>
#include "exportData.h" #include "exportData.h"
#include <FtpManager.h> #include <Windows.h>
int g_op_time; //操作员权限时长默认300秒 int g_op_time; //操作员权限时长默认300秒
int g_admin_time; //管理员操作权限时长默认300秒 int g_admin_time; //管理员操作权限时长默认300秒
@ -60,7 +60,6 @@ SyncQueue<_UDPSendInfo>* UDP_Info_queue;
//SyncQueue<_ExportDataInfo> *export_Data_Info_queue; //SyncQueue<_ExportDataInfo> *export_Data_Info_queue;
SyncQueue<_XMLExportDataInfo>* export_XMLData_Info_queue; SyncQueue<_XMLExportDataInfo>* export_XMLData_Info_queue;
ExportDataThread exportDataThread; ExportDataThread exportDataThread;
FtpManager ftpManager;
bool g_admin_mode; //是否管理员模式 bool g_admin_mode; //是否管理员模式
@ -872,7 +871,6 @@ void Cigarette::sendLatestData() {
// 连接UDP发送最新的数据 // 连接UDP发送最新的数据
int dataport = g_sys_conf.MonitorPort; int dataport = g_sys_conf.MonitorPort;
_UDPSendInfo UDPSendInfo; _UDPSendInfo UDPSendInfo;
//UDP_Info_queue->take(UDPSendInfo);
for (int i = 0; i < NumberOfSupportedCameras; i++) for (int i = 0; i < NumberOfSupportedCameras; i++)
{ {
@ -880,19 +878,16 @@ void Cigarette::sendLatestData() {
UDPSendInfo.FrameID = ok_frame; UDPSendInfo.FrameID = ok_frame;
UDPSendInfo.ok[i] = ok[i]; UDPSendInfo.ok[i] = ok[i];
#ifdef __UDPSend #ifdef __UDPSend
//sThread.sendData(("4_" + to_string(ok[i])).c_str(), dataport + UDPSendInfo.index);
UDP_Info_queue->put(UDPSendInfo); UDP_Info_queue->put(UDPSendInfo);
#endif #endif
UDPSendInfo.FrameID = ng_frame; UDPSendInfo.FrameID = ng_frame;
UDPSendInfo.ng[i] = ng[i]; UDPSendInfo.ng[i] = ng[i];
#ifdef __UDPSend #ifdef __UDPSend
//sThread.sendData(("5_" + to_string(ng[i])).c_str(), dataport + UDPSendInfo.index);
UDP_Info_queue->put(UDPSendInfo); UDP_Info_queue->put(UDPSendInfo);
#endif #endif
UDPSendInfo.FrameID = total_frame; UDPSendInfo.FrameID = total_frame;
UDPSendInfo.Total = production_number[i]; UDPSendInfo.Total = production_number[i];
#ifdef __UDPSend #ifdef __UDPSend
//sThread.sendData(("7_" + to_string(production_number[i])).c_str(), dataport + UDPSendInfo.index);
UDP_Info_queue->put(UDPSendInfo); UDP_Info_queue->put(UDPSendInfo);
#endif #endif
} }
@ -1251,14 +1246,15 @@ void Cigarette::OnNotifyHub(int Num, int Cnt,cv::Mat m)
void Cigarette::OnDisplayTimeCostHub(int Num, int ms) void Cigarette::OnDisplayTimeCostHub(int Num, int ms)
{ {
label_timecost_mat[Num]->setText(QString::number(ms) + "ms"); label_timecost_mat[Num]->setText(QString::number(ms) + "ms");
#ifdef __ExportData
exportData[Num].detectTime = QString::number(ms) + "ms"; exportData[Num].detectTime = QString::number(ms) + "ms";
#endif
} }
void Cigarette::OnDisplayCheckNumberHub(int Num, long no) void Cigarette::OnDisplayCheckNumberHub(int Num, long no)
{ {
production_number[Num]++; production_number[Num]++;
lcdNumber_total_mat[Num]->display(production_number[Num]); lcdNumber_total_mat[Num]->display(production_number[Num]);
exportData[Num].checkNum = production_number[Num];
_UDPSendInfo UDPSendInfo; _UDPSendInfo UDPSendInfo;
UDPSendInfo.FrameID = total_frame; UDPSendInfo.FrameID = total_frame;
UDPSendInfo.index = Num; UDPSendInfo.index = Num;
@ -1266,6 +1262,9 @@ void Cigarette::OnDisplayCheckNumberHub(int Num, long no)
#ifdef __UDPSend #ifdef __UDPSend
UDP_Info_queue->put(UDPSendInfo); UDP_Info_queue->put(UDPSendInfo);
#endif #endif
#ifdef __ExportData
exportData[Num].checkNum = production_number[Num];
#endif
} }
void Cigarette::OnDisplayJdNoHub(int Num, QString jd_no) void Cigarette::OnDisplayJdNoHub(int Num, QString jd_no)
@ -1290,8 +1289,9 @@ void Cigarette::OnOKHub(int Num)
lcdNumber_ok_mat[Num]->display(ok[Num]); lcdNumber_ok_mat[Num]->display(ok[Num]);
label_reslut_mat[Num]->setText("OK"); label_reslut_mat[Num]->setText("OK");
label_reslut_mat[Num]->setStyleSheet(tr("background-color: rgb(0, 255, 0);")); label_reslut_mat[Num]->setStyleSheet(tr("background-color: rgb(0, 255, 0);"));
#ifdef __ExportData
exportData[Num].okNum = ok[Num]; exportData[Num].okNum = ok[Num];
#endif
} }
void Cigarette::OnNGHub(int Num) void Cigarette::OnNGHub(int Num)
@ -1307,8 +1307,9 @@ void Cigarette::OnNGHub(int Num)
lcdNumber_ng_mat[Num]->display(ng[Num]); lcdNumber_ng_mat[Num]->display(ng[Num]);
label_reslut_mat[Num]->setText("NG"); label_reslut_mat[Num]->setText("NG");
label_reslut_mat[Num]->setStyleSheet(tr("background-color: rgb(255, 0, 0);")); label_reslut_mat[Num]->setStyleSheet(tr("background-color: rgb(255, 0, 0);"));
#ifdef __ExportData
exportData[Num].ngNum = ng[Num]; exportData[Num].ngNum = ng[Num];
#endif
} }
void Cigarette::updateStatisticsHub(const QString& statisticalData, int Num) { void Cigarette::updateStatisticsHub(const QString& statisticalData, int Num) {
@ -1320,7 +1321,9 @@ void Cigarette::updateStatisticsHub(const QString& statisticalData, int Num) {
#ifdef __UDPSend #ifdef __UDPSend
UDP_Info_queue->put(UDPSendInfo); UDP_Info_queue->put(UDPSendInfo);
#endif #endif
#ifdef __ExportData
exportData[Num].acquisitionTime = statisticalData + QStringLiteral("个/秒"); 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配置对话框 //打开PLC配置对话框
void Cigarette::on_toolButton_plc_released() 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->setStyleSheet(tr("background-color: rgb(0, 170, 0);"));
ui.label_alarm->setText(QStringLiteral("无报警")); 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 #ifdef __UDPSend
QString str; QString str;
str = QString("alarm") + '_' + QString::number(alarm_info.alarm_code); str = QString("alarm") + '_' + QString::number(alarm_info.alarm_code);
@ -2024,7 +2029,6 @@ void Cigarette::on_pushButton_clear_released()//
#ifdef __UDPSend #ifdef __UDPSend
sThread.sendData("total_" + QString::number(0), g_sys_conf.FeedbackPort); sThread.sendData("total_" + QString::number(0), g_sys_conf.FeedbackPort);
#endif #endif
} }
//读取系统管理员密码 //读取系统管理员密码

@ -86,6 +86,7 @@ private slots :
void on_btn_setup_released(); void on_btn_setup_released();
void on_checkBox_debug_clicked(bool checked); void on_checkBox_debug_clicked(bool checked);
void on_checkBox_unkick_clicked(bool checked); void on_checkBox_unkick_clicked(bool checked);
void on_pushButton_wintab_clicked(bool checked);
void on_toolButton_plc_released(); void on_toolButton_plc_released();
void on_toolButton_alarm_released(); void on_toolButton_alarm_released();
void on_pushButton_clear_released(); void on_pushButton_clear_released();

@ -1576,7 +1576,7 @@
<widget class="QLabel" name="label_18"> <widget class="QLabel" name="label_18">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>1090</x> <x>1060</x>
<y>10</y> <y>10</y>
<width>80</width> <width>80</width>
<height>20</height> <height>20</height>
@ -4394,7 +4394,7 @@
<widget class="QLabel" name="location"> <widget class="QLabel" name="location">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>1090</x> <x>1060</x>
<y>35</y> <y>35</y>
<width>161</width> <width>161</width>
<height>20</height> <height>20</height>
@ -4415,6 +4415,28 @@
<string>CDTH</string> <string>CDTH</string>
</property> </property>
</widget> </widget>
<widget class="QPushButton" name="pushButton_wintab">
<property name="geometry">
<rect>
<x>1180</x>
<y>10</y>
<width>81</width>
<height>41</height>
</rect>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">color:white</string>
</property>
<property name="text">
<string>切换</string>
</property>
</widget>
<zorder>rotate_1</zorder> <zorder>rotate_1</zorder>
<zorder>groupBox_status</zorder> <zorder>groupBox_status</zorder>
<zorder>label_title</zorder> <zorder>label_title</zorder>
@ -4522,6 +4544,7 @@
<zorder>image_label_82</zorder> <zorder>image_label_82</zorder>
<zorder>image_label_12</zorder> <zorder>image_label_12</zorder>
<zorder>location</zorder> <zorder>location</zorder>
<zorder>pushButton_wintab</zorder>
</widget> </widget>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>

@ -7,7 +7,7 @@
#include "QtCore\qdatetime.h" #include "QtCore\qdatetime.h"
//#define __DEBUG //debug信息输出功能 //#define __DEBUG //debug信息输出功能
#define __UDPSend //网络发送功能 //#define __UDPSend //网络发送功能
#define USB_BASLER_NEW_FW //使用basler定制固件 #define USB_BASLER_NEW_FW //使用basler定制固件
//#define IMM_PROCESS //拍照后立马处理,不等校验信号 //#define IMM_PROCESS //拍照后立马处理,不等校验信号
//#define IMM_FEED_BACK //处理完后立马反馈,不等校验信号 //#define IMM_FEED_BACK //处理完后立马反馈,不等校验信号
@ -15,7 +15,7 @@
#define AI_WARM_UP //AI识别开始前的热身动作 #define AI_WARM_UP //AI识别开始前的热身动作
#define LICENSE_VERIFY //开启license文件校验 #define LICENSE_VERIFY //开启license文件校验
//CAP_FEED_BACK和DOUBLE_FEED_BACK不要一起开 //CAP_FEED_BACK和DOUBLE_FEED_BACK不要一起开
#if defined (ONE_TIME_SHIFT) #if defined (ONE_TIME_SHIFT)
//#define CAP_FEED_BACK //拍照时也检测有没有测试结果,有的话就反馈 //#define CAP_FEED_BACK //拍照时也检测有没有测试结果,有的话就反馈
//#define DOUBLE_FEED_BACK //一次ng两次反馈ng信号 //#define DOUBLE_FEED_BACK //一次ng两次反馈ng信号
#endif #endif

Loading…
Cancel
Save