diff --git a/DevOp.cpp b/DevOp.cpp index c1a4f4d..7a128af 100644 --- a/DevOp.cpp +++ b/DevOp.cpp @@ -3632,7 +3632,15 @@ void DevOp::comForRFID_init(void) { // return; comForRFID = new QSerialPort(); + + comForRFID->setPortName("/dev/ttyAS1"); + + // 覆盖默认串口名称,用于x86架构调试 +#ifdef ARCH_X86 + comForRFID->setPortName("/dev/ttyUSB0"); +#endif + comForRFID->setBaudRate(9600); comForRFID->setDataBits(QSerialPort::Data8); comForRFID->setParity(QSerialPort::NoParity); @@ -3642,7 +3650,7 @@ void DevOp::comForRFID_init(void) qDebug() << "RFID串口打开成功"; connect(comForRFID,SIGNAL(readyRead()),this,SLOT(readRFIDData())); } else { - qDebug() << "RFID串口打开失败:" << comForRFID->errorString(); + qDebug() << "RFID串口打开失败: " << comForRFID->errorString(); } } @@ -3656,7 +3664,7 @@ extern void MySleep(unsigned int msec); int DevOp::comReadRFID_data() { UCHAR Cmd[23] = { 0x01, 0x17, 0xA4, 0x20, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - UCHAR revdata[100]; + UCHAR revdata[100] = {0}; Cmd[1] = 0x08; Cmd[2] = 0xA3; Cmd[4] = 0x06; //读块6 @@ -3682,8 +3690,8 @@ int DevOp::comReadRFID_data() RFIDReadData.clear(); LogInfo::setRunStatusText(tr("readB6com")); } - memcpy(revdata, recResponse, n); - if ((revdata[0] = 0x01) && ((revdata[1] == 8) || (revdata[1] == 22)) && (revdata[1] == n) && (revdata[2] == 0xA3) && (revdata[3] = 0x20))//判断是否为读数据块返回的数据包 + memcpy(revdata, recResponse.constData(), n); + if ((revdata[0] == 0x01) && ((revdata[1] == 8) || (revdata[1] == 22)) && (revdata[1] == n) && (revdata[2] == 0xA3) && (revdata[3] == 0x20))//判断是否为读数据块返回的数据包 { LogInfo::setRunStatusText(tr("readB6suc")); bool status = CheckSumIn(revdata, revdata[1]); //计算校验和 @@ -3754,8 +3762,8 @@ int DevOp::comWriteRFID_data(int type) str.sprintf("%d - %d - %d", recResponse.at(0),recResponse.at(1),recResponse.at(2)); qDebug()<<"写数据到数据块6: "< (int)sizeof(revdata)) n = sizeof(revdata); + memcpy(revdata, recResponse.constData(), n); if ((revdata[0] == 0x01) &&( revdata[1] == 8 )&& (revdata[1] == n) && (revdata[2] == 0xA5) && (revdata[3] == 0x20)) //判断是否为设置地址返回的数据包 { bool status = CheckSumIn(revdata, revdata[1]); //计算校验和 @@ -3906,7 +3915,7 @@ int DevOp::setRFIDCarKey(void) int DevOp::setRFIDReaderKey(int mac,int type) { - if(mac == 0) mac = 100; + if(mac == 0) mac = 100; QString strMac1 = QString::number(mac).mid(0,3); strMac1 = "Vernon" + strMac1 + "Bach"; strMac1 = strMac1.leftJustified(16,'6'); @@ -3985,7 +3994,8 @@ int DevOp::setRFIDReaderKey(int mac,int type) str.sprintf("%d - %d - %d", recResponse.at(0),recResponse.at(1),recResponse.at(2)); qDebug()<<"设置读写器密码: "< (int)sizeof(revdata)) n = sizeof(revdata); + memcpy(revdata, recResponse.constData(), n); if ((revdata[0] == 0x03) &&( revdata[1] == 8 )&& (revdata[1] == n) && (revdata[2] == 0xC3) && (revdata[3] == 0x20)) //判断是否为设置地址返回的数据包 { bool status = CheckSumIn(revdata, revdata[1]); //计算校验和 @@ -4010,7 +4020,7 @@ int DevOp::setRFIDReaderKey(int mac,int type) int DevOp::setRFIDReaderOriginalKey(void) { - UCHAR revdata[100]; + UCHAR revdata[100] = {0}; UCHAR Cmd[11] ; Cmd[0] = 0x03; //命令格式请核对协议手册充值章节 Cmd[1] = 0x0B; @@ -4047,7 +4057,8 @@ int DevOp::setRFIDReaderOriginalKey(void) str.sprintf("%d - %d - %d", recResponse.at(0),recResponse.at(1),recResponse.at(2)); qDebug()<<"设置读写器原始密码: "< (int)sizeof(revdata)) n = sizeof(revdata); + memcpy(revdata, recResponse.constData(), n); if ((revdata[0] == 0x03) &&( revdata[1] == 8 )&& (revdata[1] == n) && (revdata[2] == 0xC4) && (revdata[3] == 0x20)) //判断是否为设置地址返回的数据包 { bool status = CheckSumIn(revdata, revdata[1]); //计算校验和 @@ -4071,13 +4082,13 @@ int DevOp::setRFIDReaderOriginalKey(void) int DevOp::setRFIDReaderWorkMode(void) { - UCHAR revdata[100]; + UCHAR revdata[100] = {0}; UCHAR Cmd[8] ; Cmd[0] = 0x03; //命令格式请核对协议手册充值章节 - Cmd[1] = 0x08; + Cmd[1] = 0x08; // 包长度 Cmd[2] = 0xC1; //设置工作模式 - Cmd[3] = 0x20; - Cmd[4] = 0x03; + Cmd[3] = 0x20; // 地址,固定0x20 + Cmd[4] = 0x03; // 自动读块数据 Cmd[5] = 0x06; //读块6 Cmd[6] = 0x00; //主动发送数据 Cmd[7] = 0x00; @@ -4096,7 +4107,7 @@ int DevOp::setRFIDReaderWorkMode(void) qDebug()<<"read uart for RFID not open!"; } //sleep(200); // 延时200毫秒等待读写器返回数据,延时太小可能无法接收完整的数据包 - MySleep(200); + MySleep(500); int n = RFIDReadData.size(); if(n>0) { @@ -4106,7 +4117,8 @@ int DevOp::setRFIDReaderWorkMode(void) str.sprintf("%d - %d - %d", recResponse.at(0),recResponse.at(1),recResponse.at(2)); qDebug()<<"设置读写器工作模式: "< (int)sizeof(revdata)) n = sizeof(revdata); + memcpy(revdata, recResponse.constData(), n); if ((revdata[0] == 0x03) &&( revdata[1] == 8 )&& (revdata[1] == n) && (revdata[2] == 0xC1) && (revdata[3] == 0x20)) //判断是否为设置地址返回的数据包 { bool status = CheckSumIn(revdata, revdata[1]); //计算校验和 @@ -4120,18 +4132,20 @@ int DevOp::setRFIDReaderWorkMode(void) else { qDebug() << "设置读写器工作模式失败!" << endl << endl; + LogInfo::setRunStatusText("Failed to set RFID reader work mode!"); } } } else { qDebug() << "设置读写器工作模式失败!" << endl << endl; + LogInfo::setRunStatusText("Failed to set RFID reader work mode!"); } } int DevOp::receiveReadRFID_data(void) { - UCHAR revdata[100]; + UCHAR revdata[100] = {0}; QByteArray recResponse; int n = RFIDReadData.size(); if(n>0) @@ -4140,25 +4154,31 @@ int DevOp::receiveReadRFID_data(void) RFIDReadData.clear(); showData(recResponse); } + else + return 0; - memcpy(revdata, recResponse, n); - if ((revdata[0] = 0x04) && ((revdata[1] == 8) || (revdata[1] == 22)) && (revdata[1] == n) && (revdata[2] == 0x03) && (revdata[3] = 0x20))//判断是否为读数据块返回的数据包 + if(n > (int)sizeof(revdata)) // 防止越界 + n = sizeof(revdata); + + memcpy(revdata, recResponse.constData(), n); + + if ((revdata[0] == 0x04) && ((revdata[1] == 8) || (revdata[1] == 22)) && (revdata[1] == n) && (revdata[2] == 0x03) && (revdata[3] == 0x20))//判断是否为读数据块返回的数据包 { bool status = CheckSumIn(revdata, revdata[1]); //计算校验和 if (status) { if (revdata[4] == 0x00) //读数据块成功 { - UCHAR blockdata[16]; - UCHAR temp[33]; + UCHAR blockdata[16] = {0}; + UCHAR temp[33] = {0}; for (int i = 0; i < 16; i++) { blockdata[i] = revdata[5 + i]; //复制数据到数组 } Hex2Str(&blockdata[0], &temp[0], 16); // 数据块数据转换为字符 strRevdata = QString((const char*)temp); - qDebug() << "读数据块成功,数据块6" << "数据为:" << strRevdata << endl << endl; + qDebug() << "读数据块成功, 数据块6" << "数据为:" << strRevdata << endl << endl; return 1; } else @@ -4196,8 +4216,9 @@ int DevOp::queryReadRFID_address(void) } MySleep(100); int n = RFIDReadData.size(); - UCHAR revdata[100]; - memcpy(revdata, RFIDReadData, n); + UCHAR revdata[100] = {0}; + if(n > (int)sizeof(revdata)) n = sizeof(revdata); + memcpy(revdata, RFIDReadData.constData(), n); if(n>0) { showData(RFIDReadData); diff --git a/DevOp.h b/DevOp.h index 6bdc960..5db34d0 100644 --- a/DevOp.h +++ b/DevOp.h @@ -223,7 +223,12 @@ public : void comForRFID_init(); int comReadRFID_data(); // int comWriteRFID_data(int type); - int comWriteRFID_data(); + + /** + * @brief 向卡片写入当前日期时间,标识该卡片已被使用 + * @param done 异步回调函数,用于处理写入完成后的操作,参数为写入结果,0表示成功,-1表示卡片已经离开 + */ + void RFIDmarkCardUsedAsync(std::function done); int setRFIDCarKey(void); int setRFIDReaderKey(int,int); int setRFIDReaderOriginalKey(void); diff --git a/DlgRFIDConfig.cpp b/DlgRFIDConfig.cpp index 153de74..121ddb1 100644 --- a/DlgRFIDConfig.cpp +++ b/DlgRFIDConfig.cpp @@ -1,14 +1,41 @@ -#include "DlgRFIDConfig.h" -#include "ui_DlgRFIDConfig.h" - -DlgRFIDConfig::DlgRFIDConfig(QWidget *parent) : - QDialog(parent), - ui(new Ui::DlgRFIDConfig) -{ - ui->setupUi(this); -} - -DlgRFIDConfig::~DlgRFIDConfig() -{ - delete ui; -} +#include "DlgRFIDConfig.h" +#include "ui_DlgRFIDConfig.h" + +DlgRFIDConfig::DlgRFIDConfig(QWidget *parent) : + QDialog(parent), + ui(new Ui::DlgRFIDConfig) +{ + ui->setupUi(this); + setWindowFlags(windowFlags() | Qt::Tool | Qt::FramelessWindowHint); + +} + +DlgRFIDConfig::~DlgRFIDConfig() +{ + delete ui; +} + +void DlgRFIDConfig::setAutoConfirmTimeout(int seconds) +{ + if(seconds == m_autoConfirmTimeout || seconds < 0 || seconds > ui->spinBox->maximum()) { + return; + } + + m_autoConfirmTimeout = seconds; + ui->spinBox->setValue(seconds); +} + +int DlgRFIDConfig::autoConfirmTimeout() +{ + m_autoConfirmTimeout = ui->spinBox->value(); + return m_autoConfirmTimeout; +} + +void DlgRFIDConfig::onExpirySpinBoxChanged(int val) +{ + if(val == 0) { + ui->labExplain->setText(tr(u8"卡片接触后需要手动确认。")); + } + else + ui->labExplain->setText(tr(u8"卡片接触 %1 秒后自动激活。").arg(val)); +} diff --git a/DlgRFIDConfig.h b/DlgRFIDConfig.h index 8266288..8edb664 100644 --- a/DlgRFIDConfig.h +++ b/DlgRFIDConfig.h @@ -1,22 +1,34 @@ -#ifndef DLGRFIDCONFIG_H -#define DLGRFIDCONFIG_H - -#include - -namespace Ui { -class DlgRFIDConfig; -} - -class DlgRFIDConfig : public QDialog -{ - Q_OBJECT - -public: - explicit DlgRFIDConfig(QWidget *parent = nullptr); - ~DlgRFIDConfig(); - -private: - Ui::DlgRFIDConfig *ui; -}; - -#endif // DLGRFIDCONFIG_H +#ifndef DLGRFIDCONFIG_H +#define DLGRFIDCONFIG_H + +#include + +namespace Ui { +class DlgRFIDConfig; +} + +class DlgRFIDConfig : public QDialog +{ + Q_OBJECT + +public: + explicit DlgRFIDConfig(QWidget *parent = nullptr); + ~DlgRFIDConfig(); + + void setAutoConfirmTimeout(int seconds); + + int autoConfirmTimeout(); + +private slots: + void onExpirySpinBoxChanged(int val); + +signals: + void autoConfirmTimeoutChanged(); + +private: + Ui::DlgRFIDConfig *ui; + + int m_autoConfirmTimeout; +}; + +#endif // DLGRFIDCONFIG_H diff --git a/DlgRFIDConfig.ui b/DlgRFIDConfig.ui index 8abff09..ca7742b 100644 --- a/DlgRFIDConfig.ui +++ b/DlgRFIDConfig.ui @@ -1,18 +1,153 @@ - - DlgRFIDConfig - - - - 0 - 0 - 400 - 300 - - - - Dialog - - - - - + + + DlgRFIDConfig + + + + 0 + 0 + 340 + 222 + + + + Dialog + + + QWidget{ + font-size: 16px; +} + + + + + 230 + 170 + 81 + 31 + + + + 确定 + + + + + + 40 + 60 + 81 + 31 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + QAbstractSpinBox::NoButtons + + + + + + 40 + 30 + 221 + 31 + + + + 自动激活超时 + + + + + + 130 + 60 + 41 + 31 + + + + 秒 + + + + + + 40 + 100 + 271 + 61 + + + + 卡片接触 %1 秒后自动激活。 + + + Qt::AutoText + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + + + + + btnOk + clicked() + DlgRFIDConfig + accept() + + + 414 + 181 + + + 340 + 221 + + + + + btnOk + clicked() + DlgRFIDConfig + hide() + + + 396 + 184 + + + 301 + 221 + + + + + spinBox + valueChanged(int) + DlgRFIDConfig + onExpirySpinBoxChanged(int) + + + 78 + 81 + + + -81 + 81 + + + + + + onExpirySpinBoxChanged(int) + + diff --git a/InkJetPrinter.cpp b/InkJetPrinter.cpp index ac5e920..b2ae7a8 100644 --- a/InkJetPrinter.cpp +++ b/InkJetPrinter.cpp @@ -29,7 +29,7 @@ InkJetPrinter::InkJetPrinter(QWidget* parent) init(); QThread::sleep(3); - qApp->installEventFilter(this); + // qApp->installEventFilter(this); QString ARM_Version; ARM_Version.sprintf("%d.%d.%02d%s%s", UP_PRINTER_MAJOR_VER, UP_PRINTER_MINOR_VER,UP_PRINTER_RIVISION_VER,SUB_VERSION,SUB_RFID); @@ -980,10 +980,14 @@ void InkJetPrinter::timerHandler(void){ qDebug()<<"初始化刷卡模块"; flag6 = false; sysPara->devOp->setICReaderModeFlag = true; - sysPara->devOp->setRFIDReaderWorkMode(); + + // 使用RFID读写器软件设置,而不是这里 + // sysPara->devOp->setRFIDReaderWorkMode(); qDebug()<<"jd.addr: "<dlgInputAddr->jd.addr; LogInfo::setRunStatusText(QString("jd.addr:%1").arg(m_MainInstruction->dlgInputAddr->jd.addr)); - sysPara->devOp->setRFIDReaderKey(m_MainInstruction->dlgInputAddr->jd.addr,1); + + // 使用RFID读写器软件设置,而不是这里 + // sysPara->devOp->setRFIDReaderKey(m_MainInstruction->dlgInputAddr->jd.addr,1); sysPara->devOp->setICReaderModeFlag = false; } if(pulse_300ms){ @@ -991,7 +995,7 @@ void InkJetPrinter::timerHandler(void){ { sysPara->devOp->strRevdata =""; sysPara->devOp->receiveReadRFID_data(); - if(sysPara->devOp->strRevdata.length() > 1) + if(sysPara->devOp->strRevdata.length() > 3) { if((sysPara->devOp->strRevdata.left(3) == QString::number(m_MainInstruction->dlgInputAddr->jd.addr).left(3))\ || sysPara->devOp->strRevdata.left(3) == "100") @@ -1019,7 +1023,7 @@ void InkJetPrinter::timerHandler(void){ { if(sysPara->para.rfidCountDown>0) delayWithEventLoop(); //xx秒的倒计时 - if(sysPara->devOp->comWriteRFID_data() == 1){//把卡数据清零 + if(sysPara->devOp->RFIDmarkCardUsedAsync() == 1){//把卡数据清零 sysPara->RFIDPara.needInkCard = false; sysPara->RFIDPara.inkCardTimeOut = false; sysPara->saveRFIDPara(); @@ -1060,7 +1064,7 @@ void InkJetPrinter::timerHandler(void){ if(sysPara->para.rfidCountDown>0) delayWithEventLoop(); //弹出一个xx秒的倒计时,再执行以下代码 - if(sysPara->devOp->comWriteRFID_data() == 1){//把卡数据清零 + if(sysPara->devOp->RFIDmarkCardUsedAsync() == 1){//把卡数据清零 sysPara->RFIDPara.needSolventCard = false; sysPara->RFIDPara.solventCardTimeOut = false; sysPara->saveRFIDPara(); @@ -1087,7 +1091,7 @@ void InkJetPrinter::timerHandler(void){ if(sysPara->para.rfidCountDown>0) delayWithEventLoop(); //xx秒的倒计时 emit maintenanceShow(); - if(sysPara->devOp->comWriteRFID_data() == 1)//把卡数据清零 + if(sysPara->devOp->RFIDmarkCardUsedAsync() == 1)//把卡数据清零 { sysPara->RFIDPara.needMaintenance = false; sysPara->status.needMaintenanceRemind = false; diff --git a/MainInstruction.cpp b/MainInstruction.cpp index d287a78..e67fbea 100644 --- a/MainInstruction.cpp +++ b/MainInstruction.cpp @@ -2,6 +2,7 @@ #include "ui_MainInstruction.h" #include #include +#include "DlgRFIDConfig.h" MainInstruction::MainInstruction(QWidget *parent) : QWidget(parent), @@ -17,10 +18,14 @@ MainInstruction::MainInstruction(QWidget *parent) : connect(ui->sysSetBtn, &QPushButton::clicked, this, std::bind(&MainInstruction::onSpecialButtonClicked, this, 3)); connect(ui->otherSetBtn, &QPushButton::clicked, this, std::bind(&MainInstruction::onSpecialButtonClicked, this, 4)); connect(ui->sysUpdateBtn,&QPushButton::clicked, this, std::bind(&MainInstruction::onSpecialButtonClicked, this, 5)); + // 其他信号槽连接在ui文件中 dlgInputAddr = new DlgInputAddr(parent); dialogAuthorization = new DialogAuthorization(parent); + dlgRfidConfig = new DlgRFIDConfig(this); + + connect(dlgRfidConfig, &DlgRFIDConfig::accepted, this, &MainInstruction::onRFIDAutoConfirmTimeoutChanged); dlgInputAddr->GetAddr(); dlgInputAddr->vpnConnect(); @@ -244,6 +249,19 @@ void MainInstruction::slt_timeSetting() sysPara->devOp->stm32Wr(0xA1,(unsigned char *)m_datatime,8); } +void MainInstruction::onRfidCfgBtnClicked() +{ + dlgRfidConfig->setAutoConfirmTimeout(sysPara->para.rfidCountDown); + dlgRfidConfig->show(); +} + +void MainInstruction::onRFIDAutoConfirmTimeoutChanged() +{ + sysPara->para.rfidCountDown = dlgRfidConfig->autoConfirmTimeout(); + qInfo() << "RFID auto confirm timeout: " << sysPara->para.rfidCountDown; + sysPara->saveRFIDPara(); +} + void MainInstruction::applyStyleSheet() { QString styleSheet = diff --git a/MainInstruction.h b/MainInstruction.h index 204c795..d177f76 100644 --- a/MainInstruction.h +++ b/MainInstruction.h @@ -13,6 +13,7 @@ #include "LogInfo.h" #include "TimeSettingDialog.h" +class DlgRFIDConfig; namespace Ui { class MainInstruction; @@ -50,6 +51,11 @@ private slots: void on_btn_time_clicked(); void slt_timeSetting(); + + void onRfidCfgBtnClicked(); + + void onRFIDAutoConfirmTimeoutChanged(); + private: Ui::MainInstruction *ui; @@ -59,6 +65,7 @@ private: DialogAuthorization *dialogMaintenanceTimeSettingAuth; DialogMaintenanceTimeSetting *MTimeSetting; DialogAuthorization *dialogAuthorization; + DlgRFIDConfig *dlgRfidConfig = nullptr; // 时间设置 TimeSettingDialog timeDia; diff --git a/MainInstruction.ui b/MainInstruction.ui index 22a5d96..0b660d2 100644 --- a/MainInstruction.ui +++ b/MainInstruction.ui @@ -98,7 +98,7 @@ - 0 + 2 @@ -191,19 +191,6 @@ - - - - 系统更新 - - - - 220 - 60 - - - - @@ -211,13 +198,6 @@ - - - - 其他设置 - - - @@ -238,8 +218,52 @@ + + + + 系统更新 + + + + 220 + 60 + + + + + + + 额外设置 + + + + + 40 + 30 + 161 + 61 + + + + 刷卡设置 + + + + + + 40 + 120 + 161 + 61 + + + + 其他设置 + + + @@ -276,8 +300,8 @@ onGraphicsEditBtnClicked() - 207 - 246 + 230 + 196 -154 @@ -285,8 +309,25 @@ + + rfidCfgBtn + clicked() + MainInstruction + onRfidCfgBtnClicked() + + + 137 + 94 + + + -182 + 93 + + + onGraphicsEditBtnClicked() + onRfidCfgBtnClicked() diff --git a/MainWidget.ui b/MainWidget.ui index e7c44c0..6e6add3 100644 --- a/MainWidget.ui +++ b/MainWidget.ui @@ -7,9 +7,15 @@ 0 0 800 - 607 + 589 + + + 16777215 + 589 + + 0 @@ -193,516 +199,525 @@ 335 - - - - + + + 9 + + + 0 + + + 0 + + + + - - - 180 + + + 180 150 - - - - QFrame::NoFrame - - - QFrame::Plain - - - - - - Qt::Vertical - - - - 20 - 42 - - - - - - - - - 0 - 50 - - - - - - - Qt::AlignCenter - - - - - - - Qt::Vertical - - - - 20 - 42 - - - - - - - - - - - - 200 - 150 - - - - - 200 - 150 - - - - background-color:#BBBBBD;border-radius:3px; - - - - - - color:#000000;font-size:18px; - - - 产品计数器 - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - -1 - - - - - - - - -1 - 75 - true - - - - color:#000000;font-size:28px;font-weight:bold; - - - 0 - - - Qt::AlignCenter - - - - - - - 达到数量后停止: - - - - - - - color:#000000;font-size:28px;font-weight:bold; - - - 0 - - - Qt::AlignRight - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - 150 - 0 - - - - - 150 - 140 - - - - border:0px; - - - 开始打印 - - - - 130 - 130 - - - - - 130 - 130 - - - - - - - - - 0 - 130 - - - - border:0px; - - - - :/image/power.png:/image/power.png - - - - 70 - 70 - - - - - 70 - 70 - - - - - - - - - 250 - 130 - - - - background-color:#BBBBBD;border-radius:3px; - - - - - - color:#000000;font-size:18px; - - - 速度 米/分 - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - -1 - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - color:#3CB371;font-size:18px; - - - 当前 - - - - - - - Qt::Vertical - - - - 20 - 20 - - - - - - - - color:#E72F28;font-size:18px; - - - 最大 - - - - - - - - - Qt::Vertical - - - - 20 - 5 - - - - - - - - - - color:#3CB371;font-size:24px; - - - 0007.9 - - - - - - - Qt::Vertical - - - - 20 - 20 - - - - - - - - color:#E72F28;font-size:24px; - - - 0020.3 - - - - - - - - - Qt::Vertical - - - - 20 - 8 - - - - - - - - - - - - 0 - 140 - - - - border:0px; - - - 停止打印 - - - - 130 - 130 - - - - - 130 - 130 - - - - - - - - - - 5 - - - 1 - - - - - QFrame::NoFrame - - - QFrame::Plain - - - - + + + + QFrame::NoFrame + + + QFrame::Plain + + + + + + Qt::Vertical + + + + 20 + 42 + + + + + + + + + 0 + 50 + + + + + + + Qt::AlignCenter + + + + + + + Qt::Vertical + + + + 20 + 42 + + + + + + + + + + + + 200 + 150 + + + + + 200 + 150 + + + + background-color:#BBBBBD;border-radius:3px; + + + + + + color:#000000;font-size:18px; + + + 产品计数器 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + -1 + + + + + + + + -1 + 75 + true + + + + color:#000000;font-size:28px;font-weight:bold; + + + 0 + + + Qt::AlignCenter + + + + + + + 达到数量后停止: + + + + + + + color:#000000;font-size:28px;font-weight:bold; + + + 0 + + + Qt::AlignRight + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + 150 + 0 + + + + + 150 + 140 + + + + border:0px; + + + 开始打印 + + + + 130 + 130 + + + + + 130 + 130 + + + + + + + + + 0 + 130 + + + + border:0px; + + + + :/image/power.png:/image/power.png + + + + 70 + 70 + + + + + 70 + 70 + + + + + + + + + 250 + 130 + + + + background-color:#BBBBBD;border-radius:3px; + + + + + + color:#000000;font-size:18px; + + + 速度 米/分 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + -1 + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + color:#3CB371;font-size:18px; + + + 当前 + + + + + + + Qt::Vertical + + + + 20 + 20 + + + + + + + + color:#E72F28;font-size:18px; + + + 最大 + + + + + + + + + Qt::Vertical + + + + 20 + 5 + + + + + + + + + + color:#3CB371;font-size:24px; + + + 0007.9 + + + + + + + Qt::Vertical + + + + 20 + 20 + + + + + + + + color:#E72F28;font-size:24px; + + + 0020.3 + + + + + + + + + Qt::Vertical + + + + 20 + 8 + + + + + + + + + + + + 0 + 140 + + + + border:0px; + + + 停止打印 + + + + 130 + 130 + + + + + 130 + 130 + + + + + + + + + + 5 + + + 1 + + + + + QFrame::NoFrame + + + QFrame::Plain + + + + 200 150 - + - + :/image/tool.png true - - - - - - - - - Qt::AlignCenter - - - - - - - - - - - 200 - 70 - - - - - 200 - 16777215 - - - + + + + + + + + + Qt::AlignCenter + + + + + + + + + + + 200 + 70 + + + + + 200 + 16777215 + + + - - - 喷嘴开启 - - - - 70 - 70 - - - - - 70 - 70 - - - - - - - - - 200 - 70 - - - - - 200 - 444 - - - + + + 喷嘴开启 + + + + 70 + 70 + + + + + 70 + 70 + + + + + + + + + 200 + 70 + + + + + 200 + 444 + + + - - - 喷嘴关闭 - - - - 70 - 70 - - - - - 70 - 70 - - - - - - - + + + 喷嘴关闭 + + + + 70 + 70 + + + + + 70 + 70 + + + + + + + diff --git a/Public.cpp b/Public.cpp index 14d8e82..df0af2a 100644 --- a/Public.cpp +++ b/Public.cpp @@ -274,7 +274,7 @@ QString Public::ReadLanguageName() QString Public::ReadKeyBoardUse() { QFile file1("/home/plg/UseKBD"); - QString language="Chinese"; + QString language="MultiLanguage"; char buf[256]; diff --git a/QtUI.pro b/QtUI.pro index 3296107..5eb1c64 100644 --- a/QtUI.pro +++ b/QtUI.pro @@ -139,6 +139,7 @@ HEADERS += Public.h \ CounterVarSet.h \ SystemUpdate.h \ dialogmaintenancetimesetting.h \ + DlgRFIDConfig.h \ selectcodedlg.h \ BarCode/barcode.h \ QBarCode.h \ @@ -200,6 +201,7 @@ FORMS += \ countervarset.ui \ SystemUpdate.ui \ dialogmaintenancetimesetting.ui \ + DlgRFIDConfig.ui \ selectcodedlg.ui \ QBarCode.ui \ setnumdlg.ui \ @@ -283,6 +285,7 @@ SOURCES +=\ scene/PicDateItem.cpp \ SystemUpdate.cpp \ dialogmaintenancetimesetting.cpp \ + DlgRFIDConfig.cpp \ selectcodedlg.cpp \ QBarCode.cpp \ BarCode/ps.c \ diff --git a/SysPara.cpp b/SysPara.cpp index 8f352b1..b86743b 100644 --- a/SysPara.cpp +++ b/SysPara.cpp @@ -1015,6 +1015,7 @@ void SysPara::saveRFIDPara() out << RFIDPara.maintenanceInterval; out << RFIDPara.maintenanceEndDate; out << RFIDPara.needMaintenance; + out << para.rfidCountDown; if(!file.flush()){ LogInfo::setRunStatusText("RFID Para save Failed 1"); @@ -1054,6 +1055,7 @@ bool SysPara::loadRFIDPara() in >> RFIDPara.maintenanceInterval; in >> RFIDPara.maintenanceEndDate; in >> RFIDPara.needMaintenance; + in >> para.rfidCountDown; file.close(); return true;