From b71bd05e422437b998bf367c5a28bb8455400c78 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期一, 09 六月 2025 15:59:10 +0800
Subject: [PATCH] 1.LoadPort数据(PortType, PortMode等)的存储和还原; 2.Measurement -> LoadPort物流调度逻辑实现;
---
SourceCode/Bond/Servo/CLoadPort.cpp | 203 ++++++++++++++++++++++++++++----------------------
1 files changed, 113 insertions(+), 90 deletions(-)
diff --git a/SourceCode/Bond/Servo/CLoadPort.cpp b/SourceCode/Bond/Servo/CLoadPort.cpp
index 566faef..6e19e45 100644
--- a/SourceCode/Bond/Servo/CLoadPort.cpp
+++ b/SourceCode/Bond/Servo/CLoadPort.cpp
@@ -20,7 +20,7 @@
m_portMode = PortMode::ReadyToLoad;
m_cassetteType = CassetteType::G1;
m_transferMode = TransferMode::AGVMode;
- m_bEnable = TRUE;
+ m_bEnable = FALSE;
m_bAutoChangeEnable = FALSE;
}
@@ -376,6 +376,28 @@
void CLoadPort::serialize(CArchive& ar)
{
CEquipment::serialize(ar);
+
+ 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);
+ }
}
void CLoadPort::getAttributeVector(CAttributeVector& attrubutes)
@@ -891,21 +913,22 @@
LOGI("<CLoadPort-%d>准备设置Port type<%d>", m_nIndex, (int)type);
short value = (short)type;
- if (onWritedBlock != nullptr) {
- pStep->writeDataEx((const char*)&value, sizeof(short), onWritedBlock);
- }
- else {
- pStep->writeDataEx((const char*)&value, sizeof(short), [&](int code) -> int {
- if (code == WOK) {
- LOGI("<CLoadPort-%d>设置Port type成功.", m_nIndex);
- }
- else {
- LOGI("<CLoadPort-%d>设置Port type失败,code:%d", m_nIndex, code);
- }
+ pStep->writeDataEx((const char*)&value, sizeof(short), [&, onWritedBlock](int code) -> int {
+ // test
+ code = WOK;
+ if (code == WOK) {
+ m_portType = type;
+ LOGI("<CLoadPort-%d>设置Port type成功.", m_nIndex);
+ }
+ else {
+ LOGI("<CLoadPort-%d>设置Port type失败,code:%d", m_nIndex, code);
+ }
+ if (onWritedBlock != nullptr) {
+ return onWritedBlock(code);
+ }
- return 0;
- });
- }
+ return 0;
+ });
return 0;
}
@@ -920,21 +943,21 @@
LOGI("<CLoadPort-%d>准备%s Port", m_nIndex, bEnable ? _T("启用") : _T("禁用"));
short value = bEnable ? 1 : 2;
- if (onWritedBlock != nullptr) {
- pStep->writeDataEx((const char*)&value, sizeof(short), onWritedBlock);
- }
- else {
- pStep->writeDataEx((const char*)&value, sizeof(short), [&](int code) -> int {
- if (code == WOK) {
- LOGI("<CLoadPort-%d>%s Port成功.", m_nIndex, bEnable ? _T("启用") : _T("禁用"));
- }
- else {
- LOGI("<CLoadPort-%d>%s Port失败,code:%d", m_nIndex, bEnable ? _T("启用") : _T("禁用"), code);
- }
-
- return 0;
- });
- }
+ pStep->writeDataEx((const char*)&value, sizeof(short), [&, onWritedBlock](int code) -> int {
+ // test
+ code = WOK;
+ if (code == WOK) {
+ m_bEnable = bEnable;
+ LOGI("<CLoadPort-%d>%s Port成功.", m_nIndex, bEnable ? _T("启用") : _T("禁用"));
+ }
+ else {
+ LOGI("<CLoadPort-%d>%s Port失败,code:%d", m_nIndex, bEnable ? _T("启用") : _T("禁用"), code);
+ }
+ if (onWritedBlock != nullptr) {
+ return onWritedBlock(code);
+ }
+ return 0;
+ });
return 0;
}
@@ -949,21 +972,21 @@
LOGI("<CLoadPort-%d>准备设置Port mode<%d>", m_nIndex, (int)mode);
short value = (short)mode;
- if (onWritedBlock != nullptr) {
- pStep->writeDataEx((const char*)&value, sizeof(short), onWritedBlock);
- }
- else {
- pStep->writeDataEx((const char*)&value, sizeof(short), [&](int code) -> int {
- if (code == WOK) {
- LOGI("<CLoadPort-%d>设置Port mode成功.", m_nIndex);
- }
- else {
- LOGI("<CLoadPort-%d>设置Port mode失败,code:%d", m_nIndex, code);
- }
-
- return 0;
- });
- }
+ pStep->writeDataEx((const char*)&value, sizeof(short), [&, onWritedBlock](int code) -> int {
+ // test
+ code = WOK;
+ if (code == WOK) {
+ m_portMode = mode;
+ LOGI("<CLoadPort-%d>设置Port mode成功.", m_nIndex);
+ }
+ else {
+ LOGI("<CLoadPort-%d>设置Port mode失败,code:%d", m_nIndex, code);
+ }
+ if (onWritedBlock != nullptr) {
+ return onWritedBlock(code);
+ }
+ return 0;
+ });
return 0;
}
@@ -978,21 +1001,21 @@
LOGI("<CLoadPort-%d>准备设置Cassette Type<%d>", m_nIndex, (int)type);
short value = (short)type;
- if (onWritedBlock != nullptr) {
- pStep->writeDataEx((const char*)&value, sizeof(short), onWritedBlock);
- }
- else {
- pStep->writeDataEx((const char*)&value, sizeof(short), [&](int code) -> int {
- if (code == WOK) {
- LOGI("<CLoadPort-%d>设置Cassette Type成功.", m_nIndex);
- }
- else {
- LOGI("<CLoadPort-%d>设置Cassette Type失败,code:%d", m_nIndex, code);
- }
-
- return 0;
- });
- }
+ pStep->writeDataEx((const char*)&value, sizeof(short), [&, onWritedBlock](int code) -> int {
+ // test
+ code = WOK;
+ if (code == WOK) {
+ m_cassetteType = type;
+ LOGI("<CLoadPort-%d>设置Cassette Type成功.", m_nIndex);
+ }
+ else {
+ LOGI("<CLoadPort-%d>设置Cassette Type失败,code:%d", m_nIndex, code);
+ }
+ if (onWritedBlock != nullptr) {
+ return onWritedBlock(code);
+ }
+ return 0;
+ });
return 0;
}
@@ -1007,21 +1030,21 @@
LOGI("<CLoadPort-%d>准备设置Transfer mode<%d>", m_nIndex, (int)mode);
short value = (short)mode;
- if (onWritedBlock != nullptr) {
- pStep->writeDataEx((const char*)&value, sizeof(short), onWritedBlock);
- }
- else {
- pStep->writeDataEx((const char*)&value, sizeof(short), [&](int code) -> int {
- if (code == WOK) {
- LOGI("<CLoadPort-%d>设置Transfer mode成功.", m_nIndex + 1);
- }
- else {
- LOGI("<CLoadPort-%d>设置Transfer mode失败,code:%d", m_nIndex + 1, code);
- }
-
- return 0;
- });
- }
+ pStep->writeDataEx((const char*)&value, sizeof(short), [&, onWritedBlock](int code) -> int {
+ // test
+ code = WOK;
+ if (code == WOK) {
+ m_transferMode = mode;
+ LOGI("<CLoadPort-%d>设置Transfer mode成功.", m_nIndex + 1);
+ }
+ else {
+ LOGI("<CLoadPort-%d>设置Transfer mode失败,code:%d", m_nIndex + 1, code);
+ }
+ if (onWritedBlock != nullptr) {
+ return onWritedBlock(code);
+ }
+ return 0;
+ });
return 0;
}
@@ -1036,21 +1059,21 @@
LOGI("<CLoadPort-%d>准备%s Auto Change", m_nIndex, bEnable ? _T("启用") : _T("禁用"));
short value = bEnable ? 1 : 2;
- if (onWritedBlock != nullptr) {
- pStep->writeDataEx((const char*)&value, sizeof(short), onWritedBlock);
- }
- else {
- pStep->writeDataEx((const char*)&value, sizeof(short), [&](int code) -> int {
- if (code == WOK) {
- LOGI("<CLoadPort-%d>%s Auto Change成功.", m_nIndex, bEnable ? _T("启用") : _T("禁用"));
- }
- else {
- LOGI("<CLoadPort-%d>%s Auto Change失败,code:%d", m_nIndex, bEnable ? _T("启用") : _T("禁用"), code);
- }
-
- return 0;
- });
- }
+ pStep->writeDataEx((const char*)&value, sizeof(short), [&, onWritedBlock](int code) -> int {
+ // test
+ code = WOK;
+ if (code == WOK) {
+ m_bAutoChangeEnable = bEnable;
+ LOGI("<CLoadPort-%d>%s Auto Change成功.", m_nIndex, bEnable ? _T("启用") : _T("禁用"));
+ }
+ else {
+ LOGI("<CLoadPort-%d>%s Auto Change失败,code:%d", m_nIndex, bEnable ? _T("启用") : _T("禁用"), code);
+ }
+ if (onWritedBlock != nullptr) {
+ return onWritedBlock(code);
+ }
+ return 0;
+ });
return 0;
}
--
Gitblit v1.9.3