|
@@ -5,372 +5,637 @@ std::unordered_map<int, bool> WaferProgramPage::m_IdIsUsedMap;
|
|
|
WaferProgramPage::WaferProgramPage(QWidget* parent)
|
|
|
: QWidget(parent)
|
|
|
{
|
|
|
- QVBoxLayout* mainLayout = new QVBoxLayout(this);
|
|
|
-
|
|
|
- m_pCProduct = CManageDB::GetInstance()->GetCProduct();
|
|
|
- // 从数据库中加载数据
|
|
|
- m_pCProduct->LoadDataByDB();
|
|
|
-
|
|
|
- // 创建表格
|
|
|
- m_MergedTable = new QTableWidget(this);
|
|
|
- m_MergedTable->setColumnCount(11); // 11 列,包含 Matrix 和 DieMatrix 的所有字段
|
|
|
- m_MergedTable->setHorizontalHeaderLabels({
|
|
|
- "MatrixID", "MatrixRow", "MatrixCol", "LeftTopPoint_Y", "LeftTopPoint_X",
|
|
|
- "RightTopPoint_X", "RightTopPoint_Y", "RightBottomPoint_X", "RightBottomPoint_Y",
|
|
|
- "DieMatrixId", "NoBondPt"
|
|
|
- });
|
|
|
+ ui.setupUi(this);
|
|
|
|
|
|
- m_MergedTable->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
|
|
-
|
|
|
- // 创建按钮布局
|
|
|
- QHBoxLayout* buttonLayout = new QHBoxLayout();
|
|
|
- QPushButton* addRowButton = new QPushButton("Add", this);
|
|
|
- QPushButton* deleteRowButton = new QPushButton("Delete", this);
|
|
|
- QPushButton* updateButton = new QPushButton("Update", this);
|
|
|
-
|
|
|
- buttonLayout->addWidget(addRowButton);
|
|
|
- buttonLayout->addWidget(deleteRowButton);
|
|
|
- buttonLayout->addWidget(updateButton);
|
|
|
- QString buttonStyle = R"(
|
|
|
- QPushButton {
|
|
|
- background-color: #f0f0f0;
|
|
|
- border: 1px solid #b0b0b0;
|
|
|
- border-radius: 4px;
|
|
|
- padding: 4px 12px;
|
|
|
- }
|
|
|
- QPushButton:hover {
|
|
|
- background-color: #e0e0ff;
|
|
|
- }
|
|
|
- QPushButton:pressed {
|
|
|
- background-color: #d0d0ff;
|
|
|
- }
|
|
|
- )";
|
|
|
-
|
|
|
- addRowButton->setStyleSheet(buttonStyle);
|
|
|
- deleteRowButton->setStyleSheet(buttonStyle);
|
|
|
- updateButton->setStyleSheet(buttonStyle);
|
|
|
- // 将控件添加到布局
|
|
|
- mainLayout->addWidget(m_MergedTable);
|
|
|
- mainLayout->addLayout(buttonLayout);
|
|
|
- setLayout(mainLayout);
|
|
|
-
|
|
|
- // 连接按钮和槽
|
|
|
- connect(addRowButton, &QPushButton::clicked, this, &WaferProgramPage::addRow);
|
|
|
- connect(deleteRowButton, &QPushButton::clicked, this, &WaferProgramPage::deleteRow);
|
|
|
- connect(updateButton, &QPushButton::clicked, this, &WaferProgramPage::updateData);
|
|
|
- connect(m_MergedTable, &QTableWidget::cellChanged, this, &WaferProgramPage::onCellChanged);
|
|
|
- connect(m_MergedTable, &QTableWidget::cellDoubleClicked, this, [=](int row, int column) {
|
|
|
- if (column == 9) {
|
|
|
- QComboBox* comboBox = createDieMatrixIdComboBox(m_vecWaferMatrix[row].iDieMatrixId, row);
|
|
|
- m_MergedTable->setCellWidget(row, column, comboBox);
|
|
|
- comboBox->showPopup(); // 可选:自动展开下拉
|
|
|
-
|
|
|
- // 记录初始值(以防没有变化)
|
|
|
- int originalValue = comboBox->currentData().toInt();
|
|
|
-
|
|
|
- // 1. 用户选择后立即还原
|
|
|
- connect(comboBox, QOverload<int>::of(&QComboBox::activated), this, [=](int index) {
|
|
|
- int selectedId = comboBox->itemData(index).toInt();
|
|
|
- m_vecWaferMatrix[row].iDieMatrixId = selectedId;
|
|
|
-
|
|
|
- m_MergedTable->removeCellWidget(row, column);
|
|
|
- m_MergedTable->setItem(row, column, new QTableWidgetItem(QString::number(selectedId)));
|
|
|
- });
|
|
|
-
|
|
|
- // 2. 用户没有选中,仅点击其他地方,触发还原
|
|
|
- connect(comboBox, &QComboBox::hidePopup, this, [=]() {
|
|
|
- // 如果还在表格里,就还原(防止重复)
|
|
|
- if (m_MergedTable->cellWidget(row, column) == comboBox) {
|
|
|
- int selectedId = comboBox->currentData().toInt();
|
|
|
- m_vecWaferMatrix[row].iDieMatrixId = selectedId;
|
|
|
-
|
|
|
- m_MergedTable->removeCellWidget(row, column);
|
|
|
- m_MergedTable->setItem(row, column, new QTableWidgetItem(QString::number(selectedId)));
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+ ui.pushButtonSave->setProperty("type", "save");
|
|
|
+ ui.pushButtonAdd->setProperty("type", "add");
|
|
|
+
|
|
|
+ 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();
|
|
|
+
|
|
|
+
|
|
|
+ connect(ui.pushButtonSave, &QPushButton::clicked, this, [=]() {
|
|
|
+ m_pProduct->SetAllWaferMatrix(m_vecWaferMatrix);
|
|
|
+ CProduct* _Product = m_manageDB->GetCProduct();
|
|
|
});
|
|
|
- connect(m_MergedTable, &QTableWidget::cellDoubleClicked, this, [=](int row, int column) {
|
|
|
- if (column == 10) { // NoBondPt 列
|
|
|
- const auto& wafer = m_vecWaferMatrix[row];
|
|
|
-
|
|
|
- NoBondPtEditDialog dlg(wafer.MatrixRow, wafer.MatrixCol, wafer.VecNoBondPt, this);
|
|
|
- if (dlg.exec() == QDialog::Accepted) {
|
|
|
- // 获取用户选择结果
|
|
|
- QVector<XY_LONG_STRUCT> selected = dlg.getSelectedPoints();
|
|
|
-
|
|
|
- // 更新数据结构
|
|
|
- m_vecWaferMatrix[row].VecNoBondPt.clear();
|
|
|
- for (const auto& pt : selected) {
|
|
|
- m_vecWaferMatrix[row].VecNoBondPt.push_back(pt);
|
|
|
- }
|
|
|
|
|
|
- // 转换为字符串填入表格
|
|
|
- QStringList ptList;
|
|
|
- for (const auto& pt : selected) {
|
|
|
- ptList << QString("(%1,%2)").arg(pt.x).arg(pt.y);
|
|
|
- }
|
|
|
- m_MergedTable->setItem(row, column, new QTableWidgetItem(ptList.join(" ")));
|
|
|
+ connect(ui.pushButtonAdd, &QPushButton::clicked, this, [=]() {
|
|
|
+ PROGRAM_WAFER_MATRIX_STRUCT newMatrix;
|
|
|
+ //排序
|
|
|
+ std::sort(m_vecWaferMatrix.begin(), m_vecWaferMatrix.end(),
|
|
|
+ [](const PROGRAM_WAFER_MATRIX_STRUCT& a, const PROGRAM_WAFER_MATRIX_STRUCT& b) {
|
|
|
+ return a.MatrixId < b.MatrixId;
|
|
|
+ });
|
|
|
+ //找Id
|
|
|
+ int newId = 1;
|
|
|
+ for (const auto& matrix : m_vecWaferMatrix)
|
|
|
+ {
|
|
|
+ if (matrix.MatrixId == newId)
|
|
|
+ {
|
|
|
+ newId++;
|
|
|
+ }
|
|
|
+ else if (matrix.MatrixId > newId)
|
|
|
+ {
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
- });
|
|
|
|
|
|
+ newMatrix.MatrixId = newId;
|
|
|
+ newMatrix.MatrixRow = 0;
|
|
|
+ newMatrix.MatrixCol = 0;
|
|
|
|
|
|
- // 初始化表格数据
|
|
|
- initMergedData();
|
|
|
-}
|
|
|
+ int newVectorIndex = m_vecWaferMatrix.size();
|
|
|
+ m_vecWaferMatrix.push_back(newMatrix);
|
|
|
+ AddMatrixPage(newVectorIndex, newMatrix);
|
|
|
|
|
|
-//QWidget* WaferProgramPage::CreateWaferProgramPage(const CONFIG_BASE_STRUCT& control) {
|
|
|
-// return new WaferProgramPage();
|
|
|
-//}
|
|
|
+ });
|
|
|
+ initPage();
|
|
|
+}
|
|
|
|
|
|
-//创建下拉列表
|
|
|
-QComboBox* WaferProgramPage::createDieMatrixIdComboBox(int defaultId, int row) {
|
|
|
- QComboBox* comboBox = new QComboBox(m_MergedTable);
|
|
|
-
|
|
|
- // 设置样式,确保在暗色模式下也是白底黑字
|
|
|
- comboBox->setStyleSheet(R"(
|
|
|
- QComboBox {
|
|
|
- background-color: white;
|
|
|
- color: black;
|
|
|
- border: 1px solid #BABBDC;
|
|
|
- border-radius: 4px;
|
|
|
- padding: 2px 5px;
|
|
|
- }
|
|
|
- QComboBox QAbstractItemView {
|
|
|
- background-color: white;
|
|
|
- color: black;
|
|
|
- selection-background-color: #E5E5FF;
|
|
|
- selection-color: black;
|
|
|
- }
|
|
|
- )");
|
|
|
- for (const auto& dieMatrix : m_vecDieMatrixt) {
|
|
|
- /*comboBox->addItem(
|
|
|
- QString("%1 - %2").arg(dieMatrix.MatrixId).arg(QString::fromStdString(dieMatrix.strModuleName)),
|
|
|
- QVariant(dieMatrix.MatrixId)
|
|
|
- );*/
|
|
|
- comboBox->addItem(QString::number(dieMatrix.MatrixId), QVariant(dieMatrix.MatrixId));
|
|
|
+void WaferProgramPage::initPage()
|
|
|
+{
|
|
|
+ m_vecWaferMatrix = m_pProduct->GetWaferMatrix();
|
|
|
+ for (int i = 0; i < m_vecWaferMatrix.size(); i++)
|
|
|
+ {
|
|
|
+ AddMatrixPage(i, m_vecWaferMatrix[i]);
|
|
|
}
|
|
|
|
|
|
- int index = comboBox->findData(defaultId);
|
|
|
- if (index >= 0)
|
|
|
- comboBox->setCurrentIndex(index);
|
|
|
|
|
|
- return comboBox;
|
|
|
}
|
|
|
|
|
|
+XY_DOUBLE_STRUCT WaferProgramPage::WaferGetAxisPosition(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);
|
|
|
|
|
|
-void WaferProgramPage::initMergedData() {
|
|
|
- m_isInitializing = true;
|
|
|
-
|
|
|
- SqlOperation& sqlOp = SqlOperation::GetInstance();
|
|
|
- QList<QJsonObject> directories;
|
|
|
- int userPrivilege = 0;//?
|
|
|
- sqlOp.GetDirectories("Dir_Programme", userPrivilege, directories); // 使用相应的表名和权限加载目录
|
|
|
- m_vecWaferMatrix = m_pCProduct->GetWaferMatrix();
|
|
|
-
|
|
|
- for (const PROGRAM_WAFER_MATRIX_STRUCT& wafer : m_vecWaferMatrix) {
|
|
|
- int row = m_MergedTable->rowCount();
|
|
|
- m_MergedTable->insertRow(row);
|
|
|
- PROGRAM_DIE_MATRIX_STRUCT stDieMatrix;
|
|
|
- m_pCProduct->GetDieMatrix(wafer.MatrixId, stDieMatrix);
|
|
|
- m_vecDieMatrixt.push_back(stDieMatrix);
|
|
|
-
|
|
|
- // 填充表格数据
|
|
|
- m_MergedTable->setItem(row, 0, new QTableWidgetItem(QString::number(wafer.MatrixId))); // MatrixID
|
|
|
- m_MergedTable->setItem(row, 1, new QTableWidgetItem(QString::number(wafer.MatrixRow))); // MatrixRow
|
|
|
- m_MergedTable->setItem(row, 2, new QTableWidgetItem(QString::number(wafer.MatrixCol))); // MatrixCol
|
|
|
- m_MergedTable->setItem(row, 3, new QTableWidgetItem(QString::number(wafer.LeftTopPoint.y))); // LeftTopPoint_Y
|
|
|
- m_MergedTable->setItem(row, 4, new QTableWidgetItem(QString::number(wafer.LeftTopPoint.x))); // LeftTopPoint_X
|
|
|
- m_MergedTable->setItem(row, 5, new QTableWidgetItem(QString::number(wafer.RightTopPoint.x))); // RightTopPoint_X
|
|
|
- m_MergedTable->setItem(row, 6, new QTableWidgetItem(QString::number(wafer.RightTopPoint.y))); // RightTopPoint_Y
|
|
|
- m_MergedTable->setItem(row, 7, new QTableWidgetItem(QString::number(wafer.RightBottomPoint.x))); // RightBottomPoint_X
|
|
|
- m_MergedTable->setItem(row, 8, new QTableWidgetItem(QString::number(wafer.RightBottomPoint.y))); // RightBottomPoint_Y
|
|
|
- m_MergedTable->setItem(row, 9, new QTableWidgetItem(QString::number(wafer.iDieMatrixId))); // DieMatrixId
|
|
|
-
|
|
|
- // 填充 NoBondPt 数据
|
|
|
- QStringList noBondPts;
|
|
|
- for (const XY_LONG_STRUCT& pt : wafer.VecNoBondPt) {
|
|
|
- noBondPts.append(QString("(%1,%2)").arg(pt.x).arg(pt.y));
|
|
|
- }
|
|
|
- m_MergedTable->setItem(row, 10, new QTableWidgetItem(noBondPts.join(" "))); // NoBondPt
|
|
|
- }
|
|
|
|
|
|
- // 调整列宽和行高
|
|
|
- m_MergedTable->resizeColumnsToContents();
|
|
|
- m_MergedTable->resizeRowsToContents();
|
|
|
+ return errorPt;
|
|
|
+ }
|
|
|
+ m_pProgramCViewInterface->GetViewMotion()->GetAxisPosition(ModuleType, "X", pos.x);
|
|
|
+ m_pProgramCViewInterface->GetViewMotion()->GetAxisPosition(ModuleType, "Y", pos.y);
|
|
|
|
|
|
- m_isInitializing = false;// 开启信号处理
|
|
|
+ return pos;
|
|
|
}
|
|
|
|
|
|
+void WaferProgramPage::AddMatrixPage(int vectorIndex, _PROGRAM_WAFER_MATRIX_STRUCT matrixData) {
|
|
|
+ int matrixNum = m_vecWaferMatrix.size();
|
|
|
+ int newMatrixID = ++matrixNum;
|
|
|
+ QVector<QObject*> vecControls;
|
|
|
+
|
|
|
+ QGroupBox* groupBox = new QGroupBox();
|
|
|
+
|
|
|
+ QGridLayout* outMatrixGridLayout = new QGridLayout();
|
|
|
+ outMatrixGridLayout->setSpacing(6);
|
|
|
+ outMatrixGridLayout->setObjectName(QString::fromUtf8("subGridLayout"));
|
|
|
+ groupBox->setLayout(outMatrixGridLayout);
|
|
|
+
|
|
|
+ QGridLayout* subGridLayout = new QGridLayout();
|
|
|
+ subGridLayout->setSpacing(6);
|
|
|
+ subGridLayout->setObjectName(QString::fromUtf8("subGridLayout"));
|
|
|
+
|
|
|
+ QLabel* labelTitle = new QLabel(this);
|
|
|
+ labelTitle->setObjectName(QString::fromUtf8("labelTitle"));
|
|
|
+ labelTitle->setText(tr("Matrix ") + QString::number(vectorIndex));
|
|
|
+ subGridLayout->addWidget(labelTitle, 0, 0, 1, 1);
|
|
|
+ vecControls.push_back(labelTitle);
|
|
|
+
|
|
|
+ // 删除按钮
|
|
|
+ QPushButton* pushButtonDelete = new QPushButton(this);
|
|
|
+ pushButtonDelete->setObjectName(QString::fromUtf8("buttonDelete"));
|
|
|
+ pushButtonDelete->setText(tr("Delete"));
|
|
|
+ pushButtonDelete->setFixedWidth(62);
|
|
|
+ subGridLayout->addWidget(pushButtonDelete, 0, 3, 1, 1); // 添加到标题右侧的第四列
|
|
|
+ vecControls.push_back(pushButtonDelete);
|
|
|
+
|
|
|
+ // 删除按钮点击事件
|
|
|
+ connect(pushButtonDelete, &QPushButton::clicked, this, [=]() {
|
|
|
+ // 删除当前矩阵页面及控件
|
|
|
+ auto currentIt = m_mapWaferGroupBoxIndex.find(groupBox);
|
|
|
+ if (currentIt != m_mapWaferGroupBoxIndex.end()) {
|
|
|
+ int index = currentIt.value();
|
|
|
+ m_mapWaferGroupBoxIndex.erase(currentIt);
|
|
|
+
|
|
|
+ // 更新索引
|
|
|
+ for (auto it = m_mapWaferGroupBoxIndex.begin(); it != m_mapWaferGroupBoxIndex.end(); it++) {
|
|
|
+ if (it.value() > index) {
|
|
|
+ int newIndex = it.value() - 1;
|
|
|
+ m_mapWaferGroupBoxIndex.insert(it.key(), newIndex);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 删除矩阵数据
|
|
|
+ m_vecWaferMatrix.erase(m_vecWaferMatrix.begin() + index);
|
|
|
|
|
|
-void WaferProgramPage::addRow() {
|
|
|
- m_isInitializing = true;
|
|
|
- m_IdIsUsedMap.clear();
|
|
|
- for (const auto& wafer : m_vecWaferMatrix) {
|
|
|
- m_IdIsUsedMap[wafer.MatrixId] = true;
|
|
|
- }
|
|
|
- int row = m_MergedTable->rowCount();
|
|
|
- m_MergedTable->insertRow(row);
|
|
|
-
|
|
|
- int newId = 1;
|
|
|
- bool idUsed = true;
|
|
|
-
|
|
|
- //// 检查当前 MatrixId 是否已存在
|
|
|
- //while (idUsed) {
|
|
|
- // idUsed = false; // 假设 ID 没有被使用
|
|
|
-
|
|
|
- // // 如果 ID 已存在于 map 中,则说明已被使用
|
|
|
- // if (m_IdIsUsedMap.find(newId) != m_IdIsUsedMap.end()) {
|
|
|
- // idUsed = true;
|
|
|
- // }
|
|
|
-
|
|
|
- // if (idUsed) {
|
|
|
- // ++newId; // 如果 ID 被使用,检查下一个 ID
|
|
|
- // }
|
|
|
- //}
|
|
|
- //找出最大的ID值
|
|
|
- UINT maxId = 0;
|
|
|
- for (PROGRAM_WAFER_MATRIX_STRUCT& bondMatrix : m_vecWaferMatrix)
|
|
|
- {
|
|
|
- if (bondMatrix.MatrixId > maxId)
|
|
|
- {
|
|
|
- maxId = bondMatrix.MatrixId;
|
|
|
+ // 删除矩阵控件
|
|
|
+ delete groupBox;
|
|
|
}
|
|
|
- }
|
|
|
- newId = ++maxId;
|
|
|
-
|
|
|
- // 为新行添加默认数据
|
|
|
- m_MergedTable->setItem(row, 0, new QTableWidgetItem(QString::number(newId))); // MatrixID 默认值为 0
|
|
|
- m_MergedTable->setItem(row, 1, new QTableWidgetItem("1")); // MatrixRow 默认值为 1
|
|
|
- m_MergedTable->setItem(row, 2, new QTableWidgetItem("1")); // MatrixCol 默认值为 1
|
|
|
- m_MergedTable->setItem(row, 3, new QTableWidgetItem("0")); // LeftTopPoint_Y 默认值为 0
|
|
|
- m_MergedTable->setItem(row, 4, new QTableWidgetItem("0")); // LeftTopPoint_X 默认值为 0
|
|
|
- m_MergedTable->setItem(row, 5, new QTableWidgetItem("0")); // RightTopPoint_X 默认值为 0
|
|
|
- m_MergedTable->setItem(row, 6, new QTableWidgetItem("0")); // RightTopPoint_Y 默认值为 0
|
|
|
- m_MergedTable->setItem(row, 7, new QTableWidgetItem("0")); // RightBottomPoint_X 默认值为 0
|
|
|
- m_MergedTable->setItem(row, 8, new QTableWidgetItem("0")); // RightBottomPoint_Y 默认值为 0
|
|
|
- m_MergedTable->setItem(row, 9, new QTableWidgetItem("0")); // DieMatrixId 默认值为 0
|
|
|
- /*QComboBox* comboBox = createDieMatrixIdComboBox(0, row);
|
|
|
- m_MergedTable->setCellWidget(row, 9, comboBox);*/
|
|
|
-
|
|
|
- m_MergedTable->setItem(row, 10, new QTableWidgetItem("")); // NoBondPt 默认值为空
|
|
|
-
|
|
|
- // 同时更新 PROGRAM_WAFER_MATRIX_STRUCT 数据
|
|
|
- PROGRAM_WAFER_MATRIX_STRUCT newMatrix;
|
|
|
- newMatrix.MatrixId = newId;
|
|
|
- newMatrix.MatrixRow = 1;
|
|
|
- newMatrix.MatrixCol = 1;
|
|
|
- newMatrix.LeftTopPoint = { 0.0, 0.0 };
|
|
|
- newMatrix.RightTopPoint = { 0.0, 0.0 };
|
|
|
- newMatrix.RightBottomPoint = { 0.0, 0.0 };
|
|
|
- newMatrix.iDieMatrixId = 0;
|
|
|
- newMatrix.VecNoBondPt.clear(); // 默认值为空
|
|
|
-
|
|
|
- m_vecWaferMatrix.push_back(newMatrix);
|
|
|
- // 将新矩阵添加到数据结构中
|
|
|
- //m_pCProduct->AddWaferMatrix(newMatrix, newId);
|
|
|
- m_isInitializing = false;
|
|
|
-}
|
|
|
+ });
|
|
|
|
|
|
-void WaferProgramPage::deleteRow() {
|
|
|
- int currentRow = m_MergedTable->currentRow();
|
|
|
+ QLabel* labelRow = new QLabel(this);
|
|
|
+ labelRow->setObjectName(QString::fromUtf8("labelRow"));
|
|
|
+ labelRow->setText(tr("Row & Cow "));
|
|
|
+ subGridLayout->addWidget(labelRow, 1, 0, 1, 1);
|
|
|
+ vecControls.push_back(labelRow);
|
|
|
+
|
|
|
+ SpinBox* spinBoxRow = new SpinBox(this);
|
|
|
+ spinBoxRow->setObjectName(QString::fromUtf8("spinBoxRow"));
|
|
|
+ spinBoxRow->setValue(matrixData.MatrixRow);
|
|
|
+ subGridLayout->addWidget(spinBoxRow, 1, 1, 1, 1);
|
|
|
+ vecControls.push_back(spinBoxRow);
|
|
|
+
|
|
|
+ /*QLabel* labelCol = new QLabel(this);
|
|
|
+ labelCol->setObjectName(QString::fromUtf8("labelCol"));
|
|
|
+ labelCol->setText(tr("Cow "));
|
|
|
+ subGridLayout->addWidget(labelCol, 2, 0, 1, 1);
|
|
|
+ vecControls.push_back(labelCol);*/
|
|
|
+
|
|
|
+ SpinBox* spinBoxCol = new SpinBox(this);
|
|
|
+ spinBoxCol->setObjectName(QString::fromUtf8("spinBoxCol"));
|
|
|
+ spinBoxCol->setValue(matrixData.MatrixCol);
|
|
|
+ subGridLayout->addWidget(spinBoxCol, 1, 2, 1, 1);
|
|
|
+ vecControls.push_back(spinBoxCol);
|
|
|
+
|
|
|
+ QLabel* labelLeftTop = new QLabel(this);
|
|
|
+ labelLeftTop->setObjectName(QString::fromUtf8("labelLeftTop"));
|
|
|
+ labelLeftTop->setText(tr("Left Top Pos "));
|
|
|
+ subGridLayout->addWidget(labelLeftTop, 4, 0, 1, 1);
|
|
|
+ vecControls.push_back(labelLeftTop);
|
|
|
+
|
|
|
+ // Set all DoubleSpinBox width to 100
|
|
|
+ DoubleSpinBox* doubleSpinBoxLeftTopX = new DoubleSpinBox(this);
|
|
|
+ doubleSpinBoxLeftTopX->setObjectName(QString::fromUtf8("doubleSpinBoxLeftTopX"));
|
|
|
+ doubleSpinBoxLeftTopX->setValue(matrixData.LeftTopPoint.x);
|
|
|
+ doubleSpinBoxLeftTopX->setFixedWidth(100); // Set fixed width to 100
|
|
|
+ subGridLayout->addWidget(doubleSpinBoxLeftTopX, 4, 1, 1, 1);
|
|
|
+ vecControls.push_back(doubleSpinBoxLeftTopX);
|
|
|
+
|
|
|
+ DoubleSpinBox* doubleSpinBoxLeftTopY = new DoubleSpinBox(this);
|
|
|
+ doubleSpinBoxLeftTopY->setObjectName(QString::fromUtf8("doubleSpinBoxLeftTopY"));
|
|
|
+ doubleSpinBoxLeftTopY->setValue(matrixData.LeftTopPoint.y);
|
|
|
+ doubleSpinBoxLeftTopY->setFixedWidth(100); // Set fixed width to 100
|
|
|
+ subGridLayout->addWidget(doubleSpinBoxLeftTopY, 4, 2, 1, 1);
|
|
|
+ vecControls.push_back(doubleSpinBoxLeftTopY);
|
|
|
+
|
|
|
+ // Adding button to get LeftTop position
|
|
|
+ QPushButton* buttonLeftTop = new QPushButton("Get Pos", this);
|
|
|
+ buttonLeftTop->setFixedWidth(62);
|
|
|
+ subGridLayout->addWidget(buttonLeftTop, 4, 3, 1, 1); // Position the button next to LeftTopPos
|
|
|
+ /*connect(buttonLeftTop, &QPushButton::clicked, this, [=]() {
|
|
|
+ QString position = QString("X: %1, Y: %2").arg(doubleSpinBoxLeftTopX->value()).arg(doubleSpinBoxLeftTopY->value());
|
|
|
+ QMessageBox::information(this, "Left Top Position", position);
|
|
|
+ });*/
|
|
|
+ connect(buttonLeftTop, &QPushButton::clicked, this, [=]() {
|
|
|
+ // 获取+更新位置
|
|
|
+ XY_DOUBLE_STRUCT position = WaferGetAxisPosition("WaferTable", m_vecWaferMatrix[vectorIndex].LeftTopPoint);
|
|
|
+
|
|
|
+ // 更新 DoubleSpinBox 的值
|
|
|
+ doubleSpinBoxLeftTopX->setValue(position.x); // 更新 X 轴
|
|
|
+ doubleSpinBoxLeftTopY->setValue(position.y); // 更新 Y 轴
|
|
|
+ });
|
|
|
|
|
|
- if (currentRow >= 0 && currentRow < m_MergedTable->rowCount()) {
|
|
|
- // 获取 MatrixID(假设第0列是 MatrixID)
|
|
|
- QTableWidgetItem* idItem = m_MergedTable->item(currentRow, 0);
|
|
|
- if (!idItem) return;
|
|
|
+ QLabel* labelRightTopPos = new QLabel(this);
|
|
|
+ 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(this);
|
|
|
+ doubleSpinBoxRightTopX->setObjectName(QString::fromUtf8("doubleSpinBoxRightTopX"));
|
|
|
+ doubleSpinBoxRightTopX->setValue(matrixData.RightTopPoint.x);
|
|
|
+ doubleSpinBoxRightTopX->setFixedWidth(100); // Set fixed width to 100
|
|
|
+ subGridLayout->addWidget(doubleSpinBoxRightTopX, 5, 1, 1, 1);
|
|
|
+ vecControls.push_back(doubleSpinBoxRightTopX);
|
|
|
+
|
|
|
+ DoubleSpinBox* doubleSpinBoxRightTopY = new DoubleSpinBox(this);
|
|
|
+ doubleSpinBoxRightTopY->setObjectName(QString::fromUtf8("doubleSpinBoxRightTopY"));
|
|
|
+ doubleSpinBoxRightTopY->setValue(matrixData.RightTopPoint.y);
|
|
|
+ doubleSpinBoxRightTopY->setFixedWidth(100); // Set fixed width to 100
|
|
|
+ subGridLayout->addWidget(doubleSpinBoxRightTopY, 5, 2, 1, 1);
|
|
|
+ vecControls.push_back(doubleSpinBoxRightTopY);
|
|
|
+
|
|
|
+ // Adding button to get RightTop position
|
|
|
+ QPushButton* buttonRightTop = new QPushButton("Get Pos", this);
|
|
|
+ buttonRightTop->setFixedWidth(62);
|
|
|
+ subGridLayout->addWidget(buttonRightTop, 5, 3, 1, 1); // Position the button next to RightTopPos
|
|
|
+
|
|
|
+ connect(buttonRightTop, &QPushButton::clicked, this, [=]() {
|
|
|
+ // 获取+更新位置
|
|
|
+ XY_DOUBLE_STRUCT position = WaferGetAxisPosition("WaferTable", m_vecWaferMatrix[vectorIndex].LeftTopPoint);
|
|
|
+
|
|
|
+ // 更新 DoubleSpinBox 的值
|
|
|
+ doubleSpinBoxRightTopX->setValue(position.x); // 更新 X 轴
|
|
|
+ doubleSpinBoxRightTopY->setValue(position.y); // 更新 Y 轴
|
|
|
+ });
|
|
|
|
|
|
- int matrixID = idItem->text().toInt();
|
|
|
+ QLabel* labelRightButtomPos = new QLabel(this);
|
|
|
+ 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(this);
|
|
|
+ doubleSpinBoxRightButtomX->setObjectName(QString::fromUtf8("doubleSpinBoxRightButtomX"));
|
|
|
+ doubleSpinBoxRightButtomX->setValue(matrixData.RightBottomPoint.x);
|
|
|
+ doubleSpinBoxRightButtomX->setFixedWidth(100); // Set fixed width to 100
|
|
|
+ subGridLayout->addWidget(doubleSpinBoxRightButtomX, 6, 1, 1, 1);
|
|
|
+ vecControls.push_back(doubleSpinBoxRightButtomX);
|
|
|
+
|
|
|
+ DoubleSpinBox* doubleSpinBoxRightButtomY = new DoubleSpinBox(this);
|
|
|
+ doubleSpinBoxRightButtomY->setObjectName(QString::fromUtf8("doubleSpinBoxRightButtomY"));
|
|
|
+ doubleSpinBoxRightButtomY->setValue(matrixData.RightBottomPoint.y);
|
|
|
+ doubleSpinBoxRightButtomY->setFixedWidth(100); // Set fixed width to 100
|
|
|
+ subGridLayout->addWidget(doubleSpinBoxRightButtomY, 6, 2, 1, 1);
|
|
|
+ vecControls.push_back(doubleSpinBoxRightButtomY);
|
|
|
+
|
|
|
+ // Adding button to get RightBottom position
|
|
|
+ QPushButton* buttonRightButtom = new QPushButton("Get Pos", this);
|
|
|
+ buttonRightButtom->setFixedWidth(62);
|
|
|
+ subGridLayout->addWidget(buttonRightButtom, 6, 3, 1, 1); // Position the button next to RightBottomPos
|
|
|
+
|
|
|
+ connect(buttonRightButtom, &QPushButton::clicked, this, [=]() {
|
|
|
+ // 获取+更新位置
|
|
|
+ XY_DOUBLE_STRUCT position = WaferGetAxisPosition("WaferTable", m_vecWaferMatrix[vectorIndex].LeftTopPoint);
|
|
|
+
|
|
|
+ // 更新 DoubleSpinBox 的值
|
|
|
+ doubleSpinBoxRightButtomX->setValue(position.x); // 更新 X 轴
|
|
|
+ doubleSpinBoxRightButtomY->setValue(position.y); // 更新 Y 轴
|
|
|
+ });
|
|
|
|
|
|
- // 从 m_MergedTable 删除行
|
|
|
- m_MergedTable->removeRow(currentRow);
|
|
|
+ QLabel* labelNoBondPts = new QLabel(this);
|
|
|
+ labelNoBondPts->setObjectName(QString::fromUtf8("labelNoBondPts"));
|
|
|
+ labelNoBondPts->setText(tr("No Bond Points"));
|
|
|
+ subGridLayout->addWidget(labelNoBondPts, 7, 0, 1, 1);
|
|
|
+ vecControls.push_back(labelNoBondPts);
|
|
|
|
|
|
- // 从 m_vecWaferMatrix 中移除对应项
|
|
|
- auto it = std::remove_if(m_vecWaferMatrix.begin(), m_vecWaferMatrix.end(),
|
|
|
- [matrixID](const PROGRAM_WAFER_MATRIX_STRUCT& wafer) {
|
|
|
- return wafer.MatrixId == matrixID;
|
|
|
- });
|
|
|
- if (it != m_vecWaferMatrix.end()) {
|
|
|
- m_vecWaferMatrix.erase(it, m_vecWaferMatrix.end());
|
|
|
- }
|
|
|
+ QLineEdit* lineEditNoBondPts = new QLineEdit(this);
|
|
|
+ lineEditNoBondPts->setObjectName(QString::fromUtf8("lineEditNoBondPts"));
|
|
|
+ lineEditNoBondPts->setReadOnly(true);
|
|
|
+ lineEditNoBondPts->setCursor(Qt::PointingHandCursor);
|
|
|
+ lineEditNoBondPts->setProperty("vectorIndex", vectorIndex); // Store the index
|
|
|
+ lineEditNoBondPts->installEventFilter(this);
|
|
|
+ subGridLayout->addWidget(lineEditNoBondPts, 7, 1, 1, 3);
|
|
|
+ vecControls.push_back(lineEditNoBondPts);
|
|
|
|
|
|
- // 同时通知数据管理类删除
|
|
|
- //m_pCProduct->DeleteWaferMatrix(matrixID);
|
|
|
+ outMatrixGridLayout->addLayout(subGridLayout, 0, 0);
|
|
|
|
|
|
- }
|
|
|
- else {
|
|
|
- //QMessageBox::warning(this, "No Row Selected", "Please select a row to delete.");
|
|
|
- QMessageBox box(QMessageBox::Warning, "No Row Selected", "Please select a row to delete.");
|
|
|
- box.setStyleSheet(R"(
|
|
|
- QMessageBox {
|
|
|
- background-color: #eeeeee;
|
|
|
- color: black;
|
|
|
- }
|
|
|
- QPushButton {
|
|
|
- background-color: #dddddd;
|
|
|
- color: black;
|
|
|
- }
|
|
|
- )");
|
|
|
- box.exec();
|
|
|
- }
|
|
|
- currentRow = -1;
|
|
|
-}
|
|
|
+ QFrame* line = new QFrame();
|
|
|
+ line->setFrameShape(QFrame::NoFrame);
|
|
|
+ line->setFixedHeight(2);
|
|
|
+ line->setStyleSheet("background-color: #C7CAEB;");
|
|
|
+ outMatrixGridLayout->addWidget(line);
|
|
|
|
|
|
-void WaferProgramPage::updateData() {
|
|
|
- // 1. 清空原模型中的矩阵
|
|
|
- auto originalData = m_pCProduct->GetWaferMatrix();
|
|
|
- for (const auto& matrix : originalData) {
|
|
|
- m_pCProduct->DeleteWaferMatrix(matrix.MatrixId);
|
|
|
- }
|
|
|
+ ui.verticalLayout->addWidget(groupBox);
|
|
|
|
|
|
- // 2. 添加当前表格中的数据
|
|
|
- for (auto& matrix : m_vecWaferMatrix) {
|
|
|
- int newId = matrix.MatrixId;
|
|
|
- m_pCProduct->AddWaferMatrix(matrix, newId);
|
|
|
- auto originalData1 = m_pCProduct->GetWaferMatrix();
|
|
|
- }
|
|
|
+ m_mapWaferGroupBoxIndex.insert(groupBox, vectorIndex);
|
|
|
+
|
|
|
+ // 连接信号和槽
|
|
|
+ connect(spinBoxRow, &SpinBox::editDone, this, [=]() {
|
|
|
+ m_vecWaferMatrix[vectorIndex].MatrixRow = spinBoxRow->value();
|
|
|
+ });
|
|
|
+
|
|
|
+ connect(spinBoxCol, &SpinBox::editDone, this, [=]() {
|
|
|
+ m_vecWaferMatrix[vectorIndex].MatrixCol = spinBoxCol->value();
|
|
|
+ });
|
|
|
+
|
|
|
+ connect(doubleSpinBoxLeftTopX, &DoubleSpinBox::editDone, this, [=]() {
|
|
|
+ m_vecWaferMatrix[vectorIndex].LeftTopPoint.x = doubleSpinBoxLeftTopX->value();
|
|
|
+ });
|
|
|
+
|
|
|
+ connect(doubleSpinBoxLeftTopY, &DoubleSpinBox::editDone, this, [=]() {
|
|
|
+ m_vecWaferMatrix[vectorIndex].LeftTopPoint.y = doubleSpinBoxLeftTopY->value();
|
|
|
+ });
|
|
|
+
|
|
|
+ connect(doubleSpinBoxRightTopX, &DoubleSpinBox::editDone, this, [=]() {
|
|
|
+ m_vecWaferMatrix[vectorIndex].RightTopPoint.x = doubleSpinBoxRightTopX->value();
|
|
|
+ });
|
|
|
+
|
|
|
+ connect(doubleSpinBoxRightTopY, &DoubleSpinBox::editDone, this, [=]() {
|
|
|
+ m_vecWaferMatrix[vectorIndex].RightTopPoint.y = doubleSpinBoxRightTopY->value();
|
|
|
+ });
|
|
|
+
|
|
|
+ connect(doubleSpinBoxRightButtomX, &DoubleSpinBox::editDone, this, [=]() {
|
|
|
+ m_vecWaferMatrix[vectorIndex].RightBottomPoint.x = doubleSpinBoxRightButtomX->value();
|
|
|
+ });
|
|
|
+
|
|
|
+ connect(doubleSpinBoxRightButtomY, &DoubleSpinBox::editDone, this, [=]() {
|
|
|
+ m_vecWaferMatrix[vectorIndex].RightBottomPoint.y = doubleSpinBoxRightButtomY->value();
|
|
|
+ });
|
|
|
|
|
|
- //qDebug() << "WaferMatrix 已同步到模型层,共同步:" << m_vecWaferMatrix.size() << "条记录。";
|
|
|
+ connect(lineEditNoBondPts, &QLineEdit::textChanged, this, [=]() {
|
|
|
+ // Handle NoBondPts logic here
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
|
|
|
-void WaferProgramPage::onCellChanged(int row, int column)
|
|
|
-{
|
|
|
- if (m_isInitializing) return; // 防止初始化时触发
|
|
|
- if (row >= m_vecWaferMatrix.size()) return;
|
|
|
-
|
|
|
- QTableWidgetItem* item = m_MergedTable->item(row, column);
|
|
|
- if (!item) return;
|
|
|
-
|
|
|
- QString value = item->text();
|
|
|
- PROGRAM_WAFER_MATRIX_STRUCT& wafer = m_vecWaferMatrix[row];
|
|
|
-
|
|
|
- switch (column) {
|
|
|
- case 0: wafer.MatrixId = value.toInt(); break;
|
|
|
- case 1: wafer.MatrixRow = value.toInt(); break;
|
|
|
- case 2: wafer.MatrixCol = value.toInt(); break;
|
|
|
- case 3: wafer.LeftTopPoint.y = value.toDouble(); break;
|
|
|
- case 4: wafer.LeftTopPoint.x = value.toDouble(); break;
|
|
|
- case 5: wafer.RightTopPoint.x = value.toDouble(); break;
|
|
|
- case 6: wafer.RightTopPoint.y = value.toDouble(); break;
|
|
|
- case 7: wafer.RightBottomPoint.x = value.toDouble(); break;
|
|
|
- case 8: wafer.RightBottomPoint.y = value.toDouble(); break;
|
|
|
- ////case 9: wafer.iDieMatrixId = value.toInt(); break;
|
|
|
-
|
|
|
- case 10: {
|
|
|
- wafer.VecNoBondPt.clear();
|
|
|
- QRegularExpression regex(R"(\((\d+),(\d+)\))");
|
|
|
- QRegularExpressionMatchIterator i = regex.globalMatch(value);
|
|
|
- while (i.hasNext()) {
|
|
|
- auto match = i.next();
|
|
|
- XY_LONG_STRUCT pt;
|
|
|
- pt.x = match.captured(1).toInt();
|
|
|
- pt.y = match.captured(2).toInt();
|
|
|
- wafer.VecNoBondPt.push_back(pt);
|
|
|
+bool WaferProgramPage::eventFilter(QObject* obj, QEvent* event) {
|
|
|
+ if (event->type() == QEvent::MouseButtonPress) {
|
|
|
+ auto* lineEdit = qobject_cast<QLineEdit*>(obj);
|
|
|
+ if (lineEdit) {
|
|
|
+ int index = lineEdit->property("vectorIndex").toInt();
|
|
|
+ if (lineEdit->property("vectorIndex").isValid()) {
|
|
|
+ // Handle WaffleMatrix
|
|
|
+ onNoBondPtsClickedWafer(lineEdit, index);
|
|
|
+ }
|
|
|
+ return true; // Intercept the event
|
|
|
}
|
|
|
- break;
|
|
|
}
|
|
|
- default: break;
|
|
|
+ return QWidget::eventFilter(obj, event);
|
|
|
+}
|
|
|
+
|
|
|
+void WaferProgramPage::onNoBondPtsClickedWafer(QLineEdit* lineEdit, int index) {
|
|
|
+ if (index < 0 || index >= m_vecWaferMatrix.size()) return;
|
|
|
+
|
|
|
+ const auto& wafer = m_vecWaferMatrix[index];
|
|
|
+ NoBondPtEditDialog dlg(wafer.MatrixRow, wafer.MatrixCol, wafer.VecNoBondPt, this);
|
|
|
+
|
|
|
+ if (dlg.exec() == QDialog::Accepted) {
|
|
|
+ QVector<XY_LONG_STRUCT> selected = dlg.getSelectedPoints();
|
|
|
+ m_vecWaferMatrix[index].VecNoBondPt = std::vector<XY_LONG_STRUCT>(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(" "));
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+//QWidget* WaferProgramPage::CreateWaferProgramPage(const CONFIG_BASE_STRUCT& control) {
|
|
|
+// return new WaferProgramPage();
|
|
|
+//}
|
|
|
+
|
|
|
+//创建下拉列表
|
|
|
+//QComboBox* WaferProgramPage::createDieMatrixIdComboBox(int defaultId, int row) {
|
|
|
+// QComboBox* comboBox = new QComboBox(m_MergedTable);
|
|
|
+//
|
|
|
+// // 设置样式,确保在暗色模式下也是白底黑字
|
|
|
+// comboBox->setStyleSheet(R"(
|
|
|
+// QComboBox {
|
|
|
+// background-color: white;
|
|
|
+// color: black;
|
|
|
+// border: 1px solid #BABBDC;
|
|
|
+// border-radius: 4px;
|
|
|
+// padding: 2px 5px;
|
|
|
+// }
|
|
|
+// QComboBox QAbstractItemView {
|
|
|
+// background-color: white;
|
|
|
+// color: black;
|
|
|
+// selection-background-color: #E5E5FF;
|
|
|
+// selection-color: black;
|
|
|
+// }
|
|
|
+// )");
|
|
|
+// for (const auto& dieMatrix : m_vecDieMatrixt) {
|
|
|
+// /*comboBox->addItem(
|
|
|
+// QString("%1 - %2").arg(dieMatrix.MatrixId).arg(QString::fromStdString(dieMatrix.strModuleName)),
|
|
|
+// QVariant(dieMatrix.MatrixId)
|
|
|
+// );*/
|
|
|
+// comboBox->addItem(QString::number(dieMatrix.MatrixId), QVariant(dieMatrix.MatrixId));
|
|
|
+// }
|
|
|
+//
|
|
|
+// int index = comboBox->findData(defaultId);
|
|
|
+// if (index >= 0)
|
|
|
+// comboBox->setCurrentIndex(index);
|
|
|
+//
|
|
|
+// return comboBox;
|
|
|
+//}
|
|
|
+
|
|
|
+//
|
|
|
+//void WaferProgramPage::initMergedData() {
|
|
|
+// m_isInitializing = true;
|
|
|
+//
|
|
|
+// SqlOperation& sqlOp = SqlOperation::GetInstance();
|
|
|
+// QList<QJsonObject> directories;
|
|
|
+// int userPrivilege = 0;//?
|
|
|
+// sqlOp.GetDirectories("Dir_Programme", userPrivilege, directories); // 使用相应的表名和权限加载目录
|
|
|
+// m_vecWaferMatrix = m_pProduct->GetWaferMatrix();
|
|
|
+//
|
|
|
+// for (const PROGRAM_WAFER_MATRIX_STRUCT& wafer : m_vecWaferMatrix) {
|
|
|
+// int row = m_MergedTable->rowCount();
|
|
|
+// m_MergedTable->insertRow(row);
|
|
|
+// PROGRAM_DIE_MATRIX_STRUCT stDieMatrix;
|
|
|
+// m_pProduct->GetDieMatrix(wafer.MatrixId, stDieMatrix);
|
|
|
+// m_vecDieMatrixt.push_back(stDieMatrix);
|
|
|
+//
|
|
|
+// // 填充表格数据
|
|
|
+// m_MergedTable->setItem(row, 0, new QTableWidgetItem(QString::number(wafer.MatrixId))); // MatrixID
|
|
|
+// m_MergedTable->setItem(row, 1, new QTableWidgetItem(QString::number(wafer.MatrixRow))); // MatrixRow
|
|
|
+// m_MergedTable->setItem(row, 2, new QTableWidgetItem(QString::number(wafer.MatrixCol))); // MatrixCol
|
|
|
+// m_MergedTable->setItem(row, 3, new QTableWidgetItem(QString::number(wafer.LeftTopPoint.y))); // LeftTopPoint_Y
|
|
|
+// m_MergedTable->setItem(row, 4, new QTableWidgetItem(QString::number(wafer.LeftTopPoint.x))); // LeftTopPoint_X
|
|
|
+// m_MergedTable->setItem(row, 5, new QTableWidgetItem(QString::number(wafer.RightTopPoint.x))); // RightTopPoint_X
|
|
|
+// m_MergedTable->setItem(row, 6, new QTableWidgetItem(QString::number(wafer.RightTopPoint.y))); // RightTopPoint_Y
|
|
|
+// m_MergedTable->setItem(row, 7, new QTableWidgetItem(QString::number(wafer.RightBottomPoint.x))); // RightBottomPoint_X
|
|
|
+// m_MergedTable->setItem(row, 8, new QTableWidgetItem(QString::number(wafer.RightBottomPoint.y))); // RightBottomPoint_Y
|
|
|
+// m_MergedTable->setItem(row, 9, new QTableWidgetItem(QString::number(wafer.iDieMatrixId))); // DieMatrixId
|
|
|
+//
|
|
|
+// // 填充 NoBondPt 数据
|
|
|
+// QStringList noBondPts;
|
|
|
+// for (const XY_LONG_STRUCT& pt : wafer.VecNoBondPt) {
|
|
|
+// noBondPts.append(QString("(%1,%2)").arg(pt.x).arg(pt.y));
|
|
|
+// }
|
|
|
+// m_MergedTable->setItem(row, 10, new QTableWidgetItem(noBondPts.join(" "))); // NoBondPt
|
|
|
+// }
|
|
|
+//
|
|
|
+// // 调整列宽和行高
|
|
|
+// m_MergedTable->resizeColumnsToContents();
|
|
|
+// m_MergedTable->resizeRowsToContents();
|
|
|
+//
|
|
|
+// m_isInitializing = false;// 开启信号处理
|
|
|
+//}
|
|
|
+
|
|
|
+//
|
|
|
+//void WaferProgramPage::addRow() {
|
|
|
+// m_isInitializing = true;
|
|
|
+// m_IdIsUsedMap.clear();
|
|
|
+// for (const auto& wafer : m_vecWaferMatrix) {
|
|
|
+// m_IdIsUsedMap[wafer.MatrixId] = true;
|
|
|
+// }
|
|
|
+// int row = m_MergedTable->rowCount();
|
|
|
+// m_MergedTable->insertRow(row);
|
|
|
+//
|
|
|
+// int newId = 1;
|
|
|
+// bool idUsed = true;
|
|
|
+//
|
|
|
+// //// 检查当前 MatrixId 是否已存在
|
|
|
+// //while (idUsed) {
|
|
|
+// // idUsed = false; // 假设 ID 没有被使用
|
|
|
+//
|
|
|
+// // // 如果 ID 已存在于 map 中,则说明已被使用
|
|
|
+// // if (m_IdIsUsedMap.find(newId) != m_IdIsUsedMap.end()) {
|
|
|
+// // idUsed = true;
|
|
|
+// // }
|
|
|
+//
|
|
|
+// // if (idUsed) {
|
|
|
+// // ++newId; // 如果 ID 被使用,检查下一个 ID
|
|
|
+// // }
|
|
|
+// //}
|
|
|
+// //找出最大的ID值
|
|
|
+// UINT maxId = 0;
|
|
|
+// for (PROGRAM_WAFER_MATRIX_STRUCT& bondMatrix : m_vecWaferMatrix)
|
|
|
+// {
|
|
|
+// if (bondMatrix.MatrixId > maxId)
|
|
|
+// {
|
|
|
+// maxId = bondMatrix.MatrixId;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// newId = ++maxId;
|
|
|
+//
|
|
|
+// // 为新行添加默认数据
|
|
|
+// m_MergedTable->setItem(row, 0, new QTableWidgetItem(QString::number(newId))); // MatrixID 默认值为 0
|
|
|
+// m_MergedTable->setItem(row, 1, new QTableWidgetItem("1")); // MatrixRow 默认值为 1
|
|
|
+// m_MergedTable->setItem(row, 2, new QTableWidgetItem("1")); // MatrixCol 默认值为 1
|
|
|
+// m_MergedTable->setItem(row, 3, new QTableWidgetItem("0")); // LeftTopPoint_Y 默认值为 0
|
|
|
+// m_MergedTable->setItem(row, 4, new QTableWidgetItem("0")); // LeftTopPoint_X 默认值为 0
|
|
|
+// m_MergedTable->setItem(row, 5, new QTableWidgetItem("0")); // RightTopPoint_X 默认值为 0
|
|
|
+// m_MergedTable->setItem(row, 6, new QTableWidgetItem("0")); // RightTopPoint_Y 默认值为 0
|
|
|
+// m_MergedTable->setItem(row, 7, new QTableWidgetItem("0")); // RightBottomPoint_X 默认值为 0
|
|
|
+// m_MergedTable->setItem(row, 8, new QTableWidgetItem("0")); // RightBottomPoint_Y 默认值为 0
|
|
|
+// m_MergedTable->setItem(row, 9, new QTableWidgetItem("0")); // DieMatrixId 默认值为 0
|
|
|
+// /*QComboBox* comboBox = createDieMatrixIdComboBox(0, row);
|
|
|
+// m_MergedTable->setCellWidget(row, 9, comboBox);*/
|
|
|
+//
|
|
|
+// m_MergedTable->setItem(row, 10, new QTableWidgetItem("")); // NoBondPt 默认值为空
|
|
|
+//
|
|
|
+// // 同时更新 PROGRAM_WAFER_MATRIX_STRUCT 数据
|
|
|
+// PROGRAM_WAFER_MATRIX_STRUCT newMatrix;
|
|
|
+// newMatrix.MatrixId = newId;
|
|
|
+// newMatrix.MatrixRow = 1;
|
|
|
+// newMatrix.MatrixCol = 1;
|
|
|
+// newMatrix.LeftTopPoint = { 0.0, 0.0 };
|
|
|
+// newMatrix.RightTopPoint = { 0.0, 0.0 };
|
|
|
+// newMatrix.RightBottomPoint = { 0.0, 0.0 };
|
|
|
+// newMatrix.iDieMatrixId = 0;
|
|
|
+// newMatrix.VecNoBondPt.clear(); // 默认值为空
|
|
|
+//
|
|
|
+// m_vecWaferMatrix.push_back(newMatrix);
|
|
|
+// // 将新矩阵添加到数据结构中
|
|
|
+// //m_pProduct->AddWaferMatrix(newMatrix, newId);
|
|
|
+// m_isInitializing = false;
|
|
|
+//}
|
|
|
+//
|
|
|
+//void WaferProgramPage::deleteRow() {
|
|
|
+// int currentRow = m_MergedTable->currentRow();
|
|
|
+//
|
|
|
+// if (currentRow >= 0 && currentRow < m_MergedTable->rowCount()) {
|
|
|
+// // 获取 MatrixID(假设第0列是 MatrixID)
|
|
|
+// QTableWidgetItem* idItem = m_MergedTable->item(currentRow, 0);
|
|
|
+// if (!idItem) return;
|
|
|
+//
|
|
|
+// int matrixID = idItem->text().toInt();
|
|
|
+//
|
|
|
+// // 从 m_MergedTable 删除行
|
|
|
+// m_MergedTable->removeRow(currentRow);
|
|
|
+//
|
|
|
+// // 从 m_vecWaferMatrix 中移除对应项
|
|
|
+// auto it = std::remove_if(m_vecWaferMatrix.begin(), m_vecWaferMatrix.end(),
|
|
|
+// [matrixID](const PROGRAM_WAFER_MATRIX_STRUCT& wafer) {
|
|
|
+// return wafer.MatrixId == matrixID;
|
|
|
+// });
|
|
|
+// if (it != m_vecWaferMatrix.end()) {
|
|
|
+// m_vecWaferMatrix.erase(it, m_vecWaferMatrix.end());
|
|
|
+// }
|
|
|
+//
|
|
|
+// // 同时通知数据管理类删除
|
|
|
+// //m_pProduct->DeleteWaferMatrix(matrixID);
|
|
|
+//
|
|
|
+// }
|
|
|
+// else {
|
|
|
+// //QMessageBox::warning(this, "No Row Selected", "Please select a row to delete.");
|
|
|
+// QMessageBox box(QMessageBox::Warning, "No Row Selected", "Please select a row to delete.");
|
|
|
+// box.setStyleSheet(R"(
|
|
|
+// QMessageBox {
|
|
|
+// background-color: #eeeeee;
|
|
|
+// color: black;
|
|
|
+// }
|
|
|
+// QPushButton {
|
|
|
+// background-color: #dddddd;
|
|
|
+// color: black;
|
|
|
+// }
|
|
|
+// )");
|
|
|
+// box.exec();
|
|
|
+// }
|
|
|
+// currentRow = -1;
|
|
|
+//}
|
|
|
+//
|
|
|
+//void WaferProgramPage::updateData() {
|
|
|
+// // 1. 清空原模型中的矩阵
|
|
|
+// auto originalData = m_pProduct->GetWaferMatrix();
|
|
|
+// for (const auto& matrix : originalData) {
|
|
|
+// m_pProduct->DeleteWaferMatrix(matrix.MatrixId);
|
|
|
+// }
|
|
|
+//
|
|
|
+// // 2. 添加当前表格中的数据
|
|
|
+// for (auto& matrix : m_vecWaferMatrix) {
|
|
|
+// int newId = matrix.MatrixId;
|
|
|
+// m_pProduct->AddWaferMatrix(matrix, newId);
|
|
|
+// auto originalData1 = m_pProduct->GetWaferMatrix();
|
|
|
+// }
|
|
|
+//
|
|
|
+// //qDebug() << "WaferMatrix 已同步到模型层,共同步:" << m_vecWaferMatrix.size() << "条记录。";
|
|
|
+//}
|
|
|
+
|
|
|
+
|
|
|
+//void WaferProgramPage::onCellChanged(int row, int column)
|
|
|
+//{
|
|
|
+// if (m_isInitializing) return; // 防止初始化时触发
|
|
|
+// if (row >= m_vecWaferMatrix.size()) return;
|
|
|
+//
|
|
|
+// QTableWidgetItem* item = m_MergedTable->item(row, column);
|
|
|
+// if (!item) return;
|
|
|
+//
|
|
|
+// QString value = item->text();
|
|
|
+// PROGRAM_WAFER_MATRIX_STRUCT& wafer = m_vecWaferMatrix[row];
|
|
|
+//
|
|
|
+// switch (column) {
|
|
|
+// case 0: wafer.MatrixId = value.toInt(); break;
|
|
|
+// case 1: wafer.MatrixRow = value.toInt(); break;
|
|
|
+// case 2: wafer.MatrixCol = value.toInt(); break;
|
|
|
+// case 3: wafer.LeftTopPoint.y = value.toDouble(); break;
|
|
|
+// case 4: wafer.LeftTopPoint.x = value.toDouble(); break;
|
|
|
+// case 5: wafer.RightTopPoint.x = value.toDouble(); break;
|
|
|
+// case 6: wafer.RightTopPoint.y = value.toDouble(); break;
|
|
|
+// case 7: wafer.RightBottomPoint.x = value.toDouble(); break;
|
|
|
+// case 8: wafer.RightBottomPoint.y = value.toDouble(); break;
|
|
|
+// ////case 9: wafer.iDieMatrixId = value.toInt(); break;
|
|
|
+//
|
|
|
+// case 10: {
|
|
|
+// wafer.VecNoBondPt.clear();
|
|
|
+// QRegularExpression regex(R"(\((\d+),(\d+)\))");
|
|
|
+// QRegularExpressionMatchIterator i = regex.globalMatch(value);
|
|
|
+// while (i.hasNext()) {
|
|
|
+// auto match = i.next();
|
|
|
+// XY_LONG_STRUCT pt;
|
|
|
+// pt.x = match.captured(1).toInt();
|
|
|
+// pt.y = match.captured(2).toInt();
|
|
|
+// wafer.VecNoBondPt.push_back(pt);
|
|
|
+// }
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// default: break;
|
|
|
+// }
|
|
|
+//}
|