From 1e0e0a4401a783651398c2545e152013d6003939 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期二, 29 七月 2025 15:19:27 +0800
Subject: [PATCH] 1.Port编码错位问题修复; 2.调度时的判断条件优化。 3.支持上料下料混合;
---
SourceCode/Bond/Servo/CPageGraph2.cpp | 82 --------------------------
SourceCode/Bond/Servo/CPagePortProperty.cpp | 12 +--
SourceCode/Bond/Servo/CPagePortStatus.cpp | 15 ++--
SourceCode/Bond/Servo/Servo.rc | 0
SourceCode/Bond/Servo/CMaster.cpp | 23 +++----
SourceCode/Bond/Servo/CMaster.h | 4
SourceCode/Bond/Servo/Model.cpp | 6 +-
SourceCode/Bond/Servo/CEquipment.h | 4
SourceCode/Bond/Servo/CLoadPort.cpp | 26 ++------
SourceCode/Bond/Servo/ServoDlg.cpp | 2
SourceCode/Bond/Servo/CPortStatusReport.cpp | 3 -
SourceCode/Bond/Servo/Common.h | 2
12 files changed, 42 insertions(+), 137 deletions(-)
diff --git a/SourceCode/Bond/Servo/CEquipment.h b/SourceCode/Bond/Servo/CEquipment.h
index 079e4af..28bf252 100644
--- a/SourceCode/Bond/Servo/CEquipment.h
+++ b/SourceCode/Bond/Servo/CEquipment.h
@@ -55,7 +55,7 @@
typedef std::function<BOOL(void* pEiuipment, int port, CJobDataB* pJobDataB, short& putSlot)> ONPRESTOREDJOB;
typedef std::function<void(void* pEiuipment, PROCESS_STATE state)> ONPROCESSSTATE;
typedef std::function<void(void* pEiuipment, short scanMap, short downMap)> ONMAPMISMATCH;
- typedef std::function<void(void* pEiuipment, short scanMap)> ONPORTINUSE;
+ typedef std::function<void(void* pEiuipment, short status, __int64 data)> ONPORTSTATUSCHANGED;
typedef struct _EquipmentListener
{
ONALIVE onAlive;
@@ -67,7 +67,7 @@
ONPRESTOREDJOB onPreStoredJob;
ONPROCESSSTATE onProcessStateChanged;
ONMAPMISMATCH onMapMismatch;
- ONPORTINUSE onPortInUse;
+ ONPORTSTATUSCHANGED onPortStatusChanged;
} EquipmentListener;
diff --git a/SourceCode/Bond/Servo/CLoadPort.cpp b/SourceCode/Bond/Servo/CLoadPort.cpp
index 37f3139..29b9050 100644
--- a/SourceCode/Bond/Servo/CLoadPort.cpp
+++ b/SourceCode/Bond/Servo/CLoadPort.cpp
@@ -9,8 +9,8 @@
CLoadPort::CLoadPort() : CEquipment()
{
m_nIndex = 0;
- m_portType = PortType::Loading;
- m_portMode = PortMode::ReadyToLoad;
+ m_portType = PortType::Both;
+ m_portMode = PortMode::OutOfService;
m_cassetteType = CassetteType::G1;
m_transferMode = TransferMode::AGVMode;
m_bEnable = FALSE;
@@ -115,6 +115,7 @@
[&](void* pFrom, int code, const char* pszData, size_t size) -> int {
if (code == ROK && pszData != nullptr && size > 0) {
m_portMode = (PortMode)CToolUnits::toInt16(pszData);
+ LOGI("<LoadPort-%d>m_portMode:%d", m_nIndex, m_portMode);
}
return 0;
});
@@ -355,10 +356,10 @@
static int ii = 0;
ii++;
if (ii == 20) {
- char szBuffer[64];
+ char szBuffer[64] = {0};
CStep* pStep = getStepWithName(STEP_EQ_PORT1_INUSE);
CPortStatusReport portStatusReport;
- portStatusReport.setPortStatus(PORT_INUSE);
+ portStatusReport.setPortStatus(PORT_UNLOAD_READY);
portStatusReport.setJobExistenceSlot(0xf);
int nRet = portStatusReport.serialize(szBuffer, 64);
decodePortStatusReport(pStep, szBuffer, 64);
@@ -373,23 +374,11 @@
if (ar.IsStoring()) {
ar << m_nIndex;
- //ar << (int)m_portType;
- //ar << (int)m_portMode;
- //ar << (int)m_cassetteType;
- //ar << (int)m_transferMode;
- //ar << m_bEnable;
- //ar << m_bAutoChangeEnable;
m_portStatusReport.serialize(ar);
}
else {
int temp;
ar >> m_nIndex;
- //ar >> temp; m_portType = (PortType)temp;
- //ar >> temp; m_portMode = (PortMode)temp;
- //ar >> temp; m_cassetteType = (CassetteType)temp;
- //ar >> temp; m_transferMode = (TransferMode)temp;
- //ar >> m_bEnable;
- //ar >> m_bAutoChangeEnable;
m_portStatusReport.serialize(ar);
}
}
@@ -924,8 +913,9 @@
else {
// 抛出到应用层做选择要加工的片子
generateGlassList(getScanCassetteMap());
- if (m_listener.onPortInUse != nullptr) {
- m_listener.onPortInUse(this, getScanCassetteMap());
+ if (m_listener.onPortStatusChanged != nullptr) {
+ m_listener.onPortStatusChanged(this, portStatusReport.getPortStatus(),
+ getScanCassetteMap());
}
}
}
diff --git a/SourceCode/Bond/Servo/CMaster.cpp b/SourceCode/Bond/Servo/CMaster.cpp
index 615a7fd..6bcda0c 100644
--- a/SourceCode/Bond/Servo/CMaster.cpp
+++ b/SourceCode/Bond/Servo/CMaster.cpp
@@ -548,15 +548,11 @@
LOGI("Arm1 %s, Arm2 %s.", rmd.armState[0] ? _T("不可用") : _T("可用"),
rmd.armState[1] ? _T("不可用") : _T("可用"));
}
- CEquipment* pEqTar[] = { pVacuumBake, pFliper };
- if (primaryType == MaterialsType::G2) {
- pEqTar[0] = pFliper;
- pEqTar[1] = pVacuumBake;
- }
for (int s = 0; s < 4; s++) {
+ PortType pt = pLoadPorts[s]->getPortType();
if (!rmd.armState[0] && pLoadPorts[s]->isEnable()
- && pLoadPorts[s]->getPortType() == PortType::Unloading
- && pLoadPorts[s]->getPortMode() == PortMode::ReadyToUnload) {
+ && (pt == PortType::Unloading || pt == PortType::Both)
+ && pLoadPorts[s]->getPortStatus() == PORT_INUSE) {
m_pActiveRobotTask = createTransferTask(pMeasurement, pLoadPorts[s], primaryType, secondaryType);
if (m_pActiveRobotTask != nullptr) {
goto PORT_PUT;
@@ -649,9 +645,10 @@
// LoadPort -> Aligner
for (int s = 0; s < 4; s++) {
+ PortType pt = pLoadPorts[s]->getPortType();
if (!rmd.armState[0] && pLoadPorts[s]->isEnable()
- && pLoadPorts[s]->getPortType() == PortType::Loading
- && pLoadPorts[s]->getPortMode() == PortMode::ReadyToLoad) {
+ && (pt == PortType::Loading || pt == PortType::Both)
+ && pLoadPorts[s]->getPortStatus() == PORT_INUSE) {
m_pActiveRobotTask = createTransferTask(pLoadPorts[s], pAligner, primaryType, secondaryType);
if (m_pActiveRobotTask != nullptr) {
pEFEM->setContext(m_pActiveRobotTask->getContext());
@@ -891,10 +888,10 @@
LOGE("<Master-%s>Port InUse, map(%d!=%d)不一致,请检查。",
((CEquipment*)pEquipment)->getName().c_str(), scanMap, downMap);
};
- listener.onPortInUse = [&](void* pEquipment, short scanMap) {
- LOGE("<Master-%s>Port InUse。scanMap=%d", ((CEquipment*)pEquipment)->getName().c_str(), scanMap);
- if (m_listener.onLoadPortInUse != nullptr) {
- m_listener.onLoadPortInUse(this, (CEquipment*)pEquipment, scanMap);
+ listener.onPortStatusChanged = [&](void* pEquipment, short status, __int64 data) {
+ LOGE("<Master-%s>Port InUse。status=%d, data=%lld", ((CEquipment*)pEquipment)->getName().c_str(), status);
+ if (m_listener.onLoadPortStatusChanged != nullptr) {
+ m_listener.onLoadPortStatusChanged(this, (CEquipment*)pEquipment, status, data);
}
};
pEquipment->setListener(listener);
diff --git a/SourceCode/Bond/Servo/CMaster.h b/SourceCode/Bond/Servo/CMaster.h
index ed55cd9..76d52eb 100644
--- a/SourceCode/Bond/Servo/CMaster.h
+++ b/SourceCode/Bond/Servo/CMaster.h
@@ -31,7 +31,7 @@
typedef std::function<void(void* pMaster, CEquipment* pEquipment, CVcrEventReport* pReport)> ONEQVCREVENTREPORT;
typedef std::function<void(void* pMaster, CEquipment* pEquipment, int code)> ONEQDATACHANGED;
typedef std::function<void(void* pMaster, CRobotTask* pTask, int code)> ONROBOTTASKEVENT;
- typedef std::function<void(void* pMaster, CEquipment* pEquipment, short scanMap)> ONLOADPORTINUSE;
+ typedef std::function<void(void* pMaster, CEquipment* pEquipment, short status, __int64 data)> ONLOADPORTSTATUSCHANGED;
typedef struct _MasterListener
{
ONMASTERSTATECHANGED onMasterStateChanged;
@@ -41,7 +41,7 @@
ONEQVCREVENTREPORT onEqVcrEventReport;
ONEQDATACHANGED onEqDataChanged;
ONROBOTTASKEVENT onRobotTaskEvent;
- ONLOADPORTINUSE onLoadPortInUse;
+ ONLOADPORTSTATUSCHANGED onLoadPortStatusChanged;
} MasterListener;
class CMaster
diff --git a/SourceCode/Bond/Servo/CPageGraph2.cpp b/SourceCode/Bond/Servo/CPageGraph2.cpp
index eca3e9e..c22949a 100644
--- a/SourceCode/Bond/Servo/CPageGraph2.cpp
+++ b/SourceCode/Bond/Servo/CPageGraph2.cpp
@@ -212,70 +212,14 @@
// 娴嬭瘯
else if (nCmd == ID_EQSGRAPHITEM_TEST1) {
-
}
else if (nCmd == ID_EQSGRAPHITEM_TEST2) {
- SERVO::CEquipment* pEquipment = (SERVO::CEquipment*)pItem->pData;
- SERVO::CArm* pArm = (SERVO::CArm*)pEquipment->getArm();
- if (pArm != nullptr) {
- SERVO::CGlass* pGlass = pArm->getAnyGlass();
- if (pGlass != nullptr) {
- SERVO::CJobDataS* pJobDataS = pGlass->getJobDataS();
- if (pJobDataS != nullptr) {
- pEquipment->onReceivedJob(0, pJobDataS);
- Sleep(600);
- SERVO::CJobDataB jobDataB;
- pEquipment->onStoredJob(0, &pJobDataS->getJobDataB(jobDataB));
- }
- }
- }
}
else if (nCmd == ID_EQSGRAPHITEM_TEST3) {
- SERVO::CEquipment* pEquipment = (SERVO::CEquipment*)pItem->pData;
- if (pEquipment != nullptr) {
- SERVO::CGlass* pGlass = pEquipment->getAnyGlass();
- if (pGlass != nullptr) {
- SERVO::CProcessData pd;
- pd.setGlassId(pGlass->getID().c_str());
- pEquipment->onProcessData(&pd);
- }
- }
}
else if (nCmd == ID_EQSGRAPHITEM_TEST4) {
- SERVO::CEquipment* pEquipment = (SERVO::CEquipment*)pItem->pData;
- if (pEquipment != nullptr) {
- pEquipment->setLinkSignalUpstream(0, SIGNAL_UPSTREAM_INLINE, TRUE);
- pEquipment->setLinkSignalUpstream(0, SIGNAL_UPSTREAM_TROUBLE, FALSE);
- pEquipment->setLinkSignalUpstream(0, SIGNAL_INTERLOCK, TRUE);
- pEquipment->setLinkSignalUpstream(0, SIGNAL_SEND_ABLE, TRUE);
- pEquipment->setLinkSignalUpstream(1, SIGNAL_UPSTREAM_INLINE, TRUE);
- pEquipment->setLinkSignalUpstream(1, SIGNAL_UPSTREAM_TROUBLE, FALSE);
- pEquipment->setLinkSignalUpstream(1, SIGNAL_INTERLOCK, TRUE);
- pEquipment->setLinkSignalUpstream(1, SIGNAL_SEND_ABLE, TRUE);
- }
-
- if (pEquipment != nullptr && (pEquipment->getID() == EQ_ID_Bonder1
- || pEquipment->getID() == EQ_ID_Bonder2)) {
- SERVO::CGlass* pGlass = pEquipment->getAnyGlass();
- if (pGlass != nullptr) {
- SERVO::CProcessData pd;
- pd.setGlassId(pGlass->getID().c_str());
- pEquipment->onProcessData(&pd);
- }
- }
}
else if (nCmd == ID_EQSGRAPHITEM_TEST5) {
- SERVO::CEquipment* pEquipment = (SERVO::CEquipment*)pItem->pData;
- if (pEquipment != nullptr) {
- pEquipment->setLinkSignalUpstream(0, SIGNAL_UPSTREAM_INLINE, TRUE);
- pEquipment->setLinkSignalUpstream(0, SIGNAL_UPSTREAM_TROUBLE, TRUE);
- pEquipment->setLinkSignalUpstream(0, SIGNAL_INTERLOCK, TRUE);
- pEquipment->setLinkSignalUpstream(0, SIGNAL_SEND_ABLE, FALSE);
- pEquipment->setLinkSignalUpstream(1, SIGNAL_UPSTREAM_INLINE, TRUE);
- pEquipment->setLinkSignalUpstream(1, SIGNAL_UPSTREAM_TROUBLE, TRUE);
- pEquipment->setLinkSignalUpstream(1, SIGNAL_INTERLOCK, TRUE);
- pEquipment->setLinkSignalUpstream(1, SIGNAL_SEND_ABLE, FALSE);
- }
}
else if (nCmd == ID_EQSGRAPHITEM_TEST6) {
SERVO::CEquipment* pEquipment = (SERVO::CEquipment*)pItem->pData;
@@ -311,9 +255,7 @@
*/
// 娴嬭瘯璁剧疆鏃堕棿
- /*
- if (pEquipment->getID() == EQ_ID_Bonder1
- || pEquipment->getID() == EQ_ID_Bonder2) {
+ if (pEquipment->getID() == EQ_ID_EFEM) {
CTime time = CTime::GetCurrentTime();
pEquipment->setDateTime((short)time.GetYear(),
(short)time.GetMonth(),
@@ -322,7 +264,6 @@
(short)time.GetMinute(),
(short)time.GetSecond());
}
- */
// 娴嬭瘯璁剧疆cim mode
@@ -334,32 +275,13 @@
}
*/
-
+ /*
if (pEquipment->getID() == EQ_ID_Bonder1
|| pEquipment->getID() == EQ_ID_Bonder2) {
static int ii = 0; ii++;
pEquipment->setEqMode((ii % 5) + 1);
}
-
-
- /*
- SERVO::CGlass* pGlass = pEquipment->getAnyGlass();
- if (pGlass != nullptr) {
- std::string strDescription;
- SERVO::CPath* pPath = pGlass->getPath();
- while (pPath != nullptr) {
- pPath->getDescription(strDescription);
- AfxMessageBox(strDescription.c_str());
- pPath = pPath->getNext();
- }
- }
*/
-
-
- // 璇锋眰涓婚厤鏂瑰垪琛�
- if (pEquipment != nullptr) {
- pEquipment->masterRecipeListRequest(0, nullptr);
- }
}
diff --git a/SourceCode/Bond/Servo/CPagePortProperty.cpp b/SourceCode/Bond/Servo/CPagePortProperty.cpp
index f61f01a..eadf60f 100644
--- a/SourceCode/Bond/Servo/CPagePortProperty.cpp
+++ b/SourceCode/Bond/Servo/CPagePortProperty.cpp
@@ -139,14 +139,15 @@
BOOL bCheck = ((CButton*)GetDlgItem(IDC_CHECK_ENABLE))->GetCheck() == BST_CHECKED;
EnableCtrls(bCheck);
+#ifdef _LOCAL
+ ASSERT(m_pPort != nullptr);
+ theApp.m_model.setPortEnable(m_pPort->getIndex(), bCheck);
+#else
// enable port
g_nMsgDlgShow = 0;
CMsgDlg msgDlg("璇风瓑寰�", "姝e湪鎿嶄綔锛岃绛夊緟...");
- ASSERT(m_pPort != nullptr);
- theApp.m_model.setPortEnable(m_pPort->getIndex(), bCheck);
- /*
m_pPort->eablePort(bCheck, [&](int code) -> int {
Sleep(100);
CString strMsg;
@@ -186,7 +187,7 @@
msgDlg.DoModal();
g_nMsgDlgShow = 1;
- */
+#endif
}
void CPagePortProperty::OnCbnSelchangeComboPortType()
@@ -436,9 +437,6 @@
void CPagePortProperty::EnableCtrls(BOOL bEnable)
{
GetDlgItem(IDC_COMBO_PORT_TYPE)->EnableWindow(bEnable);
- GetDlgItem(IDC_COMBO_PORT_MODE)->EnableWindow(bEnable);
GetDlgItem(IDC_COMBO_PORT_CASSERT_TYPE)->EnableWindow(bEnable);
- GetDlgItem(IDC_COMBO_PORT_TRANSFER_MODE)->EnableWindow(bEnable);
- GetDlgItem(IDC_CHECK_AUTO_CHANGE)->EnableWindow(bEnable);
}
diff --git a/SourceCode/Bond/Servo/CPagePortStatus.cpp b/SourceCode/Bond/Servo/CPagePortStatus.cpp
index ff38c73..a360f4e 100644
--- a/SourceCode/Bond/Servo/CPagePortStatus.cpp
+++ b/SourceCode/Bond/Servo/CPagePortStatus.cpp
@@ -99,14 +99,15 @@
// 鍒涘缓Job Existence Slots鎺т欢
m_ctrlJobSlotGrid.Create(AfxRegisterWndClass(0), _T("JobSlotGrid"),
- WS_CHILD | WS_VISIBLE, CRect(0, 0, 100, 100), this, 1001);
- m_ctrlJobSlotGrid.SetGridSize(12, 16);
+ WS_CHILD | WS_VISIBLE, CRect(0, 0, 88, 32), this, 1001);
+ m_ctrlJobSlotGrid.SetGridSize(1, 8);
m_ctrlJobSlotGrid.SetColors(RGB(34, 177, 76), RGB(200, 200, 200));
- m_ctrlJobSlotGrid.SetSlotStatus(0, 1, true);
- m_ctrlJobSlotGrid.SetSlotStatus(1, 9, true);
- m_ctrlJobSlotGrid.SetSlotStatus(4, 9, false);
- m_ctrlJobSlotGrid.SetSlotStatus(4, 10, true, TRUE);
+ auto statusMap = m_pPort->getScanCassetteMap();
+ for (int i = 0; i < 8; ++i) {
+ bool isSet = (statusMap >> i) & 1;
+ m_ctrlJobSlotGrid.SetSlotStatus(0, i, isSet);
+ }
return TRUE; // return TRUE unless you set the focus to a control
// 寮傚父: OCX 灞炴�ч〉搴旇繑鍥� FALSE
@@ -144,5 +145,5 @@
GetClientRect(rcClient);
m_ctrlJobSlotGrid.MoveWindow(rcComboBox.left, rcLabel.top,
- rcClient.right - 22 - rcComboBox.left, rcClient.bottom - 12 - rcLabel.top);
+ 34 * 8, 32);
}
\ No newline at end of file
diff --git a/SourceCode/Bond/Servo/CPortStatusReport.cpp b/SourceCode/Bond/Servo/CPortStatusReport.cpp
index 0a0453d..89cf223 100644
--- a/SourceCode/Bond/Servo/CPortStatusReport.cpp
+++ b/SourceCode/Bond/Servo/CPortStatusReport.cpp
@@ -139,9 +139,6 @@
memcpy(&m_nLoadingCassetteType, &pszBuffer[index], sizeof(short));
index += sizeof(short);
- memcpy(&m_nLoadingCassetteType, &pszBuffer[index], sizeof(short));
- index += sizeof(short);
-
memcpy(&m_nQTimeFlag, &pszBuffer[index], sizeof(short));
index += sizeof(short);
diff --git a/SourceCode/Bond/Servo/Common.h b/SourceCode/Bond/Servo/Common.h
index 7923773..0aa7cfa 100644
--- a/SourceCode/Bond/Servo/Common.h
+++ b/SourceCode/Bond/Servo/Common.h
@@ -18,7 +18,7 @@
#define RX_CODE_EQ_DATA_CHANGED 1010
#define RX_CODE_MASTER_STATE_CHANGED 1011
#define RX_CODE_EQ_ROBOT_TASK 1012
-#define RX_CODE_LOADPORT_INUSE 1013
+#define RX_CODE_LOADPORT_STATUS_CHANGED 1014
/* Channel Name */
diff --git a/SourceCode/Bond/Servo/Model.cpp b/SourceCode/Bond/Servo/Model.cpp
index e00949f..3427f45 100644
--- a/SourceCode/Bond/Servo/Model.cpp
+++ b/SourceCode/Bond/Servo/Model.cpp
@@ -311,9 +311,9 @@
notifyPtrAndInt(RX_CODE_EQ_ROBOT_TASK, pTask, nullptr, code);
};
- masterListener.onLoadPortInUse = [&] (void* pMaster, SERVO::CEquipment* pEquipment, short scanMap) {
- LOGE("<CModel>onLoadPortInUse. scanMap = %d", scanMap);
- notifyPtr(RX_CODE_LOADPORT_INUSE, pEquipment);
+ masterListener.onLoadPortStatusChanged = [&] (void* pMaster, SERVO::CEquipment* pEquipment, short status, __int64 data) {
+ LOGE("<CModel>onLoadPortStatusChanged. status = %d", status);
+ notifyPtr(RX_CODE_LOADPORT_STATUS_CHANGED, pEquipment);
};
m_master.setListener(masterListener);
diff --git a/SourceCode/Bond/Servo/Servo.rc b/SourceCode/Bond/Servo/Servo.rc
index 003d2f9..04cab1e 100644
--- a/SourceCode/Bond/Servo/Servo.rc
+++ b/SourceCode/Bond/Servo/Servo.rc
Binary files differ
diff --git a/SourceCode/Bond/Servo/ServoDlg.cpp b/SourceCode/Bond/Servo/ServoDlg.cpp
index d6b4057..457a1fe 100644
--- a/SourceCode/Bond/Servo/ServoDlg.cpp
+++ b/SourceCode/Bond/Servo/ServoDlg.cpp
@@ -247,7 +247,7 @@
}
}
}
- else if (RX_CODE_LOADPORT_INUSE == code) {
+ else if (RX_CODE_LOADPORT_STATUS_CHANGED == code) {
SERVO::CLoadPort* pLoadPort = nullptr;
if (pAny->getPtrValue("ptr", (void*&)pLoadPort)) {
//CPortConfigurationDlg dlg;
--
Gitblit v1.9.3