From dba7d2725cefc162ef58a53bb12b4656434c8bc0 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期一, 30 六月 2025 08:42:17 +0800
Subject: [PATCH] 1.调试后更新优化;
---
SourceCode/Bond/Servo/CBakeCooling.h | 2
SourceCode/Bond/Servo/CEquipment.cpp | 83 ++++++++++++++++++++++++-----------------
SourceCode/Bond/Servo/CMaster.cpp | 4 +-
SourceCode/Bond/Servo/CEquipment.h | 8 ++--
SourceCode/Bond/Servo/CBakeCooling.cpp | 2
5 files changed, 57 insertions(+), 42 deletions(-)
diff --git a/SourceCode/Bond/Servo/CBakeCooling.cpp b/SourceCode/Bond/Servo/CBakeCooling.cpp
index 314d86f..5a7bbb0 100644
--- a/SourceCode/Bond/Servo/CBakeCooling.cpp
+++ b/SourceCode/Bond/Servo/CBakeCooling.cpp
@@ -419,6 +419,6 @@
{
CGlass* pGlass = getGlassFromSlot(slot);
if (pGlass == nullptr) return false;
- return pGlass->isProcessed(m_nID, slot);
+ return pGlass->isProcessed(m_nID, getSlotUnit(slot));
}
}
diff --git a/SourceCode/Bond/Servo/CBakeCooling.h b/SourceCode/Bond/Servo/CBakeCooling.h
index 86edf49..f60eab1 100644
--- a/SourceCode/Bond/Servo/CBakeCooling.h
+++ b/SourceCode/Bond/Servo/CBakeCooling.h
@@ -22,7 +22,7 @@
virtual void getAttributeVector(CAttributeVector& attrubutes);
virtual int recvIntent(CPin* pPin, CIntent* pIntent);
virtual int getIndexerOperationModeBaseValue();
- virtual short getSlotUnit(short slot) { return slot % 2 == 1 ? 0 : 1; };
+ virtual short getSlotUnit(short slotNo) { return slotNo % 2 == 1 ? 0 : 1; };
virtual bool isSlotProcessed(int slot);
};
}
diff --git a/SourceCode/Bond/Servo/CEquipment.cpp b/SourceCode/Bond/Servo/CEquipment.cpp
index c7d1cb7..c7cc0db 100644
--- a/SourceCode/Bond/Servo/CEquipment.cpp
+++ b/SourceCode/Bond/Servo/CEquipment.cpp
@@ -406,10 +406,12 @@
m_bLinkSignalToUpstream[i][SIGNAL_INTERLOCK] = isBitOn(pszData, size, index + 2);
m_bLinkSignalToUpstream[i][SIGNAL_SEND_ABLE] = isBitOn(pszData, size, index + 3);
index += 0x40;
+
+ if (m_bLinkSignalToUpstream[i][SIGNAL_SEND_ABLE]) {
+ onSendAble(i+1);
+ }
}
- if(m_bLinkSignalToUpstream[0][SIGNAL_SEND_ABLE]) {
- onSendAble();
- }
+
index += 0x40 * 2;
for (int i = 0; i < 8; i++) {
@@ -418,10 +420,12 @@
m_bLinkSignalToDownstream[i][SIGNAL_INTERLOCK] = isBitOn(pszData, size, index + 2);
m_bLinkSignalToDownstream[i][SIGNAL_RECEIVE_ABLE] = isBitOn(pszData, size, index + 3);
index += 0x40;
+
+ if (m_bLinkSignalToDownstream[0][SIGNAL_RECEIVE_ABLE]) {
+ onReceiveAble(i + 1);
+ }
}
- if (m_bLinkSignalToDownstream[0][SIGNAL_RECEIVE_ABLE]) {
- onReceiveAble();
- }
+
// 其它信号及响应
index = 0x540;
@@ -844,17 +848,23 @@
// 找到指定的glass id,
Lock();
- CGlass* pGlass = (CGlass*)m_slot[port - 1].getContext();
- if (pGlass == nullptr && !compareJobData(pJobDataB, pGlass->getJobDataS())) {
+ CGlass* pContext = nullptr;
+ for (int i = 0; i < SLOT_MAX; i++) {
+ CGlass* pGlass = (CGlass*)m_slot[i].getContext();
+ if (pGlass != nullptr && compareJobData(pJobDataB, pGlass->getJobDataS())) {
+ pContext = pGlass;
+ if (pGlass != nullptr) pGlass->addRef();
+ m_slot[i].setContext(nullptr);
+ break;
+ }
+ }
+ if (pContext == nullptr) {
Unlock();
return -3;
}
- if (pGlass != nullptr) pGlass->addRef();
- m_slot[port - 1].setContext(nullptr);
-
- ((CArm*)m_pArm)->tempStore(pGlass);
- pGlass->release();
+ ((CArm*)m_pArm)->tempStore(pContext);
+ pContext->release();
Unlock();
@@ -869,7 +879,7 @@
return 0;
}
- int CEquipment::storedJob(int port, CJobDataB* pJobDataB)
+ int CEquipment::storedJob(int port, CJobDataB* pJobDataB, short putSlot)
{
if (m_pArm == nullptr) {
return -1;
@@ -883,8 +893,8 @@
ASSERT(pGlass);
Lock();
- pGlass->addPath(m_nID, port);
- m_slot[port - 1].setContext(pGlass);
+ pGlass->addPath(m_nID, getSlotUnit(putSlot));
+ m_slot[putSlot - 1].setContext(pGlass);
pGlass->release(); // tempFetchOut需要调用一次release
Unlock();
@@ -895,7 +905,7 @@
if (m_listener.onDataChanged != nullptr) {
m_listener.onDataChanged(this, EDCC_STORED_JOB);
}
-
+
return 0;
}
@@ -943,7 +953,6 @@
CGlass* CEquipment::getGlassWithCassette(int cassetteSequenceNo, int jobSequenceNo)
{
- CSlot* pSlot = nullptr;
for (int i = 0; i < SLOT_MAX; i++) {
if (!m_slot[i].isEnable()) continue;
CGlass* pGlass = (CGlass*)m_slot[i].getContext();
@@ -1297,7 +1306,7 @@
if (!m_slot[i].isEnable()) continue;
if (m_slot[i].isLock()) continue;
CGlass* pGlass = (CGlass*)m_slot[i].getContext();
- if (!isSlotProcessed(i+1)) continue;
+ if (!isSlotProcessed(i)) continue;
if (pGlass == nullptr) continue;
int lsPath = m_slot[i].getLinkSignalPath();
if(!m_bLinkSignalToUpstream[lsPath][SIGNAL_UPSTREAM_INLINE]
@@ -1787,14 +1796,23 @@
if (m_processState != PROCESS_STATE::Complete) {
setProcessState(PROCESS_STATE::Complete);
}
- CGlass* pGlass = getGlassFromSlot(port);
+
+ CGlass* pGlass = getGlassFromSlot(slotNo);
if (pGlass == nullptr) {
LOGE("<CEquipment-%s>decodeJobProcessEndReport, 找不到对应glass", getName().c_str());
}
else {
- pGlass->processEnd(m_nID, port);
- if (m_processState != PROCESS_STATE::Complete) {
- setProcessState(PROCESS_STATE::Complete);
+ CJobDataS* pJs = pGlass->getJobDataS();
+ if (pJs->getCassetteSequenceNo() == cassetteNo
+ && pJs->getJobSequenceNo() == jobSequenceNo) {
+ pGlass->processEnd(m_nID, getSlotUnit(slotNo));
+ if (m_processState != PROCESS_STATE::Complete) {
+ setProcessState(PROCESS_STATE::Complete);
+ }
+ }
+ else {
+ LOGE("<CEquipment-%s>decodeJobProcessEndReport, jobSequenceNo或jobSequenceNo不匹配",
+ getName().c_str());
}
}
@@ -1844,7 +1862,7 @@
// 如果没有可用位置,报错
Lock();
- CSlot* pSlot = getSlot(port - 1);
+ CSlot* pSlot = getSlot(putSlot - 1);
ASSERT(pSlot);
if (pSlot->getContext() != nullptr) {
Unlock();
@@ -1874,12 +1892,12 @@
short putSlot = 0;
BOOL bCheck = onPreStoredJob(port, pJobDataB, putSlot);
- if (bCheck && port == putSlot) {
- return storedJob(port, pJobDataB);
+ if (bCheck) {
+ return storedJob(port, pJobDataB, putSlot);
}
// 数据异常,处理或显示
- LOGI("<CEquipment-%s>onStoredJob Error.ort:%d|GlassId:%s",
+ LOGI("<CEquipment-%s>onStoredJob Error.port:%d|GlassId:%s",
m_strName.c_str(), port, pJobDataB->getGlassId().c_str());
return -1;
}
@@ -1895,19 +1913,16 @@
* 当从CC-Link检测到设备Send Able为On时调用此函数
* 可能会多次重复调用(根据扫描频率), 注意防呆
*/
- int CEquipment::onSendAble()
+ int CEquipment::onSendAble(int port)
{
- LOGI("<CEquipment-%s>onSendAble.", m_strName.c_str());
- if (m_processState != PROCESS_STATE::Complete) {
- setProcessState(PROCESS_STATE::Complete);
- }
+ LOGI("<CEquipment-%s>onSendAble.port:%d", m_strName.c_str(), port);
return 0;
}
- int CEquipment::onReceiveAble()
+ int CEquipment::onReceiveAble(int port)
{
- LOGI("<CEquipment-%s>onReceiveAble.", m_strName.c_str());
+ LOGI("<CEquipment-%s>onReceiveAble.port:%d", m_strName.c_str(), port);
return 0;
}
diff --git a/SourceCode/Bond/Servo/CEquipment.h b/SourceCode/Bond/Servo/CEquipment.h
index e1a6901..f7ca3bc 100644
--- a/SourceCode/Bond/Servo/CEquipment.h
+++ b/SourceCode/Bond/Servo/CEquipment.h
@@ -110,14 +110,14 @@
virtual void onReceiveLBData(const char* pszData, size_t size);
virtual int onStepEvent(CStep* pStep, int code);
virtual CPin* addPin(PinType type, char* pszName);
- virtual short getSlotUnit(short slot) { return 0; };
+ virtual short getSlotUnit(short slotNo) { return 0; };
CPin* getPin(char* pszName);
std::vector<CPin*>& CEquipment::getInputPins();
std::vector<CPin*>& CEquipment::getOutputPins();
CRecipeList* getRecipeList(int unitNo);
virtual int recvIntent(CPin* pPin, CIntent* pIntent);
virtual int fetchedOutJob(int port, CJobDataB* pJobDataB);
- virtual int storedJob(int port, CJobDataB* pJobDataB);
+ virtual int storedJob(int port, CJobDataB* pJobDataB, short putSlot);
virtual int onReceivedJob(int port, CJobDataS* pJobDataS);
virtual int onSentOutJob(int port, CJobDataS* pJobDataS);
virtual BOOL onPreFetchedOutJob(int port, CJobDataB* pJobDataB);
@@ -125,8 +125,8 @@
virtual BOOL onPreStoredJob(int port, CJobDataB* pJobDataB, short& putSlot);
virtual int onStoredJob(int port, CJobDataB* pJobDataB);
virtual int onProcessData(CProcessData* pProcessData);
- virtual int onSendAble();
- virtual int onReceiveAble();
+ virtual int onSendAble(int port);
+ virtual int onReceiveAble(int port);
virtual int onProcessStateChanged(PROCESS_STATE state);
virtual int getIndexerOperationModeBaseValue();
virtual bool isSlotProcessed(int slot) { return true; };
diff --git a/SourceCode/Bond/Servo/CMaster.cpp b/SourceCode/Bond/Servo/CMaster.cpp
index 602cdf2..cba74ae 100644
--- a/SourceCode/Bond/Servo/CMaster.cpp
+++ b/SourceCode/Bond/Servo/CMaster.cpp
@@ -835,7 +835,7 @@
if (m_pActiveRobotTask != nullptr) {
if (m_pActiveRobotTask->getSrcPosition() == p->getID()) {
CGlass* pGlass = p->getGlassFromSlot(m_pActiveRobotTask->getSrcSlot());
- if (pGlass != nullptr && port == m_pActiveRobotTask->getSrcSlot()) {
+ if (pGlass != nullptr) {
CJobDataS* pJobDataS = pGlass->getJobDataS();
if (pJobDataS != nullptr
&& pJobDataS->getCassetteSequenceNo() == pJobDataB->getCassetteSequenceNo()
@@ -879,7 +879,7 @@
else if (m_pActiveRobotTask->isPlacing() &&
m_pActiveRobotTask->getTarPosition() == p->getID()) {
CGlass* pGlass = p->getGlassFromSlot(m_pActiveRobotTask->getTarSlot());
- if (pGlass == nullptr && m_pActiveRobotTask->getTarSlot() == port) {
+ if (pGlass == nullptr) {
bOk = TRUE;
slot = m_pActiveRobotTask->getTarSlot();
LOGI("<CMaster>onPreFethedOutJob, 已校验数据一致性.");
--
Gitblit v1.9.3