BondMatrixProgramPage.cpp 56 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473
  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. BondMatrixProgramPage::BondMatrixProgramPage(QWidget* parent) :
  8. QWidget(parent)
  9. {
  10. ui.setupUi(this);
  11. ui.pushButtonSave->setProperty("type", "save");
  12. ui.pushButtonAddOutMatrix->setProperty("type", "addOutMatrix");
  13. ui.pushButtonSaveParaAs->setProperty("type", "saveParaAs");
  14. ui.pushButtonSavePara->setProperty("type", "savePara");
  15. setStyleSheet(
  16. "QWidget { background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #F1F4FD, stop: 1 #E5E4F6); }"
  17. "QDoubleSpinBox { background: #FFFFFF; border: 1px solid #BABBDC; border-radius: 6px; padding: 2px 5px; }"
  18. "QSpinBox { background: #FFFFFF; border: 1px solid #BABBDC; border-radius: 6px; padding: 2px 5px; }"
  19. "QLineEdit { background: #FFFFFF; border: 1px solid #BABBDC; border-radius: 6px; padding: 2px 5px; }"
  20. "QCheckBox::indicator { width: 20px; height: 20px; }"
  21. "QCheckBox::indicator:unchecked { background-color: #FFFFFF; border-radius: 2px; }"
  22. "QComboBox { background: #FFFFFF; border: 1px solid #BABBDC; border-radius: 6px; padding: 2px 5px; }"
  23. "QComboBox::drop-down { width: 20px; }"
  24. "QPushButton { background: #D0D0E8; border: 1px solid #BABBDC; border-radius: 6px; padding: 2px 5px; }" // Button background color
  25. "QPushButton:hover { background-color: #B0B0D8; }" // Lighter color on hover
  26. "QPushButton:pressed { background-color: #A0A0C8; }" // Darker color on press
  27. );
  28. m_manageDB = CManageDB::GetInstance();
  29. if (m_manageDB == nullptr) return;
  30. m_pProduct = m_manageDB->GetCProduct();
  31. if (m_pProduct == nullptr) return;
  32. m_pProgramCViewInterface = ns_module::CViewInterface::GetInstance();
  33. ui.frame->setFrameShape(QFrame::NoFrame); // 移除默认框架
  34. ui.frame->setFixedHeight(2); // 设置固定高度
  35. ui.frame->setStyleSheet("background-color: #C7CAEB;");
  36. //ui.tab->setStyleSheet("background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #F1F4FD, stop: 1 #E5E4F6)");
  37. //从后端获取数据
  38. m_vectBondMatrixs = m_manageDB->GetCProduct()->GetBondMatrix();
  39. m_manageDB->GetCProduct()->GetAllPointMatrix(m_vecSubMatrixs);
  40. m_vecBondInfoData = m_manageDB->GetCProduct()->GetAllBondInfoData();
  41. if (m_vectBondMatrixs.size() == 0)
  42. {
  43. return;
  44. }
  45. initPage();
  46. connect(ui.pushButtonSave, &QPushButton::clicked, this, [=] {
  47. MatrixChangeEvent();
  48. });
  49. connect(ui.pushButtonAddOutMatrix, &QPushButton::clicked, this, [=]() {
  50. PROGRAM_BOND_MATRIX_STRUCT newMatrix;
  51. //排序
  52. std::sort(m_vectBondMatrixs.begin(), m_vectBondMatrixs.end(),
  53. [](const PROGRAM_BOND_MATRIX_STRUCT& a, const PROGRAM_BOND_MATRIX_STRUCT& b) {
  54. return a.BondMatrixId < b.BondMatrixId;
  55. });
  56. int newBondMatrixID = 0;
  57. UINT maxID = 0;
  58. // 查找最大 MatrixId
  59. for (PROGRAM_BOND_MATRIX_STRUCT& bondMatrix : m_vectBondMatrixs)
  60. {
  61. if (bondMatrix.BondMatrixId > maxID)
  62. {
  63. maxID = bondMatrix.BondMatrixId;
  64. }
  65. }
  66. newBondMatrixID = ++maxID;
  67. while (std::any_of(m_vectBondMatrixs.begin(), m_vectBondMatrixs.end(),
  68. [newBondMatrixID](const PROGRAM_BOND_MATRIX_STRUCT& bondMatrix) {
  69. return bondMatrix.BondMatrixId == newBondMatrixID;
  70. }))
  71. {
  72. newBondMatrixID++; // 如果生成的 ID 已经存在,递增直到找到唯一的 ID
  73. }
  74. newMatrix.BondMatrixId = newBondMatrixID;
  75. newMatrix.BondMatrixRow = 0;
  76. newMatrix.BondMatrixCol = 0;
  77. newMatrix.strModuleName = "UltraHead";
  78. newMatrix.iModuleId = MODULE_LIST::BondHead;
  79. int newVectorIndex = m_vectBondMatrixs.size();
  80. newMatrix.BondInfoId = 1;
  81. //std::vector<PROGRAM_POINT_MATRIX_STRUCT> newVecSubMatrix;
  82. m_vectBondMatrixs.push_back(newMatrix);
  83. AddOutMatrixPage(newVectorIndex, newMatrix, m_vecSubMatrixs);
  84. });
  85. connect(ui.pushButtonSavePara, &QPushButton::clicked, this, [=] {
  86. MatrixChangeEvent();
  87. ParamChangeEvent();
  88. });
  89. connect(ui.pushButtonSaveParaAs, &QPushButton::clicked, this, [=] {
  90. ParamSaveAsEvent();
  91. });
  92. //参数
  93. connect(ui.comboBoxDieSource, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [=](int index) {
  94. if (index == 0)
  95. {
  96. m_curBondInfo.eDieSource = DIE_SOURCE::BY_WAFFLE;
  97. }
  98. else if (index == 1)
  99. {
  100. m_curBondInfo.eDieSource = DIE_SOURCE::BY_WAFER;
  101. }
  102. //ParamChangeEvent();
  103. });
  104. connect(ui.checkBoxIsCalib, &QCheckBox::clicked, this, [=](bool isChecked) {
  105. });
  106. connect(ui.spinBoxPickTempID, &SpinBox::editDone, this, [=]() {
  107. m_curBondInfo.iPickPRStrategyId = ui.spinBoxPickTempID->value();
  108. //ParamChangeEvent();
  109. });
  110. connect(ui.spinBoxPickNozzleID, &SpinBox::editDone, this, [=]() {
  111. m_curBondInfo.iPickHeadId = ui.spinBoxPickNozzleID->value();
  112. //ParamChangeEvent();
  113. });
  114. connect(ui.spinBoxPreBondTemp, &SpinBox::editDone, this, [=]() {
  115. m_curBondInfo.iBondFrontPRStrategyId = ui.spinBoxPreBondTemp->value();
  116. //ParamChangeEvent();
  117. });
  118. connect(ui.spinBoxPostBondTemp, &SpinBox::editDone, this, [=]() {
  119. m_curBondInfo.iBondBackPRStrategyId = ui.spinBoxPostBondTemp->value();
  120. //ParamChangeEvent();
  121. });
  122. connect(ui.spinBoxBondTemp, &SpinBox::editDone, this, [=]() {
  123. m_curBondInfo.iBondPRStrategyId = ui.spinBoxBondTemp->value();
  124. //ParamChangeEvent();
  125. });
  126. connect(ui.spinBoxLookUpTemp, &SpinBox::editDone, this, [=]() {
  127. m_curBondInfo.iLookUpPRStrategyId = ui.spinBoxLookUpTemp->value();
  128. //ParamChangeEvent();
  129. });
  130. connect(ui.spinBoxCalibPickTemp, &SpinBox::editDone, this, [=]() {
  131. m_curBondInfo.iCalibPRStrategyId = ui.spinBoxCalibPickTemp->value();
  132. //ParamChangeEvent();
  133. });
  134. connect(ui.spinBoxBondNozzleID, &SpinBox::editDone, this, [=]() {
  135. m_curBondInfo.iBondHeadId = ui.spinBoxBondNozzleID->value();
  136. //ParamChangeEvent();
  137. });
  138. connect(ui.doubleSpinBoxBondOffsetX, &DoubleSpinBox::editDone, this, [=]() {
  139. m_curBondInfo.stOffset.x = ui.doubleSpinBoxBondOffsetX->value();
  140. //ParamChangeEvent();
  141. });
  142. connect(ui.doubleSpinBoxBondOffsetY, &DoubleSpinBox::editDone, this, [=]() {
  143. m_curBondInfo.stOffset.y = ui.doubleSpinBoxBondOffsetY->value();
  144. //ParamChangeEvent();
  145. });
  146. connect(ui.doubleSpinBoxBondOffsetAngle, &DoubleSpinBox::editDone, this, [=]() {
  147. m_curBondInfo.stOffset.a = ui.doubleSpinBoxBondOffsetAngle->value();
  148. //ParamChangeEvent();
  149. });
  150. connect(ui.comboBoxPickParamType, &QComboBox::currentTextChanged, this, [=]() {
  151. //UpdatePagePickParam();
  152. });
  153. connect(ui.checkBoxPickBlockCheck, &QCheckBox::clicked, this, [=](bool isChecked) {
  154. if (ui.comboBoxPickParamType->currentIndex() == 0)//华夫盒
  155. {
  156. m_curWaferPickParam.bCheckBlock = ui.checkBoxPickBlockCheck->isChecked();
  157. }
  158. else if (ui.comboBoxPickParamType->currentIndex() == 1)//晶圆台
  159. {
  160. m_curCalibPickParam.bCheckBlock = ui.checkBoxPickBlockCheck->isChecked();
  161. }
  162. //ParamChangeEvent();
  163. });
  164. connect(ui.checkBoxPickLoseCheck, &QCheckBox::clicked, this, [=](bool isChecked) {
  165. if (ui.comboBoxPickParamType->currentIndex() == 0)//华夫盒
  166. {
  167. m_curWaferPickParam.bCheckLose = ui.checkBoxPickLoseCheck->isChecked();
  168. }
  169. else if (ui.comboBoxPickParamType->currentIndex() == 1)//晶圆台
  170. {
  171. m_curCalibPickParam.bCheckLose = ui.checkBoxPickLoseCheck->isChecked();
  172. }
  173. //ParamChangeEvent();
  174. });
  175. connect(ui.checkBoxPickFindForceCheck, &QCheckBox::clicked, this, [=](bool isChecked) {
  176. if (ui.comboBoxPickParamType->currentIndex() == 0)//华夫盒
  177. {
  178. m_curWaferPickParam.bFindForce = ui.checkBoxPickFindForceCheck->isChecked();
  179. }
  180. else if (ui.comboBoxPickParamType->currentIndex() == 1)//晶圆台
  181. {
  182. m_curCalibPickParam.bFindForce = ui.checkBoxPickFindForceCheck->isChecked();
  183. }
  184. //ParamChangeEvent();
  185. });
  186. connect(ui.doubleSpinBoxPrePickZ, &DoubleSpinBox::editDone, this, [=]() {
  187. if (ui.comboBoxPickParamType->currentIndex() == 0)//华夫盒
  188. {
  189. m_curWaferPickParam.dPreLev = ui.doubleSpinBoxPrePickZ->value();
  190. }
  191. else if (ui.comboBoxPickParamType->currentIndex() == 1)//晶圆台
  192. {
  193. m_curCalibPickParam.dPreLev = ui.doubleSpinBoxPrePickZ->value();
  194. }
  195. //ParamChangeEvent();
  196. });
  197. connect(ui.doubleSpinBoxPickForce, &DoubleSpinBox::editDone, this, [=]() {
  198. if (ui.comboBoxPickParamType->currentIndex() == 0)//华夫盒
  199. {
  200. m_curWaferPickParam.dForce = ui.doubleSpinBoxPickForce->value();
  201. }
  202. else if (ui.comboBoxPickParamType->currentIndex() == 1)//晶圆台
  203. {
  204. m_curCalibPickParam.dForce = ui.doubleSpinBoxPickForce->value();
  205. }
  206. //ParamChangeEvent();
  207. });
  208. connect(ui.doubleSpinBoxPickPosZ, &DoubleSpinBox::editDone, this, [=]() {
  209. if (ui.comboBoxPickParamType->currentIndex() == 0)//华夫盒
  210. {
  211. m_curWaferPickParam.dWorkLev = ui.doubleSpinBoxPickPosZ->value();
  212. }
  213. else if (ui.comboBoxPickParamType->currentIndex() == 1)//晶圆台
  214. {
  215. m_curCalibPickParam.dWorkLev = ui.doubleSpinBoxPickPosZ->value();
  216. }
  217. //ParamChangeEvent();
  218. });
  219. connect(ui.spinBoxPickGrabDelay, &SpinBox::editDone, this, [=]() {
  220. if (ui.comboBoxPickParamType->currentIndex() == 0)//华夫盒
  221. {
  222. m_curWaferPickParam.iGrabDelay = ui.spinBoxPickGrabDelay->value();
  223. }
  224. else if (ui.comboBoxPickParamType->currentIndex() == 1)//晶圆台
  225. {
  226. m_curCalibPickParam.iGrabDelay = ui.spinBoxPickGrabDelay->value();
  227. }
  228. //ParamChangeEvent();
  229. });
  230. connect(ui.spinBox_PickDelay, &SpinBox::editDone, this, [=]() {
  231. if (ui.comboBoxPickParamType->currentIndex() == 0)//华夫盒
  232. {
  233. m_curWaferPickParam.iPickOrBondDelay = ui.spinBox_PickDelay->value();
  234. }
  235. else if (ui.comboBoxPickParamType->currentIndex() == 1)//晶圆台
  236. {
  237. m_curCalibPickParam.iPickOrBondDelay = ui.spinBox_PickDelay->value();
  238. }
  239. //ParamChangeEvent();
  240. });
  241. connect(ui.spinBoxPickBlockCheckDelay, &SpinBox::editDone, this, [=]() {
  242. if (ui.comboBoxPickParamType->currentIndex() == 0)//华夫盒
  243. {
  244. m_curWaferPickParam.iBlockOrLoseDelay = ui.spinBoxPickBlockCheckDelay->value();
  245. }
  246. else if (ui.comboBoxPickParamType->currentIndex() == 1)//晶圆台
  247. {
  248. m_curCalibPickParam.iBlockOrLoseDelay = ui.spinBoxPickBlockCheckDelay->value();
  249. }
  250. //ParamChangeEvent();
  251. });
  252. connect(ui.spinBoxPickVacDelay, &SpinBox::editDone, this, [=]() {
  253. if (ui.comboBoxPickParamType->currentIndex() == 0)//华夫盒
  254. {
  255. m_curWaferPickParam.iVacuumDelay = ui.spinBoxPickVacDelay->value();
  256. }
  257. else if (ui.comboBoxPickParamType->currentIndex() == 1)//晶圆台
  258. {
  259. m_curCalibPickParam.iVacuumDelay = ui.spinBoxPickVacDelay->value();
  260. }
  261. //ParamChangeEvent();
  262. });
  263. connect(ui.spinBoxPickBlowDelay, &SpinBox::editDone, this, [=]() {
  264. if (ui.comboBoxPickParamType->currentIndex() == 0)//华夫盒
  265. {
  266. m_curWaferPickParam.iBlowDelay = ui.spinBoxPickBlowDelay->value();
  267. }
  268. else if (ui.comboBoxPickParamType->currentIndex() == 1)//晶圆台
  269. {
  270. m_curCalibPickParam.iBlowDelay = ui.spinBoxPickBlowDelay->value();
  271. }
  272. //ParamChangeEvent();
  273. });
  274. connect(ui.comboBoxBondParamType, &QComboBox::currentTextChanged, this, [=]() {
  275. UpdatePageBondParam();
  276. });
  277. connect(ui.checkBoxBondBlockCheck, &QCheckBox::clicked, this, [=](bool isChecked) {
  278. if (ui.comboBoxBondParamType->currentIndex() == 0)//中转台放晶
  279. {
  280. m_curCalibPlaceParam.bCheckBlock = ui.checkBoxBondBlockCheck->isChecked();
  281. }
  282. else if (ui.comboBoxBondParamType->currentIndex() == 1)//固晶台固晶
  283. {
  284. m_curBondParam.bCheckBlock = ui.checkBoxBondBlockCheck->isChecked();
  285. }
  286. //ParamChangeEvent();
  287. });
  288. connect(ui.checkBoxBondLoseCheck, &QCheckBox::clicked, this, [=](bool isChecked) {
  289. if (ui.comboBoxBondParamType->currentIndex() == 0)//中转台放晶
  290. {
  291. m_curCalibPlaceParam.bCheckLose = ui.checkBoxBondLoseCheck->isChecked();
  292. }
  293. else if (ui.comboBoxBondParamType->currentIndex() == 1)//固晶台固晶
  294. {
  295. m_curBondParam.bCheckLose = ui.checkBoxBondLoseCheck->isChecked();
  296. }
  297. //ParamChangeEvent();
  298. });
  299. connect(ui.checkBoxBondFindForce, &QCheckBox::clicked, this, [=](bool isChecked) {
  300. if (ui.comboBoxBondParamType->currentIndex() == 0)//中转台放晶
  301. {
  302. m_curCalibPlaceParam.bFindForce = ui.checkBoxBondFindForce->isChecked();
  303. }
  304. else if (ui.comboBoxBondParamType->currentIndex() == 1)//固晶台固晶
  305. {
  306. m_curBondParam.bFindForce = ui.checkBoxBondFindForce->isChecked();
  307. }
  308. //ParamChangeEvent();
  309. });
  310. connect(ui.doubleSpinBoxPreBondPosZ, &DoubleSpinBox::editDone, this, [=]() {
  311. if (ui.comboBoxBondParamType->currentIndex() == 0)//中转台放晶
  312. {
  313. m_curCalibPlaceParam.dPreLev = ui.doubleSpinBoxPreBondPosZ->value();
  314. }
  315. else if (ui.comboBoxBondParamType->currentIndex() == 1)//固晶台固晶
  316. {
  317. m_curBondParam.dPreLev = ui.doubleSpinBoxPreBondPosZ->value();
  318. }
  319. //ParamChangeEvent();
  320. });
  321. connect(ui.doubleSpinBoxBondForce, &DoubleSpinBox::editDone, this, [=]() {
  322. if (ui.comboBoxBondParamType->currentIndex() == 0)//中转台放晶
  323. {
  324. m_curCalibPlaceParam.dForce = ui.doubleSpinBoxBondForce->value();
  325. }
  326. else if (ui.comboBoxBondParamType->currentIndex() == 1)//固晶台固晶
  327. {
  328. m_curBondParam.dForce = ui.doubleSpinBoxBondForce->value();
  329. }
  330. //ParamChangeEvent();
  331. });
  332. connect(ui.doubleSpinBoxBondPosZ, &DoubleSpinBox::editDone, this, [=]() {
  333. if (ui.comboBoxBondParamType->currentIndex() == 0)//中转台放晶
  334. {
  335. m_curCalibPlaceParam.dWorkLev = ui.doubleSpinBoxBondPosZ->value();
  336. }
  337. else if (ui.comboBoxBondParamType->currentIndex() == 1)//固晶台固晶
  338. {
  339. m_curBondParam.dWorkLev = ui.doubleSpinBoxBondPosZ->value();
  340. }
  341. //ParamChangeEvent();
  342. });
  343. connect(ui.spinBoxBondGrabDelay, &SpinBox::editDone, this, [=]() {
  344. if (ui.comboBoxBondParamType->currentIndex() == 0)//中转台放晶
  345. {
  346. m_curCalibPlaceParam.iGrabDelay = ui.spinBoxBondGrabDelay->value();
  347. }
  348. else if (ui.comboBoxBondParamType->currentIndex() == 1)//固晶台固晶
  349. {
  350. m_curBondParam.iGrabDelay = ui.spinBoxBondGrabDelay->value();
  351. }
  352. //ParamChangeEvent();
  353. });
  354. connect(ui.spinBoxBondBlockCheckDelay, &SpinBox::editDone, this, [=]() {
  355. if (ui.comboBoxBondParamType->currentIndex() == 0)//中转台放晶
  356. {
  357. m_curCalibPlaceParam.iBlockOrLoseDelay = ui.spinBoxBondBlockCheckDelay->value();
  358. }
  359. else if (ui.comboBoxBondParamType->currentIndex() == 1)//固晶台固晶
  360. {
  361. m_curBondParam.iBlockOrLoseDelay = ui.spinBoxBondBlockCheckDelay->value();
  362. }
  363. //ParamChangeEvent();
  364. });
  365. connect(ui.spinBoxBondDelay, &SpinBox::editDone, this, [=]() {
  366. if (ui.comboBoxBondParamType->currentIndex() == 0)//中转台放晶
  367. {
  368. m_curCalibPlaceParam.iPickOrBondDelay = ui.spinBoxBondDelay->value();
  369. }
  370. else if (ui.comboBoxBondParamType->currentIndex() == 1)//固晶台固晶
  371. {
  372. m_curBondParam.iPickOrBondDelay = ui.spinBoxBondDelay->value();
  373. }
  374. //ParamChangeEvent();
  375. });
  376. connect(ui.spinBoxBondVacDelay, &SpinBox::editDone, this, [=]() {
  377. if (ui.comboBoxBondParamType->currentIndex() == 0)//中转台放晶
  378. {
  379. m_curCalibPlaceParam.iVacuumDelay = ui.spinBoxBondVacDelay->value();
  380. }
  381. else if (ui.comboBoxBondParamType->currentIndex() == 1)//固晶台固晶
  382. {
  383. m_curBondParam.iVacuumDelay = ui.spinBoxBondVacDelay->value();
  384. }
  385. //ParamChangeEvent();
  386. });
  387. connect(ui.spinBoxBondBlowDelay, &SpinBox::editDone, this, [=]() {
  388. if (ui.comboBoxBondParamType->currentIndex() == 0)//中转台放晶
  389. {
  390. m_curCalibPlaceParam.iBlowDelay = ui.spinBoxBondBlowDelay->value();
  391. }
  392. else if (ui.comboBoxBondParamType->currentIndex() == 1)//固晶台固晶
  393. {
  394. m_curBondParam.iBlowDelay = ui.spinBoxBondBlowDelay->value();
  395. }
  396. //ParamChangeEvent();
  397. });
  398. }
  399. BondMatrixProgramPage::~BondMatrixProgramPage()
  400. {
  401. }
  402. XY_DOUBLE_STRUCT BondMatrixProgramPage::BondGetAxisPosition(std::string ModuleType, XY_DOUBLE_STRUCT& pos)
  403. {
  404. /*CAxis* _Axis;
  405. CAxis::AXIS_TYPE eAxisType = _Axis->GetAxisType();*/
  406. if (m_pProgramCViewInterface == nullptr)
  407. {
  408. XY_DOUBLE_STRUCT errorPt = pos; // 可以根据需要返回一个错误状态
  409. // 弹出消息框显示位置
  410. QString positionString = QString("Unable to retrieve axis position for module type: %1").arg(QString::fromStdString(ModuleType));
  411. QMessageBox::information(this, "Axis Position Error", positionString);
  412. return errorPt;
  413. }
  414. m_pProgramCViewInterface->GetViewMotion()->GetAxisPosition(ModuleType, "X", pos.x);
  415. m_pProgramCViewInterface->GetViewMotion()->GetAxisPosition(ModuleType, "Y", pos.y);
  416. return pos;
  417. }
  418. void BondMatrixProgramPage::AddOutMatrixPage(int vectorIndex, PROGRAM_BOND_MATRIX_STRUCT matrixData, std::vector<PROGRAM_POINT_MATRIX_STRUCT> vecSubMatrix)
  419. {
  420. int matrixNum = m_mapSubMatrixControls.size();
  421. int newMatrixID = ++matrixNum;
  422. QVector<QObject*> vecControls;
  423. QWidget* outWidget = new QWidget();
  424. QGridLayout* outMatrixGridLayout = new QGridLayout();
  425. outMatrixGridLayout->setSpacing(4);
  426. outMatrixGridLayout->setObjectName(QString::fromUtf8("Out GridLayout"));
  427. outMatrixGridLayout->setContentsMargins(0, 0, 0, 0); // 设置布局的边距为0
  428. QGridLayout* boxGridLayout = new QGridLayout();
  429. boxGridLayout->setSpacing(4);
  430. boxGridLayout->setObjectName(QString::fromUtf8("Box GridLayout"));
  431. boxGridLayout->setContentsMargins(0, 0, 0, 0); // 设置布局的边距为0
  432. QHBoxLayout* buttonLayout = new QHBoxLayout();
  433. QSpacerItem* item = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
  434. buttonLayout->addSpacerItem(item);
  435. QGroupBox* groupBox = new QGroupBox(outWidget);
  436. groupBox->setLayout(boxGridLayout);
  437. QGridLayout* matrixGridLayout = new QGridLayout();
  438. matrixGridLayout->setSpacing(4);
  439. matrixGridLayout->setObjectName(QString::fromUtf8("matrixGridLayout"));
  440. matrixGridLayout->setContentsMargins(0, 0, 0, 0); // 设置布局的边距为0
  441. //// Add line for separation
  442. //QFrame* line = new QFrame();
  443. //line->setFrameShape(QFrame::NoFrame); // Remove default frame
  444. //line->setFixedHeight(2); // Set fixed height for line
  445. //line->setStyleSheet("background-color: #C7CAEB;");
  446. //outMatrixGridLayout->addWidget(line, 0, 0, 1, 4);
  447. // Add matrix title
  448. QLabel* labelTitle = new QLabel(outWidget);
  449. labelTitle->setObjectName(QString::fromUtf8("labelTitle"));
  450. labelTitle->setText(tr("Bond Matrix ") + QString::number(vectorIndex));
  451. labelTitle->setStyleSheet("color: #6A78FF;height: 30px");
  452. matrixGridLayout->addWidget(labelTitle, 0, 0, 1, 1);
  453. vecControls.push_back(labelTitle);
  454. //// Add Delete Out Matrix button
  455. //QPushButton* buttonDeleteOutMatrix = new QPushButton("Delete Matrix", outWidget);
  456. //outMatrixGridLayout->addWidget(buttonDeleteOutMatrix, 8, 0, 1, 3);
  457. //connect(buttonDeleteOutMatrix, &QPushButton::clicked, this, [=]() {
  458. // m_vectBondMatrixs.erase(m_vectBondMatrixs.begin() + vectorIndex);
  459. // delete outWidget;
  460. // });
  461. // Add "Add Sub Matrix" button
  462. QPushButton* pushButtonAdd = new QPushButton(outWidget);
  463. pushButtonAdd->setObjectName(QString::fromUtf8("button Add"));
  464. pushButtonAdd->setText(tr("Add sub Matrix"));
  465. matrixGridLayout->addWidget(pushButtonAdd, 0, 2, 1, 2);
  466. pushButtonAdd->setProperty("type", "default");
  467. connect(pushButtonAdd, &QPushButton::clicked, this, [=]() {
  468. int newSubMatrixIndex = m_vecSubMatrixs.size();
  469. PROGRAM_POINT_MATRIX_STRUCT subMatrix;
  470. std::sort(m_vecSubMatrixs.begin(), m_vecSubMatrixs.end(),
  471. [](const PROGRAM_POINT_MATRIX_STRUCT& a, const PROGRAM_POINT_MATRIX_STRUCT& b) {
  472. return a.MatrixId < b.MatrixId;
  473. });
  474. int newSubMatrixID = 0;
  475. UINT maxID = 0;
  476. // 查找最大 MatrixId
  477. for (PROGRAM_POINT_MATRIX_STRUCT& subMatrix : m_vecSubMatrixs)
  478. {
  479. if (subMatrix.MatrixId > maxID)
  480. {
  481. maxID = subMatrix.MatrixId;
  482. }
  483. }
  484. newSubMatrixID = ++maxID;
  485. while (std::any_of(m_vecSubMatrixs.begin(), m_vecSubMatrixs.end(),
  486. [newSubMatrixID](const PROGRAM_POINT_MATRIX_STRUCT& subMatrix) {
  487. return subMatrix.MatrixId == newSubMatrixID;
  488. }))
  489. {
  490. newSubMatrixID++; // 如果生成的 ID 已经存在,递增直到找到唯一的 ID
  491. }
  492. subMatrix.MatrixId = newSubMatrixID;
  493. subMatrix.strModuleName = "UltraHead";
  494. subMatrix.iModuleId = MODULE_LIST::BondHead;
  495. subMatrix.MatrixRow = 0;
  496. subMatrix.MatrixCol = 0;
  497. m_vecSubMatrixs.push_back(subMatrix);
  498. // Add the submatrix to the bond matrix's VecPointMatrixId
  499. //找大矩阵ID/Index
  500. auto currentIt = m_mapOutWidgetIndex.find(outWidget);
  501. int index = currentIt.value(); //迭代器 erase后currentIt被删除了
  502. m_vectBondMatrixs[index].VecPointMatrixId.push_back(newSubMatrixID);
  503. AddMatrixPage(index, newSubMatrixIndex, subMatrix, outMatrixGridLayout);
  504. });
  505. // Add Delete Out Matrix button
  506. QPushButton* pushButtonDelete = new QPushButton(outWidget);
  507. pushButtonDelete->setObjectName(QString::fromUtf8("button delete"));
  508. pushButtonDelete->setText(tr("Delete"));
  509. matrixGridLayout->addWidget(pushButtonDelete, 0, 1, 1, 1);
  510. connect(pushButtonDelete, &QPushButton::clicked, this, [=]() {
  511. //处理index
  512. auto currentIt = m_mapOutWidgetIndex.find(outWidget);
  513. int index = currentIt.value(); //迭代器 erase后currentIt被删除了
  514. m_mapOutWidgetIndex.erase(currentIt);
  515. for (auto it = m_mapOutWidgetIndex.begin(); it != m_mapOutWidgetIndex.end(); it++)
  516. {
  517. if (it.value() > index)
  518. {
  519. int newIndex = it.value() - 1;
  520. m_mapOutWidgetIndex.insert(it.key(), newIndex);
  521. }
  522. }
  523. //删除缓存数据
  524. m_vectBondMatrixs.erase(m_vectBondMatrixs.begin() + vectorIndex);
  525. //m_mapBondMatrixToSubMatrices.remove(vectorIndex); // Remove mapping between BondMatrix and its SubMatrices
  526. delete outWidget;
  527. });
  528. // Add Row and Column controls
  529. QLabel* labelRow = new QLabel(outWidget);
  530. labelRow->setObjectName(QString::fromUtf8("labelRow"));
  531. labelRow->setText(tr("Row & Cow"));
  532. matrixGridLayout->addWidget(labelRow, 2, 0, 1, 1);
  533. vecControls.push_back(labelRow);
  534. SpinBox* spinBoxRow = new SpinBox(outWidget);
  535. spinBoxRow->setObjectName(QString::fromUtf8("spinBoxRow"));
  536. spinBoxRow->setFixedWidth(100); // Set fixed width to 100
  537. matrixGridLayout->addWidget(spinBoxRow, 2, 1, 1, 1);
  538. vecControls.push_back(spinBoxRow);
  539. /*QLabel* labelCol = new QLabel(outWidget);
  540. labelCol->setObjectName(QString::fromUtf8("labelCol"));
  541. labelCol->setText(tr("Column "));
  542. outMatrixGridLayout->addWidget(labelCol, 3, 0, 1, 1);
  543. vecControls.push_back(labelCol);*/
  544. SpinBox* spinBoxCol = new SpinBox(outWidget);
  545. spinBoxCol->setObjectName(QString::fromUtf8("spinBoxCol"));
  546. spinBoxCol->setFixedWidth(100); // Set fixed width to 100
  547. matrixGridLayout->addWidget(spinBoxCol, 2, 2, 1, 1);
  548. vecControls.push_back(spinBoxCol);
  549. // Add Left Top Position controls
  550. QLabel* labelLeftTop = new QLabel(outWidget);
  551. labelLeftTop->setObjectName(QString::fromUtf8("labelLeftTop"));
  552. labelLeftTop->setText(tr("Left Top Pos "));
  553. matrixGridLayout->addWidget(labelLeftTop, 4, 0, 1, 1);
  554. vecControls.push_back(labelLeftTop);
  555. DoubleSpinBox* doubleSpinBoxLeftTopX = new DoubleSpinBox(outWidget);
  556. doubleSpinBoxLeftTopX->setObjectName(QString::fromUtf8("doubleSpinBoxLeftTopX"));
  557. doubleSpinBoxLeftTopX->setFixedWidth(100); // Set fixed width to 100
  558. matrixGridLayout->addWidget(doubleSpinBoxLeftTopX, 4, 1, 1, 1);
  559. vecControls.push_back(doubleSpinBoxLeftTopX);
  560. DoubleSpinBox* doubleSpinBoxLeftTopY = new DoubleSpinBox(outWidget);
  561. doubleSpinBoxLeftTopY->setObjectName(QString::fromUtf8("doubleSpinBoxLeftTopY"));
  562. doubleSpinBoxLeftTopY->setFixedWidth(100); // Set fixed width to 100
  563. matrixGridLayout->addWidget(doubleSpinBoxLeftTopY, 4, 2, 1, 1);
  564. vecControls.push_back(doubleSpinBoxLeftTopY);
  565. // Add Get Pos button for Left Top
  566. QPushButton* buttonLeftTop = new QPushButton("Get Pos", this);
  567. buttonLeftTop->setFixedWidth(62); // Set the same width for the button
  568. matrixGridLayout->addWidget(buttonLeftTop, 4, 3, 1, 1); // Position the button next to LeftTopPos
  569. connect(buttonLeftTop, &QPushButton::clicked, this, [=]() {
  570. XY_DOUBLE_STRUCT position = BondGetAxisPosition("BondMatrix", m_vectBondMatrixs[vectorIndex].LeftTopPoint);
  571. doubleSpinBoxLeftTopX->setValue(position.x);
  572. doubleSpinBoxLeftTopY->setValue(position.y);
  573. });
  574. // Add Right Top Position controls
  575. QLabel* labelRightTopPos = new QLabel(outWidget);
  576. labelRightTopPos->setObjectName(QString::fromUtf8("labelRightTopPos"));
  577. labelRightTopPos->setText(tr("Right Top Pos "));
  578. matrixGridLayout->addWidget(labelRightTopPos, 5, 0, 1, 1);
  579. vecControls.push_back(labelRightTopPos);
  580. DoubleSpinBox* doubleSpinBoxRightTopX = new DoubleSpinBox(outWidget);
  581. doubleSpinBoxRightTopX->setObjectName(QString::fromUtf8("doubleSpinBoxRightTopX"));
  582. doubleSpinBoxRightTopX->setFixedWidth(100); // Set fixed width to 100
  583. matrixGridLayout->addWidget(doubleSpinBoxRightTopX, 5, 1, 1, 1);
  584. vecControls.push_back(doubleSpinBoxRightTopX);
  585. DoubleSpinBox* doubleSpinBoxRightTopY = new DoubleSpinBox(outWidget);
  586. doubleSpinBoxRightTopY->setObjectName(QString::fromUtf8("doubleSpinBoxRightTopY"));
  587. doubleSpinBoxRightTopY->setFixedWidth(100); // Set fixed width to 100
  588. matrixGridLayout->addWidget(doubleSpinBoxRightTopY, 5, 2, 1, 1);
  589. vecControls.push_back(doubleSpinBoxRightTopY);
  590. QPushButton* buttonRightTop = new QPushButton("Get Pos", this);
  591. buttonRightTop->setFixedWidth(62); // Set the same width for the button
  592. matrixGridLayout->addWidget(buttonRightTop, 5, 3, 1, 1); // Position the button next to RightTopPos
  593. connect(buttonRightTop, &QPushButton::clicked, this, [=]() {
  594. XY_DOUBLE_STRUCT position = BondGetAxisPosition("BondMatrix", m_vectBondMatrixs[vectorIndex].RightTopPoint);
  595. doubleSpinBoxRightTopX->setValue(position.x);
  596. doubleSpinBoxRightTopY->setValue(position.y);
  597. });
  598. // Add Right Bottom Position controls
  599. QLabel* labelRightButtomPos = new QLabel(outWidget);
  600. labelRightButtomPos->setObjectName(QString::fromUtf8("labelRightButtomPos"));
  601. labelRightButtomPos->setText(tr("Right Buttom pos"));
  602. matrixGridLayout->addWidget(labelRightButtomPos, 6, 0, 1, 1);
  603. vecControls.push_back(labelRightButtomPos);
  604. DoubleSpinBox* doubleSpinBoxRightButtomX = new DoubleSpinBox(outWidget);
  605. doubleSpinBoxRightButtomX->setObjectName(QString::fromUtf8("doubleSpinBoxRightButtomX"));
  606. doubleSpinBoxRightButtomX->setFixedWidth(100); // Set fixed width to 100
  607. matrixGridLayout->addWidget(doubleSpinBoxRightButtomX, 6, 1, 1, 1);
  608. vecControls.push_back(doubleSpinBoxRightButtomX);
  609. DoubleSpinBox* doubleSpinBoxRightButtomY = new DoubleSpinBox(outWidget);
  610. doubleSpinBoxRightButtomY->setObjectName(QString::fromUtf8("doubleSpinBoxRightButtomY"));
  611. doubleSpinBoxRightButtomY->setFixedWidth(100); // Set fixed width to 100
  612. matrixGridLayout->addWidget(doubleSpinBoxRightButtomY, 6, 2, 1, 1);
  613. vecControls.push_back(doubleSpinBoxRightTopX);
  614. QPushButton* buttonRightButtom = new QPushButton("Get Pos", this);
  615. buttonRightButtom->setFixedWidth(62); // Set the same width for the button
  616. matrixGridLayout->addWidget(buttonRightButtom, 6, 3, 1, 1); // Position the button next to RightBottomPos
  617. connect(buttonRightButtom, &QPushButton::clicked, this, [=]() {
  618. XY_DOUBLE_STRUCT position = BondGetAxisPosition("BondMatrix", m_vectBondMatrixs[vectorIndex].RightBottomPoint);
  619. doubleSpinBoxRightButtomX->setValue(position.x);
  620. doubleSpinBoxRightButtomY->setValue(position.y);
  621. });
  622. // Add No Bond Points line edit
  623. QLabel* labelNoBondPts = new QLabel(outWidget);
  624. labelNoBondPts->setObjectName(QString::fromUtf8("labelNoBondPts"));
  625. labelNoBondPts->setText(tr("No Bond Points"));
  626. matrixGridLayout->addWidget(labelNoBondPts, 7, 0, 1, 1);
  627. vecControls.push_back(labelNoBondPts);
  628. QLineEdit* lineEditNoBondPts = new QLineEdit(outWidget);
  629. lineEditNoBondPts->setObjectName(QString::fromUtf8("lineEditNoBondPts"));
  630. matrixGridLayout->addWidget(lineEditNoBondPts, 7, 1, 1, 3);
  631. vecControls.push_back(lineEditNoBondPts);
  632. lineEditNoBondPts->setReadOnly(true);
  633. lineEditNoBondPts->setCursor(Qt::PointingHandCursor);
  634. lineEditNoBondPts->setProperty("vectorIndex", vectorIndex); // 存储索引
  635. lineEditNoBondPts->setProperty("parentMatrixIndex", -1); // 设置父矩阵的索引
  636. lineEditNoBondPts->installEventFilter(this);
  637. /*QLineEdit* lineEditNoBondPts = new QLineEdit(outWidget);
  638. lineEditNoBondPts->setObjectName(QString::fromUtf8("lineEditNoBondPts"));
  639. matrixGridLayout->addWidget(lineEditNoBondPts, 7, 1, 1, 3);
  640. vecControls.push_back(lineEditNoBondPts);*/
  641. // Paragram line edit
  642. QLabel* labelParagram = new QLabel(outWidget);
  643. labelParagram->setObjectName(QString::fromUtf8("labelParagram"));
  644. labelParagram->setText(tr("ParagramSet"));
  645. matrixGridLayout->addWidget(labelParagram, 8, 0, 1, 1);
  646. vecControls.push_back(labelParagram);
  647. QComboBox* comboBoxParagramSet = new QComboBox(outWidget);
  648. comboBoxParagramSet->setObjectName(QString::fromUtf8("comboBoxNoBondPts"));
  649. m_mapParagramSetComboBox.insert(comboBoxParagramSet, vectorIndex);
  650. // 添加选项到下拉框并关联 iInfoId
  651. for (const auto& bondMatrix : m_vecBondInfoData) {
  652. // 将 iInfoId 作为显示项添加到下拉框
  653. QString itemText = QString::number(bondMatrix.iInfoId); // 显示编号 iInfoId
  654. // 添加项并使用 setData 存储 iInfoId 作为附加数据
  655. comboBoxParagramSet->addItem(itemText, bondMatrix.iInfoId);
  656. }
  657. // 将下拉框添加到布局中
  658. matrixGridLayout->addWidget(comboBoxParagramSet, 8, 1, 1, 1);
  659. // 将控件保存到 vecControls 中
  660. vecControls.push_back(comboBoxParagramSet);
  661. // 连接 QComboBox 的信号和槽
  662. connect(comboBoxParagramSet, SIGNAL(currentIndexChanged(int)), this, SLOT(onComboBoxIndexChanged(int)));
  663. connect(comboBoxParagramSet, SIGNAL(showPopup()), this, SLOT(onComboBoxPopup()));
  664. QPushButton* buttonParagram = new QPushButton("ShowParagram", this);
  665. //buttonParagram->setFixedWidth(62); // Set the same width for the button
  666. matrixGridLayout->addWidget(buttonParagram, 8, 2, 1, 2); // Position the button next to RightBottomPos
  667. connect(buttonParagram, &QPushButton::clicked, this, [=]() {
  668. UpdateShowBondInfoData(m_vectBondMatrixs[vectorIndex].BondInfoId);
  669. });
  670. QFrame* line = new QFrame(outWidget);
  671. line->setFrameShape(QFrame::NoFrame); // 移除默认框架
  672. line->setFixedHeight(2); // 设置固定高度
  673. line->setStyleSheet("background-color: #C7CAEB;");
  674. boxGridLayout->addLayout(matrixGridLayout, 2, 0);
  675. boxGridLayout->addWidget(line);
  676. //outMatrixGridLayout->addLayout(buttonLayout, 1, 0);
  677. outMatrixGridLayout->addWidget(groupBox);
  678. outWidget->setLayout(outMatrixGridLayout);
  679. ui.verticalLayout_3->addWidget(outWidget);
  680. ui.verticalLayout_3->setContentsMargins(0, 0, 0, 0); // Adjust margins if necessary
  681. ui.verticalLayout_3->setAlignment(Qt::AlignTop | Qt::AlignLeft); // Align the layout to the top-left
  682. m_mapOutWidgetIndex.insert(outWidget, vectorIndex);
  683. // Add Sub Matrices
  684. for (int j = 0; j < matrixData.VecPointMatrixId.size(); j++)
  685. {
  686. for (int i = 0; i < m_vecSubMatrixs.size(); i++)
  687. {
  688. if (matrixData.VecPointMatrixId[j] == m_vecSubMatrixs[i].MatrixId)
  689. {
  690. AddMatrixPage(j, i, m_vecSubMatrixs[i], outMatrixGridLayout);
  691. }
  692. }
  693. }
  694. QSpacerItem* vSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
  695. ui.verticalLayout_3->addItem(vSpacer);
  696. // Add all controls and finalize layout
  697. /*outWidget->setLayout(outMatrixGridLayout);
  698. ui.scrollArea_2->setLayout(outMatrixGridLayout);*/
  699. spinBoxRow->setValue(matrixData.BondMatrixRow);
  700. spinBoxCol->setValue(matrixData.BondMatrixCol);
  701. doubleSpinBoxLeftTopX->setValue(matrixData.LeftTopPoint.x);
  702. doubleSpinBoxLeftTopY->setValue(matrixData.LeftTopPoint.y);
  703. doubleSpinBoxRightTopX->setValue(matrixData.RightTopPoint.x);
  704. doubleSpinBoxRightTopY->setValue(matrixData.RightTopPoint.y);
  705. doubleSpinBoxRightButtomX->setValue(matrixData.RightBottomPoint.x);
  706. doubleSpinBoxRightButtomY->setValue(matrixData.RightBottomPoint.y);
  707. connect(spinBoxRow, &SpinBox::editDone, this, [=]() {
  708. m_vectBondMatrixs[vectorIndex].BondMatrixRow = spinBoxRow->value();
  709. });
  710. connect(spinBoxCol, &SpinBox::editDone, this, [=]() {
  711. m_vectBondMatrixs[vectorIndex].BondMatrixCol = spinBoxCol->value();
  712. });
  713. connect(doubleSpinBoxLeftTopX, &DoubleSpinBox::editDone, this, [=]() {
  714. m_vectBondMatrixs[vectorIndex].LeftTopPoint.x = doubleSpinBoxLeftTopX->value();
  715. });
  716. connect(doubleSpinBoxLeftTopY, &DoubleSpinBox::editDone, this, [=]() {
  717. m_vectBondMatrixs[vectorIndex].LeftTopPoint.y = doubleSpinBoxLeftTopY->value();
  718. });
  719. connect(doubleSpinBoxRightTopX, &DoubleSpinBox::editDone, this, [=]() {
  720. m_vectBondMatrixs[vectorIndex].RightTopPoint.x = doubleSpinBoxRightTopX->value();
  721. });
  722. connect(doubleSpinBoxRightTopY, &DoubleSpinBox::editDone, this, [=]() {
  723. m_vectBondMatrixs[vectorIndex].RightTopPoint.y = doubleSpinBoxRightTopY->value();
  724. });
  725. connect(doubleSpinBoxRightButtomX, &DoubleSpinBox::editDone, this, [=]() {
  726. m_vectBondMatrixs[vectorIndex].RightBottomPoint.x = doubleSpinBoxRightButtomX->value();
  727. });
  728. connect(doubleSpinBoxRightButtomY, &DoubleSpinBox::editDone, this, [=]() {
  729. m_vectBondMatrixs[vectorIndex].RightBottomPoint.y = doubleSpinBoxRightButtomY->value();
  730. });
  731. connect(lineEditNoBondPts, &QLineEdit::textChanged, this, [=]() {
  732. });
  733. }
  734. void BondMatrixProgramPage::onComboBoxPopup() {
  735. // 获取当前的 QComboBox
  736. QComboBox* comboBox = qobject_cast<QComboBox*>(sender());
  737. if (!comboBox) {
  738. return;
  739. }
  740. // 清空下拉框中的所有项
  741. comboBox->clear();
  742. // 重新填充下拉框选项,并更新 QMap 中的绑定关系
  743. for (const auto& bondMatrix : m_vecBondInfoData) {
  744. // 显示编号 iInfoId
  745. QString itemText = QString::number(bondMatrix.iInfoId);
  746. // 将 iInfoId 添加到下拉框
  747. comboBox->addItem(itemText, bondMatrix.iInfoId);
  748. }
  749. }
  750. //// 槽函数:每次下拉框弹出时刷新内容
  751. //void BondMatrixProgramPage::onComboBoxPopup() {
  752. // // 清空下拉框中的所有项
  753. // comboBoxParagramSet->clear();
  754. //
  755. // // 重新填充下拉框选项
  756. // for (const auto& bondMatrix : m_vecBondInfoData) {
  757. // // 显示编号 iInfoId
  758. // QString itemText = QString::number(bondMatrix.iInfoId);
  759. //
  760. // // 将 iInfoId 添加到下拉框
  761. // comboBoxParagramSet->addItem(itemText, bondMatrix.iInfoId);
  762. // }
  763. //}
  764. void BondMatrixProgramPage::onComboBoxIndexChanged(int index) {
  765. // 获取当前选中的 QComboBox
  766. QComboBox* comboBox = qobject_cast<QComboBox*>(sender());
  767. if (!comboBox) {
  768. return;
  769. }
  770. // 获取当前选中的 BondInfoId
  771. UINT selectedBondInfoId = comboBox->currentData().toUInt();
  772. // 获取当前 QComboBox 对应的 vectorIndex
  773. int vectorIndex = m_mapParagramSetComboBox.value(comboBox, -1); // 从 QMap 中获取 vectorIndex
  774. if (vectorIndex != -1) {
  775. // 更新 m_vectBondMatrixs[vectorIndex].BondInfoId
  776. m_vectBondMatrixs[vectorIndex].BondInfoId = selectedBondInfoId;
  777. //qDebug() << "Updated BondInfoId for vectorIndex: " << vectorIndex;
  778. }
  779. else {
  780. //qDebug() << "No vectorIndex found for the combo box!";
  781. }
  782. // 调用 UpdateShowBondInfoData 更新数据
  783. UpdateShowBondInfoData(selectedBondInfoId);
  784. }
  785. void BondMatrixProgramPage::AddMatrixPage(int vectorIndex, int subVectorIndex, PROGRAM_POINT_MATRIX_STRUCT subMatrix, QGridLayout* layout)
  786. {
  787. QVector<QObject*> vecControls;
  788. QWidget* subWidget = new QWidget();
  789. QGridLayout* subGridLayout = new QGridLayout(subWidget);
  790. subGridLayout->setSpacing(4);
  791. subGridLayout->setObjectName(QString::fromUtf8("subGridLayout"));
  792. //groupBox->setLayout(subGridLayout);
  793. subGridLayout->setContentsMargins(0, 0, 0, 0); // 设置布局的边距为0
  794. subGridLayout->setAlignment(Qt::AlignCenter);
  795. QLabel* labelTitle = new QLabel(subWidget);
  796. labelTitle->setObjectName(QString::fromUtf8("labelTitle"));
  797. labelTitle->setText(tr("Sub Matrix ") + QString::number(subVectorIndex));
  798. labelTitle->setStyleSheet("color: #808BFF;height: 30px");
  799. subGridLayout->addWidget(labelTitle, 0, 1, 1, 1);
  800. vecControls.push_back(labelTitle);
  801. QPushButton* pushButtonDelete = new QPushButton(subWidget);
  802. pushButtonDelete->setObjectName(QString::fromUtf8("button delete"));
  803. pushButtonDelete->setText(tr("Delete"));
  804. subGridLayout->addWidget(pushButtonDelete, 0, 3, 1, 1);
  805. connect(pushButtonDelete, &QPushButton::clicked, this, [=]() {
  806. //处理index
  807. auto currentIt = m_mapSubWidgetIndex.find(subWidget);
  808. int index = currentIt.value(); //迭代器 erase后currentIt被删除了
  809. m_mapSubWidgetIndex.erase(currentIt);
  810. for (auto it = m_mapSubWidgetIndex.begin(); it != m_mapSubWidgetIndex.end(); ++it)
  811. {
  812. if (it.value() > index)
  813. {
  814. //value() 返回的是副本不是引用
  815. int newIndex = it.value() - 1;
  816. m_mapSubWidgetIndex.insert(it.key(), newIndex);
  817. }
  818. }
  819. // 子矩阵ID
  820. int subMatrixId = m_vecSubMatrixs[index].MatrixId;
  821. //删除缓存
  822. m_vecSubMatrixs.erase(m_vecSubMatrixs.begin() + index);
  823. //删除大矩阵子ID数据(遍历删除)
  824. for (PROGRAM_BOND_MATRIX_STRUCT& matrix : m_vectBondMatrixs)
  825. {
  826. auto it = std::find(matrix.VecPointMatrixId.begin(), matrix.VecPointMatrixId.end(), subMatrixId);
  827. if (it != matrix.VecPointMatrixId.end())
  828. {
  829. matrix.VecPointMatrixId.erase(it);
  830. }
  831. }
  832. delete subWidget;
  833. });
  834. QLabel* labelRow = new QLabel(subWidget);
  835. labelRow->setObjectName(QString::fromUtf8("labelRow"));
  836. labelRow->setText(tr("Row & Cow"));
  837. subGridLayout->addWidget(labelRow, 2, 0, 1, 1);
  838. vecControls.push_back(labelRow);
  839. SpinBox* spinBoxRow = new SpinBox(subWidget);
  840. spinBoxRow->setObjectName(QString::fromUtf8("spinBoxRow"));
  841. subGridLayout->addWidget(spinBoxRow, 2, 1, 1, 1);
  842. vecControls.push_back(spinBoxRow);
  843. /*QLabel* labelCol = new QLabel(subWidget);
  844. labelCol->setObjectName(QString::fromUtf8("labelCol"));
  845. labelCol->setText(tr("Cow "));
  846. subGridLayout->addWidget(labelCol, 3, 0, 1, 1);
  847. vecControls.push_back(labelCol);*/
  848. SpinBox* spinBoxCol = new SpinBox(subWidget);
  849. spinBoxCol->setObjectName(QString::fromUtf8("spinBoxCol"));
  850. subGridLayout->addWidget(spinBoxCol, 2, 2, 1, 1);
  851. vecControls.push_back(spinBoxCol);
  852. QLabel* labelLeftTop = new QLabel(subWidget);
  853. labelLeftTop->setObjectName(QString::fromUtf8("labelLeftTop"));
  854. labelLeftTop->setText(tr("Left Top Pos "));
  855. subGridLayout->addWidget(labelLeftTop, 4, 0, 1, 1);
  856. vecControls.push_back(labelLeftTop);
  857. DoubleSpinBox* doubleSpinBoxLeftTopX = new DoubleSpinBox(subWidget);
  858. doubleSpinBoxLeftTopX->setObjectName(QString::fromUtf8("doubleSpinBoxLeftTopX"));
  859. doubleSpinBoxLeftTopX->setFixedWidth(100); // Set fixed width to 100
  860. doubleSpinBoxLeftTopX->setFixedWidth(100); // Set fixed width to 100
  861. subGridLayout->addWidget(doubleSpinBoxLeftTopX, 4, 1, 1, 1);
  862. vecControls.push_back(doubleSpinBoxLeftTopX);
  863. DoubleSpinBox* doubleSpinBoxLeftTopY = new DoubleSpinBox(subWidget);
  864. doubleSpinBoxLeftTopY->setObjectName(QString::fromUtf8("doubleSpinBoxLeftTopY"));
  865. doubleSpinBoxLeftTopY->setFixedWidth(100); // Set fixed width to 100
  866. doubleSpinBoxLeftTopY->setFixedWidth(100); // Set fixed width to 100
  867. subGridLayout->addWidget(doubleSpinBoxLeftTopY, 4, 2, 1, 1);
  868. vecControls.push_back(doubleSpinBoxLeftTopY);
  869. QLabel* labelRightTopPos = new QLabel(subWidget);
  870. labelRightTopPos->setObjectName(QString::fromUtf8("labelRightTopPos"));
  871. labelRightTopPos->setText(tr("Right Top Pos "));
  872. subGridLayout->addWidget(labelRightTopPos, 5, 0, 1, 1);
  873. vecControls.push_back(labelRightTopPos);
  874. DoubleSpinBox* doubleSpinBoxRightTopX = new DoubleSpinBox(subWidget);
  875. doubleSpinBoxRightTopX->setObjectName(QString::fromUtf8("doubleSpinBoxRightTopX"));
  876. doubleSpinBoxRightTopX->setFixedWidth(100); // Set fixed width to 100
  877. subGridLayout->addWidget(doubleSpinBoxRightTopX, 5, 1, 1, 1);
  878. vecControls.push_back(doubleSpinBoxRightTopX);
  879. DoubleSpinBox* doubleSpinBoxRightTopY = new DoubleSpinBox(subWidget);
  880. doubleSpinBoxRightTopY->setObjectName(QString::fromUtf8("doubleSpinBoxRightTopY"));
  881. doubleSpinBoxRightTopY->setFixedWidth(100); // Set fixed width to 100
  882. subGridLayout->addWidget(doubleSpinBoxRightTopY, 5, 2, 1, 1);
  883. vecControls.push_back(doubleSpinBoxRightTopY);
  884. QLabel* labelRightButtomPos = new QLabel(subWidget);
  885. labelRightButtomPos->setObjectName(QString::fromUtf8("labelRightButtomPos"));
  886. labelRightButtomPos->setText(tr("Right Buttom pos"));
  887. subGridLayout->addWidget(labelRightButtomPos, 6, 0, 1, 1);
  888. vecControls.push_back(labelRightButtomPos);
  889. DoubleSpinBox* doubleSpinBoxRightButtomX = new DoubleSpinBox(subWidget);
  890. doubleSpinBoxRightButtomX->setObjectName(QString::fromUtf8("doubleSpinBoxRightButtomX"));
  891. doubleSpinBoxRightButtomX->setFixedWidth(100); // Set fixed width to 100
  892. subGridLayout->addWidget(doubleSpinBoxRightButtomX, 6, 1, 1, 1);
  893. vecControls.push_back(doubleSpinBoxRightButtomX);
  894. DoubleSpinBox* doubleSpinBoxRightButtomY = new DoubleSpinBox(subWidget);
  895. doubleSpinBoxRightButtomY->setObjectName(QString::fromUtf8("doubleSpinBoxRightButtomY"));
  896. doubleSpinBoxRightButtomY->setFixedWidth(100); // Set fixed width to 100
  897. subGridLayout->addWidget(doubleSpinBoxRightButtomY, 6, 2, 1, 1);
  898. vecControls.push_back(doubleSpinBoxRightTopX);
  899. QLabel* labelNoBondPts = new QLabel(subWidget);
  900. labelNoBondPts->setObjectName(QString::fromUtf8("labelNoBondPts"));
  901. labelNoBondPts->setText(tr("No Bond Points"));
  902. subGridLayout->addWidget(labelNoBondPts, 7, 0, 1, 1);
  903. vecControls.push_back(labelNoBondPts);
  904. QLineEdit* lineEditNoBondPts = new QLineEdit(subWidget);
  905. lineEditNoBondPts->setObjectName(QString::fromUtf8("lineEditNoBondPts"));
  906. lineEditNoBondPts->setReadOnly(true);
  907. lineEditNoBondPts->setCursor(Qt::PointingHandCursor);
  908. lineEditNoBondPts->setProperty("vectorIndex", subVectorIndex); // 存储索引
  909. lineEditNoBondPts->setProperty("parentMatrixIndex", vectorIndex); // 设置父矩阵的索引
  910. lineEditNoBondPts->installEventFilter(this);
  911. subGridLayout->addWidget(lineEditNoBondPts, 7, 1, 1, 3);
  912. vecControls.push_back(lineEditNoBondPts);
  913. // Left Top Position X and Y
  914. QPushButton* buttonLeftTop = new QPushButton("Get Pos", subWidget);
  915. buttonLeftTop->setFixedWidth(62); // 设置固定宽度
  916. subGridLayout->addWidget(buttonLeftTop, 4, 3, 1, 1); // 添加按钮到4行3列
  917. connect(buttonLeftTop, &QPushButton::clicked, this, [=]() {
  918. XY_DOUBLE_STRUCT position = BondGetAxisPosition("UltraHead", m_vectBondMatrixs[subVectorIndex].LeftTopPoint);
  919. doubleSpinBoxLeftTopX->setValue(position.x); // 更新 X 轴
  920. doubleSpinBoxLeftTopY->setValue(position.y); // 更新 Y 轴
  921. });
  922. // Right Top Position X and Y
  923. QPushButton* buttonRightTop = new QPushButton("Get Pos", subWidget);
  924. buttonRightTop->setFixedWidth(62); // 设置固定宽度
  925. subGridLayout->addWidget(buttonRightTop, 5, 3, 1, 1); // 添加按钮到5行3列
  926. connect(buttonRightTop, &QPushButton::clicked, this, [=]() {
  927. XY_DOUBLE_STRUCT position = BondGetAxisPosition("UltraHead", m_vectBondMatrixs[subVectorIndex].RightTopPoint);
  928. doubleSpinBoxRightTopX->setValue(position.x); // 更新 X 轴
  929. doubleSpinBoxRightTopY->setValue(position.y); // 更新 Y 轴
  930. });
  931. // Right Bottom Position X and Y
  932. QPushButton* buttonRightButtom = new QPushButton("Get Pos", subWidget);
  933. buttonRightButtom->setFixedWidth(62); // 设置固定宽度
  934. subGridLayout->addWidget(buttonRightButtom, 6, 3, 1, 1); // 添加按钮到6行3列
  935. connect(buttonRightButtom, &QPushButton::clicked, this, [=]() {
  936. XY_DOUBLE_STRUCT position = BondGetAxisPosition("UltraHead", m_vectBondMatrixs[subVectorIndex].RightBottomPoint);
  937. doubleSpinBoxRightButtomX->setValue(position.x); // 更新 X 轴
  938. doubleSpinBoxRightButtomY->setValue(position.y); // 更新 Y 轴
  939. });
  940. //layout->addLayout(subGridLayout, 11, 0);
  941. QFrame* line = new QFrame(subWidget);
  942. line->setFrameShape(QFrame::NoFrame); // 移除默认框架
  943. line->setFixedHeight(2); // 设置固定高度
  944. line->setStyleSheet("background-color: #C7CAEB;");
  945. subGridLayout->addWidget(line, 10, 0, 1, 4);
  946. layout->addWidget(subWidget);
  947. m_mapSubWidgetIndex.insert(subWidget, subVectorIndex);
  948. spinBoxRow->setValue(subMatrix.MatrixRow);
  949. spinBoxCol->setValue(subMatrix.MatrixCol);
  950. doubleSpinBoxLeftTopX->setValue(subMatrix.LeftTopPoint.x);
  951. doubleSpinBoxLeftTopY->setValue(subMatrix.LeftTopPoint.y);
  952. doubleSpinBoxRightTopX->setValue(subMatrix.RightTopPoint.x);
  953. doubleSpinBoxRightTopY->setValue(subMatrix.RightTopPoint.y);
  954. doubleSpinBoxRightButtomX->setValue(subMatrix.RightBottomPoint.x);
  955. doubleSpinBoxRightButtomY->setValue(subMatrix.RightBottomPoint.y);
  956. connect(spinBoxRow, &SpinBox::editDone, this, [=]() {
  957. auto it = m_mapSubWidgetIndex.find(subWidget);
  958. m_vecSubMatrixs[it.value()].MatrixRow = spinBoxRow->value();
  959. });
  960. connect(spinBoxCol, &SpinBox::editDone, this, [=]() {
  961. auto it = m_mapSubWidgetIndex.find(subWidget);
  962. m_vecSubMatrixs[it.value()].MatrixCol = spinBoxCol->value();
  963. });
  964. connect(doubleSpinBoxLeftTopX, &DoubleSpinBox::editDone, this, [=]() {
  965. auto it = m_mapSubWidgetIndex.find(subWidget);
  966. m_vecSubMatrixs[it.value()].LeftTopPoint.x = doubleSpinBoxLeftTopX->value();
  967. });
  968. connect(doubleSpinBoxLeftTopY, &DoubleSpinBox::editDone, this, [=]() {
  969. auto it = m_mapSubWidgetIndex.find(subWidget);
  970. m_vecSubMatrixs[it.value()].LeftTopPoint.y = doubleSpinBoxLeftTopY->value();
  971. });
  972. connect(doubleSpinBoxRightTopX, &DoubleSpinBox::editDone, this, [=]() {
  973. auto it = m_mapSubWidgetIndex.find(subWidget);
  974. m_vecSubMatrixs[it.value()].RightTopPoint.x = doubleSpinBoxRightTopX->value();
  975. });
  976. connect(doubleSpinBoxRightTopY, &DoubleSpinBox::editDone, this, [=]() {
  977. auto it = m_mapSubWidgetIndex.find(subWidget);
  978. m_vecSubMatrixs[it.value()].RightTopPoint.y = doubleSpinBoxRightTopY->value();
  979. });
  980. connect(doubleSpinBoxRightButtomX, &DoubleSpinBox::editDone, this, [=]() {
  981. auto it = m_mapSubWidgetIndex.find(subWidget);
  982. m_vecSubMatrixs[it.value()].RightBottomPoint.x = doubleSpinBoxRightButtomX->value();
  983. });
  984. connect(doubleSpinBoxRightButtomY, &DoubleSpinBox::editDone, this, [=]() {
  985. auto it = m_mapSubWidgetIndex.find(subWidget);
  986. m_vecSubMatrixs[it.value()].RightBottomPoint.y = doubleSpinBoxRightButtomY->value();
  987. });
  988. connect(lineEditNoBondPts, &QLineEdit::textChanged, this, [=]() {
  989. auto it = m_mapSubWidgetIndex.find(subWidget);
  990. });
  991. }
  992. bool BondMatrixProgramPage::eventFilter(QObject* obj, QEvent* event) {
  993. if (event->type() == QEvent::MouseButtonPress)
  994. {
  995. auto* lineEdit = qobject_cast<QLineEdit*>(obj);
  996. if (lineEdit)
  997. {
  998. int index = lineEdit->property("vectorIndex").toInt(); // 当前矩阵索引
  999. int parentIndex = lineEdit->property("parentMatrixIndex").toInt(); // 父矩阵索引
  1000. onNoBondPtsClicked(lineEdit, index, parentIndex); // 传递父矩阵索引
  1001. return true; // 拦截事件
  1002. }
  1003. }
  1004. return QWidget::eventFilter(obj, event);
  1005. }
  1006. void BondMatrixProgramPage::onNoBondPtsClicked(QLineEdit* lineEdit, int index, int parentIndex) {
  1007. if (parentIndex != -1)
  1008. {
  1009. // 处理子矩阵的操作
  1010. if (index < 0 || index >= m_vecSubMatrixs.size()) return;
  1011. const auto& subMatrix = m_vecSubMatrixs[index];
  1012. NoBondPtEditDialog dlg(subMatrix.MatrixRow, subMatrix.MatrixCol, subMatrix.VecNoBondPt, this);
  1013. if (dlg.exec() == QDialog::Accepted)
  1014. {
  1015. QVector<XY_LONG_STRUCT> selected = dlg.getSelectedPoints();
  1016. m_vecSubMatrixs[index].VecNoBondPt = std::vector<XY_LONG_STRUCT>(selected.begin(), selected.end());
  1017. QStringList ptList;
  1018. for (const auto& pt : selected)
  1019. ptList << QString("(%1,%2)").arg(pt.x).arg(pt.y);
  1020. lineEdit->setText(ptList.join(" "));
  1021. }
  1022. // 这里可以用 parentIndex 来关联父矩阵(即大矩阵)做相应的操作
  1023. }
  1024. else
  1025. {
  1026. // 处理大矩阵的操作
  1027. if (index < 0 || index >= m_vectBondMatrixs.size()) return;
  1028. const auto& bondMatrix = m_vectBondMatrixs[index];
  1029. NoBondPtEditDialog dlg(bondMatrix.BondMatrixRow, bondMatrix.BondMatrixCol, bondMatrix.VecNoBondPt, this);
  1030. if (dlg.exec() == QDialog::Accepted)
  1031. {
  1032. QVector<XY_LONG_STRUCT> selected = dlg.getSelectedPoints();
  1033. m_vectBondMatrixs[index].VecNoBondPt = std::vector<XY_LONG_STRUCT>(selected.begin(), selected.end());
  1034. QStringList ptList;
  1035. for (const auto& pt : selected)
  1036. ptList << QString("(%1,%2)").arg(pt.x).arg(pt.y);
  1037. lineEdit->setText(ptList.join(" "));
  1038. }
  1039. // 这里也可以用 parentIndex 来关联父矩阵(即大矩阵)做相应的操作
  1040. }
  1041. }
  1042. void BondMatrixProgramPage::AddMatrixParam()
  1043. {
  1044. }
  1045. void BondMatrixProgramPage::UpdatePageParam()
  1046. {
  1047. int dieSourceIndex = 0;
  1048. if (m_curBondInfo.eDieSource == DIE_SOURCE::BY_WAFER)
  1049. {
  1050. dieSourceIndex = 1;
  1051. }
  1052. else if (m_curBondInfo.eDieSource == DIE_SOURCE::BY_WAFFLE)
  1053. {
  1054. dieSourceIndex = 0;
  1055. }
  1056. ui.comboBoxDieSource->setCurrentIndex(dieSourceIndex);
  1057. ui.spinBoxPickTempID->setValue(m_curBondInfo.iPickPRStrategyId);
  1058. ui.spinBoxPickNozzleID->setValue(m_curBondInfo.iPickHeadId);
  1059. ui.spinBoxPreBondTemp->setValue(m_curBondInfo.iBondFrontPRStrategyId);
  1060. ui.spinBoxPostBondTemp->setValue(m_curBondInfo.iBondBackPRStrategyId);
  1061. ui.spinBoxBondTemp->setValue(m_curBondInfo.iBondPRStrategyId);
  1062. ui.spinBoxLookUpTemp->setValue(m_curBondInfo.iLookUpPRStrategyId);
  1063. ui.spinBoxCalibPickTemp->setValue(m_curBondInfo.iCalibPRStrategyId);
  1064. ui.doubleSpinBoxBondOffsetX->setValue(m_curBondInfo.stOffset.x);
  1065. ui.doubleSpinBoxBondOffsetY->setValue(m_curBondInfo.stOffset.y);
  1066. ui.doubleSpinBoxBondOffsetAngle->setValue(m_curBondInfo.stOffset.a);
  1067. UpdatePagePickParam();
  1068. UpdatePageBondParam();
  1069. }
  1070. int BondMatrixProgramPage::ParamSaveAsEvent()
  1071. {
  1072. int iWaferPickParamId,iCalibPlaceParamId,iCalibPickParamId,iBondParamId;
  1073. m_manageDB->GetCProduct()->AddBondParam(m_curWaferPickParam, iWaferPickParamId); //SetBondParam(m_curWaferPickParam.iId, m_curWaferPickParam);
  1074. m_manageDB->GetCProduct()->AddBondParam(m_curCalibPlaceParam, iCalibPlaceParamId);
  1075. m_manageDB->GetCProduct()->AddBondParam(m_curCalibPickParam, iCalibPickParamId);
  1076. m_manageDB->GetCProduct()->AddBondParam(m_curBondParam, iBondParamId);
  1077. int iInfoId;
  1078. m_manageDB->GetCProduct()->AddBondInfoData(m_curBondInfo, iInfoId);
  1079. return iInfoId;
  1080. }
  1081. void BondMatrixProgramPage::ParamChangeEvent()
  1082. {
  1083. m_manageDB->GetCProduct()->SetBondInfoData(m_curBondInfo.iInfoId, m_curBondInfo);
  1084. m_manageDB->GetCProduct()->SetBondParam(m_curWaferPickParam.iId, m_curWaferPickParam);
  1085. m_manageDB->GetCProduct()->SetBondParam(m_curCalibPlaceParam.iId, m_curCalibPlaceParam);
  1086. m_manageDB->GetCProduct()->SetBondParam(m_curCalibPickParam.iId, m_curCalibPickParam);
  1087. m_manageDB->GetCProduct()->SetBondParam(m_curBondParam.iId, m_curBondParam);
  1088. CProduct* _Product = m_manageDB->GetCProduct();
  1089. }
  1090. void BondMatrixProgramPage::MatrixChangeEvent()
  1091. {
  1092. m_manageDB->GetCProduct()->SetAllBondMatrix(m_vectBondMatrixs, true);
  1093. m_manageDB->GetCProduct()->SetAllPointMatrix(m_vecSubMatrixs, true);
  1094. /*for (PROGRAM_BOND_MATRIX_STRUCT& bondMatrix : m_vectBondMatrixs)
  1095. {
  1096. m_manageDB->GetCProduct()->SetBondMatrix(bondMatrix.BondMatrixId, bondMatrix);
  1097. }*/
  1098. /*for (PROGRAM_POINT_MATRIX_STRUCT& pointMatrix : m_vecSubMatrixs)
  1099. {
  1100. m_manageDB->GetCProduct()->SetPointMatrix(pointMatrix.MatrixId, pointMatrix);
  1101. }*/
  1102. CProduct* _Product = m_manageDB->GetCProduct();
  1103. }
  1104. void BondMatrixProgramPage::UpdatePagePickParam()
  1105. {
  1106. //"取晶头取晶"
  1107. if (ui.comboBoxPickParamType->currentIndex() == 0)
  1108. {
  1109. ui.checkBoxPickBlockCheck->setChecked(m_curWaferPickParam.bCheckBlock);
  1110. ui.checkBoxPickLoseCheck->setChecked(m_curWaferPickParam.bCheckLose);
  1111. ui.checkBoxPickFindForceCheck->setChecked(m_curWaferPickParam.bFindForce);
  1112. ui.doubleSpinBoxPrePickZ->setValue(m_curWaferPickParam.dPreLev);
  1113. ui.doubleSpinBoxPickForce->setValue(m_curWaferPickParam.dForce);
  1114. ui.doubleSpinBoxPickPosZ->setValue(m_curWaferPickParam.dWorkLev);
  1115. ui.spinBoxPickGrabDelay->setValue(m_curWaferPickParam.iGrabDelay);
  1116. ui.spinBox_PickDelay->setValue(m_curWaferPickParam.iPickOrBondDelay);
  1117. ui.spinBoxPickBlockCheckDelay->setValue(m_curWaferPickParam.iBlockOrLoseDelay);
  1118. ui.spinBoxPickVacDelay->setValue(m_curWaferPickParam.iVacuumDelay);
  1119. ui.spinBoxPickBlowDelay->setValue(m_curWaferPickParam.iBlowDelay);
  1120. }
  1121. //"中转台取晶"
  1122. else if (ui.comboBoxPickParamType->currentIndex() == 1)
  1123. {
  1124. ui.checkBoxPickBlockCheck->setChecked(m_curCalibPickParam.bCheckBlock);
  1125. ui.checkBoxPickLoseCheck->setChecked(m_curCalibPickParam.bCheckLose);
  1126. ui.checkBoxPickFindForceCheck->setChecked(m_curCalibPickParam.bFindForce);
  1127. ui.doubleSpinBoxPrePickZ->setValue(m_curCalibPickParam.dPreLev);
  1128. ui.doubleSpinBoxPickForce->setValue(m_curCalibPickParam.dForce);
  1129. ui.doubleSpinBoxPickPosZ->setValue(m_curCalibPickParam.dWorkLev);
  1130. ui.spinBoxPickGrabDelay->setValue(m_curCalibPickParam.iGrabDelay);
  1131. ui.spinBox_PickDelay->setValue(m_curCalibPickParam.iPickOrBondDelay);
  1132. ui.spinBoxPickBlockCheckDelay->setValue(m_curCalibPickParam.iBlockOrLoseDelay);
  1133. ui.spinBoxPickVacDelay->setValue(m_curCalibPickParam.iVacuumDelay);
  1134. ui.spinBoxPickBlowDelay->setValue(m_curCalibPickParam.iBlowDelay);
  1135. }
  1136. }
  1137. void BondMatrixProgramPage::UpdatePageBondParam()
  1138. {
  1139. //"中转台放晶"
  1140. if (ui.comboBoxBondParamType->currentIndex() == 0)
  1141. {
  1142. ui.checkBoxBondBlockCheck->setChecked(m_curCalibPlaceParam.bCheckBlock);
  1143. ui.checkBoxBondLoseCheck->setChecked(m_curCalibPlaceParam.bCheckLose);
  1144. ui.checkBoxBondFindForce->setChecked(m_curCalibPlaceParam.bFindForce);
  1145. ui.doubleSpinBoxPreBondPosZ->setValue(m_curCalibPlaceParam.dPreLev);
  1146. ui.doubleSpinBoxBondForce->setValue(m_curCalibPlaceParam.dForce);
  1147. ui.doubleSpinBoxBondPosZ->setValue(m_curCalibPlaceParam.dWorkLev);
  1148. ui.spinBoxBondGrabDelay->setValue(m_curCalibPlaceParam.iGrabDelay);
  1149. ui.spinBoxBondDelay->setValue(m_curCalibPlaceParam.iPickOrBondDelay);
  1150. ui.spinBoxBondBlockCheckDelay->setValue(m_curCalibPlaceParam.iBlockOrLoseDelay);
  1151. ui.spinBoxBondVacDelay->setValue(m_curCalibPlaceParam.iVacuumDelay);
  1152. ui.spinBoxBondBlowDelay->setValue(m_curCalibPlaceParam.iBlowDelay);
  1153. }
  1154. //"固晶台固晶"
  1155. else if (ui.comboBoxBondParamType->currentIndex() == 1)
  1156. {
  1157. ui.checkBoxBondBlockCheck->setChecked(m_curBondParam.bCheckBlock);
  1158. ui.checkBoxBondLoseCheck->setChecked(m_curBondParam.bCheckLose);
  1159. ui.checkBoxBondFindForce->setChecked(m_curBondParam.bFindForce);
  1160. ui.doubleSpinBoxPreBondPosZ->setValue(m_curBondParam.dPreLev);
  1161. ui.doubleSpinBoxBondForce->setValue(m_curBondParam.dForce);
  1162. ui.doubleSpinBoxBondPosZ->setValue(m_curBondParam.dWorkLev);
  1163. ui.spinBoxBondGrabDelay->setValue(m_curBondParam.iGrabDelay);
  1164. ui.spinBoxBondDelay->setValue(m_curBondParam.iPickOrBondDelay);
  1165. ui.spinBoxBondBlockCheckDelay->setValue(m_curBondParam.iBlockOrLoseDelay);
  1166. ui.spinBoxBondVacDelay->setValue(m_curBondParam.iVacuumDelay);
  1167. ui.spinBoxBondBlowDelay->setValue(m_curBondParam.iBlowDelay);
  1168. }
  1169. }
  1170. void BondMatrixProgramPage::initPage()
  1171. {
  1172. //for (int i = 0; i < m_vectBondMatrixs.size(); i++)
  1173. //{
  1174. // for (int j = 0; j < m_vectBondMatrixs[i].VecPointMatrixId.size(); j++)
  1175. // {
  1176. // PROGRAM_POINT_MATRIX_STRUCT subMatrix;
  1177. // m_manageDB->GetCProduct()->GetPointMatrix(m_vectBondMatrixs[i].VecPointMatrixId[j], subMatrix);
  1178. // m_vecSubMatrixs.push_back(subMatrix);
  1179. // //AddMatrixPage(i, j, subMatrix);
  1180. // }
  1181. // AddOutMatrixPage(i, m_vectBondMatrixs[i], m_vecSubMatrixs);
  1182. //}
  1183. for (int i = 0; i < m_vectBondMatrixs.size(); i++)
  1184. {
  1185. AddOutMatrixPage(i, m_vectBondMatrixs[i], m_vecSubMatrixs);
  1186. }
  1187. //for (int i = 0; i < m_vectBondMatrixs[0].VecPointMatrixId.size(); ++i)
  1188. //{
  1189. // PROGRAM_POINT_MATRIX_STRUCT subMatrix;
  1190. // m_manageDB->GetCProduct()->GetPointMatrix(m_vectBondMatrixs[0].VecPointMatrixId[i], subMatrix);
  1191. // m_vecSubMatrixs.push_back(subMatrix);
  1192. //}
  1193. //m_manageDB->GetCProduct()->GetDieMatrix(m_vectBondMatrixs[0].VecPointMatrixId[0], m_vecSubMatrixs);
  1194. //显示矩阵数据
  1195. /*ui.spinBoxRow->setValue(m_vectBondMatrixs[0].BondMatrixRow);
  1196. ui.spinBoxCol->setValue(m_vectBondMatrixs[0].BondMatrixCol);
  1197. ui.doubleSpinBoxLeftTopX->setValue(m_vectBondMatrixs[0].LeftTopPoint.x);
  1198. ui.doubleSpinBoxLeftTopY->setValue(m_vectBondMatrixs[0].LeftTopPoint.y);
  1199. ui.doubleSpinBoxRightTopX->setValue(m_vectBondMatrixs[0].RightTopPoint.x);
  1200. ui.doubleSpinBoxRightTopY->setValue(m_vectBondMatrixs[0].RightTopPoint.y);
  1201. ui.doubleSpinBoxRightButtomX->setValue(m_vectBondMatrixs[0].RightBottomPoint.x);
  1202. ui.doubleSpinBoxRightButtomY->setValue(m_vectBondMatrixs[0].RightBottomPoint.y);
  1203. QString noBondPts = "";
  1204. bool firstTime = false;
  1205. for (XY_LONG_STRUCT& pt : m_vectBondMatrixs[0].VecNoBondPt)
  1206. {
  1207. if (firstTime)
  1208. {
  1209. noBondPts += "(" + QString::number(pt.x) + "," + QString::number(pt.y) + ")";
  1210. firstTime = true;
  1211. }
  1212. noBondPts += ";(" + QString::number(pt.x) + "," + QString::number(pt.y) + ")";
  1213. }
  1214. ui.lineEditNoBondPts->setText(noBondPts);*/
  1215. //显示子矩阵及数据
  1216. //for (PROGRAM_POINT_MATRIX_STRUCT& subMatrix : m_vecSubMatrixs)
  1217. //{
  1218. // AddMatrixPage(subMatrix);
  1219. //}
  1220. //从后端获取参数, 一套数据
  1221. CResources* pResources = CResources::GetInstance();
  1222. if (pResources == nullptr)
  1223. {
  1224. return;
  1225. }
  1226. CBondMatrix* pBondMatrix = pResources->GetBondMatrix();
  1227. if (pBondMatrix == nullptr)
  1228. {
  1229. return;
  1230. }
  1231. UpdateShowBondInfoData(m_vectBondMatrixs[0].BondInfoId);
  1232. ////pBondMatrix->GetPintInfoByIndex(0, m_curPointInfo);
  1233. //m_manageDB->GetCProduct()->GetBondInfoData(m_vectBondMatrixs[0].BondInfoId, m_curBondInfo);
  1234. //m_manageDB->GetCProduct()->GetBondParam(m_curBondInfo.iPickParamId, m_curWaferPickParam);
  1235. //m_manageDB->GetCProduct()->GetBondParam(m_curBondInfo.iCalibBondParamId, m_curCalibPlaceParam);
  1236. //m_manageDB->GetCProduct()->GetBondParam(m_curBondInfo.iCalibPickParamId, m_curCalibPickParam);
  1237. //m_manageDB->GetCProduct()->GetBondParam(m_curBondInfo.iBondParamId, m_curBondParam);
  1238. ////显示界面参数
  1239. //UpdatePageParam();
  1240. }
  1241. void BondMatrixProgramPage::UpdateShowBondInfoData(UINT iInfoId) {
  1242. //pBondMatrix->GetPintInfoByIndex(0, m_curPointInfo);
  1243. m_manageDB->GetCProduct()->GetBondInfoData(iInfoId, m_curBondInfo);
  1244. m_manageDB->GetCProduct()->GetBondParam(m_curBondInfo.iPickParamId, m_curWaferPickParam);
  1245. m_manageDB->GetCProduct()->GetBondParam(m_curBondInfo.iCalibBondParamId, m_curCalibPlaceParam);
  1246. m_manageDB->GetCProduct()->GetBondParam(m_curBondInfo.iCalibPickParamId, m_curCalibPickParam);
  1247. m_manageDB->GetCProduct()->GetBondParam(m_curBondInfo.iBondParamId, m_curBondParam);
  1248. //显示界面参数
  1249. UpdatePageParam();
  1250. }