From 690bbf01bc579aff0ca31b2f326c7a6b5d83604d Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期四, 05 六月 2025 10:51:13 +0800
Subject: [PATCH] 1.Slot的部分数据不需要存储,否则影响代码修改Slot布局等信息; 2.Bonder Porcess完成后,合成两片一起搬送的逻辑问题;

---
 SourceCode/Bond/Servo/CMaster.cpp |   76 ++++++++++++++++++++++++++++++-------
 1 files changed, 61 insertions(+), 15 deletions(-)

diff --git a/SourceCode/Bond/Servo/CMaster.cpp b/SourceCode/Bond/Servo/CMaster.cpp
index 33a5fc7..41b9205 100644
--- a/SourceCode/Bond/Servo/CMaster.cpp
+++ b/SourceCode/Bond/Servo/CMaster.cpp
@@ -294,6 +294,7 @@
 		CAligner* pAligner = (CAligner*)getEquipment(EQ_ID_ALIGNER);
 		CBonder* pBonder1 = (CBonder*)getEquipment(EQ_ID_Bonder1);
 		CBonder* pBonder2 = (CBonder*)getEquipment(EQ_ID_Bonder2);
+		CBakeCooling* pBakeCooling = (CBakeCooling*)getEquipment(EQ_ID_BAKE_COOLING);
 
 		ASSERT(pLoadPort1);
 		ASSERT(pLoadPort2);
@@ -302,6 +303,7 @@
 		ASSERT(pAligner);
 		ASSERT(pBonder1);
 		ASSERT(pBonder2);
+		ASSERT(pBakeCooling);
 
 		while (1) {
 			// 待退出信号或时间到
@@ -365,6 +367,28 @@
 				}
 
 
+				// Bonder -> BakeCooling
+				m_pActiveRobotTask = createTransferTask_bonder_to_bakecooling(pBonder1, pBakeCooling, primaryType, secondaryType);
+				if (m_pActiveRobotTask != nullptr) {
+					std::string strDescription = m_pActiveRobotTask->getDescription();
+					unlock();
+					if (m_listener.onRobotTaskEvent != nullptr) {
+						m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
+					}
+					LOGI("创建新任务<%s>...", strDescription.c_str());
+					continue;
+				}
+
+				m_pActiveRobotTask = createTransferTask_bonder_to_bakecooling(pBonder2, pBakeCooling, primaryType, secondaryType);
+				if (m_pActiveRobotTask != nullptr) {
+					std::string strDescription = m_pActiveRobotTask->getDescription();
+					unlock();
+					if (m_listener.onRobotTaskEvent != nullptr) {
+						m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
+					}
+					LOGI("创建新任务<%s>...", strDescription.c_str());
+					continue;
+				}
 
 				// Aligner -> Bonder
 				m_pActiveRobotTask = createTransferTask(pAligner, pBonder1, primaryType, secondaryType);
@@ -372,7 +396,7 @@
 					std::string strDescription = m_pActiveRobotTask->getDescription();
 					unlock();
 					if (m_listener.onRobotTaskEvent != nullptr) {
-						m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, 0);
+						m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
 					}
 					LOGI("创建新任务<%s>...", strDescription.c_str());
 					continue;
@@ -383,7 +407,7 @@
 					std::string strDescription = m_pActiveRobotTask->getDescription();
 					unlock();
 					if (m_listener.onRobotTaskEvent != nullptr) {
-						m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, 0);
+						m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
 					}
 					LOGI("创建新任务<%s>...", strDescription.c_str());
 					continue;
@@ -397,7 +421,7 @@
 					std::string strDescription = m_pActiveRobotTask->getDescription();
 					unlock();
 					if (m_listener.onRobotTaskEvent != nullptr) {
-						m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, 0);
+						m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
 					}
 					LOGI("创建新任务<%s>...", strDescription.c_str());
 					continue;
