|
|
|
|
|
#include "ModeCheckDlg.h"
|
|
|
|
|
|
#include "checkthread.h"
|
|
|
|
|
|
#include "qtimedlg.h"
|
|
|
|
|
|
#include <QTextStream>
|
|
|
|
|
|
#include "QFileDialog"
|
|
|
|
|
|
#include "qsavecsvthread.h"
|
|
|
|
|
|
#include <QDebug>
|
|
|
|
|
|
#pragma execution_character_set("utf-8")
|
|
|
|
|
|
#define WHEEL_PIC_SIZE 150
|
|
|
|
|
|
ModeCheckDlg::ModeCheckDlg(QWidget *parent)
|
|
|
|
|
|
: QWidget(parent)
|
|
|
|
|
|
{
|
|
|
|
|
|
ui.setupUi(this);
|
|
|
|
|
|
|
|
|
|
|
|
nstartTime.setHMS(0, 0, 0);
|
|
|
|
|
|
nEndTime.setHMS(23, 59, 59);
|
|
|
|
|
|
m_tableModel = new QStandardItemModel;
|
|
|
|
|
|
m_WorkHistory = new CheckData;
|
|
|
|
|
|
m_WorkHistory->moveToThread(&m_WorkThreadCheckHistory);
|
|
|
|
|
|
|
|
|
|
|
|
connect(&m_WorkThreadCheckHistory, &QThread::finished, m_WorkHistory, &QObject::deleteLater);
|
|
|
|
|
|
connect(this, &ModeCheckDlg::operateHistory, m_WorkHistory, &CheckData::doWork);
|
|
|
|
|
|
connect(m_WorkHistory, &CheckData::resultReady, this, &ModeCheckDlg::handleResultsHistory);
|
|
|
|
|
|
connect(m_WorkHistory, &CheckData::sgShowProgress, this, &ModeCheckDlg::onProgressForTsk);
|
|
|
|
|
|
m_WorkThreadCheckHistory.start();
|
|
|
|
|
|
|
|
|
|
|
|
connect(ui.pushButton_Set1_History, SIGNAL(clicked()), this, SLOT(SlotEditTime()));
|
|
|
|
|
|
connect(ui.pushButton_Set2_History, SIGNAL(clicked()), this, SLOT(SlotEditTime()));
|
|
|
|
|
|
connect(ui.pushButton_Checkdata, SIGNAL(clicked()), this, SLOT(onCheckButton()));
|
|
|
|
|
|
connect(ui.pushButton_SaveHistory, SIGNAL(clicked()), this, SLOT(onCheckButton()));
|
|
|
|
|
|
connect(ui.Prev_checkShengchang, SIGNAL(clicked()), this, SLOT(onHistoryButton()));
|
|
|
|
|
|
connect(ui.Next_checkShengchang, SIGNAL(clicked()), this, SLOT(onHistoryButton()));
|
|
|
|
|
|
connect(ui.comboBox_Banci, SIGNAL(currentIndexChanged(int)), this, SLOT(SlotCombox(int)));
|
|
|
|
|
|
|
|
|
|
|
|
ui.LineNumber_checkShengchang->setText("50");
|
|
|
|
|
|
QValidator *validator = new QIntValidator(1, 9999, this);
|
|
|
|
|
|
ui.LineNumber_checkShengchang->setValidator(validator);
|
|
|
|
|
|
ui.showNum_Label_Checkdata->setText(tr("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ%1<><31><EFBFBD><EFBFBD>¼").arg(0));
|
|
|
|
|
|
ui.showPage_Label_Checkdata->setText(tr("<EFBFBD><EFBFBD>%1ҳ <20><>%2ҳ").arg(0).arg(0));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_startDate_History = QDateTime::currentDateTime();
|
|
|
|
|
|
m_endDate_History = QDateTime::currentDateTime();
|
|
|
|
|
|
QString strstartDate = m_startDate_History.toString("yyyy-MM-dd hh:mm:ss");
|
|
|
|
|
|
ui.label_Time1_History->setText(m_startDate_History.toString("yyyy-MM-dd hh:mm:ss"));
|
|
|
|
|
|
ui.label_Time2_History->setText(m_endDate_History.toString("yyyy-MM-dd hh:mm:ss"));
|
|
|
|
|
|
if (m_tableModel)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_tableModel->clear();
|
|
|
|
|
|
}
|
|
|
|
|
|
ui.comboBox_Model->setEditable(true);
|
|
|
|
|
|
ui.label_Number->setText("0");
|
|
|
|
|
|
ui.CheckDlg_label_Pic->clear();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ModeCheckDlg::~ModeCheckDlg()
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
if (m_tableModel) {
|
|
|
|
|
|
delete m_tableModel;
|
|
|
|
|
|
m_tableModel = NULL;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (_pCompleter) {
|
|
|
|
|
|
delete _pCompleter;
|
|
|
|
|
|
_pCompleter = NULL;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (m_WorkThreadCheckHistory.isRunning())
|
|
|
|
|
|
{
|
|
|
|
|
|
qDebug() << "delete m_WorkThreadCheckHistory";
|
|
|
|
|
|
m_WorkThreadCheckHistory.quit();
|
|
|
|
|
|
m_WorkThreadCheckHistory.wait(50);
|
|
|
|
|
|
qDebug() << "delete m_WorkThreadCheckHistory end";
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ModeCheckDlg::setDBPtr(class DetectDataDB *ptr)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_pDb = ptr;
|
|
|
|
|
|
if(m_WorkHistory)
|
|
|
|
|
|
m_WorkHistory->setDB(ptr);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ModeCheckDlg::initParam(QMap<QString, TimeStruct> timetable, QStringList names)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_Totaltime = timetable;
|
|
|
|
|
|
SetModelNames(names);
|
|
|
|
|
|
ui.comboBox_Banci->clear();
|
|
|
|
|
|
ui.comboBox_Banci->addItem(tr("ȫ<EFBFBD><EFBFBD>"));
|
|
|
|
|
|
ui.comboBox_Banci->addItems(m_Totaltime.keys());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QString ModeCheckDlg::getHistoryCheckString()
|
|
|
|
|
|
{
|
|
|
|
|
|
QString m_strLast = ui.label_Time1_History->text();
|
|
|
|
|
|
QString m_endLast = ui.label_Time2_History->text();
|
|
|
|
|
|
QString modelName = ui.comboBox_Model->currentText();
|
|
|
|
|
|
QString strString;
|
|
|
|
|
|
if (modelName == tr("ȫ<EFBFBD><EFBFBD>"))
|
|
|
|
|
|
strString = QString("select * from wftable where time >'%1' and time <'%2'").arg(m_strLast).arg(m_endLast);
|
|
|
|
|
|
else
|
|
|
|
|
|
strString = QString("select * from wftable where time >'%1' and time <'%2' and model = '%3'").arg(m_strLast).arg(m_endLast).arg(modelName);
|
|
|
|
|
|
return strString;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Q_SLOT void ModeCheckDlg::onHistoryButton()
|
|
|
|
|
|
{
|
|
|
|
|
|
QString strObj = sender()->objectName();
|
|
|
|
|
|
if ("Prev_checkShengchang" == strObj) {
|
|
|
|
|
|
|
|
|
|
|
|
if (m_PrevNum <= 0)
|
|
|
|
|
|
return;
|
|
|
|
|
|
int limitNum = ui.LineNumber_checkShengchang->text().toInt();
|
|
|
|
|
|
if (limitNum <= 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
limitNum = 10;
|
|
|
|
|
|
ui.LineNumber_checkShengchang->setText("10");
|
|
|
|
|
|
}
|
|
|
|
|
|
QString strString = getHistoryCheckString();
|
|
|
|
|
|
m_PrevNum -= limitNum;
|
|
|
|
|
|
if (m_PrevNum <= 0)
|
|
|
|
|
|
m_PrevNum = 0;
|
|
|
|
|
|
strString = strString + QString(" LIMIT %1 OFFSET %2").arg(limitNum).arg(m_PrevNum);
|
|
|
|
|
|
|
|
|
|
|
|
/*<2A><><EFBFBD><EFBFBD><EFBFBD>̲߳<DFB3>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD> <20><><EFBFBD>ٽ<EFBFBD><D9BD>濨<EFBFBD><E6BFA8>*/
|
|
|
|
|
|
CheckThread *workerThread = new CheckThread(this);
|
|
|
|
|
|
workerThread->setCheckStr(m_pDb, strString);
|
|
|
|
|
|
connect(workerThread, SIGNAL(resultReady(QSqlQuery)), this, SLOT(onUpdateTableViewShow(QSqlQuery)));
|
|
|
|
|
|
connect(workerThread, &CheckThread::finished, workerThread, &QObject::deleteLater);
|
|
|
|
|
|
workerThread->start();
|
|
|
|
|
|
|
|
|
|
|
|
m_totalPage = (m_totlaNum / limitNum);
|
|
|
|
|
|
m_page = ((m_PrevNum) / limitNum) + 1;
|
|
|
|
|
|
ui.showPage_Label_Checkdata->setText(tr("<EFBFBD><EFBFBD>%1ҳ <20><>%2ҳ").arg(m_page).arg(m_totalPage + 1));
|
|
|
|
|
|
if (m_PrevNum <= 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_PrevNum = 0;
|
|
|
|
|
|
ui.Prev_checkShengchang->setDisabled(true);
|
|
|
|
|
|
}
|
|
|
|
|
|
ui.Next_checkShengchang->setDisabled(false);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if ("Next_checkShengchang" == strObj) {
|
|
|
|
|
|
if (m_PrevNum >= m_totlaNum)
|
|
|
|
|
|
return;
|
|
|
|
|
|
int limitNum = ui.LineNumber_checkShengchang->text().toInt();
|
|
|
|
|
|
if (limitNum <= 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
limitNum = 10;
|
|
|
|
|
|
ui.LineNumber_checkShengchang->setText("10");
|
|
|
|
|
|
}
|
|
|
|
|
|
m_PrevNum += limitNum;
|
|
|
|
|
|
if (m_PrevNum >= m_totlaNum)
|
|
|
|
|
|
m_PrevNum = m_totlaNum - limitNum;
|
|
|
|
|
|
QString strString = getHistoryCheckString();
|
|
|
|
|
|
strString = strString + QString(" LIMIT %1 OFFSET %2").arg(limitNum).arg(m_PrevNum);
|
|
|
|
|
|
|
|
|
|
|
|
/*<2A><><EFBFBD><EFBFBD><EFBFBD>̲߳<DFB3>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD> <20><><EFBFBD>ٽ<EFBFBD><D9BD>濨<EFBFBD><E6BFA8>*/
|
|
|
|
|
|
CheckThread *workerThread = new CheckThread(this);
|
|
|
|
|
|
workerThread->setCheckStr(m_pDb, strString);
|
|
|
|
|
|
connect(workerThread, SIGNAL(resultReady(QSqlQuery)), this, SLOT(onUpdateTableViewShow(QSqlQuery)));
|
|
|
|
|
|
connect(workerThread, &CheckThread::finished, workerThread, &QObject::deleteLater);
|
|
|
|
|
|
workerThread->start();
|
|
|
|
|
|
|
|
|
|
|
|
m_totalPage = (m_totlaNum / limitNum);
|
|
|
|
|
|
m_page = (m_PrevNum + limitNum) / limitNum;
|
|
|
|
|
|
ui.showPage_Label_Checkdata->setText(tr("<EFBFBD><EFBFBD>%1ҳ <20><>%2ҳ").arg(m_page).arg(m_totalPage + 1));
|
|
|
|
|
|
if ((m_PrevNum + limitNum) >= m_totlaNum)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_PrevNum = m_totlaNum;
|
|
|
|
|
|
ui.Next_checkShengchang->setDisabled(true);
|
|
|
|
|
|
}
|
|
|
|
|
|
ui.Prev_checkShengchang->setDisabled(false);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ModeCheckDlg::cleanHistorycal()
|
|
|
|
|
|
{
|
|
|
|
|
|
m_PrevNum = 0;
|
|
|
|
|
|
m_NextNum = 0;
|
|
|
|
|
|
m_totlaNum = 0;
|
|
|
|
|
|
m_page = 0;
|
|
|
|
|
|
m_totalPage = 0;
|
|
|
|
|
|
|
|
|
|
|
|
m_PrevNumlog = 0;
|
|
|
|
|
|
m_NextNumlog = 0;
|
|
|
|
|
|
m_totlaNumlog = 0;
|
|
|
|
|
|
m_pagelog = 0;
|
|
|
|
|
|
m_totalPagelog = 0;
|
|
|
|
|
|
|
|
|
|
|
|
ui.showNum_Label_Checkdata->setText(tr("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ%1<><31><EFBFBD><EFBFBD>¼").arg(0));
|
|
|
|
|
|
ui.showPage_Label_Checkdata->setText(tr("<EFBFBD><EFBFBD>%1ҳ <20><>%2ҳ").arg(0).arg(0));
|
|
|
|
|
|
ui.Prev_checkShengchang->setDisabled(true);
|
|
|
|
|
|
ui.Next_checkShengchang->setDisabled(true);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Q_SLOT void ModeCheckDlg::handleResultsHistory(QVariantMap Mapstr, QSqlQuery sql)
|
|
|
|
|
|
{
|
|
|
|
|
|
updateModelShowHistory(sql);
|
|
|
|
|
|
QString m_strLast = ui.label_Time1_History->text();
|
|
|
|
|
|
QString m_endLast = ui.label_Time2_History->text();
|
|
|
|
|
|
m_totlaNum = Mapstr.value("sum").toInt();
|
|
|
|
|
|
int nlimit = Mapstr.value("limit").toInt();
|
|
|
|
|
|
int nIndex = Mapstr.value("nIndex").toInt();
|
|
|
|
|
|
QString m_Title = tr("<EFBFBD><EFBFBD>ʼʱ<EFBFBD><EFBFBD>:%1 <20><> <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>:%2 <20><><EFBFBD><EFBFBD>ʷ<EFBFBD><CAB7>¼ <20><>%3<><33>").arg(m_strLast).arg(m_endLast).arg(m_totlaNum);
|
|
|
|
|
|
ui.label_Number->setText(QString::number(m_totlaNum));
|
|
|
|
|
|
QFont font;
|
|
|
|
|
|
font.setPixelSize(14);
|
|
|
|
|
|
font.setBold(true);
|
|
|
|
|
|
ui.label_Tab2_Title->setFont(font);
|
|
|
|
|
|
ui.label_Tab2_Title->setText(m_Title);
|
|
|
|
|
|
ui.Next_checkShengchang->setDisabled(false);
|
|
|
|
|
|
m_totalPage = (m_totlaNum / nlimit);
|
|
|
|
|
|
if (m_totlaNum > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_totalPage = m_totalPage + 1;
|
|
|
|
|
|
m_page = 1;
|
|
|
|
|
|
nIndex = m_totlaNum;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
m_totlaNum = 0;
|
|
|
|
|
|
m_page = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
ui.showPage_Label_Checkdata->setText(tr("<EFBFBD><EFBFBD>%1ҳ <20><>%2ҳ").arg(m_page).arg(m_totalPage));
|
|
|
|
|
|
ui.showNum_Label_Checkdata->setText(tr("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ%1<><31><EFBFBD><EFBFBD>¼").arg(nIndex));
|
|
|
|
|
|
//onShowMessage(tr("<22><><EFBFBD>ݲ<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD>"));
|
|
|
|
|
|
}
|
|
|
|
|
|
void ModeCheckDlg::updateModelShowHistory(QSqlQuery &sql)
|
|
|
|
|
|
{
|
|
|
|
|
|
QStandardItemModel *testmodel = new QStandardItemModel;
|
|
|
|
|
|
ui.tableView_checkShengchang->setModel(testmodel);//<2F>Ƚ<EFBFBD>ģ<EFBFBD>Ͳ<EFBFBD><CDB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
|
|
|
|
|
ui.tableView_checkShengchang->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
|
|
|
|
|
ui.tableView_checkShengchang->setSelectionBehavior(QAbstractItemView::SelectRows);
|
|
|
|
|
|
ui.tableView_checkShengchang->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);//<2F><><EFBFBD><EFBFBD>Ӧ<EFBFBD>п<EFBFBD>
|
|
|
|
|
|
ui.tableView_checkShengchang->horizontalHeader()->setMaximumHeight(100);
|
|
|
|
|
|
|
|
|
|
|
|
if (m_tableModel == NULL)
|
|
|
|
|
|
m_tableModel = new QStandardItemModel;
|
|
|
|
|
|
m_tableModel->clear();
|
|
|
|
|
|
ui.CheckDlg_label_Pic->clear();
|
|
|
|
|
|
m_tableModel->setHorizontalHeaderItem(0, new QStandardItem(tr("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>")));
|
|
|
|
|
|
m_tableModel->setHorizontalHeaderItem(1, new QStandardItem(tr("ƥ<EFBFBD><EFBFBD><EFBFBD>ͺ<EFBFBD>")));
|
|
|
|
|
|
m_tableModel->setHorizontalHeaderItem(2, new QStandardItem(tr("<EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD>")));
|
|
|
|
|
|
m_tableModel->setHorizontalHeaderItem(3, new QStandardItem(tr("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>s")));
|
|
|
|
|
|
m_tableModel->setHorizontalHeaderItem(4, new QStandardItem(tr("ֱ<EFBFBD><EFBFBD>mm")));
|
|
|
|
|
|
m_tableModel->setHorizontalHeaderItem(5, new QStandardItem(tr("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>mm")));
|
|
|
|
|
|
m_tableModel->setHorizontalHeaderItem(6, new QStandardItem(tr("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ")));
|
|
|
|
|
|
m_tableModel->setHorizontalHeaderItem(7, new QStandardItem(tr("uid")));
|
|
|
|
|
|
int nIndex = 0;
|
|
|
|
|
|
|
|
|
|
|
|
while (sql.next())
|
|
|
|
|
|
{
|
|
|
|
|
|
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͳ<EFBFBD>Ʋ<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>Ӧ<EFBFBD>IJ<EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>*/
|
|
|
|
|
|
int uid = sql.value("uid").toInt();
|
|
|
|
|
|
QString time = sql.value("time").toString();
|
|
|
|
|
|
QString model = sql.value("model").toString();
|
|
|
|
|
|
double dCorrelate = sql.value("correlate").toDouble();
|
|
|
|
|
|
QString correlate;
|
|
|
|
|
|
if (dCorrelate >= 1.7976931348623158e+308)
|
|
|
|
|
|
dCorrelate = 0;
|
|
|
|
|
|
correlate = QString::number(dCorrelate * 100, 'f', 3) + "%";
|
|
|
|
|
|
double dDetecttime = sql.value("detecttime").toDouble();
|
|
|
|
|
|
QString detecttime = QString::number(dDetecttime, 'f', 3);
|
|
|
|
|
|
double dDiameter = sql.value("diameter").toDouble();
|
|
|
|
|
|
QString diameter = QString::number(dDiameter, 'f', 3);
|
|
|
|
|
|
double dHight = sql.value("hight").toDouble();
|
|
|
|
|
|
QString hight = QString::number(dHight, 'f', 3);
|
|
|
|
|
|
QByteArray pic = sql.value("pic").toByteArray();
|
|
|
|
|
|
QImage img = QImage::fromData(pic);
|
|
|
|
|
|
QSize s = img.size();
|
|
|
|
|
|
QPixmap m_Pix = QPixmap::fromImage(img);
|
|
|
|
|
|
ui.CheckDlg_label_Pic->setPixmap(m_Pix.scaled(WHEEL_PIC_SIZE, WHEEL_PIC_SIZE));
|
|
|
|
|
|
m_tableModel->setItem(nIndex, 0, new QStandardItem(time));
|
|
|
|
|
|
m_tableModel->setItem(nIndex, 1, new QStandardItem(model));
|
|
|
|
|
|
m_tableModel->setItem(nIndex, 2, new QStandardItem(correlate));
|
|
|
|
|
|
m_tableModel->setItem(nIndex, 3, new QStandardItem(detecttime));
|
|
|
|
|
|
m_tableModel->setItem(nIndex, 4, new QStandardItem(diameter));
|
|
|
|
|
|
m_tableModel->setItem(nIndex, 5, new QStandardItem(hight));
|
|
|
|
|
|
m_tableModel->setItem(nIndex, 6, new QStandardItem(QIcon(m_Pix.scaled(50, 50)), ""));
|
|
|
|
|
|
m_tableModel->setItem(nIndex, 7, new QStandardItem(QString("%1").arg(uid)));
|
|
|
|
|
|
nIndex++;
|
|
|
|
|
|
}
|
|
|
|
|
|
ui.showNum_Label_Checkdata->setText(tr("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ%1<><31><EFBFBD><EFBFBD>¼").arg(nIndex));
|
|
|
|
|
|
ui.tableView_checkShengchang->setModel(m_tableModel);
|
|
|
|
|
|
ui.tableView_checkShengchang->hideColumn(7);
|
|
|
|
|
|
ui.tableView_checkShengchang->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
|
|
|
|
|
connect(ui.tableView_checkShengchang, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(onTableViewClick(QModelIndex)));
|
|
|
|
|
|
delete testmodel;
|
|
|
|
|
|
testmodel = NULL;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ModeCheckDlg::SetModelNames(QStringList models)
|
|
|
|
|
|
{
|
|
|
|
|
|
ui.comboBox_Model->clear();
|
|
|
|
|
|
ui.comboBox_Model->addItem(tr("ȫ<EFBFBD><EFBFBD>"));
|
|
|
|
|
|
if (!models.contains("NG"))
|
|
|
|
|
|
ui.comboBox_Model->addItem(tr("NG"));
|
|
|
|
|
|
ui.comboBox_Model->addItems(models);
|
|
|
|
|
|
if (_pCompleter)
|
|
|
|
|
|
delete _pCompleter;
|
|
|
|
|
|
_pCompleter = new QCompleter(models);
|
|
|
|
|
|
_pCompleter->setCaseSensitivity(Qt::CaseInsensitive);
|
|
|
|
|
|
ui.comboBox_Model->setCompleter(_pCompleter);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Q_SLOT void ModeCheckDlg::onTableViewClick(QModelIndex mIndex)
|
|
|
|
|
|
{
|
|
|
|
|
|
QString strObj = sender()->objectName();
|
|
|
|
|
|
if ("tableView_checkShengchang" == strObj) {
|
|
|
|
|
|
if (m_tableModel)
|
|
|
|
|
|
{
|
|
|
|
|
|
QModelIndex ItemIndex = m_tableModel->index(mIndex.row(), 7);
|
|
|
|
|
|
QString strdata = ItemIndex.data().toString();
|
|
|
|
|
|
if (m_pDb)
|
|
|
|
|
|
{
|
|
|
|
|
|
QVariantMap m_value;
|
|
|
|
|
|
m_value.insert(_CHECK_UID_, strdata);
|
|
|
|
|
|
m_value.insert(_CHECK_TYPE_, EMT_CHECK_BY_UID);
|
|
|
|
|
|
QString seletcStr = m_pDb->genCheckStr(m_value);
|
|
|
|
|
|
|
|
|
|
|
|
/*<2A><><EFBFBD><EFBFBD><EFBFBD>̲߳<DFB3>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD> <20><><EFBFBD>ٽ<EFBFBD><D9BD>濨<EFBFBD><E6BFA8>*/
|
|
|
|
|
|
CheckThread *workerThread = new CheckThread(this);
|
|
|
|
|
|
workerThread->setCheckStr(m_pDb, seletcStr);
|
|
|
|
|
|
connect(workerThread, SIGNAL(resultReady(QSqlQuery)), this, SLOT(onSlowPixmap(QSqlQuery)));
|
|
|
|
|
|
connect(workerThread, &CheckThread::finished, workerThread, &QObject::deleteLater);
|
|
|
|
|
|
workerThread->start();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Q_SLOT void ModeCheckDlg::onSlowPixmap(QSqlQuery sql)
|
|
|
|
|
|
{
|
|
|
|
|
|
static bool nFlag = false;
|
|
|
|
|
|
if (nFlag == true)
|
|
|
|
|
|
return;
|
|
|
|
|
|
nFlag = true;
|
|
|
|
|
|
|
|
|
|
|
|
sql.next();
|
|
|
|
|
|
double dHight = sql.value("hight").toDouble();
|
|
|
|
|
|
QByteArray pic = sql.value("pic").toByteArray();
|
|
|
|
|
|
QImage img = QImage::fromData(pic);
|
|
|
|
|
|
QSize s = img.size();
|
|
|
|
|
|
QPixmap m_Pix = QPixmap::fromImage(img);
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
int dhight = m_Pix.height();
|
|
|
|
|
|
int dwidth = m_Pix.width();
|
|
|
|
|
|
double nRate = m_Pix.width()*1.0 / m_Pix.height();
|
|
|
|
|
|
int scarew = 150;
|
|
|
|
|
|
int scareh = 150 * 1.0 / nRate;
|
|
|
|
|
|
|
|
|
|
|
|
if (scareh > 150)
|
|
|
|
|
|
{
|
|
|
|
|
|
scarew = 150;
|
|
|
|
|
|
scareh = 150 * 1.0 / nRate;
|
|
|
|
|
|
}
|
|
|
|
|
|
ui.CheckDlg_label_Pic->setPixmap(m_Pix.scaled(scarew, scareh));
|
|
|
|
|
|
}
|
|
|
|
|
|
nFlag = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ModeCheckDlg::CheckDataHistoryByDate(QString m_strLast, QString m_endLast, QString modelname)
|
|
|
|
|
|
{
|
|
|
|
|
|
QSqlQuery sql;
|
|
|
|
|
|
QVariantMap m_Value;
|
|
|
|
|
|
m_Value.insert(_CHECK_TYPE_, EMT_CHECK_BY_NAME);
|
|
|
|
|
|
m_Value.insert(_CHECK_TIME1_, m_strLast);
|
|
|
|
|
|
m_Value.insert(_CHECK_TIME2_, m_endLast);
|
|
|
|
|
|
m_Value.insert(_CHECK_NAME_, modelname);
|
|
|
|
|
|
m_Value.insert(_CHECK_COUNT_, 1);
|
|
|
|
|
|
if (modelname == "*")
|
|
|
|
|
|
m_Value.insert(_CHECK_TYPE_, EMT_CHECK_BY_SAE);
|
|
|
|
|
|
else
|
|
|
|
|
|
m_Value.insert(_CHECK_TYPE_, EMT_CHECK_BY_NAME);
|
|
|
|
|
|
QString strString;
|
|
|
|
|
|
strString = m_pDb->genCheckStr(m_Value);
|
|
|
|
|
|
int nlimit = ui.LineNumber_checkShengchang->text().toInt();
|
|
|
|
|
|
if (nlimit <= 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
nlimit = 10;
|
|
|
|
|
|
ui.LineNumber_checkShengchang->setText("10");
|
|
|
|
|
|
}
|
|
|
|
|
|
m_totlaNum = 0;
|
|
|
|
|
|
m_PrevNum = 0;
|
|
|
|
|
|
QString strStringcheck;
|
|
|
|
|
|
if (modelname == "*")
|
|
|
|
|
|
strStringcheck = QString("select * from wftable where time >'%1' and time <'%2' LIMIT %4 OFFSET %5").arg(m_strLast).arg(m_endLast).arg(nlimit).arg(m_PrevNum);
|
|
|
|
|
|
else
|
|
|
|
|
|
strStringcheck = QString("select * from wftable where time >'%1' and time <'%2' and model = '%3' LIMIT %4 OFFSET %5").arg(m_strLast).arg(m_endLast).arg(modelname).arg(nlimit).arg(m_PrevNum);
|
|
|
|
|
|
QVariantMap m_mapVarite;
|
|
|
|
|
|
m_mapVarite.insert("SqlCount", strString);
|
|
|
|
|
|
m_mapVarite.insert("SqlCheck", strStringcheck);
|
|
|
|
|
|
m_mapVarite.insert("limit", nlimit);
|
|
|
|
|
|
emit operateHistory(m_mapVarite);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Q_SLOT void ModeCheckDlg::onProgressForTsk(QVariantMap m_map)
|
|
|
|
|
|
{
|
|
|
|
|
|
QString nType = m_map.value("Type").toString();
|
|
|
|
|
|
if (nType == "start")
|
|
|
|
|
|
{
|
|
|
|
|
|
QString strMsg = m_map.value("msg", tr("<EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>")).toString();
|
|
|
|
|
|
m_Progressdlg.setWindowTitle(strMsg);
|
|
|
|
|
|
m_Progressdlg.Start(50, 150),
|
|
|
|
|
|
m_Progressdlg.show();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
m_Progressdlg.Stop();
|
|
|
|
|
|
m_Progressdlg.hide();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Q_SLOT void ModeCheckDlg::SlotEditTime()
|
|
|
|
|
|
{
|
|
|
|
|
|
QObject *obj = sender();
|
|
|
|
|
|
QString str = obj->objectName();
|
|
|
|
|
|
if (str == "pushButton_Set1_History")
|
|
|
|
|
|
{
|
|
|
|
|
|
QTimeDlg dlg(NULL);
|
|
|
|
|
|
dlg.SetDateTime(m_startDate_History);
|
|
|
|
|
|
if (dlg.exec() == QDialog::Accepted)
|
|
|
|
|
|
{
|
|
|
|
|
|
dlg.GetDateTime(m_startDate_History);
|
|
|
|
|
|
QString m_endLast = m_startDate_History.toString("yyyy-MM-dd hh:mm:ss");
|
|
|
|
|
|
ui.label_Time1_History->setText(m_endLast);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (str == "pushButton_Set2_History")
|
|
|
|
|
|
{
|
|
|
|
|
|
QTimeDlg dlg;
|
|
|
|
|
|
dlg.SetDateTime(m_endDate_History);
|
|
|
|
|
|
if (dlg.exec() == QDialog::Accepted)
|
|
|
|
|
|
{
|
|
|
|
|
|
dlg.GetDateTime(m_endDate_History);
|
|
|
|
|
|
QString m_endLast = m_endDate_History.toString("yyyy-MM-dd hh:mm:ss");
|
|
|
|
|
|
ui.label_Time2_History->setText(m_endLast);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Q_SLOT void ModeCheckDlg::onCheckButton()
|
|
|
|
|
|
{
|
|
|
|
|
|
QObject *obj = sender();
|
|
|
|
|
|
QString str = obj->objectName();
|
|
|
|
|
|
if ("pushButton_Checkdata" == str)//<2F><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
{/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>ݷ<EFBFBD>ҳ<EFBFBD><D2B3>ʾ <20><><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>й¶*/
|
|
|
|
|
|
static bool checkflags = false;
|
|
|
|
|
|
if (checkflags == false)
|
|
|
|
|
|
{
|
|
|
|
|
|
checkflags = true;
|
|
|
|
|
|
QString strBanci = ui.comboBox_Banci->currentText();
|
|
|
|
|
|
QString modelName = ui.comboBox_Model->currentText();
|
|
|
|
|
|
if (m_Totaltime.contains(strBanci))
|
|
|
|
|
|
{
|
|
|
|
|
|
if (m_startDate_History.date() > m_endDate_History.date())
|
|
|
|
|
|
{
|
|
|
|
|
|
if (m_Totaltime.value(strBanci).m_startTime > m_Totaltime.value(strBanci).m_endTime)
|
|
|
|
|
|
{
|
|
|
|
|
|
onMessageBox(QMessageBox::Information, tr("<EFBFBD><EFBFBD>ʾ"), tr("<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD>İ<EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD>Ǹ<EFBFBD>ҹ<EFBFBD>ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD>һ<EFBFBD>µ<EFBFBD>ǰ<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><EFBFBD>ٲ<EFBFBD>ѯ"));
|
|
|
|
|
|
checkflags = false;
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
onMessageBox(QMessageBox::Information, tr("<EFBFBD><EFBFBD>ʾ"), tr("<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD>һ<EFBFBD>µ<EFBFBD>ǰ<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><EFBFBD>ٲ<EFBFBD>ѯ"));
|
|
|
|
|
|
checkflags = false;
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
if (m_startDate_History.date() > m_endDate_History.date())
|
|
|
|
|
|
{
|
|
|
|
|
|
onMessageBox(QMessageBox::Information, tr("<EFBFBD><EFBFBD>ʾ"), tr("<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD>һ<EFBFBD>µ<EFBFBD>ǰ<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><EFBFBD>ٲ<EFBFBD>ѯ"));
|
|
|
|
|
|
checkflags = false;
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QString m_strLast = ui.label_Time1_History->text();
|
|
|
|
|
|
QString m_endLast = ui.label_Time2_History->text();
|
|
|
|
|
|
//QString strMsg = tr("<22><>ѯ<EFBFBD><D1AF>%1-%2<><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>").arg(m_strLast).arg(m_endLast);
|
|
|
|
|
|
//SaveLog(strMsg);
|
|
|
|
|
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
|
|
|
|
|
QFont font;
|
|
|
|
|
|
font.setPixelSize(14);
|
|
|
|
|
|
ui.label_Tab2_Title->setFont(font);
|
|
|
|
|
|
QString m_Title = tr("<EFBFBD><EFBFBD>ʼʱ<EFBFBD><EFBFBD>:%1 <20><> <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>:%2 <20><><EFBFBD><EFBFBD>ʷ<EFBFBD><CAB7>¼").arg(m_strLast).arg(m_endLast);
|
|
|
|
|
|
ui.label_Tab2_Title->setText(m_Title);
|
|
|
|
|
|
if (modelName == tr("ȫ<EFBFBD><EFBFBD>"))
|
|
|
|
|
|
CheckDataHistoryByDate(m_strLast, m_endLast, "*");
|
|
|
|
|
|
else
|
|
|
|
|
|
CheckDataHistoryByDate(m_strLast, m_endLast, modelName);
|
|
|
|
|
|
QApplication::restoreOverrideCursor();
|
|
|
|
|
|
checkflags = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
onMessageBox(QMessageBox::Information, tr("<EFBFBD><EFBFBD>ʾ"), tr("<EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ժ<EFBFBD>"));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else if ("pushButton_SaveHistory" == str)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (m_tableModel == NULL)
|
|
|
|
|
|
return;
|
|
|
|
|
|
if (m_tableModel->rowCount() <= 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
onMessageBox(QMessageBox::Warning, tr("<EFBFBD><EFBFBD>ʾ"), tr("û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>²<EFBFBD>ѯ"));
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QString filename = QString("History_%1.csv").arg(QDateTime::currentDateTime().toString("yyyy_MM_dd"));
|
|
|
|
|
|
QString fileTitle = tr("<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD>");
|
|
|
|
|
|
QFileDialog *fileDialog = new QFileDialog(NULL, fileTitle, filename);
|
|
|
|
|
|
fileDialog->setWindowTitle("Save As");
|
|
|
|
|
|
fileDialog->setAcceptMode(QFileDialog::AcceptSave);
|
|
|
|
|
|
fileDialog->setFileMode(QFileDialog::AnyFile);
|
|
|
|
|
|
fileDialog->setViewMode(QFileDialog::Detail);
|
|
|
|
|
|
fileDialog->setGeometry(10, 30, 300, 200);
|
|
|
|
|
|
fileDialog->setDirectory(".");
|
|
|
|
|
|
fileDialog->setNameFilter("Execl(*.csv)");
|
|
|
|
|
|
|
|
|
|
|
|
if (fileDialog->exec() == QDialog::Accepted)
|
|
|
|
|
|
{
|
|
|
|
|
|
QString path = fileDialog->selectedFiles()[0];
|
|
|
|
|
|
|
|
|
|
|
|
QString strString = getHistoryCheckString();
|
|
|
|
|
|
QSaveCSVThread *workerThread = new QSaveCSVThread(this);
|
|
|
|
|
|
workerThread->setInform(ui.label_Tab2_Title->text(), "username");
|
|
|
|
|
|
workerThread->setCheckStr(m_pDb, strString, path, 0);
|
|
|
|
|
|
connect(workerThread, SIGNAL(resultReady(int)), this, SLOT(onSaveCSVDone(int)));
|
|
|
|
|
|
connect(workerThread, &QSaveCSVThread::finished, workerThread, &QObject::deleteLater);
|
|
|
|
|
|
workerThread->start();
|
|
|
|
|
|
|
|
|
|
|
|
onEventLoop(tr("<EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ե<EFBFBD>"));
|
|
|
|
|
|
|
|
|
|
|
|
//QString strMsg = tr("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%1-%2<><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>").arg(ui.label_Time1_History->text()).arg(ui.label_Time2_History->text());
|
|
|
|
|
|
//SaveLog(strMsg);
|
|
|
|
|
|
onMessageBox(QMessageBox::Information, tr("<EFBFBD><EFBFBD>ʾ"), tr("<EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
|
|
|
|
|
}
|
|
|
|
|
|
if (fileDialog) {
|
|
|
|
|
|
delete fileDialog;
|
|
|
|
|
|
fileDialog = NULL;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool ModeCheckDlg::onMessageBox(QMessageBox::Icon ntype, QString strTitle, QString strAtl, int onlyOK)
|
|
|
|
|
|
{
|
|
|
|
|
|
QMessageBox::StandardButton button = QMessageBox::Ok;
|
|
|
|
|
|
|
|
|
|
|
|
if (onlyOK == 1)
|
|
|
|
|
|
button = QMessageBox::Cancel;
|
|
|
|
|
|
QMessageBox infobox(ntype, strTitle, strAtl, QMessageBox::Ok | button, NULL);
|
|
|
|
|
|
infobox.setWindowIcon(QIcon(":/image/leaper"));
|
|
|
|
|
|
infobox.setButtonText(QMessageBox::Ok, tr("ȷ<EFBFBD><EFBFBD>"));
|
|
|
|
|
|
infobox.setButtonText(QMessageBox::Cancel, tr("ȡ<EFBFBD><EFBFBD>"));
|
|
|
|
|
|
return (infobox.exec() == QMessageBox::Ok);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool ModeCheckDlg::SaveDataToCSV(QString filePath, QMap<QString, int> &m_mapTable)
|
|
|
|
|
|
{
|
|
|
|
|
|
QFile file(filePath);
|
|
|
|
|
|
if (!file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append))// <><D7B7>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
return false;
|
|
|
|
|
|
QTextStream out(&file);
|
|
|
|
|
|
QString tableData;
|
|
|
|
|
|
QString m_startStr = m_startDate_Count.toString("yyyy-MM-dd ") + m_startTime.toString("hh:mm:ss");
|
|
|
|
|
|
QString m_endStr = m_endDate_Count.toString("yyyy-MM-dd ") + m_endTime.toString("hh:mm:ss");
|
|
|
|
|
|
out << tr("<EFBFBD><EFBFBD>%1<><31>%2ͳ<32>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>").arg(m_startStr).arg(m_endStr) << "\n";
|
|
|
|
|
|
out << tr("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>") << "," << tr("<EFBFBD>ͺ<EFBFBD>") << "," << tr("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>") << "\n";
|
|
|
|
|
|
int index = 1;
|
|
|
|
|
|
int sum = 0;
|
|
|
|
|
|
for (QMap<QString, int>::iterator its = m_mapTable.begin(); its != m_mapTable.end(); ++its)
|
|
|
|
|
|
{
|
|
|
|
|
|
out << (index++) << ",";
|
|
|
|
|
|
tableData = its.key();
|
|
|
|
|
|
out << tableData << ",";
|
|
|
|
|
|
out << QString::number(m_mapTable[tableData]) << ",";
|
|
|
|
|
|
sum += m_mapTable[tableData];
|
|
|
|
|
|
out << "\n";
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!m_mapTable.contains(QString("NG")))
|
|
|
|
|
|
{
|
|
|
|
|
|
out << (index++) << "," << QString("NG") << "," << 0 << "\n";
|
|
|
|
|
|
}
|
|
|
|
|
|
out << (index++) << "," << tr("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>") << "," << QString::number(sum) << "\n";
|
|
|
|
|
|
out << tr("ʱ<EFBFBD><EFBFBD>:") << "," << QDateTime::currentDateTime().toString("yyyy-MM-dd") << "," << QDateTime::currentDateTime().toString("hh:mm:ss") << "\n";
|
|
|
|
|
|
out << tr("<EFBFBD>û<EFBFBD>:") << "," << "username" << "," << "\n";
|
|
|
|
|
|
file.close();
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ModeCheckDlg::onEventLoop(QString strMsg)
|
|
|
|
|
|
{
|
|
|
|
|
|
WaitingDialog dlg;
|
|
|
|
|
|
dlg.setWindowModality(Qt::ApplicationModal);
|
|
|
|
|
|
dlg.setWindowIcon(QIcon(":/image/leaper"));
|
|
|
|
|
|
dlg.setWindowTitle(strMsg);
|
|
|
|
|
|
dlg.Start(50, 150),
|
|
|
|
|
|
dlg.show();
|
|
|
|
|
|
QEventLoop eventloop;
|
|
|
|
|
|
connect(this, SIGNAL(sgFinish()), &eventloop, SLOT(quit()));
|
|
|
|
|
|
eventloop.exec();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Q_SLOT void ModeCheckDlg::SlotCombox(int index)
|
|
|
|
|
|
{
|
|
|
|
|
|
QObject *strobj = sender();
|
|
|
|
|
|
QString objname = strobj->objectName();
|
|
|
|
|
|
if ("comboBox_Banci" == objname)
|
|
|
|
|
|
{
|
|
|
|
|
|
QString str = ui.comboBox_Banci->currentText();
|
|
|
|
|
|
|
|
|
|
|
|
if (m_Totaltime.contains(str))
|
|
|
|
|
|
{
|
|
|
|
|
|
if (m_Totaltime.value(str).m_startTime >= m_Totaltime.value(str).m_endTime)
|
|
|
|
|
|
{
|
|
|
|
|
|
QDate m = m_endDate_History.date();
|
|
|
|
|
|
m = m.addDays(-1);
|
|
|
|
|
|
QString strdata = m.toString("yyyy-MM-dd");
|
|
|
|
|
|
m_startDate_History.setDate(m);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
m_startDate_History.setDate(m_endDate_History.date());
|
|
|
|
|
|
}
|
|
|
|
|
|
if (m_startDate_History.date() > m_endDate_History.date())
|
|
|
|
|
|
m_startDate_History.setDate(m_endDate_History.date());
|
|
|
|
|
|
m_startDate_History.setTime(m_Totaltime.value(str).m_startTime);//
|
|
|
|
|
|
m_endDate_History.setTime(m_Totaltime.value(str).m_endTime);//
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
if (str == tr("ȫ<EFBFBD><EFBFBD>"))
|
|
|
|
|
|
{
|
|
|
|
|
|
QString strTime = nstartTime.toString("hh:mm:ss");
|
|
|
|
|
|
if (m_startDate_History.date() > m_endDate_History.date())
|
|
|
|
|
|
m_startDate_History.setDate(m_endDate_History.date());
|
|
|
|
|
|
m_startDate_History.setTime(m_startTime);
|
|
|
|
|
|
m_endDate_History.setTime(nEndTime);
|
|
|
|
|
|
QString strStart = m_startDate_History.toString("yyyy-MM-dd hh:mm:ss");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
ui.label_Time1_History->setText(m_startDate_History.toString("yyyy-MM-dd hh:mm:ss"));
|
|
|
|
|
|
ui.label_Time2_History->setText(m_endDate_History.toString("yyyy-MM-dd hh:mm:ss"));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Q_SLOT void ModeCheckDlg::onUpdateTableViewShow(QSqlQuery sql)
|
|
|
|
|
|
{
|
|
|
|
|
|
updateModelShowHistory(sql);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Q_SLOT void ModeCheckDlg::onSaveCSVDone(int)
|
|
|
|
|
|
{
|
|
|
|
|
|
emit(sgFinish());
|
|
|
|
|
|
}
|