From 4a17d9968a0fd04d672170324a767fa8b224bd52 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期三, 25 六月 2025 14:09:31 +0800
Subject: [PATCH] 1.Reveive信息获取错误,已修正;

---
 SourceCode/Bond/Servo/CEquipment.cpp |   31 ++++++++++++++++++++++++-------
 SourceCode/Bond/Servo/CEquipment.h   |    5 +++--
 2 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/SourceCode/Bond/Servo/CEquipment.cpp b/SourceCode/Bond/Servo/CEquipment.cpp
index df249c7..5336a26 100644
--- a/SourceCode/Bond/Servo/CEquipment.cpp
+++ b/SourceCode/Bond/Servo/CEquipment.cpp
@@ -410,6 +410,7 @@
 			onSendAble();
 		}
 
+		index += 0x40 * 2;
 		for (int i = 0; i < 8; i++) {
 			m_bLinkSignalToDownstream[i][SIGNAL_UPSTREAM_INLINE] = isBitOn(pszData, size, index + 0);
 			m_bLinkSignalToDownstream[i][SIGNAL_UPSTREAM_TROUBLE] = isBitOn(pszData, size, index + 1);
@@ -418,7 +419,7 @@
 			index += 0x40;
 		}
 		if (m_bLinkSignalToDownstream[0][SIGNAL_RECEIVE_ABLE]) {
-			onSendAble();
+			onReceiveAble();
 		}
 
 		// 其它信号及响应
@@ -1236,6 +1237,23 @@
 		return nullptr;
 	}
 
+	CSlot* CEquipment::getAvailableSlotForGlassExcludeSignal(MaterialsType type)
+	{
+		for (int i = 0; i < SLOT_MAX; i++) {
+			if (!m_slot[i].isEnable()) continue;
+			if (m_slot[i].isLock()) continue;
+			if (!m_slot[i].isEmpty()) continue;
+
+			MaterialsType slotType = m_slot[i].getType();
+			if (type == MaterialsType::G1 && slotType == MaterialsType::G2) continue;
+			if (type == MaterialsType::G2 && slotType == MaterialsType::G1) continue;
+
+			return &m_slot[i];
+		}
+
+		return nullptr;
+	}
+
 	CSlot* CEquipment::getAvailableSlotForGlass2(MaterialsType type, const std::vector<int>& candidates)
 	{
 		for (auto item : candidates) {
@@ -1679,7 +1697,7 @@
 		CJobDataS* pJobDataS = pGlass->getJobDataS();
 		ASSERT(pJobDataS);
 		if (!compareJobData(pJobDataB, pJobDataS)) {
-			LOGE("<CFliper-%s>onPreFetchedOutJob,JobData数据不匹配(JobDataB(%d, %d),JobDataS(%d, %d)), 注意排查风险!", m_strName.c_str(),
+			LOGE("<CEquipemnt-%s>onPreFetchedOutJob,JobData数据不匹配(JobDataB(%d, %d),JobDataS(%d, %d)), 注意排查风险!", m_strName.c_str(),
 				pJobDataB->getCassetteSequenceNo(), pJobDataB->getJobSequenceNo(),
 				pJobDataS->getCassetteSequenceNo(), pJobDataS->getJobSequenceNo());
 			return FALSE;
@@ -1687,10 +1705,10 @@
 
 		// 如果没有可用位置,报错
 		Lock();
-		CSlot* pSlot = getAvailableSlotForGlass((MaterialsType)pJobDataS->getMaterialsType());
+		CSlot* pSlot = getAvailableSlotForGlassExcludeSignal((MaterialsType)pJobDataS->getMaterialsType());
 		if (pSlot == nullptr) {
 			Unlock();
-			LOGE("<CFliper-%s>onPreFetchedOutJob,找不到匹配的Slot,不能进料,请注意风险!", m_strName.c_str());
+			LOGE("<CEquipemnt-%s>onPreFetchedOutJob,找不到匹配的Slot,不能进料,请注意风险!", m_strName.c_str());
 			return FALSE;
 		}
 		Unlock();
@@ -1748,10 +1766,9 @@
 		return 0;
 	}
 
-	int CEquipment::onRecieveAble()
+	int CEquipment::onReceiveAble()
 	{
-		LOGI("<CEquipment-%s>onRecieveAble.", m_strName.c_str());
-
+		LOGI("<CEquipment-%s>onReceiveAble.", m_strName.c_str());
 
 		return 0;
 	}
diff --git a/SourceCode/Bond/Servo/CEquipment.h b/SourceCode/Bond/Servo/CEquipment.h
index 8807f13..1aa5abd 100644
--- a/SourceCode/Bond/Servo/CEquipment.h
+++ b/SourceCode/Bond/Servo/CEquipment.h
@@ -43,7 +43,7 @@
 #define SIGNAL_UPSTREAM_TROUBLE	1
 #define SIGNAL_INTERLOCK		2
 #define SIGNAL_SEND_ABLE		3
-#define SIGNAL_RECEIVE_ABLE		4
+#define SIGNAL_RECEIVE_ABLE		3
 
 	typedef std::function<void(int writeCode, int retCode)> ONWRITEDRET;
 
@@ -126,7 +126,7 @@
 		virtual int onStoredJob(int port, CJobDataB* pJobDataB);
 		virtual int onProcessData(CProcessData* pProcessData);
 		virtual int onSendAble();
-		virtual int onRecieveAble();
+		virtual int onReceiveAble();
 		virtual int onProcessStateChanged(PROCESS_STATE state);
 		virtual int getIndexerOperationModeBaseValue();
 		bool isAlarmStep(SERVO::CStep* pStep);
@@ -167,6 +167,7 @@
 
 		// 获取一个指定物料类型(G1,G2,G1&G2)的空槽位
 		CSlot* getAvailableSlotForGlass(MaterialsType type);
+		CSlot* getAvailableSlotForGlassExcludeSignal(MaterialsType type);
 
 		// 在指定的槽列表中,获取一个指定物料类型(G1,G2,G1&G2)的空槽位
 		CSlot* getAvailableSlotForGlass2(MaterialsType type, const std::vector<int>& candidates);

--
Gitblit v1.9.3