#include "BondMatrixProgramPage.h" #include "Src/RewriteControl/Controls/SpinBox.h" #include "Src/RewriteControl/Controls/DoubleSpinBox.h" #include #include #include //#include BondMatrixProgramPage::BondMatrixProgramPage(QWidget* parent) : QWidget(parent) { ui.setupUi(this); ui.pushButtonSave->setProperty("type", "save"); ui.pushButtonAddOutMatrix->setProperty("type", "addOutMatrix"); ui.pushButtonSaveParaAs->setProperty("type", "saveParaAs"); ui.pushButtonSavePara->setProperty("type", "savePara"); setStyleSheet( "QWidget { background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #F1F4FD, stop: 1 #E5E4F6); }" "QDoubleSpinBox { background: #FFFFFF; border: 1px solid #BABBDC; border-radius: 6px; padding: 2px 5px; }" "QSpinBox { background: #FFFFFF; border: 1px solid #BABBDC; border-radius: 6px; padding: 2px 5px; }" "QLineEdit { background: #FFFFFF; border: 1px solid #BABBDC; border-radius: 6px; padding: 2px 5px; }" "QCheckBox::indicator { width: 20px; height: 20px; }" "QCheckBox::indicator:unchecked { background-color: #FFFFFF; border-radius: 2px; }" "QComboBox { background: #FFFFFF; border: 1px solid #BABBDC; border-radius: 6px; padding: 2px 5px; }" "QComboBox::drop-down { width: 20px; }" "QPushButton { background: #D0D0E8; border: 1px solid #BABBDC; border-radius: 6px; padding: 2px 5px; }" // Button background color "QPushButton:hover { background-color: #B0B0D8; }" // Lighter color on hover "QPushButton:pressed { background-color: #A0A0C8; }" // Darker color on press ); m_manageDB = CManageDB::GetInstance(); if (m_manageDB == nullptr) return; m_pProduct = m_manageDB->GetCProduct(); if (m_pProduct == nullptr) return; m_pProgramCViewInterface = ns_module::CViewInterface::GetInstance(); ui.frame->setFrameShape(QFrame::NoFrame); // 移除默认框架 ui.frame->setFixedHeight(2); // 设置固定高度 ui.frame->setStyleSheet("background-color: #C7CAEB;"); //ui.tab->setStyleSheet("background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #F1F4FD, stop: 1 #E5E4F6)"); //从后端获取数据 m_vectBondMatrixs = m_manageDB->GetCProduct()->GetBondMatrix(); m_manageDB->GetCProduct()->GetAllPointMatrix(m_vecSubMatrixs); m_vecBondInfoData = m_manageDB->GetCProduct()->GetAllBondInfoData(); if (m_vectBondMatrixs.size() == 0) { return; } initPage(); connect(ui.pushButtonSave, &QPushButton::clicked, this, [=] { MatrixChangeEvent(); CBondMatrix* pBondMatrix = CResources::GetInstance()->GetBondMatrix(); pBondMatrix->LoadMatrix(BOND_DIR::OrderAndS); }); connect(ui.pushButtonAddOutMatrix, &QPushButton::clicked, this, [=]() { PROGRAM_BOND_MATRIX_STRUCT newMatrix; //排序 std::sort(m_vectBondMatrixs.begin(), m_vectBondMatrixs.end(), [](const PROGRAM_BOND_MATRIX_STRUCT& a, const PROGRAM_BOND_MATRIX_STRUCT& b) { return a.BondMatrixId < b.BondMatrixId; }); int newBondMatrixID = 0; UINT maxID = 0; // 查找最大 MatrixId for (PROGRAM_BOND_MATRIX_STRUCT& bondMatrix : m_vectBondMatrixs) { if (bondMatrix.BondMatrixId > maxID) { maxID = bondMatrix.BondMatrixId; } } newBondMatrixID = ++maxID; while (std::any_of(m_vectBondMatrixs.begin(), m_vectBondMatrixs.end(), [newBondMatrixID](const PROGRAM_BOND_MATRIX_STRUCT& bondMatrix) { return bondMatrix.BondMatrixId == newBondMatrixID; })) { newBondMatrixID++; // 如果生成的 ID 已经存在,递增直到找到唯一的 ID } newMatrix.BondMatrixId = newBondMatrixID; newMatrix.BondMatrixRow = 0; newMatrix.BondMatrixCol = 0; newMatrix.strModuleName = "BondHead"; newMatrix.iModuleId = MODULE_LIST::BondHead; int newVectorIndex = m_vectBondMatrixs.size(); newMatrix.BondInfoId = 1; //std::vector newVecSubMatrix; m_vectBondMatrixs.push_back(newMatrix); AddOutMatrixPage(newVectorIndex, newMatrix, m_vecSubMatrixs); //AddOutMatrixPage(0, m_vectBondMatrixs[0], m_vecSubMatrixs); ui.comboBoxCurrentMatrix->clear(); for (int i = 0; i < m_vectBondMatrixs.size(); i++) { // 显示 矩阵编号 int _bondMatrixId = m_vectBondMatrixs[i].BondMatrixId; QString itemText = QString::number(_bondMatrixId); // 将 矩阵编号 添加到下拉框 ui.comboBoxCurrentMatrix->addItem(itemText,_bondMatrixId); } ShowCurrentMatrix(m_vectBondMatrixs[m_vectBondMatrixs.size()-1].BondMatrixId); }); connect(ui.pushButtonSavePara, &QPushButton::clicked, this, [=] { MatrixChangeEvent(); ParamChangeEvent(); CBondMatrix* pBondMatrix = CResources::GetInstance()->GetBondMatrix(); pBondMatrix->LoadMatrix(BOND_DIR::OrderAndS); }); //BondInfo另存为 connect(ui.pushButtonSaveParaAs, &QPushButton::clicked, this, [=] { BondInfoParamSaveAsEvent(); CBondMatrix* pBondMatrix = CResources::GetInstance()->GetBondMatrix(); pBondMatrix->LoadMatrix(BOND_DIR::OrderAndS); }); // 取晶头取晶 - 连接按钮点击事件 connect(ui.pushButtonSaveAsPick1, &QPushButton::clicked, this, [=]() { ParamSaveAsEvent(m_curWaferPickParam); // 传入取晶头取晶的参数 }); // 中转台取晶 - 连接按钮点击事件 connect(ui.pushButtonSaveAsPick2, &QPushButton::clicked, this, [=]() { ParamSaveAsEvent(m_curCalibPickParam); // 传入中转台取晶的参数 }); // 中转台固晶 - 连接按钮点击事件 connect(ui.pushButtonSaveAsPlace1, &QPushButton::clicked, this, [=]() { ParamSaveAsEvent(m_curCalibPlaceParam); // 传入中转台固晶的参数 }); // 固晶台固晶 - 连接按钮点击事件 connect(ui.pushButtonSaveAsPlace2, &QPushButton::clicked, this, [=]() { ParamSaveAsEvent(m_curBondParam); // 传入固晶台固晶的参数 }); connect(ui.comboBoxCurrentMatrix, SIGNAL(currentIndexChanged(int)), this, SLOT(onComboBoxCurrentMatrixChanged(int))); connect(ui.comboBoxCurrentPara, SIGNAL(currentIndexChanged(int)), this, SLOT(onComboBoxIndexChangedForParam(int))); ui.comboBoxCurrentPara->installEventFilter(this); //参数 connect(ui.comboBoxDieSource, QOverload::of(&QComboBox::currentIndexChanged), this, [=](int index) { if (index == 0) { m_curBondInfo.eDieSource = DIE_SOURCE::BY_WAFFLE; } else if (index == 1) { m_curBondInfo.eDieSource = DIE_SOURCE::BY_WAFER; } //ParamChangeEvent(); }); connect(ui.checkBoxIsCalib, &QCheckBox::clicked, this, [=](bool isChecked) { }); connect(ui.spinBoxDieHeight, &DoubleSpinBox::editDone, this, [=]() { m_curBondInfo.dDieHeight = ui.spinBoxDieHeight->value(); //ParamChangeEvent(); }); connect(ui.spinBoxPickNozzleID, &SpinBox::editDone, this, [=]() { m_curBondInfo.iPickHeadId = ui.spinBoxPickNozzleID->value(); //ParamChangeEvent(); }); connect(ui.comboBoxPostBondTemp, static_cast(&QComboBox::currentIndexChanged), this, [=](int index) { if (m_assss) { return; } m_curBondInfo.iBondBackPRStrategyId = ui.comboBoxPostBondTemp->currentData().toInt(); //ParamChangeEvent(); }); connect(ui.comboBoxPickTempID, static_cast(&QComboBox::currentIndexChanged), this, [=](int index) { if (m_assss) { return; } m_curBondInfo.iPickPRStrategyId = ui.comboBoxPickTempID->currentData().toInt(); //ParamChangeEvent(); }); connect(ui.comboBoxPreBondTemp, static_cast(&QComboBox::currentIndexChanged), this, [=](int index) { if (m_assss) { return; } m_curBondInfo.iBondFrontPRStrategyId = ui.comboBoxPreBondTemp->currentData().toInt(); //ParamChangeEvent(); }); connect(ui.comboBoxBondTemp, static_cast(&QComboBox::currentIndexChanged), this, [=](int index) { if (m_assss) { return; } m_curBondInfo.iBondAlnPRStrategyId = ui.comboBoxBondTemp->currentData().toInt(); //ParamChangeEvent(); }); connect(ui.comboBoxLookUpTemp, static_cast(&QComboBox::currentIndexChanged), this, [=](int index) { if (m_assss) { return; } m_curBondInfo.iLookUpPRStrategyId = ui.comboBoxLookUpTemp->currentData().toInt(); //ParamChangeEvent(); }); connect(ui.comboBoxCalibPickTemp, static_cast(&QComboBox::currentIndexChanged), this, [=](int index) { if (m_assss) { return; } m_curBondInfo.iCalibPRStrategyId = ui.comboBoxCalibPickTemp->currentData().toInt(); //ParamChangeEvent(); }); //取/固晶参数集修改 connect(ui.comboBoxCurrentPara_Pick1, static_cast(&QComboBox::currentIndexChanged), this, [=](int index) { if (m_assss) { return; } m_curBondInfo.iPickParamId = ui.comboBoxCurrentPara_Pick1->currentData().toInt(); m_manageDB->GetCProduct()->GetBondParam(m_curBondInfo.iPickParamId, m_curWaferPickParam); UpdatePagePickPlaceParam(); }); connect(ui.comboBoxCurrentPara_Pick2, static_cast(&QComboBox::currentIndexChanged), this, [=](int index) { if (m_assss) { return; } m_curBondInfo.iCalibPickParamId = ui.comboBoxCurrentPara_Pick2->currentData().toInt(); m_manageDB->GetCProduct()->GetBondParam(m_curBondInfo.iCalibPickParamId, m_curCalibPickParam); UpdatePagePickPlaceParam(); }); connect(ui.comboBoxCurrentPara_Place1, static_cast(&QComboBox::currentIndexChanged), this, [=](int index) { if (m_assss) { return; } m_curBondInfo.iCalibBondParamId = ui.comboBoxCurrentPara_Place1->currentData().toInt(); m_manageDB->GetCProduct()->GetBondParam(m_curBondInfo.iCalibBondParamId, m_curCalibPlaceParam); UpdatePagePickPlaceParam(); }); connect(ui.comboBoxCurrentPara_Place2, static_cast(&QComboBox::currentIndexChanged), this, [=](int index) { if (m_assss) { return; } m_curBondInfo.iBondParamId = ui.comboBoxCurrentPara_Place2->currentData().toInt(); m_manageDB->GetCProduct()->GetBondParam(m_curBondInfo.iBondParamId, m_curBondParam); UpdatePagePickPlaceParam(); }); // Connect buttons to slots connect(ui.SetParamPickTemp, &QPushButton::clicked, this, &BondMatrixProgramPage::onSetParamPickTempClicked); connect(ui.SetParamPreBond, &QPushButton::clicked, this, &BondMatrixProgramPage::onSetParamPreBondClicked); connect(ui.SetParamPostBond, &QPushButton::clicked, this, &BondMatrixProgramPage::onSetParamPostBondClicked); connect(ui.SetParamBond, &QPushButton::clicked, this, &BondMatrixProgramPage::onSetParamBondClicked); connect(ui.SetParamLookUp, &QPushButton::clicked, this, &BondMatrixProgramPage::onSetParamLookUpClicked); connect(ui.SetParamCalibPick, &QPushButton::clicked, this, &BondMatrixProgramPage::onSetParamCalibPickClicked); connect(ui.CreatParamPickTemp, &QPushButton::clicked, this, &BondMatrixProgramPage::onCreateParamPickTempClicked); connect(ui.CreatParamPreBond, &QPushButton::clicked, this, &BondMatrixProgramPage::onCreateParamPreBondClicked); connect(ui.CreatParamPostBond, &QPushButton::clicked, this, &BondMatrixProgramPage::onCreateParamPostBondClicked); connect(ui.CreatParamBond, &QPushButton::clicked, this, &BondMatrixProgramPage::onCreateParamBondClicked); connect(ui.CreatParamLookUp, &QPushButton::clicked, this, &BondMatrixProgramPage::onCreateParamLookUpClicked); connect(ui.CreatParamCalibPick, &QPushButton::clicked, this, &BondMatrixProgramPage::onCreateParamCalibPickClicked); connect(ui.spinBoxBondNozzleID, &SpinBox::editDone, this, [=]() { m_curBondInfo.iBondHeadId = ui.spinBoxBondNozzleID->value(); ParamChangeEvent(); }); connect(ui.doubleSpinBoxBondOffsetX, &DoubleSpinBox::editDone, this, [=]() { m_curBondInfo.stOffset.x = ui.doubleSpinBoxBondOffsetX->value(); ParamChangeEvent(); }); connect(ui.doubleSpinBoxBondOffsetY, &DoubleSpinBox::editDone, this, [=]() { m_curBondInfo.stOffset.y = ui.doubleSpinBoxBondOffsetY->value(); ParamChangeEvent(); }); connect(ui.doubleSpinBoxBondOffsetAngle, &DoubleSpinBox::editDone, this, [=]() { m_curBondInfo.stOffset.a = ui.doubleSpinBoxBondOffsetAngle->value(); ParamChangeEvent(); }); // 初始化取晶控件连接 connectWaferPickControls(); connectCalibPickControls(); // 初始化放晶控件连接 connectCalibPlaceControls(); connectBondControls(); } BondMatrixProgramPage::~BondMatrixProgramPage() { } // 取晶头取晶参数连接 void BondMatrixProgramPage::connectWaferPickControls() { connect(ui.checkBoxPickBlockCheck, &QCheckBox::clicked, this, [=](bool isChecked) { m_curWaferPickParam.bCheckBlock = ui.checkBoxPickBlockCheck->isChecked(); }); connect(ui.checkBoxPickLoseCheck, &QCheckBox::clicked, this, [=](bool isChecked) { m_curWaferPickParam.bCheckLose = ui.checkBoxPickLoseCheck->isChecked(); }); connect(ui.checkBoxPickFindForceCheck, &QCheckBox::clicked, this, [=](bool isChecked) { m_curWaferPickParam.bFindForce = ui.checkBoxPickFindForceCheck->isChecked(); //ui.doubleSpinBoxPrePickZ->setEnabled(!isChecked); // Disable when checked, enable when unchecked ui.doubleSpinBoxPickPosZ->setEnabled(!isChecked); }); connect(ui.doubleSpinBoxPrePickZ, &DoubleSpinBox::editDone, this, [=]() { m_curWaferPickParam.dPreLevOffset = ui.doubleSpinBoxPrePickZ->value(); }); connect(ui.doubleSpinBoxPickForce, &DoubleSpinBox::editDone, this, [=]() { m_curWaferPickParam.dForce = ui.doubleSpinBoxPickForce->value(); }); connect(ui.doubleSpinBoxPickPosZ, &DoubleSpinBox::editDone, this, [=]() { m_curWaferPickParam.dWorkLevOffset = ui.doubleSpinBoxPickPosZ->value(); }); connect(ui.spinBoxPickGrabDelay, &SpinBox::editDone, this, [=]() { m_curWaferPickParam.iGrabDelay = ui.spinBoxPickGrabDelay->value(); }); connect(ui.spinBox_PickDelay, &SpinBox::editDone, this, [=]() { m_curWaferPickParam.iPickOrBondDelay = ui.spinBox_PickDelay->value(); }); connect(ui.spinBoxPickBlockCheckDelay, &SpinBox::editDone, this, [=]() { m_curWaferPickParam.iBlockOrLoseDelay = ui.spinBoxPickBlockCheckDelay->value(); }); connect(ui.spinBoxPickVacDelay, &SpinBox::editDone, this, [=]() { m_curWaferPickParam.iVacuumDelay = ui.spinBoxPickVacDelay->value(); }); connect(ui.spinBoxPickBlowDelay, &SpinBox::editDone, this, [=]() { m_curWaferPickParam.iBlowDelay = ui.spinBoxPickBlowDelay->value(); }); } // 晶圆台取晶连接控件 void BondMatrixProgramPage::connectCalibPickControls() { connect(ui.checkBoxPickBlockCheck_2, &QCheckBox::clicked, this, [=](bool isChecked) { m_curCalibPickParam.bCheckBlock = ui.checkBoxPickBlockCheck_2->isChecked(); }); connect(ui.checkBoxPickLoseCheck_2, &QCheckBox::clicked, this, [=](bool isChecked) { m_curCalibPickParam.bCheckLose = ui.checkBoxPickLoseCheck_2->isChecked(); }); connect(ui.checkBoxPickFindForceCheck_2, &QCheckBox::clicked, this, [=](bool isChecked) { m_curCalibPickParam.bFindForce = ui.checkBoxPickFindForceCheck_2->isChecked(); //ui.doubleSpinBoxPrePickZ_2->setEnabled(!isChecked); // Disable when checked, enable when unchecked ui.doubleSpinBoxPickPosZ_2->setEnabled(!isChecked); }); connect(ui.doubleSpinBoxPrePickZ_2, &DoubleSpinBox::editDone, this, [=]() { m_curCalibPickParam.dPreLevOffset = ui.doubleSpinBoxPrePickZ_2->value(); }); connect(ui.doubleSpinBoxPickForce_2, &DoubleSpinBox::editDone, this, [=]() { m_curCalibPickParam.dForce = ui.doubleSpinBoxPickForce_2->value(); }); connect(ui.doubleSpinBoxPickPosZ_2, &DoubleSpinBox::editDone, this, [=]() { m_curCalibPickParam.dWorkLevOffset = ui.doubleSpinBoxPickPosZ_2->value(); }); connect(ui.spinBoxPickGrabDelay_2, &SpinBox::editDone, this, [=]() { m_curCalibPickParam.iGrabDelay = ui.spinBoxPickGrabDelay_2->value(); }); connect(ui.spinBox_PickDelay_2, &SpinBox::editDone, this, [=]() { m_curCalibPickParam.iPickOrBondDelay = ui.spinBox_PickDelay_2->value(); }); connect(ui.spinBoxPickBlockCheckDelay_2, &SpinBox::editDone, this, [=]() { m_curCalibPickParam.iBlockOrLoseDelay = ui.spinBoxPickBlockCheckDelay_2->value(); }); connect(ui.spinBoxPickVacDelay_2, &SpinBox::editDone, this, [=]() { m_curCalibPickParam.iVacuumDelay = ui.spinBoxPickVacDelay_2->value(); }); connect(ui.spinBoxPickBlowDelay_2, &SpinBox::editDone, this, [=]() { m_curCalibPickParam.iBlowDelay = ui.spinBoxPickBlowDelay_2->value(); }); } // 连接 "中转台固晶" 控件 void BondMatrixProgramPage::connectCalibPlaceControls() { connect(ui.checkBoxBondBlockCheck, &QCheckBox::clicked, this, &BondMatrixProgramPage::onCheckBoxBondBlockCheckClicked); connect(ui.checkBoxBondLoseCheck, &QCheckBox::clicked, this, &BondMatrixProgramPage::onCheckBoxBondLoseCheckClicked); connect(ui.checkBoxBondFindForce, &QCheckBox::clicked, this, &BondMatrixProgramPage::onCheckBoxBondFindForceClicked); connect(ui.doubleSpinBoxPreBondPosZ, &QDoubleSpinBox::editingFinished, this, &BondMatrixProgramPage::onDoubleSpinBoxPreBondPosZEditingFinished); connect(ui.doubleSpinBoxBondForce, &QDoubleSpinBox::editingFinished, this, &BondMatrixProgramPage::onDoubleSpinBoxBondForceEditingFinished); connect(ui.doubleSpinBoxBondPosZ, &QDoubleSpinBox::editingFinished, this, &BondMatrixProgramPage::onDoubleSpinBoxBondPosZEditingFinished); connect(ui.spinBoxBondGrabDelay, &QSpinBox::editingFinished, this, &BondMatrixProgramPage::onSpinBoxBondGrabDelayEditingFinished); connect(ui.spinBoxBondBlockCheckDelay, &QSpinBox::editingFinished, this, &BondMatrixProgramPage::onSpinBoxBondBlockCheckDelayEditingFinished); connect(ui.spinBoxBondDelay, &QSpinBox::editingFinished, this, &BondMatrixProgramPage::onSpinBoxBondDelayEditingFinished); connect(ui.spinBoxBondVacDelay, &QSpinBox::editingFinished, this, &BondMatrixProgramPage::onSpinBoxBondVacDelayEditingFinished); connect(ui.spinBoxBondBlowDelay, &QSpinBox::editingFinished, this, &BondMatrixProgramPage::onSpinBoxBondBlowDelayEditingFinished); } // 连接 "固晶台固晶" 控件 void BondMatrixProgramPage::connectBondControls() { connect(ui.checkBoxBondBlockCheck_2, &QCheckBox::clicked, this, &BondMatrixProgramPage::onCheckBoxBondBlockCheck_2Clicked); connect(ui.checkBoxBondLoseCheck_2, &QCheckBox::clicked, this, &BondMatrixProgramPage::onCheckBoxBondLoseCheck_2Clicked); connect(ui.checkBoxBondFindForce_2, &QCheckBox::clicked, this, &BondMatrixProgramPage::onCheckBoxBondFindForce_2Clicked); connect(ui.doubleSpinBoxPreBondPosZ_2, &QDoubleSpinBox::editingFinished, this, &BondMatrixProgramPage::onDoubleSpinBoxPreBondPosZ_2EditingFinished); connect(ui.doubleSpinBoxBondForce_2, &QDoubleSpinBox::editingFinished, this, &BondMatrixProgramPage::onDoubleSpinBoxBondForce_2EditingFinished); connect(ui.doubleSpinBoxBondPosZ_2, &QDoubleSpinBox::editingFinished, this, &BondMatrixProgramPage::onDoubleSpinBoxBondPosZ_2EditingFinished); connect(ui.spinBoxBondGrabDelay_2, &QSpinBox::editingFinished, this, &BondMatrixProgramPage::onSpinBoxBondGrabDelay_2EditingFinished); connect(ui.spinBoxBondBlockCheckDelay_2, &QSpinBox::editingFinished, this, &BondMatrixProgramPage::onSpinBoxBondBlockCheckDelay_2EditingFinished); connect(ui.spinBoxBondDelay_2, &QSpinBox::editingFinished, this, &BondMatrixProgramPage::onSpinBoxBondDelay_2EditingFinished); connect(ui.spinBoxBondVacDelay_2, &QSpinBox::editingFinished, this, &BondMatrixProgramPage::onSpinBoxBondVacDelay_2EditingFinished); connect(ui.spinBoxBondBlowDelay_2, &QSpinBox::editingFinished, this, &BondMatrixProgramPage::onSpinBoxBondBlowDelay_2EditingFinished); } //ModifyTemplate void BondMatrixProgramPage::onSetParamPickTempClicked() { int iTemplateId = ui.comboBoxPickTempID->currentData().toInt(); m_pProgramCViewInterface->GetViewMatrix()->ModifyBondMatrixTemplate(iTemplateId); } void BondMatrixProgramPage::onSetParamPreBondClicked() { int iTemplateId = ui.comboBoxPreBondTemp->currentData().toInt(); m_pProgramCViewInterface->GetViewMatrix()->ModifyBondMatrixTemplate(iTemplateId); } void BondMatrixProgramPage::onSetParamPostBondClicked() { int iTemplateId = ui.comboBoxPostBondTemp->currentData().toInt(); m_pProgramCViewInterface->GetViewMatrix()->ModifyBondMatrixTemplate(iTemplateId); } void BondMatrixProgramPage::onSetParamBondClicked() { int iTemplateId = ui.comboBoxBondTemp->currentData().toInt(); m_pProgramCViewInterface->GetViewMatrix()->ModifyBondMatrixTemplate(iTemplateId); } void BondMatrixProgramPage::onSetParamLookUpClicked() { int iTemplateId = ui.comboBoxLookUpTemp->currentData().toInt(); m_pProgramCViewInterface->GetViewMatrix()->ModifyBondMatrixTemplate(iTemplateId); } void BondMatrixProgramPage::onSetParamCalibPickClicked() { int iTemplateId = ui.comboBoxCalibPickTemp->currentData().toInt(); m_pProgramCViewInterface->GetViewMatrix()->ModifyBondMatrixTemplate(iTemplateId); } //CreateParam void BondMatrixProgramPage::onCreateParamPickTempClicked() { UINT iBondInfoId = ui.comboBoxCurrentPara->currentData().toUInt(); m_pProgramCViewInterface->GetViewMatrix()->CreateBondMatrixTemplate(BOND_MATRIX_TEMPLATE_TYPE::TEMPLATE_WAFER_PICK, iBondInfoId); UpdateShowBondInfoData(iBondInfoId); } void BondMatrixProgramPage::onCreateParamPreBondClicked() { UINT iBondInfoId = ui.comboBoxCurrentPara->currentData().toUInt(); m_pProgramCViewInterface->GetViewMatrix()->CreateBondMatrixTemplate(BOND_MATRIX_TEMPLATE_TYPE::TEMPLATE_BONDFRONT, iBondInfoId); UpdateShowBondInfoData(iBondInfoId); } void BondMatrixProgramPage::onCreateParamPostBondClicked() { UINT iBondInfoId = ui.comboBoxCurrentPara->currentData().toUInt(); m_pProgramCViewInterface->GetViewMatrix()->CreateBondMatrixTemplate(BOND_MATRIX_TEMPLATE_TYPE::TEMPLATE_BONDBACK, iBondInfoId); UpdateShowBondInfoData(iBondInfoId); } void BondMatrixProgramPage::onCreateParamBondClicked() { UINT iBondInfoId = ui.comboBoxCurrentPara->currentData().toUInt(); m_pProgramCViewInterface->GetViewMatrix()->CreateBondMatrixTemplate(BOND_MATRIX_TEMPLATE_TYPE::TEMPLATE_WORKTABLE_BOND, iBondInfoId); UpdateShowBondInfoData(iBondInfoId); } void BondMatrixProgramPage::onCreateParamLookUpClicked() { UINT iBondInfoId = ui.comboBoxCurrentPara->currentData().toUInt(); m_pProgramCViewInterface->GetViewMatrix()->CreateBondMatrixTemplate(BOND_MATRIX_TEMPLATE_TYPE::TEMPLATE_LOOKUP, iBondInfoId); UpdateShowBondInfoData(iBondInfoId); } void BondMatrixProgramPage::onCreateParamCalibPickClicked() { UINT iBondInfoId = ui.comboBoxCurrentPara->currentData().toUInt(); m_pProgramCViewInterface->GetViewMatrix()->CreateBondMatrixTemplate(BOND_MATRIX_TEMPLATE_TYPE::TEMPLATE_TRANSFER_PICK, iBondInfoId); UpdateShowBondInfoData(iBondInfoId); } // 为华夫盒连接控件 void BondMatrixProgramPage::onCheckBoxPickBlockCheckClicked(bool isChecked) { m_curWaferPickParam.bCheckBlock = isChecked; } void BondMatrixProgramPage::onCheckBoxPickLoseCheckClicked(bool isChecked) { m_curWaferPickParam.bCheckLose = isChecked; } void BondMatrixProgramPage::onCheckBoxPickFindForceCheckClicked(bool isChecked) { m_curWaferPickParam.bFindForce = isChecked; } void BondMatrixProgramPage::onDoubleSpinBoxPrePickZEditingFinished() { m_curWaferPickParam.dPreLevOffset = ui.doubleSpinBoxPrePickZ->value(); } void BondMatrixProgramPage::onDoubleSpinBoxPickForceEditingFinished() { m_curWaferPickParam.dForce = ui.doubleSpinBoxPickForce->value(); } void BondMatrixProgramPage::onDoubleSpinBoxPickPosZEditingFinished() { m_curWaferPickParam.dWorkLevOffset = ui.doubleSpinBoxPickPosZ->value(); } void BondMatrixProgramPage::onSpinBoxPickGrabDelayEditingFinished() { m_curWaferPickParam.iGrabDelay = ui.spinBoxPickGrabDelay->value(); } void BondMatrixProgramPage::onSpinBoxPickDelayEditingFinished() { m_curWaferPickParam.iPickOrBondDelay = ui.spinBox_PickDelay->value(); } void BondMatrixProgramPage::onSpinBoxPickBlockCheckDelayEditingFinished() { m_curWaferPickParam.iBlockOrLoseDelay = ui.spinBoxPickBlockCheckDelay->value(); } void BondMatrixProgramPage::onSpinBoxPickVacDelayEditingFinished() { m_curWaferPickParam.iVacuumDelay = ui.spinBoxPickVacDelay->value(); } void BondMatrixProgramPage::onSpinBoxPickBlowDelayEditingFinished() { m_curWaferPickParam.iBlowDelay = ui.spinBoxPickBlowDelay->value(); } // 中转台取晶槽函数实现 void BondMatrixProgramPage::onCheckBoxPickBlockCheck_2Clicked(bool isChecked) { m_curCalibPickParam.bCheckBlock = isChecked; } void BondMatrixProgramPage::onCheckBoxPickLoseCheck_2Clicked(bool isChecked) { m_curCalibPickParam.bCheckLose = isChecked; } void BondMatrixProgramPage::onCheckBoxPickFindForceCheck_2Clicked(bool isChecked) { m_curCalibPickParam.bFindForce = isChecked; } void BondMatrixProgramPage::onDoubleSpinBoxPrePickZ_2EditingFinished() { m_curCalibPickParam.dPreLevOffset = ui.doubleSpinBoxPrePickZ_2->value(); } void BondMatrixProgramPage::onDoubleSpinBoxPickForce_2EditingFinished() { m_curCalibPickParam.dForce = ui.doubleSpinBoxPickForce_2->value(); } void BondMatrixProgramPage::onDoubleSpinBoxPickPosZ_2EditingFinished() { m_curCalibPickParam.dWorkLevOffset = ui.doubleSpinBoxPickPosZ_2->value(); } void BondMatrixProgramPage::onSpinBoxPickGrabDelay_2EditingFinished() { m_curCalibPickParam.iGrabDelay = ui.spinBoxPickGrabDelay_2->value(); } void BondMatrixProgramPage::onSpinBoxPickDelay_2EditingFinished() { m_curCalibPickParam.iPickOrBondDelay = ui.spinBox_PickDelay_2->value(); } void BondMatrixProgramPage::onSpinBoxPickBlockCheckDelay_2EditingFinished() { m_curCalibPickParam.iBlockOrLoseDelay = ui.spinBoxPickBlockCheckDelay_2->value(); } void BondMatrixProgramPage::onSpinBoxPickVacDelay_2EditingFinished() { m_curCalibPickParam.iVacuumDelay = ui.spinBoxPickVacDelay_2->value(); } void BondMatrixProgramPage::onSpinBoxPickBlowDelay_2EditingFinished() { m_curCalibPickParam.iBlowDelay = ui.spinBoxPickBlowDelay_2->value(); } // 处理 "中转台放晶" 控件的槽函数 void BondMatrixProgramPage::onCheckBoxBondBlockCheckClicked(bool isChecked) { m_curCalibPlaceParam.bCheckBlock = isChecked; } void BondMatrixProgramPage::onCheckBoxBondLoseCheckClicked(bool isChecked) { m_curCalibPlaceParam.bCheckLose = isChecked; } void BondMatrixProgramPage::onCheckBoxBondFindForceClicked(bool isChecked) { m_curCalibPlaceParam.bFindForce = isChecked; //ui.doubleSpinBoxPreBondPosZ->setEnabled(!isChecked); ui.doubleSpinBoxBondPosZ->setEnabled(!isChecked); } void BondMatrixProgramPage::onDoubleSpinBoxPreBondPosZEditingFinished() { m_curCalibPlaceParam.dPreLevOffset = ui.doubleSpinBoxPreBondPosZ->value(); } void BondMatrixProgramPage::onDoubleSpinBoxBondForceEditingFinished() { m_curCalibPlaceParam.dForce = ui.doubleSpinBoxBondForce->value(); } void BondMatrixProgramPage::onDoubleSpinBoxBondPosZEditingFinished() { m_curCalibPlaceParam.dWorkLevOffset = ui.doubleSpinBoxBondPosZ->value(); } void BondMatrixProgramPage::onSpinBoxBondGrabDelayEditingFinished() { m_curCalibPlaceParam.iGrabDelay = ui.spinBoxBondGrabDelay->value(); } void BondMatrixProgramPage::onSpinBoxBondBlockCheckDelayEditingFinished() { m_curCalibPlaceParam.iBlockOrLoseDelay = ui.spinBoxBondBlockCheckDelay->value(); } void BondMatrixProgramPage::onSpinBoxBondDelayEditingFinished() { m_curCalibPlaceParam.iPickOrBondDelay = ui.spinBoxBondDelay->value(); } void BondMatrixProgramPage::onSpinBoxBondVacDelayEditingFinished() { m_curCalibPlaceParam.iVacuumDelay = ui.spinBoxBondVacDelay->value(); } void BondMatrixProgramPage::onSpinBoxBondBlowDelayEditingFinished() { m_curCalibPlaceParam.iBlowDelay = ui.spinBoxBondBlowDelay->value(); } // 处理 "固晶台固晶" 控件的槽函数 void BondMatrixProgramPage::onCheckBoxBondBlockCheck_2Clicked(bool isChecked) { m_curBondParam.bCheckBlock = isChecked; } void BondMatrixProgramPage::onCheckBoxBondLoseCheck_2Clicked(bool isChecked) { m_curBondParam.bCheckLose = isChecked; } void BondMatrixProgramPage::onCheckBoxBondFindForce_2Clicked(bool isChecked) { m_curBondParam.bFindForce = isChecked; //ui.doubleSpinBoxPreBondPosZ_2->setEnabled(!isChecked); ui.doubleSpinBoxBondPosZ_2->setEnabled(!isChecked); } void BondMatrixProgramPage::onDoubleSpinBoxPreBondPosZ_2EditingFinished() { m_curBondParam.dPreLevOffset = ui.doubleSpinBoxPreBondPosZ_2->value(); } void BondMatrixProgramPage::onDoubleSpinBoxBondForce_2EditingFinished() { m_curBondParam.dForce = ui.doubleSpinBoxBondForce_2->value(); } void BondMatrixProgramPage::onDoubleSpinBoxBondPosZ_2EditingFinished() { m_curBondParam.dWorkLevOffset = ui.doubleSpinBoxBondPosZ_2->value(); } void BondMatrixProgramPage::onSpinBoxBondGrabDelay_2EditingFinished() { m_curBondParam.iGrabDelay = ui.spinBoxBondGrabDelay_2->value(); } void BondMatrixProgramPage::onSpinBoxBondBlockCheckDelay_2EditingFinished() { m_curBondParam.iBlockOrLoseDelay = ui.spinBoxBondBlockCheckDelay_2->value(); } void BondMatrixProgramPage::onSpinBoxBondDelay_2EditingFinished() { m_curBondParam.iPickOrBondDelay = ui.spinBoxBondDelay_2->value(); } void BondMatrixProgramPage::onSpinBoxBondVacDelay_2EditingFinished() { m_curBondParam.iVacuumDelay = ui.spinBoxBondVacDelay_2->value(); } void BondMatrixProgramPage::onSpinBoxBondBlowDelay_2EditingFinished() { m_curBondParam.iBlowDelay = ui.spinBoxBondBlowDelay_2->value(); } XY_DOUBLE_STRUCT BondMatrixProgramPage::BondGetAxisPosition(std::string ModuleType, XY_DOUBLE_STRUCT& pos) { /*CAxis* _Axis; CAxis::AXIS_TYPE eAxisType = _Axis->GetAxisType();*/ if (m_pProgramCViewInterface == nullptr) { XY_DOUBLE_STRUCT errorPt = pos; // 可以根据需要返回一个错误状态 // 弹出消息框显示位置 QString positionString = QString("Unable to retrieve axis position for module type: %1").arg(QString::fromStdString(ModuleType)); QMessageBox::information(this, "Axis Position Error", positionString); return errorPt; } m_pProgramCViewInterface->GetViewMotion()->GetAxisPosition(ModuleType, "X", pos.x); m_pProgramCViewInterface->GetViewMotion()->GetAxisPosition(ModuleType, "Y", pos.y); return pos; } XY_DOUBLE_STRUCT BondMatrixProgramPage::BondMoveToXYAxisPosition(std::string ModuleType, XY_DOUBLE_STRUCT& pos) { if (m_pProgramCViewInterface == nullptr) { XY_DOUBLE_STRUCT errorPt = pos; // 可以根据需要返回一个错误状态 // 弹出消息框显示位置 QString positionString = QString("Unable to retrieve axis position for module type: %1").arg(QString::fromStdString(ModuleType)); QMessageBox::information(this, "Axis Position Error", positionString); return errorPt; } m_pProgramCViewInterface->GetViewMotion()->ModuleMoveTo(ModuleType, "X", pos.x); m_pProgramCViewInterface->GetViewMotion()->ModuleMoveTo(ModuleType, "Y", pos.y); return pos; } void BondMatrixProgramPage::AddOutMatrixPage(int vectorIndex, PROGRAM_BOND_MATRIX_STRUCT matrixData, std::vector vecSubMatrix) { int matrixNum = m_mapSubMatrixControls.size(); int newMatrixID = ++matrixNum; QVector vecControls; QWidget* outWidget = new QWidget(); QGridLayout* outMatrixGridLayout = new QGridLayout(); outMatrixGridLayout->setSpacing(4); outMatrixGridLayout->setObjectName(QString::fromUtf8("Out GridLayout")); outMatrixGridLayout->setContentsMargins(0, 0, 0, 0); // 设置布局的边距为0 QGridLayout* boxGridLayout = new QGridLayout(); boxGridLayout->setSpacing(4); boxGridLayout->setObjectName(QString::fromUtf8("Box GridLayout")); boxGridLayout->setContentsMargins(0, 0, 0, 0); // 设置布局的边距为0 QHBoxLayout* buttonLayout = new QHBoxLayout(); QSpacerItem* item = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); buttonLayout->addSpacerItem(item); QGroupBox* groupBox = new QGroupBox(outWidget); groupBox->setLayout(boxGridLayout); QGridLayout* matrixGridLayout = new QGridLayout(); matrixGridLayout->setSpacing(4); matrixGridLayout->setObjectName(QString::fromUtf8("matrixGridLayout")); matrixGridLayout->setContentsMargins(0, 0, 0, 0); // 设置布局的边距为0 // Add matrix title QLabel* labelTitle = new QLabel(outWidget); labelTitle->setObjectName(QString::fromUtf8("labelTitle")); labelTitle->setText(tr("Bond Matrix ") + QString::number(vectorIndex+1)); labelTitle->setStyleSheet("color: #6A78FF;height: 30px"); matrixGridLayout->addWidget(labelTitle, 0, 0, 1, 1); vecControls.push_back(labelTitle); // Add "Add Sub Matrix" button QPushButton* pushButtonAdd = new QPushButton(outWidget); pushButtonAdd->setObjectName(QString::fromUtf8("button Add")); pushButtonAdd->setText(tr("Add sub Matrix")); matrixGridLayout->addWidget(pushButtonAdd, 0, 2, 1, 3); pushButtonAdd->setProperty("type", "default"); connect(pushButtonAdd, &QPushButton::clicked, this, [=]() { int newSubMatrixIndex = m_vecSubMatrixs.size(); PROGRAM_POINT_MATRIX_STRUCT subMatrix; std::sort(m_vecSubMatrixs.begin(), m_vecSubMatrixs.end(), [](const PROGRAM_POINT_MATRIX_STRUCT& a, const PROGRAM_POINT_MATRIX_STRUCT& b) { return a.MatrixId < b.MatrixId; }); int newSubMatrixID = 0; UINT maxID = 0; // 查找最大 MatrixId for (PROGRAM_POINT_MATRIX_STRUCT& subMatrix : m_vecSubMatrixs) { if (subMatrix.MatrixId > maxID) { maxID = subMatrix.MatrixId; } } newSubMatrixID = ++maxID; while (std::any_of(m_vecSubMatrixs.begin(), m_vecSubMatrixs.end(), [newSubMatrixID](const PROGRAM_POINT_MATRIX_STRUCT& subMatrix) { return subMatrix.MatrixId == newSubMatrixID; })) { newSubMatrixID++; // 如果生成的 ID 已经存在,递增直到找到唯一的 ID } subMatrix.MatrixId = newSubMatrixID; subMatrix.strModuleName = "BondHead"; subMatrix.iModuleId = MODULE_LIST::BondHead; subMatrix.MatrixRow = 0; subMatrix.MatrixCol = 0; m_vecSubMatrixs.push_back(subMatrix); // Add the submatrix to the bond matrix's VecPointMatrixId //找大矩阵ID/Index auto currentIt = m_mapOutWidgetIndex.find(outWidget); int bondMatrixId = currentIt.value(); //迭代器 erase后currentIt被删除了 //m_vectBondMatrixs[index].VecPointMatrixId.push_back(newSubMatrixID); // 遍历 m_vectBondMatrixs 找到对应的矩阵 for (size_t i = 0; i < m_vectBondMatrixs.size(); ++i) { if (m_vectBondMatrixs[i].BondMatrixId == bondMatrixId) { // 找到对应的矩阵,添加新的子矩阵 ID m_vectBondMatrixs[i].VecPointMatrixId.push_back(newSubMatrixID); break; // 找到后退出循环 } } AddMatrixPage(bondMatrixId, newSubMatrixIndex, subMatrix, outMatrixGridLayout); }); // Add Delete Out Matrix button QPushButton* pushButtonDelete = new QPushButton(outWidget); pushButtonDelete->setObjectName(QString::fromUtf8("button delete")); pushButtonDelete->setText(tr("Delete")); matrixGridLayout->addWidget(pushButtonDelete, 0, 1, 1, 1); connect(pushButtonDelete, &QPushButton::clicked, this, [=]() { //处理index auto currentIt = m_mapOutWidgetIndex.find(outWidget); int index = currentIt.value(); //迭代器 erase后currentIt被删除了 m_mapOutWidgetIndex.erase(currentIt); delete outWidget; ui.comboBoxCurrentMatrix->clear(); for (int i = 0; i < m_vectBondMatrixs.size(); i++) { int bondMatrixId = m_vectBondMatrixs[i].BondMatrixId; // 显示 矩阵编号 QString itemText = QString::number(bondMatrixId); if (bondMatrixId == index) { //删除缓存数据 m_vectBondMatrixs.erase(m_vectBondMatrixs.begin() + i); continue; } // 将 矩阵编号 添加到下拉框 ui.comboBoxCurrentMatrix->addItem(itemText, bondMatrixId); } if (!m_vectBondMatrixs.empty()) { ShowCurrentMatrix(m_vectBondMatrixs[0].BondMatrixId); } }); // Add Row and Column controls QLabel* labelRow = new QLabel(outWidget); labelRow->setObjectName(QString::fromUtf8("labelRow")); labelRow->setText(tr("Row & Cow")); matrixGridLayout->addWidget(labelRow, 2, 0, 1, 1); vecControls.push_back(labelRow); SpinBox* spinBoxRow = new SpinBox(outWidget); spinBoxRow->setObjectName(QString::fromUtf8("spinBoxRow")); spinBoxRow->setFixedWidth(95); // Set fixed width to 95 matrixGridLayout->addWidget(spinBoxRow, 2, 1, 1, 1); vecControls.push_back(spinBoxRow); SpinBox* spinBoxCol = new SpinBox(outWidget); spinBoxCol->setObjectName(QString::fromUtf8("spinBoxCol")); spinBoxCol->setFixedWidth(95); // Set fixed width to 95 matrixGridLayout->addWidget(spinBoxCol, 2, 2, 1, 1); vecControls.push_back(spinBoxCol); // Add Left Top Position controls QLabel* labelLeftTop = new QLabel(outWidget); labelLeftTop->setObjectName(QString::fromUtf8("labelLeftTop")); labelLeftTop->setText(tr("Left Top Pos ")); matrixGridLayout->addWidget(labelLeftTop, 4, 0, 1, 1); vecControls.push_back(labelLeftTop); DoubleSpinBox* doubleSpinBoxLeftTopX = new DoubleSpinBox(outWidget); doubleSpinBoxLeftTopX->setObjectName(QString::fromUtf8("doubleSpinBoxLeftTopX")); doubleSpinBoxLeftTopX->setFixedWidth(95); // Set fixed width to 95 matrixGridLayout->addWidget(doubleSpinBoxLeftTopX, 4, 1, 1, 1); vecControls.push_back(doubleSpinBoxLeftTopX); DoubleSpinBox* doubleSpinBoxLeftTopY = new DoubleSpinBox(outWidget); doubleSpinBoxLeftTopY->setObjectName(QString::fromUtf8("doubleSpinBoxLeftTopY")); doubleSpinBoxLeftTopY->setFixedWidth(95); // Set fixed width to 95 matrixGridLayout->addWidget(doubleSpinBoxLeftTopY, 4, 2, 1, 1); vecControls.push_back(doubleSpinBoxLeftTopY); // Add GP button for Left Top QPushButton* buttonLeftTop = new QPushButton("GP", this); buttonLeftTop->setFixedWidth(31); // Set the same width for the button matrixGridLayout->addWidget(buttonLeftTop, 4, 3, 1, 1); // Position the button next to LeftTopPos connect(buttonLeftTop, &QPushButton::clicked, this, [=]() { XY_DOUBLE_STRUCT position = BondGetAxisPosition("BondHead", m_vectBondMatrixs[vectorIndex].LeftTopPoint); doubleSpinBoxLeftTopX->setValue(position.x); doubleSpinBoxLeftTopY->setValue(position.y); }); QPushButton* buttonMoveToLeftTop = new QPushButton("MT", this); buttonMoveToLeftTop->setFixedWidth(31); // Set the same width for the button matrixGridLayout->addWidget(buttonMoveToLeftTop, 4, 4, 1, 1); // Position the button next to LeftTopPos connect(buttonMoveToLeftTop, &QPushButton::clicked, this, [=]() { XY_DOUBLE_STRUCT position = BondMoveToXYAxisPosition("BondHead", m_vectBondMatrixs[vectorIndex].LeftTopPoint); }); // Add Right Top Position controls QLabel* labelRightTopPos = new QLabel(outWidget); labelRightTopPos->setObjectName(QString::fromUtf8("labelRightTopPos")); labelRightTopPos->setText(tr("Right Top Pos ")); matrixGridLayout->addWidget(labelRightTopPos, 5, 0, 1, 1); vecControls.push_back(labelRightTopPos); DoubleSpinBox* doubleSpinBoxRightTopX = new DoubleSpinBox(outWidget); doubleSpinBoxRightTopX->setObjectName(QString::fromUtf8("doubleSpinBoxRightTopX")); doubleSpinBoxRightTopX->setFixedWidth(95); // Set fixed width to 95 matrixGridLayout->addWidget(doubleSpinBoxRightTopX, 5, 1, 1, 1); vecControls.push_back(doubleSpinBoxRightTopX); DoubleSpinBox* doubleSpinBoxRightTopY = new DoubleSpinBox(outWidget); doubleSpinBoxRightTopY->setObjectName(QString::fromUtf8("doubleSpinBoxRightTopY")); doubleSpinBoxRightTopY->setFixedWidth(95); // Set fixed width to 95 matrixGridLayout->addWidget(doubleSpinBoxRightTopY, 5, 2, 1, 1); vecControls.push_back(doubleSpinBoxRightTopY); QPushButton* buttonRightTop = new QPushButton("GP", this); buttonRightTop->setFixedWidth(31); // Set the same width for the button matrixGridLayout->addWidget(buttonRightTop, 5, 3, 1, 1); // Position the button next to RightTopPos connect(buttonRightTop, &QPushButton::clicked, this, [=]() { XY_DOUBLE_STRUCT position = BondGetAxisPosition("BondHead", m_vectBondMatrixs[vectorIndex].RightTopPoint); doubleSpinBoxRightTopX->setValue(position.x); doubleSpinBoxRightTopY->setValue(position.y); }); QPushButton* buttonMoveToRightTop = new QPushButton("MT", this); buttonMoveToRightTop->setFixedWidth(31); matrixGridLayout->addWidget(buttonMoveToRightTop, 5, 4, 1, 1); connect(buttonMoveToRightTop, &QPushButton::clicked, this, [=]() { XY_DOUBLE_STRUCT position = BondMoveToXYAxisPosition("BondHead", m_vectBondMatrixs[vectorIndex].RightTopPoint); }); // Add Right Bottom Position controls QLabel* labelRightButtomPos = new QLabel(outWidget); labelRightButtomPos->setObjectName(QString::fromUtf8("labelRightButtomPos")); labelRightButtomPos->setText(tr("Right Buttom pos")); matrixGridLayout->addWidget(labelRightButtomPos, 6, 0, 1, 1); vecControls.push_back(labelRightButtomPos); DoubleSpinBox* doubleSpinBoxRightButtomX = new DoubleSpinBox(outWidget); doubleSpinBoxRightButtomX->setObjectName(QString::fromUtf8("doubleSpinBoxRightButtomX")); doubleSpinBoxRightButtomX->setFixedWidth(95); // Set fixed width to 95 matrixGridLayout->addWidget(doubleSpinBoxRightButtomX, 6, 1, 1, 1); vecControls.push_back(doubleSpinBoxRightButtomX); DoubleSpinBox* doubleSpinBoxRightButtomY = new DoubleSpinBox(outWidget); doubleSpinBoxRightButtomY->setObjectName(QString::fromUtf8("doubleSpinBoxRightButtomY")); doubleSpinBoxRightButtomY->setFixedWidth(95); // Set fixed width to 95 matrixGridLayout->addWidget(doubleSpinBoxRightButtomY, 6, 2, 1, 1); vecControls.push_back(doubleSpinBoxRightTopX); QPushButton* buttonRightButtom = new QPushButton("GP", this); buttonRightButtom->setFixedWidth(31); // Set the same width for the button matrixGridLayout->addWidget(buttonRightButtom, 6, 3, 1, 1); // Position the button next to RightBottomPos connect(buttonRightButtom, &QPushButton::clicked, this, [=]() { XY_DOUBLE_STRUCT position = BondGetAxisPosition("BondHead", m_vectBondMatrixs[vectorIndex].RightBottomPoint); doubleSpinBoxRightButtomX->setValue(position.x); doubleSpinBoxRightButtomY->setValue(position.y); }); QPushButton* buttonMoveToRightButtom = new QPushButton("MT", this); buttonMoveToRightButtom->setFixedWidth(31); matrixGridLayout->addWidget(buttonMoveToRightButtom, 6, 4, 1, 1); connect(buttonMoveToRightButtom, &QPushButton::clicked, this, [=]() { XY_DOUBLE_STRUCT position = BondMoveToXYAxisPosition("BondHead", m_vectBondMatrixs[vectorIndex].RightBottomPoint); }); // Add No Bond Points line edit QLabel* labelNoBondPts = new QLabel(outWidget); labelNoBondPts->setObjectName(QString::fromUtf8("labelNoBondPts")); labelNoBondPts->setText(tr("No Bond Points")); matrixGridLayout->addWidget(labelNoBondPts, 7, 0, 1, 1); vecControls.push_back(labelNoBondPts); QLineEdit* lineEditNoBondPts = new QLineEdit(outWidget); lineEditNoBondPts->setObjectName(QString::fromUtf8("lineEditNoBondPts")); matrixGridLayout->addWidget(lineEditNoBondPts, 7, 1, 1, 4); vecControls.push_back(lineEditNoBondPts); lineEditNoBondPts->setReadOnly(true); lineEditNoBondPts->setCursor(Qt::PointingHandCursor); lineEditNoBondPts->setProperty("vectorIndex", vectorIndex); // 存储索引 lineEditNoBondPts->setProperty("parentMatrixIndex", -1); // 设置父矩阵的索引 lineEditNoBondPts->installEventFilter(this); // Paragram line edit QLabel* labelParagram = new QLabel(outWidget); labelParagram->setObjectName(QString::fromUtf8("labelParagram")); labelParagram->setText(tr("ParagramSet")); matrixGridLayout->addWidget(labelParagram, 8, 0, 1, 1); vecControls.push_back(labelParagram); QComboBox* comboBoxParagramSet = new QComboBox(outWidget); comboBoxParagramSet->setObjectName(QString::fromUtf8("comboBoxNoBondPts")); m_mapParagramSetComboBox.insert(comboBoxParagramSet, matrixData.BondMatrixId); // 添加选项到下拉框并关联 iInfoId for (const auto& bondMatrix : m_vecBondInfoData) { // 将 iInfoId 作为显示项添加到下拉框 QString itemText = QString::number(bondMatrix.iInfoId); // 显示编号 iInfoId // 添加项并使用 setData 存储 iInfoId 作为附加数据 comboBoxParagramSet->addItem(itemText, bondMatrix.iInfoId); } comboBoxParagramSet->setCurrentIndex(comboBoxParagramSet->findData(matrixData.BondInfoId)); // 设置默认项 ui.comboBoxCurrentPara->setCurrentIndex(ui.comboBoxCurrentPara->findData(matrixData.BondInfoId)); // 设置默认项 // 将下拉框添加到布局中 matrixGridLayout->addWidget(comboBoxParagramSet, 8, 1, 1, 1); // 将控件保存到 vecControls 中 vecControls.push_back(comboBoxParagramSet); // 连接 QComboBox 的信号和槽 connect(comboBoxParagramSet, SIGNAL(currentIndexChanged(int)), this, SLOT(onComboBoxIndexChangedForMatrixParam(int))); //connect(, SIGNAL(showPopup()), this, SLOT(onComboBoxPopup())); //connect(comboBoxParagramSet, &QComboBox::showPopup, this, &BondMatrixProgramPage::onComboBoxPopup); comboBoxParagramSet->installEventFilter(this); //QPushButton* buttonParagram = new QPushButton("ShowParagram", this); ////buttonParagram->setFixedWidth(31); // Set the same width for the button //matrixGridLayout->addWidget(buttonParagram, 8, 2, 1, 2); // Position the button next to RightBottomPos //connect(buttonParagram, &QPushButton::clicked, this, [=]() { // UpdateShowBondInfoData(m_vectBondMatrixs[vectorIndex].BondInfoId); // }); QFrame* line = new QFrame(outWidget); line->setFrameShape(QFrame::NoFrame); // 移除默认框架 line->setFixedHeight(2); // 设置固定高度 line->setStyleSheet("background-color: #C7CAEB;"); boxGridLayout->addLayout(matrixGridLayout, 2, 0); boxGridLayout->addWidget(line); //outMatrixGridLayout->addLayout(buttonLayout, 1, 0); outMatrixGridLayout->addWidget(groupBox); outWidget->setLayout(outMatrixGridLayout); ui.verticalLayout_3->addWidget(outWidget); ui.verticalLayout_3->setContentsMargins(0, 0, 0, 0); // Adjust margins if necessary ui.verticalLayout_3->setAlignment(Qt::AlignTop | Qt::AlignLeft); // Align the layout to the top-left m_mapOutWidgetIndex.insert(outWidget, matrixData.BondMatrixId); // Add Sub Matrices for (int j = 0; j < matrixData.VecPointMatrixId.size(); j++) { for (int i = 0; i < m_vecSubMatrixs.size(); i++) { if (matrixData.VecPointMatrixId[j] == m_vecSubMatrixs[i].MatrixId) { AddMatrixPage(j, i, m_vecSubMatrixs[i], outMatrixGridLayout); } } } // Add all controls and finalize layout /*outWidget->setLayout(outMatrixGridLayout); ui.scrollArea_2->setLayout(outMatrixGridLayout);*/ spinBoxRow->setValue(matrixData.BondMatrixRow); spinBoxCol->setValue(matrixData.BondMatrixCol); doubleSpinBoxLeftTopX->setValue(matrixData.LeftTopPoint.x); doubleSpinBoxLeftTopY->setValue(matrixData.LeftTopPoint.y); doubleSpinBoxRightTopX->setValue(matrixData.RightTopPoint.x); doubleSpinBoxRightTopY->setValue(matrixData.RightTopPoint.y); doubleSpinBoxRightButtomX->setValue(matrixData.RightBottomPoint.x); doubleSpinBoxRightButtomY->setValue(matrixData.RightBottomPoint.y); connect(spinBoxRow, &SpinBox::editDone, this, [=]() { m_vectBondMatrixs[vectorIndex].BondMatrixRow = spinBoxRow->value(); }); connect(spinBoxCol, &SpinBox::editDone, this, [=]() { m_vectBondMatrixs[vectorIndex].BondMatrixCol = spinBoxCol->value(); }); connect(doubleSpinBoxLeftTopX, &DoubleSpinBox::editDone, this, [=]() { m_vectBondMatrixs[vectorIndex].LeftTopPoint.x = doubleSpinBoxLeftTopX->value(); }); connect(doubleSpinBoxLeftTopY, &DoubleSpinBox::editDone, this, [=]() { m_vectBondMatrixs[vectorIndex].LeftTopPoint.y = doubleSpinBoxLeftTopY->value(); }); connect(doubleSpinBoxRightTopX, &DoubleSpinBox::editDone, this, [=]() { m_vectBondMatrixs[vectorIndex].RightTopPoint.x = doubleSpinBoxRightTopX->value(); }); connect(doubleSpinBoxRightTopY, &DoubleSpinBox::editDone, this, [=]() { m_vectBondMatrixs[vectorIndex].RightTopPoint.y = doubleSpinBoxRightTopY->value(); }); connect(doubleSpinBoxRightButtomX, &DoubleSpinBox::editDone, this, [=]() { m_vectBondMatrixs[vectorIndex].RightBottomPoint.x = doubleSpinBoxRightButtomX->value(); }); connect(doubleSpinBoxRightButtomY, &DoubleSpinBox::editDone, this, [=]() { m_vectBondMatrixs[vectorIndex].RightBottomPoint.y = doubleSpinBoxRightButtomY->value(); }); connect(lineEditNoBondPts, &QLineEdit::textChanged, this, [=]() { }); } void BondMatrixProgramPage::onComboBoxPopup(QComboBox* comboBox) { if (!comboBox) { return; } int currentIndex = comboBox->currentIndex(); // 获取当前选中的索引 QVariant currentData = comboBox->currentData(); // 获取当前选中的附加数据(例如 iInfoId) // 清空下拉框中的所有项 comboBox->clear(); // 重新填充下拉框选项,并更新 QMap 中的绑定关系 for (const auto& bondMatrix : m_vecBondInfoData) { // 显示编号 iInfoId QString itemText = QString::number(bondMatrix.iInfoId); // 将 iInfoId 添加到下拉框 comboBox->addItem(itemText, bondMatrix.iInfoId); } // 恢复原来的选中项 if (currentData.isValid()) { // 通过 currentData 恢复选中项 int index = comboBox->findData(currentData); if (index >= 0) { comboBox->setCurrentIndex(index); // 设置当前选中项 } } //UINT iInfoId = currentData.toUInt(); // 将 currentData 转换为 UINT //UpdateShowBondInfoData(iInfoId); } void BondMatrixProgramPage::ShowCurrentMatrix(int bondMatrixId) { // 遍历 comboBox 中的项,找到与 bondMatrixId 匹配的项的索引 int index = -1; for (int i = 0; i < ui.comboBoxCurrentMatrix->count(); ++i) { if (ui.comboBoxCurrentMatrix->itemData(i).toInt() == bondMatrixId) { index = i; // 找到对应的索引 break; } } // 如果找到了对应的索引,则设置为当前选中的项 if (index != -1) { ui.comboBoxCurrentMatrix->setCurrentIndex(index); } // 清空布局内容并隐藏之前的控件 QLayoutItem* item; while ((item = ui.verticalLayout_3->takeAt(0)) != nullptr) { QWidget* widget = item->widget(); if (widget) { widget->hide(); // 隐藏控件,而不是删除它 } delete item; // 删除布局项 } // 查找对应矩阵的控件 QWidget* outWidget = nullptr; // 遍历 m_mapOutWidgetIndex 查找对应的 QWidget for (auto it = m_mapOutWidgetIndex.begin(); it != m_mapOutWidgetIndex.end(); ++it) { if (it.value() == bondMatrixId) { // 找到对应的矩阵索引 outWidget = it.key(); // 获取对应的 QWidget break; } } // 找到并添加 outWidget if (outWidget && ui.verticalLayout_3->indexOf(outWidget) == -1) { ui.verticalLayout_3->addWidget(outWidget); outWidget->show(); // 显示控件 } // 最后加 back 一个 vSpacer ui.verticalLayout_3->addItem(new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding)); int selectedBondInfoId = -1; for (int i = 0; i < m_vectBondMatrixs.size(); ++i) { if (m_vectBondMatrixs[i].BondMatrixId == bondMatrixId) { selectedBondInfoId = m_vectBondMatrixs[i].BondInfoId; break; } } UpdateShowBondInfoData(selectedBondInfoId); } void BondMatrixProgramPage::onComboBoxCurrentMatrixChanged(int index) { // 判断 index 是否有效 if (index < 0 || index >= ui.comboBoxCurrentMatrix->count()) return; // 获取当前选项的 bondMatrixId int bondMatrixId = ui.comboBoxCurrentMatrix->itemData(index).toInt(); ShowCurrentMatrix(bondMatrixId); // 调用 ShowCurrentMatrix 更新显示 } //void BondMatrixProgramPage::ShowCurrentMatrix(int bondMatrixId) //{ // // 遍历 comboBox 中的项,找到与 bondMatrixId 匹配的项的索引 // int index = -1; // for (int i = 0; i < ui.comboBoxCurrentMatrix->count(); ++i) { // if (ui.comboBoxCurrentMatrix->itemData(i).toInt() == bondMatrixId) { // index = i; // 找到对应的索引 // break; // } // } // // // 如果找到了对应的索引,则设置为当前选中的项 // if (index != -1) { // ui.comboBoxCurrentMatrix->setCurrentIndex(index); // } // // // 清光布局内容 // QLayoutItem* item; // while ((item = ui.verticalLayout_3->takeAt(0)) != nullptr) { // QWidget* widget = item->widget(); // if (widget) { // widget->setParent(nullptr); // } // delete item; // } // // // 查找对应矩阵的控件 // QWidget* outWidget = nullptr; // // // 遍历 m_mapOutWidgetIndex 查找对应的 QWidget // for (auto it = m_mapOutWidgetIndex.begin(); it != m_mapOutWidgetIndex.end(); ++it) { // if (it.value() == bondMatrixId) { // 找到对应的矩阵索引 // outWidget = it.key(); // 获取对应的 QWidget // break; // } // } // // // 找到并添加 outWidget // if (outWidget && ui.verticalLayout_3->indexOf(outWidget) == -1) { // ui.verticalLayout_3->addWidget(outWidget); // } // // // 最后加 back 一个 vSpacer // ui.verticalLayout_3->addItem(new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding)); //} // //void BondMatrixProgramPage::onComboBoxCurrentMatrixChanged(int index) //{ // // 判断index有效 // if (index < 0 || index >= ui.comboBoxCurrentMatrix->count()) // return; // // // 获取当前选项的 bondMatrixId // int bondMatrixId = ui.comboBoxCurrentMatrix->itemData(index).toInt(); // ShowCurrentMatrix(bondMatrixId); //} void BondMatrixProgramPage::onComboBoxIndexChangedForMatrixParam(int index) { // 获取当前选中的 QComboBox QComboBox* comboBox = qobject_cast(sender()); if (!comboBox) { return; } // 获取当前选中的 BondInfoId UINT selectedBondInfoId = comboBox->currentData().toUInt(); // 获取当前 QComboBox 对应的 matrixId int matrixId = m_mapParagramSetComboBox.value(comboBox, -1); // 从 QMap 中获取 vectorIndex if (matrixId > 0) { // 更新 m_vectBondMatrixs[vectorIndex].BondInfoId for (int i = 0; i < m_vectBondMatrixs.size(); i++) { if (m_vectBondMatrixs[i].BondMatrixId == matrixId) { m_vectBondMatrixs[i].BondInfoId = selectedBondInfoId; break; } } } // 调用 UpdateShowBondInfoData 更新数据 UpdateShowBondInfoData(selectedBondInfoId); } void BondMatrixProgramPage::onComboBoxIndexChangedForParam(int index) { // 获取当前选中的 QComboBox QComboBox* comboBox = qobject_cast(sender()); if (!comboBox) { return; } // 获取当前选中的 BondInfoId UINT selectedBondInfoId = comboBox->currentData().toUInt(); // 调用 UpdateShowBondInfoData 更新数据 UpdateShowBondInfoData(selectedBondInfoId); } void BondMatrixProgramPage::AddMatrixPage(int vectorIndex, int subVectorIndex, PROGRAM_POINT_MATRIX_STRUCT subMatrix, QGridLayout* layout) { QVector vecControls; QWidget* subWidget = new QWidget(); QGridLayout* subGridLayout = new QGridLayout(subWidget); subGridLayout->setSpacing(4); subGridLayout->setObjectName(QString::fromUtf8("subGridLayout")); //groupBox->setLayout(subGridLayout); subGridLayout->setContentsMargins(0, 0, 0, 0); // 设置布局的边距为0 subGridLayout->setAlignment(Qt::AlignCenter); QLabel* labelTitle = new QLabel(subWidget); labelTitle->setObjectName(QString::fromUtf8("labelTitle")); labelTitle->setText(tr("Sub Matrix ") + QString::number(subVectorIndex)); labelTitle->setStyleSheet("color: #808BFF;height: 30px"); subGridLayout->addWidget(labelTitle, 0, 1, 1, 1); vecControls.push_back(labelTitle); QPushButton* pushButtonDelete = new QPushButton(subWidget); pushButtonDelete->setObjectName(QString::fromUtf8("button delete")); pushButtonDelete->setText(tr("Delete")); subGridLayout->addWidget(pushButtonDelete, 0, 3, 1, 2); connect(pushButtonDelete, &QPushButton::clicked, this, [=]() { //处理index auto currentIt = m_mapSubWidgetIndex.find(subWidget); int index = currentIt.value(); //迭代器 erase后currentIt被删除了 m_mapSubWidgetIndex.erase(currentIt); for (auto it = m_mapSubWidgetIndex.begin(); it != m_mapSubWidgetIndex.end(); ++it) { if (it.value() > index) { //value() 返回的是副本不是引用 int newIndex = it.value() - 1; m_mapSubWidgetIndex.insert(it.key(), newIndex); } } // 子矩阵ID int subMatrixId = m_vecSubMatrixs[index].MatrixId; //删除缓存 m_vecSubMatrixs.erase(m_vecSubMatrixs.begin() + index); //删除大矩阵子ID数据(遍历删除) for (PROGRAM_BOND_MATRIX_STRUCT& matrix : m_vectBondMatrixs) { auto it = std::find(matrix.VecPointMatrixId.begin(), matrix.VecPointMatrixId.end(), subMatrixId); if (it != matrix.VecPointMatrixId.end()) { matrix.VecPointMatrixId.erase(it); } } delete subWidget; }); QLabel* labelRow = new QLabel(subWidget); labelRow->setObjectName(QString::fromUtf8("labelRow")); labelRow->setText(tr("Row & Cow")); subGridLayout->addWidget(labelRow, 2, 0, 1, 1); vecControls.push_back(labelRow); SpinBox* spinBoxRow = new SpinBox(subWidget); spinBoxRow->setObjectName(QString::fromUtf8("spinBoxRow")); subGridLayout->addWidget(spinBoxRow, 2, 1, 1, 1); vecControls.push_back(spinBoxRow); /*QLabel* labelCol = new QLabel(subWidget); labelCol->setObjectName(QString::fromUtf8("labelCol")); labelCol->setText(tr("Cow ")); subGridLayout->addWidget(labelCol, 3, 0, 1, 1); vecControls.push_back(labelCol);*/ SpinBox* spinBoxCol = new SpinBox(subWidget); spinBoxCol->setObjectName(QString::fromUtf8("spinBoxCol")); subGridLayout->addWidget(spinBoxCol, 2, 2, 1, 1); vecControls.push_back(spinBoxCol); QLabel* labelLeftTop = new QLabel(subWidget); labelLeftTop->setObjectName(QString::fromUtf8("labelLeftTop")); labelLeftTop->setText(tr("Left Top Pos ")); subGridLayout->addWidget(labelLeftTop, 4, 0, 1, 1); vecControls.push_back(labelLeftTop); DoubleSpinBox* doubleSpinBoxLeftTopX = new DoubleSpinBox(subWidget); doubleSpinBoxLeftTopX->setObjectName(QString::fromUtf8("doubleSpinBoxLeftTopX")); doubleSpinBoxLeftTopX->setFixedWidth(95); // Set fixed width to 95 doubleSpinBoxLeftTopX->setFixedWidth(95); // Set fixed width to 95 subGridLayout->addWidget(doubleSpinBoxLeftTopX, 4, 1, 1, 1); vecControls.push_back(doubleSpinBoxLeftTopX); DoubleSpinBox* doubleSpinBoxLeftTopY = new DoubleSpinBox(subWidget); doubleSpinBoxLeftTopY->setObjectName(QString::fromUtf8("doubleSpinBoxLeftTopY")); doubleSpinBoxLeftTopY->setFixedWidth(95); // Set fixed width to 95 subGridLayout->addWidget(doubleSpinBoxLeftTopY, 4, 2, 1, 1); vecControls.push_back(doubleSpinBoxLeftTopY); QLabel* labelRightTopPos = new QLabel(subWidget); labelRightTopPos->setObjectName(QString::fromUtf8("labelRightTopPos")); labelRightTopPos->setText(tr("Right Top Pos ")); subGridLayout->addWidget(labelRightTopPos, 5, 0, 1, 1); vecControls.push_back(labelRightTopPos); DoubleSpinBox* doubleSpinBoxRightTopX = new DoubleSpinBox(subWidget); doubleSpinBoxRightTopX->setObjectName(QString::fromUtf8("doubleSpinBoxRightTopX")); doubleSpinBoxRightTopX->setFixedWidth(95); // Set fixed width to 95 subGridLayout->addWidget(doubleSpinBoxRightTopX, 5, 1, 1, 1); vecControls.push_back(doubleSpinBoxRightTopX); DoubleSpinBox* doubleSpinBoxRightTopY = new DoubleSpinBox(subWidget); doubleSpinBoxRightTopY->setObjectName(QString::fromUtf8("doubleSpinBoxRightTopY")); doubleSpinBoxRightTopY->setFixedWidth(95); // Set fixed width to 95 subGridLayout->addWidget(doubleSpinBoxRightTopY, 5, 2, 1, 1); vecControls.push_back(doubleSpinBoxRightTopY); QLabel* labelRightButtomPos = new QLabel(subWidget); labelRightButtomPos->setObjectName(QString::fromUtf8("labelRightButtomPos")); labelRightButtomPos->setText(tr("Right Buttom pos")); subGridLayout->addWidget(labelRightButtomPos, 6, 0, 1, 1); vecControls.push_back(labelRightButtomPos); DoubleSpinBox* doubleSpinBoxRightButtomX = new DoubleSpinBox(subWidget); doubleSpinBoxRightButtomX->setObjectName(QString::fromUtf8("doubleSpinBoxRightButtomX")); doubleSpinBoxRightButtomX->setFixedWidth(95); // Set fixed width to 95 subGridLayout->addWidget(doubleSpinBoxRightButtomX, 6, 1, 1, 1); vecControls.push_back(doubleSpinBoxRightButtomX); DoubleSpinBox* doubleSpinBoxRightButtomY = new DoubleSpinBox(subWidget); doubleSpinBoxRightButtomY->setObjectName(QString::fromUtf8("doubleSpinBoxRightButtomY")); doubleSpinBoxRightButtomY->setFixedWidth(95); // Set fixed width to 95 subGridLayout->addWidget(doubleSpinBoxRightButtomY, 6, 2, 1, 1); vecControls.push_back(doubleSpinBoxRightTopX); QLabel* labelNoBondPts = new QLabel(subWidget); labelNoBondPts->setObjectName(QString::fromUtf8("labelNoBondPts")); labelNoBondPts->setText(tr("No Bond Points")); subGridLayout->addWidget(labelNoBondPts, 7, 0, 1, 1); vecControls.push_back(labelNoBondPts); QLineEdit* lineEditNoBondPts = new QLineEdit(subWidget); lineEditNoBondPts->setObjectName(QString::fromUtf8("lineEditNoBondPts")); lineEditNoBondPts->setReadOnly(true); lineEditNoBondPts->setCursor(Qt::PointingHandCursor); lineEditNoBondPts->setProperty("vectorIndex", subVectorIndex); // 存储索引 lineEditNoBondPts->setProperty("parentMatrixIndex", vectorIndex); // 设置父矩阵的索引 lineEditNoBondPts->installEventFilter(this); subGridLayout->addWidget(lineEditNoBondPts, 7, 1, 1, 3); vecControls.push_back(lineEditNoBondPts); // Left Top Position X and Y QPushButton* buttonLeftTop = new QPushButton("GP", subWidget); buttonLeftTop->setFixedWidth(31); // 设置固定宽度 subGridLayout->addWidget(buttonLeftTop, 4, 3, 1, 1); // 添加按钮到4行3列 connect(buttonLeftTop, &QPushButton::clicked, this, [=]() { XY_DOUBLE_STRUCT position = BondGetAxisPosition("BondHead", m_vecSubMatrixs[subVectorIndex].LeftTopPoint); doubleSpinBoxLeftTopX->setValue(position.x); // 更新 X 轴 doubleSpinBoxLeftTopY->setValue(position.y); // 更新 Y 轴 }); QPushButton* buttonMoveToLeftTop = new QPushButton("MT", subWidget); buttonMoveToLeftTop->setFixedWidth(31); // 设置固定宽度 subGridLayout->addWidget(buttonMoveToLeftTop, 4, 4, 1, 1); // 添加按钮到4行3列 connect(buttonMoveToLeftTop, &QPushButton::clicked, this, [=]() { XY_DOUBLE_STRUCT position = BondMoveToXYAxisPosition("BondHead", m_vecSubMatrixs[subVectorIndex].LeftTopPoint); }); // Right Top Position X and Y QPushButton* buttonRightTop = new QPushButton("GP", subWidget); buttonRightTop->setFixedWidth(31); // 设置固定宽度 subGridLayout->addWidget(buttonRightTop, 5, 3, 1, 1); // 添加按钮到5行3列 connect(buttonRightTop, &QPushButton::clicked, this, [=]() { XY_DOUBLE_STRUCT position = BondGetAxisPosition("BondHead", m_vecSubMatrixs[subVectorIndex].RightTopPoint); doubleSpinBoxRightTopX->setValue(position.x); // 更新 X 轴 doubleSpinBoxRightTopY->setValue(position.y); // 更新 Y 轴 }); QPushButton* buttonMoveToRightTop = new QPushButton("MT", subWidget); buttonMoveToRightTop->setFixedWidth(31); // 设置固定宽度 subGridLayout->addWidget(buttonMoveToRightTop, 5, 4, 1, 1); // 添加按钮到4行3列 connect(buttonMoveToRightTop, &QPushButton::clicked, this, [=]() { XY_DOUBLE_STRUCT position = BondMoveToXYAxisPosition("BondHead", m_vecSubMatrixs[subVectorIndex].RightTopPoint); }); // Right Bottom Position X and Y QPushButton* buttonRightButtom = new QPushButton("GP", subWidget); buttonRightButtom->setFixedWidth(31); // 设置固定宽度 subGridLayout->addWidget(buttonRightButtom, 6, 3, 1, 1); // 添加按钮到6行3列 connect(buttonRightButtom, &QPushButton::clicked, this, [=]() { XY_DOUBLE_STRUCT position = BondGetAxisPosition("BondHead", m_vecSubMatrixs[subVectorIndex].RightBottomPoint); doubleSpinBoxRightButtomX->setValue(position.x); // 更新 X 轴 doubleSpinBoxRightButtomY->setValue(position.y); // 更新 Y 轴 }); QPushButton* buttonMoveToRightButtom = new QPushButton("MT", subWidget); buttonMoveToRightButtom->setFixedWidth(31); // 设置固定宽度 subGridLayout->addWidget(buttonMoveToRightButtom, 6, 4, 1, 1); // 添加按钮到4行3列 connect(buttonMoveToRightButtom, &QPushButton::clicked, this, [=]() { XY_DOUBLE_STRUCT position = BondMoveToXYAxisPosition("BondHead", m_vecSubMatrixs[subVectorIndex].RightBottomPoint); }); //layout->addLayout(subGridLayout, 11, 0); QFrame* line = new QFrame(subWidget); line->setFrameShape(QFrame::NoFrame); // 移除默认框架 line->setFixedHeight(2); // 设置固定高度 line->setStyleSheet("background-color: #C7CAEB;"); subGridLayout->addWidget(line, 10, 0, 1, 4); layout->addWidget(subWidget); m_mapSubWidgetIndex.insert(subWidget, subVectorIndex); spinBoxRow->setValue(subMatrix.MatrixRow); spinBoxCol->setValue(subMatrix.MatrixCol); doubleSpinBoxLeftTopX->setValue(subMatrix.LeftTopPoint.x); doubleSpinBoxLeftTopY->setValue(subMatrix.LeftTopPoint.y); doubleSpinBoxRightTopX->setValue(subMatrix.RightTopPoint.x); doubleSpinBoxRightTopY->setValue(subMatrix.RightTopPoint.y); doubleSpinBoxRightButtomX->setValue(subMatrix.RightBottomPoint.x); doubleSpinBoxRightButtomY->setValue(subMatrix.RightBottomPoint.y); connect(spinBoxRow, &SpinBox::editDone, this, [=]() { auto it = m_mapSubWidgetIndex.find(subWidget); m_vecSubMatrixs[it.value()].MatrixRow = spinBoxRow->value(); }); connect(spinBoxCol, &SpinBox::editDone, this, [=]() { auto it = m_mapSubWidgetIndex.find(subWidget); m_vecSubMatrixs[it.value()].MatrixCol = spinBoxCol->value(); }); connect(doubleSpinBoxLeftTopX, &DoubleSpinBox::editDone, this, [=]() { auto it = m_mapSubWidgetIndex.find(subWidget); m_vecSubMatrixs[it.value()].LeftTopPoint.x = doubleSpinBoxLeftTopX->value(); }); connect(doubleSpinBoxLeftTopY, &DoubleSpinBox::editDone, this, [=]() { auto it = m_mapSubWidgetIndex.find(subWidget); m_vecSubMatrixs[it.value()].LeftTopPoint.y = doubleSpinBoxLeftTopY->value(); }); connect(doubleSpinBoxRightTopX, &DoubleSpinBox::editDone, this, [=]() { auto it = m_mapSubWidgetIndex.find(subWidget); m_vecSubMatrixs[it.value()].RightTopPoint.x = doubleSpinBoxRightTopX->value(); }); connect(doubleSpinBoxRightTopY, &DoubleSpinBox::editDone, this, [=]() { auto it = m_mapSubWidgetIndex.find(subWidget); m_vecSubMatrixs[it.value()].RightTopPoint.y = doubleSpinBoxRightTopY->value(); }); connect(doubleSpinBoxRightButtomX, &DoubleSpinBox::editDone, this, [=]() { auto it = m_mapSubWidgetIndex.find(subWidget); m_vecSubMatrixs[it.value()].RightBottomPoint.x = doubleSpinBoxRightButtomX->value(); }); connect(doubleSpinBoxRightButtomY, &DoubleSpinBox::editDone, this, [=]() { auto it = m_mapSubWidgetIndex.find(subWidget); m_vecSubMatrixs[it.value()].RightBottomPoint.y = doubleSpinBoxRightButtomY->value(); }); connect(lineEditNoBondPts, &QLineEdit::textChanged, this, [=]() { auto it = m_mapSubWidgetIndex.find(subWidget); }); } bool BondMatrixProgramPage::eventFilter(QObject* obj, QEvent* event) { // 捕获鼠标点击事件(QEvent::MouseButtonPress) if (event->type() == QEvent::MouseButtonPress) { auto* comboBox = qobject_cast(obj); if (comboBox) { // 当 QComboBox 被点击时执行 onComboBoxPopup() onComboBoxPopup(comboBox); return false; // 拦截事件,防止进一步传播 } // 处理 QLineEdit 的点击事件 auto* lineEdit = qobject_cast(obj); if (lineEdit) { int index = lineEdit->property("vectorIndex").toInt(); // 当前矩阵索引 int parentIndex = lineEdit->property("parentMatrixIndex").toInt(); // 父矩阵索引 onNoBondPtsClicked(lineEdit, index, parentIndex); // 传递父矩阵索引 return true; // 拦截事件 } } return QWidget::eventFilter(obj, event); } void BondMatrixProgramPage::onNoBondPtsClicked(QLineEdit* lineEdit, int index, int parentIndex) { if (parentIndex != -1) { // 处理子矩阵的操作 if (index < 0 || index >= m_vecSubMatrixs.size()) return; const auto& subMatrix = m_vecSubMatrixs[index]; NoBondPtEditDialog dlg(subMatrix.MatrixRow, subMatrix.MatrixCol, subMatrix.VecNoBondPt, this); if (dlg.exec() == QDialog::Accepted) { QVector selected = dlg.getSelectedPoints(); m_vecSubMatrixs[index].VecNoBondPt = std::vector(selected.begin(), selected.end()); QStringList ptList; for (const auto& pt : selected) ptList << QString("(%1,%2)").arg(pt.x).arg(pt.y); lineEdit->setText(ptList.join(" ")); } // 这里可以用 parentIndex 来关联父矩阵(即大矩阵)做相应的操作 } else { // 处理大矩阵的操作 if (index < 0 || index >= m_vectBondMatrixs.size()) return; const auto& bondMatrix = m_vectBondMatrixs[index]; NoBondPtEditDialog dlg(bondMatrix.BondMatrixRow, bondMatrix.BondMatrixCol, bondMatrix.VecNoBondPt, this); if (dlg.exec() == QDialog::Accepted) { QVector selected = dlg.getSelectedPoints(); m_vectBondMatrixs[index].VecNoBondPt = std::vector(selected.begin(), selected.end()); QStringList ptList; for (const auto& pt : selected) ptList << QString("(%1,%2)").arg(pt.x).arg(pt.y); lineEdit->setText(ptList.join(" ")); } // 这里也可以用 parentIndex 来关联父矩阵(即大矩阵)做相应的操作 } } void BondMatrixProgramPage::AddMatrixParam() { } inline void safeSetComboBoxIndex(QComboBox* combo, int value) { combo->blockSignals(true); int idx = combo->findData(value); if (idx >= 0) { combo->setCurrentIndex(idx); } else { // 如果没找到值,保持不变或不设置任何值 combo->setCurrentIndex(-1); // 明确不设置为第一个 } combo->blockSignals(false); } void BondMatrixProgramPage::UpdatePageParam() { int dieSourceIndex = 0; if (m_curBondInfo.eDieSource == DIE_SOURCE::BY_WAFER) { dieSourceIndex = 1; } else if (m_curBondInfo.eDieSource == DIE_SOURCE::BY_WAFFLE) { dieSourceIndex = 0; } ui.comboBoxDieSource->setCurrentIndex(dieSourceIndex); ui.spinBoxPickNozzleID->setValue(m_curBondInfo.iPickHeadId); ui.spinBoxDieHeight->setValue(m_curBondInfo.dDieHeight); m_assss = true; // 初始化 并设置默认选项 ui.comboBoxPostBondTemp->clear(); ui.comboBoxPickTempID->clear(); ui.comboBoxPreBondTemp->clear(); ui.comboBoxBondTemp->clear(); ui.comboBoxLookUpTemp->clear(); ui.comboBoxCalibPickTemp->clear(); for (const auto& templateData : m_vecPrTemplate) { ui.comboBoxPickTempID->addItem(QString::number(templateData.iTemplateId), templateData.iTemplateId); ui.comboBoxPreBondTemp->addItem(QString::number(templateData.iTemplateId), templateData.iTemplateId); ui.comboBoxBondTemp->addItem(QString::number(templateData.iTemplateId), templateData.iTemplateId); ui.comboBoxLookUpTemp->addItem(QString::number(templateData.iTemplateId), templateData.iTemplateId); ui.comboBoxCalibPickTemp->addItem(QString::number(templateData.iTemplateId), templateData.iTemplateId); } for (const auto& strategy : m_vecPrStrategy) { ui.comboBoxPickTempID->addItem(QString::number(strategy.iStrategyId), strategy.iStrategyId); ui.comboBoxPreBondTemp->addItem(QString::number(strategy.iStrategyId), strategy.iStrategyId); ui.comboBoxBondTemp->addItem(QString::number(strategy.iStrategyId), strategy.iStrategyId); ui.comboBoxLookUpTemp->addItem(QString::number(strategy.iStrategyId), strategy.iStrategyId); ui.comboBoxCalibPickTemp->addItem(QString::number(strategy.iStrategyId), strategy.iStrategyId); } for (const auto& bondInspData : m_vecPrBondInsp) { ui.comboBoxPostBondTemp->addItem(QString::number(bondInspData.iID), bondInspData.iID); // 设置数据 } m_assss = false; // --- PostBondTemp --- //ui.comboBoxPostBondTemp->addItem(QString::number(m_curBondInfo.iBondBackPRStrategyId), m_curBondInfo.iBondBackPRStrategyId); // 设置数据 //int index3 = ui.comboBoxPostBondTemp->findData(m_curBondInfo.iBondBackPRStrategyId); //ui.comboBoxPostBondTemp->setCurrentIndex(ui.comboBoxPostBondTemp->findData(m_curBondInfo.iBondBackPRStrategyId)); // 设置默认项 safeSetComboBoxIndex(ui.comboBoxPostBondTemp, m_curBondInfo.iBondBackPRStrategyId); // --- PickTempID --- safeSetComboBoxIndex(ui.comboBoxPickTempID, m_curBondInfo.iPickPRStrategyId); // --- PreBondTemp --- safeSetComboBoxIndex(ui.comboBoxPreBondTemp, m_curBondInfo.iBondFrontPRStrategyId); // --- BondTemp --- safeSetComboBoxIndex(ui.comboBoxBondTemp, m_curBondInfo.iBondAlnPRStrategyId); // --- LookUpTemp --- safeSetComboBoxIndex(ui.comboBoxLookUpTemp, m_curBondInfo.iLookUpPRStrategyId); // --- CalibPickTemp --- safeSetComboBoxIndex(ui.comboBoxCalibPickTemp, m_curBondInfo.iCalibPRStrategyId); ui.doubleSpinBoxBondOffsetX->setValue(m_curBondInfo.stOffset.x); ui.doubleSpinBoxBondOffsetY->setValue(m_curBondInfo.stOffset.y); ui.doubleSpinBoxBondOffsetAngle->setValue(m_curBondInfo.stOffset.a); UpdatePagePickPlaceParam(); } void BondMatrixProgramPage::UpdatePagePickPlaceParam() { m_assss = true; ui.comboBoxCurrentPara_Pick1->clear(); ui.comboBoxCurrentPara_Pick2->clear(); ui.comboBoxCurrentPara_Place1->clear(); ui.comboBoxCurrentPara_Pick2->clear(); //取/固晶参数 for (const auto& param : m_vecParam) { ui.comboBoxCurrentPara_Pick1->addItem(QString::number(param.iId), param.iId); ui.comboBoxCurrentPara_Pick2->addItem(QString::number(param.iId), param.iId); ui.comboBoxCurrentPara_Place1->addItem(QString::number(param.iId), param.iId); ui.comboBoxCurrentPara_Place2->addItem(QString::number(param.iId), param.iId); } m_assss = false; // --- 取晶头取晶 --- safeSetComboBoxIndex(ui.comboBoxCurrentPara_Pick1, m_curBondInfo.iPickParamId); // --- 中转台取晶 --- safeSetComboBoxIndex(ui.comboBoxCurrentPara_Pick2, m_curBondInfo.iCalibPickParamId); // --- 中转台固晶 --- safeSetComboBoxIndex(ui.comboBoxCurrentPara_Place1, m_curBondInfo.iCalibBondParamId); // --- 固晶台固晶 --- safeSetComboBoxIndex(ui.comboBoxCurrentPara_Place2, m_curBondInfo.iBondParamId); UpdatePagePickParam(); UpdatePageBondParam(); } //取/固晶参数另存为 int BondMatrixProgramPage::ParamSaveAsEvent(ns_db::PICKBOND_PARAM_STRUCT &m_curToSaveAsParam) { int iToSaveAsParamId; m_manageDB->GetCProduct()->AddBondParam(m_curToSaveAsParam, iToSaveAsParamId); // 判断传入的是哪一个参数,并相应修改m_curBondInfo中的ID if (&m_curToSaveAsParam == &m_curWaferPickParam) { m_curBondInfo.iPickParamId = iToSaveAsParamId; } else if (&m_curToSaveAsParam == &m_curCalibPlaceParam) { m_curBondInfo.iCalibBondParamId = iToSaveAsParamId; } else if (&m_curToSaveAsParam == &m_curCalibPickParam) { m_curBondInfo.iCalibPickParamId = iToSaveAsParamId; } else if (&m_curToSaveAsParam == &m_curBondParam) { m_curBondInfo.iBondParamId = iToSaveAsParamId; } m_manageDB->GetCProduct()->GetBondParam(iToSaveAsParamId, m_curToSaveAsParam); m_vecParam.push_back(m_curToSaveAsParam);// = m_manageDB->GetCProduct()->GetAllBondInfoData(); // 填充 QComboBox UpdatePagePickPlaceParam(); return iToSaveAsParamId; } //BondInfo另存为 int BondMatrixProgramPage::BondInfoParamSaveAsEvent() { //int iWaferPickParamId,iCalibPlaceParamId,iCalibPickParamId,iBondParamId; //m_manageDB->GetCProduct()->AddBondParam(m_curWaferPickParam, iWaferPickParamId); //SetBondParam(m_curWaferPickParam.iId, m_curWaferPickParam); //m_manageDB->GetCProduct()->AddBondParam(m_curCalibPlaceParam, iCalibPlaceParamId); //m_manageDB->GetCProduct()->AddBondParam(m_curCalibPickParam, iCalibPickParamId); //m_manageDB->GetCProduct()->AddBondParam(m_curBondParam, iBondParamId); int iInfoId; m_manageDB->GetCProduct()->AddBondInfoData(m_curBondInfo, iInfoId); ns_db::BOND_INFO_STRUCT newBondInfo; m_manageDB->GetCProduct()->GetBondInfoData(iInfoId, newBondInfo); m_vecBondInfoData.push_back(newBondInfo);// = m_manageDB->GetCProduct()->GetAllBondInfoData(); // 填充 QComboBox ui.comboBoxCurrentPara->clear(); for (const auto& bondMatrix : m_vecBondInfoData) { QString itemText = QString::number(bondMatrix.iInfoId); ui.comboBoxCurrentPara->addItem(itemText, bondMatrix.iInfoId); } ui.comboBoxCurrentPara->setCurrentIndex(ui.comboBoxCurrentPara->findData(iInfoId)); // 设置默认项 return iInfoId; } void BondMatrixProgramPage::ParamChangeEvent() { m_manageDB->GetCProduct()->SetBondInfoData(m_curBondInfo.iInfoId, m_curBondInfo); m_manageDB->GetCProduct()->SetBondParam(m_curWaferPickParam.iId, m_curWaferPickParam); m_manageDB->GetCProduct()->SetBondParam(m_curCalibPlaceParam.iId, m_curCalibPlaceParam); m_manageDB->GetCProduct()->SetBondParam(m_curCalibPickParam.iId, m_curCalibPickParam); m_manageDB->GetCProduct()->SetBondParam(m_curBondParam.iId, m_curBondParam); CProduct* _Product = m_manageDB->GetCProduct(); } void BondMatrixProgramPage::MatrixChangeEvent() { //TODO:此处可能有问题,可改成后端更新,没有相应ID则添加的形式 m_manageDB->GetCProduct()->SetAllBondMatrix(m_vectBondMatrixs, true); m_manageDB->GetCProduct()->SetAllPointMatrix(m_vecSubMatrixs, true); /*for (PROGRAM_BOND_MATRIX_STRUCT& bondMatrix : m_vectBondMatrixs) { m_manageDB->GetCProduct()->SetBondMatrix(bondMatrix.BondMatrixId, bondMatrix); }*/ /*for (PROGRAM_POINT_MATRIX_STRUCT& pointMatrix : m_vecSubMatrixs) { m_manageDB->GetCProduct()->SetPointMatrix(pointMatrix.MatrixId, pointMatrix); }*/ CProduct* _Product = m_manageDB->GetCProduct(); } void BondMatrixProgramPage::UpdatePagePickParam() { //"取晶头取晶" //if (ui.comboBoxPickParamType->currentIndex() == 0) { ui.checkBoxPickBlockCheck->setChecked(m_curWaferPickParam.bCheckBlock); ui.checkBoxPickLoseCheck->setChecked(m_curWaferPickParam.bCheckLose); ui.checkBoxPickFindForceCheck->setChecked(m_curWaferPickParam.bFindForce); ui.doubleSpinBoxPrePickZ->setValue(m_curWaferPickParam.dPreLevOffset); ui.doubleSpinBoxPickForce->setValue(m_curWaferPickParam.dForce); ui.doubleSpinBoxPickPosZ->setValue(m_curWaferPickParam.dWorkLevOffset); ui.spinBoxPickGrabDelay->setValue(m_curWaferPickParam.iGrabDelay); ui.spinBox_PickDelay->setValue(m_curWaferPickParam.iPickOrBondDelay); ui.spinBoxPickBlockCheckDelay->setValue(m_curWaferPickParam.iBlockOrLoseDelay); ui.spinBoxPickVacDelay->setValue(m_curWaferPickParam.iVacuumDelay); ui.spinBoxPickBlowDelay->setValue(m_curWaferPickParam.iBlowDelay); ui.doubleSpinBoxPrePickZ->setEnabled(!ui.checkBoxPickFindForceCheck->isChecked()); ui.doubleSpinBoxPickPosZ->setEnabled(!ui.checkBoxPickFindForceCheck->isChecked()); } //"中转台取晶" //else if (ui.comboBoxPickParamType->currentIndex() == 1) { ui.checkBoxPickBlockCheck_2->setChecked(m_curCalibPickParam.bCheckBlock); ui.checkBoxPickLoseCheck_2->setChecked(m_curCalibPickParam.bCheckLose); ui.checkBoxPickFindForceCheck_2->setChecked(m_curCalibPickParam.bFindForce); ui.doubleSpinBoxPrePickZ_2->setValue(m_curCalibPickParam.dPreLevOffset); ui.doubleSpinBoxPickForce_2->setValue(m_curCalibPickParam.dForce); ui.doubleSpinBoxPickPosZ_2->setValue(m_curCalibPickParam.dWorkLevOffset); ui.spinBoxPickGrabDelay_2->setValue(m_curCalibPickParam.iGrabDelay); ui.spinBox_PickDelay_2->setValue(m_curCalibPickParam.iPickOrBondDelay); ui.spinBoxPickBlockCheckDelay_2->setValue(m_curCalibPickParam.iBlockOrLoseDelay); ui.spinBoxPickVacDelay_2->setValue(m_curCalibPickParam.iVacuumDelay); ui.spinBoxPickBlowDelay_2->setValue(m_curCalibPickParam.iBlowDelay); ui.doubleSpinBoxPrePickZ_2->setEnabled(!ui.checkBoxPickFindForceCheck_2->isChecked()); ui.doubleSpinBoxPickPosZ_2->setEnabled(!ui.checkBoxPickFindForceCheck_2->isChecked()); } } void BondMatrixProgramPage::UpdatePageBondParam() { //"中转台放晶" //if (ui.comboBoxBondParamType->currentIndex() == 0) { ui.checkBoxBondBlockCheck->setChecked(m_curCalibPlaceParam.bCheckBlock); ui.checkBoxBondLoseCheck->setChecked(m_curCalibPlaceParam.bCheckLose); ui.checkBoxBondFindForce->setChecked(m_curCalibPlaceParam.bFindForce); ui.doubleSpinBoxPreBondPosZ->setValue(m_curCalibPlaceParam.dPreLevOffset); ui.doubleSpinBoxBondForce->setValue(m_curCalibPlaceParam.dForce); ui.doubleSpinBoxBondPosZ->setValue(m_curCalibPlaceParam.dWorkLevOffset); ui.spinBoxBondGrabDelay->setValue(m_curCalibPlaceParam.iGrabDelay); ui.spinBoxBondDelay->setValue(m_curCalibPlaceParam.iPickOrBondDelay); ui.spinBoxBondBlockCheckDelay->setValue(m_curCalibPlaceParam.iBlockOrLoseDelay); ui.spinBoxBondVacDelay->setValue(m_curCalibPlaceParam.iVacuumDelay); ui.spinBoxBondBlowDelay->setValue(m_curCalibPlaceParam.iBlowDelay); ui.doubleSpinBoxPreBondPosZ->setEnabled(!ui.checkBoxBondFindForce->isChecked()); ui.doubleSpinBoxBondPosZ->setEnabled(!ui.checkBoxBondFindForce->isChecked()); } //"固晶台固晶" //else if (ui.comboBoxBondParamType->currentIndex() == 1) { ui.checkBoxBondBlockCheck_2->setChecked(m_curBondParam.bCheckBlock); ui.checkBoxBondLoseCheck_2->setChecked(m_curBondParam.bCheckLose); ui.checkBoxBondFindForce_2->setChecked(m_curBondParam.bFindForce); ui.doubleSpinBoxPreBondPosZ_2->setValue(m_curBondParam.dPreLevOffset); ui.doubleSpinBoxBondForce_2->setValue(m_curBondParam.dForce); ui.doubleSpinBoxBondPosZ_2->setValue(m_curBondParam.dWorkLevOffset); ui.spinBoxBondGrabDelay_2->setValue(m_curBondParam.iGrabDelay); ui.spinBoxBondDelay_2->setValue(m_curBondParam.iPickOrBondDelay); ui.spinBoxBondBlockCheckDelay_2->setValue(m_curBondParam.iBlockOrLoseDelay); ui.spinBoxBondVacDelay_2->setValue(m_curBondParam.iVacuumDelay); ui.spinBoxBondBlowDelay_2->setValue(m_curBondParam.iBlowDelay); ui.doubleSpinBoxPreBondPosZ_2->setEnabled(!ui.checkBoxBondFindForce_2->isChecked()); ui.doubleSpinBoxBondPosZ_2->setEnabled(!ui.checkBoxBondFindForce_2->isChecked()); } } void BondMatrixProgramPage::initPage() { //for (int i = 0; i < m_vectBondMatrixs.size(); i++) //{ // for (int j = 0; j < m_vectBondMatrixs[i].VecPointMatrixId.size(); j++) // { // PROGRAM_POINT_MATRIX_STRUCT subMatrix; // m_manageDB->GetCProduct()->GetPointMatrix(m_vectBondMatrixs[i].VecPointMatrixId[j], subMatrix); // m_vecSubMatrixs.push_back(subMatrix); // //AddMatrixPage(i, j, subMatrix); // } // AddOutMatrixPage(i, m_vectBondMatrixs[i], m_vecSubMatrixs); //} for (int i = 0; i < m_vectBondMatrixs.size(); i++) { AddOutMatrixPage(i, m_vectBondMatrixs[i], m_vecSubMatrixs); } //for (int i = 0; i < m_vectBondMatrixs[0].VecPointMatrixId.size(); ++i) //{ // PROGRAM_POINT_MATRIX_STRUCT subMatrix; // m_manageDB->GetCProduct()->GetPointMatrix(m_vectBondMatrixs[0].VecPointMatrixId[i], subMatrix); // m_vecSubMatrixs.push_back(subMatrix); //} //m_manageDB->GetCProduct()->GetDieMatrix(m_vectBondMatrixs[0].VecPointMatrixId[0], m_vecSubMatrixs); ////显示矩阵数据 //ui.spinBoxRow->setValue(m_vectBondMatrixs[0].BondMatrixRow); //ui.spinBoxCol->setValue(m_vectBondMatrixs[0].BondMatrixCol); //ui.doubleSpinBoxLeftTopX->setValue(m_vectBondMatrixs[0].LeftTopPoint.x); //ui.doubleSpinBoxLeftTopY->setValue(m_vectBondMatrixs[0].LeftTopPoint.y); //ui.doubleSpinBoxRightTopX->setValue(m_vectBondMatrixs[0].RightTopPoint.x); //ui.doubleSpinBoxRightTopY->setValue(m_vectBondMatrixs[0].RightTopPoint.y); //ui.doubleSpinBoxRightButtomX->setValue(m_vectBondMatrixs[0].RightBottomPoint.x); //ui.doubleSpinBoxRightButtomY->setValue(m_vectBondMatrixs[0].RightBottomPoint.y); //QString noBondPts = ""; //bool firstTime = false; //for (XY_LONG_STRUCT& pt : m_vectBondMatrixs[0].VecNoBondPt) //{ // if (firstTime) // { // noBondPts += "(" + QString::number(pt.x) + "," + QString::number(pt.y) + ")"; // firstTime = true; // } // noBondPts += ";(" + QString::number(pt.x) + "," + QString::number(pt.y) + ")"; //} //ui.lineEditNoBondPts->setText(noBondPts); ////显示子矩阵及数据 //for (PROGRAM_POINT_MATRIX_STRUCT& subMatrix : m_vecSubMatrixs) //{ // AddMatrixPage(subMatrix); //} //从后端获取参数, 一套数据 CResources* pResources = CResources::GetInstance(); if (pResources == nullptr) { return; } CBondMatrix* pBondMatrix = pResources->GetBondMatrix(); if (pBondMatrix == nullptr) { return; } //AddOutMatrixPage(0, m_vectBondMatrixs[0], m_vecSubMatrixs); ui.comboBoxCurrentMatrix->clear(); for (int i = 0; i < m_vectBondMatrixs.size(); i++) { // 显示 矩阵编号 int _bondMatrixId = m_vectBondMatrixs[i].BondMatrixId; QString itemText = QString::number(_bondMatrixId); // 将 矩阵编号 添加到下拉框 ui.comboBoxCurrentMatrix->addItem(itemText,_bondMatrixId); } if (!m_vectBondMatrixs.empty()) { ShowCurrentMatrix(m_vectBondMatrixs[0].BondMatrixId); } // 清空下拉框中的所有项 ui.comboBoxCurrentPara->clear(); // 重新填充下拉框选项,并更新 QMap 中的绑定关系 for (const auto& bondMatrix : m_vecBondInfoData) { // 显示编号 iInfoId QString itemText = QString::number(bondMatrix.iInfoId); // 将 iInfoId 添加到下拉框 ui.comboBoxCurrentPara->addItem(itemText, bondMatrix.iInfoId); } UpdateShowBondInfoData(m_vectBondMatrixs[0].BondInfoId); ////pBondMatrix->GetPintInfoByIndex(0, m_curPointInfo); //m_manageDB->GetCProduct()->GetBondInfoData(m_vectBondMatrixs[0].BondInfoId, m_curBondInfo); //m_manageDB->GetCProduct()->GetBondParam(m_curBondInfo.iPickParamId, m_curWaferPickParam); //m_manageDB->GetCProduct()->GetBondParam(m_curBondInfo.iCalibBondParamId, m_curCalibPlaceParam); //m_manageDB->GetCProduct()->GetBondParam(m_curBondInfo.iCalibPickParamId, m_curCalibPickParam); //m_manageDB->GetCProduct()->GetBondParam(m_curBondInfo.iBondParamId, m_curBondParam); //显示界面参数 //UpdatePageParam(); } void BondMatrixProgramPage::UpdateShowBondInfoData(UINT iInfoId) { if (iInfoId <= 0)return; //pBondMatrix->GetPintInfoByIndex(0, m_curPointInfo); m_manageDB->GetCProduct()->GetBondInfoData(iInfoId, m_curBondInfo); m_manageDB->GetCProduct()->GetBondParam(m_curBondInfo.iPickParamId, m_curWaferPickParam); m_manageDB->GetCProduct()->GetBondParam(m_curBondInfo.iCalibBondParamId, m_curCalibPlaceParam); m_manageDB->GetCProduct()->GetBondParam(m_curBondInfo.iCalibPickParamId, m_curCalibPickParam); m_manageDB->GetCProduct()->GetBondParam(m_curBondInfo.iBondParamId, m_curBondParam); m_vecParam = m_manageDB->GetCProduct()->GetAllBondParamData(); m_vecPrTemplate = m_manageDB->GetCProduct()->GetPrTemplate(); m_vecPrStrategy = m_manageDB->GetCProduct()->GetPrStrategy(); m_vecPrBondInsp = m_manageDB->GetCProduct()->GetPrBondInsp(); ui.comboBoxCurrentPara->setCurrentIndex(ui.comboBoxCurrentPara->findData(iInfoId)); // 设置默认项 //显示界面参数 UpdatePageParam(); }