|
|
|
@ -81,6 +81,7 @@ int quantity_stop_count; //
|
|
|
|
|
int g_seconds;
|
|
|
|
|
int CurOpLabel;
|
|
|
|
|
bool onrestart = false;
|
|
|
|
|
bool flag = false;
|
|
|
|
|
|
|
|
|
|
VOID BeforeWork(int shoot[])
|
|
|
|
|
{
|
|
|
|
@ -256,6 +257,7 @@ Cigarette::Cigarette(QWidget *parent)
|
|
|
|
|
#ifdef __ExportData
|
|
|
|
|
exportDataThread.init();
|
|
|
|
|
exportDataThread.start_work();
|
|
|
|
|
connect(this, &Cigarette::sendMsgToExportData, &exportDataThread, &ExportDataThread::EDrecMsgFromCigarette);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
m_PLCDevice = new PLCDevice;
|
|
|
|
@ -1244,6 +1246,7 @@ 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");
|
|
|
|
|
exportData[Num].detectTime = QString::number(ms) + "ms";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Cigarette::OnDisplayCheckNumberHub(int Num, long no)
|
|
|
|
@ -1262,6 +1265,10 @@ void Cigarette::OnDisplayCheckNumberHub(int Num, long no)
|
|
|
|
|
void Cigarette::OnDisplayJdNoHub(int Num, QString jd_no)
|
|
|
|
|
{
|
|
|
|
|
label_jd_no_mat[Num]->setText(jd_no);
|
|
|
|
|
#ifdef __ExportData
|
|
|
|
|
exportData[Num].cameraId = Num;
|
|
|
|
|
exportData[Num].jdNum = jd_no;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Cigarette::OnOKHub(int Num)
|
|
|
|
@ -1278,7 +1285,7 @@ void Cigarette::OnOKHub(int Num)
|
|
|
|
|
label_reslut_mat[Num]->setText("OK");
|
|
|
|
|
label_reslut_mat[Num]->setStyleSheet(tr("background-color: rgb(0, 255, 0);"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exportData[Num].okNum = ok[Num];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Cigarette::OnNGHub(int Num)
|
|
|
|
@ -1294,10 +1301,11 @@ 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);"));
|
|
|
|
|
|
|
|
|
|
exportData[Num].ngNum = ng[Num];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Cigarette::updateStatisticsHub(const QString& statisticalData, int Num)
|
|
|
|
|
{
|
|
|
|
|
void Cigarette::updateStatisticsHub(const QString& statisticalData, int Num) {
|
|
|
|
|
label_cap_speed_mat[Num]->setText(statisticalData + QStringLiteral("个/秒"));
|
|
|
|
|
_UDPSendInfo UDPSendInfo;
|
|
|
|
|
UDPSendInfo.FrameID = speed_frame;
|
|
|
|
@ -1306,6 +1314,7 @@ void Cigarette::updateStatisticsHub(const QString& statisticalData, int Num)
|
|
|
|
|
#ifdef __UDPSend
|
|
|
|
|
UDP_Info_queue->put(UDPSendInfo);
|
|
|
|
|
#endif
|
|
|
|
|
exportData[Num].acquisitionTime = statisticalData + QStringLiteral("个/秒");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//不剔除模式
|
|
|
|
@ -1479,13 +1488,16 @@ void Cigarette::handleTimeout()
|
|
|
|
|
int ret = m_PLCDevice->read_short_from_plc(g_modbus_conf.kick[i], 2, dest16);
|
|
|
|
|
if (ret == 2) {
|
|
|
|
|
Kick[i] = dest16[0] + (dest16[1] << 16);
|
|
|
|
|
lcdNumber_kick_mat[i]->display(Kick[i]);
|
|
|
|
|
lcdNumber_kick_mat[i]->display(dest16[0] + (dest16[1] << 16));
|
|
|
|
|
#ifdef __UDPSend
|
|
|
|
|
_UDPSendInfo UDPSendInfo;
|
|
|
|
|
UDPSendInfo.FrameID = kick_frame;
|
|
|
|
|
UDPSendInfo.index = 0;
|
|
|
|
|
UDPSendInfo.index = i;
|
|
|
|
|
UDPSendInfo.Kick[UDPSendInfo.index] = dest16[0] + (dest16[1] << 16);
|
|
|
|
|
UDP_Info_queue->put(UDPSendInfo);
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef __ExportData
|
|
|
|
|
exportData[i].kick = dest16[0] + (dest16[1] << 16);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1860,10 +1872,9 @@ void Cigarette::on_toolButton_alarm_released()
|
|
|
|
|
}
|
|
|
|
|
void Cigarette::on_pushButton_clear_released()//换班
|
|
|
|
|
{
|
|
|
|
|
#ifdef __ExportData
|
|
|
|
|
_XMLExportDataInfo exportXMLDataInfo;
|
|
|
|
|
#endif
|
|
|
|
|
emit sengMsgToClog("Change shift.");
|
|
|
|
|
emit sendMsgToExportData();
|
|
|
|
|
|
|
|
|
|
if (!g_admin_mode)
|
|
|
|
|
{
|
|
|
|
|
if (!g_op_mode)
|
|
|
|
@ -1889,10 +1900,6 @@ void Cigarette::on_pushButton_clear_released()//
|
|
|
|
|
{
|
|
|
|
|
production_number[i]=0;
|
|
|
|
|
lcdNumber_total_mat[i]->display(production_number[i]);
|
|
|
|
|
#ifdef __ExportData
|
|
|
|
|
exportXMLDataInfo.okNum[i] = ok[i];
|
|
|
|
|
exportXMLDataInfo.ngNum[i] = ng[i];
|
|
|
|
|
#endif
|
|
|
|
|
ok[i] = 0;
|
|
|
|
|
lcdNumber_ok_mat[i]->display(ok[i]);
|
|
|
|
|
ng[i] = 0;
|
|
|
|
@ -1943,29 +1950,44 @@ void Cigarette::on_pushButton_clear_released()//
|
|
|
|
|
{
|
|
|
|
|
int cur_quantity = dest16[0] + (dest16[1] << 16);
|
|
|
|
|
ui.lcdNumber_total_no_last->display(cur_quantity);
|
|
|
|
|
exportXMLDataInfo.TotalCheckNum = cur_quantity;
|
|
|
|
|
#ifdef __ExportData
|
|
|
|
|
exportData->totalCheckNum = cur_quantity;
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef __UDPSend
|
|
|
|
|
sThread.sendData("totallast_" + QString::number(cur_quantity), g_sys_conf.FeedbackPort);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef __ExportData
|
|
|
|
|
// 读取剔除值
|
|
|
|
|
for (int i = 0; i < NumberOfSupportedCameras; i++) {
|
|
|
|
|
#if defined(NumberOfSupportedCameras) && (NumberOfSupportedCameras > i)
|
|
|
|
|
if (g_modbus_conf.kick[i] > 0) {
|
|
|
|
|
uint16_t dest16[2];
|
|
|
|
|
int ret = m_PLCDevice->read_short_from_plc(g_modbus_conf.kick[i], 2, dest16);
|
|
|
|
|
if (ret == 2) {
|
|
|
|
|
exportXMLDataInfo.kickNum[i] = dest16[0] + (dest16[1] << 16);
|
|
|
|
|
}
|
|
|
|
|
//发送换班消息给PLC
|
|
|
|
|
if (g_modbus_conf.shift > 0)
|
|
|
|
|
{
|
|
|
|
|
int ret = m_PLCDevice->write_bit_2_plc( g_modbus_conf.shift, 1);
|
|
|
|
|
if (g_modbus_conf.alarm >0)///给报警地址(alarm对应的PLC地址)清零
|
|
|
|
|
{
|
|
|
|
|
uint16_t dest16[2] = { 0,0 };
|
|
|
|
|
int ret = m_PLCDevice->write_short_2_plc(g_modbus_conf.alarm, 2, dest16);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
g_op_time = OP_TIME;
|
|
|
|
|
|
|
|
|
|
#ifdef __ExportData
|
|
|
|
|
for (int i = 0; i < NumberOfSupportedCameras; i++) {
|
|
|
|
|
_XMLExportDataInfo exportXMLDataInfo;
|
|
|
|
|
exportXMLDataInfo.cameraTotal = NumberOfSupportedCameras;
|
|
|
|
|
exportXMLDataInfo.cameraId = exportData[i].cameraId;
|
|
|
|
|
exportXMLDataInfo.TotalCheckNum = exportData[i].totalCheckNum;
|
|
|
|
|
exportXMLDataInfo.shotCounts = g_sys_conf.shoot[i];
|
|
|
|
|
exportXMLDataInfo.DetectSpeed = exportData[i].detectTime;
|
|
|
|
|
exportXMLDataInfo.AcquisitionSpeed = exportData[i].acquisitionTime;
|
|
|
|
|
exportXMLDataInfo.jdNum = exportData[i].jdNum;
|
|
|
|
|
exportXMLDataInfo.okNum = exportData[i].okNum;
|
|
|
|
|
exportXMLDataInfo.ngNum = exportData[i].ngNum;
|
|
|
|
|
exportXMLDataInfo.kickNum= exportData[i].kick;
|
|
|
|
|
int flag = 0;
|
|
|
|
|
for (int i = 1; i < NumberOfSupportedCameras; i++) {
|
|
|
|
|
if (exportXMLDataInfo.kickNum[i] != exportXMLDataInfo.kickNum[0]) {
|
|
|
|
|
if (exportData[i].kick != exportData[0].kick) {
|
|
|
|
|
flag = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -1973,32 +1995,21 @@ void Cigarette::on_pushButton_clear_released()//
|
|
|
|
|
if (flag == 1) {
|
|
|
|
|
// Kick值不一致
|
|
|
|
|
for (int i = 0; i < NumberOfSupportedCameras; i++) {
|
|
|
|
|
exportXMLDataInfo.TotalKickNum += exportXMLDataInfo.kickNum[i];
|
|
|
|
|
exportXMLDataInfo.TotalKickNum += exportData[i].kick;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
exportXMLDataInfo.TotalKickNum = exportXMLDataInfo.kickNum[0];
|
|
|
|
|
|
|
|
|
|
exportXMLDataInfo.KickRate = ((double)exportXMLDataInfo.TotalKickNum / (double)exportXMLDataInfo.TotalCheckNum) * 100;
|
|
|
|
|
exportXMLDataInfo.PassRate = (1.0 - exportXMLDataInfo.KickRate) * 100;
|
|
|
|
|
exportXMLDataInfo.TotalKickNum = exportData[0].kick;
|
|
|
|
|
if (exportXMLDataInfo.TotalKickNum == 0)
|
|
|
|
|
exportXMLDataInfo.KickRate = 0;
|
|
|
|
|
else
|
|
|
|
|
exportXMLDataInfo.KickRate = (double)exportXMLDataInfo.TotalKickNum / exportXMLDataInfo.TotalCheckNum;
|
|
|
|
|
exportXMLDataInfo.PassRate = 1.0 - exportXMLDataInfo.KickRate;
|
|
|
|
|
|
|
|
|
|
export_XMLData_Info_queue->put(exportXMLDataInfo);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//发送换班消息给PLC
|
|
|
|
|
if (g_modbus_conf.shift > 0)
|
|
|
|
|
{
|
|
|
|
|
int ret = m_PLCDevice->write_bit_2_plc( g_modbus_conf.shift, 1);
|
|
|
|
|
if (g_modbus_conf.alarm >0)///给报警地址(alarm对应的PLC地址)清零
|
|
|
|
|
{
|
|
|
|
|
uint16_t dest16[2] = { 0,0 };
|
|
|
|
|
int ret = m_PLCDevice->write_short_2_plc(g_modbus_conf.alarm, 2, dest16);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
g_op_time = OP_TIME;
|
|
|
|
|
flag = false;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//读取系统管理员密码
|
|
|
|
|