From b2aa706dfea78ad2e327fb5e414207af69d23d64 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期六, 13 九月 2025 11:33:04 +0800
Subject: [PATCH] 1.对话框显示工艺参数,可复制到剪贴板; 2.修复几处因按回车或ESC键导致页面被关闭的问题; 3.修复解释警告数据文本失败的问题; 4.更新警告文本,显示警告详细信息; 5.完善警告描述内容 ;

---
 SourceCode/Bond/Servo/CMaster.cpp |  122 +++++++++++++++++++++++++++++++++++++++-
 1 files changed, 118 insertions(+), 4 deletions(-)

diff --git a/SourceCode/Bond/Servo/CMaster.cpp b/SourceCode/Bond/Servo/CMaster.cpp
index 3b2d01f..0925933 100644
--- a/SourceCode/Bond/Servo/CMaster.cpp
+++ b/SourceCode/Bond/Servo/CMaster.cpp
@@ -53,7 +53,7 @@
 		m_ullRunTime = 0;
 		m_state = MASTERSTATE::READY;
 		m_pActiveRobotTask = nullptr;
-		m_nLastError = 0;
+		m_nLastError = ER_CODE_NOERROR;
 		m_isCompareMapsBeforeProceeding = FALSE;
 		m_bJobMode = FALSE;
 		m_bEnableEventReport = true;
@@ -307,7 +307,7 @@
 		return 0;
 	}
 
-	int CMaster::stop()
+	int CMaster::stop(int nErCode/* = ER_CODE_NOERROR*/)
 	{
 		// 运行时间为累加结果,本次停止时刷新;
 		lock();
@@ -321,6 +321,7 @@
 
 
 		// 更新状态
+		m_nLastError = nErCode;
 		setState(MASTERSTATE::STOPPING);
 
 
@@ -423,6 +424,7 @@
 					});
 				if (nRet != 0) {
 					LOGE("<Master>EFEM切换Start状态失败");
+					m_nLastError = ER_CODE_OPERATION_MODE_FAIL;
 					m_strLastError = "EFEM切换Start状态失败.";
 					goto WAIT;
 				}
@@ -436,6 +438,7 @@
 					});
 				if (nRet != 0) {
 					LOGE("<Master>Bonder1切换Start状态失败");
+					m_nLastError = ER_CODE_BONDER_OPERATION_MODE_FAIL;
 					m_strLastError = "Bonder1切换Start状态失败.";
 					goto WAIT;
 				}
@@ -449,6 +452,7 @@
 					});
 				if (nRet != 0) {
 					LOGE("<Master>Bonder2切换Start状态失败");
+					m_nLastError = ER_CODE_BONDER_OPERATION_MODE_FAIL;
 					m_strLastError = "Bonder2切换Start状态失败.";
 					goto WAIT;
 				}
@@ -462,6 +466,7 @@
 					});
 				if (nRet != 0) {
 					LOGE("<Master>BakeCooling切换Start状态失败");
+					m_nLastError = ER_CODE_OPERATION_MODE_FAIL;
 					m_strLastError = "BakeCooling切换Start状态失败.";
 					goto WAIT;
 				}
@@ -475,6 +480,7 @@
 					});
 				if (nRet != 0) {
 					LOGE("<Master>VacuumBake切换Start状态失败");
+					m_nLastError = ER_CODE_OPERATION_MODE_FAIL;
 					m_strLastError = "VacuumBake切换Start状态失败.";
 					goto WAIT;
 				}
@@ -488,6 +494,7 @@
 					});
 				if (nRet != 0) {
 					LOGE("<Master>Measurement切换Start状态失败");
+					m_nLastError = ER_CODE_OPERATION_MODE_FAIL;
 					m_strLastError = "Measurement切换Start状态失败.";
 					goto WAIT;
 				}
@@ -546,6 +553,7 @@
 						});
 					if (nRet != 0) {
 						LOGE("<Master>%s切换Stop状态发送失败", pEq[i]->getName().c_str());
+						m_nLastError = ER_CODE_OPERATION_MODE_FAIL;
 						m_strLastError = pEq[i]->getName() + "切换Stop状态发送失败.";
 						bIomcOk[i] = FALSE;
 						promises[i].set_value(); // 避免 wait 阻塞
@@ -570,7 +578,11 @@
 				}
 
 				LOGI("<Master>所有设备成功切换到 Stop 模式");
-				setState(MASTERSTATE::READY);
+				if(m_nLastError == ER_CODE_NOERROR)
+					setState(MASTERSTATE::READY);
+				else
+					setState(MASTERSTATE::ATHERERROR);
+
 				continue;
 			}
 
@@ -774,6 +786,7 @@
 								continue;
 							}
 
+							pGlass->queue();
 							pGlass->start();
 							pEFEM->setContext(m_pActiveRobotTask->getContext());
 							goto PORT_GET;
