2026年5月23日暂存

This commit is contained in:
2026-05-23 14:16:57 +08:00
parent c8a5a121c9
commit 1cb9d5ac42
59 changed files with 15774 additions and 8662 deletions
+53
View File
@@ -377,6 +377,59 @@ void CounterVarSet::applyStyleSheet()
box-shadow: 0 -3px 8px rgba(44, 125, 232, 0.25);
}
QRadioButton::indicator {
width: 25px;
height: 25px;
}
QSpinBox::down-button {
width: 23px; /* 图标显示宽度 */
height: 23px; /* 图标显示高度 */
border: 1px solid #333333;
border-radius: 3px;
background-color: #5396C1;
}
QSpinBox::down-arrow {
image: url(image/down_white.png);
height: 18px;
width: 18px;
}
QSpinBox::up-button {
width: 23px; /* 图标显示宽度 */
height: 23px; /* 图标显示高度 */
border: 1px solid #333333;
border-radius: 3px;
background-color: #5396C1;
}
QSpinBox::up-arrow {
image: url(image/up_white.png);
height: 18px;
width: 18px;
}
QSpinBox {
border: 1px solid #333333;
}
QCheckBox {
color: #000000;
}
QCheckBox::indicator {
width: 15px;
height: 15px;
border: 1px solid #96A0A9;
border-radius: 8px;
background-color: #ffffff;
}
QCheckBox::indicator:checked {
background-color: #95B2D4;
border-color: #95B2D4;
}
)";
this->setStyleSheet(styleSheet);
+13 -9
View File
@@ -3642,16 +3642,19 @@ void DevOp::comForRFID_init(void)
comForRFID->setPortName("/dev/ttyUSB0");
#endif
LogInfo::setRunStatusText("RFID port dev name: " + comForRFID->portName());
comForRFID->setBaudRate(9600);
comForRFID->setDataBits(QSerialPort::Data8);
comForRFID->setParity(QSerialPort::NoParity);
comForRFID->setStopBits(QSerialPort::OneStop);
comForRFID->setFlowControl(QSerialPort::NoFlowControl);
if (comForRFID->open(QIODevice::ReadWrite)) {
qDebug() << "RFID串口打开成功";
qInfo() << "RFID串口打开成功";
connect(comForRFID,SIGNAL(readyRead()),this,SLOT(readRFIDData()));
LogInfo::setRunStatusText("Successed to open RFID port");
} else {
qDebug() << "RFID串口打开失败: " << comForRFID->errorString();
LogInfo::setRunStatusText("Failed to open RFID port");
}
}
@@ -3710,7 +3713,7 @@ int DevOp::comReadRFID_data()
//CardDataRwLock.lockForWrite();
strRevdata = QString((const char*)temp);
// CardDataRwLock.unlock();
qDebug() << "读数据块成功,数据块6" << "数据为:" << temp << endl << endl;
// qDebug() << "读数据块成功,数据块6" << "数据为:" << temp << endl << endl;
return 1;
}
}
@@ -3807,6 +3810,7 @@ int DevOp::RFIDmarkCardUsedAsync(int type)
qDebug()<<"Cmd["<<i+6<<"]: "<<Cmd[i+6];
}
//
if(type == 0) {
Cmd[6] = 0x10;
Cmd[7] = 0x0A;
@@ -3908,7 +3912,7 @@ int DevOp::setRFIDCarKey(void)
}
MySleep(200);
int n = RFIDReadData.size();
if(n>0)
if(n>2)
{
recResponse = RFIDReadData;
RFIDReadData.clear();
@@ -4015,7 +4019,7 @@ int DevOp::setRFIDReaderKey(int mac,int type)
}
QElapsedTimer elapsedTimer;
elapsedTimer.start();
while(comForRFID->bytesAvailable() < 8 && !elapsedTimer.hasExpired(2000)) {
while(comForRFID->bytesAvailable() < 8 && !elapsedTimer.hasExpired(20000)) {
QApplication::processEvents(QEventLoop::AllEvents, 100);
}
@@ -4025,7 +4029,7 @@ int DevOp::setRFIDReaderKey(int mac,int type)
connect(comForRFID, &QSerialPort::readyRead, this, &DevOp::readRFIDData);
if(n < 8) {
qDebug() << "读取数据失败, 数据长度不足8字节" << endl << endl;
LogInfo::setRunStatusText(u8"读取数据失败, 数据长度不足8字节");
return -3;
}
@@ -4088,7 +4092,7 @@ int DevOp::setRFIDReaderOriginalKey(void)
}
MySleep(200);
int n = RFIDReadData.size();
if(n>0)
if(n>2)
{
recResponse = RFIDReadData;
RFIDReadData.clear();
@@ -4151,7 +4155,7 @@ int DevOp::setRFIDReaderWorkMode(void)
QElapsedTimer elapsedTimer;
elapsedTimer.start();
while(comForRFID->bytesAvailable() < 8 && !elapsedTimer.hasExpired(2000)) {
while(comForRFID->bytesAvailable() < 8 && !elapsedTimer.hasExpired(20000)) {
QApplication::processEvents(QEventLoop::AllEvents, 100);
}
@@ -4161,7 +4165,7 @@ int DevOp::setRFIDReaderWorkMode(void)
connect(comForRFID, &QSerialPort::readyRead, this, &DevOp::readRFIDData);
if(n < 8) {
qDebug() << "读取数据失败, 数据长度不足8字节" << endl << endl;
LogInfo::setRunStatusText(u8"读取数据失败, 数据长度不足8字节");
return -2;
}
@@ -4272,7 +4276,7 @@ int DevOp::queryReadRFID_address(void)
UCHAR revdata[100] = {0};
if(n > (int)sizeof(revdata)) n = sizeof(revdata);
memcpy(revdata, RFIDReadData.constData(), n);
if(n>0)
if(n>4)
{
showData(RFIDReadData);
if(CheckSumIn(revdata, revdata[1]) == false){
-1
View File
@@ -226,7 +226,6 @@ public :
/**
* @brief 向卡片写入当前日期时间,标识该卡片已被使用
* @param done 异步回调函数,用于处理写入完成后的操作,参数为写入结果,0表示成功,-1表示卡片已经离开
*/
int RFIDmarkCardUsedAsync(int type = 0);
int setRFIDCarKey(void);
-2
View File
@@ -6,8 +6,6 @@ DlgRFIDConfig::DlgRFIDConfig(QWidget *parent) :
ui(new Ui::DlgRFIDConfig)
{
ui->setupUi(this);
setWindowFlags(windowFlags() | Qt::Tool | Qt::FramelessWindowHint | Qt::BypassWindowManagerHint);
}
DlgRFIDConfig::~DlgRFIDConfig()
+423
View File
@@ -0,0 +1,423 @@
#include "DlgVoltePara25Dots.h"
#include "DevOp.h"
#include <QHeaderView>
#include <QIntValidator>
#include <QLineEdit>
#include <QScrollArea>
DlgVoltePara25Dots::DlgVoltePara25Dots(DevOp *devOp, QWidget *parent)
: QDialog(parent)
, m_devOp(devOp)
, tableSingleDot1(nullptr)
, tableSingleDotFirst1(nullptr)
, table2Dots(nullptr)
, table3Dots(nullptr)
, table4Dots(nullptr)
, table5Dots(nullptr)
, tableContinuous(nullptr)
, tableDiffVoltage(nullptr)
, tableExtraLine(nullptr)
, tableFirstOnePointExtra(nullptr)
, tableAdjustPara(nullptr)
, tableGiantPoint(nullptr)
{
setupUI();
}
DlgVoltePara25Dots::~DlgVoltePara25Dots()
{
}
// 创建通用表格
QTableWidget* DlgVoltePara25Dots::createTable(int rows, int cols, int minVal, int maxVal)
{
QTableWidget *table = new QTableWidget(rows, cols, this);
table->setMinimumHeight(200);
// 设置行头(通道编号)
QStringList rowHeaders;
for (int i = 0; i < rows; i++) {
rowHeaders << QString::number(i);
}
table->setVerticalHeaderLabels(rowHeaders);
// 设置列头(点序号)
QStringList colHeaders;
for (int i = 0; i < cols; i++) {
if (cols == 1)
colHeaders << QString("值");
else
colHeaders << QString("点%1").arg(i + 1);
}
table->setHorizontalHeaderLabels(colHeaders);
// 初始化所有单元格为 0
for (int r = 0; r < rows; r++) {
for (int c = 0; c < cols; c++) {
QTableWidgetItem *item = new QTableWidgetItem("0");
item->setTextAlignment(Qt::AlignCenter);
table->setItem(r, c, item);
}
}
// 设置行高适配触屏
table->verticalHeader()->setDefaultSectionSize(30);
table->horizontalHeader()->setDefaultSectionSize(60);
Q_UNUSED(minVal);
Q_UNUSED(maxVal);
return table;
}
void DlgVoltePara25Dots::setupUI()
{
setWindowTitle(QString("25点阵充电参数编辑"));
resize(800, 600);
QVBoxLayout *mainLayout = new QVBoxLayout(this);
mainLayout->setContentsMargins(4, 4, 4, 4);
mainLayout->setSpacing(4);
// 选项卡
tabWidget = new QTabWidget(this);
tabWidget->addTab(createTab_SingleDot(), QString("单点"));
tabWidget->addTab(createTab_2Dots(), QString("2点连续"));
tabWidget->addTab(createTab_3Dots(), QString("3点连续"));
tabWidget->addTab(createTab_4Dots(), QString("4点连续"));
tabWidget->addTab(createTab_5Dots(), QString("5点连续"));
tabWidget->addTab(createTab_Continuous(), QString("连续点"));
tabWidget->addTab(createTab_DiffVoltage(), QString("差分补偿"));
tabWidget->addTab(createTab_ExtraLine(), QString("行补偿"));
tabWidget->addTab(createTab_GiantPoint(), QString("巨点补偿"));
mainLayout->addWidget(tabWidget);
// 底部按钮栏
QHBoxLayout *btnLayout = new QHBoxLayout();
btnLoad = new QPushButton(QString("读取当前值"), this);
btnSave = new QPushButton(QString("保存并推送FPGA"), this);
btnLoad->setMinimumHeight(40);
btnSave->setMinimumHeight(40);
btnLayout->addWidget(btnLoad);
btnLayout->addStretch();
btnLayout->addWidget(btnSave);
mainLayout->addLayout(btnLayout);
connect(btnLoad, SIGNAL(clicked()), this, SLOT(onBtnLoadClicked()));
connect(btnSave, SIGNAL(clicked()), this, SLOT(onBtnSaveClicked()));
}
// ========== 选项卡创建 ==========
QWidget* DlgVoltePara25Dots::createTab_SingleDot()
{
QWidget *page = new QWidget(this);
QVBoxLayout *layout = new QVBoxLayout(page);
QLabel *label1 = new QLabel(QString("单点 DAC (matchTotalTableDACArray1)"), page);
tableSingleDot1 = createTable(64, 1, 0, 65535);
layout->addWidget(label1);
layout->addWidget(tableSingleDot1);
QLabel *label2 = new QLabel(QString("首单点 DAC (matchTotalTableDACArrayFirst1)"), page);
tableSingleDotFirst1 = createTable(64, 1, 0, 65535);
layout->addWidget(label2);
layout->addWidget(tableSingleDotFirst1);
return page;
}
QWidget* DlgVoltePara25Dots::createTab_2Dots()
{
QWidget *page = new QWidget(this);
QVBoxLayout *layout = new QVBoxLayout(page);
table2Dots = createTable(64, 2, 0, 65535);
layout->addWidget(table2Dots);
return page;
}
QWidget* DlgVoltePara25Dots::createTab_3Dots()
{
QWidget *page = new QWidget(this);
QVBoxLayout *layout = new QVBoxLayout(page);
table3Dots = createTable(64, 3, 0, 65535);
layout->addWidget(table3Dots);
return page;
}
QWidget* DlgVoltePara25Dots::createTab_4Dots()
{
QWidget *page = new QWidget(this);
QVBoxLayout *layout = new QVBoxLayout(page);
table4Dots = createTable(64, 4, 0, 65535);
layout->addWidget(table4Dots);
return page;
}
QWidget* DlgVoltePara25Dots::createTab_5Dots()
{
QWidget *page = new QWidget(this);
QVBoxLayout *layout = new QVBoxLayout(page);
table5Dots = createTable(64, 5, 0, 65535);
layout->addWidget(table5Dots);
return page;
}
QWidget* DlgVoltePara25Dots::createTab_Continuous()
{
QWidget *page = new QWidget(this);
QVBoxLayout *layout = new QVBoxLayout(page);
QLabel *label = new QLabel(QString("连续点 DAC (matchContinousDACArray)"), page);
tableContinuous = createTable(64, 1, 0, 65535);
layout->addWidget(label);
layout->addWidget(tableContinuous);
return page;
}
QWidget* DlgVoltePara25Dots::createTab_DiffVoltage()
{
QWidget *page = new QWidget(this);
QVBoxLayout *layout = new QVBoxLayout(page);
QLabel *label = new QLabel(QString("差分电压补偿 (matchTotalDiffVoltageValue) [50×64]"), page);
tableDiffVoltage = createTable(50, 64, -128, 127);
layout->addWidget(label);
layout->addWidget(tableDiffVoltage);
return page;
}
QWidget* DlgVoltePara25Dots::createTab_ExtraLine()
{
QWidget *page = new QWidget(this);
QVBoxLayout *layout = new QVBoxLayout(page);
QLabel *label1 = new QLabel(QString("额外行补偿 (matchExtraLineDACArray)"), page);
tableExtraLine = createTable(64, 1, 0, 255);
layout->addWidget(label1);
layout->addWidget(tableExtraLine);
QLabel *label2 = new QLabel(QString("首单点行补偿 (matchFirstOnePointExtraLineDACArray)"), page);
tableFirstOnePointExtra = createTable(64, 1, -128, 127);
layout->addWidget(label2);
layout->addWidget(tableFirstOnePointExtra);
return page;
}
QWidget* DlgVoltePara25Dots::createTab_GiantPoint()
{
QWidget *page = new QWidget(this);
QVBoxLayout *layout = new QVBoxLayout(page);
QLabel *label1 = new QLabel(QString("巨点调整参数 (matchAdjustParaDACArray) [8]"), page);
tableAdjustPara = createTable(8, 1, -128, 127);
layout->addWidget(label1);
layout->addWidget(tableAdjustPara);
QLabel *label2 = new QLabel(QString("巨点电压补偿 (matchGiantPointVoltageValue) [16×64]"), page);
tableGiantPoint = createTable(16, 64, -128, 127);
layout->addWidget(label2);
layout->addWidget(tableGiantPoint);
return page;
}
// ========== 数据加载:结构体 → UI ==========
void DlgVoltePara25Dots::loadDataToUI()
{
if (!sysPara) return;
voltePara_t_25Dots &data = sysPara->voltePara_25Dots;
// matchTotalTableDACArray1[64]
for (int i = 0; i < 64; i++) {
tableSingleDot1->item(i, 0)->setText(QString::number(data.matchTotalTableDACArray1[i]));
}
// matchTotalTableDACArrayFirst1[64]
for (int i = 0; i < 64; i++) {
tableSingleDotFirst1->item(i, 0)->setText(QString::number(data.matchTotalTableDACArrayFirst1[i]));
}
// matchTotalTableDACArray2[64][2]
for (int i = 0; i < 64; i++) {
for (int j = 0; j < 2; j++) {
table2Dots->item(i, j)->setText(QString::number(data.matchTotalTableDACArray2[i][j]));
}
}
// matchTotalTableDACArray3[64][3]
for (int i = 0; i < 64; i++) {
for (int j = 0; j < 3; j++) {
table3Dots->item(i, j)->setText(QString::number(data.matchTotalTableDACArray3[i][j]));
}
}
// matchTotalTableDACArray4[64][4]
for (int i = 0; i < 64; i++) {
for (int j = 0; j < 4; j++) {
table4Dots->item(i, j)->setText(QString::number(data.matchTotalTableDACArray4[i][j]));
}
}
// matchTotalTableDACArray5[64][5]
for (int i = 0; i < 64; i++) {
for (int j = 0; j < 5; j++) {
table5Dots->item(i, j)->setText(QString::number(data.matchTotalTableDACArray5[i][j]));
}
}
// matchContinousDACArray[64]
for (int i = 0; i < 64; i++) {
tableContinuous->item(i, 0)->setText(QString::number(data.matchContinousDACArray[i]));
}
// matchTotalDiffVoltageValue[50][64]
for (int i = 0; i < 50; i++) {
for (int j = 0; j < 64; j++) {
tableDiffVoltage->item(i, j)->setText(QString::number((qint8)data.matchTotalDiffVoltageValue[i][j]));
}
}
// matchExtraLineDACArray[64]
for (int i = 0; i < 64; i++) {
tableExtraLine->item(i, 0)->setText(QString::number(data.matchExtraLineDACArray[i]));
}
// matchFirstOnePointExtraLineDACArray[64]
for (int i = 0; i < 64; i++) {
tableFirstOnePointExtra->item(i, 0)->setText(QString::number((qint8)data.matchFirstOnePointExtraLineDACArray[i]));
}
// matchAdjustParaDACArray[8]
for (int i = 0; i < 8; i++) {
tableAdjustPara->item(i, 0)->setText(QString::number((qint8)data.matchAdjustParaDACArray[i]));
}
// matchGiantPointVoltageValue[16][64]
for (int i = 0; i < 16; i++) {
for (int j = 0; j < 64; j++) {
tableGiantPoint->item(i, j)->setText(QString::number((qint8)data.matchGiantPointVoltageValue[i][j]));
}
}
}
// ========== 数据保存:UI → 结构体 ==========
void DlgVoltePara25Dots::saveDataFromUI()
{
if (!sysPara) return;
voltePara_t_25Dots &data = sysPara->voltePara_25Dots;
// matchTotalTableDACArray1[64]
for (int i = 0; i < 64; i++) {
data.matchTotalTableDACArray1[i] = (quint16)tableSingleDot1->item(i, 0)->text().toUInt();
}
// matchTotalTableDACArrayFirst1[64]
for (int i = 0; i < 64; i++) {
data.matchTotalTableDACArrayFirst1[i] = (quint16)tableSingleDotFirst1->item(i, 0)->text().toUInt();
}
// matchTotalTableDACArray2[64][2]
for (int i = 0; i < 64; i++) {
for (int j = 0; j < 2; j++) {
data.matchTotalTableDACArray2[i][j] = (quint16)table2Dots->item(i, j)->text().toUInt();
}
}
// matchTotalTableDACArray3[64][3]
for (int i = 0; i < 64; i++) {
for (int j = 0; j < 3; j++) {
data.matchTotalTableDACArray3[i][j] = (quint16)table3Dots->item(i, j)->text().toUInt();
}
}
// matchTotalTableDACArray4[64][4]
for (int i = 0; i < 64; i++) {
for (int j = 0; j < 4; j++) {
data.matchTotalTableDACArray4[i][j] = (quint16)table4Dots->item(i, j)->text().toUInt();
}
}
// matchTotalTableDACArray5[64][5]
for (int i = 0; i < 64; i++) {
for (int j = 0; j < 5; j++) {
data.matchTotalTableDACArray5[i][j] = (quint16)table5Dots->item(i, j)->text().toUInt();
}
}
// matchContinousDACArray[64]
for (int i = 0; i < 64; i++) {
data.matchContinousDACArray[i] = (quint16)tableContinuous->item(i, 0)->text().toUInt();
}
// matchTotalDiffVoltageValue[50][64]
for (int i = 0; i < 50; i++) {
for (int j = 0; j < 64; j++) {
data.matchTotalDiffVoltageValue[i][j] = (qint8)tableDiffVoltage->item(i, j)->text().toInt();
}
}
// matchExtraLineDACArray[64]
for (int i = 0; i < 64; i++) {
data.matchExtraLineDACArray[i] = (quint8)tableExtraLine->item(i, 0)->text().toUInt();
}
// matchFirstOnePointExtraLineDACArray[64]
for (int i = 0; i < 64; i++) {
data.matchFirstOnePointExtraLineDACArray[i] = (qint8)tableFirstOnePointExtra->item(i, 0)->text().toInt();
}
// matchAdjustParaDACArray[8]
for (int i = 0; i < 8; i++) {
data.matchAdjustParaDACArray[i] = (qint8)tableAdjustPara->item(i, 0)->text().toInt();
}
// matchGiantPointVoltageValue[16][64]
for (int i = 0; i < 16; i++) {
for (int j = 0; j < 64; j++) {
data.matchGiantPointVoltageValue[i][j] = (qint8)tableGiantPoint->item(i, j)->text().toInt();
}
}
}
// ========== 按钮槽函数 ==========
void DlgVoltePara25Dots::onBtnLoadClicked()
{
loadDataToUI();
}
void DlgVoltePara25Dots::onBtnSaveClicked()
{
int ret = QMessageBox::question(this,
QString("确认"),
QString("确定要将修改后的充电参数写入FPGA吗?"),
QMessageBox::Yes | QMessageBox::No,
QMessageBox::No);
if (ret != QMessageBox::Yes)
return;
saveDataFromUI();
if (m_devOp) {
m_devOp->writeDacValue2Fpga_No72NewVoltData();
}
QMessageBox::information(this, QString("完成"), QString("充电参数已保存并推送至FPGA。"));
}
+70
View File
@@ -0,0 +1,70 @@
#ifndef DLGVOLTEPARA25DOTS_H
#define DLGVOLTEPARA25DOTS_H
#include <QDialog>
#include <QTabWidget>
#include <QTableWidget>
#include <QPushButton>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QLabel>
#include <QMessageBox>
#include "ParaSettingUI.h"
class DevOp;
class DlgVoltePara25Dots : public QDialog, public ParaSettingUI
{
Q_OBJECT
public:
explicit DlgVoltePara25Dots(DevOp *devOp, QWidget *parent = nullptr);
~DlgVoltePara25Dots();
public slots:
void onBtnLoadClicked();
void onBtnSaveClicked();
private:
void setupUI();
// 创建各选项卡
QWidget* createTab_SingleDot();
QWidget* createTab_2Dots();
QWidget* createTab_3Dots();
QWidget* createTab_4Dots();
QWidget* createTab_5Dots();
QWidget* createTab_Continuous();
QWidget* createTab_DiffVoltage();
QWidget* createTab_ExtraLine();
QWidget* createTab_GiantPoint();
// 辅助方法
QTableWidget* createTable(int rows, int cols, int minVal, int maxVal);
void loadDataToUI();
void saveDataFromUI();
// UI 控件
QTabWidget *tabWidget;
QPushButton *btnLoad;
QPushButton *btnSave;
// DevOp 指针,用于调用 writeDacValue2Fpga_No72NewVoltData
DevOp *m_devOp;
// 各选项卡的表格指针
QTableWidget *tableSingleDot1; // matchTotalTableDACArray1[64]
QTableWidget *tableSingleDotFirst1; // matchTotalTableDACArrayFirst1[64]
QTableWidget *table2Dots; // matchTotalTableDACArray2[64][2]
QTableWidget *table3Dots; // matchTotalTableDACArray3[64][3]
QTableWidget *table4Dots; // matchTotalTableDACArray4[64][4]
QTableWidget *table5Dots; // matchTotalTableDACArray5[64][5]
QTableWidget *tableContinuous; // matchContinousDACArray[64]
QTableWidget *tableDiffVoltage; // matchTotalDiffVoltageValue[50][64]
QTableWidget *tableExtraLine; // matchExtraLineDACArray[64]
QTableWidget *tableFirstOnePointExtra; // matchFirstOnePointExtraLineDACArray[64]
QTableWidget *tableAdjustPara; // matchAdjustParaDACArray[8]
QTableWidget *tableGiantPoint; // matchGiantPointVoltageValue[16][64]
};
#endif // DLGVOLTEPARA25DOTS_H
+85 -85
View File
@@ -28,6 +28,7 @@ InkJetPrinter::InkJetPrinter(QWidget* parent)
// 初始化业务逻辑(仅保留原init中的非UI创建部分)
init();
initRunTimeCtrl();
QThread::sleep(3);
qApp->installEventFilter(this);
@@ -95,6 +96,7 @@ void InkJetPrinter::init()
jd_timer->start(500);
msgtest = new QMessageBox(this);
msgtest->setWindowTitle(tr("提示"));
connect(msgtest, SIGNAL(finished(int)), this, SLOT(OnFinished(int)));
// 信号槽连接(原逻辑完全不变)
@@ -278,35 +280,6 @@ void InkJetPrinter::init()
connect(m_QRCodeDlg, &dlgQrCode::sig_qrCodeClose,
m_TestPrintWidget, &TestPrintWidget::slt_QRCodeItemDone);
#ifdef __RFID_CARD
curPowerOnDateTime = QDateTime::currentDateTime();
QDate curDate = QDate::currentDate();
unsigned int curDateInt = curDate.toString("yyMMdd").toInt();
if(sysPara->RFIDPara.maintenanceDate == 0){
sysPara->RFIDPara.maintenanceDate = curDateInt;
sysPara->RFIDPara.maintenanceInterval = 6;
QDate mtEndDate = curDate.addMonths(sysPara->RFIDPara.maintenanceInterval);
sysPara->RFIDPara.maintenanceEndDate = mtEndDate.toString("yyMMdd").toInt();
}
QString mtEndDatestr = "20" + QString::number(sysPara->RFIDPara.maintenanceEndDate);
QDate mtEndDate = QDate::fromString(mtEndDatestr,"yyyyMMdd");
timeoutDay = curDate.daysTo(mtEndDate);
LogInfo::setRunStatusText(tr("mtDate: %1").arg(sysPara->RFIDPara.maintenanceDate));
LogInfo::setRunStatusText(tr("mtInterval: %1").arg(sysPara->RFIDPara.maintenanceInterval));
LogInfo::setRunStatusText(tr("mtEndDate: %1").arg(sysPara->RFIDPara.maintenanceEndDate));
LogInfo::setRunStatusText(tr("mtFlag: %1").arg(sysPara->RFIDPara.needMaintenance));
LogInfo::setRunStatusText(tr("timeoutDay: %1").arg(timeoutDay));
qDebug()<<"mtDate: "<<sysPara->RFIDPara.maintenanceDate;
qDebug()<<"mtInterval: "<<sysPara->RFIDPara.maintenanceInterval;
qDebug()<<"mtEndDate: "<<sysPara->RFIDPara.maintenanceEndDate;
qDebug()<<"mtFlog: "<<sysPara->RFIDPara.needMaintenance;
qDebug()<<"timeoutDay: "<<timeoutDay;
if(timeoutDay <= 0 && !sysPara->RFIDPara.needMaintenance)
sysPara->RFIDPara.needMaintenance = true;
if(timeoutDay <= 30)
sysPara->status.needMaintenanceRemind = true;
#endif
sysPara->status.machineMac = m_MainInstruction->dlgInputAddr->jd.addr;
sysPara->para.rfidCountDown = 5;
}
@@ -354,6 +327,33 @@ void InkJetPrinter::slt_editCounter(CounterViewModel vm)
}
}
void InkJetPrinter::slt_warningMaintenance()
{
// 新逻辑的时间跨度更短,优先判断
if (timeoutDay >= 30) {
double runHours = sysPara->RFIDPara.runTime / 60.0 / 60.0;
double hours = sysPara->RFIDPara.maintenanceHours - runHours;
QString str;
if (hours >= 0) {
str = tr("保养期还有%1小时到期,请及时保养,否则喷码机容易损坏")
.arg(QString::number(hours, 'f', 2));
} else {
hours = hours * (-1);
str = tr("保养期已超过%1小时,请及时保养,否则喷码机容易损坏")
.arg(QString::number(hours, 'f', 2));
}
msgtest->setText(str);
msgtest->show();
// m_MainWidget->setRunStatus(str);
LogInfo::setRunStatusText(str);
return;
} else {
warningHandler(3);
return;
}
}
void InkJetPrinter::enableInkJetTabClick(bool flag){
this->setEnabled(flag);
}
@@ -681,7 +681,6 @@ void InkJetPrinter::timerHandler(void){
if(m_MainWidget->getCurrPrintStatus() != 1){
m_MainWidget->_on_pushButtonPowerOff_pressed(false);
LogInfo::setRunStatusText(tr("测试时间结束,准备关机"));
// m_MainWidget->setRunStatus(tr("测试时间结束,准备关机")); hlp
}
}
if(sysPara->status.selfCheckDone && sysPara->para.Reciclar && test_flag){
@@ -874,9 +873,8 @@ void InkJetPrinter::timerHandler(void){
{
if(!sysPara->status.selfCheckDone && sysPara->status.isPrinting){
sysPara->status.selfCheckDone = true;
// m_MainWidget->updatePrintDisplayLabel();hlp
m_MainWidget->updatePrintDisplayLabel();
// sysPara->status.flagOfAbnormalStatus = true;
// LogInfo::setRunStatusText(tr("打印过程中死机了!!!"));
qDebug()<<"打印过程中死机了!!!";
}
if(!sysPara->status.selfCheckDone)
@@ -888,7 +886,7 @@ void InkJetPrinter::timerHandler(void){
}
/*-----------------------------------------------------*/
if(!sysPara->status.selfCheckCnt) {
LogInfo::setRunStatusText(tr("开始自检,请等待60秒..............."));
LogInfo::setRunStatusText(tr("开始自检,请等待60秒..."));
m_MainWidget->enableReclaimCtrlButton(false);
m_MainWidget->enablePrintButton(false);
sysPara->devOp->mainInkCtrl();
@@ -912,7 +910,6 @@ void InkJetPrinter::timerHandler(void){
LogInfo::setRunStatusText(tr("自检完成!!!"));
m_MainWidget->setRunStatus(tr("自检完成!!!"));
qDebug()<<"自检完成!!!";
// ui->tabPrintSetting->PrintSettingLog();
m_MainWidget->enableReclaimCtrlButton(true);
sysPara->devOp->mainInkCtrl();
sysPara->status.canRunAirPushing = true;
@@ -922,7 +919,6 @@ void InkJetPrinter::timerHandler(void){
}
else {
if((sysPara->status.selfCheckCnt % 200) == 0)
// sysPara->devOp->controlReclaimTankOpen(false);
m_MainWidget->enableReclaimCtrlButton(false);
}
@@ -1032,7 +1028,7 @@ void InkJetPrinter::timerHandler(void){
sysPara->saveRFIDPara();
msgtest->setText(tr("刷墨水卡成功!"));
msgtest->show();
// m_MainWidget->setRunStatus(tr("刷墨水卡成功!")); hlp
m_MainWidget->setRunStatus(tr("刷墨水卡成功!"));
LogInfo::setRunStatusText(tr("刷墨水卡成功!"));
qDebug()<<"刷墨水卡成功";
sysPara->para.flagOfInkWarning = false;
@@ -1070,7 +1066,7 @@ void InkJetPrinter::timerHandler(void){
sysPara->saveRFIDPara();
msgtest->setText(tr("刷溶剂卡成功!"));
msgtest->show();
// m_MainWidget->setRunStatus(tr("刷溶剂卡成功!")); hlp
m_MainWidget->setRunStatus(tr("刷溶剂卡成功!"));
LogInfo::setRunStatusText(tr("刷溶剂卡成功!"));
qDebug()<<"刷溶剂卡成功";
sysPara->para.flagOfSolventWarning = false;
@@ -1092,14 +1088,15 @@ void InkJetPrinter::timerHandler(void){
sysPara->RFIDPara.needMaintenance = false;
sysPara->status.needMaintenanceRemind = false;
QDate curDate = QDate::currentDate();
sysPara->RFIDPara.maintenanceDate = curDate.toString("yyMMdd").toInt();
QDate mtEndDate = curDate.addMonths(sysPara->RFIDPara.maintenanceInterval);
sysPara->RFIDPara.maintenanceEndDate = mtEndDate.toString("yyMMdd").toInt();
sysPara->RFIDPara.runTime = 0;
ctrl_runTime->updatePara(&sysPara->RFIDPara);
sysPara->saveRFIDPara();
// msgtest->setText(tr("刷保养卡成功!"));
// msgtest->show();
// m_MainWidget->setRunStatus(tr("刷保养卡成功!")); hlp
m_MainWidget->setRunStatus(tr("刷保养卡成功!"));
LogInfo::setRunStatusText(tr("刷保养卡成功!"));
qDebug()<<"刷保养卡成功";
}
@@ -1121,7 +1118,7 @@ void InkJetPrinter::timerHandler(void){
}
else
{
LogInfo::setRunStatusText(tr("card data: %1").arg(sysPara->devOp->strRevdata));
// LogInfo::setRunStatusText(tr("card data: %1").arg(sysPara->devOp->strRevdata));
QString str1 = QString::number(sysPara->devOp->strRevdata.mid(0,2).toInt(0,16)).rightJustified(2,'0');
QString str2 =QString::number(sysPara->devOp->strRevdata.mid(2,2).toInt(0,16)).rightJustified(2,'0');
QString str3 = QString::number(sysPara->devOp->strRevdata.mid(4,2).toInt(0,16)).rightJustified(2,'0');
@@ -1253,8 +1250,9 @@ void InkJetPrinter::timerHandler(void){
}
#ifdef __RFID_CARD
// hlp 0513 :甲方要求提示越来越频繁
if(sysPara->status.needMaintenanceRemind){
warningHandler(3);
// warningHandler(3);
}
static bool logFlagCard1 = 1;
if(!sysPara->para.flagOfInkWarning){
@@ -1379,7 +1377,7 @@ void InkJetPrinter::timerHandler(void){
sysPara->status.beeperOnFlag = true;
if(sysPara->status.gearPumpRunStopFlag && pushButtonStartFlag)
{
// m_MainWidget->setRunStatus(tr("压力泄漏或压力传感器故障!")); hlp
m_MainWidget->setRunStatus(tr("压力泄漏或压力传感器故障!"));
}
if(!resumeFlag)
{
@@ -1839,16 +1837,16 @@ void InkJetPrinter::slt_counterVarUpdate()
// m_TestPrintWidget->onEditItemCounterDone();
}
void InkJetPrinter::showScheduleShiftsEditor(PicScheduleShiftItem* item)
void InkJetPrinter::showScheduleShiftsEditor(QVector<ScheduleModel> schedules, TextItemModel txtModel)
{
m_StackedWidget->setCurrentWidget(m_scheduleShiftsEditor);
m_scheduleShiftsEditor->edit(item);
m_scheduleShiftsEditor->setItemModel(schedules, txtModel);
}
void InkJetPrinter::onScheduleShiftsEditDone()
{
m_StackedWidget->setCurrentWidget(m_TestPrintWidget);
m_TestPrintWidget->addScheduleShiftsItem(m_scheduleShiftsEditor->dataModel());
m_TestPrintWidget->addScheduleShiftsItem(m_scheduleShiftsEditor->scheduleModel(), m_scheduleShiftsEditor->textItemModel());
}
bool InkJetPrinter::eventFilter(QObject *watched, QEvent *event)
@@ -1897,7 +1895,7 @@ void InkJetPrinter::saveFPGAStatus(unsigned char *data){
}
if(sysPara->status.dummy != sysPara->status.isPrinting){
sysPara->status.isPrinting = sysPara->status.dummy;
// m_MainWidget->updatePrintDisplayLabel(); hlp
m_MainWidget->updatePrintDisplayLabel();
}
}
@@ -2500,21 +2498,15 @@ void InkJetPrinter::detectAndcontrolReclaimTank(){
sysPara->status.reclaimTankBlockedAppending =0;
if(sysPara->status.reclaimTankstatus == 0x10) //7 故障,6 关完成,5开完成,4 保持, 3 停止, 2 关, 1 开,0-无操作
{
LogInfo::setRunStatusText(tr("电机故障"));
m_MainWidget->setRunStatus(tr("电机故障"));
if(sysPara->devOp->isReclaimTankCloseEnable())
{
LogInfo::setRunStatusText(tr("电机故障"));
// m_MainWidget->setRunStatus(tr("电机故障")); hlp
sysPara->devOp->controlReclaimTankClose(false);
// ui->tabMainWindow->resetReclaimCtrlButtonText();
// emit reclaimTankBlock();
}
else {
LogInfo::setRunStatusText(tr("电机故障"));
// m_MainWidget->setRunStatus(tr("电机故障!!!")); hlp
if(sysPara->devOp->isReclaimTankOpenEnable())
sysPara->devOp->controlReclaimTankOpen(false);
// ui->tabMainWindow->resetReclaimCtrlButtonText();
// emit reclaimTankBlock();
}
}
@@ -2523,10 +2515,9 @@ void InkJetPrinter::detectAndcontrolReclaimTank(){
if(sysPara->devOp->isReclaimTankOpenEnable())
sysPara->devOp->controlReclaimTankOpen(false); //到头,关闭
sysPara->status.reclainTankReachEnd = true;
/*应要求去掉多余到信息 LogInfo::setRunStatusText(tr("回收槽到头"));*/
m_MainWidget->setRunStatus(tr("回收槽到头"));
// m_MainWidget->setRunStatus(tr("回收槽到头"));
m_MainWidget->setReclaimStatus(true, 100);
m_MainWidget->enablePrintButton(true); //仅仅在此时能使能打印按钮
// ui->tabMainWindow->resetReclaimCtrlButtonText();
sysPara->devOp->highVoltageCtrl(1);
// emit reclaimTankOpenDone();
/*回收槽开关时间校正*/
@@ -2539,14 +2530,10 @@ void InkJetPrinter::detectAndcontrolReclaimTank(){
else if(sysPara->status.reclaimTankstatus == 0x11 )//7 故障,6 关完成,5开完成,4 保持, 3 停止, 2 关, 1 开,0-无操作
{
sysPara->devOp->controlReclaimTankOpen(false); //卡住,关闭
// ui->tabMainWindow->resetReclaimCtrlButtonText();
// LogInfo::setRunStatusText(tr("回收槽卡住或者回收槽开关时间设置错误"));
// ui->tabMainWindow->setRunStatus(tr("回收槽卡住或者回收槽开关时间设置错误"));
// emit reclaimTankBlock();
}
else if(sysPara->status.reclaimTankstatus == 1 || sysPara->status.reclaimTankstatus == 2)//7 故障,6 关完成,5开完成,4 保持, 3 停止, 2 关, 1 开,0-无操作
{
// emit setReclaimTankCurrentPos(sysPara->status.currReclaimTankPos);
sysPara->status.reclaimBlockedCnt = 0;
}
@@ -2554,10 +2541,8 @@ void InkJetPrinter::detectAndcontrolReclaimTank(){
{
if(sysPara->devOp->isReclaimTankCloseEnable())
sysPara->devOp->controlReclaimTankClose(false); //到头,关闭
/*应要求去掉多余到信息 LogInfo::setRunStatusText(tr("回收槽到头"));*/
m_MainWidget->setRunStatus(tr("回收槽到头"));
m_MainWidget->setReclaimStatus(false, 0);
//sysPara->status.currReclaimTankPos = 0; //将回收槽的时间置为零
// ui->tabMainWindow->resetReclaimCtrlButtonText();
// emit reclaimTankCloseDone();
sysPara->status.lastRecycleWarn = 0;
sysPara->status.HVFaultCloseEn=0;
@@ -2572,13 +2557,7 @@ void InkJetPrinter::detectAndcontrolReclaimTank(){
{
sysPara->devOp->controlReclaimTankOpen(false); //到头,关闭
LogInfo::setRunStatusText(tr("回收槽卡住或者回收槽开关时间设置错误"));
// m_MainWidget->setRunStatus(tr("回收槽卡住或者回收槽开关时间设置错误")); hlp
// ui->tabMainWindow->resetReclaimCtrlButtonText();
// emit reclaimTankBlock();
}
else // if(sysPara->status.reclaimTankstatus == 7 )//7 故障,6 关完成,5开完成,4 保持, 3 停止, 2 关, 1 开,0-无操作
{
// emit setReclaimTankCurrentPos(sysPara->status.currReclaimTankPos);
m_MainWidget->setRunStatus(tr("回收槽卡住或者回收槽开关时间设置错误"));
}
}
@@ -2627,7 +2606,7 @@ void InkJetPrinter::showMessage(QString str){
qDebug()<<str;
}
sysPara->devOp->color_flag = 2;
// m_MainWidget->setRunStatus(str); hlp
m_MainWidget->setRunStatus(str);
}
void InkJetPrinter::resetPressureCnt(){
@@ -2739,7 +2718,7 @@ void InkJetPrinter::warningShow(int type,int num){
str = tr("墨水液位报警超过48小时,机器无法正常打印,请先添加原厂墨水再刷墨水卡,以恢复喷码机的正常工作!");
msgtest->setText(str);
msgtest->show();
// m_MainWidget->setRunStatus(str); hlp
// m_MainWidget->setRunStatus(str);
LogInfo::setRunStatusText(str);
qDebug()<<str;
}
@@ -2750,7 +2729,7 @@ void InkJetPrinter::warningShow(int type,int num){
str = tr("溶剂液位报警超过48小时,机器无法正常打印,请先添加溶剂再刷溶剂卡以恢复喷码机的正常工作!");
msgtest->setText(str);
msgtest->show();
// m_MainWidget->setRunStatus(str); hlp
// m_MainWidget->setRunStatus(str);
LogInfo::setRunStatusText(str);
qDebug()<<str;
}
@@ -2761,7 +2740,7 @@ void InkJetPrinter::warningShow(int type,int num){
str = tr("保养期已超过%1天,请进行保养以恢复喷码机的正常使用").arg(num*(-1));
msgtest->setText(str);
msgtest->show();
// m_MainWidget->setRunStatus(str); hlp
// m_MainWidget->setRunStatus(str);
LogInfo::setRunStatusText(str);
qDebug()<<str;
}
@@ -2799,7 +2778,7 @@ bool InkJetPrinter::cardTouchConfirm(QString msgTxt, QString variableMsgTxt)
{
QMessageBox box(QMessageBox::Warning, tr("警告"),
msgTxt, QMessageBox::Ok | QMessageBox::Cancel,
this, Qt::Dialog | Qt::Tool | Qt::FramelessWindowHint | Qt::BypassWindowManagerHint );
this);
int rfidCountDown = sysPara->para.rfidCountDown;
QTimer msgTimer;
@@ -2818,15 +2797,36 @@ bool InkJetPrinter::cardTouchConfirm(QString msgTxt, QString variableMsgTxt)
msgTimer.start(1000);
}
// 为边框设置圆角和边框颜色
box.setStyleSheet(R"(
QDialog {
border-radius: 5px;
border: 2px solid #333333;
}
)");
box.exec();
return box.result() == QMessageBox::Ok || box.result() == QMessageBox::Accepted;
}
void InkJetPrinter::initRunTimeCtrl()
{
if (ctrl_runTime == nullptr) {
ctrl_runTime = RunTimeCtrl::instance();
#ifdef __RFID_CARD
connect(ctrl_runTime, &RunTimeCtrl::sig_updateTimeoutDay, this, [=](int days) {
// timeoutDay:仅适用于原来月份的处理
this->timeoutDay = days;
if(timeoutDay <= 30)
sysPara->status.needMaintenanceRemind = true;
});
connect(ctrl_runTime, &RunTimeCtrl::sig_saveRunTime, this, [=]() {
// 运行时间处理
sysPara->RFIDPara.runTime += 30;
sysPara->saveRFIDPara();
});
// 弹窗提示
connect(ctrl_runTime, &RunTimeCtrl::sig_alertTimeout,
this, &InkJetPrinter::slt_warningMaintenance);
curPowerOnDateTime = QDateTime::currentDateTime();
if (sysPara)
ctrl_runTime->loadConfig(&sysPara->RFIDPara);
ctrl_runTime->start();
#endif
}
}
+7 -4
View File
@@ -33,6 +33,8 @@
#include "QBarCode.h"
#include "dlgQrCode.h"
#include "runtimectrl.h"
class InkJetPrinter : public QWidget,public ParaSettingUI
{
Q_OBJECT
@@ -108,6 +110,8 @@ private:
QDateTime curPowerOnDateTime;
int timeoutDay;
RunTimeCtrl* ctrl_runTime = nullptr;
void initRunTimeCtrl();
private slots:
void timerHandler();
void getMainWidgetButtonClickedSlot(int index);
@@ -129,7 +133,7 @@ private slots:
void getCounterVarSetWidgetButtonClickSlot(int index);
void slt_counterVarUpdate();
void showScheduleShiftsEditor(PicScheduleShiftItem* item);
void showScheduleShiftsEditor(QVector<ScheduleModel> schedules, TextItemModel txtModel);
void onScheduleShiftsEditDone();
@@ -165,9 +169,8 @@ private slots:
void slt_editCounter(CounterViewModel vm);
//复制粘贴
// void slt_copy();
// 保养警告
void slt_warningMaintenance();
signals:
void maintenanceShow();
+4 -3
View File
@@ -27,7 +27,6 @@ LogInfo::LogInfo(QWidget *parent) :
textEdit = ui->textEditRunStatus;
textEdit->verticalScrollBar()->setStyleSheet("QScrollBar:vertical { width: 40px; }");
textEdit2 = ui->textEditRunStatus_2;
//textEdit2->verticalScrollBar()->setStyleSheet("QScrollBar:vertical { width: 40px; }");
textEdit2->verticalScrollBar()->setStyleSheet("QScrollBar:vertical { width: 40px; }");
@@ -35,8 +34,6 @@ LogInfo::LogInfo(QWidget *parent) :
runStatusTextIndex = 0;
openFileName ="";
ui->labelPreFileName->setText("");
//currenDate="";
//r_CurrentDate=QDate::currentDate().toString("yyyyMMdd");
textEdit2->append(tr("请先打开历史状态文件!"));
if(!QDir("/home/plg").exists())
@@ -182,6 +179,10 @@ void LogInfo::setRunStatusText(QString str){
}
truncatelog();
}
textEdit->moveCursor(QTextCursor::End);
qInfo() << "RunStatusText:"<< str;
}
QString LogInfo::getRunStatusText(void){
+40 -52
View File
@@ -3,6 +3,7 @@
#include <QMessageBox>
#include <QDebug>
#include "DlgRFIDConfig.h"
#include "runtimectrl.h"
MainInstruction::MainInstruction(QWidget *parent) :
QWidget(parent),
@@ -38,9 +39,21 @@ MainInstruction::MainInstruction(QWidget *parent) :
MTimeSetting = new DialogMaintenanceTimeSetting(this);
connect(MTimeSetting,SIGNAL(accepted()),this,SLOT(onMTimeSettingAccepted()));
//30s刷新一次总运行时间
connect(RunTimeCtrl::instance(), &RunTimeCtrl::sig_saveRunTime
, this, [=]() {
if (sysPara)
MTimeSetting->updateUI(sysPara->RFIDPara);
});
applyStyleSheet();
// 授权
ui->tabWidget->removeTab(2);
timeDia.hide();
connect(&timeDia,SIGNAL(accepted()),this,SLOT(slt_timeSetting()));
}
MainInstruction::~MainInstruction()
@@ -82,51 +95,24 @@ void MainInstruction::on_maintenanceIntervalBtn_clicked()
}
void MainInstruction::onDlgAuthMaintenanceTimeAccepted(){
// QString authString= dialogMaintenanceTimeSettingAuth->getAuth();
// if(dlgInputAddr->checWhJmDate(authString)) // 0xa001
// {
QDate curDate = QDate::currentDate();
QString mtEndDatestr = "20" + QString::number(sysPara->RFIDPara.maintenanceEndDate);
QDate mtEndDate = QDate::fromString(mtEndDatestr,"yyyyMMdd");
int timeoutDay = curDate.daysTo(mtEndDate);
MTimeSetting->updateMaintenanceTime(QString("%1 Days").arg(timeoutDay));
MTimeSetting->updateMaintenanceIntervalToUI(sysPara->RFIDPara.maintenanceInterval);
void MainInstruction::onDlgAuthMaintenanceTimeAccepted()
{
MTimeSetting->updateUI(sysPara->RFIDPara);
MTimeSetting->disableMaintenanceTimeSet(false);
MTimeSetting->show();
// }else
// {
// QMessageBox::about(this, tr("提示"), tr("密码不正确!"));
// return;
// }
}
void MainInstruction::maintenanceDialogShow(){
QDate curDate = QDate::currentDate();
QString mtEndDatestr = "20" + QString::number(sysPara->RFIDPara.maintenanceEndDate);
QDate mtEndDate = QDate::fromString(mtEndDatestr,"yyyyMMdd");
int timeoutDay = curDate.daysTo(mtEndDate);
MTimeSetting->updateMaintenanceTime(QString("%1 Days").arg(timeoutDay));
MTimeSetting->updateMaintenanceIntervalToUI(sysPara->RFIDPara.maintenanceInterval);
void MainInstruction::maintenanceDialogShow()
{
MTimeSetting->updateUI(sysPara->RFIDPara);
RunTimeCtrl::instance()->updatePara(&sysPara->RFIDPara);
MTimeSetting->disableMaintenanceTimeSet(true);
MTimeSetting->show();
}
void MainInstruction::onMTimeSettingAccepted(){
sysPara->RFIDPara.maintenanceInterval = MTimeSetting->getInterval();
if(MTimeSetting->getResetSchedule()){
QDate curDate = QDate::currentDate();
int curdate = curDate.toString("yyMMdd").toInt();
sysPara->RFIDPara.maintenanceDate = curdate;
}
QString mtDatestr = QString::number(sysPara->RFIDPara.maintenanceDate);
QDate mtDate = QDate::fromString(mtDatestr,"yyMMdd");
QDate mtEndDate = mtDate.addMonths(sysPara->RFIDPara.maintenanceInterval);
sysPara->RFIDPara.maintenanceEndDate = mtEndDate.toString("yyMMdd").toInt();
LogInfo::setRunStatusText(tr("mtDate1: %1").arg(sysPara->RFIDPara.maintenanceDate));
LogInfo::setRunStatusText(tr("mtInterval1: %1").arg(sysPara->RFIDPara.maintenanceInterval));
LogInfo::setRunStatusText(tr("mtEndDate1: %1").arg(sysPara->RFIDPara.maintenanceEndDate));
LogInfo::setRunStatusText(tr("mtFlog1: %1").arg(sysPara->RFIDPara.needMaintenance));
MTimeSetting->getInterval(&sysPara->RFIDPara);
RunTimeCtrl::instance()->updatePara(&sysPara->RFIDPara);
sysPara->saveRFIDPara();
}
@@ -137,22 +123,12 @@ void MainInstruction::ondialogAuthorizationAccepted(){
if((authString.left(4) == "nnyp") && ( dlgInputAddr->checkSupperJm(authString.mid(4))))
{
#ifdef __RFID_CARD
/**********超级密码,除了维护时间的3个参数,其他参数清零*****************/
unsigned int mtDate = sysPara->RFIDPara.maintenanceDate;
unsigned int mtInterval = sysPara->RFIDPara.maintenanceInterval;
unsigned int mtEndDate = sysPara->RFIDPara.maintenanceEndDate;
qDebug()<<"mtDate2: "<<sysPara->RFIDPara.maintenanceDate;
qDebug()<<"mtInterval2: "<<sysPara->RFIDPara.maintenanceInterval;
qDebug()<<"mtEndDate2: "<<sysPara->RFIDPara.maintenanceEndDate;
/**********超级密码,除了维护时间的5个参数,其他参数清零*****************/
memset(&sysPara->RFIDPara,0,sizeof(sysPara->RFIDPara));
sysPara->RFIDPara.maintenanceDate = mtDate;
sysPara->RFIDPara.maintenanceInterval = mtInterval;
sysPara->RFIDPara.maintenanceEndDate = mtEndDate;
qDebug()<<"mtDate3: "<<sysPara->RFIDPara.maintenanceDate;
qDebug()<<"mtInterval3: "<<sysPara->RFIDPara.maintenanceInterval;
qDebug()<<"mtEndDate3: "<<sysPara->RFIDPara.maintenanceEndDate;
RunTimeCtrl::instance()->authorizationAccepted(&sysPara->RFIDPara);
sysPara->saveRFIDPara();
QMessageBox::warning(0,tr("提示"),tr("RFID卡清零!") );
sysPara->para.flagOfInkWarning = false;
sysPara->para.flagOfSolventWarning = false;
sysPara->status.needMaintenanceRemind = false;
@@ -170,11 +146,25 @@ void MainInstruction::ondialogAuthorizationAccepted(){
dlgInputAddr->show();
// ui->labMac->setText(QString("Mac:%1").arg(dlgInputAddr->jd.addr));
}
else if(authString == "nnyp") {
ui->tabWidget->addTab(ui->tabExtra, tr("额外设置"));
ui->pushButtonAuth->setText(tr("取消授权"));
} else {
QMessageBox box(QMessageBox::Warning, tr("警告"),
tr("密码错误:%1").arg(authString), QMessageBox::Ok,
this);
box.exec();
}
}
void MainInstruction::on_pushButtonAuth_clicked()
{
if (ui->pushButtonAuth->text() == tr("取消授权")) {
ui->pushButtonAuth->setText(tr("系统授权"));
int index = ui->tabWidget->indexOf(ui->tabExtra);
ui->tabWidget->removeTab(index);
return;
}
dialogAuthorization->clearAuth();
dialogAuthorization->show();
}
@@ -190,9 +180,7 @@ void MainInstruction::on_btn_time_clicked()
timeDia.setHour(tm.hour());
timeDia.setMinute(tm.minute());
timeDia.setSecond(tm.second());
timeDia.hide();
timeDia.show();
connect(&timeDia,SIGNAL(accepted()),this,SLOT(slt_timeSetting()));
}
#include <time.h>
+28 -13
View File
@@ -100,16 +100,31 @@
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tabExtra">
<widget class="QWidget" name="tabBasic">
<attribute name="title">
<string>基本设置</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>30</number>
</property>
<property name="topMargin">
<number>30</number>
</property>
<property name="rightMargin">
<number>30</number>
</property>
<property name="bottomMargin">
<number>30</number>
</property>
<property name="spacing">
<number>30</number>
</property>
<item row="0" column="0">
<widget class="QPushButton" name="graphicsEditorBtn">
<property name="maximumSize">
<size>
<width>253</width>
<width>254</width>
<height>92</height>
</size>
</property>
@@ -128,7 +143,7 @@
<widget class="QPushButton" name="btn_time">
<property name="maximumSize">
<size>
<width>253</width>
<width>254</width>
<height>92</height>
</size>
</property>
@@ -147,7 +162,7 @@
<widget class="QPushButton" name="btn_network">
<property name="maximumSize">
<size>
<width>253</width>
<width>254</width>
<height>92</height>
</size>
</property>
@@ -233,17 +248,17 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab">
<widget class="QWidget" name="tabExtra">
<attribute name="title">
<string>额外设置</string>
</attribute>
<widget class="QPushButton" name="rfidCfgBtn">
<property name="geometry">
<rect>
<x>40</x>
<y>30</y>
<width>161</width>
<height>61</height>
<x>30</x>
<y>70</y>
<width>254</width>
<height>92</height>
</rect>
</property>
<property name="text">
@@ -253,10 +268,10 @@
<widget class="QPushButton" name="otherSetBtn">
<property name="geometry">
<rect>
<x>40</x>
<y>120</y>
<width>161</width>
<height>61</height>
<x>30</x>
<y>230</y>
<width>254</width>
<height>92</height>
</rect>
</property>
<property name="text">
+261 -200
View File
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>800</width>
<height>550</height>
<height>558</height>
</rect>
</property>
<property name="sizePolicy">
@@ -211,7 +211,7 @@
<height>300</height>
</size>
</property>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0">
<property name="leftMargin">
<number>9</number>
</property>
@@ -230,146 +230,22 @@
</size>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QFrame" name="fra_state">
<property name="maximumSize">
<size>
<width>180</width>
<height>140</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QLabel" name="lb_generalState">
<property name="minimumSize">
<size>
<width>0</width>
<height>50</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="1">
<widget class="QFrame" name="sub3">
<property name="minimumSize">
<size>
<width>200</width>
<height>140</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>140</height>
</size>
</property>
<property name="styleSheet">
<string>background-color:#BBBBBD;border-radius:3px;</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QLabel" name="sub3_lb1">
<property name="styleSheet">
<string notr="true">color:#000000;font-size:18px;</string>
</property>
<property name="text">
<string>产品计数器</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="indent">
<number>-1</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelProductCnt">
<property name="font">
<font>
<pointsize>-1</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color:#000000;font-size:28px;font-weight:bold;</string>
</property>
<property name="text">
<string>0</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lb_counter">
<property name="text">
<string>达到数量后停止:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelTotalProductCnt">
<property name="styleSheet">
<string>color:#000000;font-size:28px;font-weight:bold;</string>
</property>
<property name="text">
<string>0</string>
</property>
<property name="alignment">
<set>Qt::AlignRight</set>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="m_StartBtn">
<property name="minimumSize">
<size>
<width>150</width>
<height>140</height>
<height>130</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>150</width>
<height>140</height>
<height>130</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">border:0px;</string>
<string notr="true"/>
</property>
<property name="text">
<string>开始打印</string>
@@ -388,36 +264,7 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="m_CloseBtn">
<property name="minimumSize">
<size>
<width>0</width>
<height>130</height>
</size>
</property>
<property name="styleSheet">
<string>border:0px;</string>
</property>
<property name="icon">
<iconset resource="image.qrc">
<normaloff>:/image/power.png</normaloff>:/image/power.png</iconset>
</property>
<property name="iconSize">
<size>
<width>70</width>
<height>70</height>
</size>
</property>
<property name="fixedSize" stdset="0">
<size>
<width>70</width>
<height>70</height>
</size>
</property>
</widget>
</item>
<item row="1" column="1">
<item row="2" column="1">
<widget class="QFrame" name="sub2">
<property name="maximumSize">
<size>
@@ -561,16 +408,22 @@
</layout>
</widget>
</item>
<item row="1" column="2">
<item row="2" column="2">
<widget class="QPushButton" name="m_StopBtn">
<property name="minimumSize">
<size>
<width>0</width>
<height>140</height>
<height>130</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>130</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">border:0px;</string>
<string notr="true"/>
</property>
<property name="text">
<string>停止打印</string>
@@ -589,47 +442,160 @@
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item alignment="Qt::AlignRight">
<widget class="QWidget" name="rightPanel" native="true">
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="1,0,0">
<property name="spacing">
<number>5</number>
<item row="0" column="1">
<widget class="QFrame" name="sub3">
<property name="minimumSize">
<size>
<width>200</width>
<height>150</height>
</size>
</property>
<property name="leftMargin">
<number>1</number>
</property>
<item>
<widget class="QFrame" name="frame_2">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5" stretch="1,0">
<item>
<widget class="QLabel" name="lb_reclaimtanl">
<property name="maximumSize">
<size>
<width>200</width>
<height>150</height>
</size>
</property>
<property name="styleSheet">
<string>background-color:#BBBBBD;border-radius:3px;</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QLabel" name="sub3_lb1">
<property name="styleSheet">
<string notr="true">color:#000000;font-size:18px;</string>
</property>
<property name="text">
<string/>
<string>产品计数器</string>
</property>
<property name="pixmap">
<pixmap resource="image.qrc">:/image/tool.png</pixmap>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="scaledContents">
<bool>true</bool>
<property name="indent">
<number>-1</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelProductCnt">
<property name="font">
<font>
<pointsize>-1</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color:#000000;font-size:28px;font-weight:bold;</string>
</property>
<property name="text">
<string>0</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lb_counter">
<property name="text">
<string>达到数量后停止:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelTotalProductCnt">
<property name="styleSheet">
<string>color:#000000;font-size:28px;font-weight:bold;</string>
</property>
<property name="text">
<string>0</string>
</property>
<property name="alignment">
<set>Qt::AlignRight</set>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="m_CloseBtn">
<property name="minimumSize">
<size>
<width>0</width>
<height>130</height>
</size>
</property>
<property name="styleSheet">
<string>border:0px;</string>
</property>
<property name="icon">
<iconset resource="image.qrc">
<normaloff>:/image/power.png</normaloff>:/image/power.png</iconset>
</property>
<property name="iconSize">
<size>
<width>70</width>
<height>70</height>
</size>
</property>
<property name="fixedSize" stdset="0">
<size>
<width>70</width>
<height>70</height>
</size>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QFrame" name="fra_state">
<property name="maximumSize">
<size>
<width>180</width>
<height>140</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6" stretch="1">
<item>
<widget class="QLabel" name="lb_generalState">
<property name="minimumSize">
<size>
<width>0</width>
<height>50</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lb_nozzleState">
<property name="text">
<string/>
@@ -642,25 +608,45 @@
</layout>
</widget>
</item>
<item alignment="Qt::AlignRight">
<widget class="QWidget" name="rightPanel" native="true">
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0">
<property name="spacing">
<number>5</number>
</property>
<property name="leftMargin">
<number>1</number>
</property>
<item>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<layout class="QVBoxLayout" name="verticalLayout_8">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="m_RightBtn">
<property name="minimumSize">
<size>
<width>200</width>
<height>70</height>
<width>150</width>
<height>95</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>16777215</height>
<width>150</width>
<height>100</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>喷嘴开启</string>
<string/>
</property>
<property name="icon">
<iconset resource="image.qrc">
<normaloff>:/image/RePipeOpen.png</normaloff>:/image/RePipeOpen.png</iconset>
</property>
<property name="iconSize">
<size>
@@ -677,24 +663,70 @@
</widget>
</item>
<item>
<widget class="QPushButton" name="m_LeftBtn">
<widget class="QLabel" name="lb_RightBtn">
<property name="minimumSize">
<size>
<width>200</width>
<height>70</height>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>444</height>
<width>16777215</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>喷嘴开启</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_7">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="m_LeftBtn">
<property name="minimumSize">
<size>
<width>150</width>
<height>95</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>150</width>
<height>100</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>喷嘴关闭</string>
<string/>
</property>
<property name="icon">
<iconset resource="image.qrc">
<normaloff>:/image/RePipeClose.png</normaloff>:/image/RePipeClose.png</iconset>
</property>
<property name="iconSize">
<size>
@@ -710,6 +742,35 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lb_LeftBtn">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>喷嘴关闭</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="margin">
<number>0</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</item>
+65 -83
View File
@@ -23,17 +23,13 @@ PrintSetting::PrintSetting(QWidget *parent) :
ui->labelSynTriggerPrintLenRatio->setHidden(1);
ui->spinBoxSynTriggerPrintLenRatio->setHidden(1);
//隐藏这部分控件暂时用不到
ui->radioButtonSynTrigger->hide();
ui->labelDelayTriggerValue->hide();
ui->spinBoxDelayTriggerValue->hide();
ui->groupBox_3->hide();
ui->labelTimeTriggerMode->setEnabled(false);
ui->comboBoxTimeTriggerMode->setEnabled(false);
init();
ui->eleEyeEdgetTriggerInner->click();
ui->radioButtonSynTriggerExternal->click();
}
PrintSetting::~PrintSetting()
@@ -137,7 +133,7 @@ void PrintSetting::TriggerupdateSysParaToUI(){
ui->radioButtonSynTriggerInner->setChecked(sysPara->para.synTriggerInner);
ui->radioButtonSynTriggerExternal->setChecked(sysPara->para.synTriggerExternal);
ui->spinBoxDelayTriggerValue->setValue(sysPara->para.printDelayMs);
ui->sb_printingDelay->setValue(sysPara->para.printDelayMs);
#ifndef NON_CABLE
ui->comboBoxTimeTriggerMode->setCurrentIndex(sysPara->para.timeTriggerPrintMode);
#endif
@@ -156,7 +152,6 @@ void PrintSetting::TriggerupdateSysParaToUI(){
/*----------------------------------------*/
ui->spinBoxEleEyeTriggerPrintDelay->setValue(sysPara->para.eleEyeTriggerPrintDelay);
ui->checkBoxSynMakeClean->setChecked(sysPara->para.synClearCntInEleEyeMode);
//ui->checkBoxEleEyeMakeClean->setChecked(sysPara->para.eleEyeClearCntInSynMode);
ui->comboBoxEleEyeMakeClean->setCurrentIndex( sysPara->para.eleEyeClearCntInSynMode & 0x0f);
@@ -171,7 +166,6 @@ void PrintSetting::TriggerupdateSysParaToUI(){
ui->spinBoxOutputPulseDelayMs->setEnabled(isPulseEenable);
ui->spinBoxOuputPulseCol->setValue(sysPara->para.OuputPulseCol);
ui->checkEyeTriggerSynPrintEn->setChecked (sysPara->para.eleEyeTriggerSynPrintEn);
ui->comboBoxSyncActType->setCurrentIndex (sysPara->para.synchronizorActType);
//ui->checkBoxAutoSpeedEN->setChecked (sysPara->para.autoSynSpeedEn );
ui->spinBoxEleMaskTime->setValue(sysPara->para.eleMaskTime);
@@ -240,25 +234,27 @@ void PrintSetting::applyUITriggerPara(){
}
sysPara->para.OuputPulseCol = ui->spinBoxOuputPulseCol->value();
if(((ui->checkEyeTriggerSynPrintEn->checkState()==1 )
&&(sysPara->para.printTriggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || sysPara->para.printTriggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE))
if(((sysPara->para.printTriggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL
|| sysPara->para.printTriggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE))
|| sysPara->para.printTriggerMode == PRINT_TRIGGER_SYNCHRONIZER )
{
ui->labelOutputPulseDelayMs->setText(tr("延时(毫米):"));
}
else ui->labelOutputPulseDelayMs->setText(tr("延时(毫秒):"));
// if(sysPara->devOp->writeFpgaPrintPara() != -1)
// QMessageBox::information(this,tr("提示"),tr("应用成功"));
}
}
void PrintSetting::GetTriggerUIPara(){
if(sysPara){
sysPara->para.printDelayMs = ui->spinBoxDelayTriggerValue->value();
sysPara->para.printDelayMs = ui->sb_printingDelay->value();
sysPara->para.timeTriggerPrintMode = ui->comboBoxTimeTriggerMode->currentIndex();
sysPara->para.elecEyeTriggerInterval = ui->spinBoxEleEyeTriggerIntervalMs->value(); //电眼触发的重复间隔
sysPara->para.photoElectricityRepeateNum = ui->spinBoxEleEyeTriggerRepeatCnt->value();
int value = 0;
if (ui->cb_unlimited) value = 65535;
else value = ui->spinBoxEleEyeTriggerRepeatCnt->value();
sysPara->para.photoElectricityRepeateNum = value;
sysPara->para.synTriggerPrintLenMm = ui->spinBoxSynTriggerPrintLen->text().toFloat();
//sysPara->para.synTriggerPrintLenMm = ui->spinBoxSynTriggerPrintLen->value();
@@ -301,7 +297,6 @@ void PrintSetting::GetTriggerUIPara(){
sysPara->para.eleEyeTriggerSynPrintEn=false;
sysPara->para.eleEyeTriggerPrintDelay = ui->spinBoxEleEyeTriggerPrintDelay->value();
sysPara->para.synClearCntInEleEyeMode = ui->checkBoxSynMakeClean->isChecked();
sysPara->para.eleEyeClearCntInSynMode = (sysPara->para.eleEyeClearCntInSynMode & 0xf0) + ui->comboBoxEleEyeMakeClean->currentIndex(); //ui->checkBoxEleEyeMakeClean->isChecked();
//sysPara->para.autoSynSpeedEn = ui->checkBoxAutoSpeedEN->isChecked ();
sysPara->para.autoSynSpeedEn = 0;
@@ -359,14 +354,11 @@ void PrintSetting::on_radioButtonSynTrigger_pressed()
void PrintSetting::on_checkEyeTriggerSynPrintEn_clicked(bool checked)
{
qDebug()<<"checked:"<<checked;
int triggerMode = sysPara->para.printTriggerMode;
if(sysPara)
{
//if( !sysPara->para.eleEyeTriggerSynPrintEn )
int triggerMode = sysPara->para.printTriggerMode;
if( checked)
{
//ui->radioButtonSynTrigger->setChecked(1);
#ifndef NON_CABLE
ui->spinBoxSynTriggerPrintLen->setEnabled(1);
#endif
@@ -379,7 +371,7 @@ void PrintSetting::on_checkEyeTriggerSynPrintEn_clicked(bool checked)
ui->pushButtonApplyPulseFix->setEnabled(1);
ui->comboBoxSynPrintMode->setEnabled(1);
ui->labelSynPrintMode->setEnabled(1);
//ui->checkBoxAutoSpeedEN->setEnabled (1);
ui->cb_unlimited->setEnabled (1);
ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(0);
ui->labelEleEyeTriggerPrintDelay->setText(tr("触发延时(毫米)"));
ui->labelEleEyeTriggerIntervalMs->setText(tr("重复间隔(毫米)"));
@@ -392,7 +384,6 @@ void PrintSetting::on_checkEyeTriggerSynPrintEn_clicked(bool checked)
}
else
{
// ui->radioButtonSynTrigger->setChecked(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
#ifndef NON_CABLE
ui->spinBoxSynTriggerPrintLen->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
#endif
@@ -405,36 +396,28 @@ void PrintSetting::on_checkEyeTriggerSynPrintEn_clicked(bool checked)
ui->pushButtonApplyPulseFix->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
ui->comboBoxSynPrintMode->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
ui->labelSynPrintMode->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
// ui->checkBoxAutoSpeedEN->setEnabled (triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
//ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
ui->cb_unlimited->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(1);
ui->labelEleEyeTriggerPrintDelay->setText(tr("触发延时(毫秒)"));
ui->labelEleEyeTriggerIntervalMs->setText(tr("重复间隔(毫秒)"));
ui->labelEleMaskTime->setText(tr("抑止距离(毫秒)"));
ui->labelOutputPulseDelayMs->setText( ui->radioButtonSynTrigger->isChecked()?tr("延时(毫米):"):tr("延时(毫秒):"));
}
}
}
void PrintSetting::setTriggerUI(int triggerMode){
ui->radioButtonDelayTrigger->setChecked(triggerMode == PRINT_TRIGGER_TIME);
ui->spinBoxDelayTriggerValue->setEnabled(triggerMode == PRINT_TRIGGER_TIME);
ui->labelDelayTriggerValue->setEnabled(triggerMode == PRINT_TRIGGER_TIME);
// ui->comboBoxTimeTriggerMode->setEnabled(triggerMode == PRINT_TRIGGER_TIME);
// ui->labelTimeTriggerMode->setEnabled(triggerMode == PRINT_TRIGGER_TIME);
// ui->sb_printingDelay->setEnabled(triggerMode == PRINT_TRIGGER_TIME);
ui->lb_printingDelay->setEnabled(triggerMode == PRINT_TRIGGER_TIME);
ui->radioButtonEleEyeEdgetTrigger->setChecked( triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE);
ui->radioButtonEleEyeLevelTrigger->setChecked(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL);
ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE || triggerMode == PRINT_TRIGGER_TIME);
ui->labelEleEyeTriggerIntervalMs->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE);
ui->spinBoxEleEyeTriggerRepeatCnt->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE);
ui->cb_unlimited->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE);
ui->labelEleEyeTriggerRepeatCnt->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE);
ui->spinBoxEleEyeTriggerPrintDelay->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE || PRINT_TRIGGER_SYNCHRONIZER);
ui->labelEleEyeTriggerPrintDelay->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE || PRINT_TRIGGER_SYNCHRONIZER);
ui->checkBoxSynMakeClean->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE);
ui->checkEyeTriggerSynPrintEn->setEnabled (triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE);
ui->labelEleMaskTime->setEnabled (triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE);
ui->spinBoxEleMaskTime->setEnabled (triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE);
@@ -442,8 +425,6 @@ void PrintSetting::setTriggerUI(int triggerMode){
(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE)
)
{
//ui->radioButtonSynTrigger->setChecked(1);
// ui->spinBoxSynTriggerPrintLen->setEnabled(0);
ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(0);
ui->labelSynTriggerPrintLen->setEnabled(1);
ui->lineEditTriggerPulsePerMm->setEnabled(1);
@@ -454,19 +435,15 @@ void PrintSetting::setTriggerUI(int triggerMode){
ui->pushButtonApplyPulseFix->setEnabled(1);
ui->comboBoxSynPrintMode->setEnabled(1);
ui->labelSynPrintMode->setEnabled(1);
//ui->checkBoxAutoSpeedEN->setEnabled (1);
ui->labelEleMaskTime->setEnabled(1);
ui->spinBoxEleMaskTime->setEnabled(1);
//ui->spinBoxEleMaskTime->setEnabled(1);
ui->labelEleEyeTriggerPrintDelay->setText(tr("触发延时(毫米)"));
ui->labelEleEyeTriggerIntervalMs->setText(tr("重复间隔(毫米)"));
ui->labelEleMaskTime->setText(tr("抑止距离(毫米)"));
}
else
{
ui->radioButtonSynTrigger->setChecked(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
#ifndef NON_CABLE
ui->spinBoxSynTriggerPrintLen->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
#endif
@@ -491,9 +468,8 @@ void PrintSetting::setTriggerUI(int triggerMode){
ui->labelEleEyeTriggerIntervalMs->setText(tr("重复间隔(毫秒)"));
ui->labelEleMaskTime->setText(tr("封锁时间(毫秒)"));
}
if(( ( //sysPara->para.eleEyeTriggerSynPrintEn ||
ui->checkEyeTriggerSynPrintEn->isChecked())
&&(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE))
if(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL
|| triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE
|| triggerMode == PRINT_TRIGGER_SYNCHRONIZER )
{
ui->labelOutputPulseDelayMs->setText(tr("延时(毫米):"));
@@ -501,25 +477,6 @@ void PrintSetting::setTriggerUI(int triggerMode){
else ui->labelOutputPulseDelayMs->setText(tr("延时(毫秒):"));
setSynPrintMode(sysPara->para.sysTriggerPrintMode);
//72版本禁用该输入框
//67打开
// if(triggerMode== PRINT_TRIGGER_SYNCHRONIZER){
// const unsigned short &FpgaVer=sysPara->status.build_dat.builTime;
// if(72==FpgaVer)
// {
// ui->spinBoxSynTriggerPrintLenRatio->setValue(0);
// ui->spinBoxSynTriggerPrintLenRatio->setEnabled(false);
// }
// else if(67==FpgaVer)
// {
// ui->spinBoxSynTriggerPrintLenRatio->setEnabled(true);
// }
// }
// else{
// ui->spinBoxSynTriggerPrintLenRatio->setValue(0);
// ui->spinBoxSynTriggerPrintLenRatio->setEnabled(false);
// }
}
void PrintSetting::setSynPrintMode(int mode){
@@ -596,6 +553,22 @@ void PrintSetting::applyStyleSheet()
background-color: #BAE7FF;
}
QPushButton#checkBtn {
background-color: #E6F7FF;
border: 1px solid #87CEEB;
border-radius: 4px;
font-size: 24px;
color: #228B22;
}
QPushButton#checkBtn:hover {
background-color: #D1E9FF;
}
QPushButton#checkBtn:pressed {
background-color: #BAE7FF;
}
QLabel {
font-size: 18px;
color: #000000;
@@ -644,6 +617,12 @@ void PrintSetting::applyStyleSheet()
QWidget#fileTab, QWidget#extraTab, QWidget#settingsTab, QWidget#serviceTab {
background-color: #E3E7EC;
}
QRadioButton {
background-color: rgb(192, 205, 210);
border-radius: 5px;
padding-left: 5px;
}
)";
this->setStyleSheet(styleSheet);
@@ -651,26 +630,28 @@ void PrintSetting::applyStyleSheet()
void PrintSetting::on_eleEyeEdgetTriggerInner_clicked()
{
setEnableEleEyeSetting(false);
if (sysPara == NULL) return;
if(ui->radioButtonSynTriggerInner->isChecked()){
sysPara->para.printTriggerMode = PRINT_TRIGGER_TIME;
}else
sysPara->para.printTriggerMode = PRINT_TRIGGER_SYNCHRONIZER;
setTriggerUI(sysPara->para.printTriggerMode);
ui->checkEyeTriggerSynPrintEn->setChecked(false);
on_checkEyeTriggerSynPrintEn_clicked(ui->checkEyeTriggerSynPrintEn->isChecked());
setEnableEleEyeSetting(false);
}
void PrintSetting::setEnableEleEyeSetting(bool flag){
ui->labelEleEyeTriggerIntervalMs->setEnabled(flag);
ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(flag || sysPara->para.printTriggerMode == PRINT_TRIGGER_TIME);
if (sysPara) {
ui->spinBoxEleEyeTriggerIntervalMs->
setEnabled(flag || sysPara->para.printTriggerMode == PRINT_TRIGGER_TIME);
}
ui->labelEleMaskTime->setEnabled(flag);
ui->spinBoxEleMaskTime->setEnabled(flag);
ui->labelEleEyeTriggerRepeatCnt->setEnabled(flag);
ui->spinBoxEleEyeTriggerRepeatCnt->setEnabled(flag);
ui->checkBoxSynMakeClean->setEnabled(flag);
ui->cb_unlimited->setEnabled(flag);
ui->radioButtonEleEyeEdgetTrigger->setEnabled(flag);
ui->radioButtonEleEyeLevelTrigger->setEnabled(flag);
@@ -678,12 +659,8 @@ void PrintSetting::setEnableEleEyeSetting(bool flag){
void PrintSetting::on_eleEyeEdgetTriggerExternal_clicked()
{
if(ui->radioButtonSynTrigger->isChecked())
ui->checkEyeTriggerSynPrintEn->setChecked(true);
else
ui->checkEyeTriggerSynPrintEn->setChecked(false);
on_checkEyeTriggerSynPrintEn_clicked(ui->checkEyeTriggerSynPrintEn->isChecked());
if (sysPara)
on_checkEyeTriggerSynPrintEn_clicked(sysPara->para.eleEyeTriggerSynPrintEn);
setEnableEleEyeSetting(true);
}
@@ -697,30 +674,30 @@ void PrintSetting::setEnableSynTriggerSetting(bool flag){
ui->comboBoxSyncActType->setEnabled(flag);
ui->labelSynPrintMode->setEnabled(flag);
ui->comboBoxSynPrintMode->setEnabled(flag);
ui->cb_unlimited->setEnabled(flag);
}
void PrintSetting::on_radioButtonSynTriggerInner_clicked()
{
setEnableSynTriggerSetting(false);
if (sysPara == NULL) return;
if(ui->eleEyeEdgetTriggerInner->isChecked()){
sysPara->para.printTriggerMode = PRINT_TRIGGER_TIME;
setTriggerUI(sysPara->para.printTriggerMode);
}
if (sysPara)
on_checkEyeTriggerSynPrintEn_clicked(sysPara->para.eleEyeTriggerSynPrintEn);
ui->checkEyeTriggerSynPrintEn->setChecked(false);
on_checkEyeTriggerSynPrintEn_clicked(ui->checkEyeTriggerSynPrintEn->isChecked());
setEnableSynTriggerSetting(false);
}
void PrintSetting::on_radioButtonSynTriggerExternal_clicked()
{
if(ui->eleEyeEdgetTriggerExternal->isChecked())
ui->checkEyeTriggerSynPrintEn->setChecked(true);
else{
ui->checkEyeTriggerSynPrintEn->setChecked(false);
if(!ui->eleEyeEdgetTriggerExternal->isChecked()){
if (sysPara)
sysPara->para.printTriggerMode = PRINT_TRIGGER_SYNCHRONIZER;
}
on_checkEyeTriggerSynPrintEn_clicked(ui->checkEyeTriggerSynPrintEn->isChecked());
if (sysPara)
on_checkEyeTriggerSynPrintEn_clicked(sysPara->para.eleEyeTriggerSynPrintEn);
setEnableSynTriggerSetting(true);
}
@@ -741,3 +718,8 @@ void PrintSetting::on_checkBoxPulseOutputEnable_clicked(bool checked)
isPulseEenable = checked;
ui->spinBoxOutputPulseDelayMs->setEnabled(checked);
}
void PrintSetting::on_cb_unlimited_clicked(bool checked)
{
ui->spinBoxEleEyeTriggerRepeatCnt->setEnabled(!checked);
}
+2
View File
@@ -75,6 +75,8 @@ private slots:
void on_checkBoxPulseOutputEnable_clicked(bool checked);
void on_cb_unlimited_clicked(bool checked);
private:
Ui::PrintSetting *ui;
+794 -956
View File
File diff suppressed because it is too large Load Diff
+4 -2
View File
@@ -165,7 +165,8 @@ HEADERS += Public.h \
Log/logger.h \
Log/logmessage.h \
Log/logglobal.h \
loginfoctrl.h
loginfoctrl.h \
runtimectrl.h
FORMS += \
@@ -321,7 +322,8 @@ SOURCES +=\
Log/filelogger.cpp \
Log/logger.cpp \
Log/logmessage.cpp \
loginfoctrl.cpp
loginfoctrl.cpp \
runtimectrl.cpp
+10 -3
View File
@@ -108,8 +108,10 @@ void SysPara::loadParaFromFile(){
file.close();
if(para.gearPumpSpeedAlarm < 1000 || para.gearPumpSpeedAlarm > 2000)
para.gearPumpSpeedAlarm = 1500;
if(para.gearPumpEnable && !para.flagOfReclaimPumEnable)
para.flagOfReclaimPumEnable = 1;
// 将flagOfReclaimPumEnable强制设置为0。该参数影响的是压力控制算法,但现在已经不使用 byons@2026年5月12日
if(para.gearPumpEnable && para.flagOfReclaimPumEnable)
para.flagOfReclaimPumEnable = false;
if (DeviceCodefile.isOpen()) {
DeviceCodefile.close();
}
@@ -156,7 +158,7 @@ void SysPara::loadDefaultPara(){
para.synPulseNumPerMm = 8;// 同步器参数 脉冲/毫米
para.OuputPulseCol = 0;//桂林客户,精准控制输出脉冲的位置,精确到打印的列数
para.gearPumpEnable = 1;
para.flagOfReclaimPumEnable = 1;
para.flagOfReclaimPumEnable = 0;
para.oscillatorVoltage = 30;//晶振电压
para.highVoltageLevel = 100;//高压包容差
@@ -1015,6 +1017,8 @@ void SysPara::saveRFIDPara()
out << RFIDPara.maintenanceInterval;
out << RFIDPara.maintenanceEndDate;
out << RFIDPara.needMaintenance;
out << RFIDPara.runTime;
out << RFIDPara.maintenanceHours;
out << para.rfidCountDown;
if(!file.flush()){
@@ -1030,6 +1034,7 @@ void SysPara::saveRFIDPara()
}
file.close();
}
bool SysPara::loadRFIDPara()
{
QFile file(RFID_FILE_PATH);
@@ -1055,6 +1060,8 @@ bool SysPara::loadRFIDPara()
in >> RFIDPara.maintenanceInterval;
in >> RFIDPara.maintenanceEndDate;
in >> RFIDPara.needMaintenance;
in >> RFIDPara.runTime;
in >> RFIDPara.maintenanceHours;
in >> para.rfidCountDown;
file.close();
+3
View File
@@ -882,6 +882,9 @@ typedef struct
unsigned int maintenanceInterval;
unsigned int maintenanceEndDate;
bool needMaintenance;
// 运行时间与保养间隔时间 runTime>=maintenanceHours 时提示保养
unsigned int runTime; // 单位:秒
unsigned int maintenanceHours;
}RFIDPara_t;
#define MDT 0
+4 -10
View File
@@ -34,9 +34,7 @@ SystemManage::SystemManage(QWidget *parent) :
ui->pushButtonCompressPump->setEnabled(false);
ui->pushButtonMainInkPump->setEnabled(false);
ui->pushButtonReleaseValve->setEnabled(false);
// 总是启用回收泵控制 byons@2026年4月22日
// ui->pushButtonReclaimPump->setEnabled(false);
ui->pushButtonReclaimPump->setEnabled(false);
ui->pushButtonGearPump->setEnabled(true);
ui->pushButtonGearPumpOff->setEnabled(true);
@@ -228,18 +226,14 @@ void SystemManage::setPumpValveBottonEnable(bool enable){
ui->pushButtonCompressPump->setEnabled(false);
ui->pushButtonMainInkPump->setEnabled(false);
ui->pushButtonReleaseValve->setEnabled(false);
// 总是启用回收泵控制 byons@2026年4月22日
// ui->pushButtonReclaimPump->setEnabled(enable);
ui->pushButtonReclaimPump->setEnabled(enable);
}
else
{
ui->pushButtonCompressPump->setEnabled(enable);
ui->pushButtonMainInkPump->setEnabled(enable);
ui->pushButtonReleaseValve->setEnabled(enable);
// 总是启用回收泵控制 byons@2026年4月22日
// ui->pushButtonReclaimPump->setEnabled(enable);
ui->pushButtonReclaimPump->setEnabled(enable);
}
}
ui->pushButtonCycleValve->setEnabled(enable);
@@ -1345,7 +1339,7 @@ void SystemManage::programFPGAProcess(){
QFile file("/udisk/FPGAFile.rbf");
if(!file.exists())
{
QMessageBox::warning(this,"提示","没有FPGA升级文件");
QMessageBox::warning(this,tr("提示"), tr("没有FPGA升级文件"));
programFPGATimer->stop();
return;
}
+1537 -789
View File
File diff suppressed because it is too large Load Diff
+22 -99
View File
@@ -267,54 +267,7 @@
</widget>
<widget class="QWidget" name="tab_2">
<property name="styleSheet">
<string notr="true">QSpinBox::down-button {
width: 23px; /* 图标显示宽度 */
height: 23px; /* 图标显示高度 */
border: 1px solid #333333;
border-radius: 3px;
background-color: #5396C1;
}
QSpinBox::down-arrow {
image: url(image/down_white.png);
height: 18px;
width: 18px;
}
QSpinBox::up-button {
width: 23px; /* 图标显示宽度 */
height: 23px; /* 图标显示高度 */
border: 1px solid #333333;
border-radius: 3px;
background-color: #5396C1;
}
QSpinBox::up-arrow {
image: url(image/up_white.png);
height: 18px;
width: 18px;
}
QSpinBox {
border: 1px solid #333333;
}
QCheckBox {
color: #000000;
}
QCheckBox::indicator {
width: 15px;
height: 15px;
border: 1px solid #96A0A9;
border-radius: 8px;
background-color: #ffffff;
}
QCheckBox::indicator:checked {
background-color: #95B2D4;
border-color: #95B2D4;
}</string>
<string notr="true"/>
</property>
<attribute name="title">
<string>计数器1</string>
@@ -748,8 +701,8 @@ QCheckBox::indicator:checked {
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
<width>37</width>
<height>17</height>
</size>
</property>
</spacer>
@@ -812,18 +765,6 @@ QCheckBox::indicator:checked {
</size>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
@@ -858,10 +799,7 @@ QCheckBox::indicator:checked {
</size>
</property>
<property name="styleSheet">
<string notr="true">QRadioButton::indicator {
width: 25px;
height: 25px;
}</string>
<string notr="true"/>
</property>
<property name="text">
<string>增量值: </string>
@@ -1237,21 +1175,9 @@ height: 25px;
<height>50</height>
</size>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="leftMargin">
<number>1</number>
</property>
<property name="topMargin">
<number>1</number>
</property>
<property name="rightMargin">
<number>1</number>
</property>
<property name="bottomMargin">
<number>1</number>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<spacer name="horizontalSpacer_3">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@@ -1274,7 +1200,7 @@ height: 25px;
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
<height>32</height>
</size>
</property>
<property name="maximumSize">
@@ -1305,27 +1231,27 @@ height: 25px;
<height>50</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="leftMargin">
<number>0</number>
<property name="minimumSize">
<size>
<width>100</width>
<height>50</height>
</size>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
<property name="maximumSize">
<size>
<width>100</width>
<height>50</height>
</size>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<spacer name="horizontalSpacer_4">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<width>6</width>
<height>20</height>
</size>
</property>
@@ -1342,7 +1268,7 @@ height: 25px;
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
<height>32</height>
</size>
</property>
<property name="maximumSize">
@@ -1352,10 +1278,7 @@ height: 25px;
</size>
</property>
<property name="styleSheet">
<string notr="true">QRadioButton::indicator {
width: 25px;
height: 25px;
}</string>
<string notr="true"/>
</property>
<property name="text">
<string>增量值: </string>
+30 -10
View File
@@ -1,5 +1,6 @@
#include "dialogmaintenancetimesetting.h"
#include "ui_dialogmaintenancetimesetting.h"
#include <QDate>
#include <QMessageBox>
DialogMaintenanceTimeSetting::DialogMaintenanceTimeSetting(QWidget *parent) :
@@ -15,9 +16,18 @@ DialogMaintenanceTimeSetting::~DialogMaintenanceTimeSetting()
delete ui;
}
int DialogMaintenanceTimeSetting::getInterval()
int DialogMaintenanceTimeSetting::getInterval(RFIDPara_t* para)
{
return ui->spinBox->value();
para->maintenanceInterval = ui->spinBox->value();
para->maintenanceHours = ui->spinBoxRuntime->value();
if (resetSchedule) {
resetSchedule = false;
QDate curDate = QDate::currentDate();
int curdate = curDate.toString("yyMMdd").toInt();
para->maintenanceDate = curdate; // 维护日期
para->runTime = 0;
}
return 0;
}
bool DialogMaintenanceTimeSetting::getResetSchedule(){
bool flag = resetSchedule;
@@ -37,16 +47,26 @@ void DialogMaintenanceTimeSetting::on_pushButton_Reset_clicked()
}
}
void DialogMaintenanceTimeSetting::updateMaintenanceIntervalToUI(int interval){
ui->spinBox->setValue(interval);
}
void DialogMaintenanceTimeSetting::updateMaintenanceTime(QString str){
ui->label_MaintenanceTime->setText(str);
}
void DialogMaintenanceTimeSetting::disableMaintenanceTimeSet(bool flag){
ui->spinBox->setEnabled(flag);
ui->pushButton_Reset->setEnabled(flag);
ui->label_MaintenanceTime->setEnabled(flag);
ui->label_4->setEnabled(flag);
ui->label_5->setEnabled(flag);
ui->spinBoxRuntime->setEnabled(flag);
}
void DialogMaintenanceTimeSetting::updateUI(RFIDPara_t para)
{
QDate curDate = QDate::currentDate();
QString mtEndDatestr = "20" + QString::number(para.maintenanceEndDate);
QDate mtEndDate = QDate::fromString(mtEndDatestr,"yyyyMMdd");
int timeoutDay = curDate.daysTo(mtEndDate);
ui->label_MaintenanceTime->setText(QString("%1 Days").arg(timeoutDay));
ui->spinBox->setValue(para.maintenanceInterval);
double h = para.runTime / 60.0 / 60.0;
// 保留两位小数
ui->label_CurRunTime->setText(QString("%1 Hours").arg(QString::number(h, 'f', 2)));
ui->spinBoxRuntime->setValue(para.maintenanceHours);
}
+6 -3
View File
@@ -2,7 +2,11 @@
#define DIALOGMAINTENANCETIMESETTING_H
#include <QDialog>
#include "SysPara.h"
/**
设置保养间隔ui
**/
namespace Ui {
class DialogMaintenanceTimeSetting;
}
@@ -15,12 +19,11 @@ public:
explicit DialogMaintenanceTimeSetting(QWidget *parent = 0);
~DialogMaintenanceTimeSetting();
bool getResetSchedule();
int getInterval();
int getInterval(RFIDPara_t* para);
bool resetSchedule;
void updateMaintenanceIntervalToUI(int);
void updateMaintenanceTime(QString);
void disableMaintenanceTimeSet(bool);
void updateUI(RFIDPara_t para);
private slots:
void on_pushButton_Reset_clicked();
+102 -19
View File
@@ -6,23 +6,26 @@
<rect>
<x>0</x>
<y>0</y>
<width>524</width>
<height>260</height>
<width>536</width>
<height>312</height>
</rect>
</property>
<property name="focusPolicy">
<enum>Qt::ClickFocus</enum>
</property>
<property name="windowTitle">
<string>Dialog</string>
<string>设置保养间隔</string>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">
<rect>
<x>170</x>
<x>260</x>
<y>220</y>
<width>341</width>
<height>32</height>
<width>241</width>
<height>71</height>
</rect>
</property>
<property name="orientation">
@@ -44,6 +47,9 @@
<property name="text">
<string>保养周期</string>
</property>
<property name="alignment">
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
</property>
</widget>
<widget class="QSpinBox" name="spinBox">
<property name="geometry">
@@ -51,7 +57,7 @@
<x>30</x>
<y>70</y>
<width>111</width>
<height>41</height>
<height>31</height>
</rect>
</property>
<property name="keyboardTracking">
@@ -73,7 +79,7 @@
<x>150</x>
<y>70</y>
<width>67</width>
<height>41</height>
<height>31</height>
</rect>
</property>
<property name="text">
@@ -83,10 +89,10 @@
<widget class="QPushButton" name="pushButton_Reset">
<property name="geometry">
<rect>
<x>250</x>
<y>30</y>
<width>251</width>
<height>81</height>
<x>20</x>
<y>220</y>
<width>191</width>
<height>71</height>
</rect>
</property>
<property name="text">
@@ -96,22 +102,22 @@
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>40</x>
<y>140</y>
<width>100</width>
<x>250</x>
<y>70</y>
<width>121</width>
<height>30</height>
</rect>
</property>
<property name="text">
<string>维护时间:</string>
<string>剩余维护时间:</string>
</property>
</widget>
<widget class="QLabel" name="label_MaintenanceTime">
<property name="geometry">
<rect>
<x>120</x>
<y>140</y>
<width>100</width>
<x>370</x>
<y>70</y>
<width>131</width>
<height>30</height>
</rect>
</property>
@@ -119,6 +125,83 @@
<string>TextLabel</string>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>30</x>
<y>110</y>
<width>141</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>运行时间</string>
</property>
<property name="alignment">
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
</property>
</widget>
<widget class="QSpinBox" name="spinBoxRuntime">
<property name="geometry">
<rect>
<x>30</x>
<y>150</y>
<width>111</width>
<height>31</height>
</rect>
</property>
<property name="keyboardTracking">
<bool>true</bool>
</property>
<property name="minimum">
<number>3000</number>
</property>
<property name="maximum">
<number>20000</number>
</property>
<property name="value">
<number>3000</number>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>150</x>
<y>150</y>
<width>67</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>(小时)</string>
</property>
</widget>
<widget class="QLabel" name="label_CurRunTime">
<property name="geometry">
<rect>
<x>370</x>
<y>150</y>
<width>131</width>
<height>30</height>
</rect>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>250</x>
<y>150</y>
<width>121</width>
<height>30</height>
</rect>
</property>
<property name="text">
<string>当前运行时间:</string>
</property>
</widget>
</widget>
<resources/>
<connections>
+3 -3
View File
@@ -120,9 +120,9 @@ void DlgMutiLanguage::SetNewLanguage(){
}
// 提示重启
QMessageBox::StandardButton ret = QMessageBox::information(this, tr("提示"),
tr("是否重启?"),
QMessageBox::Ok);
QMessageBox::StandardButton ret =
QMessageBox::information(this, tr("提示"),tr("是否重启?"),
QMessageBox::Ok | QMessageBox::Cancel);
if (ret == QMessageBox::Ok) {
sysPara->saveParaToFile(); // 关机前将相关配置保存
sysPara->saveRFIDPara();
+310
View File
@@ -0,0 +1,310 @@
# Scene 模块健壮性更新说明
## 概述
本文档针对 `scene/` 目录下所有类进行健壮性审查,识别出以下几类典型问题:
1. **外部参数输入未校验** — 公共方法接收指针、索引、容器等参数时缺少有效性检查
2. **空指针解引用风险** — 存储的原始指针在使用前未做 null 检查
3. **数组/容器越界访问** — 使用索引访问 QVector/QMap 时未验证边界
4. **缺少错误处理** — 文件操作、类型转换等缺少失败路径处理
5. **类型安全问题** — QVariant 类型擦除后未做类型校验
---
## 各类问题详细清单
### 1. BarcodeEditor
| 文件 | 问题 | 严重程度 | 建议修复 |
|------|------|----------|----------|
| BarcodeEditor.h/cpp | `bindSysPara(SysPara*)` 未校验 nullptr | 高 | 入口处添加 `if (!sysPara) return;` 并记录日志 |
| BarcodeEditor.cpp | `applyCounterConfigToSysPara()` 直接解引用 `m_sysPara` 无 null 检查 | 高 | 使用前添加 `Q_ASSERT(m_sysPara); if (!m_sysPara) return;` |
| BarcodeEditor.cpp | `bindViewModel()` 中 `format` 字段通过 `QVariant::value<T>()` 取值,无类型校验 | 中 | 使用 `canConvert<T>()` 先行判断 |
| BarcodeEditor.cpp | 计数器相关逻辑中 `counterValues` 索引访问无边界检查 | 高 | 访问前检查 `counterValues.size() >= 2` |
---
### 2. CounterEditor
| 文件 | 问题 | 严重程度 | 建议修复 |
|------|------|----------|----------|
| CounterEditor.cpp | `bindSysPara(SysPara*)` 未校验 nullptr | 高 | 入口处添加空指针检查 |
| CounterEditor.cpp | 计数器参数(步长、初始值、最大值)未做范围校验 | 中 | 添加数值范围合法性检查(如步长不为0,最大值>最小值) |
| CounterEditor.cpp | UI 控件取值后直接使用,未校验转换是否成功 | 低 | `toInt()` 等调用使用带 `ok` 参数的重载 |
---
### 3. DateFormatEditor
| 文件 | 问题 | 严重程度 | 建议修复 |
|------|------|----------|----------|
| DateFormatEditor.cpp | `setDateModel(const DateItemModel&)` 未校验 model 内部容器是否为空 | 中 | 检查关键 map 的 size 是否满足预期 |
| DateFormatEditor.cpp | 日期偏移量输入未做范围限制 | 低 | 限制偏移量在合理范围内(如 ±9999) |
---
### 4. DateReplaceEditor
| 文件 | 问题 | 严重程度 | 建议修复 |
|------|------|----------|----------|
| DateReplaceEditor.cpp | `onLineEditReplaceChanged(int i, QString txt)` 中 `mapIdx` 可能为负值 | 中 | 添加 `if (mapIdx < 0) return;` |
| DateReplaceEditor.cpp | `on_cb_replaceType_currentIndexChanged(int index)` 未校验 index 范围 | 低 | 添加 `if (index < 0 || index > 5) return;` |
| DateReplaceEditor.cpp | 分页逻辑中 `currPage` 无上下界保护 | 中 | 翻页时 clamp 到 `[0, maxPage]` |
---
### 5. DlgBarcodeFormat
| 文件 | 问题 | 严重程度 | 建议修复 |
|------|------|----------|----------|
| DlgBarcodeFormat.cpp | 条码类型索引直接映射到枚举,无范围校验 | 中 | 添加枚举范围检查 |
| DlgBarcodeFormat.cpp | 条码内容长度未做上限校验 | 中 | 根据条码类型限制最大长度 |
---
### 6. DlgQrcodeFormat
| 文件 | 问题 | 严重程度 | 建议修复 |
|------|------|----------|----------|
| DlgQrcodeFormat.cpp | 二维码内容长度未做上限校验 | 中 | 限制输入长度(QR Code 最大约 4296 字符) |
| DlgQrcodeFormat.cpp | 纠错等级索引未校验 | 低 | 确保 index 在 0-3 范围内 |
---
### 7. ItemCommon
| 文件 | 问题 | 严重程度 | 建议修复 |
|------|------|----------|----------|
| ItemCommon.cpp | `generateTxtFromDateItemModel` 中 `monthsMap[month-1]`、`daysMap[day-1]`、`hoursMap[hour]`、`weeksMap[dayOfWeek-1]` 均无边界检查 | **高** | 访问前检查 map/list 的 size 是否足够 |
| ItemCommon.cpp | `generateTxtFromBarcodeViewModel` 中 `counterValues[0]`/`[1]` 无 size 检查 | **高** | 添加 `if (counterValues.size() < 2) return QString();` |
| ItemCommon.cpp | 日期格式解析中未处理无效 datetime 的情况 | 中 | 检查 `QDateTime::isValid()` |
---
### 8. ItemGeneralSettings
| 文件 | 问题 | 严重程度 | 建议修复 |
|------|------|----------|----------|
| ItemGeneralSettings.cpp | `bindItem(QGraphicsItem*)` 未校验 nullptr | 高 | 入口处添加空指针检查 |
| ItemGeneralSettings.cpp | 坐标/尺寸输入未做负值或零值校验 | 中 | 宽高不允许为0或负数 |
| ItemGeneralSettings.cpp | `dynamic_cast` 结果未检查 | 中 | 转换后检查是否为 nullptr |
---
### 9. picscene (PicScene)
| 文件 | 问题 | 严重程度 | 建议修复 |
|------|------|----------|----------|
| picscene.cpp | 多处 `dynamic_cast` 后直接使用结果,未检查 nullptr | **高** | 每次 `dynamic_cast` 后添加 null 检查 |
| picscene.cpp | `addItem` 系列方法中传入的参数(如文本内容、位置坐标)未校验 | 中 | 校验坐标在场景范围内,文本非空 |
| picscene.cpp | 场景 item 列表遍历中假设 item 类型,未做防御性检查 | 中 | 遍历时使用 `qgraphicsitem_cast` 并检查结果 |
| picscene.cpp | 文件读写操作缺少错误处理(如文件打开失败) | 中 | 检查 `QFile::open()` 返回值 |
---
### 10. piccodeitem (PicCodeItem)
| 文件 | 问题 | 严重程度 | 建议修复 |
|------|------|----------|----------|
| piccodeitem.cpp | `updateVariants(QVector<int> counters)` 未校验 `counters.size() >= 2` | **高** | 添加 `if (counters.size() < 2) return defaultImage;` |
| piccodeitem.cpp | `setBarcodeViewModel(const BarcodeViewModel& vm)` 未校验 vm 字段有效性 | 中 | 检查 `vm.type` 和 `vm.contentPattern` 非空 |
| piccodeitem.cpp | `setSource(QVariant var)` 参数被完全忽略 | 低 | 添加注释说明或移除无用参数 |
---
### 11. PicCounterItem
| 文件 | 问题 | 严重程度 | 建议修复 |
|------|------|----------|----------|
| PicCounterItem.cpp | `updateVariants(QVector<int> counters)` 未校验容器大小 | 高 | 同 piccodeitem |
| PicCounterItem.cpp | 计数器溢出未处理(超过最大值后的行为) | 中 | 添加溢出保护逻辑 |
---
### 12. PicDateItem
| 文件 | 问题 | 严重程度 | 建议修复 |
|------|------|----------|----------|
| PicDateItem.cpp | `setDateModel(const DateItemModel&)` 未校验 model 内部 map 完整性 | 高 | 检查各 map 的 size 满足最低要求 |
| PicDateItem.cpp | 日期替换表访问无边界保护 | 高 | 同 ItemCommon 中的修复 |
---
### 13. PicImageItem
| 文件 | 问题 | 严重程度 | 建议修复 |
|------|------|----------|----------|
| PicImageItem.cpp | `setSource(QVariant var)` 未校验 QVariant 类型 | 低 | 使用 `var.canConvert<QString>()` 判断 |
| PicImageItem.cpp | `setCustomAttrs` 未检查 "source" 属性是否存在 | 低 | 添加 `attrs.contains("source")` 检查 |
| PicImageItem.cpp | 图片加载失败无日志输出 | 低 | 添加 `qWarning()` 日志 |
---
### 14. PicScheduleShiftItem
| 文件 | 问题 | 严重程度 | 建议修复 |
|------|------|----------|----------|
| PicScheduleShiftItem.cpp | `findScheduleName()` 存在不可达代码 | 低 | 清理逻辑 |
| PicScheduleShiftItem.cpp | `itemImage()` 中存在未赋值的 QImage 返回路径 | 中 | 确保所有分支都有有效返回 |
---
### 15. pictextitem (PicTextItem)
| 文件 | 问题 | 严重程度 | 建议修复 |
|------|------|----------|----------|
| pictextitem.cpp | 文本内容设置未做长度上限校验 | 低 | 根据打印能力限制最大字符数 |
| pictextitem.cpp | 字体大小设置未做合理范围校验 | 低 | 限制在合理范围(如 1-999) |
---
### 16. ViewModels
| 文件 | 问题 | 严重程度 | 建议修复 |
|------|------|----------|----------|
| ViewModels.cpp | `makeCounterVM(SysPara*, ...)` 接收指针但部分路径未检查 null | 中 | 统一在入口处检查 |
| ViewModels.cpp | ViewModel 构造时未校验字段合法性 | 低 | 添加工厂方法中的断言 |
---
### 17. ScheduleShiftsEditor
| 文件 | 问题 | 严重程度 | 建议修复 |
|------|------|----------|----------|
| ScheduleShiftsEditor.cpp | 班次时间输入未校验逻辑合理性(如结束时间>开始时间) | 中 | 添加时间区间合法性校验 |
| ScheduleShiftsEditor.cpp | 班次数量未做上限限制 | 低 | 限制最大班次数 |
---
### 18. myview / sceneviewwidget
| 文件 | 问题 | 严重程度 | 建议修复 |
|------|------|----------|----------|
| myview.cpp | 缩放因子未做范围限制 | 低 | 限制在合理范围(如 0.1 ~ 10.0) |
| sceneviewwidget.cpp | `setScene(PicScene*)` 未校验 nullptr | 中 | 添加空指针检查 |
---
## 修复优先级建议
### P0 — 立即修复(可能导致崩溃)
1. **所有 `bindSysPara(SysPara*)` 调用处** — 添加 nullptr 检查
2. **`ItemCommon::generateTxtFromDateItemModel`** — 所有 map 索引访问添加边界检查
3. **`ItemCommon::generateTxtFromBarcodeViewModel`** — counterValues size 检查
4. **`PicCodeItem::updateVariants`** — counters 容器大小校验
5. **`picscene.cpp` 中所有 `dynamic_cast`** — 添加 null 检查
### P1 — 尽快修复(可能导致数据错误)
1. DateReplaceEditor 分页索引保护
2. 条码/二维码内容长度限制
3. ItemGeneralSettings 中 `dynamic_cast` 结果检查
4. PicDateItem 日期替换表边界保护
5. ScheduleShiftsEditor 时间区间合法性校验
### P2 — 后续优化(改善代码质量)
1. QVariant 类型安全检查
2. 日志输出完善
3. 无用参数清理
4. 数值输入范围限制
---
## 修复模式参考
### 模式 A:指针参数校验
```cpp
// 修复前
void BarcodeEditor::bindSysPara(SysPara *sysPara)
{
m_sysPara = sysPara;
}
// 修复后
void BarcodeEditor::bindSysPara(SysPara *sysPara)
{
if (!sysPara) {
qWarning() << "BarcodeEditor::bindSysPara: null pointer passed";
return;
}
m_sysPara = sysPara;
}
```
### 模式 B:容器索引边界检查
```cpp
// 修复前
auto val = m_currCounterValues[0];
// 修复后
if (m_currCounterValues.size() < 2) {
qWarning() << "counterValues size insufficient:" << m_currCounterValues.size();
return QImage();
}
auto val = m_currCounterValues[0];
```
### 模式 C:Map 访问保护
```cpp
// 修复前
result.replace("{M}", model.monthsMap[month - 1]);
// 修复后
if (month - 1 >= 0 && month - 1 < model.monthsMap.size()) {
result.replace("{M}", model.monthsMap[month - 1]);
} else {
qWarning() << "monthsMap index out of range:" << month - 1;
}
```
### 模式 D:dynamic_cast 安全使用
```cpp
// 修复前
auto* textItem = dynamic_cast<PicTextItem*>(item);
textItem->setText(content);
// 修复后
auto* textItem = dynamic_cast<PicTextItem*>(item);
if (!textItem) {
qWarning() << "dynamic_cast to PicTextItem failed";
return;
}
textItem->setText(content);
```
### 模式 E:数值范围校验
```cpp
// 修复前
void ItemGeneralSettings::setWidth(int w)
{
item->setWidth(w);
}
// 修复后
void ItemGeneralSettings::setWidth(int w)
{
if (w <= 0 || w > MAX_ITEM_WIDTH) {
qWarning() << "Invalid width:" << w;
return;
}
item->setWidth(w);
}
```
---
## 实施计划
1. **第一阶段**:修复所有 P0 问题(防崩溃)
2. **第二阶段**:修复所有 P1 问题(防数据错误)
3. **第三阶段**:完成 P2 优化(代码质量提升)
每个阶段修复后需进行编译验证和基本功能回归测试。
+1537 -789
View File
File diff suppressed because it is too large Load Diff
+1537 -789
View File
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -207,8 +207,8 @@ void FileManageWidget::copyFiles(QListWidget *from, QListWidget *to)
void FileManageWidget::applyStyleSheet()
{
QString styleSheet = R"(
QString styleSheet =
R"(
QPushButton#closeBtn {
background-color: #E6F7FF;
border: 1px solid #87CEEB;
@@ -230,7 +230,7 @@ void FileManageWidget::applyStyleSheet()
border: 1px solid #000000;
border-radius: 3px;
font-size: 18px;
width: 100px;
width: 150px;
height: 50px;
}
+17 -1
View File
@@ -85,8 +85,24 @@
<widget class="QWidget" name="widget_4" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="leftMargin">
<number>50</number>
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="exportBtn">
<property name="text">
+2 -2
View File
@@ -1014,7 +1014,6 @@
<file>image/start.png</file>
<file>image/stop.png</file>
<file>image/text.png</file>
<file>image/tool.png</file>
<file>image/uk_flag.png</file>
<file>image/ALARMYellow.PNG</file>
<file>image/ALARMRed.PNG</file>
@@ -1036,6 +1035,7 @@
<file>image/set3.png</file>
<file>image/down_white.png</file>
<file>image/up_white.png</file>
<file>styles.qss</file>
<file>image/RePipeClose.png</file>
<file>image/RePipeOpen.png</file>
</qresource>
</RCC>
Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

+1956 -1236
View File
File diff suppressed because it is too large Load Diff
+74 -63
View File
@@ -75,6 +75,7 @@ MainWidget::MainWidget(QWidget* parent)
changeHighLight(false);
enablePrintButton(false);
}
MainWidget::~MainWidget()
@@ -235,7 +236,7 @@ void MainWidget::checkForPowerOff(){
sysPara->devOp->controlInkValve(false);
sysPara->devOp->controlInkValvePWM(false);
}
// this->setRunStatus(tr("正在准备关机,请等待%1秒...............").arg(i*2)); hlp
this->setRunStatus(tr("正在准备关机,请等待%1秒...").arg(i*2));
MySleep(2000);
}
}
@@ -268,7 +269,7 @@ void MainWidget::checkForPowerOff(){
{
if(i==13)
sysPara->devOp->controlReclaimTankOpen(false);
// this->setRunStatus(tr("正在准备关机,请等待%1秒...............").arg(i*3)); hlp
this->setRunStatus(tr("正在准备关机,请等待%1秒...").arg(i*3));
MySleep(3000);
}
}
@@ -294,7 +295,7 @@ void MainWidget::checkForPowerOff(){
sysPara->para.gearPumpValue = 0;
sysPara->devOp->WriteMoterPump();
}
// this->setRunStatus(tr("正在准备关机,请等待%1秒...............").arg(i*3)); hlp
this->setRunStatus(tr("正在准备关机,请等待%1秒...").arg(i*3));
MySleep(3000);
}
}
@@ -303,8 +304,8 @@ void MainWidget::checkForPowerOff(){
sysPara->para.gearPumpValue=gearPumpValue_backup;
sysPara->para.reclaimPumpPWMWidth = reclaimPumpPWMWidth_backup;
sysPara->devOp->controlCompressPump(false);
// setRunStatus(tr("准备关机......")); hlp
qDebug()<<"准备关机";
setRunStatus(tr("准备关机..."));
sysPara->para.totalProductCnt +=sysPara->status.totalProductCnt;
sysPara->devOp->clearProductCnt(3 | 0x10);//总产器计数器立即清零
sysPara->para.ReadFileErrorCnt=0;
@@ -328,7 +329,7 @@ static int numOfPowerOffCMD = 0;
void MainWidget::sendPowerOffCmd(){
if(++numOfPowerOffCMD == 6){
sysPara->devOp->color_flag = 2;
// setRunStatus(tr("关机失败!!!")); hlp
setRunStatus(tr("关机失败!!!"));
timerPowerOff->stop();
numOfPowerOffCMD = 0;
return;
@@ -618,7 +619,7 @@ void MainWidget::PreviewPressed(){
// var
//qDebug() <<"VarNum"<<TempVarNum;
if(TempVarNum>8){
// setRunStatus(tr("变量数大于8个,某些变量将不起作用!!!")); hlp
setRunStatus(tr("变量数大于8个,某些变量将不起作用!!!"));
strTitle= tr("变量数大于8个,某些变量将不起作用!!!");
strTitle.append("\r\n");
strTitle.append(tr("请减少信息中的变量(或计数器)数量."));
@@ -846,17 +847,7 @@ void MainWidget::ontextEdittextChanged()
void MainWidget::setRunStatus(QString str){
// switch(sysPara->devOp->color_flag){
// case 1:
// ui.labelRunStatus->setStyleSheet("color:yellow");
// break;
// case 2:
// ui.labelRunStatus->setStyleSheet("color:red");
// break;
// default:
// ui.labelRunStatus->setStyleSheet("color:black");
// break;
// }
ui.lb_nozzleState->setText(str);
}
@@ -909,13 +900,6 @@ int MainWidget::searchQrVar(){
sysPara->para.qrOption.width=sysPara->print.QRvars[varNum].width = rx.cap(3).toInt(&ok);// *(sysPara->status.addSpace && type==9 ?2:1) ;
sysPara->para.qrOption.height =sysPara->print.QRvars[varNum].height = rx.cap(4).toInt(&ok);
sysPara->print.QRvars[varNum].startRowPos = sysPara->print.QRvars[varNum].endRowPos-sysPara->print.QRvars[varNum].height;
//qDebug()<<"type:"<<varNum<<sysPara->print.QRvars[varNum].type<<sysPara->status.QRvariNum
// <<sysPara->print.QRvars[varNum].startColPos<<sysPara->print.QRvars[varNum].startRowPos<<sysPara->print.QRvars[varNum].endRowPos
// <<sysPara->print.QRvars[varNum].width<<sysPara->print.QRvars[varNum].height
// <<rx.cap(1)<<rx.cap(2)<<rx.cap(3)<<rx.cap(4);
//type: 0 1 1 0 0 21 25 21 "10" "QRV21" "25" "21"
//type: 0 2 1 0 0 12 325 12 "11" "BARV12" "325" "12"
varNum++;
//break;
}
@@ -1656,7 +1640,7 @@ void MainWidget::on_m_StartBtn_clicked()
/*---------------------------------开关回收槽------------------------------*/
enableReclaimCtrlButton(false);
// updatePrintDisplayLabel(); hlp
updatePrintDisplayLabel();
// 20170717 移动此,以观察条形码打印异常问题。
if(!startPrintingFlag)
{
@@ -1692,7 +1676,7 @@ void MainWidget::on_m_StopBtn_clicked()
enableReclaimCtrlButton(true);
printintFlag = false;
startPrintingFlag = false;
// updatePrintDisplayLabel(); hlp
updatePrintDisplayLabel();
sysPara->status. waitHightVolOff = 1;
sysPara->saveParaToFile(); // 将相关配置保存
@@ -1772,6 +1756,25 @@ int MainWidget::getCurrPrintStatus()
return printStatus;
}
void MainWidget::setReclaimStatus(bool isOpen, int rate)
{
if (!sysPara->devOp->isReclaimTankOpenEnable()) {
QString str = isOpen? tr("停止开启") : tr("停止关闭");
setRunStatus(str);
return;
};
if (isOpen) {
QString str = rate == 100? tr("喷嘴已开启"):tr("喷嘴开启中");
ui.lb_RightBtn->setText(str);
ui.lb_LeftBtn->setText(tr("喷嘴关闭"));
} else {
QString str = rate == 0? tr("喷嘴已关闭"):tr("喷嘴关闭中");
ui.lb_LeftBtn->setText(str);
ui.lb_RightBtn->setText(tr("喷嘴开启"));
}
}
static int mainInkPumpCtrlStatus = 0;
static int mainInkPumpCtrlCnt = 0;
//100ms 为单位
@@ -1781,7 +1784,7 @@ void MainWidget::airPushingProcess()
if (sysPara->status.airPushing) {
//qDebug()<< "start airPushingProcess "<<sysPara->status.airPushingOnTime;
// 执行排气 7 秒
// setRunStatus(tr("正在排气 ...............")); hlp
setRunStatus(tr("正在排气..."));
++sysPara->status.airPushingOnTime;
if(sysPara->status.airPushingOnTime >= 50) {
static int delayCount = 0;
@@ -1867,7 +1870,8 @@ void MainWidget::reclaimTanOpen()
sysPara->devOp->controlReclaimTankOpen(!sysPara->devOp->isReclaimTankOpenEnable());
sysPara->devOp->highVoltageCtrl(0); /*回收槽动作的时候务必关高压*/
// sysPara->status.reclaimTankstatus = 1;
setRunStatus(sysPara->devOp->isReclaimTankOpenEnable()?tr("正在打开回收槽..."):tr("停止打开"));
// setRunStatus(sysPara->devOp->isReclaimTankOpenEnable()?tr("正在打开回收槽..."):tr("停止打开"));
setReclaimStatus(true, 0);
if (!sysPara->para.reclaimTankTime) {
// LogInfo::setRunStatusText(tr("警告!回收槽开关时间未设置!"));
}
@@ -1885,8 +1889,7 @@ void MainWidget::reclaimTanOpen()
void MainWidget::initSheet()
{
// 仅当前按钮生效
ui.m_StartBtn->setStyleSheet(
R"(
QString startBtnSheet = R"(
QPushButton {
background-color: #1e8449;
color: black;
@@ -1897,10 +1900,11 @@ void MainWidget::initSheet()
color: #7f8c8d; /* 灰色文字 */
border: 1px solid #95a5a6; /* 灰色边框 */
}
)");
)";
ui.m_StopBtn->setStyleSheet(
R"(
ui.m_StartBtn->setStyleSheet(startBtnSheet);
QString stopBtnSheet = R"(
QPushButton {
background-color: #e74c3c;
color: black;
@@ -1911,7 +1915,27 @@ void MainWidget::initSheet()
color: #7f8c8d; /* 灰色文字 */
border: 1px solid #95a5a6; /* 灰色边框 */
}
)");
)";
ui.m_StopBtn->setStyleSheet(stopBtnSheet);
QString btnSheet = R"(
QPushButton:disabled {
background-color: #bdc3c7; /* 灰色背景 */
color: #7f8c8d; /* 灰色文字 */
border: 1px solid #95a5a6; /* 灰色边框 */
}
)";
ui.m_RightBtn->setStyleSheet(btnSheet);
ui.m_LeftBtn->setStyleSheet(btnSheet);
QString lbSheet = R"(
QLabel {
border: 1px solid #95a5a6; /* 灰色边框 */
}
)";
ui.lb_LeftBtn->setStyleSheet(lbSheet);
ui.lb_RightBtn->setStyleSheet(lbSheet);
}
@@ -2022,7 +2046,8 @@ void MainWidget::on_m_LeftBtn_clicked()
enablePrintButton(SIMULATE_PRINTING_MODE);
sysPara->devOp->highVoltageCtrl(0);
// sysPara->status.reclaimTankstatus = 2;
setRunStatus(sysPara->devOp->isReclaimTankCloseEnable()?tr("正在关闭回收槽..."):tr("停止关闭"));
// setRunStatus(sysPara->devOp->isReclaimTankCloseEnable()?tr("正在关闭回收槽..."):tr("停止关闭"));
setReclaimStatus(false, 100);
if(!sysPara->para.reclaimTankTime){
// LogInfo::setRunStatusText(tr("警告!回收槽开关时间未设置!"));
}
@@ -2695,7 +2720,7 @@ void MainWidget::onPreviewScene()
}
if(TempVarNum>MAX_VARI_NUM){
// setRunStatus(tr("变量数大于8个,某些变量将不起作用!!!")); hlp
setRunStatus(tr("变量数大于8个,某些变量将不起作用!!!"));
strTitle= tr("变量数大于8个,某些变量将不起作用!!!");
strTitle.append("\r\n");
strTitle.append(tr("请减少信息中的变量(或计数器)数量."));
@@ -3270,7 +3295,7 @@ void MainWidget::RefreshStatusLight(){//100ms
// on_pushButtonPausePrint_pressed();
on_m_StopBtn_clicked();
LogInfo::setRunStatusText(tr("高压故障,暂停打印"));
// setRunStatus(tr("高压故障,暂停打印"));hlp
setRunStatus(tr("高压故障,暂停打印"));
strTitle = tr("高压故障,暂停打印.");
@@ -3288,7 +3313,7 @@ void MainWidget::RefreshStatusLight(){//100ms
on_m_LeftBtn_clicked();
sysPara->status.reclaimTankBlockedAppending=1;
LogInfo::setRunStatusText(tr("高压故障,关回收槽"));
// setRunStatus(tr("高压故障,关回收槽和墨线")); hlp
setRunStatus(tr("高压故障,关回收槽和墨线"));
}
sysPara->status.HVFaultCloseEn=1;
}
@@ -3341,10 +3366,10 @@ void MainWidget::RefreshStatusLight(){//100ms
// on_pushButtonReclaimTankClose_pressed();
on_m_LeftBtn_clicked();
LogInfo::setRunStatusText(tr("回收故障,关闭回收槽,关墨线"));
// setRunStatus(tr("回收故障,关闭回收槽,关墨线")); hlp
setRunStatus(tr("回收故障,关闭回收槽,关墨线"));
}
}
// else setRunStatus(tr("回收故障.")); hlp
else setRunStatus(tr("回收故障."));
}
else
@@ -3359,32 +3384,22 @@ void MainWidget::RefreshStatusLight(){//100ms
else if(sysPara->status.lastRecycleWarn)sysPara->status.lastRecycleWarn--;
}
// if(ui.labelRunStatus->text().length()<4){
// if(startPrintingFlag ){
// if(printintFlag)
// setRunStatus(tr("正在喷印..............."));
// setRunStatus(tr("正在喷印..."));
// else
// setRunStatus(tr("暂停喷印..............."));
// setRunStatus(tr("暂停喷印..."));
// }
// } hlp
// 20160620 新增主界面显示:压力,粘度,隔膜位置,晶振电压数,相位
// ui->labPress->setText(QString("%1/%2").arg(sysPara->status.PRESSURE).arg(sysPara->para.pressure));
// ui->labViso->setText(QString("%1/%2").arg(sysPara->status.viscosity).arg(sysPara->para.viscosity) );
alarmStatus.pressValue = QString("%1/%2").arg(sysPara->status.PRESSURE).arg(sysPara->para.pressure);
alarmStatus.visoValue = QString("%1/%2").arg(sysPara->status.viscosity).arg(sysPara->para.viscosity);
if(sysPara->para.gearPumpEnable)
{
// ui->labPosition->setText(QString("%1").arg(sysPara->status.gearPumpRunSpeed));
alarmStatus.gearPumpRunSpeed = QString("%1").arg(sysPara->status.gearPumpRunSpeed);
}
else
{
// ui->labPosition->setText(QString("%1/%2").arg(sysPara->status.SEPTAL_POSITION).arg(sysPara->para.septalPostion) );
}
// ui->labOscVol->setText(QString::number(sysPara->status.HV_DETOUT) + "/" + QString::number(sysPara->para.maxHighVoltageDAC));
// ui->label_size->setText(tr("%1/%2/%3").arg(sysPara->status.sizeFPGA).arg(sysPara->status.sizequeueFPGA).arg(sysPara->status.sizeSTM32));
alarmStatus.highVol = QString::number(sysPara->status.HV_DETOUT) + "/" + QString::number(sysPara->para.maxHighVoltageDAC);
alarmStatus.dataSize = QString("%1/%2/%3").arg(sysPara->status.sizeFPGA).arg(sysPara->status.sizequeueFPGA).arg(sysPara->status.sizeSTM32);
@@ -3396,9 +3411,6 @@ void MainWidget::RefreshStatusLight(){//100ms
bool MainWidget::updatePhaseIndicatorLight(){
if(sysPara==0) return 0;
// if(dlgMyWarringShowDlyCnt)dlgMyWarringShowDlyCnt--;
// if(dlgMyWarringShowDlyCnt==1) dlgMyWarring.hide();
/*------------------------------------------喷头盖未关或回收槽未全部打开的时候不报相位故障-------------------------------------------------*/
if((!sysPara->status.flight_tm_error && !sysPara->status.detect_phase_error) || (sysPara->status.statWarn & WARN_STATUS_HDINT) || !sysPara->status.reclainTankReachEnd){
//故障后必须等手动按故障恢复才会继续
@@ -3416,7 +3428,6 @@ bool MainWidget::updatePhaseIndicatorLight(){
sysPara->status.phaseErrorCnt ++ ;
else {
if(!sysPara->status.lastPhaseFault){
// ui->labelStatusChargefault->setPixmap(QPixmap(QString::fromUtf8(":/image/ALARMRed.PNG")));
alarmStatus.chargeFault = DEV_STATUS_RED;
sysPara->status.lastPhaseFault = 1;
if(sysPara->status.flight_tm_error)
@@ -3434,7 +3445,7 @@ bool MainWidget::updatePhaseIndicatorLight(){
sysPara->status.powerOffAfterPhaseFaultAppending = 1;
_on_pushButtonPowerOff_pressed(false);
LogInfo::setRunStatusText(tr("相位故障,准备关机"));
// setRunStatus(tr("相位故障,准备关机"));hlp
setRunStatus(tr("相位故障,准备关机"));
strTitle = tr("相位故障,准备关机");
@@ -3446,7 +3457,7 @@ bool MainWidget::updatePhaseIndicatorLight(){
// on_pushButtonPausePrint_pressed();
on_m_StopBtn_clicked();
LogInfo::setRunStatusText(tr("相位故障,暂停打印"));
// setRunStatus(tr("相位故障,暂停打印")); hlp
setRunStatus(tr("相位故障,暂停打印"));
strTitle = tr("相位故障,暂停打印");
}
@@ -3455,7 +3466,7 @@ bool MainWidget::updatePhaseIndicatorLight(){
sysPara->devOp->printCtrl(PRINT_CTRL_DAC_DISABLE);
sysPara->status.DACDisable = true;
LogInfo::setRunStatusText(tr("相位故障,屏蔽DAC输出"));
// setRunStatus(tr("相位故障,屏蔽充电")); hlp
setRunStatus(tr("相位故障,屏蔽充电"));
strTitle = tr("相位故障,屏蔽充电");
}
@@ -3469,7 +3480,7 @@ bool MainWidget::updatePhaseIndicatorLight(){
bool MainWidget::eventFilter(QObject *watched, QEvent *event)
{
if (event->type() == QEvent::MouseButtonDblClick) {
//todo 双击事件,设置总数xxx,打印该数量后停止
//双击事件,设置总数xxx,打印该数量后停止
if (watched == ui.sub3 || watched == ui.labelProductCnt) {
if (m_setNumDlg) {
m_setNumDlg->show();
@@ -3495,7 +3506,7 @@ void MainWidget::onLabelFaultRusumePressed(){
sysPara->status.compressPumpError = false;
sysPara->status.compressPumpRunTmCnt = 0;
sysPara->devOp->resumeFault();
// ui.labelRunStatus->clear(); hlp
ui.lb_nozzleState->clear();
sysPara->status.beeperOnFlag = false;
sysPara->devOp->controlBeeper(false);
sysPara->status.heaterONTimeCnt = 0; //加热块计数清零
+6
View File
@@ -80,6 +80,12 @@ public:
void enableReclaimCtrlButton(bool);
void enablePrintButton(bool);
int getCurrPrintStatus();
/**
* @brief 设置回收槽开关状态
* @param isOpen true:开;false:关
* @param rate 回收槽开启程度,0~100;
*/
void setReclaimStatus(bool isOpen, int rate = 0);
void updateSysStatusToUI(); //重载
//Mainwindow获取机器总状态
+176
View File
@@ -0,0 +1,176 @@
#include "LogInfo.h"
#include "runtimectrl.h"
#include <QFileInfo>
RunTimeCtrl::RunTimeCtrl()
{
init();
}
RunTimeCtrl::~RunTimeCtrl()
{
m_checkTimer->stop();
m_alertTimer->stop();
delete m_checkTimer;
delete m_alertTimer;
}
void RunTimeCtrl::start()
{
slt_checkRunTime();
m_checkTimer->start(1000 * 60 * 5);
m_runTimer->start(1000);
}
void RunTimeCtrl::stop()
{
m_checkTimer->stop();
m_alertTimer->stop();
m_runTimer->stop();
}
void RunTimeCtrl::setAlertInterval(qint64 minutes)
{
if (minutes > 0) {
m_alertIntervalMinutes = minutes;
m_alertTimer->stop();
m_alertTimer->start(m_alertIntervalMinutes * 60 * 1000);
}
}
qint64 RunTimeCtrl::getElapsedSeconds() const
{
return m_elapsedSeconds;
}
qint64 RunTimeCtrl::getTotalSeconds() const
{
return m_totalSeconds;
}
//5min
void RunTimeCtrl::slt_checkRunTime()
{
// 检查运行时间 || 检查保养时间
if (checkRunTime() || checkTimeoutDay()) {
// 立即发送第一次提示
emit sig_alertTimeout();
// 启动定时提示器
m_alertTimer->start(m_alertIntervalMinutes * 60 * 1000);
} else {
m_alertTimer->stop();
}
}
void RunTimeCtrl::slt_recodeTime()
{
m_elapsedSeconds++;
if (m_elapsedSeconds % 30 == 0) {
m_totalSeconds += 30;
m_para.runTime += 30;
emit sig_saveRunTime();
}
}
void RunTimeCtrl::init()
{
m_checkTimer = new QTimer(this);
m_alertTimer = new QTimer(this);
m_runTimer = new QTimer(this);
// 每5分钟1次,检查运行时间
connect(m_checkTimer, &QTimer::timeout, this, &RunTimeCtrl::slt_checkRunTime);
// 每 m_alertIntervalMinutes 分钟一次消息框提示
connect(m_alertTimer, &QTimer::timeout, this, &RunTimeCtrl::sig_alertTimeout);
// 每30s,记录一次总时间
connect(m_runTimer, &QTimer::timeout, this, &RunTimeCtrl::slt_recodeTime);
}
bool RunTimeCtrl::checkRunTime()
{
// 甲方要求提示越来越频繁
// 168h 72h 24h
int runHours = m_totalSeconds/60.0/60.0;
if (runHours + 24 >= m_para.maintenanceHours) {
setAlertInterval(15); //15min
return true;
}
if (runHours + 72 >= m_para.maintenanceHours) {
setAlertInterval(60); //1h
return true;
}
if (runHours + 168 >= m_para.maintenanceHours) {
setAlertInterval(1); //3h
return true;
}
return false;
}
bool RunTimeCtrl::checkTimeoutDay()
{
return (timeoutDay < 30);
}
// 读配置 初始化的时候调用
void RunTimeCtrl::loadConfig(RFIDPara_t* para)
{
QDate curDate = QDate::currentDate();
unsigned int curDateInt = curDate.toString("yyMMdd").toInt();
// 第一次初始化
if(para->maintenanceDate == 0){
para->maintenanceDate = curDateInt;
para->maintenanceInterval = 6;
QDate mtEndDate = curDate.addMonths(para->maintenanceInterval);
para->maintenanceEndDate = mtEndDate.toString("yyMMdd").toInt();
para->runTime = 0;
para->maintenanceHours = 3000;
}
// 结束维护的天数
QString mtEndDatestr = "20" + QString::number(para->maintenanceEndDate);
QDate mtEndDate = QDate::fromString(mtEndDatestr,"yyyyMMdd");
timeoutDay = curDate.daysTo(mtEndDate);
LogInfo::setRunStatusText(tr("mtDate: %1").arg(para->maintenanceDate));
LogInfo::setRunStatusText(tr("mtInterval: %1").arg(para->maintenanceInterval));
LogInfo::setRunStatusText(tr("mtEndDate: %1").arg(para->maintenanceEndDate));
LogInfo::setRunStatusText(tr("mtFlag: %1").arg(para->needMaintenance));
LogInfo::setRunStatusText(tr("timeoutDay: %1").arg(timeoutDay));
LogInfo::setRunStatusText(tr("runTime: %1").arg(para->runTime));
LogInfo::setRunStatusText(tr("maintenanceHours: %1").arg(para->maintenanceHours));
if(timeoutDay <= 0 && !para->needMaintenance)
para->needMaintenance = true;
emit sig_updateTimeoutDay(timeoutDay);
m_para = *para;
m_totalSeconds = para->runTime;
}
void RunTimeCtrl::updatePara(RFIDPara_t* para)
{
QString mtDatestr = QString::number(para->maintenanceDate);
QDate mtDate = QDate::fromString(mtDatestr,"yyMMdd");
QDate mtEndDate = mtDate.addMonths(para->maintenanceInterval); // 结束维护日期
para->maintenanceEndDate = mtEndDate.toString("yyMMdd").toInt();
LogInfo::setRunStatusText(tr("mtDate1: %1").arg(para->maintenanceDate));
LogInfo::setRunStatusText(tr("mtInterval1: %1").arg(para->maintenanceInterval));
LogInfo::setRunStatusText(tr("mtEndDate1: %1").arg(para->maintenanceEndDate));
LogInfo::setRunStatusText(tr("mtFlog1: %1").arg(para->needMaintenance));
m_para = *para;
}
void RunTimeCtrl::authorizationAccepted(RFIDPara_t* para)
{
para->maintenanceDate = m_para.maintenanceDate;
para->maintenanceInterval = m_para.maintenanceInterval;
para->maintenanceEndDate = m_para.maintenanceEndDate;
para->runTime = m_para.runTime;
para->maintenanceHours = m_para.maintenanceHours;
updatePara(para);
}
+86
View File
@@ -0,0 +1,86 @@
#ifndef RUNTIMECTRL_H
#define RUNTIMECTRL_H
#include <QDateTime>
#include <QObject>
#include <QTimer>
#include <QSettings>
#include "SysPara.h"
/**
当前类用于统计软件运行时间、到期提醒间隔
设备保养提醒
*/
class RunTimeCtrl : public QObject
{
Q_OBJECT
public:
static RunTimeCtrl* instance() {
static RunTimeCtrl ins;
return &ins;
}
~RunTimeCtrl();
// 启动计时
void start();
// 停止计时
void stop();
// 设置提示间隔(单位:分钟,默认5分钟)
void setAlertInterval(qint64 minutes);
// 获取本次运行时间(秒)
qint64 getElapsedSeconds() const;
// 获取已运行时间(秒)
qint64 getTotalSeconds() const;
// 初始化加载参数
void loadConfig(RFIDPara_t* para);
// 更新参数
void updatePara(RFIDPara_t* para);
// 授权时
void authorizationAccepted(RFIDPara_t* para);
signals:
void sig_alertTimeout();
void sig_updateTimeoutDay(int days);
void sig_saveRunTime();
private slots:
void slt_checkRunTime();
void slt_recodeTime();
private:
RunTimeCtrl();
QTimer *m_checkTimer = nullptr; // 检查计时器
QTimer *m_alertTimer = nullptr; // 提示计时器
QTimer *m_runTimer = nullptr; // 运行计时器,记录运行时间和更新总时间
QDateTime m_startTime; // 开始时间
QDateTime m_stopTime; // 停止时间
unsigned int m_stopTimeHours = 0; // 停止时间(小时)
int m_alertIntervalMinutes = 180; // 提示间隔(分钟)
bool m_isAlter = false; // 启动提示计时器标志
quint64 m_elapsedSeconds = 0; // 本次运行的时间
quint64 m_totalSeconds = 0; // 总运行时间 30s更新一次
// todo 后续一个相关功能建立一个结构体和独立定时器
RFIDPara_t m_para;
int timeoutDay = 0;
void init();
bool checkRunTime();
bool checkTimeoutDay();
};
#endif // RUNTIMECTRL_H
+16 -2
View File
@@ -87,7 +87,16 @@ BarcodeEditor::~BarcodeEditor()
delete ui;
}
void BarcodeEditor::bindViewModel(const BarcodeViewModel& vm)
void BarcodeEditor::bindSysPara(SysPara *sysPara)
{
if (!sysPara) {
qWarning() << "BarcodeEditor::bindSysPara: null pointer passed, ignored";
return;
}
m_sysPara = sysPara;
}
void BarcodeEditor::bindViewModel(const BarcodeViewModel &vm)
{
m_vm = vm;
@@ -221,7 +230,7 @@ BarcodeViewModel BarcodeEditor::viewModel()
void BarcodeEditor::restoreViewModel()
{
m_vm.generalSettingsVM = ItemGeneralSettingsVM();
m_vm.generalSettingsVM = TextItemModel();
m_vm.contentPattern = "";
m_vm.counterViewModel = CounterViewModel();
m_vm.dateViewModel = DateItemModel::createDefaultReplaceModel();
@@ -239,6 +248,11 @@ void BarcodeEditor::applyCounterConfigToSysPara()
if(!m_vm.contentPattern.contains("{c}"))
return;
if (!m_sysPara) {
qWarning() << "BarcodeEditor::applyCounterConfigToSysPara: m_sysPara is null, skipping";
return;
}
CounterEditorVM cnt = m_counterEditor->viewModel();
if(cnt.counterType == COUNTER_TYPE_1) {
m_sysPara->para.cnt1StartValue = cnt.counter1.startValue;
+2 -2
View File
@@ -26,7 +26,7 @@ enum BarcodeType {
* 仅当 contentPattern 含有相应变量时,counterViewModel / dateViewModel 字段才有意义。
*/
struct BarcodeViewModel {
ItemGeneralSettingsVM generalSettingsVM; // 通用设置视图模型
TextItemModel generalSettingsVM; // 通用设置视图模型
QString contentPattern; // 条形码内容模版,例如 "ABC{t}{c1}"
CounterViewModel counterViewModel; // 计数器视图模型
DateItemModel dateViewModel; // 日期视图模型
@@ -104,7 +104,7 @@ public:
*
* @param sysPara
*/
void bindSysPara(SysPara* sysPara) { m_sysPara = sysPara; }
void bindSysPara(SysPara* sysPara);
/**
* @brief 注入条形码视图模型(纯结构体,按值拷贝)
+16 -16
View File
@@ -126,7 +126,7 @@ QSpinBox::down-arrow {
<widget class="QSpinBox" name="BarCodeScale">
<property name="geometry">
<rect>
<x>300</x>
<x>280</x>
<y>150</y>
<width>60</width>
<height>31</height>
@@ -173,9 +173,9 @@ QSpinBox::down-arrow {
<widget class="QComboBox" name="BarCodeDot">
<property name="geometry">
<rect>
<x>190</x>
<y>150</y>
<width>71</width>
<x>70</x>
<y>230</y>
<width>111</width>
<height>31</height>
</rect>
</property>
@@ -213,10 +213,10 @@ QSpinBox::down-arrow {
<widget class="QCheckBox" name="checkBoxAddText">
<property name="geometry">
<rect>
<x>330</x>
<y>240</y>
<width>83</width>
<height>16</height>
<x>280</x>
<y>230</y>
<width>150</width>
<height>31</height>
</rect>
</property>
<property name="sizePolicy">
@@ -240,7 +240,7 @@ QSpinBox::down-arrow {
<rect>
<x>70</x>
<y>150</y>
<width>71</width>
<width>111</width>
<height>31</height>
</rect>
</property>
@@ -248,9 +248,9 @@ QSpinBox::down-arrow {
<widget class="QComboBox" name="comboBoxInkColor">
<property name="geometry">
<rect>
<x>300</x>
<x>280</x>
<y>70</y>
<width>81</width>
<width>111</width>
<height>31</height>
</rect>
</property>
@@ -271,8 +271,8 @@ QSpinBox::down-arrow {
<widget class="QLabel" name="label_7">
<property name="geometry">
<rect>
<x>190</x>
<y>120</y>
<x>70</x>
<y>200</y>
<width>76</width>
<height>23</height>
</rect>
@@ -299,7 +299,7 @@ QSpinBox::down-arrow {
<rect>
<x>70</x>
<y>70</y>
<width>140</width>
<width>161</width>
<height>31</height>
</rect>
</property>
@@ -319,7 +319,7 @@ QSpinBox::down-arrow {
<widget class="QLabel" name="lab123">
<property name="geometry">
<rect>
<x>300</x>
<x>280</x>
<y>40</y>
<width>76</width>
<height>23</height>
@@ -335,7 +335,7 @@ QSpinBox::down-arrow {
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>300</x>
<x>280</x>
<y>120</y>
<width>129</width>
<height>23</height>
+38 -8
View File
@@ -6,6 +6,7 @@
#include "BarCode/barcode.h"
#include <QPainter>
#include <cstring>
#include <QDebug>
/**
* @brief 将libqrencode的QRcode结构渲染成QImage
@@ -308,10 +309,15 @@ static QImage generateBarCodeImage(const QString &content, int barCodeType)
return generateBarCodeImage(content, vm);
}
QString generateTxtFromDateItemModel(const DateItemModel &model, const QDateTime &time)
QString ItemUtils::generateTxtFromDateItemModel(const DateItemModel &model, const QDateTime &time)
{
QString result = model.datetimePattern;
if (!time.isValid()) {
qWarning() << "generateTxtFromDateItemModel: invalid QDateTime passed";
return result;
}
// 应用偏移量
QDateTime applyDateTime = time;
if(model.monthsOffset != 0) {
@@ -341,19 +347,37 @@ QString generateTxtFromDateItemModel(const DateItemModel &model, const QDateTime
// 匹配两位数月份 MM
i = result.indexOf("MM");
if(i != -1) {
result.replace(i, 2, model.monthsMap[applyDateTime.date().month() - 1]);
int monthIdx = applyDateTime.date().month() - 1;
if (monthIdx >= 0 && monthIdx < model.monthsMap.size()) {
result.replace(i, 2, model.monthsMap[monthIdx]);
} else {
qWarning() << "generateTxtFromDateItemModel: monthsMap index out of range:" << monthIdx;
result.replace(i, 2, QString::number(applyDateTime.date().month()).rightJustified(2, '0'));
}
}
// 匹配两位数日期 dd
i = result.indexOf("dd");
if(i != -1) {
result.replace(i, 2, model.daysMap[applyDateTime.date().day() - 1]);
int dayIdx = applyDateTime.date().day() - 1;
if (dayIdx >= 0 && dayIdx < model.daysMap.size()) {
result.replace(i, 2, model.daysMap[dayIdx]);
} else {
qWarning() << "generateTxtFromDateItemModel: daysMap index out of range:" << dayIdx;
result.replace(i, 2, QString::number(applyDateTime.date().day()).rightJustified(2, '0'));
}
}
// 匹配两位数小时 HH
i = result.indexOf("HH");
if(i != -1) {
result.replace(i, 2, model.hoursMap[applyDateTime.time().hour()]);
int hourIdx = applyDateTime.time().hour();
if (hourIdx >= 0 && hourIdx < model.hoursMap.size()) {
result.replace(i, 2, model.hoursMap[hourIdx]);
} else {
qWarning() << "generateTxtFromDateItemModel: hoursMap index out of range:" << hourIdx;
result.replace(i, 2, QString::number(applyDateTime.time().hour()).rightJustified(2, '0'));
}
}
// 匹配两位数分钟 mm
@@ -373,7 +397,13 @@ QString generateTxtFromDateItemModel(const DateItemModel &model, const QDateTime
// 格式化周几 w
i = result.indexOf("w");
if (i != -1) {
result.replace(i, 1, model.weeksMap[applyDateTime.date().dayOfWeek() - 1]);
int weekIdx = applyDateTime.date().dayOfWeek() - 1;
if (weekIdx >= 0 && weekIdx < model.weeksMap.size()) {
result.replace(i, 1, model.weeksMap[weekIdx]);
} else {
qWarning() << "generateTxtFromDateItemModel: weeksMap index out of range:" << weekIdx;
result.replace(i, 1, QString::number(applyDateTime.date().dayOfWeek()));
}
}
// 格式化年中周数 c
@@ -386,7 +416,7 @@ QString generateTxtFromDateItemModel(const DateItemModel &model, const QDateTime
}
QString generateTxtFromBarcodeViewModel(const BarcodeViewModel &vm, const std::array<int, 2> counterValues, const QDateTime &time)
QString ItemUtils::generateTxtFromBarcodeViewModel(const BarcodeViewModel &vm, const std::array<int, 2> counterValues, const QDateTime &time)
{
QString txt = vm.contentPattern;
auto pos = vm.contentPattern.indexOf("{t}");
@@ -424,7 +454,7 @@ QString generateTxtFromBarcodeViewModel(const BarcodeViewModel &vm, const std::a
* - BARCODE_TYPE_BARCODE: DlgBarcodeFormatVM(完整配置)或 int(条形码类型索引,使用默认值)
* @return QImage 生成的图像;失败返回空QImage
*/
QImage generateBarcodeImage(const QString &content, BarcodeType type, const QVariant &format)
QImage ItemUtils::generateBarcodeImage(const QString &content, BarcodeType type, const QVariant &format)
{
if (content.isEmpty()) {
return QImage();
@@ -516,7 +546,7 @@ end:
return img.copy(clipRect);
}
QImage txtToImage(const QString &txt, const QFont &font, const QColor &fgColor, const QColor &bgColor)
QImage ItemUtils::txtToImage(const QString &txt, const QFont &font, const QColor &fgColor, const QColor &bgColor)
{
if (txt.isEmpty()) {
return QImage();
+12 -9
View File
@@ -9,7 +9,10 @@
#include <array>
#include <QImage>
/**
namespace ItemUtils
{
/**
* @brief 根据日期视图模型和时间生成字符串
* @param model 包含日期格式模版和相关配置的视图模型
* @param time 用于生成字符串的时间
@@ -26,9 +29,9 @@
* - w: 星期几,支持替换为自定义字符串(通过 model.weeksMap)
* - c: 年中周数
*/
QString generateTxtFromDateItemModel(const DateItemModel& model, const QDateTime& time);
QString generateTxtFromDateItemModel(const DateItemModel& model, const QDateTime& time);
/**
/**
* @brief 根据条形码视图模型的内容模版生成字符串,
* 生成的字符串可用于创建条形码或二维码
*
@@ -45,9 +48,9 @@ QString generateTxtFromDateItemModel(const DateItemModel& model, const QDateTime
* @return QString 格式化后的字符串
*
*/
QString generateTxtFromBarcodeViewModel(const BarcodeViewModel& vm, const std::array<int, 2> counterValues, const QDateTime& time);
QString generateTxtFromBarcodeViewModel(const BarcodeViewModel& vm, const std::array<int, 2> counterValues, const QDateTime& time);
/**
/**
* @brief 根据条形码类型和内容生成条形码或二维码图像
* @param content 已格式化的文本内容
* @param type 条码类型
@@ -60,9 +63,9 @@ QString generateTxtFromBarcodeViewModel(const BarcodeViewModel& vm, const std::a
* 如果 format 是 int 类型, 对于 QR Code,0 表示 Data Matrix,1 表示 QR Code;对于条形码,int 值对应 DlgBarcodeFormatVM 中 type 的索引。
* 如果 format 是 int 类型,则使用默认配置并根据 int 值选择二维码或条形码的子类型;如果 format 是对应的 VM 类型,则使用其中的详细配置。
*/
QImage generateBarcodeImage(const QString& content, BarcodeType type, const QVariant& format);
QImage generateBarcodeImage(const QString& content, BarcodeType type, const QVariant& format);
/**
/**
* @brief 将文本转换为图像
* @param txt 要转换的文本
* @param font 文本使用的字体
@@ -71,6 +74,6 @@ QImage generateBarcodeImage(const QString& content, BarcodeType type, const QVar
* @return QImage 转换后的图像
* @note 返回的字符串图像会裁剪至最小边界以节省空间。例如字符串"aaa"的高度会比"bbbjjj"小,因为前者没有上下行部分。
*/
QImage txtToImage(const QString& txt, const QFont& font, const QColor& fgColor = Qt::black, const QColor& bgColor = Qt::white);
QImage txtToImage(const QString& txt, const QFont& font, const QColor& fgColor = Qt::black, const QColor& bgColor = Qt::white);
}
#endif // _ITEM_COMMON_H_
+2 -2
View File
@@ -38,7 +38,7 @@ void ItemGeneralSettings::edit(PicTextItem *item)
m_currItem = item;
// 从item快照创建ViewModel(如果item为空,使用默认值)
setViewModel(ItemGeneralSettingsVM::fromItem(item));
setViewModel(TextItemModel::fromItem(item));
}
void ItemGeneralSettings::initUI()
@@ -53,7 +53,7 @@ void ItemGeneralSettings::initUI()
ui->counterIDSpinBox->setValue(0);
}
void ItemGeneralSettings::setViewModel(const ItemGeneralSettingsVM &vm)
void ItemGeneralSettings::setViewModel(const TextItemModel &vm)
{
m_vmSnapshot = vm;
m_vm = vm;
+4 -44
View File
@@ -11,46 +11,6 @@ namespace Ui {
class ItemGeneralSettings;
}
/**
* @brief 图元通用属性的ViewModel
*
* 目的:解耦UI编辑器与PicTextItem,支持灵活的数据绑定和批量操作。
* UI修改属性时先更新VM,再决定何时应用到item(实时或延迟)。
*/
struct ItemGeneralSettingsVM {
// 图元类型,用于判断是否显示字间距
SourceType sourceType = SourceType::UNKNOWN;
ItemDirectionType direction = NORMAL;
int boldMultiple = 1;
int letterSpace = 0;
bool colorReversal = false;
std::function<QImage()> imageGenerator; // 图片生成函数
// 便利方法:从PicTextItem快照创建VM
static ItemGeneralSettingsVM fromItem(PicTextItem *item) {
ItemGeneralSettingsVM vm;
if (item) {
vm.sourceType = item->sourceType();
vm.direction = item->direction();
vm.boldMultiple = item->boldMultiple();
vm.letterSpace = item->letterSpace();
vm.colorReversal = item->colorReversal();
}
return vm;
}
// 检查是否有改动
bool hasDifference(const ItemGeneralSettingsVM &other) const {
return sourceType != other.sourceType ||
direction != other.direction ||
boldMultiple != other.boldMultiple ||
letterSpace != other.letterSpace ||
colorReversal != other.colorReversal;
}
};
class ItemGeneralSettings : public QWidget
{
Q_OBJECT
@@ -72,14 +32,14 @@ public:
*
* @param vm
*/
void setViewModel(const ItemGeneralSettingsVM& vm);
void setViewModel(const TextItemModel& vm);
/**
* @brief 获取当前ViewModel
*
* 调用者可以检查是否有改动,并决定是否应用
*/
ItemGeneralSettingsVM viewModel() const { return m_vm; }
TextItemModel viewModel() const { return m_vm; }
/**
* @brief 将ViewModel的属性应用到指定的PicTextItem
@@ -117,10 +77,10 @@ private:
PicTextItem* m_currItem = nullptr;
// UI编辑的状态,独立于m_currItem
ItemGeneralSettingsVM m_vm;
TextItemModel m_vm;
// 初始加载时的VM状态,用于检测改动
ItemGeneralSettingsVM m_vmSnapshot;
TextItemModel m_vmSnapshot;
QPainter m_painter;
};
+3 -3
View File
@@ -26,7 +26,7 @@ void PicDateItem::setSource(QVariant var)
if(m_model.datetimePattern.isEmpty())
return;
m_currDateTimeStr = generateTxtFromDateItemModel(m_model, QDateTime::currentDateTime());
m_currDateTimeStr = ItemUtils::generateTxtFromDateItemModel(m_model, QDateTime::currentDateTime());
applyModify();
}
@@ -47,13 +47,13 @@ bool PicDateItem::updateDatetimeStr()
return false;
if(m_currDateTimeStr.isEmpty()) {
m_currDateTimeStr = generateTxtFromDateItemModel(m_model, QDateTime::currentDateTime());
m_currDateTimeStr = ItemUtils::generateTxtFromDateItemModel(m_model, QDateTime::currentDateTime());
applyModify();
return true;
}
auto now = QDateTime::currentDateTime();
auto str = generateTxtFromDateItemModel(m_model, now);
auto str = ItemUtils::generateTxtFromDateItemModel(m_model, now);
if(str == m_currDateTimeStr) {
return false;
}
+9 -15
View File
@@ -52,22 +52,20 @@ ScheduleShiftsEditor::~ScheduleShiftsEditor()
delete ui;
}
void ScheduleShiftsEditor::edit(PicScheduleShiftItem* item)
void ScheduleShiftsEditor::setItemModel(QVector<ScheduleModel> schedulesModel, TextItemModel txtModel)
{
m_backup.clear();
m_generalSettings->edit(item);
if(item) {
item->saveAttrs(m_backup);
m_dataModel = item->schedules();
}
else {
m_dataModel.clear();
}
m_generalSettings->setViewModel(txtModel);
m_dataModel = schedulesModel;
applyDataModel();
}
const QVector<ScheduleModel>& ScheduleShiftsEditor::dataModel() const
TextItemModel ScheduleShiftsEditor::textItemModel()
{
return m_generalSettings->viewModel();
}
const QVector<ScheduleModel>& ScheduleShiftsEditor::scheduleModel() const
{
return m_dataModel;
}
@@ -79,10 +77,6 @@ PicScheduleShiftItem *ScheduleShiftsEditor::currEditItem()
void ScheduleShiftsEditor::onBtnCloseClicked()
{
if(currEditItem()) {
currEditItem()->setAttrs(m_backup);
}
emit rejected();
}
+5 -3
View File
@@ -35,7 +35,11 @@ public:
void edit(PicScheduleShiftItem* item);
const QVector<ScheduleModel>& dataModel() const;
void setItemModel(QVector<ScheduleModel> schedulesModel, TextItemModel txtModel);
TextItemModel textItemModel();
const QVector<ScheduleModel>& scheduleModel() const;
PicScheduleShiftItem* currEditItem();
@@ -59,8 +63,6 @@ private:
Ui::ScheduleShiftsEditor *ui;
QVector<ScheduleModel> m_dataModel;
ItemGeneralSettings* m_generalSettings = nullptr;
QXmlStreamAttributes m_backup;
};
#endif // SCHEDULESHIFTSEDITOR_H
+13 -2
View File
@@ -37,17 +37,23 @@ void PicCodeItem::setBarcodeViewModel(const BarcodeViewModel &vm)
{
m_vm = vm;
m_currCodeTxt = "";
setTextItemModel(m_vm.generalSettingsVM);
updateVariants();
qInfo() << "Barcode model: \r\n" << qPrintable(BarcodeViewModel::toString(vm));
}
BarcodeViewModel PicCodeItem::barcodeViewModel()
{
m_vm.generalSettingsVM = textItemModel();
return m_vm;
}
bool PicCodeItem::updateVariants(const QVector<int> counters)
{
if (counters.size() < 2) {
qWarning() << "PicCodeItem::updateVariants: counters size insufficient:" << counters.size() << ", expected >= 2";
return false;
}
m_currCounterValues = counters;
return updateVariants();
}
@@ -70,10 +76,15 @@ void PicCodeItem::saveCustomAttrs(QXmlStreamAttributes &attrs)
bool PicCodeItem::updateVariants()
{
auto txt = generateTxtFromBarcodeViewModel(m_vm, {m_currCounterValues[0], m_currCounterValues[1]}, QDateTime::currentDateTime());
if (m_currCounterValues.size() < 2) {
qWarning() << "PicCodeItem::updateVariants: m_currCounterValues size < 2, cannot generate barcode text";
return false;
}
auto txt = ItemUtils::generateTxtFromBarcodeViewModel(m_vm, {m_currCounterValues[0], m_currCounterValues[1]}, QDateTime::currentDateTime());
if(txt != m_currCodeTxt || m_currCodeTxt.isEmpty()) {
m_currCodeTxt = txt;
m_codeImage = generateBarcodeImage(txt, m_vm.type, m_vm.format);
m_codeImage = ItemUtils::generateBarcodeImage(txt, m_vm.type, m_vm.format);
applyModify();
return true;
}
+26
View File
@@ -300,6 +300,19 @@ QImage PicTextItem::preview()
{
return m_itemImage;
}
void PicTextItem::setTextItemModel(const TextItemModel &model)
{
setLetterSpace(model.letterSpace);
setBoldMultiple(model.boldMultiple);
setDirection(model.direction);
setColorReversal(model.colorReversal);
}
TextItemModel PicTextItem::textItemModel()
{
return TextItemModel::fromItem(this);
}
//! [1]
QVariant PicTextItem::itemChange(GraphicsItemChange change,
const QVariant &value)
@@ -441,3 +454,16 @@ QPointF PicTextItem::clampItemPos(const QPointF &p)
return QPointF (std::min(qreal(scene()->width() - boundingRect().width()), std::max(0.0, p.x())),
std::min(qreal(scene()->height() - boundingRect().height()), std::max(0.0, p.y())));
}
TextItemModel TextItemModel::fromItem(PicTextItem *item)
{
TextItemModel vm;
if (item) {
vm.sourceType = item->sourceType();
vm.direction = item->direction();
vm.boldMultiple = item->boldMultiple();
vm.letterSpace = item->letterSpace();
vm.colorReversal = item->colorReversal();
}
return vm;
}
+37
View File
@@ -42,6 +42,39 @@ enum SourceType{
COUNTER,
};
class PicTextItem;
/**
* @brief 图元通用属性的ViewModel
*
* 目的:解耦UI编辑器与PicTextItem,支持灵活的数据绑定和批量操作。
* UI修改属性时先更新VM,再决定何时应用到item(实时或延迟)。
*/
struct TextItemModel {
// 图元类型,用于判断是否显示字间距
SourceType sourceType = SourceType::UNKNOWN;
ItemDirectionType direction = NORMAL;
int boldMultiple = 1;
int letterSpace = 0;
bool colorReversal = false;
std::function<QImage()> imageGenerator; // 图片生成函数
// 便利方法:从PicTextItem快照创建VM
static TextItemModel fromItem(PicTextItem *item);
// 检查是否有改动
bool hasDifference(const TextItemModel &other) const {
return sourceType != other.sourceType ||
direction != other.direction ||
boldMultiple != other.boldMultiple ||
letterSpace != other.letterSpace ||
colorReversal != other.colorReversal;
}
};
class PicTextItem : public QGraphicsTextItem
{
Q_OBJECT
@@ -121,6 +154,10 @@ public:
*/
QImage preview();
void setTextItemModel(const TextItemModel& model);
TextItemModel textItemModel();
signals:
void lostFocus(PicTextItem *item);
void selectedChange(QGraphicsItem *item);
+1 -1
View File
@@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
<string>设置计数器</string>
</property>
<widget class="QCheckBox" name="cb_setNum">
<property name="geometry">
+1537 -789
View File
File diff suppressed because it is too large Load Diff
+5 -3
View File
@@ -1376,7 +1376,7 @@ void TestPrintWidget::onBtnItemConfigClicked()
if(item->sourceType() == SourceType::SCHEDULE_SHIFT) {
auto scheduleItem = dynamic_cast<PicScheduleShiftItem*>(item);
emit sig_showScheduleShiftsEditor(scheduleItem);
emit sig_showScheduleShiftsEditor(scheduleItem->schedules(), scheduleItem->textItemModel());
return;
}
@@ -1561,7 +1561,7 @@ void TestPrintWidget::addDateTimeItem(const DateItemModel &model)
item->setModel(model);
}
void TestPrintWidget::addScheduleShiftsItem(QVector<ScheduleModel> schedules)
void TestPrintWidget::addScheduleShiftsItem(QVector<ScheduleModel> schedules, TextItemModel txtModel)
{
// 如果当前选中了一个日期时间item,则直接设置模型
auto selectItems = pPicScene->selectedItems();
@@ -1570,6 +1570,7 @@ void TestPrintWidget::addScheduleShiftsItem(QVector<ScheduleModel> schedules)
if(item->sourceType() == SourceType::SCHEDULE_SHIFT) {
auto scheduleItem = dynamic_cast<PicScheduleShiftItem*>(item);
scheduleItem->setSchedules(schedules);
scheduleItem->setTextItemModel(txtModel);
return;
}
}
@@ -1584,6 +1585,7 @@ void TestPrintWidget::addScheduleShiftsItem(QVector<ScheduleModel> schedules)
item->setPos(boundingRect.right(), 0.0);
item->setSelected(true);
item->setSchedules(std::move(schedules));
item->setTextItemModel(txtModel);
}
void TestPrintWidget::addCounterItem(CounterViewModel vm, QSharedPointer<QFont> f)
@@ -1654,7 +1656,7 @@ void TestPrintWidget::showBarcodeEditor(bool restoreViewModel)
void TestPrintWidget::onBtnArrowClicked()
{
pPicScene->clearSelection();
emit sig_showScheduleShiftsEditor(nullptr);
emit sig_showScheduleShiftsEditor(QVector<ScheduleModel>(), TextItemModel());
}
void TestPrintWidget::on_btn_copy_clicked()
+2 -2
View File
@@ -74,7 +74,7 @@ public:
void addDateTimeItem(const DateItemModel& model);
void addScheduleShiftsItem(QVector<ScheduleModel> schedules);
void addScheduleShiftsItem(QVector<ScheduleModel> schedules, TextItemModel txtModel);
void addCounterItem(CounterViewModel vm, QSharedPointer<QFont> font = nullptr);
@@ -216,7 +216,7 @@ signals:
// 如果item为null,表明是从新建按钮发出的,如果item不为null,表明用户正在尝试编辑一个日期item
void sig_showEditDataTime(PicDateItem* item);
void sig_showScheduleShiftsEditor(PicScheduleShiftItem* item);
void sig_showScheduleShiftsEditor(QVector<ScheduleModel> schedules, TextItemModel txtModel);
};
#endif // TESTPRINTWIDGET_H
+1537 -789
View File
File diff suppressed because it is too large Load Diff
+1537 -789
View File
File diff suppressed because it is too large Load Diff
+1537 -789
View File
File diff suppressed because it is too large Load Diff