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完成后,合成两片一起搬送的逻辑问题;

---
 /dev/null                              |    0 
 SourceCode/Bond/x64/Debug/EqsGraph.ini |    2 
 .gitignore                             |    1 
 SourceCode/Bond/Servo/CArm.cpp         |    4 ++
 SourceCode/Bond/Servo/CSlot.cpp        |   11 -----
 SourceCode/Bond/Servo/CEquipment.cpp   |   11 +++--
 SourceCode/Bond/Servo/CArmTray.cpp     |    4 ++
 SourceCode/Bond/Servo/CMaster.cpp      |   22 +++++-----
 SourceCode/Bond/Servo/Model.cpp        |    2 
 SourceCode/Bond/Servo/ServoDlg.cpp     |   35 ++++++++++-------
 SourceCode/Bond/Servo/CBonder.cpp      |    5 ++
 11 files changed, 54 insertions(+), 43 deletions(-)

diff --git a/.gitignore b/.gitignore
index f1a3d18..cde4f6a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -52,3 +52,4 @@
 SourceCode/Bond/x64/Debug/Backups/
 Document/鍏变韩鏂囦欢澶�/
 Document/鍏变韩鏂囦欢澶�.rar
+SourceCode/Bond/x64/Debug/Master.dat
diff --git a/SourceCode/Bond/Servo/CArm.cpp b/SourceCode/Bond/Servo/CArm.cpp
index 3a8d15b..cf6320e 100644
--- a/SourceCode/Bond/Servo/CArm.cpp
+++ b/SourceCode/Bond/Servo/CArm.cpp
@@ -106,6 +106,10 @@
 		pGlass = pPreviousGlass;
 		pGlass->addRef();
 		m_slot[0].setContext(nullptr);
+		CGlass* pBuddy = pGlass->getBuddy();
+		if (pBuddy != nullptr) {
+			m_slot[1].setContext(nullptr);
+		}
 		Unlock();
 
 		if (m_listener.onDataChanged != nullptr) {
diff --git a/SourceCode/Bond/Servo/CArmTray.cpp b/SourceCode/Bond/Servo/CArmTray.cpp
index 6e74681..0a043b6 100644
--- a/SourceCode/Bond/Servo/CArmTray.cpp
+++ b/SourceCode/Bond/Servo/CArmTray.cpp
@@ -41,6 +41,10 @@
 		m_slot[0].setPosition(m_nID);
 		m_slot[0].setNo(1);
 		m_slot[0].setName("Slot 1");
+		m_slot[1].enable();
+		m_slot[1].setPosition(m_nID);
+		m_slot[1].setNo(2);
+		m_slot[1].setName("Slot 2");
 	}
 
 	void CArmTray::onTimer(UINT nTimerid)
diff --git a/SourceCode/Bond/Servo/CBonder.cpp b/SourceCode/Bond/Servo/CBonder.cpp
index c7bd953..4a48f1e 100644
--- a/SourceCode/Bond/Servo/CBonder.cpp
+++ b/SourceCode/Bond/Servo/CBonder.cpp
@@ -390,6 +390,11 @@
 		Lock();
 		CGlass* pGlass1 = getGlassFromSlot(1);
 		CGlass* pGlass2 = getGlassFromSlot(2);