@@ -408,7 +432,7 @@
 					std::string strDescription = m_pActiveRobotTask->getDescription();
 					unlock();
 					if (m_listener.onRobotTaskEvent != nullptr) {
-						m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, 0);
+						m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
 					}
 					LOGI("创建新任务<%s>...", strDescription.c_str());
 					continue;
@@ -428,7 +452,7 @@
 					std::string strDescription = m_pActiveRobotTask->getDescription();
 					unlock();
 					if (m_listener.onRobotTaskEvent != nullptr) {
-						m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, 0);
+						m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
 					}
 					LOGI("创建新任务<%s>...", strDescription.c_str());
 					continue;
@@ -439,7 +463,7 @@
 					std::string strDescription = m_pActiveRobotTask->getDescription();
 					unlock();
 					if (m_listener.onRobotTaskEvent != nullptr) {
-						m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, 0);
+						m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
 					}
 					LOGI("创建新任务<%s>...", strDescription.c_str());
 					continue;
@@ -453,7 +477,7 @@
 					std::string strDescription = m_pActiveRobotTask->getDescription();
 					unlock();
 					if (m_listener.onRobotTaskEvent != nullptr) {
-						m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, 0);
+						m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
 					}
 					LOGI("创建新任务<%s>...", strDescription.c_str());
 					continue;
@@ -464,14 +488,11 @@
 					std::string strDescription = m_pActiveRobotTask->getDescription();
 					unlock();
 					if (m_listener.onRobotTaskEvent != nullptr) {
-						m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, 0);
+						m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
 					}
 					LOGI("创建新任务<%s>...", strDescription.c_str());
 					continue;
 				}
-
-
-				// Bonder -> BakeCooling
 
 
 				// BakeCooling ->Measurement
@@ -647,9 +668,8 @@
 
 
 					lock();
-
 					if (m_listener.onRobotTaskEvent != nullptr) {
-						m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, 1);
+						m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_FINISH);
 					}
 					delete m_pActiveRobotTask;
 					m_pActiveRobotTask = nullptr;
@@ -1074,10 +1094,36 @@
 		CRobotTask* pTask = nullptr;
 		CSlot* pSrcSlot, * pTarSlot;
 		pTarSlot = pTarEq->getAvailableSlotForGlass(primaryType);
-		pSrcSlot = pSrcEq->getNonEmptySlot(primaryType);
+		pSrcSlot = pSrcEq->getProcessedSlot(primaryType);
 		if (pSrcSlot == nullptr || nullptr == pTarSlot) {
 			pTarSlot = pTarEq->getAvailableSlotForGlass(secondaryType);
-			pSrcSlot = pSrcEq->getNonEmptySlot(secondaryType);
+			pSrcSlot = pSrcEq->getProcessedSlot(secondaryType);
+		}
+
+
+		if (pSrcSlot != nullptr && nullptr != pTarSlot) {
+			pTask = new CRobotTask();
+			pTask->setContext(pSrcSlot->getContext());
+			pTask->setRobotTransferParam(++taskSeqNo, 1, pSrcSlot->getPosition(),
+				pTarSlot->getPosition(), pSrcSlot->getNo(), pTarSlot->getNo());
+		}
+
+
+		return pTask;
+	}
+
+	CRobotTask* CMaster::createTransferTask_bonder_to_bakecooling(CEquipment* pSrcEq, CEquipment* pTarEq,
+		MaterialsType primaryType/* = MaterialsType::G1*/, MaterialsType secondaryType/* = MaterialsType::G2*/)
+	{
+		std::vector<int> slots = {1, 2};
+
+		CRobotTask* pTask = nullptr;
+		CSlot* pSrcSlot, * pTarSlot;
+		pTarSlot = pTarEq->getAvailableSlotForGlass2(primaryType, slots);
+		pSrcSlot = pSrcEq->getProcessedSlot(primaryType);
+		if (pSrcSlot == nullptr || nullptr == pTarSlot) {
+			pTarSlot = pTarEq->getAvailableSlotForGlass(secondaryType);
+			pSrcSlot = pSrcEq->getProcessedSlot(secondaryType);
 		}
 
 

--
Gitblit v1.9.3