#include "PrintSetting.h" #include "ui_printsetting.h" #include "SysPara.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "DevOp.h" #include "Public.h" #include "LogInfo.h" #include #include #include #include #include #include "myinclude.h" #include #include #include"scene/picscene.h" #include"scene/pictextitem.h" #include #include #include "rfid/rfidmanager.h" #include PrintSetting::PrintSetting(QWidget *parent) : QWidget(parent), ui(new Ui::PrintSetting) { ui->setupUi(this); ui->comboBoxPrintMode->setView(new QListView()); dialogAuthorization = new DialogAuthorization(parent); dialogAuthVarSet = new DialogAuthorization(parent); dialogModuleSeletion = new DialogModuleSeletion(parent); last_area_end = 0; area_end = 0; lockpulse = false; dialogShowCounter = new DialogShowCounter(parent); dialogShowCounter->setLCDframe(); dialogShowCounter->hide(); connect(dialogShowCounter,SIGNAL(rejected()),this,SLOT(ondialogShowCounterAccepted())); connect(dialogShowCounter,SIGNAL(accepted()),this,SLOT(ondialogShowCounterAccepted())); refresh_timer = new QTimer(); connect(refresh_timer, SIGNAL(timeout()), this, SLOT(refreshtimerHandler())); ui->volButton->hide(); dlgInputAddr = new DlgInputAddr(parent); dlgInputAddr->GetAddr(); dlgInputAddr->vpnConnect(); dlgInputAddr->hide(); dlgvarLen = new DlgVarLength(parent); dlgvarLen->hide(); connect(dialogAuthorization,SIGNAL(accepted()),this,SLOT(ondialogAuthorizationAccepted())); connect(dialogAuthVarSet,SIGNAL(accepted()),this,SLOT(ondialogAuthVarSetAccepted())); //connect(this,SIGNAL(authChanged(int )),this,SLOT(showVolDacEdit(int ))); connect(dlgInputAddr,SIGNAL(changeMac(QString)),ui->labMac,SLOT(setText(QString))); connect(dlgInputAddr,SIGNAL(changeMac(QString)),this,SLOT(updateMachineMac(QString))); connect(dlgInputAddr,SIGNAL(changeMac(QString)),this,SLOT(showMachInfo(QString))); connect(ui->pushButtonVAR,SIGNAL(pressed()),this,SLOT(on_checkVarLenChg())); connect(dlgvarLen,SIGNAL(on_set()),this,SLOT(on_VarLenSet())); if(Public::ReadLanguageName()=="Chinese"){ ui->labelZFGD->setPixmap(QPixmap(QString::fromUtf8(":/image/AH12.png"))); }else { ui->labelZFGD->setPixmap(QPixmap(QString::fromUtf8(":/image/AH13.png"))); } //ui->labelZFGD->setPixmap(QPixmap(QString::fromUtf8(":/image/AH12.png"))); dialogAuthorization->hide(); auth = AUTH_NONE; //showVolDacEdit(auth); // ui->pushTestSysSet->hide(); //ui->spinBoxFullColFixVal->hide(); ui->tabWidget_2->removeTab(1);//去掉高级设置标签 ui->tabWidget_2->setCurrentIndex(0); ui->tabWidget->setCurrentIndex(0); ui->tabWidget->widget(1)->setStyleSheet("color:blue"); #ifdef COUNTER1_BY_GROUP /* 分段计米 */ QStringList headerLabels = QStringList()<tableWidget->setHorizontalHeaderLabels(headerLabels); ui->tableWidget->setFocusPolicy(Qt::NoFocus); ui->tableWidget->horizontalHeader()->setHighlightSections(false); ui->tableWidget->setColumnHidden(3,true);//第3列用来标志是否保存当前行 QHeaderView* vertivalHeader = ui->tableWidget->verticalHeader(); vertivalHeader->setFixedWidth(60); ui->tableWidget->setColumnWidth(2,120); //高级设置隐藏选项 flagOfSpecailSettng = 0; SpecailSettingsDisplay(); //工程模式隐藏选项 flagOfEngineeringMode = 0; EngineeringModeDisplay(); flagOfModuleDecimal = 0; ModuleDecimalDisplay(); flagOfModuleHide = 0; ModuleHideDisplay(); specailMachineSetting(0); #else delete ui->tableWidget; delete ui->checkBoxGroupCnt1; delete ui->Cnt3AddRowBtn; delete ui->Cnt3InsertRowBtn; delete ui->Cnt3RemoveRowBtn; delete ui->cnt3RemoveAllRowsBtn; #endif #ifdef SPACEFLAG #else #endif current_print_col_num=0; ui->tabWidget_2->addTab(ui->tab_11,tr("打印电压缩放")); } PrintSetting::~PrintSetting() { delete ui; delete dialogAuthorization; delete refresh_timer; } void PrintSetting::on_checkVarLenChg() { //DlgVarLength dlg; //bool en = ui->checkVARLEN->isChecked(); if(sysPara) { dialogAuthVarSet->clearAuth(); dialogAuthVarSet->show(); } } void PrintSetting::on_VarLenSet() { //qDebug()<<"on_set"; if(sysPara){ sysPara->para.headLen=dlgvarLen->headLen; sysPara->para.endLen=dlgvarLen->endLen; sysPara->para.varLen=dlgvarLen->varLen; sysPara->para.varLen1=dlgvarLen->varLen1; sysPara->para.varLenEn = dlgvarLen->varEn; ui->checkVARLEN->setChecked(dlgvarLen->varEn); if( sysPara->para.synTriggerPrintLenMm < dlgvarLen->varLen || sysPara->para.synTriggerPrintLenMm < dlgvarLen->varLen1) { QMessageBox::information(this,tr("提示:可变长度参数不正确"),tr("要求:调整长度小于喷印间隔")); } } } void PrintSetting::ondialogAuthVarSetAccepted(){ QString authString = dialogAuthVarSet->getAuth(); if(authString == "07710665") { dlgvarLen->headLen = sysPara->para.headLen; dlgvarLen->endLen = sysPara->para.endLen; dlgvarLen->varLen = sysPara->para.varLen; dlgvarLen->varLen1 = sysPara->para.varLen1; dlgvarLen->varEn=sysPara->para.varLenEn; dlgvarLen->applyUI(sysPara->para.cnt1EndValue - sysPara->para.cnt1StartValue+1);//sysPara->para.synTriggerPrintLenMm //dlgvarLen->lab_4->setText("ddd"); dlgvarLen->show(); dlgvarLen->setFocus(); //sysPara->para.varLenEn = en; } } void PrintSetting::bindSysPara(SysPara *sysPara){ this->sysPara =sysPara; //ui->volDacEdit //ui->volDacEdit->bindSysPara(sysPara); #ifdef COUNTER2_BY_GROUP ui->secionCountPanel->hide(); ui->tabWidget_2->addTab(ui->tab_9,tr("其他设置")); initSection(); #endif } void PrintSetting::PrintupdateSysParaToUI() { updateSysParaToUI(); } void PrintSetting::updateSysParaToUI(){ if(sysPara){ ui->checkVARLEN->setChecked(sysPara->para.varLenEn?1:0); ui->checkBoxNewAmplifyPlate->setChecked(sysPara->para.newAmplifyPlate); ui->comBoxExtSrceen->setCurrentIndex(sysPara->para.ExtScreenType); ui->comBoxExtMeterType->setCurrentIndex(sysPara->para.ExtMeterType); ui->checkBoxLeftRightInverse->setChecked(sysPara->para.leftRightInverse); ui->checkBoxUpDownInverse->setChecked(sysPara->para.upDownInverse); ui->checkBoxScanInverse->setChecked(sysPara->para.scanInverse); ui->checkBoxRecycleWarnAction->setChecked(sysPara->para.RecycleWarnAction); ui->checkBoxPowerOffAfterPhaseFault->setChecked(sysPara->para.powerOffAfterPhaseFault); ui->checkBoxSuspendAfterPhaseFault->setChecked(!sysPara->para.powerOffAfterPhaseFault); ui->checkBoxSuspendAfterPhaseFault->setChecked(sysPara->para.suspendAfterPhaseFault); ui->checkBoxStopCounterMeterAfterFault->setEnabled(sysPara->para.suspendAfterPhaseFault); ui->checkBoxStopCounterMeterAfterFault->setChecked(sysPara->para.stopCounterMeterAfterFault); ui->comboBoxPrintMode->setCurrentIndex(sysPara->para.currPrintMode); ui->spinBox_gearPumpSpeedAlarm->setValue(sysPara->para.gearPumpSpeedAlarm); /*----------------------------------------*/ ui->spinBoxColDelay->setValue(sysPara->para.printColDelay); ui->spinBoxColRepeatCnt->setValue(sysPara->para.charBold); ui->spinBoxCnt1EndValue->setValue(sysPara->para.cnt1EndValue); ui->spinBoxCnt1RepeateCnt->setValue(sysPara->para.cnt1RepeateValue); ui->spinBoxCnt1StartValue->setValue(sysPara->para.cnt1StartValue); ui->spinBoxCnt1StepValue->setValue(sysPara->para.cnt1StepValue); ui->spinBoxCnt1CurrValue->setValue(sysPara->para.cnt1CurrValue); ui->spinBoxCnt2EndValue->setValue(sysPara->para.cnt2EndValue); ui->spinBoxCnt2RepeateCnt->setValue(sysPara->para.cnt2RepeateValue); ui->spinBoxCnt2StartValue->setValue(sysPara->para.cnt2StartValue); ui->spinBoxCnt2StepValue->setValue(sysPara->para.cnt2StepValue); ui->spinBoxCnt2CurrValue->setValue(sysPara->para.cnt2CurrValue); ui->spinBoxCnt3EndValue->setValue(sysPara->para.cnt3EndValue); ui->spinBoxCnt3RepeateCnt->setValue(sysPara->para.cnt3RepeateValue); ui->spinBoxCnt3StartValue->setValue(sysPara->para.cnt3StartValue); ui->spinBoxCnt3StepValue->setValue(sysPara->para.cnt3StepValue); ui->spinBoxCnt3CurrValue->setValue(sysPara->para.cnt3CurrValue); ui->spinBoxStartVoltage->setValue(sysPara->para.startVoltage); ui->spinBoxEndVoltage->setValue(sysPara->para.endVoltage); ui->spinBoxHighVoltageValue->setValue(sysPara->para.HighVoltageAmplitude); ui->spinBoxReducedPixelNum->setValue(sysPara->para.reducedPixelNumRatio); ui->comboBoxReducedPixMode->setCurrentIndex(sysPara->para.reducedPixelMode); ui->spinBoxRowSequenceMode->setValue(sysPara->para.rowSequenceMode); ui->spinBoxPointVoltageAdjustPos->setValue(sysPara->para.pointVoltageAdjustPos); ui->spinBoxVoltageAdjustValue->setValue(sysPara->para.PointVoltageAdjustValue); ui->spinBoxLineEndAdjustPointCnt->setValue(sysPara->para.lineEndAdjustPointCnt); ui->comboBoxLineEndAdjustPointMode->setCurrentIndex(sysPara->para.lineEndAdjustPointDelay); ui->spinBoxLastLineEndPointFixedValue->setValue(sysPara->para.lastLineEndPointFixedValue); // ui->spinBoxFullColFixVal->setValue(sysPara->para.FullColFixVal); ui->radioButtonFUllColFIxVal->setChecked(sysPara->para.FullColFixVal); ui->comboBox_selcetVolPara->setCurrentIndex(sysPara->para.currSelectVolPara); //隐藏功能 ui->radioButtonSpecialCondition->setChecked(sysPara->para.HiddenFuncEnable); ui->spinBoxHiddenValue->setValue(sysPara->para.cnt4CurrValue); ui->spinBoxConditionValue->setValue(sysPara->para.HiddenConditionValue); ui->spinBoxMeterEnable->setValue(sysPara->para.HiddenMeterEnable); // sysPara->status.cnt4CurrValue = sysPara->para.cnt4CurrValue; sysPara->status.specialVarPrint.SpecialConditionValue = sysPara->para.HiddenConditionValue ; sysPara->status.specialVarPrint.SpecialVarEnable =sysPara->para.HiddenFuncEnable ; sysPara->status.specialVarPrint.MeterEnable = sysPara->para.HiddenMeterEnable; if(sysPara->status.specialVarPrint.SpecialVarEnable) sysPara->status.specialVarPrint.SpecialVarEnable = 0xFF; if(sysPara->status.specialVarPrint.MeterEnable) sysPara->status.specialVarPrint.MeterEnable = 0xFF; emit HiddenFunction(ui->radioButtonSpecialCondition->isChecked()); if(sysPara->para.HiddenFuncEnable) { // emit HiddenFunction(ui->radioButtonSpecialCondition->isChecked()); ui->spinBoxdecimalpointnum->setValue(0); ui->spinBoxdecimalpointnum->setEnabled(false); ui->radioButtonSpecialCondition->setEnabled(true); ui->spinBoxHiddenValue->setEnabled(true); ui->spinBoxConditionValue->setEnabled(true); ui->spinBoxMeterEnable->setEnabled(true); } if(!sysPara->para.rrr_nc) { if(!sysPara->para.printNumPoint) ui->spinBoxdecimalpointnum->setValue(0); else ui->spinBoxdecimalpointnum->setValue(1); } else { if(!sysPara->para.printNumPoint) ui->spinBoxdecimalpointnum->setValue(2); else ui->spinBoxdecimalpointnum->setValue(3); } ui->comboBoxIndustry->setCurrentIndex(sysPara->para.industryIndex); ui->comboBoxRecommendedPrintSpeed->setCurrentIndex(sysPara->para.recommendedPrintSpeed); ui->comboBoxAlterPrintEnable->setCurrentIndex (sysPara->para.alterPrint.enable );// 修改后的 if(sysPara->para.alterPrint.enable == 0) { ui->spinBoxXStartValue->setEnabled(false); ui->spinBoxXRepeatTimeValue->setEnabled(false); ui->spinBoxXGapValue->setEnabled(false); } ui->spinBoxXStartValue->setValue (sysPara->para.alterPrint.startValue ); ui->spinBoxXGapValue->setValue (sysPara->para.alterPrint.repeatValue); ui->spinBoxXRepeatTimeValue->setValue (sysPara->para.alterPrint.repeatPrintTimes); ui->spinBoxDistanceTail->setValue(sysPara->para.alterPrint.DistanceTail ); ui->checkBoxCnt1NatureValue->setChecked ( sysPara->para.Cnt1NatureValue); // ui->checkBoxSpeedOver->setChecked(sysPara->para.speedoverPaushPrint); ui->checkSynCntEn->setChecked(sysPara->para.SynCntEn); ui->checkVol1of8En->setChecked(sysPara->para.Vol1of8En); ui->checkBoxEleEyeRetrigDis->setChecked( sysPara->para.eleEyeReTrigDisable ); ui->checkmode0211->setChecked(sysPara->para.mode0211); ui->resetToCnt1InitValueCheckBox->setChecked(sysPara->para.cnt1ResetToInitValue); qDebug()<<"checkmode0211:"<para.mode0211; qDebug()<<"checkVol1of8En:"<para.Vol1of8En; qDebug()<<"radioButtonFUllColFIxVal:"<para.FullColFixVal; qDebug()<<"checkBoxCharWidthSet:"<para.charWidthSetEnable; //ui->checkBoxPrintOnce->setChecked(sysPara->para.printOnce); //ui->checkBoxNumPoint->setChecked(sysPara->para.printNumPoint); ui->checkBoxReciclar->setChecked(sysPara->para.Reciclar); ui->dacScaledSpinBox->setValue(sysPara->para.dacScale); ui->checkBoxResetSendData->setChecked(sysPara->para.ResetSendData); ui->spinBoxJumpStartValue->setValue( sysPara->para.stepPrint.startValue ); ui->spinBoxJumpEndValue->setValue( sysPara->para.stepPrint.endValue ); //ui->checkBoxStepPrintEn->setEnabled( sysPara->para.stepPrint.enbale ); ui->checkBoxStepPrintEn->setChecked( sysPara->para.stepPrint.enbale ); ui->spinBoxJumpStepValue->setValue(sysPara->para.stepPrint.StepValue); ui->checkProductResetEn->setChecked(sysPara->para.ResetProductCntEn); ui->checkAllProductResetEn->setChecked(sysPara->para.ResetAllProductCntEn); ui->checkHVFaultCloseEn->setChecked(sysPara->para.HVFaultCloseEn); // 电眼触发计数器动作 选择 ui->eleCNT1IncEn->setChecked( (sysPara->para.eleEyeClearCntInSynMode & 0x10)?1:0); ui->radCNT1ResetEn->setChecked( (sysPara->para.eleEyeClearCntInSynMode & 0x10)?0:1); ui->eleCNT2IncEn->setChecked( (sysPara->para.eleEyeClearCntInSynMode & 0x20)?1:0); ui->radCNT2ResetEn->setChecked( (sysPara->para.eleEyeClearCntInSynMode & 0x20)?0:1); ui->eleCNT3IncEn->setChecked( (sysPara->para.eleEyeClearCntInSynMode & 0x40)?1:0); ui->radCNT3ResetEn->setChecked( (sysPara->para.eleEyeClearCntInSynMode & 0x40)?0:1); ui->checkBoxGearPumpEnable->setChecked(sysPara->para.gearPumpEnable); ui->checkBox_ReclaimPumpEnable->setChecked(sysPara->para.flagOfReclaimPumEnable); ui->checkBoxCharWidthSet->setChecked(sysPara->para.charWidthSetEnable); ui->checkBoxMagnet->setChecked(sysPara->para.isCheckMagnet); ui->printfLightCheckBox->setChecked(sysPara->para.isCheckPrintLight); ui->phaseHighCntSpinBox->setValue( sysPara->para.phaseHighCnt); sysPara->para.bcOption.var1Num=ui->spinBoxCnt1EndValue->text().length(); sysPara->para.bcOption.var2Num=ui->spinBoxCnt2EndValue->text().length(); ui->checkBox_FastMode->setChecked(sysPara->para.flagOfFastMode); ui->labMac->setText(QString(" Mac:%1").arg(dlgInputAddr->jd.addr)); sysPara->status.machineMac = dlgInputAddr->jd.addr; showMachInfo(QString::number(dlgInputAddr->jd.addr)); ui->CBDateFormat1->setCurrentIndex(sysPara->para.ExpirySplitMode);//p_var->splitMode ui->spinBoxExpiryDate->setValue(sysPara->para.ExpiryDay); //on_spinBoxExpiryDate_valueChanged(sysPara->print.ExpiryVar.); ui->checkBoxSaveCNTStateValue->setCheckState(sysPara->para.isCntSaveStateValue ? Qt::Checked : Qt::Unchecked); flagOfModuleDecimal = sysPara->para.flagOfModuleDecimal; ModuleDecimalDisplay(); flagOfModuleHide = sysPara->para.flagOfModuleHide; ModuleHideDisplay(); displayForAdjustVoltage(sysPara->para.flagOfAdjustVoltage); #ifdef COUNTER2_BY_GROUP SectionalManager::instance()->emitLoadUI(); #else LoadCnt1GroupSettingsToUI(); #endif if(sysPara->para.mode0211 || sysPara->para.FullColFixVal) { ui->spinBoxStartVoltage->setEnabled(false); ui->spinBoxEndVoltage->setEnabled(false); } // if(sysPara->para.flagOfCnt1GroupDisp) // { // //edit@12-03 // const int indexTab=ui->tabWidget_2->indexOf(ui->tab_9); // if(-1==indexTab) { // ui->tabWidget_2->addTab(ui->tab_9,tr("其他设置")); // } // } if(sysPara->para.flagOfstepPrint) { //edit@12-03 const int indexTab=ui->tabWidget->indexOf(ui->tab_6); if(-1==indexTab) ui->tabWidget->addTab(ui->tab_6,tr("跳米设置")); } } } #include "VerBVersion.h" void PrintSetting::showMachInfo(QString Mac) { QString VernonBach; VernonBach.sprintf("%s.%s.", MACHINAE_VER, PUMP_VER); VernonBach = VernonBach + (QString) Public::DateToString(__DATE__)+"_";//+UP_PRINTER_STAGE_VER; } void PrintSetting::showRemoteControl(QString SuperNodeIP,QString EdgeIP) { QString VernonBach; VernonBach.sprintf("%s.%s.", MACHINAE_VER, PUMP_VER); VernonBach = VernonBach + (QString) Public::DateToString(__DATE__)+"_";//+UP_PRINTER_STAGE_VER; } void PrintSetting::applyUIPara(){ if(sysPara){ LogInfo::setRunStatusText(tr("addr: %1").arg(addr)); LogInfo::setRunStatusText(tr("data: %1").arg(data)); LogInfo::setRunStatusText(tr("len: %1").arg(len)); sysPara->para.ExtScreenType = ui->comBoxExtSrceen->currentIndex(); sysPara->para.ExtMeterType = ui->comBoxExtMeterType->currentIndex(); sysPara->para.gearPumpSpeedAlarm = ui->spinBox_gearPumpSpeedAlarm->value(); if(sysPara->para.ExtScreenType==0) { sysPara->status.ExtScreenEn =0; } ui->spinBoxColDelay->setEnabled(1); sysPara->para.varLenEn = ui->checkVARLEN->isChecked(); sysPara->para.checkSpace = 0;//ui->checkSpace->isChecked(); sysPara->para.leftRightInverse = ui->checkBoxLeftRightInverse->isChecked(); sysPara->para.upDownInverse = ui->checkBoxUpDownInverse->isChecked(); sysPara->para.scanInverse = ui->checkBoxScanInverse->isChecked(); sysPara->para.currPrintMode = ui->comboBoxPrintMode->currentIndex(); sysPara->para.currSelectVolPara = ui->comboBox_selcetVolPara->currentIndex(); sysPara->para.suspendAfterPhaseFault = ui->checkBoxSuspendAfterPhaseFault->isChecked(); sysPara->para.powerOffAfterPhaseFault = ui->checkBoxPowerOffAfterPhaseFault->isChecked(); sysPara->para.RecycleWarnAction = ui->checkBoxRecycleWarnAction->isChecked(); sysPara->para.stopCounterMeterAfterFault = ui->checkBoxStopCounterMeterAfterFault->isChecked(); sysPara->para.printColDelay = ui->spinBoxColDelay->value(); sysPara->para.cnt1EndValue = ui->spinBoxCnt1EndValue->value(); sysPara->para.cnt1RepeateValue = ui->spinBoxCnt1RepeateCnt->value(); sysPara->para.cnt1StartValue = ui->spinBoxCnt1StartValue->value(); sysPara->para.cnt1StepValue = ui->spinBoxCnt1StepValue->value(); sysPara->para.cnt1CurrValue = ui->spinBoxCnt1CurrValue->value(); //这个值设置没关系,在关机前还会再此被设置 sysPara->para.cnt2EndValue = ui->spinBoxCnt2EndValue->value(); sysPara->para.cnt2RepeateValue = ui->spinBoxCnt2RepeateCnt->value(); sysPara->para.cnt2StartValue = ui->spinBoxCnt2StartValue->value(); sysPara->para.cnt2StepValue = ui->spinBoxCnt2StepValue->value(); sysPara->para.cnt2CurrValue = ui->spinBoxCnt2CurrValue->value(); sysPara->para.newAmplifyPlate = ui->checkBoxNewAmplifyPlate->isChecked(); sysPara->para.cnt3EndValue = ui->spinBoxCnt3EndValue->value(); sysPara->para.cnt3RepeateValue = ui->spinBoxCnt3RepeateCnt->value(); sysPara->para.cnt3StartValue = ui->spinBoxCnt3StartValue->value(); sysPara->para.cnt3StepValue = ui->spinBoxCnt3StepValue->value(); sysPara->para.cnt3CurrValue = ui->spinBoxCnt3CurrValue->value(); sysPara->para.startVoltage = ui->spinBoxStartVoltage->value(); sysPara->para.endVoltage = ui->spinBoxEndVoltage->value(); sysPara->para.charBold = ui->spinBoxColRepeatCnt->value(); sysPara->para.HighVoltageAmplitude = ui->spinBoxHighVoltageValue->value(); sysPara->devOp->setHighVoltageAmplitudetoSTM32(); sysPara->status.cnt1CurrentValueInitDoneFlag = !ui->checkBoxResetCnt1CurrValue->isChecked(); sysPara->status.cnt2CurrentValueInitDoneFlag = !ui->checkBoxResetCnt2CurrValue->isChecked(); sysPara->status.cnt3CurrentValueInitDoneFlag = !ui->checkBoxResetCnt3CurrValue->isChecked(); //将vx4的分段计米功能迁移了,这个应用设置后续会删除 hlp todo 0602 #ifndef COUNTER2_BY_GROUP if(sysPara->para.cnt1ByGroupEnalbe) ApplyCnt1GroupSetting(); #endif sysPara->para.flagOfFastMode = ui->checkBox_FastMode->isChecked(); if(sysPara->para.flagOfFastMode){ if(ui->comboBoxPrintMode->count()>=3){ ui->comboBoxPrintMode->setItemText(0,tr("超高速")); ui->comboBoxPrintMode->setItemText(1,tr("高速")); ui->comboBoxPrintMode->removeItem(2); } }else{ if(ui->comboBoxPrintMode->count()<3){ ui->comboBoxPrintMode->setItemText(0,tr("快速")); ui->comboBoxPrintMode->setItemText(1,tr("标准")); ui->comboBoxPrintMode->addItem(tr("慢速")); } } if(sysPara->para.EditMode==TXTFILE) { sysPara->status.specialVarPrint.SpecialVarEnable = ui->radioButtonSpecialCondition->isChecked(); sysPara->status.cnt4CurrValue = ui->spinBoxHiddenValue->value(); sysPara->status.specialVarPrint.MeterEnable = ui ->spinBoxMeterEnable->value(); sysPara ->status.specialVarPrint.SpecialConditionValue = ui->spinBoxConditionValue->value(); if(sysPara->status.specialVarPrint.SpecialVarEnable) sysPara->status.specialVarPrint.SpecialVarEnable = 0xFF; if(sysPara->status.specialVarPrint.MeterEnable) sysPara->status.specialVarPrint.MeterEnable = 0xFF; sysPara->para.cnt4CurrValue = sysPara->status.cnt4CurrValue; sysPara->para.HiddenConditionValue = sysPara->status.specialVarPrint.SpecialConditionValue; sysPara->para.HiddenFuncEnable = sysPara->status.specialVarPrint.SpecialVarEnable; sysPara->para.HiddenMeterEnable = sysPara->status.specialVarPrint.MeterEnable; } sysPara->devOp->writeFpgaCalandar(0); sysPara->para.reducedPixelNumRatio = ui->spinBoxReducedPixelNum->value(); sysPara->para.reducedPixelMode = ui->comboBoxReducedPixMode->currentIndex(); sysPara->para.rowSequenceMode = ui->spinBoxRowSequenceMode->value(); sysPara->para.pointVoltageAdjustPos = ui->spinBoxPointVoltageAdjustPos->value(); sysPara->para.PointVoltageAdjustValue = ui->spinBoxVoltageAdjustValue->value(); sysPara->para.lineEndAdjustPointCnt = ui->spinBoxLineEndAdjustPointCnt->value(); sysPara->para.lineEndAdjustPointDelay = ui->comboBoxLineEndAdjustPointMode->currentIndex(); sysPara->para.lastLineEndPointFixedValue = ui->spinBoxLastLineEndPointFixedValue->value(); sysPara->para.FullColFixVal = ui->radioButtonFUllColFIxVal->isChecked();//2020/3/2 sysPara->para.dacScale = ui->dacScaledSpinBox->value(); sysPara->para.industryIndex = ui->comboBoxIndustry->currentIndex(); sysPara->para.recommendedPrintSpeed = ui->comboBoxRecommendedPrintSpeed->currentIndex(); if(ui->eleCNT1IncEn->isChecked()) sysPara->para.eleEyeClearCntInSynMode = (sysPara->para.eleEyeClearCntInSynMode | 0x10); // CNT1 +1 else sysPara->para.eleEyeClearCntInSynMode = (sysPara->para.eleEyeClearCntInSynMode & 0xef); // CNT1 = current if(ui->eleCNT2IncEn->isChecked()) sysPara->para.eleEyeClearCntInSynMode = (sysPara->para.eleEyeClearCntInSynMode | 0x20); // CNT2 +1 else sysPara->para.eleEyeClearCntInSynMode = (sysPara->para.eleEyeClearCntInSynMode & 0xdf); // CNT2 = current if(ui->eleCNT3IncEn->isChecked()) sysPara->para.eleEyeClearCntInSynMode = (sysPara->para.eleEyeClearCntInSynMode | 0x40); // CNT3 +1 else sysPara->para.eleEyeClearCntInSynMode = (sysPara->para.eleEyeClearCntInSynMode & 0xbf); // CNT3 = current sysPara->para.alterPrint.enable =ui->comboBoxAlterPrintEnable->currentIndex();// 修改后的 if(sysPara->para.alterPrint.enable) sysPara->para.textEditLineSpace = 0; sysPara->para.alterPrint.lineSpace = sysPara->para.textEditLineSpace; sysPara->para.alterPrint.startValue = ui->spinBoxXStartValue->value (); sysPara->para.alterPrint.repeatValue = ui->spinBoxXGapValue->value (); sysPara->para.alterPrint.repeatPrintTimes =ui->spinBoxXRepeatTimeValue->value (); sysPara->para.alterPrint.DistanceTail =ui->spinBoxDistanceTail->value (); if( sysPara->para.alterPrint.startValue>= sysPara->para.alterPrint.repeatValue ) { sysPara->para.alterPrint.startValue =sysPara->para.alterPrint.repeatValue -1; ui->spinBoxXStartValue->setValue (sysPara->para.alterPrint.startValue); QMessageBox::information(this,tr("提示:交替参数不正确"),tr("要求:起始位置<交替间隔")); } if( sysPara->para.alterPrint.repeatPrintTimes+sysPara->para.alterPrint.startValue > sysPara->para.alterPrint.repeatValue ) { sysPara->para.alterPrint.repeatPrintTimes =sysPara->para.alterPrint.repeatValue -sysPara->para.alterPrint.startValue-1; ui->spinBoxXRepeatTimeValue->setValue (sysPara->para.alterPrint.repeatPrintTimes); QMessageBox::information(this,tr("提示:交替参数不正确"),tr("要求:(重复次数+起始位置)<交替间隔")); } sysPara->para.Cnt1NatureValue = ui->checkBoxCnt1NatureValue->isChecked (); // sysPara->para.speedoverPaushPrint = ui->checkBoxSpeedOver->isChecked(); sysPara->para.SynCntEn = ui->checkSynCntEn->isChecked(); sysPara->para.Vol1of8En = ui->checkVol1of8En->isChecked();//打印优化 sysPara->para.mode0211 = ui->checkmode0211->isChecked();//添加0211模式 sysPara->para.cnt1ResetToInitValue = ui->resetToCnt1InitValueCheckBox->isChecked();// 电眼复位时,复位起始值或当前值 //sysPara->para.printOnce = ui->checkBoxPrintOnce->isChecked();// 每条信息只喷一次 // sysPara->para.printOnce = 0;// 每条信息只喷一次 //sysPara->para.printNumPoint = ui->checkBoxNumPoint->isChecked();// 每条信息只喷一次 sysPara->para.Reciclar = ui->checkBoxReciclar->isChecked();//sysPara->para.Reciclar = 0; // switch(ui->spinBoxdecimalpointnum->value()) //20240625修改小数点位数可选0-3位,FPGA原参数a44d 地址第6号位为 是否打印小数使能信号,1为打印小数,0为不打印小数。 //更改为: // a44d 地址第6号位和第7号位为 打印显示小数位数; // 第7,6变量为 11 打印3位小数, // 第7,6变量为 10 打印2位小数, // 第7,6变量为 01 打印1位小数, // 第7,6变量为 00 打印0位小数, { case 0: ui->radioButtonSpecialCondition->setEnabled(true); sysPara->para.printNumPoint = 0; sysPara->para.rrr_nc = 0; break; case 1: ui->radioButtonSpecialCondition->setEnabled(false); ui->spinBoxMeterEnable->setValue(0); sysPara->para.printNumPoint = 1; sysPara->para.rrr_nc = 0; break; case 2: ui->radioButtonSpecialCondition->setEnabled(false); ui->spinBoxMeterEnable->setValue(0); sysPara->para.printNumPoint = 0; sysPara->para.rrr_nc = 1; break; case 3: ui->radioButtonSpecialCondition->setEnabled(false); ui->spinBoxMeterEnable->setValue(0); sysPara->para.printNumPoint = 1; sysPara->para.rrr_nc = 1; break; default: sysPara->para.printNumPoint = 0; sysPara->para.rrr_nc = 0; break; } sysPara->para.stepPrint.startValue = ui->spinBoxJumpStartValue->value(); sysPara->para.stepPrint.endValue = ui->spinBoxJumpEndValue->value(); sysPara->para.stepPrint.enbale = ui->checkBoxStepPrintEn->isChecked(); sysPara->para.stepPrint.StepValue = ui->spinBoxJumpStepValue->value(); sysPara->para.ResetSendData = ui->checkBoxResetSendData->isChecked(); sysPara->para.eleEyeReTrigDisable = ui->checkBoxEleEyeRetrigDis->isChecked(); sysPara->para.ResetAllProductCntEn = ui->checkAllProductResetEn->isChecked(); sysPara->para.ResetProductCntEn = ui->checkProductResetEn->isChecked(); sysPara->para.HVFaultCloseEn = ui->checkHVFaultCloseEn->isChecked(); sysPara->para.gearPumpEnable = ui->checkBoxGearPumpEnable->isChecked(); sysPara->para.flagOfReclaimPumEnable = ui->checkBox_ReclaimPumpEnable->isChecked(); sysPara->para.phaseHighCnt = ui->phaseHighCntSpinBox->value(); sysPara->para.charWidthSetEnable = ui->checkBoxCharWidthSet->isChecked(); sysPara->para.isCheckMagnet = ui->checkBoxMagnet->isChecked(); sysPara->para.isCheckPrintLight = ui->printfLightCheckBox->isChecked(); LogInfo::setRunStatusText(tr("sysPara->para.isCheckPrintLight: %1").arg(sysPara->para.isCheckPrintLight)); sysPara->para.bcOption.var1Num=ui->spinBoxCnt1EndValue->text().length(); sysPara->para.bcOption.var2Num=ui->spinBoxCnt2EndValue->text().length(); // sysPara->para.bcOption.var3Num=ui->spinBoxCnt2EndValue_2->text().length(); //qDebug()<<"sysPara->para.bcOption.varNum"<para.bcOption.var1Num<para.bcOption.var2Num; sysPara->para.ExpiryDay = ui->spinBoxExpiryDate->value(); sysPara->para.ExpirySplitMode = ui->CBDateFormat1->currentIndex(); ui->resetToCnt1InitValueCheckBox->isChecked(); //qDebug()<print.ExpiryDay; if(sysPara->devOp->writeFpgaPrintPara() != -1) // save para to disk file. QMessageBox::information(this,tr("提示"),tr("应用成功")); //ui->labelCnt1CurrValueTxt->setEnabled(false); // ui->labelCnt2CurrValueTxt->setEnabled(false); ui->spinBoxCnt1CurrValue->setEnabled(false); ui->spinBoxCnt2CurrValue->setEnabled(false); ui->spinBoxCnt3CurrValue->setEnabled(false); ui->checkBoxResetCnt1CurrValue->setChecked(false); ui->checkBoxResetCnt2CurrValue->setChecked(false); ui->checkBoxResetCnt3CurrValue->setChecked(false); emit checkPrintIntervalSignal(); } } void PrintSetting::updateSysStatusToUI(){ if(sysPara){ ui->labelCnt1CurrValue->setText(QString::number(sysPara->status.calandar_and_dat.cnt1CurrValue,16)); ui->labelCnt2CurrValue->setText(QString::number(sysPara->status.calandar_and_dat.cnt2CurrValue,16)); ui->labelCnt3CurrValue->setText(QString::number(sysPara->status.Status_Counter3.cnt3CurrValue,16)); int rDay= sysPara->para.openInkLineTime/24/3600; long tmp = sysPara->para.openInkLineTime%(24*3600); int rHour = tmp/3600; tmp =tmp%3600; int rMinute = tmp/60; int rSecond=tmp%60; QString s=""; //s.sprintf(tr("%4d天 %02d:%02d:%02d").toUtf8(), rDay,rHour,rMinute,rSecond);ui->labOpenInkLineTime->setText(s); s.sprintf(("%6d:%02d:%02d"), rDay*24+rHour,rMinute,rSecond);ui->labOpenInkLineTime->setText(s); ui->label_MaintenanceTime->setText(QString::number(dlgInputAddr->repairTimeLess,10)+tr("小时")); //ui->labOpenInkLineTime->setText(tr("%1天 %2:%3:%4").arg(rDay).arg(rHour).arg(rMinute).arg(rSecond)); ui->labTrunOnPowerCnt->setText(QString::number(sysPara->para.TrunOnPowerCnt,10)); } } void PrintSetting::on_pushButtonClearRunTime_pressed(){ sysPara->para.openInkLineTime=0; sysPara->para.TrunOnPowerCnt=0; sysPara->saveParaToFile(); } void PrintSetting::on_pushButtonApply_pressed() { applyUIPara(); emit HiddenFunction(ui->radioButtonSpecialCondition->isChecked()); autoUpdateFontWidth(sysPara->status.textEditTotalCol); PrintSettingLog(); SectionalManager::instance()->emitApplySetting(); } void PrintSetting::PrintSettingLog(){ //qDebug()<comboBoxPrintMode->currentIndex()); qDebug()<spinBoxColDelay->value()); qDebug()<spinBoxColRepeatCnt->value()); qDebug()<spinBoxStartVoltage->value()); qDebug()<spinBoxEndVoltage->value()); qDebug()<spinBoxHighVoltageValue->value()); qDebug()<checkBoxRecycleWarnAction->isChecked()); qDebug()<checkBoxPowerOffAfterPhaseFault->isChecked()); qDebug()<checkSynCntEn->isChecked()); qDebug()<checkHVFaultCloseEn->isChecked()); qDebug()<checkBoxSpeedOver->isChecked()); qDebug()<checkBoxSuspendAfterPhaseFault->isChecked()); qDebug()<checkmode0211->isChecked()); qDebug()<checkVol1of8En->isChecked()); qDebug()<checkBoxCnt1NatureValue->isChecked()); qDebug()<checkBoxStopCounterMeterAfterFault->isChecked()); qDebug()<checkBoxEleEyeRetrigDis->isChecked()); qDebug()<radioButtonFUllColFIxVal->isChecked()); qDebug()<checkBoxUpDownInverse->isChecked()); qDebug()<checkBoxLeftRightInverse->isChecked()); qDebug()<comboBoxIndustry->currentIndex()); qDebug()<comboBoxRecommendedPrintSpeed->currentIndex()); qDebug()<checkBoxMagnet->isChecked()); qDebug()<checkBoxCharWidthSet->isChecked()); qDebug()<checkBoxGearPumpEnable->isChecked()); qDebug()<checkBoxResetSendData->isChecked()); qDebug()<spinBoxCnt1StartValue->value()); qDebug()<spinBoxCnt1EndValue->value()); qDebug()<spinBoxCnt1RepeateCnt->value()); qDebug()<spinBoxCnt1StepValue->value()); qDebug()<spinBoxCnt1CurrValue->value()); qDebug()<checkBoxResetCnt1CurrValue->isChecked()); //qDebug()<checkBoxNumPoint->isChecked()); qDebug()<checkVARLEN->isChecked()); qDebug()<resetToCnt1InitValueCheckBox->isChecked()); qDebug()<CBDateFormat1->currentIndex()); qDebug()<checkBoxSaveCNTStateValue->isChecked()); qDebug()<spinBoxExpiryDate->value()); qDebug()<checkBoxCircleProductCnt->isChecked()); qDebug()<spinBoxCnt2StartValue->value()); qDebug()<spinBoxCnt2EndValue->value()); qDebug()<spinBoxCnt2RepeateCnt->value()); qDebug()<spinBoxCnt2StepValue->value()); qDebug()<spinBoxCnt2CurrValue->value()); qDebug()<checkBoxResetCnt2CurrValue->isChecked()); qDebug()<spinBoxXStartValue->value()); qDebug()<spinBoxXGapValue->value()); qDebug()<spinBoxXRepeatTimeValue->value()); qDebug()<comboBoxAlterPrintEnable->currentIndex()); qDebug()<para.HiddenFuncEnable); if(ui->radioButtonSpecialCondition->isChecked()){ qDebug()<spinBoxHiddenValue->value()); qDebug()<spinBoxConditionValue->value()); qDebug()<spinBoxMeterEnable->value()); } } void PrintSetting::on_checkBoxResetCnt1CurrValue_released() { bool checked = ui->checkBoxResetCnt1CurrValue->isChecked(); ui->spinBoxCnt1CurrValue->setEnabled(checked); } void PrintSetting::on_checkBoxResetCnt2CurrValue_released() { bool checked = ui->checkBoxResetCnt2CurrValue->isChecked(); ui->spinBoxCnt2CurrValue->setEnabled(checked); } void PrintSetting::on_checkBoxResetCnt3CurrValue_released() { bool checked = ui->checkBoxResetCnt3CurrValue->isChecked(); ui->spinBoxCnt3CurrValue->setEnabled(checked); } void PrintSetting::on_checkBoxSaveCNTStateValue_released() { bool checked = ui->checkBoxSaveCNTStateValue->isChecked(); sysPara->para.isCntSaveStateValue = checked; } void PrintSetting::on_checkBoxCircleProductCnt_released() { bool checked = ui->checkBoxCircleProductCnt->isChecked(); sysPara->status.circleProductCnt = checked; } void PrintSetting::on_dialogModPasswdAccepted() { QString authString = dialogModPasswd->getModPasswd(); if(authString == "987456123") { qDebug()<< "right choice"; modify_vol = true; ui->volButton->setText("取消授权"); ui->spinBoxHighVoltageValue->setEnabled(true); ui->spinBoxStartVoltage->setEnabled(true); } else { QMessageBox::critical(this,tr("错误"),tr("授权码:") + authString + tr(" 错误")); } } void PrintSetting::ondialogAuthorizationAccepted(){ QString authString = dialogAuthorization->getAuth(); if(authString == "nnyp"){ auth = AUTH_DISPLAY_SYSTEM_SETTING | AUTH_DISPLAY_SYSTEM_MANAGE | AUTH_SUPER_USER1\ //edit@11-28 |AUTH_SUPER_USER2|AUTH_DISPLAY_OTHER_INFO; SpecailSettingsDisplay(); EngineeringModeDisplay(); ModuleDecimalDisplay(); ModuleHideDisplay(); displayForAdjustVoltage(sysPara->para.flagOfAdjustVoltage); // const int indexTab1=ui->tabWidget_2->indexOf(ui->tab_9); // if(sysPara->para.flagOfCnt1GroupDisp) // ui->tabWidget_2->addTab(ui->tab_9,tr("其他设置")); // else // ui->tabWidget_2->removeTab(indexTab1); const int indexTab2=ui->tabWidget->indexOf(ui->tab_6); if(sysPara->para.flagOfstepPrint) ui->tabWidget->addTab(ui->tab_6,tr("跳米设置")); else ui->tabWidget->removeTab(indexTab2); } else if(authString == "by2016"){ //edit@11-28 auth = \ AUTH_DISPLAY_LOG_INFO //AUTH_DISPLAY_SYSTEM_SETTING | AUTH_DISPLAY_SYSTEM_MANAGE //| AUTH_DISPLAY_OTHER_INFO | AUTH_SUPER_USER1 |AUTH_SUPER_USER2 ; SpecailSettingsDisplay(); EngineeringModeDisplay(); ModuleDecimalDisplay(); ModuleHideDisplay(); displayForAdjustVoltage(sysPara->para.flagOfAdjustVoltage); // const int indexTab1=ui->tabWidget_2->indexOf(ui->tab_9); // if(sysPara->para.flagOfCnt1GroupDisp) // ui->tabWidget_2->addTab(ui->tab_9,tr("其他设置")); // else // ui->tabWidget_2->removeTab(indexTab1); const int indexTab2=ui->tabWidget->indexOf(ui->tab_6); if(sysPara->para.flagOfstepPrint) ui->tabWidget->addTab(ui->tab_6,tr("跳米设置")); else ui->tabWidget->removeTab(indexTab2); } else if(authString == "07710665"){ flagOfSpecailSettng = !flagOfSpecailSettng; SpecailSettingsDisplay(); displayForAdjustVoltage(sysPara->para.flagOfAdjustVoltage); } else if(authString == "nnyp0998"){ flagOfEngineeringMode =true; //edit@11-28 flagOfSpecailSettng =true;// !flagOfSpecailSettng; auth = AUTH_DISPLAY_SYSTEM_SETTING | AUTH_DISPLAY_SYSTEM_MANAGE | AUTH_DISPLAY_LOG_INFO | AUTH_DISPLAY_OTHER_INFO| AUTH_SUPER_USER1 |AUTH_SUPER_USER2; SpecailSettingsDisplay(); EngineeringModeDisplay(); engineerMode(true); //edit@11-30 ModuleDecimalHideDisplay(sysPara->para.HiddenFuncEnable); specailMachineSetting(1); } else if(authString == "111"){ unsigned short type; if(dialogModuleSeletion->exec() == QDialog::Accepted){ type = dialogModuleSeletion->getModuleType(); sysPara->para.moduleSelection = type; if(type & 1) flagOfModuleDecimal = true; else flagOfModuleDecimal = false; sysPara->para.flagOfModuleDecimal = flagOfModuleDecimal; ModuleDecimalDisplay(); ModuleHideDisplay(); sysPara->para.flagOfModuleHide = flagOfModuleHide; if(type & 1<<1) flagOfModuleHide = true; else flagOfModuleHide = false; sysPara->para.flagOfModuleHide = flagOfModuleHide; ModuleHideDisplay(); ModuleDecimalDisplay(); sysPara->para.flagOfModuleDecimal = flagOfModuleDecimal; if(type & 1<<2) sysPara->para.flagOfCnt1GroupDisp = true; else sysPara->para.flagOfCnt1GroupDisp = false; // const int indexTab1=ui->tabWidget_2->indexOf(ui->tab_9); // if(sysPara->para.flagOfCnt1GroupDisp) // ui->tabWidget_2->addTab(ui->tab_9,tr("其他设置")); // else // ui->tabWidget_2->removeTab(indexTab1); if (type & 1<<3) sysPara->para.flagOfstepPrint = true; else sysPara->para.flagOfstepPrint = false; const int indexTab2=ui->tabWidget->indexOf(ui->tab_6); if(sysPara->para.flagOfstepPrint) ui->tabWidget->addTab(ui->tab_6,tr("跳米设置")); else ui->tabWidget->removeTab(indexTab2); if(type & 1<<4) sysPara->para.flagOfAdjustVoltage = true; else{ sysPara->para.flagOfAdjustVoltage = false; setForAdjustVoltage(); } displayForAdjustVoltage(sysPara->para.flagOfAdjustVoltage); } } else if(authString == "07710221"){ flagOfModuleDecimal = !flagOfModuleDecimal; sysPara->para.flagOfModuleDecimal = flagOfModuleDecimal; ModuleDecimalDisplay(); ModuleHideDisplay(); sysPara->para.flagOfModuleHide = flagOfModuleHide; }else if(authString == "07710331"){ flagOfModuleHide = !flagOfModuleHide; sysPara->para.flagOfModuleHide = flagOfModuleHide; ModuleHideDisplay(); ModuleDecimalDisplay(); sysPara->para.flagOfModuleDecimal = flagOfModuleDecimal; } //edit@11-29 输入密码显示,再次输入隐藏 else if(authString == "07710441"){ //edit@12-03 // const int indexTab=ui->tabWidget_2->indexOf(ui->tab_9); // if(sysPara->para.flagOfCnt1GroupDisp) // ui->tabWidget_2->removeTab(indexTab); // else // ui->tabWidget_2->addTab(ui->tab_9,tr("其他设置")); sysPara->para.flagOfCnt1GroupDisp=!sysPara->para.flagOfCnt1GroupDisp; } //edit@11-29 输入密码显示,再次输入隐藏 else if(authString == "07710551"){ //edit@12-03 const int indexTab=ui->tabWidget->indexOf(ui->tab_6); if(sysPara->para.flagOfstepPrint) ui->tabWidget->removeTab(indexTab); else ui->tabWidget->addTab(ui->tab_6,tr("跳米设置")); sysPara->para.flagOfstepPrint=!sysPara->para.flagOfstepPrint; } else if(dlgInputAddr->checkSupperInit(authString) ) { sysPara->status.WorkTimeOut=0; dlgInputAddr->SetNewJm(1); sysPara->para.varLen=0; sysPara->para.varLen1=0; #ifdef __RFID_CARD // RFIDManager::instance()->setICReaderModeFlag = true; // MySleep(300); // QMessageBox::warning(0,tr("提示"),tr("软件初始化完成.") ); // RFIDManager::instance()->setRFIDReaderWorkMode(); // RFIDManager::instance()->setRFIDReaderKey(dlgInputAddr->jd.addr,1); // RFIDManager::instance()->setICReaderModeFlag = false; // RFIDManager::instance()->initRFIDMoudle(dlgInputAddr->jd.addr); #endif } else if((authString.left(4) == "nnyp") && ( dlgInputAddr->checkSupperJm(authString.mid(4)))) { #ifdef __RFID_CARD memset(&sysPara->RFIDPara,0,sizeof(sysPara->RFIDPara)); sysPara->saveRFIDPara(); sysPara->para.RFIDInkWarn = false; sysPara->status.flagOfInkMaxDot = false; sysPara->status.flagOfNeedInkCard = false; sysPara->para.RFIDSolventWarn = 0; sysPara->para.RFIDSolventWarnMixCnt = 0; sysPara->para.inkWarnDate = 0; sysPara->para.inkWarnTime = 0; sysPara->para.solventWarnDate = 0; sysPara->para.solventWarnTime = 0; sysPara->status.flagOfSolventMaxNum = false; sysPara->status.flagOfNeedSolventCard = false; qDebug()<<"RFID卡清零"; sysPara->saveParaToFile(); QMessageBox::warning(0,tr("提示"),tr("RFID卡清零!") ); #endif } else if( dlgInputAddr->checkSupperJm(authString)) { sysPara->status.WorkTimeOut=0; dlgInputAddr->ReadJm(); dlgInputAddr->show(); ui->labMac->setText(QString("Mac:%1").arg(dlgInputAddr->jd.addr)); } else if(dlgInputAddr->checWhJm(authString)) // 0xa001 { sysPara->status.WorkTimeOut=0; QMessageBox::warning(this,tr("提示"),tr("喷码机维护设置成功!"),QMessageBox::Ok); specailMachineSetting(1); } else if(dlgInputAddr->checkSysJm(authString)) { dlgInputAddr->SaveJm(); dlgInputAddr->show(); ui->labMac->setText(QString("Mac:%1").arg(dlgInputAddr->jd.addr)); sysPara->status.WorkTimeOut=0; QMessageBox::warning(this,tr( "提示"),tr("系统维护设置成功!") ,QMessageBox::Ok); } else if(authString == "vbip") { dlgInputAddr->setNodeIpAndPrivateIp(false); dlgInputAddr->show(); } else { auth = AUTH_NONE; QMessageBox::critical(this,tr("错误"),tr("密码:") + authString + tr(" 不存在")); } emit authChanged(auth); if(auth == AUTH_NONE ) {sysPara->status.adjHightVolInitEN=0;sysPara->status.updateSoftEN=0;} ui->pushButtonAuth->setText((auth == AUTH_NONE)?tr("输入密码"):tr("取消授权")); } void PrintSetting::SpecailSettingsDisplay() { if(flagOfSpecailSettng) { const int indexTab=ui->tabWidget_2->indexOf(ui->tab_11); if (indexTab == -1) ui->tabWidget_2->addTab(ui->tab_11,tr("打印电压缩放")); ui->comboBoxIndustry->setVisible(1); ui->checkBoxNewAmplifyPlate->setVisible(1); // ui->labelRecommendedPrintSpeed->setVisible(1); ui->comboBoxRecommendedPrintSpeed->setVisible(1); ui->checkBoxPrintOnce->setVisible(1); ui->checkBoxReciclar->setVisible(1); ui->lockoulsepushButton->setVisible(1); ui->pushButtonRecommendedSetting->setVisible(1); ui->checkBox_FastMode->setVisible(1); } else { if(flagOfEngineeringMode) ui->tabWidget_2->removeTab(5); // else // ui->tabWidget_2->removeTab(4); ui->comboBoxIndustry->hide(); ui->checkBoxNewAmplifyPlate->hide(); // ui->labelRecommendedPrintSpeed->hide(); ui->comboBoxRecommendedPrintSpeed->hide(); ui->checkBoxPrintOnce->hide(); ui->checkBoxReciclar->hide(); ui->lockoulsepushButton->hide(); ui->pushButtonRecommendedSetting->hide(); ui->checkBox_FastMode->hide(); } } void PrintSetting::EngineeringModeDisplay() { if(flagOfEngineeringMode) { #ifdef COUNTER2_BY_GROUP ui->tabWidget_2->addTab(ui->tab_9,tr("其他设置")); ui->tabWidget_2->addTab(sectionalWid, tr("分段计数")); #endif if(flagOfSpecailSettng) { const int indexTab=ui->tabWidget_2->indexOf(ui->tab_11); if (indexTab == -1) ui->tabWidget_2->addTab(ui->tab_11,tr("打印电压缩放")); } ui->tabWidget->addTab(ui->tab_8,tr("计数器3设置")); ui->tabWidget->addTab(ui->tab_6,tr("跳米设置")); ui->checkBoxSpeedOver->setVisible(1); ui->checkBoxSuspendAfterPhaseFault->setVisible(1); ui->checkmode0211->setVisible(1); ui->checkVol1of8En->setVisible(1); ui->checkBoxStopCounterMeterAfterFault->setVisible(1); ui->checkBoxEleEyeRetrigDis->setVisible(1); ui->radioButtonFUllColFIxVal->setVisible(1); ui->checkBoxCharWidthSet->setVisible(1); ui->radioCNT3->setVisible(1); ui->radioButtonSpecialCondition->setVisible(1); ui->label_7->setVisible(1); ui->label_6->setVisible(1); ui->label_34->setVisible(1); ui->label_35->setVisible(1); ui->spinBoxdecimalpointnum->setVisible(1); ui->spinBoxHiddenValue->setVisible(1); ui->radioButtonSpecialCondition->setVisible(1); ui->spinBoxConditionValue->setVisible(1); ui->spinBoxMeterEnable->setVisible(1); } else { if(flagOfSpecailSettng) { ui->tabWidget_2->removeTab(5); const int indexTab=ui->tabWidget_2->indexOf(ui->tab_11); if (indexTab == -1) ui->tabWidget_2->addTab(ui->tab_11,tr("打印电压缩放")); } else { // ui->tabWidget_2->removeTab(4); } ui->tabWidget->removeTab(3); ui->tabWidget->removeTab(2); ui->checkBoxSpeedOver->hide(); ui->checkBoxSuspendAfterPhaseFault->hide(); ui->checkmode0211->hide(); ui->checkVol1of8En->hide(); ui->checkBoxStopCounterMeterAfterFault->hide(); ui->checkBoxEleEyeRetrigDis->hide(); ui->radioButtonFUllColFIxVal->hide(); ui->checkBoxCharWidthSet->hide(); ui->radioCNT3->hide(); ui->radioButtonSpecialCondition->hide(); ui->label_7->hide(); ui->label_6->hide(); ui->label_34->hide(); ui->label_35->hide(); ui->spinBoxdecimalpointnum->hide(); ui->spinBoxHiddenValue->hide(); ui->radioButtonSpecialCondition->hide(); ui->spinBoxConditionValue->hide(); ui->spinBoxMeterEnable->hide(); } ModuleDecimalDisplay(); ModuleHideDisplay(); } void PrintSetting::ModuleDecimalDisplay() { if(flagOfModuleDecimal){ ui->label_35->setVisible(1); ui->spinBoxdecimalpointnum->setVisible(1); flagOfModuleHide = 0; ui->radioButtonSpecialCondition->setChecked(0); }else{ ui->spinBoxdecimalpointnum->setValue(0); ui->spinBoxdecimalpointnum->setEnabled(0); ui->radioButtonSpecialCondition->setEnabled(1); ui->label_35->hide(); ui->spinBoxdecimalpointnum->hide(); } } void PrintSetting::ModuleHideDisplay() { if(flagOfModuleHide && sysPara){ ui->label_7->setVisible(1); ui->label_6->setVisible(1); ui->label_34->setVisible(1); ui->spinBoxHiddenValue->setVisible(1); ui->radioButtonSpecialCondition->setVisible(1); ui->spinBoxConditionValue->setVisible(1); ui->spinBoxMeterEnable->setVisible(1); flagOfModuleDecimal = 0; ui->spinBoxdecimalpointnum->setValue(0); sysPara->para.rrr_nc = 0; sysPara->para.printNumPoint = 0; }else{ ui->radioButtonSpecialCondition->setChecked(0); ui->spinBoxdecimalpointnum->setEnabled(1); ui->label_7->hide(); ui->label_6->hide(); ui->label_34->hide(); ui->spinBoxHiddenValue->hide(); ui->radioButtonSpecialCondition->hide(); ui->spinBoxConditionValue->hide(); ui->spinBoxMeterEnable->hide(); } } void PrintSetting::on_checkBoxSuspendAfterPhaseFault_clicked() { ui->checkBoxStopCounterMeterAfterFault->setEnabled(ui->checkBoxSuspendAfterPhaseFault->isChecked()); } void PrintSetting::on_checkBoxPowerOffAfterPhaseFault_clicked() { ui->checkBoxStopCounterMeterAfterFault->setEnabled(!ui->checkBoxPowerOffAfterPhaseFault->isChecked() && ui->checkBoxSuspendAfterPhaseFault->isChecked()); ui->checkBoxSuspendAfterPhaseFault->setEnabled(!ui->checkBoxPowerOffAfterPhaseFault->isChecked()); } #include #include #include void PrintSetting::on_pushButtonAuth_pressed() { if(auth == AUTH_NONE){ dialogAuthorization->clearAuth(); dialogAuthorization->show(); } else { emit authChanged(AUTH_NONE); auth = AUTH_NONE; sysPara->status.adjHightVolInitEN=0;sysPara->status.updateSoftEN=0; ui->pushButtonAuth->setText(tr("输入密码")); //edit@11-28 flagOfEngineeringMode = false; flagOfSpecailSettng = false; //qDebug()<updateSysParaToUI(); specailMachineSetting(0); engineerMode(false); } } void PrintSetting::updateAuthorization(int auth){ //ui->dacScaledSpinBox->setEnabled(auth & AUTH_SUPER_USER1); ui->checkBoxScanInverse->setEnabled(auth & AUTH_SUPER_USER1); // ui->labelVoltageAdjustPos->setEnabled(auth & AUTH_SUPER_USER1); // ui->spinBoxPointVoltageAdjustPos->setEnabled(auth & AUTH_SUPER_USER1); ui->labelReducedPixelNum->setEnabled(auth & AUTH_SUPER_USER1); ui->spinBoxReducedPixelNum->setEnabled(auth & AUTH_SUPER_USER1); // ui->labelVoltageAdjustValue->setEnabled(auth & AUTH_SUPER_USER1); // ui->spinBoxVoltageAdjustValue->setEnabled(auth & AUTH_SUPER_USER1); ui->labelRowSequenceMode->setEnabled(auth & AUTH_SUPER_USER1); ui->spinBoxRowSequenceMode->setEnabled(auth & AUTH_SUPER_USER1); // ui->labelReducedPixMode->setEnabled(auth & AUTH_SUPER_USER1); // ui->comboBoxReducedPixMode->setEnabled(auth & AUTH_SUPER_USER1); // ui->labelLineEndAdjustPointCnt->setEnabled(auth & AUTH_SUPER_USER1); // ui->spinBoxLineEndAdjustPointCnt->setEnabled(auth & AUTH_SUPER_USER1); // ui->labelLineEndAdjustPointMode->setEnabled(auth & AUTH_SUPER_USER1); // ui->comboBoxLineEndAdjustPointMode->setEnabled(auth & AUTH_SUPER_USER1); // ui->spinBoxLastLineEndPointFixedValue->setEnabled(auth & AUTH_SUPER_USER1); // ui->labelLastLineEndPointFixedValue->setEnabled(auth & AUTH_SUPER_USER1); ui->pushButtonClearRunTime->setEnabled(auth & AUTH_SUPER_USER1); // 透明按钮 //ui->volDacEdit->updateAuthorization (auth); } void PrintSetting::on_spinBoxLastLineEndPointFixedValue_valueChanged(int arg1) { if(sysPara){ sysPara->devOp->setLastLineEndPointFixedValue(arg1); } } void PrintSetting::on_pushButtonRecommendedSetting_clicked() { QMessageBox::StandardButton ret; ret = QMessageBox::warning(this, tr("警告"), tr("是否确认使用推荐设置?"), QMessageBox::Ok | QMessageBox::Cancel); if (ret == QMessageBox::Ok){ /*----------------------------设置参数,然后更新到界面-----------------------------*/ int industry = ui->comboBoxIndustry->currentIndex(); int speed = ui->comboBoxRecommendedPrintSpeed->currentIndex(); ui->comboBoxPrintMode->setCurrentIndex((industry?1:0) + speed + 1); ui->spinBoxVoltageAdjustValue->setValue(0); ui->comboBoxReducedPixMode->setCurrentIndex(0); ui->spinBoxReducedPixelNum->setValue((speed == 0)?55:((speed == 1)?30:0)); ui->spinBoxRowSequenceMode->setValue(1); ui->checkBoxScanInverse->setChecked(false); ui->spinBoxLineEndAdjustPointCnt->setValue(2); ui->comboBoxLineEndAdjustPointMode->setCurrentIndex((industry?3:1) + speed + 1); ui->spinBoxLastLineEndPointFixedValue->setValue((speed < 2)?-20:0); on_pushButtonApply_pressed(); } } void PrintSetting::showVolDacEdit(int auth){ /* if((auth&AUTH_SUPER_USER2)) { if(ui->tabWidget_2->indexOf (ui->tab_8)==-1) ui->tabWidget_2->addTab (ui->tab_8,tr("点距电压微调")); } else { if(ui->tabWidget_2->indexOf (ui->tab_8)!=-1) ui->tabWidget_2->removeTab (ui->tabWidget_2->indexOf (ui->tab_8));//ui->tabWidget_2->indexOf (ui->tab_8) } */ } void PrintSetting::on_pushOnlyCNT1Clear_pressed(){ sysPara->devOp->clearProductCnt(1<<2); // 计数器1单独清零 //sysPara->para.totalProductCnt += sysPara->status.productCnt; //qDebug()<<"only1"; } void PrintSetting::on_pushOnlyCNT2Clear_pressed(){ sysPara->devOp->clearProductCnt(1<<3);// 计数器2单独清零 //qDebug()<<"only2"; } void PrintSetting::on_pushButtonRanddomBackUP_pressed(){ QMessageBox::StandardButton ret; QFile f1("/home/plg/Xrand2.txt"); QString str; //f1.open(QFile::ReadWrite); int len = f1.size(); if(f1.size()<100 ) { ret = QMessageBox::warning(this, tr("提示"), tr("随机码文件为空,不需要导出"), QMessageBox::Ok ); //f1.close(); return; } //f1.close(); ret = QMessageBox::warning(this, tr("提示"), tr("随机码文本将展出到U盘,请插入U盘"), QMessageBox::Ok | QMessageBox::Cancel); if (ret == QMessageBox::Ok){ LogInfo::setRunStatusText("正在导出随机码文件到U盘......"); sysPara->devOp->RandTxtBakup(1); LogInfo::setRunStatusText("随机码文件导出完成."); } } void PrintSetting::on_spinBoxExpiryDate_valueChanged(int arg1) { QDate curDate= QDate::currentDate().addDays(arg1); //ui->CBDateFormat1->clear(); QString DateTime;QString format; // str.sprintf("%04d-%02d-%02d",curDate.year(),curDate.month(),curDate.day()); // ui->CBDateFormat1->setItemText(0,str);//ui->CBDateFormat1->addItem(str); // str.sprintf("%04d/%02d/%02d",curDate.year(),curDate.month(),curDate.day()); // ui->CBDateFormat1->setItemText(1,str);//ui->CBDateFormat1->addItem(str); // str.sprintf("%04d%02d%02d",curDate.year(),curDate.month(),curDate.day()); // ui->CBDateFormat1->setItemText(2,str);//ui->CBDateFormat1->addItem(str); ui->CBDateFormat1->count(); for(int i=0;i < ui->CBDateFormat1->count();++i) { format = ui->CBDateFormat1->itemText(i); DateTime = QDateTime::currentDateTime().toString(format); ui->CBDateFormat1->setItemText(i,DateTime); //qDebug()<CBDateFormat1->addItem(str.toLocal8Bit()); //ui->CBDateFormat1->setCurrentIndex(sysPara->para.ExpirySplitMode);//p_var->splitMode //sysPara->para.ExpiryDay = arg1; } void PrintSetting::on_CBDateFormat1_currentIndexChanged(int index) { sysPara->para.ExpirySplitMode = index; } #if(1) void PrintSetting::updateCnt1GroupsTblWgt() { #ifdef COUNTER1_BY_GROUP /* 分段计米 */ QPalette Palette; QLineEdit *pLineEdit; int rowCnt=ui->tableWidget->rowCount(); //int rowCnt=sysPara->para.Cnt1ByGroup.cnt1GroupCnt; //qDebug()<<"updateCnt1GroupsTblWgt count"<status.cnt1GroupRunningIndex; for(int i=0;itableWidget->cellWidget(i,j); Palette = pLineEdit->palette(); if(sysPara->para.cnt1ByGroupEnalbe && (i == sysPara->status.cnt1GroupRunningIndex)) { Palette.setColor(QPalette::Normal,QPalette::Base, Qt::green); } else { Palette.setColor(QPalette::Normal,QPalette::Base, Qt::lightGray); } pLineEdit->setPalette(Palette); } } #endif } void PrintSetting::onUpdateCnt1GroupDisp(bool bChangeToNext) { #ifdef COUNTER1_BY_GROUP /* 分段计米 */ if(bChangeToNext)//循环数走完 { //改变当前执行的分段的背景颜色 updateCnt1GroupsTblWgt(); } #endif } void PrintSetting::LoadCnt1GroupSettingsToUI() { #ifdef COUNTER1_BY_GROUP /* 分段计米 */ QLineEdit *pLineEdit; ui->checkBoxGroupCnt1->setChecked(sysPara->para.cnt1ByGroupEnalbe); on_checkBoxGroupCnt1_clicked(sysPara->para.cnt1ByGroupEnalbe); //qDebug()<<"LoadCnt1GroupSettingsToUI:cnt1GroupCnt "<para.Cnt1ByGroup.cnt1GroupCnt; ui->tableWidget->setRowCount(sysPara->para.Cnt1ByGroup.cnt1GroupCnt); QRegExp regx("[0-9]+$"); QValidator *validator = new QRegExpValidator(regx, this); QRegExp regxLoop("[1-9][0-9]+$"); QValidator *validatorLoop = new QRegExpValidator(regxLoop, this); for(int i=0; ipara.Cnt1ByGroup.cnt1GroupCnt; i++) { pLineEdit = new QLineEdit; pLineEdit->setText(QString::number(sysPara->para.Cnt1ByGroup.cnt1GroupSettings[i].StartValue)); pLineEdit->setValidator(validator); ui->tableWidget->setCellWidget(i,0,pLineEdit); pLineEdit = new QLineEdit; pLineEdit->setText(QString::number(sysPara->para.Cnt1ByGroup.cnt1GroupSettings[i].EndValue)); pLineEdit->setValidator(validator); ui->tableWidget->setCellWidget(i,1,pLineEdit); pLineEdit = new QLineEdit; pLineEdit->setText(QString::number(sysPara->para.Cnt1ByGroup.cnt1GroupSettings[i].LoopTimes)); pLineEdit->setValidator(validatorLoop); ui->tableWidget->setCellWidget(i,2,pLineEdit); } updateCnt1GroupsTblWgt(); #endif } void PrintSetting::ApplyCnt1GroupSetting() { #ifdef COUNTER1_BY_GROUP /* 分段计米 */ QLineEdit *pLineEdit; sysPara->para.cnt1ByGroupEnalbe = ui->checkBoxGroupCnt1->isChecked(); sysPara->para.Cnt1ByGroup.cnt1GroupCnt=ui->tableWidget->rowCount(); if(sysPara->para.cnt1ByGroupEnalbe && sysPara->para.Cnt1ByGroup.cnt1GroupCnt==0) { sysPara->para.cnt1ByGroupEnalbe=false; ui->checkBoxGroupCnt1->setChecked(false); on_checkBoxGroupCnt1_clicked(false); } //qDebug()<<"ApplyCnt1GroupSetting:cnt1GroupCnt "<para.Cnt1ByGroup.cnt1GroupCnt; for(int i=0; ipara.Cnt1ByGroup.cnt1GroupCnt; i++) { pLineEdit = (QLineEdit *)ui->tableWidget->cellWidget(i,0); sysPara->para.Cnt1ByGroup.cnt1GroupSettings[i].StartValue = pLineEdit->text().toInt(); pLineEdit = (QLineEdit *)ui->tableWidget->cellWidget(i,1); sysPara->para.Cnt1ByGroup.cnt1GroupSettings[i].EndValue = pLineEdit->text().toInt(); pLineEdit = (QLineEdit *)ui->tableWidget->cellWidget(i,2); sysPara->para.Cnt1ByGroup.cnt1GroupSettings[i].LoopTimes = pLineEdit->text().toInt(); } sysPara->devOp->writeCnt1GroupSetting(1); sysPara->saveParaToFile(); //改变当前执行的分段的背景颜色 updateCnt1GroupsTblWgt(); #endif } void PrintSetting::rowWidgetCreate(int rowIndex) { #ifdef COUNTER1_BY_GROUP /* 分段计米 */ QLineEdit* pLineEdit; QRegExp regx("[0-9]+$"); QValidator *validator = new QRegExpValidator(regx, this); QRegExp regxLoop("[1-9][0-9]+$"); QValidator *validatorLoop = new QRegExpValidator(regxLoop, this); for(int i=0;i<3;i++) { if(i==3) { //ui->tableWidget->item(rowIndex,i)->setCheckState(Qt::Unchecked); } else { if(i<2) { pLineEdit = new QLineEdit(tr("0")); pLineEdit->setValidator(validator); } else if(i==2) { pLineEdit = new QLineEdit(tr("1")); pLineEdit->setValidator(validatorLoop); } ui->tableWidget->setCellWidget(rowIndex,i,pLineEdit); } } #endif } void PrintSetting::on_checkBoxGroupCnt1_clicked(bool checked) { #ifdef COUNTER1_BY_GROUP /* 分段计米 */ if(checked) { ui->spinBoxCnt1StartValue->setEnabled(false); ui->spinBoxCnt1EndValue->setEnabled(false); // ui->checkBoxResetCnt1CurrValue->setEnabled(false); } else { ui->spinBoxCnt1StartValue->setEnabled(true); ui->spinBoxCnt1EndValue->setEnabled(true); ui->checkBoxResetCnt1CurrValue->setEnabled(true); } #endif } void PrintSetting::on_Cnt3AddRowBtn_pressed() { #ifdef COUNTER1_BY_GROUP /* 分段计米 */ int rowCnt=ui->tableWidget->rowCount(); if(rowCnt>=MAX_CNT1_GROUPS_NUM) { return; } //sysPara->para.cnt1GroupCnt++; ui->tableWidget->setRowCount(rowCnt+1); rowWidgetCreate(rowCnt); #endif } void PrintSetting::on_Cnt3InsertRowBtn_pressed() { #ifdef COUNTER1_BY_GROUP /* 分段计米 */ int rowIndex=ui->tableWidget->currentRow(); int rowCnt=ui->tableWidget->rowCount(); if(rowIndex<0||rowCnt>=MAX_CNT1_GROUPS_NUM) { //qDebug()<<"max counter1 groups num is "<tableWidget->insertRow(rowIndex+1); rowWidgetCreate(rowIndex+1); #endif } void PrintSetting::on_Cnt3RemoveRowBtn_pressed() { #ifdef COUNTER1_BY_GROUP /* 分段计米 */ int rowIndex=ui->tableWidget->currentRow(); if(rowIndex<0) { return; } QMessageBox::StandardButton ret; if(rowIndex==sysPara->status.cnt1GroupRunningIndex) { QMessageBox::warning(this, tr("错误"), tr("正在打印第%1组设置,不可删除").arg(rowIndex+1), QMessageBox::Ok); return; } ret = QMessageBox::warning(this, tr("警告"), tr("是否确认删除第%1组设置?").arg(rowIndex+1), QMessageBox::Ok | QMessageBox::Cancel); if (ret == QMessageBox::Ok){ ui->tableWidget->removeRow(rowIndex); } #endif } void PrintSetting::on_cnt3RemoveAllRowsBtn_pressed() { #ifdef COUNTER1_BY_GROUP /* 分段计米 */ QMessageBox::StandardButton ret; ret = QMessageBox::warning(this, tr("警告"), tr("是否确认删除全部设置?"), QMessageBox::Ok | QMessageBox::Cancel); if (ret == QMessageBox::Ok){ int rowCnt=ui->tableWidget->rowCount(); for(int i=rowCnt-1;i>=0;i--) { ui->tableWidget->removeRow(i); } } #endif } #endif void PrintSetting::on_comboBoxAlterPrintEnable_currentIndexChanged(int index) { if(index==0) { ui->spinBoxXStartValue->setEnabled(false); ui->spinBoxXRepeatTimeValue->setEnabled(false); ui->spinBoxXGapValue->setEnabled(false); } else { ui->spinBoxXStartValue->setEnabled(true); ui->spinBoxXRepeatTimeValue->setEnabled(true); ui->spinBoxXGapValue->setEnabled(true); } if(index==3) { ui->spinBoxDistanceTail->setEnabled(true); } else { ui->spinBoxDistanceTail->setEnabled(false); } } void PrintSetting::on_checkVol1of8En_clicked(bool checked) { if(checked && ui->checkmode0211->checkState()) { ui->checkmode0211->setChecked(false); } } void PrintSetting::on_checkmode0211_clicked(bool checked) { if(checked && ui->checkVol1of8En->checkState()) { ui->checkVol1of8En->setChecked(false); } if(checked && ui->radioButtonFUllColFIxVal->checkState()) { ui->radioButtonFUllColFIxVal->setChecked(false); } //sysPara->para.Vol1of8En = !checked;//打印优化 if(!checked && ui->radioButtonFUllColFIxVal->checkState() == false) { ui->spinBoxStartVoltage->setEnabled(true); ui->spinBoxEndVoltage->setEnabled(true); } else { ui->spinBoxStartVoltage->setEnabled(false); ui->spinBoxEndVoltage->setEnabled(false); } } void PrintSetting::on_volButton_clicked() { if(!modify_vol) { dialogModPasswd->clearAuth(); dialogModPasswd->show(); }else { modify_vol = false; ui->volButton->setText("修改授权"); ui->spinBoxHighVoltageValue->setEnabled(false); ui->spinBoxStartVoltage->setEnabled(false); } } void PrintSetting::on_spinBoxColDelay_valueChanged(int arg1) { if(!sysPara->para.charWidthSetEnable) { if(arg1 == 0) { QMessageBox::warning(this, tr("警告"), tr("字体宽度不能为0"), QMessageBox::Ok | QMessageBox::Cancel); ui->spinBoxColDelay->setValue(sysPara->para.printColDelay); } } else { sysPara->para.printColDelay = arg1; } } void PrintSetting::on_radioButtonFUllColFIxVal_clicked(bool checked) { if(!checked && ui->checkmode0211->checkState() == false) { ui->spinBoxStartVoltage->setEnabled(true); ui->spinBoxEndVoltage->setEnabled(true); } else { ui->spinBoxStartVoltage->setEnabled(false); ui->spinBoxEndVoltage->setEnabled(false); } if(checked && ui->checkmode0211->checkState()) { ui->checkmode0211->setChecked(false); } } void PrintSetting::on_metreCountButton_clicked() { // sysPara->status.calandar_and_dat.cnt1CurrValue = 123; dialogShowCounter->show(); dialogShowCounter->init_arg(); refresh_timer->start(500); // qDebug()<<"asdasd"; // sysPara->status.calandar_and_dat.cnt2CurrValue; } void PrintSetting::ondialogShowCounterAccepted(void) { refresh_timer->stop(); // qDebug()<<"refresh_timer stop"; } void PrintSetting::updateUIForSpecialCondition() { if(sysPara->para.EditMode == TXTFILE) { ui->radioButtonSpecialCondition->setEnabled(true); } } void PrintSetting::on_radioButtonSpecialCondition_clicked(bool checked) { if(sysPara->para.EditMode==TXTFILE) { ui->spinBoxHiddenValue->setEnabled(checked); ui->spinBoxMeterEnable->setEnabled(checked); ui->spinBoxConditionValue->setEnabled(checked); ui->spinBoxdecimalpointnum->setValue(0); ui->spinBoxdecimalpointnum->setEnabled(!checked); } } void PrintSetting::refreshtimerHandler(void) { int bcdTodec = 0; int resetmetre = 0; // int cn1StartValue = ui->spinBoxCnt1StartValue->value(); // int cn1EndValue = ui->spinBoxCnt1EndValue->value(); resetmetre = dialogShowCounter->getResetMetreState(area_end); if(last_area_end != area_end){ //qDebug() << "set spinBoxCnt1StartValue"; last_area_end = area_end; ui->spinBoxCnt1StartValue->setValue(0); ui->spinBoxCnt1EndValue->setValue(area_end); sysPara->para.cnt1EndValue = area_end; } if(true == resetmetre){ if(sysPara){ QMessageBox::StandardButton ret; ret = QMessageBox::warning(this, tr("警告"), tr("是否立即重新计米?"), QMessageBox::Ok | QMessageBox::Cancel); if (ret == QMessageBox::Ok){ sysPara->devOp->clearProductCnt(3 | 0x10);// [3]总产品计数器清零FPGA sysPara->para.totalProductCnt = 0; } } resetmetre = false; } //bcdTodec = sysPara->status.calandar_and_dat.cnt1CurrValue - (sysPara->status.calandar_and_dat.cnt1CurrValue>>4)*6; //dialogShowCounter->refreshdate(sysPara->status.productCnt,cn1StartValue,cn1EndValue,bcdTodec); int currValue1 = QString::number(sysPara->status.calandar_and_dat.cnt1CurrValue,16).toInt(); int currCnt1GroupIndex = sysPara->status.cnt1GroupRunningIndex; int currCnt1GroupLoop = sysPara->status.cnt1GroupCurrentLoop; int cnt1StartValue = sysPara->para.Cnt1ByGroup.cnt1GroupSettings[currCnt1GroupIndex].StartValue; int cnt1EndValue = sysPara->para.Cnt1ByGroup.cnt1GroupSettings[currCnt1GroupIndex].EndValue; dialogShowCounter->refreshdate(currValue1, cnt1StartValue, cnt1EndValue, currCnt1GroupIndex, currCnt1GroupLoop); } void PrintSetting::on_lockoulsepushButton_clicked() { if(lockpulse){ ui->lockoulsepushButton->setText(tr("锁定脉冲计数")); lockpulse = false; }else{ ui->lockoulsepushButton->setText(tr("解锁脉冲计数")); lockpulse = true; } } void PrintSetting::on_spinBoxCnt1EndValue_valueChanged(int arg1) { if(lockpulse){ sysPara->para.productCntPerOutputPulse = arg1; // qDebug()<< "emit change_OutputPulse()"; emit change_OutputPulse(); } } #if(1) void PrintSetting::moveRow( int nFrom, int nTo) { int StartValue,EndValue,LoopTimes; int To_StartValue,To_EndValue,To_LoopTimes; QLineEdit *pLineEdit; if( nFrom == nTo ) { return; } if( nFrom < 0 || nTo < 0 ) { return; } int nRowCount = ui->tableWidget->rowCount(); if( nFrom >= nRowCount || nTo >= nRowCount ) return; pLineEdit = (QLineEdit *)ui->tableWidget->cellWidget(nFrom,0); StartValue = pLineEdit->text().toInt(); pLineEdit = (QLineEdit *)ui->tableWidget->cellWidget(nFrom,1); EndValue = pLineEdit->text().toInt(); pLineEdit = (QLineEdit *)ui->tableWidget->cellWidget(nFrom,2); LoopTimes = pLineEdit->text().toInt(); // qDebug()<<"StartValue="<setText(QString::number(StartValue)); pLineEdit->setValidator(validator); ui->tableWidget->setCellWidget(nTo,0,pLineEdit); pLineEdit = new QLineEdit; pLineEdit->setText(QString::number(EndValue)); pLineEdit->setValidator(validator); ui->tableWidget->setCellWidget(nTo,1,pLineEdit); pLineEdit = new QLineEdit; pLineEdit->setText(QString::number(LoopTimes)); pLineEdit->setValidator(validatorLoop); ui->tableWidget->setCellWidget(nTo,2,pLineEdit); pLineEdit = new QLineEdit; pLineEdit->setText(QString::number(To_StartValue)); pLineEdit->setValidator(validator); ui->tableWidget->setCellWidget(nFrom,0,pLineEdit); pLineEdit = new QLineEdit; pLineEdit->setText(QString::number(To_EndValue)); pLineEdit->setValidator(validator); ui->tableWidget->setCellWidget(nFrom,1,pLineEdit); pLineEdit = new QLineEdit; pLineEdit->setText(QString::number(To_LoopTimes)); pLineEdit->setValidator(validatorLoop); ui->tableWidget->setCellWidget(nFrom,2,pLineEdit); ui->tableWidget->selectRow(nTo); // ui->tableWidget->clearFocus(); // ui->tabWidget->focusPolicy(); } //调用 void PrintSetting::on_moveUp_clicked() { moveRow(ui->tableWidget->currentRow(),ui->tableWidget->currentRow() - 1); } void PrintSetting::on_moveDown_clicked() { moveRow(ui->tableWidget->currentRow(),ui->tableWidget->currentRow() + 1); } void PrintSetting::on_pushButtonUpRow_clicked() { on_moveUp_clicked(); } void PrintSetting::on_pushButtonDownRow_clicked() { on_moveDown_clicked(); } #endif void PrintSetting::on_pushOnlyCNT3Clear_pressed() { sysPara->devOp->clearProductCnt(1<<4);// 计数器3单独清零 } void PrintSetting::setCNT1BackColor(bool flag) { if(flag) { ui->radioCNT1->setCheckable(true); ui->radioCNT1->setChecked(true); } else { ui->radioCNT1->setChecked(false); ui->radioCNT1->setCheckable(false); } // if(flag) // { // //ui->tabWidget->widget(0)->setStyleSheet("QTabBar::tab{background-color:rgb(255, 0, 0);}"); //设置选中背景色 // ui->radioCNT1->setChecked(flag); // } // else // { // //ui->tabWidget->widget(0)->setStyleSheet("QTabBar::tab{background-color:rgb(239, 239, 239);}"); //设置选中背景色 // ui->radioCNT1->setChecked(flag); // } } void PrintSetting::setCNT2BackColor(bool flag) { if(flag) { ui->radioCNT2->setCheckable(true); ui->radioCNT2->setChecked(true); } else { ui->radioCNT2->setChecked(false); ui->radioCNT2->setCheckable(false); } } void PrintSetting::setCNT3BackColor(bool flag) { if(flag) { ui->radioCNT3->setCheckable(true); ui->radioCNT3->setChecked(true); } else { ui->radioCNT3->setChecked(false); ui->radioCNT3->setCheckable(false); } } void PrintSetting::getFpgaVersionSetDisable(){ qDebug()<<"getFpgaVersionSetDisable"; sysPara->devOp->readFpgaVersionNum(); int FPGAVersion =sysPara->status.build_dat.builTime; unsigned int type = sysPara->status.fpgaVersionNum >> 12; LogInfo::setRunStatusText(tr("builTime:%1").arg(FPGAVersion)); LogInfo::setRunStatusText(tr("fpgaVersionNum: %1").arg(sysPara->status.fpgaVersionNum)); LogInfo::setRunStatusText(tr("FPGAType: %1").arg(type)); if(type == 1 || type == 2) FPGAVersion = 67; else if(type == 6 || type == 8) FPGAVersion = 72; if (FPGAVersion == 67){ sysPara->status.flagOfNo67FPGA = 1; ui->checkBox_FastMode->setEnabled(true); if(!sysPara->para.flagOfFastMode) uiSettingForNo67(); else uiSettingForNo66(); } else{ uiSettingForNo72(); } /****************VX4使用,VX5不需要 else if(sysPara->status.FPGAVersionType == 1) uiSettingForNo66(); else if(sysPara->status.FPGAVersionType == 2) uiSettingForNo67(); else if(FPGAVersion == 72) uiSettingForNo72(); else if(FPGAVersion == 73) uiSettingForNo73();*/ qDebug()<<"checkmode0211:"<checkmode0211->isChecked(); qDebug()<<"charWidthSetEnable:"<checkBoxCharWidthSet->isChecked(); qDebug()<<"Vol1of8En:"<checkVol1of8En->isChecked(); qDebug()<<"FullColFixVal:"<radioButtonFUllColFIxVal->isChecked(); sysPara->para.mode0211 = ui->checkmode0211->isChecked();//添加0211模式 sysPara->para.charWidthSetEnable = ui->checkBoxCharWidthSet->isChecked(); sysPara->para.Vol1of8En = ui->checkVol1of8En->isChecked();//打印优化 sysPara->para.FullColFixVal = ui->radioButtonFUllColFIxVal->isChecked();//2020/3/2 } void PrintSetting::resizeEvent(QResizeEvent *event) { #ifdef COUNTER2_BY_GROUP if(event->size().width() > 0) { // 将 widget_2 移动到其父级中间 ui->widget_2->move(ui->widget_2->parentWidget()->width() / 2 - ui->widget_2->width() / 2, ui->widget_2->y()); } #endif QWidget::resizeEvent(event); } void PrintSetting::uiSettingForNo66(){ ui->checkBox_FastMode->setChecked(true); if(sysPara->para.currPrintMode>1) ui->comboBoxPrintMode->setCurrentIndex(0); ui->comboBoxPrintMode->setCurrentIndex(sysPara->para.currPrintMode); ui->checkBoxCharWidthSet->setChecked(true); ui->checkVol1of8En->setChecked(true); ui->radioButtonFUllColFIxVal->setChecked(true); ui->checkmode0211->setChecked(false); ui->comboBoxPrintMode->setItemText(0,tr("超高速")); ui->comboBoxPrintMode->setItemText(1,tr("高速")); if(ui->comboBoxPrintMode->count()>2) ui->comboBoxPrintMode->removeItem(2); } void PrintSetting::uiSettingForNo67(){ ui->checkBox_FastMode->setEnabled(true); if(!sysPara->para.flagOfFastMode){ ui->checkBox_FastMode->setChecked(false); if(sysPara->para.currPrintMode>2) ui->comboBoxPrintMode->setCurrentIndex(0); ui->comboBoxPrintMode->setCurrentIndex(sysPara->para.currPrintMode); ui->checkBoxCharWidthSet->setChecked(true); ui->checkVol1of8En->setChecked(true); ui->radioButtonFUllColFIxVal->setChecked(true); ui->checkmode0211->setChecked(false); if(ui->comboBoxPrintMode->count()<=2){ ui->comboBoxPrintMode->setItemText(0,tr("快速")); ui->comboBoxPrintMode->setItemText(1,tr("标准")); ui->comboBoxPrintMode->addItem(tr("慢速")); } } } void PrintSetting::uiSettingForNo72(){ sysPara->status.flagOfNo67FPGA = 0; sysPara->para.flagOfFastMode=false; ui->checkBox_FastMode->setChecked(false); ui->checkBox_FastMode->setEnabled(false); ui->comboBoxPrintMode->setCurrentIndex(1); ui->comboBoxPrintMode->setEnabled(true); ui->checkBoxCharWidthSet->setChecked(false); ui->checkVol1of8En->setChecked(false); ui->radioButtonFUllColFIxVal->setChecked(false); ui->checkmode0211->setChecked(true); if(ui->comboBoxPrintMode->count()<=2){ ui->comboBoxPrintMode->setItemText(0,tr("快速")); ui->comboBoxPrintMode->setItemText(1,tr("标准")); ui->comboBoxPrintMode->addItem(tr("慢速")); } } void PrintSetting::uiSettingForNo73() { sysPara->status.flagOfNo67FPGA = 0; sysPara->para.flagOfFastMode=false; ui->checkBox_FastMode->setChecked(false); ui->checkBox_FastMode->setEnabled(false); ui->checkBoxCharWidthSet->setChecked(false); ui->checkVol1of8En->setChecked(false); ui->radioButtonFUllColFIxVal->setChecked(false); ui->checkmode0211->setChecked(false); if(ui->comboBoxPrintMode->count()<=2){ ui->comboBoxPrintMode->setItemText(0,tr("快速")); ui->comboBoxPrintMode->setItemText(1,tr("标准")); ui->comboBoxPrintMode->addItem(tr("慢速")); } } //67 触发-同步器触发-字符宽度 void PrintSetting::setDisableFontWidth(bool flag){ if(sysPara->para.charWidthSetEnable && flag){ ui->spinBoxColDelay->setValue(0); ui->spinBoxColDelay->setEnabled(true); }else { ui->spinBoxColDelay->setValue(sysPara->para.printColDelay); ui->spinBoxColDelay->setEnabled(true); } } //72 打印设置->常用设置->字体宽度 void PrintSetting::autoUpdateFontWidth(const unsigned int totalCol) { return; if(totalCol == 0) return; if(!sysPara->status.selfCheckDone && !TEST_MODE) return;//自检完成之前不检查 if(sysPara->para.printTriggerMode == PRINT_TRIGGER_TIME) return;//延迟触发模式不检查 if(((sysPara->para.printTriggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL ||sysPara->para.printTriggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE) && !sysPara->para.eleEyeTriggerSynPrintEn)) return;//电眼触发非同步打印模式不检查 #define MIN_CHAR_WIDTH 0.1 //0.1mm/列 #define MAX_CHAR_WIDTH 4.0 //4.0mm/列 float printInterval; int currPrintCol; float Cur_Col_Width; float MAX_COL_DELAY; int MIN_COL_DELAY; float Cur_Max_ColDelay; int Cur_Col_Delay; if((sysPara->para.printTriggerMode == PRINT_TRIGGER_SYNCHRONIZER)) { printInterval = (int )sysPara->para.synTriggerPrintLenMm; } else if(((sysPara->para.printTriggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL ||sysPara->para.printTriggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE) && sysPara->para.eleEyeTriggerSynPrintEn)) { printInterval = sysPara->para.elecEyeTriggerInterval; } currPrintCol = totalCol + BLANK_COL_NUM; qDebug()<<"printInterval: "<para.printColDelay; #define MIN_COL_WIDTH 0.11 #define MAX_COL_WIDTH 0.81 Cur_Col_Width = printInterval/currPrintCol; Cur_Col_Delay = sysPara->para.printColDelay; if(sysPara->status.build_dat.builTime == 67){ float Col_Width = (MIN_CHAR_WIDTH +Cur_Col_Delay*(MAX_CHAR_WIDTH - MIN_CHAR_WIDTH) /100)*currPrintCol; MIN_COL_DELAY = 1; MAX_COL_DELAY = (MAX_COL_WIDTH - MIN_CHAR_WIDTH)/0.039;//(MAX_CHAR_WIDTH - MIN_CHAR_WIDTH) /100=0.039 Cur_Max_ColDelay = (Cur_Col_Width - MIN_CHAR_WIDTH)/0.039; } else{ MIN_COL_DELAY = (int)(sysPara->para.synPulseNumPerMm*MIN_COL_WIDTH); MAX_COL_DELAY = sysPara->para.synPulseNumPerMm*MAX_COL_WIDTH; Cur_Max_ColDelay = sysPara->para.synPulseNumPerMm*Cur_Col_Width; } if(Cur_Max_ColDelay < 1){ QMessageBox::information(this,tr("提示"),tr("喷印间隔太小,无法正常打印!!!")); return; } if(Cur_Col_Delay == 0){ QMessageBox::information(this,tr("提示"),tr("字体宽度为0!!!")); return; } if(Cur_Max_ColDelay > MAX_COL_DELAY) Cur_Max_ColDelay = MAX_COL_DELAY; if(Cur_Col_Delay > (int)Cur_Max_ColDelay){ int oldColDelay = sysPara->para.printColDelay; sysPara->para.printColDelay = (int)Cur_Max_ColDelay; ui->spinBoxColDelay->setValue(sysPara->para.printColDelay); if(sysPara)sysPara->saveParaToFile (); QMessageBox::information(this,tr("提示"),tr("原字体宽度(%1mm)已不适用于新设置的喷印间隔,已自动调整到最大允许值(%2mm)!") .arg(oldColDelay).arg(Cur_Max_ColDelay)); } if(sysPara->para.printColDelay < MIN_COL_DELAY){ QMessageBox::information(this,tr("提示"),tr("字体宽度太小,打印字体将会被严重压缩!\n建议最小字体宽度为:%1\n建议最小喷印间隔为:%2") .arg(MIN_COL_DELAY).arg(currPrintCol*MIN_COL_WIDTH)); } } void PrintSetting::on_checkBox_FastMode_clicked() { bool flag = ui->checkBox_FastMode->isChecked(); if(flag){ ui->spinBoxReducedPixelNum->setValue(60); }else{ ui->spinBoxReducedPixelNum->setValue(0); } } //edit@11-30 小数点和隐藏值模块都显示,仅做展示。 void PrintSetting::ModuleDecimalHideDisplay(const bool bEnabled) { //工程模式下,隐藏值界面控件-全部显示 ui->label_7->setVisible(1); ui->label_6->setVisible(1); ui->label_34->setVisible(1); ui->radioButtonSpecialCondition->setVisible(1); ui->spinBoxHiddenValue->setVisible(1); ui->spinBoxMeterEnable->setVisible(1); ui->spinBoxConditionValue->setVisible(1); ui->spinBoxHiddenValue->setEnabled(bEnabled); ui->spinBoxMeterEnable->setEnabled(bEnabled); ui->spinBoxConditionValue->setEnabled(bEnabled); ui->radioButtonSpecialCondition->setChecked(bEnabled); //工程模式下,小数点界面控件--全部显示 ui->label_35->setVisible(1); ui->spinBoxdecimalpointnum->setVisible(1); ui->spinBoxdecimalpointnum->setEnabled(!bEnabled); } void PrintSetting::specailMachineSetting(bool enable){ ui->checkBox_ReclaimPumpEnable->setEnabled(enable); ui->spinBox_gearPumpSpeedAlarm->setEnabled(enable); } void PrintSetting::displayForAdjustVoltage(bool flag){ ui->checkVol1of8En->setVisible(flag); ui->radioButtonFUllColFIxVal->setVisible(flag); } void PrintSetting::setForAdjustVoltage(){ ui->checkVol1of8En->setChecked(true); ui->radioButtonFUllColFIxVal->setChecked(true); sysPara->para.Vol1of8En = ui->checkVol1of8En->isChecked(); sysPara->para.FullColFixVal = ui->radioButtonFUllColFIxVal->isChecked(); ui->spinBoxStartVoltage->setValue(30); ui->spinBoxStartVoltage->setEnabled(false); ui->spinBoxEndVoltage->setValue(75); ui->spinBoxEndVoltage->setEnabled(false); sysPara->para.startVoltage = 30; sysPara->para.endVoltage = 75; } void PrintSetting::on_spinBox_1_valueChanged(int arg1) { sysPara->devOp->controlInkValvePWMSTM32(arg1); } unsigned char dataofMotorCtrl[1]; void PrintSetting::on_pushButton_2_pressed() { dataofMotorCtrl[0]=0x12; sysPara->devOp->stm32Wr(0x01,dataofMotorCtrl,1); } void PrintSetting::on_pushButton_3_pressed() { dataofMotorCtrl[0]=0x11; sysPara->devOp->stm32Wr(0x01,dataofMotorCtrl,1); } void PrintSetting::on_pushButton_4_pressed() { dataofMotorCtrl[0]=0x10; sysPara->devOp->stm32Wr(0x01,dataofMotorCtrl,1); } void PrintSetting::slt_updateCntShow(bool checked) { ui->spinBoxCnt1StartValue->setEnabled(!checked); ui->spinBoxCnt1EndValue->setEnabled(!checked); ui->spinBoxCnt2StartValue->setEnabled(!checked); ui->spinBoxCnt2EndValue->setEnabled(!checked); if (!checked) ui->checkBoxResetCnt1CurrValue->setEnabled(true); if (checked) { ui->spinBoxCnt1StepValue->setValue(-1); ui->spinBoxCnt2StepValue->setValue(-1); } } void PrintSetting::initSection() { if (sectionalWid == nullptr) { sectionalWid = new SectionalWid(this); sectionalWid->bindSysPara(sysPara); ui->tabWidget_2->addTab(sectionalWid, tr("分段计数")); connect(SectionalManager::instance(), &SectionalManager::sig_updateCntShow, this, &PrintSetting::slt_updateCntShow); // SectionalManager::instance()->emitLoadUI(); } /*else { ui->tabWidget_2->addTab(sectionalWid, tr("分段计数")); }*/ } int tempReclaimTankStatus = 0; void PrintSetting::showReclaimTankstatusslot(unsigned char data) { QString str(""); QString str1 = QString::number(data); switch (data) { case 0x06:str="关闭成功"; break; case 0x05:str="打开成功"; break; case 0x03:str="关闭"; break; case 0x02:str="正在关"; break; case 0x01:str="正在开"; break; case 0x10:str="故障"; break; default: break; } tempReclaimTankStatus = data; } void PrintSetting::showMotorIsenVal(int data,int data1) { QString str = QString::number(data); QString str1 = QString::number(data1); } void PrintSetting::updateMachineMac(QString mac){ bool ok; int macValue = mac.toInt(&ok); if (!ok || macValue < 0 || macValue > 999) { return; } sysPara->status.machineMac = macValue; // sysPara->status.machineMac = mac.toInt(); }