+		if (pGlass1 == nullptr || pGlass2 == nullptr) {
+			LOGE("<CBonder-%s>onProcessData,错误!不满足两片玻璃且分别为G1与G2的条件,请检查数据是否正确!", m_strName.c_str());
+			Unlock();
+			return -1;
+		}
 		if (pGlass1->getBuddy() != nullptr || pGlass2->getBuddy() != nullptr) {
 			LOGE("<CBonder-%s>onProcessData,错误!玻璃较早前已被绑定,请检查数据是否正确!", m_strName.c_str());
 			Unlock();
diff --git a/SourceCode/Bond/Servo/CEquipment.cpp b/SourceCode/Bond/Servo/CEquipment.cpp
index 0a7d384..bd36700 100644
--- a/SourceCode/Bond/Servo/CEquipment.cpp
+++ b/SourceCode/Bond/Servo/CEquipment.cpp
@@ -777,16 +777,19 @@
 
 
 		// 如果此玻璃已经贴合,贴合的玻璃也要从加入到列表中
-		/*
 		CGlass* pBuddy = pGlass->getBuddy();
 		if (pBuddy != nullptr) {
 			Lock();
 			pBuddy->addPath(m_nID);
-			pBuddy->addRef();					// 加入list,addRef
-			m_glassList.push_back(pBuddy);
+			if (putSlot % 2 == 0) {
+				m_slot[putSlot - 2].setContext(pBuddy);
+			}
+			else {
+				m_slot[putSlot].setContext(pBuddy);
+			}
 			Unlock();
 		}
-		*/
+
 
 		if (m_listener.onDataChanged != nullptr) {
 			m_listener.onDataChanged(this, EDCC_STORED_JOB);
diff --git a/SourceCode/Bond/Servo/CMaster.cpp b/SourceCode/Bond/Servo/CMaster.cpp
index cbcfcde..41b9205 100644
--- a/SourceCode/Bond/Servo/CMaster.cpp
+++ b/SourceCode/Bond/Servo/CMaster.cpp
@@ -373,7 +373,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;
@@ -384,7 +384,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;
@@ -396,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;
@@ -407,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;
@@ -421,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;
@@ -432,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;
@@ -452,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;
@@ -463,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;
@@ -477,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;
@@ -488,7 +488,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;
@@ -669,7 +669,7 @@
 
 					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;
diff --git a/SourceCode/Bond/Servo/CSlot.cpp b/SourceCode/Bond/Servo/CSlot.cpp
index 958d5c6..94299a1 100644
--- a/SourceCode/Bond/Servo/CSlot.cpp
+++ b/SourceCode/Bond/Servo/CSlot.cpp
@@ -122,23 +122,12 @@
 	void CSlot::serialize(CArchive& ar)
 	{
 		if (ar.IsStoring()) {
-			ar << m_nPosition;
-			ar << m_nNo;
-			ar << (int)m_materialsType;
-			WriteString(ar, m_strName);
 			ar << (__int64)m_pContext;
-			ar << m_bEnable;
 			ar << m_bLock;
 		}
 		else {
-			int i32;
 			__int64 i64;
-			ar >> m_nPosition;
-			ar >> m_nNo;
-			ar >> i32; m_materialsType = (MaterialsType)i32;
-			ReadString(ar, m_strName);
 			ar >> i64; m_pTempContext = (CContext*)i64;
-			ar >> m_bEnable;
 			ar >> m_bLock;
 		}
 	}
diff --git a/SourceCode/Bond/Servo/Model.cpp b/SourceCode/Bond/Servo/Model.cpp
index 30793da..e39f62d 100644
--- a/SourceCode/Bond/Servo/Model.cpp
+++ b/SourceCode/Bond/Servo/Model.cpp
@@ -248,7 +248,7 @@
 		int nRecordId = 0;
 		TransferManager::getInstance().addTransferRecord(data, nRecordId);
 
-		notifyPtr(RX_CODE_EQ_ROBOT_TASK, pTask);
+		notifyPtrAndInt(RX_CODE_EQ_ROBOT_TASK, pTask, nullptr, code);
 		LOGI("<CModel>onRobotTaskEvent: 任务记录已保存,RecordID=%d", nRecordId);
 	};
 	m_master.setListener(masterListener);
diff --git a/SourceCode/Bond/Servo/ServoDlg.cpp b/SourceCode/Bond/Servo/ServoDlg.cpp
index 17306f8..80117a5 100644
--- a/SourceCode/Bond/Servo/ServoDlg.cpp
+++ b/SourceCode/Bond/Servo/ServoDlg.cpp
@@ -188,21 +188,26 @@
 				}
 			}
 			else if (RX_CODE_EQ_ROBOT_TASK == code) {
-				SERVO::CRobotTask* pTask = theApp.m_model.getMaster().getActiveRobotTask();
-				if (m_pRobotTaskDlg != nullptr) {
-					m_pRobotTaskDlg->SetRobotTask(pTask);
-				}
-				if (pTask == nullptr) {
-					m_pMyStatusbar->setCurTaskBtnText("无");
-				}
-				else {
-					SERVO::CEquipment* pEq1, * pEq2;
-					pEq1 = theApp.m_model.getMaster().getEquipment(pTask->getSrcPosition());
-					pEq2 = theApp.m_model.getMaster().getEquipment(pTask->getTarPosition());
-					if (pEq1 != nullptr && pEq2 != nullptr) {
-						CString strText;
-						strText.Format(_T("%s --> %s"), pEq1->getName().c_str(), pEq2->getName().c_str());
-						m_pMyStatusbar->setCurTaskBtnText((LPTSTR)(LPCTSTR)strText);
+				int exCode;
+				if (pAny->getIntValue("exCode", exCode)) {
+					if (exCode == ROBOT_EVENT_CREATE) {
+						SERVO::CRobotTask* pTask = theApp.m_model.getMaster().getActiveRobotTask();
+						ASSERT(pTask);
+						if (m_pRobotTaskDlg) {
+							m_pRobotTaskDlg->SetRobotTask(pTask);
+						}
+
+						SERVO::CEquipment* pEq1, * pEq2;
+						pEq1 = theApp.m_model.getMaster().getEquipment(pTask->getSrcPosition());
+						pEq2 = theApp.m_model.getMaster().getEquipment(pTask->getTarPosition());
+						if (pEq1 != nullptr && pEq2 != nullptr) {
+							CString strText;
+							strText.Format(_T("%s --> %s"), pEq1->getName().c_str(), pEq2->getName().c_str());
+							m_pMyStatusbar->setCurTaskBtnText((LPTSTR)(LPCTSTR)strText);
+						}
+					}
+					else if (exCode == ROBOT_EVENT_FINISH) {
+						m_pMyStatusbar->setCurTaskBtnText("无");
 					}
 				}
 			}
diff --git a/SourceCode/Bond/x64/Debug/EqsGraph.ini b/SourceCode/Bond/x64/Debug/EqsGraph.ini
index 9b63e87..3860bf9 100644
--- a/SourceCode/Bond/x64/Debug/EqsGraph.ini
+++ b/SourceCode/Bond/x64/Debug/EqsGraph.ini
@@ -39,7 +39,7 @@
 Top=63
 [Arm Tray2]
 Left=467
-Top=166
+Top=167
 [Fliper(G2)]
 Left=238
 Top=251
diff --git a/SourceCode/Bond/x64/Debug/Master.dat b/SourceCode/Bond/x64/Debug/Master.dat
deleted file mode 100644
index 697ea90..0000000
--- a/SourceCode/Bond/x64/Debug/Master.dat
+++ /dev/null
Binary files differ

--
Gitblit v1.9.3