From 30847e604bbf072a0b6a4577cf395ff1a617bac3 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期四, 24 七月 2025 08:51:17 +0800
Subject: [PATCH] 1.LoadPort状态变为InUse的时候不自动弹出LoadPort配置对话框; 2.修改调度逻辑,G2和G1分别进入Bonder的间隔不要太长,防止G2先进入Bonder,等待烘烤中的G1太久,在高温Bonder下出问题;

---
 SourceCode/Bond/Servo/PortConfigurationDlg.cpp |    7 +++
 SourceCode/Bond/Servo/CMaster.cpp              |   88 +++++++++++++++++++++++++++++++++++--------
 SourceCode/Bond/Servo/ServoDlg.cpp             |    6 +-
 SourceCode/Bond/Servo/CBonder.h                |    1 
 SourceCode/Bond/Servo/CBonder.cpp              |    6 +++
 5 files changed, 87 insertions(+), 21 deletions(-)

diff --git a/SourceCode/Bond/Servo/CBonder.cpp b/SourceCode/Bond/Servo/CBonder.cpp
index 3c42d87..c4cb52f 100644
--- a/SourceCode/Bond/Servo/CBonder.cpp
+++ b/SourceCode/Bond/Servo/CBonder.cpp
@@ -464,6 +464,12 @@
 		return pBuddy != nullptr;
 	}
 
+	BOOL CBonder::hasG2Class()
+	{
+		CGlass* pGlass = (CGlass*)m_slot[0].getContext();
+		return (pGlass != nullptr);
+	}
+
 	int CBonder::onProcessData(CProcessData* pProcessData)
 	{
 		CEquipment::onProcessData(pProcessData);
diff --git a/SourceCode/Bond/Servo/CBonder.h b/SourceCode/Bond/Servo/CBonder.h
index 7fa6aea..4e8edcd 100644
--- a/SourceCode/Bond/Servo/CBonder.h
+++ b/SourceCode/Bond/Servo/CBonder.h
@@ -29,6 +29,7 @@
         void setIndex(unsigned int index);
         unsigned int getIndex();
         BOOL hasBondClass();
+        BOOL hasG2Class();
 
     private:
         unsigned int m_nIndex;
diff --git a/SourceCode/Bond/Servo/CMaster.cpp b/SourceCode/Bond/Servo/CMaster.cpp
index 6c9a004..5b6d6e9 100644
--- a/SourceCode/Bond/Servo/CMaster.cpp
+++ b/SourceCode/Bond/Servo/CMaster.cpp
@@ -660,8 +660,10 @@
 
 				// Fliper(G2) -> Bonder
 				// VacuumBake(G1) -> Bonder
+				SERVO::CRobotTask* tempTask[2] = {nullptr, nullptr};
 				if (!rmd.armState[1] && !pBonder1->hasBondClass()) {
-					m_pActiveRobotTask = createTransferTask(pFliper, pBonder1, primaryType, secondaryType, 2);
+					tempTask[0] = createTransferTask(pFliper, pBonder1, primaryType, secondaryType, 2);
+					/*
 					if (m_pActiveRobotTask != nullptr) {
 						m_pActiveRobotTask->pick();
 						std::string strDescription = m_pActiveRobotTask->getDescription();
@@ -672,24 +674,12 @@
 						LOGI("创建新任务<%s>...", strDescription.c_str());
 						continue;
 					}
-				}
-
-				if (!rmd.armState[1] && !pBonder2->hasBondClass()) {
-					m_pActiveRobotTask = createTransferTask(pFliper, pBonder2, primaryType, secondaryType, 2);
-					if (m_pActiveRobotTask != nullptr) {
-						m_pActiveRobotTask->pick();
-						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;
-					}
+					*/
 				}
 
 				if (!rmd.armState[0] && !pBonder1->hasBondClass()) {
-					m_pActiveRobotTask = createTransferTask(pVacuumBake, pBonder1, primaryType, secondaryType);
+					tempTask[1] = createTransferTask(pVacuumBake, pBonder1, primaryType, secondaryType);
+					/*
 					if (m_pActiveRobotTask != nullptr) {
 						m_pActiveRobotTask->pick();
 						std::string strDescription = m_pActiveRobotTask->getDescription();
@@ -700,10 +690,51 @@
 						LOGI("创建新任务<%s>...", strDescription.c_str());
 						continue;
 					}
+					*/
+				}
+
+				if (tempTask[1] != nullptr && pBonder1->hasG2Class()) {
+					m_pActiveRobotTask = tempTask[1];
+					if(tempTask[0] != nullptr) delete tempTask[0];
+				}
+				else if (tempTask[0] != nullptr && tempTask[1] != nullptr) {
+					m_pActiveRobotTask = tempTask[0];
+					delete tempTask[1];
+				}
+				if (m_pActiveRobotTask != nullptr) {
+					m_pActiveRobotTask->pick();
+					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;
+				}
+
+				if (tempTask[0] != nullptr) delete tempTask[0];
+				if (tempTask[1] != nullptr) delete tempTask[1];
+				tempTask[0] = nullptr;
+				tempTask[1] = nullptr;
+				if (!rmd.armState[1] && !pBonder2->hasBondClass()) {
+					tempTask[0] = createTransferTask(pFliper, pBonder2, primaryType, secondaryType, 2);
+					/*
+					if (m_pActiveRobotTask != nullptr) {
+						m_pActiveRobotTask->pick();
+						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;
+					}
+					*/
 				}
 
 				if (!rmd.armState[0] && !pBonder2->hasBondClass()) {
-					m_pActiveRobotTask = createTransferTask(pVacuumBake, pBonder2, primaryType, secondaryType);
+					tempTask[1] = createTransferTask(pVacuumBake, pBonder2, primaryType, secondaryType);
+					/*
 					if (m_pActiveRobotTask != nullptr) {
 						m_pActiveRobotTask->pick();
 						std::string strDescription = m_pActiveRobotTask->getDescription();
@@ -714,8 +745,31 @@
 						LOGI("创建新任务<%s>...", strDescription.c_str());
 						continue;
 					}
+					*/
 				}
 
+				if (tempTask[1] != nullptr && pBonder1->hasG2Class()) {
+					m_pActiveRobotTask = tempTask[1];
+					if (tempTask[0] != nullptr) delete tempTask[0];
+				}
+				else if (tempTask[0] != nullptr && tempTask[1] != nullptr) {
+					m_pActiveRobotTask = tempTask[0];
+					delete tempTask[1];
+				}
+				if (m_pActiveRobotTask != nullptr) {
+					m_pActiveRobotTask->pick();
+					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;
+				}
+				if (tempTask[0] != nullptr) delete tempTask[0];
+				if (tempTask[1] != nullptr) delete tempTask[1];
+				tempTask[0] = nullptr;
+				tempTask[1] = nullptr;
 
 				// Aligner -> Fliper(G2)
 				// Aligner -> VacuumBake(G1)
diff --git a/SourceCode/Bond/Servo/PortConfigurationDlg.cpp b/SourceCode/Bond/Servo/PortConfigurationDlg.cpp
index 62b883a..d960f3b 100644
--- a/SourceCode/Bond/Servo/PortConfigurationDlg.cpp
+++ b/SourceCode/Bond/Servo/PortConfigurationDlg.cpp
@@ -240,7 +240,6 @@
     GetDlgItem(IDC_BUTTON_PROCESS_START)->EnableWindow(FALSE);
     GetDlgItem(IDC_BUTTON_PROCESS_CANCEL)->EnableWindow(FALSE);
 
-
 	return TRUE;  // return TRUE unless you set the focus to a control
 	// 寮傚父: OCX 灞炴�ч〉搴旇繑鍥� FALSE
 }
