parent
23c75b57de
commit
27d0b77cba
|
@ -15,7 +15,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
this->statusBar = new QStatusBar();
|
||||
this->statusInfo = new QLabel("初始化完成",this);
|
||||
this->statusBar->addPermanentWidget(this->statusInfo);//显示正常信息
|
||||
QLabel* statusVersion = new QLabel("开启时间:" + QDateTime::currentDateTime().toString("yy.MM.dd.hh.mm"),this);
|
||||
QLabel* statusVersion = new QLabel("开启时间:" + QDateTime::currentDateTime().toString("yy-MM-dd hh:mm"),this);
|
||||
this->statusBar->addWidget(statusVersion);
|
||||
|
||||
layout()->addWidget(this->statusBar);
|
||||
|
@ -142,7 +142,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
}
|
||||
});
|
||||
connect(this->tcpClient, &TcpClient::getDirectionSignals, this, [=](int direction) {
|
||||
if (this->iDirection != direction)
|
||||
if (this->iDirection == 0)
|
||||
{
|
||||
this->logInfo("获得方向判定:" + QString(direction > -1 ? (direction > 0 ? "需识别" : "待定") : "无需上传"));
|
||||
this->iDirection = direction;
|
||||
|
@ -598,17 +598,17 @@ void MainWindow::getQueueDataThread()
|
|||
if (i.size() == 26 || i.size() == 24)
|
||||
{
|
||||
// 车厢信息
|
||||
QString strTrainInfo = i.left(14);
|
||||
QString strTrainInfo = i.mid(1,13);
|
||||
|
||||
if (vecTrain.empty() || !vecTrain.contains(strTrainInfo))
|
||||
{
|
||||
bool isNoCarriage = false;
|
||||
int carT = strTrainInfo.mid(3, 2).simplified().toInt(&isNoCarriage);
|
||||
if (isNoCarriage && carT >= 10) continue;
|
||||
// 因信号不稳定 增加一行过滤 出现文字中带有字母及数字以外的字符时,过滤
|
||||
if (!strTrainInfo.contains(QRegExp("^[A-Z0-9\\s]+$"))) continue;
|
||||
// 因信号不稳定 增加一行过滤 出现读到的数据里 空格替代了实际字符的情况
|
||||
if (strTrainInfo.mid(7, 7).simplified().size() < 7) continue;
|
||||
// 判断是否是车头 车头的第14位是 K或H (慎重)
|
||||
if (!i.mid(14, 1).contains(QRegExp("^[0-9]+$"))) continue;
|
||||
// 过滤掉车号中有非数字的
|
||||
if (!strTrainInfo.right(7).contains(QRegExp("^[0-9]+$"))) continue;
|
||||
// 因信号不稳定 增加一行过滤 出现读到的编号数据里 空格替代了实际字符的情况
|
||||
if (strTrainInfo.right(7).simplified().size() < 7) continue;
|
||||
|
||||
vecTrain.append(strTrainInfo);
|
||||
int train_order = vecTrain.size();
|
||||
this->resultTableModel_->setItem(train_order - 1, 0, new QStandardItem(strTrainInfo));
|
||||
|
@ -666,7 +666,13 @@ void MainWindow::upRfid(QString rfidInfo)
|
|||
QString info = this->vecTrain.back();
|
||||
int order = this->vecTrain.size();
|
||||
|
||||
info = info.mid(1,info.size() - 1);
|
||||
if (order > this->socketServerConfig_.delayed_upload && this->iDirection == 0)
|
||||
{
|
||||
this->iDirection = 1;
|
||||
}
|
||||
if (!this->baseConfig_.useSocketServer) this->iDirection = 1;
|
||||
|
||||
// info = info.mid(1,info.size() - 1);
|
||||
|
||||
TrainInfo trainInfo;
|
||||
trainInfo.carriageType = info.left(6).simplified().toStdString();
|
||||
|
@ -676,7 +682,21 @@ void MainWindow::upRfid(QString rfidInfo)
|
|||
trainInfo.collectTime = QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss.zzz").toStdString();
|
||||
trainInfo.strRfidInfo = rfidInfo.toStdString();
|
||||
|
||||
this->queueTrainInfo_.push(trainInfo);
|
||||
// this->queueTrainInfo_.push(trainInfo);
|
||||
this->queueTmpTrainInfo_.push(trainInfo);
|
||||
|
||||
if (this->iDirection < 0)
|
||||
{
|
||||
this->queueTmpTrainInfo_.clear();
|
||||
return;
|
||||
}
|
||||
if (this->iDirection > 0)
|
||||
{
|
||||
while (!this->queueTmpTrainInfo_.isEmpty())
|
||||
{
|
||||
this->queueTrainInfo_.push(this->queueTmpTrainInfo_.pop());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::IdentifyTypeUpdate() {
|
||||
|
@ -721,7 +741,7 @@ void MainWindow::ErrorSlots(const QString &info) {
|
|||
void MainWindow::readTestInfo()
|
||||
{
|
||||
|
||||
if (this->isOpenCom)
|
||||
if (this->isOpenCom || ui->openComButton->text() == "关闭串口")
|
||||
{
|
||||
logWarn("请先关闭串口后进行测试操作!");
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue