超级IC卡暂存

This commit is contained in:
2026-07-08 16:56:05 +08:00
parent 5b06da56a7
commit 4bb8d7dfa5
21 changed files with 4133 additions and 3811 deletions
+255 -193
View File
@@ -306,7 +306,7 @@ void InkJetPrinter::slt_editCounter(CounterViewModel vm)
void InkJetPrinter::slt_warningMaintenance() void InkJetPrinter::slt_warningMaintenance()
{ {
// 新逻辑的时间跨度更短,优先判断 // 距离维护时间结束大于30天,判断运行时间的检测
if (timeoutDay >= 30) { if (timeoutDay >= 30) {
double runHours = sysPara->RFIDPara.runTime / 60.0 / 60.0; double runHours = sysPara->RFIDPara.runTime / 60.0 / 60.0;
double hours = sysPara->RFIDPara.maintenanceHours - runHours; double hours = sysPara->RFIDPara.maintenanceHours - runHours;
@@ -321,11 +321,10 @@ void InkJetPrinter::slt_warningMaintenance()
} }
msgtest->setText(str); msgtest->setText(str);
msgtest->show(); msgtest->show();
// m_MainWidget->setRunStatus(str);
LogInfo::setRunStatusText(str); LogInfo::setRunStatusText(str);
return; return;
} else { } else {
warningHandler(3); warningHandler(CARD_TYPE::MAINTENANCE); // 距离维护时间结束大于30天,判断运行时间的检测
return; return;
} }
@@ -1250,128 +1249,21 @@ void InkJetPrinter::timerHandler(void){
#ifdef __RFID_CARD #ifdef __RFID_CARD
// hlp 0513 :甲方要求提示越来越频繁 // hlp 0513 :甲方要求提示越来越频繁
if(sysPara->status.needMaintenanceRemind){ // if(sysPara->status.needMaintenanceRemind){
// warningHandler(3); // warningHandler(3);
} // }
static bool logFlagCard1 = 1; // LogInfo::setRunStatusText(tr("处理警告:%1").arg(QDateTime::currentDateTime()));
if(!sysPara->para.flagOfInkWarning){ handleWarnInk(); // 处理墨水警告
if(sysPara->status.statWarn & WARN_STATUS_INK_WARN) handleWarnSolvent(); // 处理溶剂警告
sysPara->status.inkWarningCnt++;
if(!(sysPara->status.statWarn & WARN_STATUS_INK_WARN))
sysPara->status.inkWarningCnt = 0;
if(sysPara->status.inkWarningCnt >= DETECT_WARNING_TIME){
sysPara->para.flagOfInkWarning = true;
QDateTime curDateTime = QDateTime::currentDateTime();
QString strCurDateTime = curDateTime.toString("yyMMddhhmmss");
LogInfo::setRunStatusText("Ink warning.");
qDebug()<<"墨水液位报警";
if(sysPara->para.inkWarnDate == 0){
sysPara->para.inkWarnDate = strCurDateTime.mid(0,6).toInt();
sysPara->para.inkWarnTime = strCurDateTime.mid(6,6).toInt();
}
sysPara->saveParaToFile();
}
}
else{
if(logFlagCard1){
logFlagCard1 = 0;
QString strDate = QString::number(sysPara->para.inkWarnDate);
QString strTime = QString::number(sysPara->para.inkWarnTime);
QString str1 = QString::number(strDate.mid(0,2).toInt()).rightJustified(2,'0');
QString str2 = QString::number(strDate.mid(2,2).toInt()).rightJustified(2,'0');
QString str3 = QString::number(strDate.mid(4,2).toInt()).rightJustified(2,'0');
QString str4 = QString::number(strTime.mid(0,2).toInt()).rightJustified(2,'0');
QString str5 = QString::number(strTime.mid(2,2).toInt()).rightJustified(2,'0');
QString str6 = QString::number(strTime.mid(4,2).toInt()).rightJustified(2,'0');
QString strDateTime = str1 + "-" + str2 + "-" + str3 + " " + str4 + ":" + str5 + ":" + str6;
LogInfo::setRunStatusText(tr("ink Warning at: %1").arg(strDateTime));
qDebug()<<"ink Warning at:"<<strDateTime;
}
}
static bool logFlag2 = 1;
if(!sysPara->para.flagOfSolventWarning){
if(sysPara->status.statWarn & WARN_STATUS_SOLV_WARN)
sysPara->status.solventWarningCnt++;
if(!(sysPara->status.statWarn & WARN_STATUS_SOLV_WARN))
sysPara->status.solventWarningCnt = 0;
if(sysPara->status.solventWarningCnt >= DETECT_WARNING_TIME){
sysPara->para.flagOfSolventWarning = true;
QDateTime curDateTime = QDateTime::currentDateTime();
QString strCurDateTime = curDateTime.toString("yyMMddhhmmss");
LogInfo::setRunStatusText("Solvent warning.");
qDebug()<<"溶剂液位报警";
if(sysPara->para.solventWarnDate == 0){
sysPara->para.solventWarnDate = strCurDateTime.mid(0,6).toInt();
sysPara->para.solventWarnTime = strCurDateTime.mid(6,6).toInt();
}
sysPara->saveParaToFile();
}
}
else{
if(logFlag2){
logFlag2 = 0;
QString strDate = QString::number(sysPara->para.solventWarnDate);
QString strTime = QString::number(sysPara->para.solventWarnTime);
QString str1 = QString::number(strDate.mid(0,2).toInt()).rightJustified(2,'0');
QString str2 = QString::number(strDate.mid(2,2).toInt()).rightJustified(2,'0');
QString str3 = QString::number(strDate.mid(4,2).toInt()).rightJustified(2,'0');
QString str4 = QString::number(strTime.mid(0,2).toInt()).rightJustified(2,'0');
QString str5 = QString::number(strTime.mid(2,2).toInt()).rightJustified(2,'0');
QString str6 = QString::number(strTime.mid(4,2).toInt()).rightJustified(2,'0');
QString strDateTime = str1 + "-" + str2 + "-" + str3 + " " + str4 + ":" + str5 + ":" + str6;
LogInfo::setRunStatusText(tr("solvent Warning at: %1").arg(strDateTime));
qDebug()<<"solvent Warning at:"<<strDateTime;
}
}
if(sysPara->para.flagOfInkWarning){
if(!sysPara->RFIDPara.needInkCard){
QDateTime curDateTime = QDateTime::currentDateTime();
QByteArray curDateTimestr = curDateTime.toString("yyyy-MM-dd HH::mm::ss").toUtf8();
QFile file("/home/plg/inkRFIDTime.txt");
if(!file.open(QIODevice::WriteOnly)){
qDebug()<<"Open inkRFIDTime Failure.";
LogInfo::setRunStatusText("Open inkRFIDTime Failure.");
}
int ret = file.write(curDateTimestr);
if(ret <= 0){
qDebug()<<"Write inkRFIDTime Failure.";
LogInfo::setRunStatusText("Write inkRFIDTime Failure.");
}
file.close();
sysPara->RFIDPara.needInkCard = true;
sysPara->saveRFIDPara();
}
warningHandler(1);
}
if(sysPara->para.flagOfSolventWarning){
if(!sysPara->RFIDPara.needSolventCard){
QDateTime curDateTime = QDateTime::currentDateTime();
QByteArray curDateTimestr = curDateTime.toString("yyyy-MM-dd HH::mm::ss").toUtf8();
QFile file("/home/plg/solventRFIDTime.txt");
if(!file.open(QIODevice::WriteOnly)){
qDebug()<<"Open solventRFIDTime Failure.";
LogInfo::setRunStatusText("Open solventRFIDTime Failure.");
}
int ret = file.write(curDateTimestr);
if(ret <= 0){
qDebug()<<"Write solventRFIDTime Failure.";
LogInfo::setRunStatusText("Write solventRFIDTime Failure.");
}
file.close();
sysPara->RFIDPara.needSolventCard = true;
sysPara->saveRFIDPara();
}
warningHandler(2);
}
#endif #endif
static bool resumeFlag = false; static bool resumeFlag = false;
if(lostCommuFlag || m_MainWidget->updatePhaseIndicatorLight() || (sysPara->status.statWarn & (WARN_STATUS_POWER_MON|WARN_STATUS_INK_WARN|WARN_STATUS_SUMP_WARN if(lostCommuFlag || m_MainWidget->updatePhaseIndicatorLight()
|WARN_STATUS_SOLV_WARN|WARN_STATUS_POWER_MON)) || (sysPara->status.gearPumpRunStopFlag && pushButtonStartFlag) ||sysPara->status.lastHighVoltageFault) || (sysPara->status.statWarn &
(WARN_STATUS_POWER_MON|WARN_STATUS_INK_WARN|WARN_STATUS_SUMP_WARN
|WARN_STATUS_SOLV_WARN|WARN_STATUS_POWER_MON))
|| (sysPara->status.gearPumpRunStopFlag && pushButtonStartFlag)
||sysPara->status.lastHighVoltageFault)
{ {
sysPara->status.beeperOnFlag = true; sysPara->status.beeperOnFlag = true;
if(sysPara->status.gearPumpRunStopFlag && pushButtonStartFlag) if(sysPara->status.gearPumpRunStopFlag && pushButtonStartFlag)
@@ -2756,87 +2648,94 @@ void InkJetPrinter::OnFinished(int event){
} }
#define INTERVAL_BEFORE48H 30
#define INTERVAL_AFTER48H 5 #define INTERVAL_AFTER48H 5
void InkJetPrinter::warningHandler(int type){ void InkJetPrinter::warningHandler(int type){
static int lastMin = 0;
static bool flagOfWarning = true; static bool flagOfWarning = true;
static bool flagOfmtWarning = true; static bool flagOfmtWarning = true;
static int lastTimeElasped = 0;
QTime curTime = QTime::currentTime();
QDateTime curDateTime = QDateTime::currentDateTime();
int curMin = curTime.minute();
int timeElasped = 0;
if(lastMin != curMin){
lastMin = curMin;
if(type == 1 && sysPara->RFIDPara.inkCardTimeOut){
if(++sysPara->status.showInkWarningNumber >= INTERVAL_AFTER48H){
warningShow(type,49);
sysPara->status.showInkWarningNumber = 0;
}
return;
}
if(type == 2 && sysPara->RFIDPara.solventCardTimeOut){
if(++sysPara->status.showSolventWarningNumber >= INTERVAL_AFTER48H){
warningShow(type,49);
sysPara->status.showSolventWarningNumber = 0;
}
return;
}
/***********处理保养到期提示start************************/
if(type == 3){
static int i = 1; static int i = 1;
if(sysPara->RFIDPara.needMaintenance){//保养到期,喷码机禁用 int elasped = curPowerOnDateTime.secsTo(QDateTime::currentDateTime());// 本次开机运行秒数
warningShow(3,timeoutDay); if(elasped >= 60*60*i){ //开机后1小时提醒一次,测试时可以缩短
} // if (elasped > 30*i) {//test
else if(sysPara->status.needMaintenanceRemind){//保养到期提前一个月提示
if(flagOfmtWarning){
warningShow(3,timeoutDay);
flagOfmtWarning = false;
}
QDateTime curDateTime = QDateTime::currentDateTime();
int elasped = curPowerOnDateTime.secsTo(curDateTime);
if(elasped >= 7200*i){
i++; i++;
flagOfmtWarning = true; flagOfmtWarning = true;
flagOfWarning = true;
LogInfo::setRunStatusText("Next Hour Warning");
} }
int inkTime = 0, solventTime = 0;
if (type == CARD_TYPE::INK) {
// 只有当报警标志为true时,文件的时间才会更新,此时才读取
if(sysPara->para.flagOfInkWarning) {
int dateTimeDiff = updateWarningTime(type);
if (dateTimeDiff > 60*60*24*2) {
sysPara->RFIDPara.inkCardTimeOut = true;
} }
if (!sysPara->RFIDPara.inkCardTimeOut)
inkTime = 48- dateTimeDiff/60/60;
}
if(sysPara->RFIDPara.inkCardTimeOut){
if(++sysPara->status.showInkWarningNumber >= INTERVAL_AFTER48H){
warningShow(CARD_TYPE::INK,49);
sysPara->status.showInkWarningNumber = 0;//是否有必要保存?
sysPara->saveRFIDPara();
return; return;
} }
/***********处理保养到期提示end**************************************/
timeElasped = dateTimeElasped(type,curDateTime.toString("yyyy-MM-dd HH::mm::ss"));
if(timeElasped - lastTimeElasped >= 60*INTERVAL_BEFORE48H){
qDebug()<<"Next Hour Warning";
LogInfo::setRunStatusText("Next Hour Warning");
flagOfWarning = true;//一个小时提示一次
}
for(int i = 1;i<49;i++){
if(timeElasped <= i*3600 && flagOfWarning){
lastTimeElasped = timeElasped;
warningShow(type,49-i);
flagOfWarning = false;
break;
}
}
if(timeElasped > 48*3600){
if(type == 1){
sysPara->RFIDPara.inkCardTimeOut = true;
warningShow(1,49);
}
if(type == 2){
sysPara->RFIDPara.solventCardTimeOut = true;
warningShow(2,49);
} }
sysPara->saveRFIDPara(); sysPara->saveRFIDPara();
} }
else if(type == CARD_TYPE::SOLVENT) {
//只有当报警标志为true时,文件的时间才会更新,此时才读取
if (sysPara->para.flagOfSolventWarning) {
int dateTimeDiff = updateWarningTime(type);
if (dateTimeDiff > 60*60*24*2) {
sysPara->RFIDPara.solventCardTimeOut = true;
}
if (!sysPara->RFIDPara.solventCardTimeOut)
solventTime = 48- dateTimeDiff/60/60;
}
if(sysPara->RFIDPara.solventCardTimeOut){
if(++sysPara->status.showSolventWarningNumber >= INTERVAL_AFTER48H){
warningShow(CARD_TYPE::SOLVENT,49);
sysPara->status.showSolventWarningNumber = 0;
sysPara->saveRFIDPara();
return;
}
}
sysPara->saveRFIDPara();
}
/***********处理保养到期提示start******************/
else if(type == CARD_TYPE::MAINTENANCE){
if(sysPara->RFIDPara.needMaintenance){//保养到期,喷码机禁用
warningShow(CARD_TYPE::MAINTENANCE,timeoutDay);
}
//needMaintenanceRemind:保养到期提前一个月提示标志
else if(sysPara->status.needMaintenanceRemind){
if(flagOfmtWarning){
warningShow(CARD_TYPE::MAINTENANCE,timeoutDay);
flagOfmtWarning = false;
}
}
return;
}
/***********处理保养到期提示end******************/
// 超过48小时后,不会执行这一段
if(flagOfWarning){
//48小时后禁用,小时=第一次提示时间到当前时间的间隔秒数/60/60
if (type = INK && sysPara->para.flagOfInkWarning)
warningShow(type,inkTime);
else if (type = SOLVENT && sysPara->para.flagOfSolventWarning)
warningShow(type,solventTime);
flagOfWarning = false;
} }
} }
// 1:Ink 2:Solvent 3:Maintenance
void InkJetPrinter::warningShow(int type,int num){ void InkJetPrinter::warningShow(int type,int num){
QString str = ""; QString str = "";
if(type == 1){ if(type == CARD_TYPE::INK && sysPara->RFIDPara.needInkCard){
if(num < 49) if(num < 49)
str = tr("请刷墨水卡,请使用原厂墨水耗材,否则机器将在%1小时后禁止使用!").arg(num); str = tr("请刷墨水卡,请使用原厂墨水耗材,否则机器将在%1小时后禁止使用!").arg(num);
else if(num == 49) else if(num == 49)
@@ -2847,7 +2746,7 @@ void InkJetPrinter::warningShow(int type,int num){
LogInfo::setRunStatusText(str); LogInfo::setRunStatusText(str);
qDebug()<<str; qDebug()<<str;
} }
else if(type == 2){ else if(type == CARD_TYPE::SOLVENT && sysPara->RFIDPara.needSolventCard){
if(num < 49) if(num < 49)
str = tr("请刷溶剂卡,请使用原厂溶剂耗材,否则机器将在%1小时后禁止使用!").arg(num); str = tr("请刷溶剂卡,请使用原厂溶剂耗材,否则机器将在%1小时后禁止使用!").arg(num);
else if(num == 49) else if(num == 49)
@@ -2858,14 +2757,13 @@ void InkJetPrinter::warningShow(int type,int num){
LogInfo::setRunStatusText(str); LogInfo::setRunStatusText(str);
qDebug()<<str; qDebug()<<str;
} }
else if(type == 3){ else if(type == CARD_TYPE::MAINTENANCE){
if(timeoutDay >= 0) if(timeoutDay >= 0)
str = tr("保养期还有%1天到期,请及时保养,否则喷码机容易损坏").arg(num); str = tr("保养期还有%1天到期,请及时保养,否则喷码机容易损坏").arg(num);
else else
str = tr("保养期已超过%1天,请进行保养以恢复喷码机的正常使用").arg(num*(-1)); str = tr("保养期已超过%1天,请进行保养以恢复喷码机的正常使用").arg(num*(-1));
msgtest->setText(str); msgtest->setText(str);
msgtest->show(); msgtest->show();
// m_MainWidget->setRunStatus(str);
LogInfo::setRunStatusText(str); LogInfo::setRunStatusText(str);
qDebug()<<str; qDebug()<<str;
} }
@@ -2893,32 +2791,55 @@ void InkJetPrinter::createNewJobFile()
m_TestPrintWidget->on_newfileButton_pressed(); m_TestPrintWidget->on_newfileButton_pressed();
} }
int InkJetPrinter::dateTimeElasped(int type,QString str){ int InkJetPrinter::updateWarningTime(int type){
QFile file; QFile file;
if(type == 1) if(type == 1)
file.setFileName("/home/plg/inkRFIDTime.txt"); file.setFileName("/home/plg/inkRFIDTime.txt");
else if(type == 2) else if(type == 2)
file.setFileName("/home/plg/solventRFIDTime.txt"); file.setFileName("/home/plg/solventRFIDTime.txt");
else return;
if(!file.exists()){ if(!file.exists()){
qDebug()<<"刷卡倒计时起始时间文件不存在";
LogInfo::setRunStatusText(tr("刷卡倒计时起始时间文件不存在")); LogInfo::setRunStatusText(tr("刷卡倒计时起始时间文件不存在"));
return -1; return -1;
} }
QDateTime curDateTime = QDateTime::currentDateTime();
int dateTimeDiff = -1;
if (type == 1) {
if (inkWarnTime == QDateTime()) {
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
// 读取文件内容 // 读取文件内容
QTextStream in(&file); QTextStream in(&file);
QString starTime = in.readAll(); QString starTime = in.readAll(); // 第一次提示的时间
// 关闭文件 // 关闭文件
file.close(); file.close();
QDateTime startDateTime = QDateTime::fromString(starTime,"yyyy-MM-dd HH::mm::ss"); inkWarnTime = QDateTime::fromString(starTime,"yyyy-MM-dd HH::mm::ss");
QDateTime curDateTime = QDateTime::fromString(str,"yyyy-MM-dd HH::mm::ss");
int dateTimeDiff = startDateTime.secsTo(curDateTime);
return dateTimeDiff;
} else { } else {
qDebug() << "Failed to open file for reading:"; qDebug() << "Failed to open file for reading:";
LogInfo::setRunStatusText("Failed to open file for reading");
return -1; return -1;
} }
}
dateTimeDiff = inkWarnTime.secsTo(curDateTime);
} else if (type == 2) {
if (solventWarnTime == QDateTime()) {
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
// 读取文件内容
QTextStream in(&file);
QString starTime = in.readAll(); // 第一次提示的时间
// 关闭文件
file.close();
solventWarnTime = QDateTime::fromString(starTime,"yyyy-MM-dd HH::mm::ss");
} else {
qDebug() << "Failed to open file for reading:";
LogInfo::setRunStatusText("Failed to open file for reading");
return -1;
}
}
dateTimeDiff = solventWarnTime.secsTo(curDateTime);
}
return dateTimeDiff;
} }
bool InkJetPrinter::cardTouchConfirm(QString msgTxt, QString variableMsgTxt) bool InkJetPrinter::cardTouchConfirm(QString msgTxt, QString variableMsgTxt)
@@ -2989,6 +2910,147 @@ void InkJetPrinter::initRFIDManager()
m_MainInstruction,SLOT(maintenanceDialogShow())); m_MainInstruction,SLOT(maintenanceDialogShow()));
} }
} }
void InkJetPrinter::handleWarnInk()
{
static bool logFlag_inkCard = 1; // 每次启动提示一次即可
if(!sysPara->para.flagOfInkWarning){
if(sysPara->status.statWarn & WARN_STATUS_INK_WARN)
sysPara->status.inkWarningCnt++; // 累计警报10次就提示
else {
sysPara->status.inkWarningCnt = 0;
}
if(sysPara->status.inkWarningCnt >= DETECT_WARNING_TIME){
sysPara->para.flagOfInkWarning = true;
QString strCurDateTime = QDateTime::currentDateTime().toString("yyMMddhhmmss");
LogInfo::setRunStatusText("Ink warning.");
qDebug()<<"墨水液位报警";
if(sysPara->para.inkWarnDate == 0){
sysPara->para.inkWarnDate = strCurDateTime.mid(0,6).toInt();
sysPara->para.inkWarnTime = strCurDateTime.mid(6,6).toInt();
}
sysPara->saveParaToFile();
}
}
else{
if(logFlag_inkCard){
logFlag_inkCard = 0;
QString strDate = QString::number(sysPara->para.inkWarnDate);
QString strTime = QString::number(sysPara->para.inkWarnTime);
QString str1 = QString::number(strDate.mid(0,2).toInt()).rightJustified(2,'0');
QString str2 = QString::number(strDate.mid(2,2).toInt()).rightJustified(2,'0');
QString str3 = QString::number(strDate.mid(4,2).toInt()).rightJustified(2,'0');
QString str4 = QString::number(strTime.mid(0,2).toInt()).rightJustified(2,'0');
QString str5 = QString::number(strTime.mid(2,2).toInt()).rightJustified(2,'0');
QString str6 = QString::number(strTime.mid(4,2).toInt()).rightJustified(2,'0');
QString strDateTime = str1 + "-" + str2 + "-" + str3 + " " + str4 + ":" + str5 + ":" + str6;
LogInfo::setRunStatusText(tr("ink Warning at: %1").arg(strDateTime));
qDebug()<<"ink Warning at:"<<strDateTime;
}
}
if(sysPara->para.flagOfInkWarning){
if(!sysPara->RFIDPara.needInkCard){
// 软件启动后第一次提示的时间
QDateTime curDateTime = QDateTime::currentDateTime();
QByteArray curDateTimestr = curDateTime.toString("yyyy-MM-dd HH::mm::ss").toUtf8();
QFile file("/home/plg/inkRFIDTime.txt");
if(!file.open(QIODevice::WriteOnly)){
qDebug()<<"Open inkRFIDTime Failure.";
LogInfo::setRunStatusText("Open inkRFIDTime Failure.");
}
int ret = file.write(curDateTimestr);
if(ret <= 0){
qDebug()<<"Write inkRFIDTime Failure.";
LogInfo::setRunStatusText("Write inkRFIDTime Failure.");
}
file.close();
sysPara->RFIDPara.needInkCard = true;
sysPara->saveRFIDPara();
}
warningHandler(CARD_TYPE::INK);
// 状态正常但是需要刷卡,说明此时先加的墨水,后面再刷卡
if(!(sysPara->status.statWarn & WARN_STATUS_INK_WARN)
&& sysPara->RFIDPara.needInkCard){
sysPara->RFIDPara.addedInk = true;
sysPara->saveRFIDPara();
}
}
}
void InkJetPrinter::handleWarnSolvent()
{
static bool logFlag_solventCard = 1; // 每次启动提示一次即可
if(!sysPara->para.flagOfSolventWarning){
if(sysPara->status.statWarn & WARN_STATUS_SOLV_WARN)
sysPara->status.solventWarningCnt++;
else{
sysPara->status.solventWarningCnt = 0;
}
if(sysPara->status.solventWarningCnt >= DETECT_WARNING_TIME){
sysPara->para.flagOfSolventWarning = true;
QDateTime curDateTime = QDateTime::currentDateTime();
QString strCurDateTime = curDateTime.toString("yyMMddhhmmss");
LogInfo::setRunStatusText("Solvent warning.");
qDebug()<<"溶剂液位报警";
if(sysPara->para.solventWarnDate == 0){
sysPara->para.solventWarnDate = strCurDateTime.mid(0,6).toInt();
sysPara->para.solventWarnTime = strCurDateTime.mid(6,6).toInt();
}
sysPara->saveParaToFile();
}
}
else{
if(logFlag_solventCard){
logFlag_solventCard = 0;
QString strDate = QString::number(sysPara->para.solventWarnDate);
QString strTime = QString::number(sysPara->para.solventWarnTime);
QString str1 = QString::number(strDate.mid(0,2).toInt()).rightJustified(2,'0');
QString str2 = QString::number(strDate.mid(2,2).toInt()).rightJustified(2,'0');
QString str3 = QString::number(strDate.mid(4,2).toInt()).rightJustified(2,'0');
QString str4 = QString::number(strTime.mid(0,2).toInt()).rightJustified(2,'0');
QString str5 = QString::number(strTime.mid(2,2).toInt()).rightJustified(2,'0');
QString str6 = QString::number(strTime.mid(4,2).toInt()).rightJustified(2,'0');
QString strDateTime = str1 + "-" + str2 + "-" + str3 + " " + str4 + ":" + str5 + ":" + str6;
LogInfo::setRunStatusText(tr("solvent Warning at: %1").arg(strDateTime));
qDebug()<<"solvent Warning at:"<<strDateTime;
}
}
if(sysPara->para.flagOfSolventWarning){
if(!sysPara->RFIDPara.needSolventCard){
QDateTime curDateTime = QDateTime::currentDateTime();
QByteArray curDateTimestr = curDateTime.toString("yyyy-MM-dd HH::mm::ss").toUtf8();
QFile file("/home/plg/solventRFIDTime.txt");
if(!file.open(QIODevice::WriteOnly)){
qDebug()<<"Open solventRFIDTime Failure.";
LogInfo::setRunStatusText("Open solventRFIDTime Failure.");
}
int ret = file.write(curDateTimestr);
if(ret <= 0){
qDebug()<<"Write solventRFIDTime Failure.";
LogInfo::setRunStatusText("Write solventRFIDTime Failure.");
}
file.close();
sysPara->RFIDPara.needSolventCard = true;
sysPara->saveRFIDPara();
}
warningHandler(CARD_TYPE::SOLVENT);
// 如果溶剂报警,说明此时先加的溶剂,后面再刷卡
if(!(sysPara->status.statWarn & WARN_STATUS_SOLV_WARN)
&& sysPara->RFIDPara.needSolventCard){
sysPara->RFIDPara.addedSolvent = true;
sysPara->saveRFIDPara();
}
}
}
#endif #endif
void InkJetPrinter::slt_showMsg(QString msg) void InkJetPrinter::slt_showMsg(QString msg)
+7 -3
View File
@@ -114,7 +114,7 @@ private:
bool cardTouchConfirm(QString msgTxt, QString variableMsgTxt); bool cardTouchConfirm(QString msgTxt, QString variableMsgTxt);
QMessageBox *msgtest; QMessageBox *msgtest;
// 本次开机时间
QDateTime curPowerOnDateTime; QDateTime curPowerOnDateTime;
int timeoutDay; int timeoutDay;
@@ -124,6 +124,10 @@ private:
#ifdef __RFID_CARD #ifdef __RFID_CARD
RFIDManager* manager_rfid = nullptr; RFIDManager* manager_rfid = nullptr;
void initRFIDManager(); void initRFIDManager();
void handleWarnInk();
void handleWarnSolvent();
QDateTime inkWarnTime = QDateTime();
QDateTime solventWarnTime = QDateTime();
#endif #endif
private slots: private slots:
void slt_showMsg(QString msg); void slt_showMsg(QString msg);
@@ -195,8 +199,8 @@ public slots:
void handleInitedPID(); void handleInitedPID();
void resetPressureCnt(); void resetPressureCnt();
// 从文件获取墨水和溶剂各自第一次警告的时间
int dateTimeElasped(int,QString); int updateWarningTime(int);
void warningHandler(int); void warningHandler(int);
void warningShow(int,int); void warningShow(int,int);
+8
View File
@@ -1024,6 +1024,10 @@ void SysPara::saveRFIDPara()
out << RFIDPara.needMaintenance; out << RFIDPara.needMaintenance;
out << RFIDPara.runTime; out << RFIDPara.runTime;
out << RFIDPara.maintenanceHours; out << RFIDPara.maintenanceHours;
out << RFIDPara.addedInk;
out << RFIDPara.addedSolvent;
out << RFIDPara.cardInk;
out << RFIDPara.cardSolvent;
out << para.rfidCountDown; out << para.rfidCountDown;
if(!file.flush()){ if(!file.flush()){
@@ -1067,6 +1071,10 @@ bool SysPara::loadRFIDPara()
in >> RFIDPara.needMaintenance; in >> RFIDPara.needMaintenance;
in >> RFIDPara.runTime; in >> RFIDPara.runTime;
in >> RFIDPara.maintenanceHours; in >> RFIDPara.maintenanceHours;
in >> RFIDPara.addedInk;
in >> RFIDPara.addedSolvent;
in >> RFIDPara.cardInk;
in >> RFIDPara.cardSolvent;
in >> para.rfidCountDown; in >> para.rfidCountDown;
file.close(); file.close();
+8 -2
View File
@@ -801,8 +801,8 @@ typedef struct {
bool eleEyeEdgetTriggerExternal; bool eleEyeEdgetTriggerExternal;
bool synTriggerInner; bool synTriggerInner;
bool synTriggerExternal; bool synTriggerExternal;
bool flagOfInkWarning; bool flagOfInkWarning; //报错累计次数达标,报警标志设为true
bool flagOfSolventWarning; bool flagOfSolventWarning; //报错累计次数达标,报警标志设为true
unsigned short rfidCountDown; unsigned short rfidCountDown;
/* */ /* */
// 1108Bytes // 1108Bytes
@@ -887,6 +887,12 @@ typedef struct
// 运行时间与保养间隔时间 runTime>=maintenanceHours 时提示保养 // 运行时间与保养间隔时间 runTime>=maintenanceHours 时提示保养
unsigned int runTime; // 单位:秒 unsigned int runTime; // 单位:秒
unsigned int maintenanceHours; unsigned int maintenanceHours;
// 已经加过墨水或溶剂
bool addedInk;
bool addedSolvent;
// 已经刷过墨水或溶剂卡
bool cardInk;
bool cardSolvent;
}RFIDPara_t; }RFIDPara_t;
#define MDT 0 #define MDT 0
+1 -1
View File
@@ -6,7 +6,7 @@
*/ */
#define UP_PRINTER_MAJOR_VER 6 #define UP_PRINTER_MAJOR_VER 6
#define UP_PRINTER_MINOR_VER 7 #define UP_PRINTER_MINOR_VER 7
#define UP_PRINTER_RIVISION_VER 1 #define UP_PRINTER_RIVISION_VER 2
#define SUB_VERSION "_KOR" #define SUB_VERSION "_KOR"
#ifdef __RFID_OLD #ifdef __RFID_OLD
#define SUB_RFID "_RO" #define SUB_RFID "_RO"
+451 -413
View File
File diff suppressed because it is too large Load Diff
Binary file not shown.
+451 -413
View File
File diff suppressed because it is too large Load Diff
+451 -413
View File
File diff suppressed because it is too large Load Diff
+496 -423
View File
File diff suppressed because it is too large Load Diff
+8 -244
View File
@@ -43,7 +43,7 @@
</size> </size>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>3</number>
</property> </property>
<widget class="QWidget" name="tab"> <widget class="QWidget" name="tab">
<attribute name="title"> <attribute name="title">
@@ -671,15 +671,6 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</active> </active>
<inactive> <inactive>
<colorrole role="WindowText"> <colorrole role="WindowText">
@@ -709,15 +700,6 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</inactive> </inactive>
<disabled> <disabled>
<colorrole role="WindowText"> <colorrole role="WindowText">
@@ -747,15 +729,6 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</disabled> </disabled>
</palette> </palette>
</property> </property>
@@ -808,15 +781,6 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</active> </active>
<inactive> <inactive>
<colorrole role="WindowText"> <colorrole role="WindowText">
@@ -846,15 +810,6 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</inactive> </inactive>
<disabled> <disabled>
<colorrole role="WindowText"> <colorrole role="WindowText">
@@ -884,15 +839,6 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</disabled> </disabled>
</palette> </palette>
</property> </property>
@@ -948,15 +894,6 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</active> </active>
<inactive> <inactive>
<colorrole role="WindowText"> <colorrole role="WindowText">
@@ -986,15 +923,6 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</inactive> </inactive>
<disabled> <disabled>
<colorrole role="WindowText"> <colorrole role="WindowText">
@@ -1024,15 +952,6 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</disabled> </disabled>
</palette> </palette>
</property> </property>
@@ -1085,15 +1004,6 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</active> </active>
<inactive> <inactive>
<colorrole role="WindowText"> <colorrole role="WindowText">
@@ -1123,15 +1033,6 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</inactive> </inactive>
<disabled> <disabled>
<colorrole role="WindowText"> <colorrole role="WindowText">
@@ -1161,15 +1062,6 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</disabled> </disabled>
</palette> </palette>
</property> </property>
@@ -1222,15 +1114,6 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</active> </active>
<inactive> <inactive>
<colorrole role="WindowText"> <colorrole role="WindowText">
@@ -1260,15 +1143,6 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</inactive> </inactive>
<disabled> <disabled>
<colorrole role="WindowText"> <colorrole role="WindowText">
@@ -1298,15 +1172,6 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</disabled> </disabled>
</palette> </palette>
</property> </property>
@@ -1359,15 +1224,6 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</active> </active>
<inactive> <inactive>
<colorrole role="WindowText"> <colorrole role="WindowText">
@@ -1397,15 +1253,6 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</inactive> </inactive>
<disabled> <disabled>
<colorrole role="WindowText"> <colorrole role="WindowText">
@@ -1435,15 +1282,6 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</disabled> </disabled>
</palette> </palette>
</property> </property>
@@ -1496,15 +1334,6 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</active> </active>
<inactive> <inactive>
<colorrole role="WindowText"> <colorrole role="WindowText">
@@ -1534,15 +1363,6 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</inactive> </inactive>
<disabled> <disabled>
<colorrole role="WindowText"> <colorrole role="WindowText">
@@ -1572,15 +1392,6 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</disabled> </disabled>
</palette> </palette>
</property> </property>
@@ -1633,15 +1444,6 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</active> </active>
<inactive> <inactive>
<colorrole role="WindowText"> <colorrole role="WindowText">
@@ -1671,15 +1473,6 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</inactive> </inactive>
<disabled> <disabled>
<colorrole role="WindowText"> <colorrole role="WindowText">
@@ -1709,15 +1502,6 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</disabled> </disabled>
</palette> </palette>
</property> </property>
@@ -1770,15 +1554,6 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</active> </active>
<inactive> <inactive>
<colorrole role="WindowText"> <colorrole role="WindowText">
@@ -1808,15 +1583,6 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</inactive> </inactive>
<disabled> <disabled>
<colorrole role="WindowText"> <colorrole role="WindowText">
@@ -1846,15 +1612,6 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</disabled> </disabled>
</palette> </palette>
</property> </property>
@@ -2106,6 +1863,13 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<widget class="QLabel" name="lb_warn">
<property name="text">
<string/>
</property>
</widget>
</item>
<item> <item>
<spacer name="verticalSpacer_2"> <spacer name="verticalSpacer_2">
<property name="orientation"> <property name="orientation">
+1 -2
View File
@@ -2746,12 +2746,10 @@ void MainWidget::onPreviewScene()
else else
{ //Y = 0.299*R' + 0.587*G' + 0.114*B //非变量 { //Y = 0.299*R' + 0.587*G' + 0.114*B //非变量
int y = (((rgb&0xff)*299 + ((rgb>>8)&0xff)*587 + ((rgb>>16)&0xff)*114))/1000; int y = (((rgb&0xff)*299 + ((rgb>>8)&0xff)*587 + ((rgb>>16)&0xff)*114))/1000;
//qDebug()<<"y:"<<y;
if(y < 125 ){ if(y < 125 ){
dat[MAX_PRINT_ROW_BYTE_NUM*(i+(sysPara->status.addSpace?i:0)) + j/8] |= 1 << (j%8); //画黑点 dat[MAX_PRINT_ROW_BYTE_NUM*(i+(sysPara->status.addSpace?i:0)) + j/8] |= 1 << (j%8); //画黑点
if((j+1) > sysPara->status.currPrintRow) { if((j+1) > sysPara->status.currPrintRow) {
sysPara->status.currPrintRow = j+1; sysPara->status.currPrintRow = j+1;
//qDebug()<<"dddd currPrintRow:"<< sysPara->status.currPrintRow;
} }
} }
} }
@@ -3024,6 +3022,7 @@ void MainWidget::onPreviewScene()
for(int i = item_x_start_pos; i < item_x_end_pos; i++){ for(int i = item_x_start_pos; i < item_x_end_pos; i++){
for(int j = item_y_start_pos; j < item_y_end_pos; j++){ for(int j = item_y_start_pos; j < item_y_end_pos; j++){
dat[MAX_PRINT_ROW_BYTE_NUM*(i+(sysPara->status.addSpace?0:0)) + j/8] &= ~(1 << (j%8)); //将画点取消掉 dat[MAX_PRINT_ROW_BYTE_NUM*(i+(sysPara->status.addSpace?0:0)) + j/8] &= ~(1 << (j%8)); //将画点取消掉
dat[MAX_PRINT_ROW_BYTE_NUM*(i+(sysPara->status.addSpace?0:0)) + j/8] &= ~(1 << (j%8));
} }
} }
sysPara->status.vars[myvariNum].height = textrx.cap(5).toInt(&ok)-1; sysPara->status.vars[myvariNum].height = textrx.cap(5).toInt(&ok)-1;
+139 -26
View File
@@ -9,7 +9,7 @@
#include "runtimectrl.h" #include "runtimectrl.h"
#include "SysPara.h" #include "SysPara.h"
#define HLPDEBUG // #define HLPDEBUG
RFIDManager::RFIDManager() RFIDManager::RFIDManager()
@@ -123,7 +123,7 @@ void RFIDManager::comForRFID_init()
#ifndef HLPDEBUG #ifndef HLPDEBUG
comForRFID->setPortName("/dev/ttyAS1"); comForRFID->setPortName("/dev/ttyAS1");
#else #else
// comForRFID->setPortName("/dev/ttyUSB0"); // comForRFID->setPortName("/dev/ttyUSB0");
#endif #endif
comForRFID->setPortName("/dev/ttyAS1"); comForRFID->setPortName("/dev/ttyAS1");
@@ -362,6 +362,8 @@ void RFIDManager::initRFIDMoudle(unsigned int addr, SysPara *sysPara)
setRFIDReaderWorkMode(); setRFIDReaderWorkMode();
setRFIDReaderKey(addr,1); setRFIDReaderKey(addr,1);
setICReaderModeFlag = false; setICReaderModeFlag = false;
//报警定时器一定要在初始化之后启动,不然就崩
warningTimer->start(1000);
} }
void RFIDManager::handleCheck(unsigned int addr) void RFIDManager::handleCheck(unsigned int addr)
@@ -369,19 +371,24 @@ void RFIDManager::handleCheck(unsigned int addr)
if(!setICReaderModeFlag) if(!setICReaderModeFlag)
{ {
strRevdata =""; strRevdata ="";
receiveReadRFID_data(); auto res = receiveReadRFID_data();
// LogInfo::setRunStatusText(tr("receiveReadRFID_data res:%1, data:%2")
// .arg(res).arg(strRevdata));
if(strRevdata.length() > 3) if(strRevdata.length() > 3)
{ {
if((strRevdata.left(3) == QString::number(addr).left(3))\ if((strRevdata.left(3) == QString::number(addr).left(3))\
|| strRevdata.left(3) == "100") || strRevdata.left(3) == "100")
{ {
if(strRevdata.at(3) == 'A') { if(strRevdata.at(3) == 'A') {
if(!sysPara->RFIDPara.needInkCard && false){ if (sysPara->RFIDPara.cardInk) {
emit sig_showMsg(tr("已经刷过墨水卡,需添加墨水"));
}
if(!sysPara->RFIDPara.needInkCard){
emit sig_showMsg(tr("不需要刷墨水卡!")); emit sig_showMsg(tr("不需要刷墨水卡!"));
} }
else if(sysPara->status.statWarn & WARN_STATUS_INK_WARN && false){ // else if(sysPara->status.statWarn & WARN_STATUS_INK_WARN){
emit sig_showMsg(tr("请先添加墨水再刷墨水卡!")); // emit sig_showMsg(tr("请先添加墨水再刷墨水卡!"));
} // }
else else
{ {
auto ok = cardTouchConfirm(tr("确认要刷墨水卡吗?"), tr("确认要刷墨水卡吗? %1 秒后将自动确认")); auto ok = cardTouchConfirm(tr("确认要刷墨水卡吗?"), tr("确认要刷墨水卡吗? %1 秒后将自动确认"));
@@ -389,26 +396,23 @@ void RFIDManager::handleCheck(unsigned int addr)
LogInfo::setRunStatusText("The user has canceled the operation about marking the ink card."); LogInfo::setRunStatusText("The user has canceled the operation about marking the ink card.");
} }
else if(RFIDmarkCardUsedAsync(0) == 1){ else if(RFIDmarkCardUsedAsync(0) == 1){
sysPara->RFIDPara.needInkCard = false;
sysPara->RFIDPara.inkCardTimeOut = false;
sysPara->saveRFIDPara();
emit sig_showMsg(tr("刷墨水卡成功!")); emit sig_showMsg(tr("刷墨水卡成功!"));
sysPara->para.inkWarnDate = 0; sysPara->RFIDPara.cardInk = true;
sysPara->para.inkWarnTime = 0; sysPara->saveRFIDPara();
sysPara->saveParaToFile();
} }
} }
} }
else if(strRevdata.at(3) == 'B') else if(strRevdata.at(3) == 'B')
{ {
sysPara->para.flagOfInkWarning = false; if (sysPara->RFIDPara.cardSolvent) {
emit sig_showMsg(tr("已经刷过溶剂卡,需添加溶剂"));
if(!sysPara->RFIDPara.needSolventCard && false){ }
if(!sysPara->RFIDPara.needSolventCard){
emit sig_showMsg(tr("不需要刷溶剂卡!")); emit sig_showMsg(tr("不需要刷溶剂卡!"));
} }
else if(sysPara->status.statWarn & WARN_STATUS_SOLV_WARN && false){ // else if(sysPara->status.statWarn & WARN_STATUS_SOLV_WARN){
emit sig_showMsg(tr("请先添加溶剂再刷溶剂卡!")); // emit sig_showMsg(tr("请先添加溶剂再刷溶剂卡!"));
} // }
else else
{ {
auto ok = cardTouchConfirm(tr("确认要刷溶剂卡吗?"), tr("确认要刷溶剂卡吗? %1 秒后将自动确认")); auto ok = cardTouchConfirm(tr("确认要刷溶剂卡吗?"), tr("确认要刷溶剂卡吗? %1 秒后将自动确认"));
@@ -416,14 +420,9 @@ void RFIDManager::handleCheck(unsigned int addr)
LogInfo::setRunStatusText("The user has canceled the operation about marking the solvent card."); LogInfo::setRunStatusText("The user has canceled the operation about marking the solvent card.");
} }
else if(RFIDmarkCardUsedAsync(1) == 1) { else if(RFIDmarkCardUsedAsync(1) == 1) {
sysPara->RFIDPara.needSolventCard = false;
sysPara->RFIDPara.solventCardTimeOut = false;
sysPara->saveRFIDPara();
emit sig_showMsg(tr("刷溶剂卡成功!")); emit sig_showMsg(tr("刷溶剂卡成功!"));
sysPara->para.flagOfSolventWarning = false; sysPara->RFIDPara.cardSolvent = true;
sysPara->para.solventWarnDate = 0; sysPara->saveRFIDPara();
sysPara->para.solventWarnTime = 0;
sysPara->saveParaToFile();
} }
} }
@@ -899,6 +898,12 @@ void RFIDManager::initTimer()
this, &RFIDManager::slt_timerHandle); this, &RFIDManager::slt_timerHandle);
RFIDTimer->start(10 * 1000); RFIDTimer->start(10 * 1000);
} }
if (warningTimer == nullptr) {
warningTimer = new QTimer(this);
connect(warningTimer, &QTimer::timeout,
this, &RFIDManager::slt_intervalTimerHandle);
}
} }
bool RFIDManager::cardTouchConfirm(QString msgTxt, QString variableMsgTxt) bool RFIDManager::cardTouchConfirm(QString msgTxt, QString variableMsgTxt)
@@ -928,6 +933,91 @@ bool RFIDManager::cardTouchConfirm(QString msgTxt, QString variableMsgTxt)
return box.result() == QMessageBox::Ok || box.result() == QMessageBox::Accepted; return box.result() == QMessageBox::Ok || box.result() == QMessageBox::Accepted;
} }
void RFIDManager::updateStatus()
{
if (sysPara) {
status.addedInk = sysPara->RFIDPara.addedInk;
status.addedSolvent = sysPara->RFIDPara.addedSolvent;
status.cardInk = sysPara->RFIDPara.cardInk;
status.cardSolvent = sysPara->RFIDPara.cardSolvent;
}
}
bool RFIDManager::waitStatus()
{
updateStatus();
bool res = false;
bool inkFlag = !(sysPara->status.statWarn & WARN_STATUS_INK_WARN);
bool solventFlag = !(sysPara->status.statWarn & WARN_STATUS_SOLV_WARN);
if (status.addedInk && status.cardInk) {
if (sysPara && inkFlag) {
sysPara->RFIDPara.needInkCard = false;
sysPara->RFIDPara.inkCardTimeOut = false;
sysPara->RFIDPara.addedInk = false;
sysPara->RFIDPara.cardInk = false;
sysPara->saveRFIDPara();
sysPara->para.inkWarnDate = 0;
sysPara->para.inkWarnTime = 0;
sysPara->para.flagOfInkWarning = false;
sysPara->saveParaToFile();
res = true;
emit sig_showMsg(tr("已取消墨水提示"));
}
} else if (status.addedSolvent && status.cardSolvent) {
if (sysPara && solventFlag) {
sysPara->RFIDPara.needSolventCard = false;
sysPara->RFIDPara.solventCardTimeOut = false;
sysPara->RFIDPara.addedSolvent = false;
sysPara->RFIDPara.cardSolvent = false;
sysPara->saveRFIDPara();
sysPara->para.flagOfSolventWarning = false;
sysPara->para.solventWarnDate = 0;
sysPara->para.solventWarnTime = 0;
sysPara->saveParaToFile();
}
res = true;
emit sig_showMsg(tr("已取消溶剂提示"));
}
return res;
}
bool RFIDManager::waitCard()
{
updateStatus();
bool res = false;
if (status.addedInk) {
if (sysPara && status.cardInk) {
sysPara->RFIDPara.needInkCard = false;
sysPara->RFIDPara.inkCardTimeOut = false;
sysPara->RFIDPara.addedInk = false;
sysPara->RFIDPara.cardInk = false;
sysPara->saveRFIDPara();
sysPara->para.inkWarnDate = 0;
sysPara->para.inkWarnTime = 0;
sysPara->para.flagOfInkWarning = false;
sysPara->saveParaToFile();
res = true;
emit sig_showMsg(tr("先加墨水后刷卡:成功"));
}
} else if (status.addedSolvent) {
if (sysPara && status.cardSolvent) {
sysPara->RFIDPara.needSolventCard = false;
sysPara->RFIDPara.solventCardTimeOut = false;
sysPara->RFIDPara.addedSolvent = false;
sysPara->RFIDPara.cardSolvent = false;
sysPara->saveRFIDPara();
sysPara->para.flagOfSolventWarning = false;
sysPara->para.solventWarnDate = 0;
sysPara->para.solventWarnTime = 0;
sysPara->saveParaToFile();
res = true;
emit sig_showMsg(tr("先加溶剂后刷卡:成功"));
}
}
return res;
}
void RFIDManager::slt_readRFIDData() void RFIDManager::slt_readRFIDData()
{ {
QMutexLocker locker(&m_rfidMutex); QMutexLocker locker(&m_rfidMutex);
@@ -956,4 +1046,27 @@ void RFIDManager::slt_timerHandle()
} }
} }
static int totalTime = 0;
void RFIDManager::slt_intervalTimerHandle()
{
// QString type = curType == INK? "ink" : "solvent";
// if (totalTime % 5 == 0) // 提醒频率定为5s一次,后续可能加界面显示
// LogInfo::setRunStatusText(tr("定时器运行中,curType:%1, cardFlag:%2, time:%3")
// .arg(type).arg(cardFlag).arg(totalTime));
// if (waitCard()) {
// LogInfo::setRunStatusText(tr("waitCard sucess, timer stop"));
//// totalTime = 0;
// return;
// }
//不需要通知先后,成功即可
if (waitStatus()) {
LogInfo::setRunStatusText(tr("sucess"));
// totalTime = 0;
return;
}
}
+27
View File
@@ -8,6 +8,25 @@
#include <QMutex> #include <QMutex>
class SysPara; class SysPara;
enum CARD_TYPE{
INK = 1,
SOLVENT = 2,
MAINTENANCE = 3,
};
struct StatuStruct
{
bool addedInk;
bool addedSolvent;
bool cardInk;
bool cardSolvent;
StatuStruct() {
addedInk = false;
addedSolvent = false;
cardInk = false;
cardSolvent = false;
}
};
typedef unsigned char UCHAR; typedef unsigned char UCHAR;
class RFIDManager : public QObject class RFIDManager : public QObject
@@ -67,6 +86,12 @@ private:
bool cardTouchConfirm(QString msgTxt, QString variableMsgTxt); bool cardTouchConfirm(QString msgTxt, QString variableMsgTxt);
//刷卡新需求,刷卡和倒溶剂/墨水不分先后,都可以去除报警提示。
StatuStruct status;
void updateStatus();
QTimer* warningTimer = nullptr;
bool waitStatus();
bool waitCard();
signals: signals:
void sig_showMsg(QString msg); void sig_showMsg(QString msg);
@@ -79,6 +104,8 @@ private slots:
//超时处理槽函数 //超时处理槽函数
void slt_timerHandle(); void slt_timerHandle();
//处理刷卡与溶剂/墨水报警标志
void slt_intervalTimerHandle();
}; };
#endif // RFIDMANAGER_H #endif // RFIDMANAGER_H
+1 -1
View File
@@ -127,7 +127,7 @@ void RunTimeCtrl::loadConfig(RFIDPara_t* para)
para->runTime = 0; para->runTime = 0;
para->maintenanceHours = 3000; para->maintenanceHours = 3000;
} }
// 结束维护的天数 // 结束维护的天数maintenanceEndDate = 刷卡日期+维护月份
QString mtEndDatestr = "20" + QString::number(para->maintenanceEndDate); QString mtEndDatestr = "20" + QString::number(para->maintenanceEndDate);
QDate mtEndDate = QDate::fromString(mtEndDatestr,"yyyyMMdd"); QDate mtEndDate = QDate::fromString(mtEndDatestr,"yyyyMMdd");
timeoutDay = curDate.daysTo(mtEndDate); timeoutDay = curDate.daysTo(mtEndDate);
+2 -2
View File
@@ -63,7 +63,7 @@ private:
QTimer *m_checkTimer = nullptr; // 检查计时器 QTimer *m_checkTimer = nullptr; // 检查计时器
QTimer *m_alertTimer = nullptr; // 提示计时器 QTimer *m_alertTimer = nullptr; // 提示计时器
QTimer *m_runTimer = nullptr; // 运行计时器,记录运行时间和更新总时间 QTimer *m_runTimer = nullptr; // 运行计时器,记录运行时间和更新总时间
int m_alertIntervalMinutes = 180; // 提示间隔(分钟) int m_alertIntervalMinutes = 60; // 提示间隔(分钟)
bool m_isAlter = false; // 启动提示计时器标志 bool m_isAlter = false; // 启动提示计时器标志
quint64 m_elapsedSeconds = 0; // 本次运行的时间 quint64 m_elapsedSeconds = 0; // 本次运行的时间
quint64 m_totalSeconds = 0; // 总运行时间 30s更新一次 quint64 m_totalSeconds = 0; // 总运行时间 30s更新一次
@@ -71,7 +71,7 @@ private:
// todo 后续一个相关功能建立一个结构体和独立定时器 // todo 后续一个相关功能建立一个结构体和独立定时器
RFIDPara_t m_para; RFIDPara_t m_para;
int timeoutDay = 0; int timeoutDay = 0; // 当前日期到维护结束日期的天数
void init(); void init();
+451 -413
View File
File diff suppressed because it is too large Load Diff
+451 -413
View File
File diff suppressed because it is too large Load Diff
+451 -413
View File
File diff suppressed because it is too large Load Diff
+451 -413
View File
File diff suppressed because it is too large Load Diff