@@ -254,6 +253,12 @@
 	}
 
 	// 鍔犺浇閫変腑绔彛鐨勯厤缃埌 UI
+    for (int i = 1; i <= 8; i++) {
+        m_wndGrid.SetItemText(i, 0, "");
+        m_wndGrid.SetItemText(i, 1, "");
+        m_wndGrid.SetCellType(i, 1, RUNTIME_CLASS(CGridCellNumeric));
+    }
+    m_wndGrid.Invalidate();
 	LoadPortConfigToUI(m_pPort[selPort]);
 }
 
diff --git a/SourceCode/Bond/Servo/ServoDlg.cpp b/SourceCode/Bond/Servo/ServoDlg.cpp
index bde44da..cec70de 100644
--- a/SourceCode/Bond/Servo/ServoDlg.cpp
+++ b/SourceCode/Bond/Servo/ServoDlg.cpp
@@ -244,9 +244,9 @@
 			else if (RX_CODE_LOADPORT_INUSE == code) {
 				SERVO::CLoadPort* pLoadPort = nullptr;
 				if (pAny->getPtrValue("ptr", (void*&)pLoadPort)) {
-					CPortConfigurationDlg dlg;
-					dlg.setCurSelPort(pLoadPort->getIndex());
-					dlg.DoModal();
+					//CPortConfigurationDlg dlg;
+					//dlg.setCurSelPort(pLoadPort->getIndex());
+					//dlg.DoModal();
 				}
 			}
 

--
Gitblit v1.9.3