BondMatrixProgramPage.cpp 84 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170
  1. #include "BondMatrixProgramPage.h"
  2. #include "Src/RewriteControl/Controls/SpinBox.h"
  3. #include "Src/RewriteControl/Controls/DoubleSpinBox.h"
  4. #include <QPushButton>
  5. #include <QtWidgets/qmessagebox.h>
  6. #include <View/die-bonder-ui/Src/MatrixDialogs/NoBondPtEditDialog.h>
  7. //#include <Module/Module/Resources/database/CProduct.h>
  8. BondMatrixProgramPage::BondMatrixProgramPage(QWidget* parent) :
  9. QWidget(parent)
  10. {
  11. ui.setupUi(this);
  12. ui.pushButtonSave->setProperty("type", "save");
  13. ui.pushButtonAddOutMatrix->setProperty("type", "addOutMatrix");
  14. ui.pushButtonSaveParaAs->setProperty("type", "saveParaAs");
  15. ui.pushButtonSavePara->setProperty("type", "savePara");
  16. setStyleSheet(
  17. "QWidget { background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #F1F4FD, stop: 1 #E5E4F6); }"
  18. "QDoubleSpinBox { background: #FFFFFF; border: 1px solid #BABBDC; border-radius: 6px; padding: 2px 5px; }"
  19. "QSpinBox { background: #FFFFFF; border: 1px solid #BABBDC; border-radius: 6px; padding: 2px 5px; }"
  20. "QLineEdit { background: #FFFFFF; border: 1px solid #BABBDC; border-radius: 6px; padding: 2px 5px; }"
  21. "QCheckBox::indicator { width: 20px; height: 20px; }"
  22. "QCheckBox::indicator:unchecked { background-color: #FFFFFF; border-radius: 2px; }"
  23. "QComboBox { background: #FFFFFF; border: 1px solid #BABBDC; border-radius: 6px; padding: 2px 5px; }"
  24. "QComboBox::drop-down { width: 20px; }"
  25. "QPushButton { background: #D0D0E8; border: 1px solid #BABBDC; border-radius: 6px; padding: 2px 5px; }" // Button background color
  26. "QPushButton:hover { background-color: #B0B0D8; }" // Lighter color on hover
  27. "QPushButton:pressed { background-color: #A0A0C8; }" // Darker color on press
  28. );
  29. m_manageDB = CManageDB::GetInstance();
  30. if (m_manageDB == nullptr) return;
  31. m_pProduct = m_manageDB->GetCProduct();
  32. if (m_pProduct == nullptr) return;
  33. m_pProgramCViewInterface = ns_module::CViewInterface::GetInstance();
  34. ui.frame->setFrameShape(QFrame::NoFrame); // 移除默认框架
  35. ui.frame->setFixedHeight(2); // 设置固定高度
  36. ui.frame->setStyleSheet("background-color: #C7CAEB;");
  37. //ui.tab->setStyleSheet("background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #F1F4FD, stop: 1 #E5E4F6)");
  38. //从后端获取数据
  39. m_vectBondMatrixs = m_manageDB->GetCProduct()->GetBondMatrix();
  40. m_manageDB->GetCProduct()->GetAllPointMatrix(m_vecSubMatrixs);
  41. m_vecBondInfoData = m_manageDB->GetCProduct()->GetAllBondInfoData();
  42. if (m_vectBondMatrixs.size() == 0)
  43. {
  44. return;
  45. }
  46. initPage();
  47. connect(ui.pushButtonSave, &QPushButton::clicked, this, [=] {
  48. MatrixChangeEvent();
  49. CBondMatrix* pBondMatrix = CResources::GetInstance()->GetBondMatrix();
  50. pBondMatrix->LoadMatrix(BOND_DIR::OrderAndS);
  51. });
  52. connect(ui.pushButtonAddOutMatrix, &QPushButton::clicked, this, [=]() {
  53. PROGRAM_BOND_MATRIX_STRUCT newMatrix;
  54. //排序
  55. std::sort(m_vectBondMatrixs.begin(), m_vectBondMatrixs.end(),
  56. [](const PROGRAM_BOND_MATRIX_STRUCT& a, const PROGRAM_BOND_MATRIX_STRUCT& b) {
  57. return a.BondMatrixId < b.BondMatrixId;
  58. });
  59. int newBondMatrixID = 0;
  60. UINT maxID = 0;
  61. // 查找最大 MatrixId
  62. for (PROGRAM_BOND_MATRIX_STRUCT& bondMatrix : m_vectBondMatrixs)
  63. {
  64. if (bondMatrix.BondMatrixId > maxID)
  65. {
  66. maxID = bondMatrix.BondMatrixId;
  67. }
  68. }
  69. newBondMatrixID = ++maxID;
  70. while (std::any_of(m_vectBondMatrixs.begin(), m_vectBondMatrixs.end(),
  71. [newBondMatrixID](const PROGRAM_BOND_MATRIX_STRUCT& bondMatrix) {
  72. return bondMatrix.BondMatrixId == newBondMatrixID;
  73. }))
  74. {
  75. newBondMatrixID++; // 如果生成的 ID 已经存在,递增直到找到唯一的 ID
  76. }
  77. newMatrix.BondMatrixId = newBondMatrixID;
  78. newMatrix.BondMatrixRow = 0;
  79. newMatrix.BondMatrixCol = 0;
  80. newMatrix.strModuleName = "BondHead";
  81. newMatrix.iModuleId = MODULE_LIST::BondHead;
  82. int newVectorIndex = m_vectBondMatrixs.size();
  83. newMatrix.BondInfoId = 1;
  84. //std::vector<PROGRAM_POINT_MATRIX_STRUCT> newVecSubMatrix;
  85. m_vectBondMatrixs.push_back(newMatrix);
  86. AddOutMatrixPage(newVectorIndex, newMatrix, m_vecSubMatrixs);
  87. //AddOutMatrixPage(0, m_vectBondMatrixs[0], m_vecSubMatrixs);
  88. ui.comboBoxCurrentMatrix->clear();
  89. for (int i = 0; i < m_vectBondMatrixs.size(); i++)
  90. {
  91. // 显示 矩阵编号
  92. int _bondMatrixId = m_vectBondMatrixs[i].BondMatrixId;
  93. QString itemText = QString::number(_bondMatrixId);
  94. // 将 矩阵编号 添加到下拉框
  95. ui.comboBoxCurrentMatrix->addItem(itemText,_bondMatrixId);
  96. }
  97. ShowCurrentMatrix(m_vectBondMatrixs[m_vectBondMatrixs.size()-1].BondMatrixId);
  98. });
  99. connect(ui.pushButtonSavePara, &QPushButton::clicked, this, [=] {
  100. MatrixChangeEvent();
  101. ParamChangeEvent();
  102. CBondMatrix* pBondMatrix = CResources::GetInstance()->GetBondMatrix();
  103. pBondMatrix->LoadMatrix(BOND_DIR::OrderAndS);
  104. });
  105. //BondInfo另存为
  106. connect(ui.pushButtonSaveParaAs, &QPushButton::clicked, this, [=] {
  107. BondInfoParamSaveAsEvent();
  108. CBondMatrix* pBondMatrix = CResources::GetInstance()->GetBondMatrix();
  109. pBondMatrix->LoadMatrix(BOND_DIR::OrderAndS);
  110. });
  111. // 取晶头取晶 - 连接按钮点击事件
  112. connect(ui.pushButtonSaveAsPick1, &QPushButton::clicked, this, [=]() {
  113. ParamSaveAsEvent(m_curWaferPickParam); // 传入取晶头取晶的参数
  114. });
  115. // 中转台取晶 - 连接按钮点击事件
  116. connect(ui.pushButtonSaveAsPick2, &QPushButton::clicked, this, [=]() {
  117. ParamSaveAsEvent(m_curCalibPickParam); // 传入中转台取晶的参数
  118. });
  119. // 中转台固晶 - 连接按钮点击事件
  120. connect(ui.pushButtonSaveAsPlace1, &QPushButton::clicked, this, [=]() {
  121. ParamSaveAsEvent(m_curCalibPlaceParam); // 传入中转台固晶的参数
  122. });
  123. // 固晶台固晶 - 连接按钮点击事件
  124. connect(ui.pushButtonSaveAsPlace2, &QPushButton::clicked, this, [=]() {
  125. ParamSaveAsEvent(m_curBondParam); // 传入固晶台固晶的参数
  126. });
  127. connect(ui.comboBoxCurrentMatrix, SIGNAL(currentIndexChanged(int)), this, SLOT(onComboBoxCurrentMatrixChanged(int)));
  128. connect(ui.comboBoxCurrentPara, SIGNAL(currentIndexChanged(int)), this, SLOT(onComboBoxIndexChangedForParam(int)));
  129. ui.comboBoxCurrentPara->installEventFilter(this);
  130. //参数
  131. connect(ui.comboBoxDieSource, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [=](int index) {
  132. if (index == 0)
  133. {
  134. m_curBondInfo.eDieSource = DIE_SOURCE::BY_WAFFLE;
  135. }
  136. else if (index == 1)
  137. {
  138. m_curBondInfo.eDieSource = DIE_SOURCE::BY_WAFER;
  139. }
  140. //ParamChangeEvent();
  141. });
  142. connect(ui.checkBoxIsCalib, &QCheckBox::clicked, this, [=](bool isChecked) {
  143. });
  144. connect(ui.spinBoxDieHeight, &DoubleSpinBox::editDone, this, [=]() {
  145. m_curBondInfo.dDieHeight = ui.spinBoxDieHeight->value();
  146. //ParamChangeEvent();
  147. });
  148. connect(ui.spinBoxPickNozzleID, &SpinBox::editDone, this, [=]() {
  149. m_curBondInfo.iPickHeadId = ui.spinBoxPickNozzleID->value();
  150. //ParamChangeEvent();
  151. });
  152. connect(ui.comboBoxPostBondTemp, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, [=](int index) {
  153. if (m_assss)
  154. {
  155. return;
  156. }
  157. m_curBondInfo.iBondBackPRStrategyId = ui.comboBoxPostBondTemp->currentData().toInt();
  158. //ParamChangeEvent();
  159. });
  160. connect(ui.comboBoxPickTempID, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, [=](int index) {
  161. if (m_assss)
  162. {
  163. return;
  164. }
  165. m_curBondInfo.iPickPRStrategyId = ui.comboBoxPickTempID->currentData().toInt();
  166. //ParamChangeEvent();
  167. });
  168. connect(ui.comboBoxPreBondTemp, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, [=](int index) {
  169. if (m_assss)
  170. {
  171. return;
  172. }
  173. m_curBondInfo.iBondFrontPRStrategyId = ui.comboBoxPreBondTemp->currentData().toInt();
  174. //ParamChangeEvent();
  175. });
  176. connect(ui.comboBoxBondTemp, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, [=](int index) {
  177. if (m_assss)
  178. {
  179. return;
  180. }
  181. m_curBondInfo.iBondAlnPRStrategyId = ui.comboBoxBondTemp->currentData().toInt();
  182. //ParamChangeEvent();
  183. });
  184. connect(ui.comboBoxLookUpTemp, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, [=](int index) {
  185. if (m_assss)
  186. {
  187. return;
  188. }
  189. m_curBondInfo.iLookUpPRStrategyId = ui.comboBoxLookUpTemp->currentData().toInt();
  190. //ParamChangeEvent();
  191. });
  192. connect(ui.comboBoxCalibPickTemp, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, [=](int index) {
  193. if (m_assss)
  194. {
  195. return;
  196. }
  197. m_curBondInfo.iCalibPRStrategyId = ui.comboBoxCalibPickTemp->currentData().toInt();
  198. //ParamChangeEvent();
  199. });
  200. //取/固晶参数集修改
  201. connect(ui.comboBoxCurrentPara_Pick1, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, [=](int index) {
  202. if (m_assss) {
  203. return;
  204. }
  205. m_curBondInfo.iPickParamId = ui.comboBoxCurrentPara_Pick1->currentData().toInt();
  206. m_manageDB->GetCProduct()->GetBondParam(m_curBondInfo.iPickParamId, m_curWaferPickParam);
  207. UpdatePagePickPlaceParam();
  208. });
  209. connect(ui.comboBoxCurrentPara_Pick2, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, [=](int index) {
  210. if (m_assss) {
  211. return;
  212. }
  213. m_curBondInfo.iCalibPickParamId = ui.comboBoxCurrentPara_Pick2->currentData().toInt();
  214. m_manageDB->GetCProduct()->GetBondParam(m_curBondInfo.iCalibPickParamId, m_curCalibPickParam);
  215. UpdatePagePickPlaceParam();
  216. });
  217. connect(ui.comboBoxCurrentPara_Place1, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, [=](int index) {
  218. if (m_assss) {
  219. return;
  220. }
  221. m_curBondInfo.iCalibBondParamId = ui.comboBoxCurrentPara_Place1->currentData().toInt();
  222. m_manageDB->GetCProduct()->GetBondParam(m_curBondInfo.iCalibBondParamId, m_curCalibPlaceParam);
  223. UpdatePagePickPlaceParam();
  224. });
  225. connect(ui.comboBoxCurrentPara_Place2, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, [=](int index) {
  226. if (m_assss) {
  227. return;
  228. }
  229. m_curBondInfo.iBondParamId = ui.comboBoxCurrentPara_Place2->currentData().toInt();
  230. m_manageDB->GetCProduct()->GetBondParam(m_curBondInfo.iBondParamId, m_curBondParam);
  231. UpdatePagePickPlaceParam();
  232. });
  233. // Connect buttons to slots
  234. connect(ui.SetParamPickTemp, &QPushButton::clicked, this, &BondMatrixProgramPage::onSetParamPickTempClicked);
  235. connect(ui.SetParamPreBond, &QPushButton::clicked, this, &BondMatrixProgramPage::onSetParamPreBondClicked);
  236. connect(ui.SetParamPostBond, &QPushButton::clicked, this, &BondMatrixProgramPage::onSetParamPostBondClicked);
  237. connect(ui.SetParamBond, &QPushButton::clicked, this, &BondMatrixProgramPage::onSetParamBondClicked);
  238. connect(ui.SetParamLookUp, &QPushButton::clicked, this, &BondMatrixProgramPage::onSetParamLookUpClicked);
  239. connect(ui.SetParamCalibPick, &QPushButton::clicked, this, &BondMatrixProgramPage::onSetParamCalibPickClicked);
  240. connect(ui.CreatParamPickTemp, &QPushButton::clicked, this, &BondMatrixProgramPage::onCreateParamPickTempClicked);
  241. connect(ui.CreatParamPreBond, &QPushButton::clicked, this, &BondMatrixProgramPage::onCreateParamPreBondClicked);
  242. connect(ui.CreatParamPostBond, &QPushButton::clicked, this, &BondMatrixProgramPage::onCreateParamPostBondClicked);
  243. connect(ui.CreatParamBond, &QPushButton::clicked, this, &BondMatrixProgramPage::onCreateParamBondClicked);
  244. connect(ui.CreatParamLookUp, &QPushButton::clicked, this, &BondMatrixProgramPage::onCreateParamLookUpClicked);
  245. connect(ui.CreatParamCalibPick, &QPushButton::clicked, this, &BondMatrixProgramPage::onCreateParamCalibPickClicked);
  246. connect(ui.spinBoxBondNozzleID, &SpinBox::editDone, this, [=]() {
  247. m_curBondInfo.iBondHeadId = ui.spinBoxBondNozzleID->value();
  248. ParamChangeEvent();
  249. });
  250. connect(ui.doubleSpinBoxBondOffsetX, &DoubleSpinBox::editDone, this, [=]() {
  251. m_curBondInfo.stOffset.x = ui.doubleSpinBoxBondOffsetX->value();
  252. ParamChangeEvent();
  253. });
  254. connect(ui.doubleSpinBoxBondOffsetY, &DoubleSpinBox::editDone, this, [=]() {
  255. m_curBondInfo.stOffset.y = ui.doubleSpinBoxBondOffsetY->value();
  256. ParamChangeEvent();
  257. });
  258. connect(ui.doubleSpinBoxBondOffsetAngle, &DoubleSpinBox::editDone, this, [=]() {
  259. m_curBondInfo.stOffset.a = ui.doubleSpinBoxBondOffsetAngle->value();
  260. ParamChangeEvent();
  261. });
  262. // 初始化取晶控件连接
  263. connectWaferPickControls();
  264. connectCalibPickControls();
  265. // 初始化放晶控件连接
  266. connectCalibPlaceControls();
  267. connectBondControls();
  268. }
  269. BondMatrixProgramPage::~BondMatrixProgramPage()
  270. {
  271. }
  272. // 取晶头取晶参数连接
  273. void BondMatrixProgramPage::connectWaferPickControls()
  274. {
  275. connect(ui.checkBoxPickBlockCheck, &QCheckBox::clicked, this, [=](bool isChecked) {
  276. m_curWaferPickParam.bCheckBlock = ui.checkBoxPickBlockCheck->isChecked();
  277. });
  278. connect(ui.checkBoxPickLoseCheck, &QCheckBox::clicked, this, [=](bool isChecked) {
  279. m_curWaferPickParam.bCheckLose = ui.checkBoxPickLoseCheck->isChecked();
  280. });
  281. connect(ui.checkBoxPickFindForceCheck, &QCheckBox::clicked, this, [=](bool isChecked) {
  282. m_curWaferPickParam.bFindForce = ui.checkBoxPickFindForceCheck->isChecked();
  283. //ui.doubleSpinBoxPrePickZ->setEnabled(!isChecked); // Disable when checked, enable when unchecked
  284. ui.doubleSpinBoxPickPosZ->setEnabled(!isChecked);
  285. });
  286. connect(ui.doubleSpinBoxPrePickZ, &DoubleSpinBox::editDone, this, [=]() {
  287. m_curWaferPickParam.dPreLevOffset = ui.doubleSpinBoxPrePickZ->value();
  288. });
  289. connect(ui.doubleSpinBoxPickForce, &DoubleSpinBox::editDone, this, [=]() {
  290. m_curWaferPickParam.dForce = ui.doubleSpinBoxPickForce->value();
  291. });
  292. connect(ui.doubleSpinBoxPickPosZ, &DoubleSpinBox::editDone, this, [=]() {
  293. m_curWaferPickParam.dWorkLevOffset = ui.doubleSpinBoxPickPosZ->value();
  294. });
  295. connect(ui.spinBoxPickGrabDelay, &SpinBox::editDone, this, [=]() {
  296. m_curWaferPickParam.iGrabDelay = ui.spinBoxPickGrabDelay->value();
  297. });
  298. connect(ui.spinBox_PickDelay, &SpinBox::editDone, this, [=]() {
  299. m_curWaferPickParam.iPickOrBondDelay = ui.spinBox_PickDelay->value();
  300. });
  301. connect(ui.spinBoxPickBlockCheckDelay, &SpinBox::editDone, this, [=]() {
  302. m_curWaferPickParam.iBlockOrLoseDelay = ui.spinBoxPickBlockCheckDelay->value();
  303. });
  304. connect(ui.spinBoxPickVacDelay, &SpinBox::editDone, this, [=]() {
  305. m_curWaferPickParam.iVacuumDelay = ui.spinBoxPickVacDelay->value();
  306. });
  307. connect(ui.spinBoxPickBlowDelay, &SpinBox::editDone, this, [=]() {
  308. m_curWaferPickParam.iBlowDelay = ui.spinBoxPickBlowDelay->value();
  309. });
  310. }
  311. // 晶圆台取晶连接控件
  312. void BondMatrixProgramPage::connectCalibPickControls()
  313. {
  314. connect(ui.checkBoxPickBlockCheck_2, &QCheckBox::clicked, this, [=](bool isChecked) {
  315. m_curCalibPickParam.bCheckBlock = ui.checkBoxPickBlockCheck_2->isChecked();
  316. });
  317. connect(ui.checkBoxPickLoseCheck_2, &QCheckBox::clicked, this, [=](bool isChecked) {
  318. m_curCalibPickParam.bCheckLose = ui.checkBoxPickLoseCheck_2->isChecked();
  319. });
  320. connect(ui.checkBoxPickFindForceCheck_2, &QCheckBox::clicked, this, [=](bool isChecked) {
  321. m_curCalibPickParam.bFindForce = ui.checkBoxPickFindForceCheck_2->isChecked();
  322. //ui.doubleSpinBoxPrePickZ_2->setEnabled(!isChecked); // Disable when checked, enable when unchecked
  323. ui.doubleSpinBoxPickPosZ_2->setEnabled(!isChecked);
  324. });
  325. connect(ui.doubleSpinBoxPrePickZ_2, &DoubleSpinBox::editDone, this, [=]() {
  326. m_curCalibPickParam.dPreLevOffset = ui.doubleSpinBoxPrePickZ_2->value();
  327. });
  328. connect(ui.doubleSpinBoxPickForce_2, &DoubleSpinBox::editDone, this, [=]() {
  329. m_curCalibPickParam.dForce = ui.doubleSpinBoxPickForce_2->value();
  330. });
  331. connect(ui.doubleSpinBoxPickPosZ_2, &DoubleSpinBox::editDone, this, [=]() {
  332. m_curCalibPickParam.dWorkLevOffset = ui.doubleSpinBoxPickPosZ_2->value();
  333. });
  334. connect(ui.spinBoxPickGrabDelay_2, &SpinBox::editDone, this, [=]() {
  335. m_curCalibPickParam.iGrabDelay = ui.spinBoxPickGrabDelay_2->value();
  336. });
  337. connect(ui.spinBox_PickDelay_2, &SpinBox::editDone, this, [=]() {
  338. m_curCalibPickParam.iPickOrBondDelay = ui.spinBox_PickDelay_2->value();
  339. });
  340. connect(ui.spinBoxPickBlockCheckDelay_2, &SpinBox::editDone, this, [=]() {
  341. m_curCalibPickParam.iBlockOrLoseDelay = ui.spinBoxPickBlockCheckDelay_2->value();
  342. });
  343. connect(ui.spinBoxPickVacDelay_2, &SpinBox::editDone, this, [=]() {
  344. m_curCalibPickParam.iVacuumDelay = ui.spinBoxPickVacDelay_2->value();
  345. });
  346. connect(ui.spinBoxPickBlowDelay_2, &SpinBox::editDone, this, [=]() {
  347. m_curCalibPickParam.iBlowDelay = ui.spinBoxPickBlowDelay_2->value();
  348. });
  349. }
  350. // 连接 "中转台固晶" 控件
  351. void BondMatrixProgramPage::connectCalibPlaceControls()
  352. {
  353. connect(ui.checkBoxBondBlockCheck, &QCheckBox::clicked, this, &BondMatrixProgramPage::onCheckBoxBondBlockCheckClicked);
  354. connect(ui.checkBoxBondLoseCheck, &QCheckBox::clicked, this, &BondMatrixProgramPage::onCheckBoxBondLoseCheckClicked);
  355. connect(ui.checkBoxBondFindForce, &QCheckBox::clicked, this, &BondMatrixProgramPage::onCheckBoxBondFindForceClicked);
  356. connect(ui.doubleSpinBoxPreBondPosZ, &QDoubleSpinBox::editingFinished, this, &BondMatrixProgramPage::onDoubleSpinBoxPreBondPosZEditingFinished);
  357. connect(ui.doubleSpinBoxBondForce, &QDoubleSpinBox::editingFinished, this, &BondMatrixProgramPage::onDoubleSpinBoxBondForceEditingFinished);
  358. connect(ui.doubleSpinBoxBondPosZ, &QDoubleSpinBox::editingFinished, this, &BondMatrixProgramPage::onDoubleSpinBoxBondPosZEditingFinished);
  359. connect(ui.spinBoxBondGrabDelay, &QSpinBox::editingFinished, this, &BondMatrixProgramPage::onSpinBoxBondGrabDelayEditingFinished);
  360. connect(ui.spinBoxBondBlockCheckDelay, &QSpinBox::editingFinished, this, &BondMatrixProgramPage::onSpinBoxBondBlockCheckDelayEditingFinished);
  361. connect(ui.spinBoxBondDelay, &QSpinBox::editingFinished, this, &BondMatrixProgramPage::onSpinBoxBondDelayEditingFinished);
  362. connect(ui.spinBoxBondVacDelay, &QSpinBox::editingFinished, this, &BondMatrixProgramPage::onSpinBoxBondVacDelayEditingFinished);
  363. connect(ui.spinBoxBondBlowDelay, &QSpinBox::editingFinished, this, &BondMatrixProgramPage::onSpinBoxBondBlowDelayEditingFinished);
  364. }
  365. // 连接 "固晶台固晶" 控件
  366. void BondMatrixProgramPage::connectBondControls()
  367. {
  368. connect(ui.checkBoxBondBlockCheck_2, &QCheckBox::clicked, this, &BondMatrixProgramPage::onCheckBoxBondBlockCheck_2Clicked);
  369. connect(ui.checkBoxBondLoseCheck_2, &QCheckBox::clicked, this, &BondMatrixProgramPage::onCheckBoxBondLoseCheck_2Clicked);
  370. connect(ui.checkBoxBondFindForce_2, &QCheckBox::clicked, this, &BondMatrixProgramPage::onCheckBoxBondFindForce_2Clicked);
  371. connect(ui.doubleSpinBoxPreBondPosZ_2, &QDoubleSpinBox::editingFinished, this, &BondMatrixProgramPage::onDoubleSpinBoxPreBondPosZ_2EditingFinished);
  372. connect(ui.doubleSpinBoxBondForce_2, &QDoubleSpinBox::editingFinished, this, &BondMatrixProgramPage::onDoubleSpinBoxBondForce_2EditingFinished);
  373. connect(ui.doubleSpinBoxBondPosZ_2, &QDoubleSpinBox::editingFinished, this, &BondMatrixProgramPage::onDoubleSpinBoxBondPosZ_2EditingFinished);
  374. connect(ui.spinBoxBondGrabDelay_2, &QSpinBox::editingFinished, this, &BondMatrixProgramPage::onSpinBoxBondGrabDelay_2EditingFinished);
  375. connect(ui.spinBoxBondBlockCheckDelay_2, &QSpinBox::editingFinished, this, &BondMatrixProgramPage::onSpinBoxBondBlockCheckDelay_2EditingFinished);
  376. connect(ui.spinBoxBondDelay_2, &QSpinBox::editingFinished, this, &BondMatrixProgramPage::onSpinBoxBondDelay_2EditingFinished);
  377. connect(ui.spinBoxBondVacDelay_2, &QSpinBox::editingFinished, this, &BondMatrixProgramPage::onSpinBoxBondVacDelay_2EditingFinished);
  378. connect(ui.spinBoxBondBlowDelay_2, &QSpinBox::editingFinished, this, &BondMatrixProgramPage::onSpinBoxBondBlowDelay_2EditingFinished);
  379. }
  380. //ModifyTemplate
  381. void BondMatrixProgramPage::onSetParamPickTempClicked()
  382. {
  383. int iTemplateId = ui.comboBoxPickTempID->currentData().toInt();
  384. m_pProgramCViewInterface->GetViewMatrix()->ModifyBondMatrixTemplate(iTemplateId);
  385. }
  386. void BondMatrixProgramPage::onSetParamPreBondClicked()
  387. {
  388. int iTemplateId = ui.comboBoxPreBondTemp->currentData().toInt();
  389. m_pProgramCViewInterface->GetViewMatrix()->ModifyBondMatrixTemplate(iTemplateId);
  390. }
  391. void BondMatrixProgramPage::onSetParamPostBondClicked()
  392. {
  393. int iTemplateId = ui.comboBoxPostBondTemp->currentData().toInt();
  394. m_pProgramCViewInterface->GetViewMatrix()->ModifyBondMatrixTemplate(iTemplateId);
  395. }
  396. void BondMatrixProgramPage::onSetParamBondClicked()
  397. {
  398. int iTemplateId = ui.comboBoxBondTemp->currentData().toInt();
  399. m_pProgramCViewInterface->GetViewMatrix()->ModifyBondMatrixTemplate(iTemplateId);
  400. }
  401. void BondMatrixProgramPage::onSetParamLookUpClicked()
  402. {
  403. int iTemplateId = ui.comboBoxLookUpTemp->currentData().toInt();
  404. m_pProgramCViewInterface->GetViewMatrix()->ModifyBondMatrixTemplate(iTemplateId);
  405. }
  406. void BondMatrixProgramPage::onSetParamCalibPickClicked()
  407. {
  408. int iTemplateId = ui.comboBoxCalibPickTemp->currentData().toInt();
  409. m_pProgramCViewInterface->GetViewMatrix()->ModifyBondMatrixTemplate(iTemplateId);
  410. }
  411. //CreateParam
  412. void BondMatrixProgramPage::onCreateParamPickTempClicked()
  413. {
  414. UINT iBondInfoId = ui.comboBoxCurrentPara->currentData().toUInt();
  415. m_pProgramCViewInterface->GetViewMatrix()->CreateBondMatrixTemplate(BOND_MATRIX_TEMPLATE_TYPE::TEMPLATE_WAFER_PICK, iBondInfoId);
  416. UpdateShowBondInfoData(iBondInfoId);
  417. }
  418. void BondMatrixProgramPage::onCreateParamPreBondClicked()
  419. {
  420. UINT iBondInfoId = ui.comboBoxCurrentPara->currentData().toUInt();
  421. m_pProgramCViewInterface->GetViewMatrix()->CreateBondMatrixTemplate(BOND_MATRIX_TEMPLATE_TYPE::TEMPLATE_BONDFRONT, iBondInfoId);
  422. UpdateShowBondInfoData(iBondInfoId);
  423. }
  424. void BondMatrixProgramPage::onCreateParamPostBondClicked()
  425. {
  426. UINT iBondInfoId = ui.comboBoxCurrentPara->currentData().toUInt();
  427. m_pProgramCViewInterface->GetViewMatrix()->CreateBondMatrixTemplate(BOND_MATRIX_TEMPLATE_TYPE::TEMPLATE_BONDBACK, iBondInfoId);
  428. UpdateShowBondInfoData(iBondInfoId);
  429. }
  430. void BondMatrixProgramPage::onCreateParamBondClicked()
  431. {
  432. UINT iBondInfoId = ui.comboBoxCurrentPara->currentData().toUInt();
  433. m_pProgramCViewInterface->GetViewMatrix()->CreateBondMatrixTemplate(BOND_MATRIX_TEMPLATE_TYPE::TEMPLATE_WORKTABLE_BOND, iBondInfoId);
  434. UpdateShowBondInfoData(iBondInfoId);
  435. }
  436. void BondMatrixProgramPage::onCreateParamLookUpClicked()
  437. {
  438. UINT iBondInfoId = ui.comboBoxCurrentPara->currentData().toUInt();
  439. m_pProgramCViewInterface->GetViewMatrix()->CreateBondMatrixTemplate(BOND_MATRIX_TEMPLATE_TYPE::TEMPLATE_LOOKUP, iBondInfoId);
  440. UpdateShowBondInfoData(iBondInfoId);
  441. }
  442. void BondMatrixProgramPage::onCreateParamCalibPickClicked()
  443. {
  444. UINT iBondInfoId = ui.comboBoxCurrentPara->currentData().toUInt();
  445. m_pProgramCViewInterface->GetViewMatrix()->CreateBondMatrixTemplate(BOND_MATRIX_TEMPLATE_TYPE::TEMPLATE_TRANSFER_PICK, iBondInfoId);
  446. UpdateShowBondInfoData(iBondInfoId);
  447. }
  448. // 为华夫盒连接控件
  449. void BondMatrixProgramPage::onCheckBoxPickBlockCheckClicked(bool isChecked)
  450. {
  451. m_curWaferPickParam.bCheckBlock = isChecked;
  452. }
  453. void BondMatrixProgramPage::onCheckBoxPickLoseCheckClicked(bool isChecked)
  454. {
  455. m_curWaferPickParam.bCheckLose = isChecked;
  456. }
  457. void BondMatrixProgramPage::onCheckBoxPickFindForceCheckClicked(bool isChecked)
  458. {
  459. m_curWaferPickParam.bFindForce = isChecked;
  460. }
  461. void BondMatrixProgramPage::onDoubleSpinBoxPrePickZEditingFinished()
  462. {
  463. m_curWaferPickParam.dPreLevOffset = ui.doubleSpinBoxPrePickZ->value();
  464. }
  465. void BondMatrixProgramPage::onDoubleSpinBoxPickForceEditingFinished()
  466. {
  467. m_curWaferPickParam.dForce = ui.doubleSpinBoxPickForce->value();
  468. }
  469. void BondMatrixProgramPage::onDoubleSpinBoxPickPosZEditingFinished()
  470. {
  471. m_curWaferPickParam.dWorkLevOffset = ui.doubleSpinBoxPickPosZ->value();
  472. }
  473. void BondMatrixProgramPage::onSpinBoxPickGrabDelayEditingFinished()
  474. {
  475. m_curWaferPickParam.iGrabDelay = ui.spinBoxPickGrabDelay->value();
  476. }
  477. void BondMatrixProgramPage::onSpinBoxPickDelayEditingFinished()
  478. {
  479. m_curWaferPickParam.iPickOrBondDelay = ui.spinBox_PickDelay->value();
  480. }
  481. void BondMatrixProgramPage::onSpinBoxPickBlockCheckDelayEditingFinished()
  482. {
  483. m_curWaferPickParam.iBlockOrLoseDelay = ui.spinBoxPickBlockCheckDelay->value();
  484. }
  485. void BondMatrixProgramPage::onSpinBoxPickVacDelayEditingFinished()
  486. {
  487. m_curWaferPickParam.iVacuumDelay = ui.spinBoxPickVacDelay->value();
  488. }
  489. void BondMatrixProgramPage::onSpinBoxPickBlowDelayEditingFinished()
  490. {
  491. m_curWaferPickParam.iBlowDelay = ui.spinBoxPickBlowDelay->value();
  492. }
  493. // 中转台取晶槽函数实现
  494. void BondMatrixProgramPage::onCheckBoxPickBlockCheck_2Clicked(bool isChecked)
  495. {
  496. m_curCalibPickParam.bCheckBlock = isChecked;
  497. }
  498. void BondMatrixProgramPage::onCheckBoxPickLoseCheck_2Clicked(bool isChecked)
  499. {
  500. m_curCalibPickParam.bCheckLose = isChecked;
  501. }
  502. void BondMatrixProgramPage::onCheckBoxPickFindForceCheck_2Clicked(bool isChecked)
  503. {
  504. m_curCalibPickParam.bFindForce = isChecked;
  505. }
  506. void BondMatrixProgramPage::onDoubleSpinBoxPrePickZ_2EditingFinished()
  507. {
  508. m_curCalibPickParam.dPreLevOffset = ui.doubleSpinBoxPrePickZ_2->value();
  509. }
  510. void BondMatrixProgramPage::onDoubleSpinBoxPickForce_2EditingFinished()
  511. {
  512. m_curCalibPickParam.dForce = ui.doubleSpinBoxPickForce_2->value();
  513. }
  514. void BondMatrixProgramPage::onDoubleSpinBoxPickPosZ_2EditingFinished()
  515. {
  516. m_curCalibPickParam.dWorkLevOffset = ui.doubleSpinBoxPickPosZ_2->value();
  517. }
  518. void BondMatrixProgramPage::onSpinBoxPickGrabDelay_2EditingFinished()
  519. {
  520. m_curCalibPickParam.iGrabDelay = ui.spinBoxPickGrabDelay_2->value();
  521. }
  522. void BondMatrixProgramPage::onSpinBoxPickDelay_2EditingFinished()
  523. {
  524. m_curCalibPickParam.iPickOrBondDelay = ui.spinBox_PickDelay_2->value();
  525. }
  526. void BondMatrixProgramPage::onSpinBoxPickBlockCheckDelay_2EditingFinished()
  527. {
  528. m_curCalibPickParam.iBlockOrLoseDelay = ui.spinBoxPickBlockCheckDelay_2->value();
  529. }
  530. void BondMatrixProgramPage::onSpinBoxPickVacDelay_2EditingFinished()
  531. {
  532. m_curCalibPickParam.iVacuumDelay = ui.spinBoxPickVacDelay_2->value();
  533. }
  534. void BondMatrixProgramPage::onSpinBoxPickBlowDelay_2EditingFinished()
  535. {
  536. m_curCalibPickParam.iBlowDelay = ui.spinBoxPickBlowDelay_2->value();
  537. }
  538. // 处理 "中转台放晶" 控件的槽函数
  539. void BondMatrixProgramPage::onCheckBoxBondBlockCheckClicked(bool isChecked)
  540. {
  541. m_curCalibPlaceParam.bCheckBlock = isChecked;
  542. }
  543. void BondMatrixProgramPage::onCheckBoxBondLoseCheckClicked(bool isChecked)
  544. {
  545. m_curCalibPlaceParam.bCheckLose = isChecked;
  546. }
  547. void BondMatrixProgramPage::onCheckBoxBondFindForceClicked(bool isChecked)
  548. {
  549. m_curCalibPlaceParam.bFindForce = isChecked;
  550. //ui.doubleSpinBoxPreBondPosZ->setEnabled(!isChecked);
  551. ui.doubleSpinBoxBondPosZ->setEnabled(!isChecked);
  552. }
  553. void BondMatrixProgramPage::onDoubleSpinBoxPreBondPosZEditingFinished()
  554. {
  555. m_curCalibPlaceParam.dPreLevOffset = ui.doubleSpinBoxPreBondPosZ->value();
  556. }
  557. void BondMatrixProgramPage::onDoubleSpinBoxBondForceEditingFinished()
  558. {
  559. m_curCalibPlaceParam.dForce = ui.doubleSpinBoxBondForce->value();
  560. }
  561. void BondMatrixProgramPage::onDoubleSpinBoxBondPosZEditingFinished()
  562. {
  563. m_curCalibPlaceParam.dWorkLevOffset = ui.doubleSpinBoxBondPosZ->value();
  564. }
  565. void BondMatrixProgramPage::onSpinBoxBondGrabDelayEditingFinished()
  566. {
  567. m_curCalibPlaceParam.iGrabDelay = ui.spinBoxBondGrabDelay->value();
  568. }
  569. void BondMatrixProgramPage::onSpinBoxBondBlockCheckDelayEditingFinished()
  570. {
  571. m_curCalibPlaceParam.iBlockOrLoseDelay = ui.spinBoxBondBlockCheckDelay->value();
  572. }
  573. void BondMatrixProgramPage::onSpinBoxBondDelayEditingFinished()
  574. {
  575. m_curCalibPlaceParam.iPickOrBondDelay = ui.spinBoxBondDelay->value();
  576. }
  577. void BondMatrixProgramPage::onSpinBoxBondVacDelayEditingFinished()
  578. {
  579. m_curCalibPlaceParam.iVacuumDelay = ui.spinBoxBondVacDelay->value();
  580. }
  581. void BondMatrixProgramPage::onSpinBoxBondBlowDelayEditingFinished()
  582. {
  583. m_curCalibPlaceParam.iBlowDelay = ui.spinBoxBondBlowDelay->value();
  584. }
  585. // 处理 "固晶台固晶" 控件的槽函数
  586. void BondMatrixProgramPage::onCheckBoxBondBlockCheck_2Clicked(bool isChecked)
  587. {
  588. m_curBondParam.bCheckBlock = isChecked;
  589. }
  590. void BondMatrixProgramPage::onCheckBoxBondLoseCheck_2Clicked(bool isChecked)
  591. {
  592. m_curBondParam.bCheckLose = isChecked;
  593. }
  594. void BondMatrixProgramPage::onCheckBoxBondFindForce_2Clicked(bool isChecked)
  595. {
  596. m_curBondParam.bFindForce = isChecked;
  597. //ui.doubleSpinBoxPreBondPosZ_2->setEnabled(!isChecked);
  598. ui.doubleSpinBoxBondPosZ_2->setEnabled(!isChecked);
  599. }
  600. void BondMatrixProgramPage::onDoubleSpinBoxPreBondPosZ_2EditingFinished()
  601. {
  602. m_curBondParam.dPreLevOffset = ui.doubleSpinBoxPreBondPosZ_2->value();
  603. }
  604. void BondMatrixProgramPage::onDoubleSpinBoxBondForce_2EditingFinished()
  605. {
  606. m_curBondParam.dForce = ui.doubleSpinBoxBondForce_2->value();
  607. }
  608. void BondMatrixProgramPage::onDoubleSpinBoxBondPosZ_2EditingFinished()
  609. {
  610. m_curBondParam.dWorkLevOffset = ui.doubleSpinBoxBondPosZ_2->value();
  611. }
  612. void BondMatrixProgramPage::onSpinBoxBondGrabDelay_2EditingFinished()
  613. {
  614. m_curBondParam.iGrabDelay = ui.spinBoxBondGrabDelay_2->value();
  615. }
  616. void BondMatrixProgramPage::onSpinBoxBondBlockCheckDelay_2EditingFinished()
  617. {
  618. m_curBondParam.iBlockOrLoseDelay = ui.spinBoxBondBlockCheckDelay_2->value();
  619. }
  620. void BondMatrixProgramPage::onSpinBoxBondDelay_2EditingFinished()
  621. {
  622. m_curBondParam.iPickOrBondDelay = ui.spinBoxBondDelay_2->value();
  623. }
  624. void BondMatrixProgramPage::onSpinBoxBondVacDelay_2EditingFinished()
  625. {
  626. m_curBondParam.iVacuumDelay = ui.spinBoxBondVacDelay_2->value();
  627. }
  628. void BondMatrixProgramPage::onSpinBoxBondBlowDelay_2EditingFinished()
  629. {
  630. m_curBondParam.iBlowDelay = ui.spinBoxBondBlowDelay_2->value();
  631. }
  632. XY_DOUBLE_STRUCT BondMatrixProgramPage::BondGetAxisPosition(std::string ModuleType, XY_DOUBLE_STRUCT& pos)
  633. {
  634. /*CAxis* _Axis;
  635. CAxis::AXIS_TYPE eAxisType = _Axis->GetAxisType();*/
  636. if (m_pProgramCViewInterface == nullptr)
  637. {
  638. XY_DOUBLE_STRUCT errorPt = pos; // 可以根据需要返回一个错误状态
  639. // 弹出消息框显示位置
  640. QString positionString = QString("Unable to retrieve axis position for module type: %1").arg(QString::fromStdString(ModuleType));
  641. QMessageBox::information(this, "Axis Position Error", positionString);
  642. return errorPt;
  643. }
  644. m_pProgramCViewInterface->GetViewMotion()->GetAxisPosition(ModuleType, "X", pos.x);
  645. m_pProgramCViewInterface->GetViewMotion()->GetAxisPosition(ModuleType, "Y", pos.y);
  646. return pos;
  647. }
  648. XY_DOUBLE_STRUCT BondMatrixProgramPage::BondMoveToXYAxisPosition(std::string ModuleType, XY_DOUBLE_STRUCT& pos)
  649. {
  650. if (m_pProgramCViewInterface == nullptr)
  651. {
  652. XY_DOUBLE_STRUCT errorPt = pos; // 可以根据需要返回一个错误状态
  653. // 弹出消息框显示位置
  654. QString positionString = QString("Unable to retrieve axis position for module type: %1").arg(QString::fromStdString(ModuleType));
  655. QMessageBox::information(this, "Axis Position Error", positionString);
  656. return errorPt;
  657. }
  658. m_pProgramCViewInterface->GetViewMotion()->ModuleMoveTo(ModuleType, "X", pos.x);
  659. m_pProgramCViewInterface->GetViewMotion()->ModuleMoveTo(ModuleType, "Y", pos.y);
  660. return pos;
  661. }
  662. void BondMatrixProgramPage::AddOutMatrixPage(int vectorIndex, PROGRAM_BOND_MATRIX_STRUCT matrixData, std::vector<PROGRAM_POINT_MATRIX_STRUCT> vecSubMatrix)
  663. {
  664. int matrixNum = m_mapSubMatrixControls.size();
  665. int newMatrixID = ++matrixNum;
  666. QVector<QObject*> vecControls;
  667. QWidget* outWidget = new QWidget();
  668. QGridLayout* outMatrixGridLayout = new QGridLayout();
  669. outMatrixGridLayout->setSpacing(4);
  670. outMatrixGridLayout->setObjectName(QString::fromUtf8("Out GridLayout"));
  671. outMatrixGridLayout->setContentsMargins(0, 0, 0, 0); // 设置布局的边距为0
  672. QGridLayout* boxGridLayout = new QGridLayout();
  673. boxGridLayout->setSpacing(4);
  674. boxGridLayout->setObjectName(QString::fromUtf8("Box GridLayout"));
  675. boxGridLayout->setContentsMargins(0, 0, 0, 0); // 设置布局的边距为0
  676. QHBoxLayout* buttonLayout = new QHBoxLayout();
  677. QSpacerItem* item = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
  678. buttonLayout->addSpacerItem(item);
  679. QGroupBox* groupBox = new QGroupBox(outWidget);
  680. groupBox->setLayout(boxGridLayout);
  681. QGridLayout* matrixGridLayout = new QGridLayout();
  682. matrixGridLayout->setSpacing(4);
  683. matrixGridLayout->setObjectName(QString::fromUtf8("matrixGridLayout"));
  684. matrixGridLayout->setContentsMargins(0, 0, 0, 0); // 设置布局的边距为0
  685. // Add matrix title
  686. QLabel* labelTitle = new QLabel(outWidget);
  687. labelTitle->setObjectName(QString::fromUtf8("labelTitle"));
  688. labelTitle->setText(tr("Bond Matrix ") + QString::number(vectorIndex+1));
  689. labelTitle->setStyleSheet("color: #6A78FF;height: 30px");
  690. matrixGridLayout->addWidget(labelTitle, 0, 0, 1, 1);
  691. vecControls.push_back(labelTitle);
  692. // Add "Add Sub Matrix" button
  693. QPushButton* pushButtonAdd = new QPushButton(outWidget);
  694. pushButtonAdd->setObjectName(QString::fromUtf8("button Add"));
  695. pushButtonAdd->setText(tr("Add sub Matrix"));
  696. matrixGridLayout->addWidget(pushButtonAdd, 0, 2, 1, 3);
  697. pushButtonAdd->setProperty("type", "default");
  698. connect(pushButtonAdd, &QPushButton::clicked, this, [=]() {
  699. int newSubMatrixIndex = m_vecSubMatrixs.size();
  700. PROGRAM_POINT_MATRIX_STRUCT subMatrix;
  701. std::sort(m_vecSubMatrixs.begin(), m_vecSubMatrixs.end(),
  702. [](const PROGRAM_POINT_MATRIX_STRUCT& a, const PROGRAM_POINT_MATRIX_STRUCT& b) {
  703. return a.MatrixId < b.MatrixId;
  704. });
  705. int newSubMatrixID = 0;
  706. UINT maxID = 0;
  707. // 查找最大 MatrixId
  708. for (PROGRAM_POINT_MATRIX_STRUCT& subMatrix : m_vecSubMatrixs)
  709. {
  710. if (subMatrix.MatrixId > maxID)
  711. {
  712. maxID = subMatrix.MatrixId;
  713. }
  714. }
  715. newSubMatrixID = ++maxID;
  716. while (std::any_of(m_vecSubMatrixs.begin(), m_vecSubMatrixs.end(),
  717. [newSubMatrixID](const PROGRAM_POINT_MATRIX_STRUCT& subMatrix) {
  718. return subMatrix.MatrixId == newSubMatrixID;
  719. }))
  720. {
  721. newSubMatrixID++; // 如果生成的 ID 已经存在,递增直到找到唯一的 ID
  722. }
  723. subMatrix.MatrixId = newSubMatrixID;
  724. subMatrix.strModuleName = "BondHead";
  725. subMatrix.iModuleId = MODULE_LIST::BondHead;
  726. subMatrix.MatrixRow = 0;
  727. subMatrix.MatrixCol = 0;
  728. m_vecSubMatrixs.push_back(subMatrix);
  729. // Add the submatrix to the bond matrix's VecPointMatrixId
  730. //找大矩阵ID/Index
  731. auto currentIt = m_mapOutWidgetIndex.find(outWidget);
  732. int bondMatrixId = currentIt.value(); //迭代器 erase后currentIt被删除了
  733. //m_vectBondMatrixs[index].VecPointMatrixId.push_back(newSubMatrixID);
  734. // 遍历 m_vectBondMatrixs 找到对应的矩阵
  735. for (size_t i = 0; i < m_vectBondMatrixs.size(); ++i) {
  736. if (m_vectBondMatrixs[i].BondMatrixId == bondMatrixId) {
  737. // 找到对应的矩阵,添加新的子矩阵 ID
  738. m_vectBondMatrixs[i].VecPointMatrixId.push_back(newSubMatrixID);
  739. break; // 找到后退出循环
  740. }
  741. }
  742. AddMatrixPage(bondMatrixId, newSubMatrixIndex, subMatrix, outMatrixGridLayout);
  743. });
  744. // Add Delete Out Matrix button
  745. QPushButton* pushButtonDelete = new QPushButton(outWidget);
  746. pushButtonDelete->setObjectName(QString::fromUtf8("button delete"));
  747. pushButtonDelete->setText(tr("Delete"));
  748. matrixGridLayout->addWidget(pushButtonDelete, 0, 1, 1, 1);
  749. connect(pushButtonDelete, &QPushButton::clicked, this, [=]() {
  750. //处理index
  751. auto currentIt = m_mapOutWidgetIndex.find(outWidget);
  752. int index = currentIt.value(); //迭代器 erase后currentIt被删除了
  753. m_mapOutWidgetIndex.erase(currentIt);
  754. delete outWidget;
  755. ui.comboBoxCurrentMatrix->clear();
  756. for (int i = 0; i < m_vectBondMatrixs.size(); i++)
  757. {
  758. int bondMatrixId = m_vectBondMatrixs[i].BondMatrixId;
  759. // 显示 矩阵编号
  760. QString itemText = QString::number(bondMatrixId);
  761. if (bondMatrixId == index) {
  762. //删除缓存数据
  763. m_vectBondMatrixs.erase(m_vectBondMatrixs.begin() + i);
  764. continue;
  765. }
  766. // 将 矩阵编号 添加到下拉框
  767. ui.comboBoxCurrentMatrix->addItem(itemText, bondMatrixId);
  768. }
  769. if (!m_vectBondMatrixs.empty()) {
  770. ShowCurrentMatrix(m_vectBondMatrixs[0].BondMatrixId);
  771. }
  772. });
  773. // Add Row and Column controls
  774. QLabel* labelRow = new QLabel(outWidget);
  775. labelRow->setObjectName(QString::fromUtf8("labelRow"));
  776. labelRow->setText(tr("Row & Cow"));
  777. matrixGridLayout->addWidget(labelRow, 2, 0, 1, 1);
  778. vecControls.push_back(labelRow);
  779. SpinBox* spinBoxRow = new SpinBox(outWidget);
  780. spinBoxRow->setObjectName(QString::fromUtf8("spinBoxRow"));
  781. spinBoxRow->setFixedWidth(95); // Set fixed width to 95
  782. matrixGridLayout->addWidget(spinBoxRow, 2, 1, 1, 1);
  783. vecControls.push_back(spinBoxRow);
  784. SpinBox* spinBoxCol = new SpinBox(outWidget);
  785. spinBoxCol->setObjectName(QString::fromUtf8("spinBoxCol"));
  786. spinBoxCol->setFixedWidth(95); // Set fixed width to 95
  787. matrixGridLayout->addWidget(spinBoxCol, 2, 2, 1, 1);
  788. vecControls.push_back(spinBoxCol);
  789. // Add Left Top Position controls
  790. QLabel* labelLeftTop = new QLabel(outWidget);
  791. labelLeftTop->setObjectName(QString::fromUtf8("labelLeftTop"));
  792. labelLeftTop->setText(tr("Left Top Pos "));
  793. matrixGridLayout->addWidget(labelLeftTop, 4, 0, 1, 1);
  794. vecControls.push_back(labelLeftTop);
  795. DoubleSpinBox* doubleSpinBoxLeftTopX = new DoubleSpinBox(outWidget);
  796. doubleSpinBoxLeftTopX->setObjectName(QString::fromUtf8("doubleSpinBoxLeftTopX"));
  797. doubleSpinBoxLeftTopX->setFixedWidth(95); // Set fixed width to 95
  798. matrixGridLayout->addWidget(doubleSpinBoxLeftTopX, 4, 1, 1, 1);
  799. vecControls.push_back(doubleSpinBoxLeftTopX);
  800. DoubleSpinBox* doubleSpinBoxLeftTopY = new DoubleSpinBox(outWidget);
  801. doubleSpinBoxLeftTopY->setObjectName(QString::fromUtf8("doubleSpinBoxLeftTopY"));
  802. doubleSpinBoxLeftTopY->setFixedWidth(95); // Set fixed width to 95
  803. matrixGridLayout->addWidget(doubleSpinBoxLeftTopY, 4, 2, 1, 1);
  804. vecControls.push_back(doubleSpinBoxLeftTopY);
  805. // Add GP button for Left Top
  806. QPushButton* buttonLeftTop = new QPushButton("GP", this);
  807. buttonLeftTop->setFixedWidth(31); // Set the same width for the button
  808. matrixGridLayout->addWidget(buttonLeftTop, 4, 3, 1, 1); // Position the button next to LeftTopPos
  809. connect(buttonLeftTop, &QPushButton::clicked, this, [=]() {
  810. XY_DOUBLE_STRUCT position = BondGetAxisPosition("BondHead", m_vectBondMatrixs[vectorIndex].LeftTopPoint);
  811. doubleSpinBoxLeftTopX->setValue(position.x);
  812. doubleSpinBoxLeftTopY->setValue(position.y);
  813. });
  814. QPushButton* buttonMoveToLeftTop = new QPushButton("MT", this);
  815. buttonMoveToLeftTop->setFixedWidth(31); // Set the same width for the button
  816. matrixGridLayout->addWidget(buttonMoveToLeftTop, 4, 4, 1, 1); // Position the button next to LeftTopPos
  817. connect(buttonMoveToLeftTop, &QPushButton::clicked, this, [=]() {
  818. XY_DOUBLE_STRUCT position = BondMoveToXYAxisPosition("BondHead", m_vectBondMatrixs[vectorIndex].LeftTopPoint);
  819. });
  820. // Add Right Top Position controls
  821. QLabel* labelRightTopPos = new QLabel(outWidget);
  822. labelRightTopPos->setObjectName(QString::fromUtf8("labelRightTopPos"));
  823. labelRightTopPos->setText(tr("Right Top Pos "));
  824. matrixGridLayout->addWidget(labelRightTopPos, 5, 0, 1, 1);
  825. vecControls.push_back(labelRightTopPos);
  826. DoubleSpinBox* doubleSpinBoxRightTopX = new DoubleSpinBox(outWidget);
  827. doubleSpinBoxRightTopX->setObjectName(QString::fromUtf8("doubleSpinBoxRightTopX"));
  828. doubleSpinBoxRightTopX->setFixedWidth(95); // Set fixed width to 95
  829. matrixGridLayout->addWidget(doubleSpinBoxRightTopX, 5, 1, 1, 1);
  830. vecControls.push_back(doubleSpinBoxRightTopX);
  831. DoubleSpinBox* doubleSpinBoxRightTopY = new DoubleSpinBox(outWidget);
  832. doubleSpinBoxRightTopY->setObjectName(QString::fromUtf8("doubleSpinBoxRightTopY"));
  833. doubleSpinBoxRightTopY->setFixedWidth(95); // Set fixed width to 95
  834. matrixGridLayout->addWidget(doubleSpinBoxRightTopY, 5, 2, 1, 1);
  835. vecControls.push_back(doubleSpinBoxRightTopY);
  836. QPushButton* buttonRightTop = new QPushButton("GP", this);
  837. buttonRightTop->setFixedWidth(31); // Set the same width for the button
  838. matrixGridLayout->addWidget(buttonRightTop, 5, 3, 1, 1); // Position the button next to RightTopPos
  839. connect(buttonRightTop, &QPushButton::clicked, this, [=]() {
  840. XY_DOUBLE_STRUCT position = BondGetAxisPosition("BondHead", m_vectBondMatrixs[vectorIndex].RightTopPoint);
  841. doubleSpinBoxRightTopX->setValue(position.x);
  842. doubleSpinBoxRightTopY->setValue(position.y);
  843. });
  844. QPushButton* buttonMoveToRightTop = new QPushButton("MT", this);
  845. buttonMoveToRightTop->setFixedWidth(31);
  846. matrixGridLayout->addWidget(buttonMoveToRightTop, 5, 4, 1, 1);
  847. connect(buttonMoveToRightTop, &QPushButton::clicked, this, [=]() {
  848. XY_DOUBLE_STRUCT position = BondMoveToXYAxisPosition("BondHead", m_vectBondMatrixs[vectorIndex].RightTopPoint);
  849. });
  850. // Add Right Bottom Position controls
  851. QLabel* labelRightButtomPos = new QLabel(outWidget);
  852. labelRightButtomPos->setObjectName(QString::fromUtf8("labelRightButtomPos"));
  853. labelRightButtomPos->setText(tr("Right Buttom pos"));
  854. matrixGridLayout->addWidget(labelRightButtomPos, 6, 0, 1, 1);
  855. vecControls.push_back(labelRightButtomPos);
  856. DoubleSpinBox* doubleSpinBoxRightButtomX = new DoubleSpinBox(outWidget);
  857. doubleSpinBoxRightButtomX->setObjectName(QString::fromUtf8("doubleSpinBoxRightButtomX"));
  858. doubleSpinBoxRightButtomX->setFixedWidth(95); // Set fixed width to 95
  859. matrixGridLayout->addWidget(doubleSpinBoxRightButtomX, 6, 1, 1, 1);
  860. vecControls.push_back(doubleSpinBoxRightButtomX);
  861. DoubleSpinBox* doubleSpinBoxRightButtomY = new DoubleSpinBox(outWidget);
  862. doubleSpinBoxRightButtomY->setObjectName(QString::fromUtf8("doubleSpinBoxRightButtomY"));
  863. doubleSpinBoxRightButtomY->setFixedWidth(95); // Set fixed width to 95
  864. matrixGridLayout->addWidget(doubleSpinBoxRightButtomY, 6, 2, 1, 1);
  865. vecControls.push_back(doubleSpinBoxRightTopX);
  866. QPushButton* buttonRightButtom = new QPushButton("GP", this);
  867. buttonRightButtom->setFixedWidth(31); // Set the same width for the button
  868. matrixGridLayout->addWidget(buttonRightButtom, 6, 3, 1, 1); // Position the button next to RightBottomPos
  869. connect(buttonRightButtom, &QPushButton::clicked, this, [=]() {
  870. XY_DOUBLE_STRUCT position = BondGetAxisPosition("BondHead", m_vectBondMatrixs[vectorIndex].RightBottomPoint);
  871. doubleSpinBoxRightButtomX->setValue(position.x);
  872. doubleSpinBoxRightButtomY->setValue(position.y);
  873. });
  874. QPushButton* buttonMoveToRightButtom = new QPushButton("MT", this);
  875. buttonMoveToRightButtom->setFixedWidth(31);
  876. matrixGridLayout->addWidget(buttonMoveToRightButtom, 6, 4, 1, 1);
  877. connect(buttonMoveToRightButtom, &QPushButton::clicked, this, [=]() {
  878. XY_DOUBLE_STRUCT position = BondMoveToXYAxisPosition("BondHead", m_vectBondMatrixs[vectorIndex].RightBottomPoint);
  879. });
  880. // Add No Bond Points line edit
  881. QLabel* labelNoBondPts = new QLabel(outWidget);
  882. labelNoBondPts->setObjectName(QString::fromUtf8("labelNoBondPts"));
  883. labelNoBondPts->setText(tr("No Bond Points"));
  884. matrixGridLayout->addWidget(labelNoBondPts, 7, 0, 1, 1);
  885. vecControls.push_back(labelNoBondPts);
  886. QLineEdit* lineEditNoBondPts = new QLineEdit(outWidget);
  887. lineEditNoBondPts->setObjectName(QString::fromUtf8("lineEditNoBondPts"));
  888. matrixGridLayout->addWidget(lineEditNoBondPts, 7, 1, 1, 4);
  889. vecControls.push_back(lineEditNoBondPts);
  890. lineEditNoBondPts->setReadOnly(true);
  891. lineEditNoBondPts->setCursor(Qt::PointingHandCursor);
  892. lineEditNoBondPts->setProperty("vectorIndex", vectorIndex); // 存储索引
  893. lineEditNoBondPts->setProperty("parentMatrixIndex", -1); // 设置父矩阵的索引
  894. lineEditNoBondPts->installEventFilter(this);
  895. // Paragram line edit
  896. QLabel* labelParagram = new QLabel(outWidget);
  897. labelParagram->setObjectName(QString::fromUtf8("labelParagram"));
  898. labelParagram->setText(tr("ParagramSet"));
  899. matrixGridLayout->addWidget(labelParagram, 8, 0, 1, 1);
  900. vecControls.push_back(labelParagram);
  901. QComboBox* comboBoxParagramSet = new QComboBox(outWidget);
  902. comboBoxParagramSet->setObjectName(QString::fromUtf8("comboBoxNoBondPts"));
  903. m_mapParagramSetComboBox.insert(comboBoxParagramSet, matrixData.BondMatrixId);
  904. // 添加选项到下拉框并关联 iInfoId
  905. for (const auto& bondMatrix : m_vecBondInfoData) {
  906. // 将 iInfoId 作为显示项添加到下拉框
  907. QString itemText = QString::number(bondMatrix.iInfoId); // 显示编号 iInfoId
  908. // 添加项并使用 setData 存储 iInfoId 作为附加数据
  909. comboBoxParagramSet->addItem(itemText, bondMatrix.iInfoId);
  910. }
  911. comboBoxParagramSet->setCurrentIndex(comboBoxParagramSet->findData(matrixData.BondInfoId)); // 设置默认项
  912. ui.comboBoxCurrentPara->setCurrentIndex(ui.comboBoxCurrentPara->findData(matrixData.BondInfoId)); // 设置默认项
  913. // 将下拉框添加到布局中
  914. matrixGridLayout->addWidget(comboBoxParagramSet, 8, 1, 1, 1);
  915. // 将控件保存到 vecControls 中
  916. vecControls.push_back(comboBoxParagramSet);
  917. // 连接 QComboBox 的信号和槽
  918. connect(comboBoxParagramSet, SIGNAL(currentIndexChanged(int)), this, SLOT(onComboBoxIndexChangedForMatrixParam(int)));
  919. //connect(, SIGNAL(showPopup()), this, SLOT(onComboBoxPopup()));
  920. //connect(comboBoxParagramSet, &QComboBox::showPopup, this, &BondMatrixProgramPage::onComboBoxPopup);
  921. comboBoxParagramSet->installEventFilter(this);
  922. //QPushButton* buttonParagram = new QPushButton("ShowParagram", this);
  923. ////buttonParagram->setFixedWidth(31); // Set the same width for the button
  924. //matrixGridLayout->addWidget(buttonParagram, 8, 2, 1, 2); // Position the button next to RightBottomPos
  925. //connect(buttonParagram, &QPushButton::clicked, this, [=]() {
  926. // UpdateShowBondInfoData(m_vectBondMatrixs[vectorIndex].BondInfoId);
  927. // });
  928. QFrame* line = new QFrame(outWidget);
  929. line->setFrameShape(QFrame::NoFrame); // 移除默认框架
  930. line->setFixedHeight(2); // 设置固定高度
  931. line->setStyleSheet("background-color: #C7CAEB;");
  932. boxGridLayout->addLayout(matrixGridLayout, 2, 0);
  933. boxGridLayout->addWidget(line);
  934. //outMatrixGridLayout->addLayout(buttonLayout, 1, 0);
  935. outMatrixGridLayout->addWidget(groupBox);
  936. outWidget->setLayout(outMatrixGridLayout);
  937. ui.verticalLayout_3->addWidget(outWidget);
  938. ui.verticalLayout_3->setContentsMargins(0, 0, 0, 0); // Adjust margins if necessary
  939. ui.verticalLayout_3->setAlignment(Qt::AlignTop | Qt::AlignLeft); // Align the layout to the top-left
  940. m_mapOutWidgetIndex.insert(outWidget, matrixData.BondMatrixId);
  941. // Add Sub Matrices
  942. for (int j = 0; j < matrixData.VecPointMatrixId.size(); j++)
  943. {
  944. for (int i = 0; i < m_vecSubMatrixs.size(); i++)
  945. {
  946. if (matrixData.VecPointMatrixId[j] == m_vecSubMatrixs[i].MatrixId)
  947. {
  948. AddMatrixPage(j, i, m_vecSubMatrixs[i], outMatrixGridLayout);
  949. }
  950. }
  951. }
  952. // Add all controls and finalize layout
  953. /*outWidget->setLayout(outMatrixGridLayout);
  954. ui.scrollArea_2->setLayout(outMatrixGridLayout);*/
  955. spinBoxRow->setValue(matrixData.BondMatrixRow);
  956. spinBoxCol->setValue(matrixData.BondMatrixCol);
  957. doubleSpinBoxLeftTopX->setValue(matrixData.LeftTopPoint.x);
  958. doubleSpinBoxLeftTopY->setValue(matrixData.LeftTopPoint.y);
  959. doubleSpinBoxRightTopX->setValue(matrixData.RightTopPoint.x);
  960. doubleSpinBoxRightTopY->setValue(matrixData.RightTopPoint.y);
  961. doubleSpinBoxRightButtomX->setValue(matrixData.RightBottomPoint.x);
  962. doubleSpinBoxRightButtomY->setValue(matrixData.RightBottomPoint.y);
  963. connect(spinBoxRow, &SpinBox::editDone, this, [=]() {
  964. m_vectBondMatrixs[vectorIndex].BondMatrixRow = spinBoxRow->value();
  965. });
  966. connect(spinBoxCol, &SpinBox::editDone, this, [=]() {
  967. m_vectBondMatrixs[vectorIndex].BondMatrixCol = spinBoxCol->value();
  968. });
  969. connect(doubleSpinBoxLeftTopX, &DoubleSpinBox::editDone, this, [=]() {
  970. m_vectBondMatrixs[vectorIndex].LeftTopPoint.x = doubleSpinBoxLeftTopX->value();
  971. });
  972. connect(doubleSpinBoxLeftTopY, &DoubleSpinBox::editDone, this, [=]() {
  973. m_vectBondMatrixs[vectorIndex].LeftTopPoint.y = doubleSpinBoxLeftTopY->value();
  974. });
  975. connect(doubleSpinBoxRightTopX, &DoubleSpinBox::editDone, this, [=]() {
  976. m_vectBondMatrixs[vectorIndex].RightTopPoint.x = doubleSpinBoxRightTopX->value();
  977. });
  978. connect(doubleSpinBoxRightTopY, &DoubleSpinBox::editDone, this, [=]() {
  979. m_vectBondMatrixs[vectorIndex].RightTopPoint.y = doubleSpinBoxRightTopY->value();
  980. });
  981. connect(doubleSpinBoxRightButtomX, &DoubleSpinBox::editDone, this, [=]() {
  982. m_vectBondMatrixs[vectorIndex].RightBottomPoint.x = doubleSpinBoxRightButtomX->value();
  983. });
  984. connect(doubleSpinBoxRightButtomY, &DoubleSpinBox::editDone, this, [=]() {
  985. m_vectBondMatrixs[vectorIndex].RightBottomPoint.y = doubleSpinBoxRightButtomY->value();
  986. });
  987. connect(lineEditNoBondPts, &QLineEdit::textChanged, this, [=]() {
  988. });
  989. }
  990. void BondMatrixProgramPage::onComboBoxPopup(QComboBox* comboBox) {
  991. if (!comboBox) {
  992. return;
  993. }
  994. int currentIndex = comboBox->currentIndex(); // 获取当前选中的索引
  995. QVariant currentData = comboBox->currentData(); // 获取当前选中的附加数据(例如 iInfoId)
  996. // 清空下拉框中的所有项
  997. comboBox->clear();
  998. // 重新填充下拉框选项,并更新 QMap 中的绑定关系
  999. for (const auto& bondMatrix : m_vecBondInfoData) {
  1000. // 显示编号 iInfoId
  1001. QString itemText = QString::number(bondMatrix.iInfoId);
  1002. // 将 iInfoId 添加到下拉框
  1003. comboBox->addItem(itemText, bondMatrix.iInfoId);
  1004. }
  1005. // 恢复原来的选中项
  1006. if (currentData.isValid()) {
  1007. // 通过 currentData 恢复选中项
  1008. int index = comboBox->findData(currentData);
  1009. if (index >= 0) {
  1010. comboBox->setCurrentIndex(index); // 设置当前选中项
  1011. }
  1012. }
  1013. //UINT iInfoId = currentData.toUInt(); // 将 currentData 转换为 UINT
  1014. //UpdateShowBondInfoData(iInfoId);
  1015. }
  1016. void BondMatrixProgramPage::ShowCurrentMatrix(int bondMatrixId)
  1017. {
  1018. // 遍历 comboBox 中的项,找到与 bondMatrixId 匹配的项的索引
  1019. int index = -1;
  1020. for (int i = 0; i < ui.comboBoxCurrentMatrix->count(); ++i) {
  1021. if (ui.comboBoxCurrentMatrix->itemData(i).toInt() == bondMatrixId) {
  1022. index = i; // 找到对应的索引
  1023. break;
  1024. }
  1025. }
  1026. // 如果找到了对应的索引,则设置为当前选中的项
  1027. if (index != -1) {
  1028. ui.comboBoxCurrentMatrix->setCurrentIndex(index);
  1029. }
  1030. // 清空布局内容并隐藏之前的控件
  1031. QLayoutItem* item;
  1032. while ((item = ui.verticalLayout_3->takeAt(0)) != nullptr) {
  1033. QWidget* widget = item->widget();
  1034. if (widget) {
  1035. widget->hide(); // 隐藏控件,而不是删除它
  1036. }
  1037. delete item; // 删除布局项
  1038. }
  1039. // 查找对应矩阵的控件
  1040. QWidget* outWidget = nullptr;
  1041. // 遍历 m_mapOutWidgetIndex 查找对应的 QWidget
  1042. for (auto it = m_mapOutWidgetIndex.begin(); it != m_mapOutWidgetIndex.end(); ++it) {
  1043. if (it.value() == bondMatrixId) { // 找到对应的矩阵索引
  1044. outWidget = it.key(); // 获取对应的 QWidget
  1045. break;
  1046. }
  1047. }
  1048. // 找到并添加 outWidget
  1049. if (outWidget && ui.verticalLayout_3->indexOf(outWidget) == -1) {
  1050. ui.verticalLayout_3->addWidget(outWidget);
  1051. outWidget->show(); // 显示控件
  1052. }
  1053. // 最后加 back 一个 vSpacer
  1054. ui.verticalLayout_3->addItem(new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding));
  1055. int selectedBondInfoId = -1;
  1056. for (int i = 0; i < m_vectBondMatrixs.size(); ++i) {
  1057. if (m_vectBondMatrixs[i].BondMatrixId == bondMatrixId) {
  1058. selectedBondInfoId = m_vectBondMatrixs[i].BondInfoId;
  1059. break;
  1060. }
  1061. }
  1062. UpdateShowBondInfoData(selectedBondInfoId);
  1063. }
  1064. void BondMatrixProgramPage::onComboBoxCurrentMatrixChanged(int index)
  1065. {
  1066. // 判断 index 是否有效
  1067. if (index < 0 || index >= ui.comboBoxCurrentMatrix->count())
  1068. return;
  1069. // 获取当前选项的 bondMatrixId
  1070. int bondMatrixId = ui.comboBoxCurrentMatrix->itemData(index).toInt();
  1071. ShowCurrentMatrix(bondMatrixId); // 调用 ShowCurrentMatrix 更新显示
  1072. }
  1073. //void BondMatrixProgramPage::ShowCurrentMatrix(int bondMatrixId)
  1074. //{
  1075. // // 遍历 comboBox 中的项,找到与 bondMatrixId 匹配的项的索引
  1076. // int index = -1;
  1077. // for (int i = 0; i < ui.comboBoxCurrentMatrix->count(); ++i) {
  1078. // if (ui.comboBoxCurrentMatrix->itemData(i).toInt() == bondMatrixId) {
  1079. // index = i; // 找到对应的索引
  1080. // break;
  1081. // }
  1082. // }
  1083. //
  1084. // // 如果找到了对应的索引,则设置为当前选中的项
  1085. // if (index != -1) {
  1086. // ui.comboBoxCurrentMatrix->setCurrentIndex(index);
  1087. // }
  1088. //
  1089. // // 清光布局内容
  1090. // QLayoutItem* item;
  1091. // while ((item = ui.verticalLayout_3->takeAt(0)) != nullptr) {
  1092. // QWidget* widget = item->widget();
  1093. // if (widget) {
  1094. // widget->setParent(nullptr);
  1095. // }
  1096. // delete item;
  1097. // }
  1098. //
  1099. // // 查找对应矩阵的控件
  1100. // QWidget* outWidget = nullptr;
  1101. //
  1102. // // 遍历 m_mapOutWidgetIndex 查找对应的 QWidget
  1103. // for (auto it = m_mapOutWidgetIndex.begin(); it != m_mapOutWidgetIndex.end(); ++it) {
  1104. // if (it.value() == bondMatrixId) { // 找到对应的矩阵索引
  1105. // outWidget = it.key(); // 获取对应的 QWidget
  1106. // break;
  1107. // }
  1108. // }
  1109. //
  1110. // // 找到并添加 outWidget
  1111. // if (outWidget && ui.verticalLayout_3->indexOf(outWidget) == -1) {
  1112. // ui.verticalLayout_3->addWidget(outWidget);
  1113. // }
  1114. //
  1115. // // 最后加 back 一个 vSpacer
  1116. // ui.verticalLayout_3->addItem(new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding));
  1117. //}
  1118. //
  1119. //void BondMatrixProgramPage::onComboBoxCurrentMatrixChanged(int index)
  1120. //{
  1121. // // 判断index有效
  1122. // if (index < 0 || index >= ui.comboBoxCurrentMatrix->count())
  1123. // return;
  1124. //
  1125. // // 获取当前选项的 bondMatrixId
  1126. // int bondMatrixId = ui.comboBoxCurrentMatrix->itemData(index).toInt();
  1127. // ShowCurrentMatrix(bondMatrixId);
  1128. //}
  1129. void BondMatrixProgramPage::onComboBoxIndexChangedForMatrixParam(int index) {
  1130. // 获取当前选中的 QComboBox
  1131. QComboBox* comboBox = qobject_cast<QComboBox*>(sender());
  1132. if (!comboBox) {
  1133. return;
  1134. }
  1135. // 获取当前选中的 BondInfoId
  1136. UINT selectedBondInfoId = comboBox->currentData().toUInt();
  1137. // 获取当前 QComboBox 对应的 matrixId
  1138. int matrixId = m_mapParagramSetComboBox.value(comboBox, -1); // 从 QMap 中获取 vectorIndex
  1139. if (matrixId > 0) {
  1140. // 更新 m_vectBondMatrixs[vectorIndex].BondInfoId
  1141. for (int i = 0; i < m_vectBondMatrixs.size(); i++) {
  1142. if (m_vectBondMatrixs[i].BondMatrixId == matrixId) {
  1143. m_vectBondMatrixs[i].BondInfoId = selectedBondInfoId;
  1144. break;
  1145. }
  1146. }
  1147. }
  1148. // 调用 UpdateShowBondInfoData 更新数据
  1149. UpdateShowBondInfoData(selectedBondInfoId);
  1150. }
  1151. void BondMatrixProgramPage::onComboBoxIndexChangedForParam(int index) {
  1152. // 获取当前选中的 QComboBox
  1153. QComboBox* comboBox = qobject_cast<QComboBox*>(sender());
  1154. if (!comboBox) {
  1155. return;
  1156. }
  1157. // 获取当前选中的 BondInfoId
  1158. UINT selectedBondInfoId = comboBox->currentData().toUInt();
  1159. // 调用 UpdateShowBondInfoData 更新数据
  1160. UpdateShowBondInfoData(selectedBondInfoId);
  1161. }
  1162. void BondMatrixProgramPage::AddMatrixPage(int vectorIndex, int subVectorIndex, PROGRAM_POINT_MATRIX_STRUCT subMatrix, QGridLayout* layout)
  1163. {
  1164. QVector<QObject*> vecControls;
  1165. QWidget* subWidget = new QWidget();
  1166. QGridLayout* subGridLayout = new QGridLayout(subWidget);
  1167. subGridLayout->setSpacing(4);
  1168. subGridLayout->setObjectName(QString::fromUtf8("subGridLayout"));
  1169. //groupBox->setLayout(subGridLayout);
  1170. subGridLayout->setContentsMargins(0, 0, 0, 0); // 设置布局的边距为0
  1171. subGridLayout->setAlignment(Qt::AlignCenter);
  1172. QLabel* labelTitle = new QLabel(subWidget);
  1173. labelTitle->setObjectName(QString::fromUtf8("labelTitle"));
  1174. labelTitle->setText(tr("Sub Matrix ") + QString::number(subVectorIndex));
  1175. labelTitle->setStyleSheet("color: #808BFF;height: 30px");
  1176. subGridLayout->addWidget(labelTitle, 0, 1, 1, 1);
  1177. vecControls.push_back(labelTitle);
  1178. QPushButton* pushButtonDelete = new QPushButton(subWidget);
  1179. pushButtonDelete->setObjectName(QString::fromUtf8("button delete"));
  1180. pushButtonDelete->setText(tr("Delete"));
  1181. subGridLayout->addWidget(pushButtonDelete, 0, 3, 1, 2);
  1182. connect(pushButtonDelete, &QPushButton::clicked, this, [=]() {
  1183. //处理index
  1184. auto currentIt = m_mapSubWidgetIndex.find(subWidget);
  1185. int index = currentIt.value(); //迭代器 erase后currentIt被删除了
  1186. m_mapSubWidgetIndex.erase(currentIt);
  1187. for (auto it = m_mapSubWidgetIndex.begin(); it != m_mapSubWidgetIndex.end(); ++it)
  1188. {
  1189. if (it.value() > index)
  1190. {
  1191. //value() 返回的是副本不是引用
  1192. int newIndex = it.value() - 1;
  1193. m_mapSubWidgetIndex.insert(it.key(), newIndex);
  1194. }
  1195. }
  1196. // 子矩阵ID
  1197. int subMatrixId = m_vecSubMatrixs[index].MatrixId;
  1198. //删除缓存
  1199. m_vecSubMatrixs.erase(m_vecSubMatrixs.begin() + index);
  1200. //删除大矩阵子ID数据(遍历删除)
  1201. for (PROGRAM_BOND_MATRIX_STRUCT& matrix : m_vectBondMatrixs)
  1202. {
  1203. auto it = std::find(matrix.VecPointMatrixId.begin(), matrix.VecPointMatrixId.end(), subMatrixId);
  1204. if (it != matrix.VecPointMatrixId.end())
  1205. {
  1206. matrix.VecPointMatrixId.erase(it);
  1207. }
  1208. }
  1209. delete subWidget;
  1210. });
  1211. QLabel* labelRow = new QLabel(subWidget);
  1212. labelRow->setObjectName(QString::fromUtf8("labelRow"));
  1213. labelRow->setText(tr("Row & Cow"));
  1214. subGridLayout->addWidget(labelRow, 2, 0, 1, 1);
  1215. vecControls.push_back(labelRow);
  1216. SpinBox* spinBoxRow = new SpinBox(subWidget);
  1217. spinBoxRow->setObjectName(QString::fromUtf8("spinBoxRow"));
  1218. subGridLayout->addWidget(spinBoxRow, 2, 1, 1, 1);
  1219. vecControls.push_back(spinBoxRow);
  1220. /*QLabel* labelCol = new QLabel(subWidget);
  1221. labelCol->setObjectName(QString::fromUtf8("labelCol"));
  1222. labelCol->setText(tr("Cow "));
  1223. subGridLayout->addWidget(labelCol, 3, 0, 1, 1);
  1224. vecControls.push_back(labelCol);*/
  1225. SpinBox* spinBoxCol = new SpinBox(subWidget);
  1226. spinBoxCol->setObjectName(QString::fromUtf8("spinBoxCol"));
  1227. subGridLayout->addWidget(spinBoxCol, 2, 2, 1, 1);
  1228. vecControls.push_back(spinBoxCol);
  1229. QLabel* labelLeftTop = new QLabel(subWidget);
  1230. labelLeftTop->setObjectName(QString::fromUtf8("labelLeftTop"));
  1231. labelLeftTop->setText(tr("Left Top Pos "));
  1232. subGridLayout->addWidget(labelLeftTop, 4, 0, 1, 1);
  1233. vecControls.push_back(labelLeftTop);
  1234. DoubleSpinBox* doubleSpinBoxLeftTopX = new DoubleSpinBox(subWidget);
  1235. doubleSpinBoxLeftTopX->setObjectName(QString::fromUtf8("doubleSpinBoxLeftTopX"));
  1236. doubleSpinBoxLeftTopX->setFixedWidth(95); // Set fixed width to 95
  1237. doubleSpinBoxLeftTopX->setFixedWidth(95); // Set fixed width to 95
  1238. subGridLayout->addWidget(doubleSpinBoxLeftTopX, 4, 1, 1, 1);
  1239. vecControls.push_back(doubleSpinBoxLeftTopX);
  1240. DoubleSpinBox* doubleSpinBoxLeftTopY = new DoubleSpinBox(subWidget);
  1241. doubleSpinBoxLeftTopY->setObjectName(QString::fromUtf8("doubleSpinBoxLeftTopY"));
  1242. doubleSpinBoxLeftTopY->setFixedWidth(95); // Set fixed width to 95
  1243. subGridLayout->addWidget(doubleSpinBoxLeftTopY, 4, 2, 1, 1);
  1244. vecControls.push_back(doubleSpinBoxLeftTopY);
  1245. QLabel* labelRightTopPos = new QLabel(subWidget);
  1246. labelRightTopPos->setObjectName(QString::fromUtf8("labelRightTopPos"));
  1247. labelRightTopPos->setText(tr("Right Top Pos "));
  1248. subGridLayout->addWidget(labelRightTopPos, 5, 0, 1, 1);
  1249. vecControls.push_back(labelRightTopPos);
  1250. DoubleSpinBox* doubleSpinBoxRightTopX = new DoubleSpinBox(subWidget);
  1251. doubleSpinBoxRightTopX->setObjectName(QString::fromUtf8("doubleSpinBoxRightTopX"));
  1252. doubleSpinBoxRightTopX->setFixedWidth(95); // Set fixed width to 95
  1253. subGridLayout->addWidget(doubleSpinBoxRightTopX, 5, 1, 1, 1);
  1254. vecControls.push_back(doubleSpinBoxRightTopX);
  1255. DoubleSpinBox* doubleSpinBoxRightTopY = new DoubleSpinBox(subWidget);
  1256. doubleSpinBoxRightTopY->setObjectName(QString::fromUtf8("doubleSpinBoxRightTopY"));
  1257. doubleSpinBoxRightTopY->setFixedWidth(95); // Set fixed width to 95
  1258. subGridLayout->addWidget(doubleSpinBoxRightTopY, 5, 2, 1, 1);
  1259. vecControls.push_back(doubleSpinBoxRightTopY);
  1260. QLabel* labelRightButtomPos = new QLabel(subWidget);
  1261. labelRightButtomPos->setObjectName(QString::fromUtf8("labelRightButtomPos"));
  1262. labelRightButtomPos->setText(tr("Right Buttom pos"));
  1263. subGridLayout->addWidget(labelRightButtomPos, 6, 0, 1, 1);
  1264. vecControls.push_back(labelRightButtomPos);
  1265. DoubleSpinBox* doubleSpinBoxRightButtomX = new DoubleSpinBox(subWidget);
  1266. doubleSpinBoxRightButtomX->setObjectName(QString::fromUtf8("doubleSpinBoxRightButtomX"));
  1267. doubleSpinBoxRightButtomX->setFixedWidth(95); // Set fixed width to 95
  1268. subGridLayout->addWidget(doubleSpinBoxRightButtomX, 6, 1, 1, 1);
  1269. vecControls.push_back(doubleSpinBoxRightButtomX);
  1270. DoubleSpinBox* doubleSpinBoxRightButtomY = new DoubleSpinBox(subWidget);
  1271. doubleSpinBoxRightButtomY->setObjectName(QString::fromUtf8("doubleSpinBoxRightButtomY"));
  1272. doubleSpinBoxRightButtomY->setFixedWidth(95); // Set fixed width to 95
  1273. subGridLayout->addWidget(doubleSpinBoxRightButtomY, 6, 2, 1, 1);
  1274. vecControls.push_back(doubleSpinBoxRightTopX);
  1275. QLabel* labelNoBondPts = new QLabel(subWidget);
  1276. labelNoBondPts->setObjectName(QString::fromUtf8("labelNoBondPts"));
  1277. labelNoBondPts->setText(tr("No Bond Points"));
  1278. subGridLayout->addWidget(labelNoBondPts, 7, 0, 1, 1);
  1279. vecControls.push_back(labelNoBondPts);
  1280. QLineEdit* lineEditNoBondPts = new QLineEdit(subWidget);
  1281. lineEditNoBondPts->setObjectName(QString::fromUtf8("lineEditNoBondPts"));
  1282. lineEditNoBondPts->setReadOnly(true);
  1283. lineEditNoBondPts->setCursor(Qt::PointingHandCursor);
  1284. lineEditNoBondPts->setProperty("vectorIndex", subVectorIndex); // 存储索引
  1285. lineEditNoBondPts->setProperty("parentMatrixIndex", vectorIndex); // 设置父矩阵的索引
  1286. lineEditNoBondPts->installEventFilter(this);
  1287. subGridLayout->addWidget(lineEditNoBondPts, 7, 1, 1, 3);
  1288. vecControls.push_back(lineEditNoBondPts);
  1289. // Left Top Position X and Y
  1290. QPushButton* buttonLeftTop = new QPushButton("GP", subWidget);
  1291. buttonLeftTop->setFixedWidth(31); // 设置固定宽度
  1292. subGridLayout->addWidget(buttonLeftTop, 4, 3, 1, 1); // 添加按钮到4行3列
  1293. connect(buttonLeftTop, &QPushButton::clicked, this, [=]() {
  1294. XY_DOUBLE_STRUCT position = BondGetAxisPosition("BondHead", m_vecSubMatrixs[subVectorIndex].LeftTopPoint);
  1295. doubleSpinBoxLeftTopX->setValue(position.x); // 更新 X 轴
  1296. doubleSpinBoxLeftTopY->setValue(position.y); // 更新 Y 轴
  1297. });
  1298. QPushButton* buttonMoveToLeftTop = new QPushButton("MT", subWidget);
  1299. buttonMoveToLeftTop->setFixedWidth(31); // 设置固定宽度
  1300. subGridLayout->addWidget(buttonMoveToLeftTop, 4, 4, 1, 1); // 添加按钮到4行3列
  1301. connect(buttonMoveToLeftTop, &QPushButton::clicked, this, [=]() {
  1302. XY_DOUBLE_STRUCT position = BondMoveToXYAxisPosition("BondHead", m_vecSubMatrixs[subVectorIndex].LeftTopPoint);
  1303. });
  1304. // Right Top Position X and Y
  1305. QPushButton* buttonRightTop = new QPushButton("GP", subWidget);
  1306. buttonRightTop->setFixedWidth(31); // 设置固定宽度
  1307. subGridLayout->addWidget(buttonRightTop, 5, 3, 1, 1); // 添加按钮到5行3列
  1308. connect(buttonRightTop, &QPushButton::clicked, this, [=]() {
  1309. XY_DOUBLE_STRUCT position = BondGetAxisPosition("BondHead", m_vecSubMatrixs[subVectorIndex].RightTopPoint);
  1310. doubleSpinBoxRightTopX->setValue(position.x); // 更新 X 轴
  1311. doubleSpinBoxRightTopY->setValue(position.y); // 更新 Y 轴
  1312. });
  1313. QPushButton* buttonMoveToRightTop = new QPushButton("MT", subWidget);
  1314. buttonMoveToRightTop->setFixedWidth(31); // 设置固定宽度
  1315. subGridLayout->addWidget(buttonMoveToRightTop, 5, 4, 1, 1); // 添加按钮到4行3列
  1316. connect(buttonMoveToRightTop, &QPushButton::clicked, this, [=]() {
  1317. XY_DOUBLE_STRUCT position = BondMoveToXYAxisPosition("BondHead", m_vecSubMatrixs[subVectorIndex].RightTopPoint);
  1318. });
  1319. // Right Bottom Position X and Y
  1320. QPushButton* buttonRightButtom = new QPushButton("GP", subWidget);
  1321. buttonRightButtom->setFixedWidth(31); // 设置固定宽度
  1322. subGridLayout->addWidget(buttonRightButtom, 6, 3, 1, 1); // 添加按钮到6行3列
  1323. connect(buttonRightButtom, &QPushButton::clicked, this, [=]() {
  1324. XY_DOUBLE_STRUCT position = BondGetAxisPosition("BondHead", m_vecSubMatrixs[subVectorIndex].RightBottomPoint);
  1325. doubleSpinBoxRightButtomX->setValue(position.x); // 更新 X 轴
  1326. doubleSpinBoxRightButtomY->setValue(position.y); // 更新 Y 轴
  1327. });
  1328. QPushButton* buttonMoveToRightButtom = new QPushButton("MT", subWidget);
  1329. buttonMoveToRightButtom->setFixedWidth(31); // 设置固定宽度
  1330. subGridLayout->addWidget(buttonMoveToRightButtom, 6, 4, 1, 1); // 添加按钮到4行3列
  1331. connect(buttonMoveToRightButtom, &QPushButton::clicked, this, [=]() {
  1332. XY_DOUBLE_STRUCT position = BondMoveToXYAxisPosition("BondHead", m_vecSubMatrixs[subVectorIndex].RightBottomPoint);
  1333. });
  1334. //layout->addLayout(subGridLayout, 11, 0);
  1335. QFrame* line = new QFrame(subWidget);
  1336. line->setFrameShape(QFrame::NoFrame); // 移除默认框架
  1337. line->setFixedHeight(2); // 设置固定高度
  1338. line->setStyleSheet("background-color: #C7CAEB;");
  1339. subGridLayout->addWidget(line, 10, 0, 1, 4);
  1340. layout->addWidget(subWidget);
  1341. m_mapSubWidgetIndex.insert(subWidget, subVectorIndex);
  1342. spinBoxRow->setValue(subMatrix.MatrixRow);
  1343. spinBoxCol->setValue(subMatrix.MatrixCol);
  1344. doubleSpinBoxLeftTopX->setValue(subMatrix.LeftTopPoint.x);
  1345. doubleSpinBoxLeftTopY->setValue(subMatrix.LeftTopPoint.y);
  1346. doubleSpinBoxRightTopX->setValue(subMatrix.RightTopPoint.x);
  1347. doubleSpinBoxRightTopY->setValue(subMatrix.RightTopPoint.y);
  1348. doubleSpinBoxRightButtomX->setValue(subMatrix.RightBottomPoint.x);
  1349. doubleSpinBoxRightButtomY->setValue(subMatrix.RightBottomPoint.y);
  1350. connect(spinBoxRow, &SpinBox::editDone, this, [=]() {
  1351. auto it = m_mapSubWidgetIndex.find(subWidget);
  1352. m_vecSubMatrixs[it.value()].MatrixRow = spinBoxRow->value();
  1353. });
  1354. connect(spinBoxCol, &SpinBox::editDone, this, [=]() {
  1355. auto it = m_mapSubWidgetIndex.find(subWidget);
  1356. m_vecSubMatrixs[it.value()].MatrixCol = spinBoxCol->value();
  1357. });
  1358. connect(doubleSpinBoxLeftTopX, &DoubleSpinBox::editDone, this, [=]() {
  1359. auto it = m_mapSubWidgetIndex.find(subWidget);
  1360. m_vecSubMatrixs[it.value()].LeftTopPoint.x = doubleSpinBoxLeftTopX->value();
  1361. });
  1362. connect(doubleSpinBoxLeftTopY, &DoubleSpinBox::editDone, this, [=]() {
  1363. auto it = m_mapSubWidgetIndex.find(subWidget);
  1364. m_vecSubMatrixs[it.value()].LeftTopPoint.y = doubleSpinBoxLeftTopY->value();
  1365. });
  1366. connect(doubleSpinBoxRightTopX, &DoubleSpinBox::editDone, this, [=]() {
  1367. auto it = m_mapSubWidgetIndex.find(subWidget);
  1368. m_vecSubMatrixs[it.value()].RightTopPoint.x = doubleSpinBoxRightTopX->value();
  1369. });
  1370. connect(doubleSpinBoxRightTopY, &DoubleSpinBox::editDone, this, [=]() {
  1371. auto it = m_mapSubWidgetIndex.find(subWidget);
  1372. m_vecSubMatrixs[it.value()].RightTopPoint.y = doubleSpinBoxRightTopY->value();
  1373. });
  1374. connect(doubleSpinBoxRightButtomX, &DoubleSpinBox::editDone, this, [=]() {
  1375. auto it = m_mapSubWidgetIndex.find(subWidget);
  1376. m_vecSubMatrixs[it.value()].RightBottomPoint.x = doubleSpinBoxRightButtomX->value();
  1377. });
  1378. connect(doubleSpinBoxRightButtomY, &DoubleSpinBox::editDone, this, [=]() {
  1379. auto it = m_mapSubWidgetIndex.find(subWidget);
  1380. m_vecSubMatrixs[it.value()].RightBottomPoint.y = doubleSpinBoxRightButtomY->value();
  1381. });
  1382. connect(lineEditNoBondPts, &QLineEdit::textChanged, this, [=]() {
  1383. auto it = m_mapSubWidgetIndex.find(subWidget);
  1384. });
  1385. }
  1386. bool BondMatrixProgramPage::eventFilter(QObject* obj, QEvent* event) {
  1387. // 捕获鼠标点击事件(QEvent::MouseButtonPress)
  1388. if (event->type() == QEvent::MouseButtonPress) {
  1389. auto* comboBox = qobject_cast<QComboBox*>(obj);
  1390. if (comboBox) {
  1391. // 当 QComboBox 被点击时执行 onComboBoxPopup()
  1392. onComboBoxPopup(comboBox);
  1393. return false; // 拦截事件,防止进一步传播
  1394. }
  1395. // 处理 QLineEdit 的点击事件
  1396. auto* lineEdit = qobject_cast<QLineEdit*>(obj);
  1397. if (lineEdit) {
  1398. int index = lineEdit->property("vectorIndex").toInt(); // 当前矩阵索引
  1399. int parentIndex = lineEdit->property("parentMatrixIndex").toInt(); // 父矩阵索引
  1400. onNoBondPtsClicked(lineEdit, index, parentIndex); // 传递父矩阵索引
  1401. return true; // 拦截事件
  1402. }
  1403. }
  1404. return QWidget::eventFilter(obj, event);
  1405. }
  1406. void BondMatrixProgramPage::onNoBondPtsClicked(QLineEdit* lineEdit, int index, int parentIndex) {
  1407. if (parentIndex != -1)
  1408. {
  1409. // 处理子矩阵的操作
  1410. if (index < 0 || index >= m_vecSubMatrixs.size()) return;
  1411. const auto& subMatrix = m_vecSubMatrixs[index];
  1412. NoBondPtEditDialog dlg(subMatrix.MatrixRow, subMatrix.MatrixCol, subMatrix.VecNoBondPt, this);
  1413. if (dlg.exec() == QDialog::Accepted)
  1414. {
  1415. QVector<XY_LONG_STRUCT> selected = dlg.getSelectedPoints();
  1416. m_vecSubMatrixs[index].VecNoBondPt = std::vector<XY_LONG_STRUCT>(selected.begin(), selected.end());
  1417. QStringList ptList;
  1418. for (const auto& pt : selected)
  1419. ptList << QString("(%1,%2)").arg(pt.x).arg(pt.y);
  1420. lineEdit->setText(ptList.join(" "));
  1421. }
  1422. // 这里可以用 parentIndex 来关联父矩阵(即大矩阵)做相应的操作
  1423. }
  1424. else
  1425. {
  1426. // 处理大矩阵的操作
  1427. if (index < 0 || index >= m_vectBondMatrixs.size()) return;
  1428. const auto& bondMatrix = m_vectBondMatrixs[index];
  1429. NoBondPtEditDialog dlg(bondMatrix.BondMatrixRow, bondMatrix.BondMatrixCol, bondMatrix.VecNoBondPt, this);
  1430. if (dlg.exec() == QDialog::Accepted)
  1431. {
  1432. QVector<XY_LONG_STRUCT> selected = dlg.getSelectedPoints();
  1433. m_vectBondMatrixs[index].VecNoBondPt = std::vector<XY_LONG_STRUCT>(selected.begin(), selected.end());
  1434. QStringList ptList;
  1435. for (const auto& pt : selected)
  1436. ptList << QString("(%1,%2)").arg(pt.x).arg(pt.y);
  1437. lineEdit->setText(ptList.join(" "));
  1438. }
  1439. // 这里也可以用 parentIndex 来关联父矩阵(即大矩阵)做相应的操作
  1440. }
  1441. }
  1442. void BondMatrixProgramPage::AddMatrixParam()
  1443. {
  1444. }
  1445. inline void safeSetComboBoxIndex(QComboBox* combo, int value)
  1446. {
  1447. combo->blockSignals(true);
  1448. int idx = combo->findData(value);
  1449. if (idx >= 0) {
  1450. combo->setCurrentIndex(idx);
  1451. }
  1452. else {
  1453. // 如果没找到值,保持不变或不设置任何值
  1454. combo->setCurrentIndex(-1); // 明确不设置为第一个
  1455. }
  1456. combo->blockSignals(false);
  1457. }
  1458. void BondMatrixProgramPage::UpdatePageParam()
  1459. {
  1460. int dieSourceIndex = 0;
  1461. if (m_curBondInfo.eDieSource == DIE_SOURCE::BY_WAFER)
  1462. {
  1463. dieSourceIndex = 1;
  1464. }
  1465. else if (m_curBondInfo.eDieSource == DIE_SOURCE::BY_WAFFLE)
  1466. {
  1467. dieSourceIndex = 0;
  1468. }
  1469. ui.comboBoxDieSource->setCurrentIndex(dieSourceIndex);
  1470. ui.spinBoxPickNozzleID->setValue(m_curBondInfo.iPickHeadId);
  1471. ui.spinBoxDieHeight->setValue(m_curBondInfo.dDieHeight);
  1472. m_assss = true;
  1473. // 初始化 并设置默认选项
  1474. ui.comboBoxPostBondTemp->clear();
  1475. ui.comboBoxPickTempID->clear();
  1476. ui.comboBoxPreBondTemp->clear();
  1477. ui.comboBoxBondTemp->clear();
  1478. ui.comboBoxLookUpTemp->clear();
  1479. ui.comboBoxCalibPickTemp->clear();
  1480. for (const auto& templateData : m_vecPrTemplate) {
  1481. ui.comboBoxPickTempID->addItem(QString::number(templateData.iTemplateId), templateData.iTemplateId);
  1482. ui.comboBoxPreBondTemp->addItem(QString::number(templateData.iTemplateId), templateData.iTemplateId);
  1483. ui.comboBoxBondTemp->addItem(QString::number(templateData.iTemplateId), templateData.iTemplateId);
  1484. ui.comboBoxLookUpTemp->addItem(QString::number(templateData.iTemplateId), templateData.iTemplateId);
  1485. ui.comboBoxCalibPickTemp->addItem(QString::number(templateData.iTemplateId), templateData.iTemplateId);
  1486. }
  1487. for (const auto& strategy : m_vecPrStrategy) {
  1488. ui.comboBoxPickTempID->addItem(QString::number(strategy.iStrategyId), strategy.iStrategyId);
  1489. ui.comboBoxPreBondTemp->addItem(QString::number(strategy.iStrategyId), strategy.iStrategyId);
  1490. ui.comboBoxBondTemp->addItem(QString::number(strategy.iStrategyId), strategy.iStrategyId);
  1491. ui.comboBoxLookUpTemp->addItem(QString::number(strategy.iStrategyId), strategy.iStrategyId);
  1492. ui.comboBoxCalibPickTemp->addItem(QString::number(strategy.iStrategyId), strategy.iStrategyId);
  1493. }
  1494. for (const auto& bondInspData : m_vecPrBondInsp) {
  1495. ui.comboBoxPostBondTemp->addItem(QString::number(bondInspData.iID), bondInspData.iID); // 设置数据
  1496. }
  1497. m_assss = false;
  1498. // --- PostBondTemp ---
  1499. //ui.comboBoxPostBondTemp->addItem(QString::number(m_curBondInfo.iBondBackPRStrategyId), m_curBondInfo.iBondBackPRStrategyId); // 设置数据
  1500. //int index3 = ui.comboBoxPostBondTemp->findData(m_curBondInfo.iBondBackPRStrategyId);
  1501. //ui.comboBoxPostBondTemp->setCurrentIndex(ui.comboBoxPostBondTemp->findData(m_curBondInfo.iBondBackPRStrategyId)); // 设置默认项
  1502. safeSetComboBoxIndex(ui.comboBoxPostBondTemp, m_curBondInfo.iBondBackPRStrategyId);
  1503. // --- PickTempID ---
  1504. safeSetComboBoxIndex(ui.comboBoxPickTempID, m_curBondInfo.iPickPRStrategyId);
  1505. // --- PreBondTemp ---
  1506. safeSetComboBoxIndex(ui.comboBoxPreBondTemp, m_curBondInfo.iBondFrontPRStrategyId);
  1507. // --- BondTemp ---
  1508. safeSetComboBoxIndex(ui.comboBoxBondTemp, m_curBondInfo.iBondAlnPRStrategyId);
  1509. // --- LookUpTemp ---
  1510. safeSetComboBoxIndex(ui.comboBoxLookUpTemp, m_curBondInfo.iLookUpPRStrategyId);
  1511. // --- CalibPickTemp ---
  1512. safeSetComboBoxIndex(ui.comboBoxCalibPickTemp, m_curBondInfo.iCalibPRStrategyId);
  1513. ui.doubleSpinBoxBondOffsetX->setValue(m_curBondInfo.stOffset.x);
  1514. ui.doubleSpinBoxBondOffsetY->setValue(m_curBondInfo.stOffset.y);
  1515. ui.doubleSpinBoxBondOffsetAngle->setValue(m_curBondInfo.stOffset.a);
  1516. UpdatePagePickPlaceParam();
  1517. }
  1518. void BondMatrixProgramPage::UpdatePagePickPlaceParam()
  1519. {
  1520. m_assss = true;
  1521. ui.comboBoxCurrentPara_Pick1->clear();
  1522. ui.comboBoxCurrentPara_Pick2->clear();
  1523. ui.comboBoxCurrentPara_Place1->clear();
  1524. ui.comboBoxCurrentPara_Pick2->clear();
  1525. //取/固晶参数
  1526. for (const auto& param : m_vecParam) {
  1527. ui.comboBoxCurrentPara_Pick1->addItem(QString::number(param.iId), param.iId);
  1528. ui.comboBoxCurrentPara_Pick2->addItem(QString::number(param.iId), param.iId);
  1529. ui.comboBoxCurrentPara_Place1->addItem(QString::number(param.iId), param.iId);
  1530. ui.comboBoxCurrentPara_Place2->addItem(QString::number(param.iId), param.iId);
  1531. }
  1532. m_assss = false;
  1533. // --- 取晶头取晶 ---
  1534. safeSetComboBoxIndex(ui.comboBoxCurrentPara_Pick1, m_curBondInfo.iPickParamId);
  1535. // --- 中转台取晶 ---
  1536. safeSetComboBoxIndex(ui.comboBoxCurrentPara_Pick2, m_curBondInfo.iCalibPickParamId);
  1537. // --- 中转台固晶 ---
  1538. safeSetComboBoxIndex(ui.comboBoxCurrentPara_Place1, m_curBondInfo.iCalibBondParamId);
  1539. // --- 固晶台固晶 ---
  1540. safeSetComboBoxIndex(ui.comboBoxCurrentPara_Place2, m_curBondInfo.iBondParamId);
  1541. UpdatePagePickParam();
  1542. UpdatePageBondParam();
  1543. }
  1544. //取/固晶参数另存为
  1545. int BondMatrixProgramPage::ParamSaveAsEvent(ns_db::PICKBOND_PARAM_STRUCT &m_curToSaveAsParam)
  1546. {
  1547. int iToSaveAsParamId;
  1548. m_manageDB->GetCProduct()->AddBondParam(m_curToSaveAsParam, iToSaveAsParamId);
  1549. // 判断传入的是哪一个参数,并相应修改m_curBondInfo中的ID
  1550. if (&m_curToSaveAsParam == &m_curWaferPickParam)
  1551. {
  1552. m_curBondInfo.iPickParamId = iToSaveAsParamId;
  1553. }
  1554. else if (&m_curToSaveAsParam == &m_curCalibPlaceParam)
  1555. {
  1556. m_curBondInfo.iCalibBondParamId = iToSaveAsParamId;
  1557. }
  1558. else if (&m_curToSaveAsParam == &m_curCalibPickParam)
  1559. {
  1560. m_curBondInfo.iCalibPickParamId = iToSaveAsParamId;
  1561. }
  1562. else if (&m_curToSaveAsParam == &m_curBondParam)
  1563. {
  1564. m_curBondInfo.iBondParamId = iToSaveAsParamId;
  1565. }
  1566. m_manageDB->GetCProduct()->GetBondParam(iToSaveAsParamId, m_curToSaveAsParam);
  1567. m_vecParam.push_back(m_curToSaveAsParam);// = m_manageDB->GetCProduct()->GetAllBondInfoData();
  1568. // 填充 QComboBox
  1569. UpdatePagePickPlaceParam();
  1570. return iToSaveAsParamId;
  1571. }
  1572. //BondInfo另存为
  1573. int BondMatrixProgramPage::BondInfoParamSaveAsEvent()
  1574. {
  1575. //int iWaferPickParamId,iCalibPlaceParamId,iCalibPickParamId,iBondParamId;
  1576. //m_manageDB->GetCProduct()->AddBondParam(m_curWaferPickParam, iWaferPickParamId); //SetBondParam(m_curWaferPickParam.iId, m_curWaferPickParam);
  1577. //m_manageDB->GetCProduct()->AddBondParam(m_curCalibPlaceParam, iCalibPlaceParamId);
  1578. //m_manageDB->GetCProduct()->AddBondParam(m_curCalibPickParam, iCalibPickParamId);
  1579. //m_manageDB->GetCProduct()->AddBondParam(m_curBondParam, iBondParamId);
  1580. int iInfoId;
  1581. m_manageDB->GetCProduct()->AddBondInfoData(m_curBondInfo, iInfoId);
  1582. ns_db::BOND_INFO_STRUCT newBondInfo;
  1583. m_manageDB->GetCProduct()->GetBondInfoData(iInfoId, newBondInfo);
  1584. m_vecBondInfoData.push_back(newBondInfo);// = m_manageDB->GetCProduct()->GetAllBondInfoData();
  1585. // 填充 QComboBox
  1586. ui.comboBoxCurrentPara->clear();
  1587. for (const auto& bondMatrix : m_vecBondInfoData) {
  1588. QString itemText = QString::number(bondMatrix.iInfoId);
  1589. ui.comboBoxCurrentPara->addItem(itemText, bondMatrix.iInfoId);
  1590. }
  1591. ui.comboBoxCurrentPara->setCurrentIndex(ui.comboBoxCurrentPara->findData(iInfoId)); // 设置默认项
  1592. return iInfoId;
  1593. }
  1594. void BondMatrixProgramPage::ParamChangeEvent()
  1595. {
  1596. m_manageDB->GetCProduct()->SetBondInfoData(m_curBondInfo.iInfoId, m_curBondInfo);
  1597. m_manageDB->GetCProduct()->SetBondParam(m_curWaferPickParam.iId, m_curWaferPickParam);
  1598. m_manageDB->GetCProduct()->SetBondParam(m_curCalibPlaceParam.iId, m_curCalibPlaceParam);
  1599. m_manageDB->GetCProduct()->SetBondParam(m_curCalibPickParam.iId, m_curCalibPickParam);
  1600. m_manageDB->GetCProduct()->SetBondParam(m_curBondParam.iId, m_curBondParam);
  1601. CProduct* _Product = m_manageDB->GetCProduct();
  1602. }
  1603. void BondMatrixProgramPage::MatrixChangeEvent()
  1604. {
  1605. //TODO:此处可能有问题,可改成后端更新,没有相应ID则添加的形式
  1606. m_manageDB->GetCProduct()->SetAllBondMatrix(m_vectBondMatrixs, true);
  1607. m_manageDB->GetCProduct()->SetAllPointMatrix(m_vecSubMatrixs, true);
  1608. /*for (PROGRAM_BOND_MATRIX_STRUCT& bondMatrix : m_vectBondMatrixs)
  1609. {
  1610. m_manageDB->GetCProduct()->SetBondMatrix(bondMatrix.BondMatrixId, bondMatrix);
  1611. }*/
  1612. /*for (PROGRAM_POINT_MATRIX_STRUCT& pointMatrix : m_vecSubMatrixs)
  1613. {
  1614. m_manageDB->GetCProduct()->SetPointMatrix(pointMatrix.MatrixId, pointMatrix);
  1615. }*/
  1616. CProduct* _Product = m_manageDB->GetCProduct();
  1617. }
  1618. void BondMatrixProgramPage::UpdatePagePickParam()
  1619. {
  1620. //"取晶头取晶"
  1621. //if (ui.comboBoxPickParamType->currentIndex() == 0)
  1622. {
  1623. ui.checkBoxPickBlockCheck->setChecked(m_curWaferPickParam.bCheckBlock);
  1624. ui.checkBoxPickLoseCheck->setChecked(m_curWaferPickParam.bCheckLose);
  1625. ui.checkBoxPickFindForceCheck->setChecked(m_curWaferPickParam.bFindForce);
  1626. ui.doubleSpinBoxPrePickZ->setValue(m_curWaferPickParam.dPreLevOffset);
  1627. ui.doubleSpinBoxPickForce->setValue(m_curWaferPickParam.dForce);
  1628. ui.doubleSpinBoxPickPosZ->setValue(m_curWaferPickParam.dWorkLevOffset);
  1629. ui.spinBoxPickGrabDelay->setValue(m_curWaferPickParam.iGrabDelay);
  1630. ui.spinBox_PickDelay->setValue(m_curWaferPickParam.iPickOrBondDelay);
  1631. ui.spinBoxPickBlockCheckDelay->setValue(m_curWaferPickParam.iBlockOrLoseDelay);
  1632. ui.spinBoxPickVacDelay->setValue(m_curWaferPickParam.iVacuumDelay);
  1633. ui.spinBoxPickBlowDelay->setValue(m_curWaferPickParam.iBlowDelay);
  1634. ui.doubleSpinBoxPrePickZ->setEnabled(!ui.checkBoxPickFindForceCheck->isChecked());
  1635. ui.doubleSpinBoxPickPosZ->setEnabled(!ui.checkBoxPickFindForceCheck->isChecked());
  1636. }
  1637. //"中转台取晶"
  1638. //else if (ui.comboBoxPickParamType->currentIndex() == 1)
  1639. {
  1640. ui.checkBoxPickBlockCheck_2->setChecked(m_curCalibPickParam.bCheckBlock);
  1641. ui.checkBoxPickLoseCheck_2->setChecked(m_curCalibPickParam.bCheckLose);
  1642. ui.checkBoxPickFindForceCheck_2->setChecked(m_curCalibPickParam.bFindForce);
  1643. ui.doubleSpinBoxPrePickZ_2->setValue(m_curCalibPickParam.dPreLevOffset);
  1644. ui.doubleSpinBoxPickForce_2->setValue(m_curCalibPickParam.dForce);
  1645. ui.doubleSpinBoxPickPosZ_2->setValue(m_curCalibPickParam.dWorkLevOffset);
  1646. ui.spinBoxPickGrabDelay_2->setValue(m_curCalibPickParam.iGrabDelay);
  1647. ui.spinBox_PickDelay_2->setValue(m_curCalibPickParam.iPickOrBondDelay);
  1648. ui.spinBoxPickBlockCheckDelay_2->setValue(m_curCalibPickParam.iBlockOrLoseDelay);
  1649. ui.spinBoxPickVacDelay_2->setValue(m_curCalibPickParam.iVacuumDelay);
  1650. ui.spinBoxPickBlowDelay_2->setValue(m_curCalibPickParam.iBlowDelay);
  1651. ui.doubleSpinBoxPrePickZ_2->setEnabled(!ui.checkBoxPickFindForceCheck_2->isChecked());
  1652. ui.doubleSpinBoxPickPosZ_2->setEnabled(!ui.checkBoxPickFindForceCheck_2->isChecked());
  1653. }
  1654. }
  1655. void BondMatrixProgramPage::UpdatePageBondParam()
  1656. {
  1657. //"中转台放晶"
  1658. //if (ui.comboBoxBondParamType->currentIndex() == 0)
  1659. {
  1660. ui.checkBoxBondBlockCheck->setChecked(m_curCalibPlaceParam.bCheckBlock);
  1661. ui.checkBoxBondLoseCheck->setChecked(m_curCalibPlaceParam.bCheckLose);
  1662. ui.checkBoxBondFindForce->setChecked(m_curCalibPlaceParam.bFindForce);
  1663. ui.doubleSpinBoxPreBondPosZ->setValue(m_curCalibPlaceParam.dPreLevOffset);
  1664. ui.doubleSpinBoxBondForce->setValue(m_curCalibPlaceParam.dForce);
  1665. ui.doubleSpinBoxBondPosZ->setValue(m_curCalibPlaceParam.dWorkLevOffset);
  1666. ui.spinBoxBondGrabDelay->setValue(m_curCalibPlaceParam.iGrabDelay);
  1667. ui.spinBoxBondDelay->setValue(m_curCalibPlaceParam.iPickOrBondDelay);
  1668. ui.spinBoxBondBlockCheckDelay->setValue(m_curCalibPlaceParam.iBlockOrLoseDelay);
  1669. ui.spinBoxBondVacDelay->setValue(m_curCalibPlaceParam.iVacuumDelay);
  1670. ui.spinBoxBondBlowDelay->setValue(m_curCalibPlaceParam.iBlowDelay);
  1671. ui.doubleSpinBoxPreBondPosZ->setEnabled(!ui.checkBoxBondFindForce->isChecked());
  1672. ui.doubleSpinBoxBondPosZ->setEnabled(!ui.checkBoxBondFindForce->isChecked());
  1673. }
  1674. //"固晶台固晶"
  1675. //else if (ui.comboBoxBondParamType->currentIndex() == 1)
  1676. {
  1677. ui.checkBoxBondBlockCheck_2->setChecked(m_curBondParam.bCheckBlock);
  1678. ui.checkBoxBondLoseCheck_2->setChecked(m_curBondParam.bCheckLose);
  1679. ui.checkBoxBondFindForce_2->setChecked(m_curBondParam.bFindForce);
  1680. ui.doubleSpinBoxPreBondPosZ_2->setValue(m_curBondParam.dPreLevOffset);
  1681. ui.doubleSpinBoxBondForce_2->setValue(m_curBondParam.dForce);
  1682. ui.doubleSpinBoxBondPosZ_2->setValue(m_curBondParam.dWorkLevOffset);
  1683. ui.spinBoxBondGrabDelay_2->setValue(m_curBondParam.iGrabDelay);
  1684. ui.spinBoxBondDelay_2->setValue(m_curBondParam.iPickOrBondDelay);
  1685. ui.spinBoxBondBlockCheckDelay_2->setValue(m_curBondParam.iBlockOrLoseDelay);
  1686. ui.spinBoxBondVacDelay_2->setValue(m_curBondParam.iVacuumDelay);
  1687. ui.spinBoxBondBlowDelay_2->setValue(m_curBondParam.iBlowDelay);
  1688. ui.doubleSpinBoxPreBondPosZ_2->setEnabled(!ui.checkBoxBondFindForce_2->isChecked());
  1689. ui.doubleSpinBoxBondPosZ_2->setEnabled(!ui.checkBoxBondFindForce_2->isChecked());
  1690. }
  1691. }
  1692. void BondMatrixProgramPage::initPage()
  1693. {
  1694. //for (int i = 0; i < m_vectBondMatrixs.size(); i++)
  1695. //{
  1696. // for (int j = 0; j < m_vectBondMatrixs[i].VecPointMatrixId.size(); j++)
  1697. // {
  1698. // PROGRAM_POINT_MATRIX_STRUCT subMatrix;
  1699. // m_manageDB->GetCProduct()->GetPointMatrix(m_vectBondMatrixs[i].VecPointMatrixId[j], subMatrix);
  1700. // m_vecSubMatrixs.push_back(subMatrix);
  1701. // //AddMatrixPage(i, j, subMatrix);
  1702. // }
  1703. // AddOutMatrixPage(i, m_vectBondMatrixs[i], m_vecSubMatrixs);
  1704. //}
  1705. for (int i = 0; i < m_vectBondMatrixs.size(); i++)
  1706. {
  1707. AddOutMatrixPage(i, m_vectBondMatrixs[i], m_vecSubMatrixs);
  1708. }
  1709. //for (int i = 0; i < m_vectBondMatrixs[0].VecPointMatrixId.size(); ++i)
  1710. //{
  1711. // PROGRAM_POINT_MATRIX_STRUCT subMatrix;
  1712. // m_manageDB->GetCProduct()->GetPointMatrix(m_vectBondMatrixs[0].VecPointMatrixId[i], subMatrix);
  1713. // m_vecSubMatrixs.push_back(subMatrix);
  1714. //}
  1715. //m_manageDB->GetCProduct()->GetDieMatrix(m_vectBondMatrixs[0].VecPointMatrixId[0], m_vecSubMatrixs);
  1716. ////显示矩阵数据
  1717. //ui.spinBoxRow->setValue(m_vectBondMatrixs[0].BondMatrixRow);
  1718. //ui.spinBoxCol->setValue(m_vectBondMatrixs[0].BondMatrixCol);
  1719. //ui.doubleSpinBoxLeftTopX->setValue(m_vectBondMatrixs[0].LeftTopPoint.x);
  1720. //ui.doubleSpinBoxLeftTopY->setValue(m_vectBondMatrixs[0].LeftTopPoint.y);
  1721. //ui.doubleSpinBoxRightTopX->setValue(m_vectBondMatrixs[0].RightTopPoint.x);
  1722. //ui.doubleSpinBoxRightTopY->setValue(m_vectBondMatrixs[0].RightTopPoint.y);
  1723. //ui.doubleSpinBoxRightButtomX->setValue(m_vectBondMatrixs[0].RightBottomPoint.x);
  1724. //ui.doubleSpinBoxRightButtomY->setValue(m_vectBondMatrixs[0].RightBottomPoint.y);
  1725. //QString noBondPts = "";
  1726. //bool firstTime = false;
  1727. //for (XY_LONG_STRUCT& pt : m_vectBondMatrixs[0].VecNoBondPt)
  1728. //{
  1729. // if (firstTime)
  1730. // {
  1731. // noBondPts += "(" + QString::number(pt.x) + "," + QString::number(pt.y) + ")";
  1732. // firstTime = true;
  1733. // }
  1734. // noBondPts += ";(" + QString::number(pt.x) + "," + QString::number(pt.y) + ")";
  1735. //}
  1736. //ui.lineEditNoBondPts->setText(noBondPts);
  1737. ////显示子矩阵及数据
  1738. //for (PROGRAM_POINT_MATRIX_STRUCT& subMatrix : m_vecSubMatrixs)
  1739. //{
  1740. // AddMatrixPage(subMatrix);
  1741. //}
  1742. //从后端获取参数, 一套数据
  1743. CResources* pResources = CResources::GetInstance();
  1744. if (pResources == nullptr)
  1745. {
  1746. return;
  1747. }
  1748. CBondMatrix* pBondMatrix = pResources->GetBondMatrix();
  1749. if (pBondMatrix == nullptr)
  1750. {
  1751. return;
  1752. }
  1753. //AddOutMatrixPage(0, m_vectBondMatrixs[0], m_vecSubMatrixs);
  1754. ui.comboBoxCurrentMatrix->clear();
  1755. for (int i = 0; i < m_vectBondMatrixs.size(); i++)
  1756. {
  1757. // 显示 矩阵编号
  1758. int _bondMatrixId = m_vectBondMatrixs[i].BondMatrixId;
  1759. QString itemText = QString::number(_bondMatrixId);
  1760. // 将 矩阵编号 添加到下拉框
  1761. ui.comboBoxCurrentMatrix->addItem(itemText,_bondMatrixId);
  1762. }
  1763. if (!m_vectBondMatrixs.empty()) {
  1764. ShowCurrentMatrix(m_vectBondMatrixs[0].BondMatrixId);
  1765. }
  1766. // 清空下拉框中的所有项
  1767. ui.comboBoxCurrentPara->clear();
  1768. // 重新填充下拉框选项,并更新 QMap 中的绑定关系
  1769. for (const auto& bondMatrix : m_vecBondInfoData) {
  1770. // 显示编号 iInfoId
  1771. QString itemText = QString::number(bondMatrix.iInfoId);
  1772. // 将 iInfoId 添加到下拉框
  1773. ui.comboBoxCurrentPara->addItem(itemText, bondMatrix.iInfoId);
  1774. }
  1775. UpdateShowBondInfoData(m_vectBondMatrixs[0].BondInfoId);
  1776. ////pBondMatrix->GetPintInfoByIndex(0, m_curPointInfo);
  1777. //m_manageDB->GetCProduct()->GetBondInfoData(m_vectBondMatrixs[0].BondInfoId, m_curBondInfo);
  1778. //m_manageDB->GetCProduct()->GetBondParam(m_curBondInfo.iPickParamId, m_curWaferPickParam);
  1779. //m_manageDB->GetCProduct()->GetBondParam(m_curBondInfo.iCalibBondParamId, m_curCalibPlaceParam);
  1780. //m_manageDB->GetCProduct()->GetBondParam(m_curBondInfo.iCalibPickParamId, m_curCalibPickParam);
  1781. //m_manageDB->GetCProduct()->GetBondParam(m_curBondInfo.iBondParamId, m_curBondParam);
  1782. //显示界面参数
  1783. //UpdatePageParam();
  1784. }
  1785. void BondMatrixProgramPage::UpdateShowBondInfoData(UINT iInfoId) {
  1786. if (iInfoId <= 0)return;
  1787. //pBondMatrix->GetPintInfoByIndex(0, m_curPointInfo);
  1788. m_manageDB->GetCProduct()->GetBondInfoData(iInfoId, m_curBondInfo);
  1789. m_manageDB->GetCProduct()->GetBondParam(m_curBondInfo.iPickParamId, m_curWaferPickParam);
  1790. m_manageDB->GetCProduct()->GetBondParam(m_curBondInfo.iCalibBondParamId, m_curCalibPlaceParam);
  1791. m_manageDB->GetCProduct()->GetBondParam(m_curBondInfo.iCalibPickParamId, m_curCalibPickParam);
  1792. m_manageDB->GetCProduct()->GetBondParam(m_curBondInfo.iBondParamId, m_curBondParam);
  1793. m_vecParam = m_manageDB->GetCProduct()->GetAllBondParamData();
  1794. m_vecPrTemplate = m_manageDB->GetCProduct()->GetPrTemplate();
  1795. m_vecPrStrategy = m_manageDB->GetCProduct()->GetPrStrategy();
  1796. m_vecPrBondInsp = m_manageDB->GetCProduct()->GetPrBondInsp();
  1797. ui.comboBoxCurrentPara->setCurrentIndex(ui.comboBoxCurrentPara->findData(iInfoId)); // 设置默认项
  1798. //显示界面参数
  1799. UpdatePageParam();
  1800. }