LAPTOP-SNT8I5JK\Boounion
2025-06-09 b71bd05e422437b998bf367c5a28bb8455400c78
1.LoadPort数据(PortType, PortMode等)的存储和还原;
2.Measurement -> LoadPort物流调度逻辑实现;
已修改6个文件
206 ■■■■ 文件已修改
SourceCode/Bond/Servo/CLoadPort.cpp 107 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CMaster.cpp 51 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CPagePortProperty.cpp 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CPortStatusReport.cpp 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CPortStatusReport.h 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/Servo.rc 补丁 | 查看 | 原始文档 | blame | 历史
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 {
        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;
    }
@@ -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 {
        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 {
        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 {
        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 {
        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 {
        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;
    }
SourceCode/Bond/Servo/CMaster.cpp
@@ -375,6 +375,37 @@
                }
                // Measurement -> LoadPort
                CLoadPort* pEqLoadPort[] = { pLoadPort1, pLoadPort2, pLoadPort3, pLoadPort4 };
                CEquipment* pEqTar[] = { pVacuumBack, pFliper };
                if (primaryType == MaterialsType::G2) {
                    pEqTar[0] = pFliper;
                    pEqTar[1] = pVacuumBack;
                }
                for (int s = 0; s < 4; s++) {
                    if (pEqLoadPort[s]->isEnable()
                        && pEqLoadPort[s]->getPortType() == PortType::Unloading
                        && pEqLoadPort[s]->getPortMode() == PortMode::ReadyToUnload) {
                        m_pActiveRobotTask = createTransferTask(pMeasurement, pEqLoadPort[s], primaryType, secondaryType);
                        if (m_pActiveRobotTask != nullptr) {
                            goto PORT_PUT;
                        }
                    }
                }
            PORT_PUT:
                if (m_pActiveRobotTask != nullptr) {
                    m_pActiveRobotTask->run();
                    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;
                }
                // BakeCooling ->Measurement
                m_pActiveRobotTask = createTransferTask_bakecooling_to_measurement(pBakeCooling, pMeasurement);
                if (m_pActiveRobotTask != nullptr) {
@@ -484,18 +515,12 @@
                // LoadPort -> Fliper(G2)
                // LoadPort -> VacuumBake(G1)
                CLoadPort* pEqSrc[] = { pLoadPort1, pLoadPort2, pLoadPort3, pLoadPort4 };
                CEquipment* pEqTar[] = { pVacuumBack, pFliper };
                if (primaryType == MaterialsType::G2) {
                    pEqTar[0] = pFliper;
                    pEqTar[1] = pVacuumBack;
                }
                for (int s = 0; s < 4; s++) {
                    for (int t = 0; t < 2; t++) {
                        if (pEqSrc[s]->isEnable()
                            && pEqSrc[s]->getPortType() == PortType::Loading
                            && pEqSrc[s]->getPortMode() == PortMode::ReadyToLoad) {
                            m_pActiveRobotTask = createTransferTask(pEqSrc[s], pEqTar[t], primaryType, secondaryType);
                        if (pEqLoadPort[s]->isEnable()
                            && pEqLoadPort[s]->getPortType() == PortType::Loading
                            && pEqLoadPort[s]->getPortMode() == PortMode::ReadyToLoad) {
                            m_pActiveRobotTask = createTransferTask(pEqLoadPort[s], pEqTar[t], primaryType, secondaryType);
                            if (m_pActiveRobotTask != nullptr) {
                                goto PORT_GET;
                            }
@@ -514,11 +539,6 @@
                    LOGI("创建新任务<%s>...", strDescription.c_str());
                    continue;
                }
                // Measurement -> LoadPort
                unlock();
@@ -1187,6 +1207,7 @@
        if (pSrcSlot != nullptr && nullptr != pTarSlot) {
            pTask = new CRobotTask();
            pTask->setContext(pSrcSlot->getContext());
            pTask->setEFEM((CEFEM*)getEquipment(EQ_ID_EFEM));
            pTask->setRobotTransferParam(++taskSeqNo, 1, pSrcSlot->getPosition(),
                pTarSlot->getPosition(), pSrcSlot->getNo(), pTarSlot->getNo());
        }
SourceCode/Bond/Servo/CPagePortProperty.cpp
@@ -69,7 +69,7 @@
    pComboBox = (CComboBox*)GetDlgItem(IDC_COMBO_PORT_MODE);
    for (int i = 0; i <= 5; i++) {
        pComboBox->InsertString(i - 1, SERVO::CLoadPort::getPortModeDescription((SERVO::PortMode)i, strTemp).c_str());
        pComboBox->InsertString(i, SERVO::CLoadPort::getPortModeDescription((SERVO::PortMode)i, strTemp).c_str());
    }
    int portMode = (int)m_pPort->getPortMode();
    if (0 <= portMode && portMode <= 5) {
SourceCode/Bond/Servo/CPortStatusReport.cpp
@@ -176,6 +176,34 @@
            std::to_string(m_nCassetteStatus).c_str(), "", weight++));
    }
    void CPortStatusReport::serialize(CArchive& ar)
    {
        if (ar.IsStoring()) {
            ar << m_nPortStatus;
            ar << m_nCassetteSequenceNo;
            WriteString(ar, m_strCassetteID);
            for (int i = 0; i < 12; i++) {
                ar << m_nJobExistenceSlot[i];
            }
            ar << m_nLoadingCassetteType;
            ar << m_nQTimeFlag;
            ar << m_nCassetteMappingState;
            ar << m_nCassetteStatus;
        }
        else {
            ar >> m_nPortStatus;
            ar >> m_nCassetteSequenceNo;
            ReadString(ar, m_strCassetteID);
            for (int i = 0; i < 12; i++) {
                ar >> m_nJobExistenceSlot[i];
            }
            ar >> m_nLoadingCassetteType;
            ar >> m_nQTimeFlag;
            ar >> m_nCassetteMappingState;
            ar >> m_nCassetteStatus;
        }
    }
    bool CPortStatusReport::canPickFromPort()
    {
        // 1. Port 状态必须是 Load Ready(上料请求)
@@ -208,5 +236,18 @@
        return false;
    }
    void CPortStatusReport::WriteString(CArchive& ar, std::string& string)
    {
        CString strTemp = string.c_str();
        ar << strTemp;
    }
    void CPortStatusReport::ReadString(CArchive& ar, std::string& string)
    {
        CString strTemp;
        ar >> strTemp;
        string = (LPTSTR)(LPCTSTR)strTemp;
    }
}
SourceCode/Bond/Servo/CPortStatusReport.h
@@ -23,12 +23,17 @@
        int serialize(char* pszBuffer, int nBufferSize);
        int unserialize(const char* pszBuffer, int nBufferSize);
        void getAttributeVector(CAttributeVector& attrubutes, int beginWeight);
        virtual void serialize(CArchive& ar);
        
    public:
        bool canPickFromPort();
        bool isJobExistenceSlot();
    private:
        void WriteString(CArchive& ar, std::string& string);
        void ReadString(CArchive& ar, std::string& string);
    private:
        short m_nPortStatus;
        short m_nCassetteSequenceNo;
        std::string m_strCassetteID;
SourceCode/Bond/Servo/Servo.rc
Binary files differ