@@ -1450,6 +1463,8 @@
 					if (m_pActiveRobotTask->getSrcPosition() == EQ_ID_MEASUREMENT) {
 						CGlass* pGlass = (CGlass*)m_pActiveRobotTask->getContext();
 						pGlass->complete();
+						CGlass* pBuddy = pGlass->getBuddy();
+						if (pBuddy != nullptr) pBuddy->complete();
 						this->saveState();
 						bool bMoved = glassFromInPorcessToComplete(pGlass);
 						if (bMoved) {
@@ -1572,6 +1587,25 @@
 				strOut.append(szBuffer);
 			}
 			LOGD("<CMaster-%s>SVDataReport:%s", ((CEquipment*)pEquipment)->getName().c_str(), strOut.c_str());
+		};
+		listener.onPanelDataReport = [&](void* pEquipment, void* pContext) {
+			LOGD("<CMaster-%s>onPanelDataReport", ((CEquipment*)pEquipment)->getName().c_str());
+
+			CEquipment* pEq = (CEquipment*)pEquipment;
+			CGlass* pGlass = (CGlass*)pContext;
+
+			// 如果AOI检测失败,要停机
+			if (pEq->getID() == EQ_ID_MEASUREMENT) {
+				LOGD("<CMaster-%s>onPanelDataReport 01", ((CEquipment*)pEquipment)->getName().c_str());
+				if (pGlass->getAOIInspResult() == InspResult::Fail) {
+					LOGD("<CMaster-%s>onPanelDataReport 02", ((CEquipment*)pEquipment)->getName().c_str());
+					if (stop() == 0) {
+						m_nLastError = ER_CODE_AOI_NG;
+						m_strLastError = "AOI检测未通过.";
+					}
+				}
+			}
+
 		};
 		pEquipment->setListener(listener);
 		pEquipment->setCcLink(&m_cclink);
@@ -1833,6 +1867,8 @@
 			if (!m_inProcesGlasses.empty()) {
 				CGlass* pGlass = m_inProcesGlasses.front();
 				pGlass->complete();
+				CGlass* pBuddy = pGlass->getBuddy();
+				if (pBuddy != nullptr) pBuddy->complete();
 				glassFromInPorcessToComplete(pGlass);
 				this->saveState();
 
@@ -2040,7 +2076,7 @@
 		pTarSlot = pTarEq->getAvailableSlotForGlass(primaryType);
 		pSrcSlot = pSrcEq->getProcessedSlot(primaryType, bJobMode);
 		if (m_nTestFlag == 1) LOGD("createTransferTask 003 %x, %x", pTarSlot, pSrcSlot);
-		if (pSrcSlot == nullptr || nullptr == pTarSlot && secondaryType != SERVO::MaterialsType::G0) {
+		if ((pSrcSlot == nullptr || nullptr == pTarSlot) && secondaryType != SERVO::MaterialsType::G0) {
 			pTarSlot = pTarEq->getAvailableSlotForGlass(secondaryType);
 			pSrcSlot = pSrcEq->getProcessedSlot(secondaryType, bJobMode);
 		}
@@ -2277,6 +2313,22 @@
 		int eqid[] = { EQ_ID_LOADPORT1, EQ_ID_LOADPORT2, EQ_ID_LOADPORT3, EQ_ID_LOADPORT4 };
 		CLoadPort* pPort = (CLoadPort*)getEquipment(eqid[index]);
 		pPort->localEanblePort(bEnable);
+	}
+
+	int CMaster::getPortCassetteSnSeed(int port)
+	{
+		ASSERT(1 <= port && port <= 4);
+		int eqid[] = { EQ_ID_LOADPORT1, EQ_ID_LOADPORT2, EQ_ID_LOADPORT3, EQ_ID_LOADPORT4 };
+		CLoadPort* pPort = (CLoadPort*)getEquipment(eqid[port - 1]);
+		return pPort->getPortCassetteSnSeed();
+	}
+
+	void CMaster::setPortCassetteSnSeed(int port, int seed)
+	{
+		ASSERT(1 <= port && port <= 4);
+		int eqid[] = { EQ_ID_LOADPORT1, EQ_ID_LOADPORT2, EQ_ID_LOADPORT3, EQ_ID_LOADPORT4 };
+		CLoadPort* pPort = (CLoadPort*)getEquipment(eqid[port - 1]);
+		return pPort->setPortCassetteSnSeed(seed);
 	}
 
 	void CMaster::setCompareMapsBeforeProceeding(BOOL bCompare)
@@ -2712,4 +2764,66 @@
 
 		return (int)glasses.size();
 	}
+
+	int CMaster::getLastError()
+	{
+		return m_nLastError;
+	}
+
+	std::string& CMaster::getLastErrorText()
+	{
+		return m_strLastError;
+	}
+
+	void CMaster::test()
+	{
+		if (stop() == 0) {
+			m_nLastError = ER_CODE_AOI_NG;
+			m_strLastError = "AOI检测未通过.";
+		}
+	}
+
+	bool CMaster::moveGlassToBuf(int eqid, int slotNo)
+	{
+		CEquipment* pEquipment = getEquipment(eqid);
+		if (pEquipment == nullptr) return false;
+
+		CSlot* pSlot = pEquipment->getSlotWithNo(slotNo);
+		if (pSlot == nullptr) return false;
+
+		CGlass* pGlass = (CGlass*)pSlot->getContext();
+		m_bufGlass.push_back(pGlass);
+		pGlass->addRef();
+		pSlot->setContext(nullptr);
+
+		m_bDataModify = TRUE;
+		if (m_listener.onEqDataChanged != nullptr) {
+			m_listener.onEqDataChanged(this, pEquipment, 0);
+		}
+
+		return true;
+	}
+
+	bool CMaster::moveGlassToSlot(int eqid, int slotNo)
+	{
+		CEquipment* pEquipment = getEquipment(eqid);
+		if (pEquipment == nullptr) return false;
+
+		CSlot* pSlot = pEquipment->getSlotWithNo(slotNo);
+		if (pSlot == nullptr) return false;
+		if (m_bufGlass.empty()) return false;
+
+		CGlass* pGlass = m_bufGlass.front();
+		m_bufGlass.pop_front();
+		if (pGlass == nullptr) return false;
+		pSlot->setContext(pGlass);
+		pGlass->release();
+
+		m_bDataModify = TRUE;
+		if (m_listener.onEqDataChanged != nullptr) {
+			m_listener.onEqDataChanged(this, pEquipment, 0);
+		}
+
+		return true;
+	}
 }

--
Gitblit v1.9.3