修改巴鲁夫部分代码、删除产量统计部分代码等

main
seiyu 1 year ago
parent 39f080cdca
commit 215acc558b

@ -1597,7 +1597,7 @@ void Cigarette::handleTimeout()
{ {
qint64 secA = time.secsTo(g_sys_conf.shiftA); qint64 secA = time.secsTo(g_sys_conf.shiftA);
qint64 secB = time.secsTo(g_sys_conf.shiftB); qint64 secB = time.secsTo(g_sys_conf.shiftB);
qint64 secC = time.secsTo(g_sys_conf.shiftC); qint64 secC = time.secsTo(g_sys_conf.shiftC);
if (secA == 0) if (secA == 0)
{ {
g_op_mode = true; //激活操作员模式 g_op_mode = true; //激活操作员模式
@ -1912,7 +1912,7 @@ void Cigarette::on_pushButton_clear_released()//
if (g_modbus_conf.quantity > 0) if (g_modbus_conf.quantity > 0)
{ {
uint16_t dest16[2]; uint16_t dest16[2];
int ret = m_PLCDevice->read_short_from_plc( g_modbus_conf.quantity, 2, dest16); int ret = m_PLCDevice->read_short_from_plc(g_modbus_conf.quantity, 2, dest16);
//std::cout << ret << std::endl; //std::cout << ret << std::endl;
if (ret > 0) if (ret > 0)
{ {
@ -1972,7 +1972,6 @@ void Cigarette::on_pushButton_clear_released()//
} }
//flag = false; //flag = false;
#endif #endif
//发送换班消息给PLC //发送换班消息给PLC
if (g_modbus_conf.shift > 0) if (g_modbus_conf.shift > 0)
{ {
@ -3356,24 +3355,26 @@ void Cigarette::EnumerateCameras(SingleCamInfoStruct *TempSingleCamInfoStruct,bo
for (int i = 0; i < min(unfiltered, NumberOfSupportedCameras); i++) for (int i = 0; i < min(unfiltered, NumberOfSupportedCameras); i++)
{ {
Device* pDev = BalluffCamera::devMgr[i]; Device* pDev = BalluffCamera::devMgr[i];
std::string manufacture = pDev->manufacturer.read(); if (!pDev->isInUse()) {
if(showinfo)std::cout << "Camera:" << i << ",vendor = " << manufacture << std::endl; std::string manufacture = pDev->manufacturer.read();
transform(manufacture.begin(), manufacture.end(), manufacture.begin(), ::toupper); if (showinfo)std::cout << "Camera:" << i << ",vendor = " << manufacture << std::endl;
SingleCamInfoStruct CamInfo; transform(manufacture.begin(), manufacture.end(), manufacture.begin(), ::toupper);
if ((!manufacture.compare(0, 7, "BALLUFF"))||(!manufacture.compare(0, 13, "MATRIX VISION"))) SingleCamInfoStruct CamInfo;
{ if ((!manufacture.compare(0, 7, "BALLUFF")) || (!manufacture.compare(0, 13, "MATRIX VISION")))
mvIMPACT::acquire::GenICam::DeviceControl dc(pDev); {
std::string UserID = dc.deviceUserID.read(); mvIMPACT::acquire::GenICam::DeviceControl dc(pDev);
pDev->close(); std::string UserID = dc.deviceUserID.read();
if(showinfo)std::cout << "Balluff user ID = " << UserID << std::endl; pDev->close();
CamInfo.UserID = atoi(UserID.c_str()); if (showinfo)std::cout << "Balluff user ID = " << UserID << std::endl;
CamInfo.CamClass = BalluffClassID; CamInfo.UserID = atoi(UserID.c_str());
CamInfo.unfiltered_num = i; CamInfo.CamClass = BalluffClassID;
CamInfo.Detect = false; CamInfo.unfiltered_num = i;
CamInfo.IsOpen = false; CamInfo.Detect = false;
CamInfo.OffLine = false; CamInfo.IsOpen = false;
TempSingleCamInfo.push_back(CamInfo); CamInfo.OffLine = false;
balluff_cnt++; TempSingleCamInfo.push_back(CamInfo);
balluff_cnt++;
}
} }
} }
@ -3555,9 +3556,10 @@ void Cigarette::record_output_statistic(qint64 quantity, int Kick[NumberOfSuppor
memset(buf, 0, 256); memset(buf, 0, 256);
sprintf(buf, "\n\n**************************************************************************************\n"); sprintf(buf, "\n\n**************************************************************************************\n");
cfg_file.write(buf, strlen(buf)); cfg_file.write(buf, strlen(buf));
QDate date = QDate::currentDate(); //QDate date = QDate::currentDate();
QDateTime date = QDateTime::currentDateTime();
memset(buf, 0, 256); memset(buf, 0, 256);
sprintf(buf, "%s:\n", date.toString("yyyy-MM-dd ").toStdString().c_str()); sprintf(buf, "%s:\n", date.toString("yyyy-MM-dd_HH-mm-ss").toStdString().c_str());
cfg_file.write(buf, strlen(buf)); cfg_file.write(buf, strlen(buf));
} }
memset(buf, 0, 256); memset(buf, 0, 256);

@ -190,14 +190,14 @@ int ExportDataThread::insertXMLNode(const char* xmlPath, _XMLExportDataInfo& dat
// ºÏ¸ñÂÊ // ºÏ¸ñÂÊ
XMLElement* PassRate = pDocument[data.cameraId]->NewElement("PassRate"); XMLElement* PassRate = pDocument[data.cameraId]->NewElement("PassRate");
std::string temp_str = std::to_string(data.PassRate * 100); std::string temp_str = std::to_string(data.PassRate * 100 ) + "%";
const char* temp_char = temp_str.c_str(); const char* temp_char = temp_str.c_str();
PassRate->InsertEndChild(pDocument[data.cameraId]->NewText(temp_char)); PassRate->InsertEndChild(pDocument[data.cameraId]->NewText(temp_char));
JudgeNum->InsertEndChild(PassRate); JudgeNum->InsertEndChild(PassRate);
// ÌÞ³ýÂÊ // ÌÞ³ýÂÊ
XMLElement* KickRate = pDocument[data.cameraId]->NewElement("KickRate"); XMLElement* KickRate = pDocument[data.cameraId]->NewElement("KickRate");
temp_str = std::to_string(data.KickRate * 100); temp_str = std::to_string(data.KickRate * 100) + "%";
temp_char = temp_str.c_str(); temp_char = temp_str.c_str();
KickRate->InsertEndChild(pDocument[data.cameraId]->NewText(temp_char)); KickRate->InsertEndChild(pDocument[data.cameraId]->NewText(temp_char));
JudgeNum->InsertEndChild(KickRate); JudgeNum->InsertEndChild(KickRate);

@ -47,36 +47,6 @@ output_statistic::~output_statistic()
void output_statistic::recMsgFromDialogSetup() void output_statistic::recMsgFromDialogSetup()
{ {
#ifdef __ExportData
_ExportDataInfo data;
map<string, float> averageData[NumberOfSupportedCameras];
ui.tabWidget->setTabVisible(1, false);
ui.tabWidget->setTabVisible(2, false);
ui.tabWidget->setTabVisible(3, false);
ui.tabWidget->setTabVisible(4, false);
ui.tabWidget->setTabVisible(5, false);
ui.tabWidget->setTabVisible(6, false);
ui.tabWidget->setTabVisible(7, false);
ui.tabWidget->setTabText(0, "Statistical data");
for (int index = 0; index < NumberOfSupportedCameras; index++) {
data.getAverageData(averageData[index], index);
QString text;
text.append(" CameraId: ");
text.append(std::to_string((int)averageData[index]["CameraId"]).c_str());
text.append("\n IsNG: ");
text.append(std::to_string((int)averageData[index]["IsNG"]).c_str());
text.append("\n IsJdExist: ");
text.append(std::to_string((int)averageData[index]["IsJdExist"]).c_str());
text.append("\n TimeCost: ");
text.append(std::to_string(averageData[index]["TimeCost"]).c_str());
text.append("\n*************************************************\n");
ui.textBrowser_1->insertPlainText(text);
}
#else
QString file_path, file_name; QString file_path, file_name;
QFile file; QFile file;
for (int i = 0; i < NumberOfSupportedCameras; i++) { for (int i = 0; i < NumberOfSupportedCameras; i++) {
@ -95,6 +65,5 @@ void output_statistic::recMsgFromDialogSetup()
file.close(); file.close();
this->show(); this->show();
} }
#endif
//this->show(); //this->show();
} }
Loading…
Cancel
Save