已修改9个文件
203 ■■■■ 文件已修改
SourceCode/Bond/Servo/CEFEM.cpp 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CEquipment.cpp 90 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CEquipment.h 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CMaster.cpp 51 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CMaster.h 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CPageGraph2.cpp 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/Servo.rc 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/ServoCommo.h 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/resource.h 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CEFEM.cpp
@@ -663,6 +663,16 @@
                m_pPort[i]->onReceiveLBData(pszData, size);
            }
        }
        // 更新信号到LoadPort, Robot, Aligner, Fliper
        m_pPort[0]->setLinkSignalBlock(0, &m_bLinkSignal[0][0]);
        m_pPort[1]->setLinkSignalBlock(0, &m_bLinkSignal[1][0]);
        m_pPort[2]->setLinkSignalBlock(0, &m_bLinkSignal[2][0]);
        m_pPort[3]->setLinkSignalBlock(0, &m_bLinkSignal[3][0]);
        m_pArmTray[0]->setLinkSignalBlock(0, &m_bLinkSignal[4][0]);
        m_pArmTray[1]->setLinkSignalBlock(0, &m_bLinkSignal[5][0]);
        m_pAligner->setLinkSignalBlock(0, &m_bLinkSignal[6][0]);
        m_pFliper->setLinkSignalBlock(0, &m_bLinkSignal[7][0]);
    }
    int CEFEM::onReceivedJob(int port, CJobDataS* pJobDataS)
SourceCode/Bond/Servo/CEquipment.cpp
@@ -35,6 +35,7 @@
        m_bLocalAlarm = FALSE;
        m_bAutoRecipeChange = FALSE;
        m_bVCREnable[0] = FALSE;
        memset(m_bLinkSignal, 0, sizeof(m_bLinkSignal));
        m_pCclink = nullptr;
        m_nBaseAlarmId = 0;
        m_pArm = nullptr;
@@ -334,22 +335,23 @@
            }
            
            // 梳理各玻璃之间的绑定关系
            /*
            Lock();
            std::list<CGlass*> list = m_glassList;
            for (auto item : list) {
                std::string& strBuddyId = item->getBuddyId();
                if (!strBuddyId.empty()) {
                    for (auto item2 : m_glassList) {
                        if (strBuddyId.compare(item2->getID()) == 0) {
                            item->setBuddy(item2);
                            TRACE("绑定关系: %s <- %s\n", item->getID().c_str(), item2->getID().c_str());
            for (int i = 0; i < SLOT_MAX; i++) {
                CGlass* pGlass = (CGlass*)m_slot[i].getContext();
                if (pGlass != nullptr) {
                    std::string& strBuddyId = pGlass->getBuddyId();
                    if (!strBuddyId.empty()) {
                        for (int j = 0; j < SLOT_MAX; j++) {
                            CGlass* pBudy = (CGlass*)m_slot[j].getContext();
                            if (pBudy != nullptr && strBuddyId.compare(pBudy->getID()) == 0) {
                                pGlass->setBuddy(pBudy);
                                TRACE("绑定关系: %s <- %s\n", pGlass->getID().c_str(), pBudy->getID().c_str());
                            }
                        }
                    }
                }
            }
            Unlock();
            */
        }
    }
@@ -363,9 +365,20 @@
        }
        */
        // 以下解释和处理数据
        // 连接信号解释和保存
        BOOL bFlag;
        int index = 0x540;
        int index = 0;
        for (int i = 0; i < 8; i++) {
            m_bLinkSignal[i][SIGNAL_UPSTREAM_INLINE] = isBitOn(pszData, size, index + 0);
            m_bLinkSignal[i][SIGNAL_UPSTREAM_TROUBLE] = isBitOn(pszData, size, index + 1);
            m_bLinkSignal[i][SIGNAL_INTERLOCK] = isBitOn(pszData, size, index + 2);
            m_bLinkSignal[i][SIGNAL_SEND_ABLE] = isBitOn(pszData, size, index + 3);
            index += 0x40;
        }
        // 其它信号及响应
        index = 0x540;
        // alive
@@ -580,6 +593,28 @@
    {
        if (index >= VCR_MAX) return FALSE;
        return m_bVCREnable[index];
    }
    BOOL CEquipment::isLinkSignalOn(unsigned int path, unsigned int signal)
    {
        if (path >= PATH_MAX) return FALSE;
        if (signal >= SIGNAL_MAX) return FALSE;
        return m_bLinkSignal[path][signal];
    }
    void CEquipment::setLinkSignal(unsigned int path, unsigned int signal, BOOL bOn)
    {
        if (path >= PATH_MAX) return;
        if (signal >= SIGNAL_MAX) return;
        m_bLinkSignal[path][signal] = bOn;
    }
    void CEquipment::setLinkSignalBlock(unsigned int path, BOOL* pSignal)
    {
        if (path >= PATH_MAX) return;
        for (int i = 0; i < SIGNAL_MAX; i++) {
            m_bLinkSignal[path][i] = pSignal[i];
        }
    }
    int CEquipment::onStepEvent(CStep* pStep, int code)
@@ -1114,11 +1149,14 @@
            if (m_slot[i].isLock()) continue;
            CGlass* pGlass = (CGlass*)m_slot[i].getContext();
            if (pGlass == nullptr) continue;
            if(!m_bLinkSignal[0][SIGNAL_UPSTREAM_INLINE]
                || m_bLinkSignal[0][SIGNAL_UPSTREAM_TROUBLE]
                || !m_bLinkSignal[0][SIGNAL_INTERLOCK]
                || !m_bLinkSignal[0][SIGNAL_SEND_ABLE] ) continue;
            MaterialsType glassType = pGlass->getType();
            if (glassType == MaterialsType::G1 && putSlotType == MaterialsType::G2) continue;
            if (glassType == MaterialsType::G2 && putSlotType == MaterialsType::G1) continue;
            if (!pGlass->isProcessed(m_nID, 0)) continue;
            return &m_slot[i];
        }
@@ -1126,6 +1164,32 @@
        return nullptr;
    }
    CSlot* CEquipment::getProcessedSlot2(MaterialsType putSlotType, const std::vector<int>& candidates)
    {
        for (auto item : candidates) {
            for (int i = 0; i < SLOT_MAX; i++) {
                if (item == i + 1) {
                    if (!m_slot[i].isEnable()) continue;
                    if (m_slot[i].isLock()) continue;
                    CGlass* pGlass = (CGlass*)m_slot[i].getContext();
                    if (pGlass == nullptr) continue;
                    if (!m_bLinkSignal[0][SIGNAL_UPSTREAM_INLINE]
                        || m_bLinkSignal[0][SIGNAL_UPSTREAM_TROUBLE]
                        || !m_bLinkSignal[0][SIGNAL_INTERLOCK]
                        || !m_bLinkSignal[0][SIGNAL_SEND_ABLE]) continue;
                    MaterialsType glassType = pGlass->getType();
                    if (glassType == MaterialsType::G1 && putSlotType == MaterialsType::G2) continue;
                    if (glassType == MaterialsType::G2 && putSlotType == MaterialsType::G1) continue;
                    return &m_slot[i];
                }
            }
        }
        return nullptr;
    }
    CGlass* CEquipment::getGlassFromSlot(int slotNo)
    {
        CSlot* pSlot = nullptr;
SourceCode/Bond/Servo/CEquipment.h
@@ -38,7 +38,11 @@
namespace SERVO {
#define SLOT_MAX        12
#define SLOT_MAX                PATH_MAX
#define SIGNAL_UPSTREAM_INLINE    0
#define SIGNAL_UPSTREAM_TROUBLE    1
#define SIGNAL_INTERLOCK        2
#define SIGNAL_SEND_ABLE        3
    typedef std::function<void(void* pEiuipment, BOOL bAlive)> ONALIVE;
    typedef std::function<void(void* pEiuipment, int code)> ONDATACHANGED;
@@ -160,6 +164,7 @@
        // 获取一个指定物料类型(G1,G2,G1&G2)的且已经加工处理的槽位
        CSlot* getProcessedSlot(MaterialsType putSlotType);
        CSlot* getProcessedSlot2(MaterialsType putSlotType, const std::vector<int>& candidates);
        // 获取玻璃物料
        CGlass* getGlassFromSlot(int slotNo);
@@ -187,6 +192,11 @@
        BOOL isLocalAlarm();
        BOOL isAutoRecipeChange();
        BOOL isVCREnable(unsigned int index);
        BOOL isLinkSignalOn(unsigned int path, unsigned int signal);
        // 只在模拟测试时使用的函数,用于模拟信号
        void setLinkSignal(unsigned int path, unsigned int signal, BOOL bOn);
        void setLinkSignalBlock(unsigned int path, BOOL* pSignal);
    protected:
        inline void Lock() { EnterCriticalSection(&m_criticalSection); }
@@ -231,6 +241,7 @@
        BOOL m_bLocalAlarm;
        BOOL m_bAutoRecipeChange;
        BOOL m_bVCREnable[VCR_MAX];
        BOOL m_bLinkSignal[PATH_MAX][SIGNAL_MAX];
    protected:
        CCCLinkIEControl* m_pCclink;
SourceCode/Bond/Servo/CMaster.cpp
@@ -367,8 +367,10 @@
                }
                // Bonder -> BakeCooling
                m_pActiveRobotTask = createTransferTask_bonder_to_bakecooling(pBonder1, pBakeCooling, primaryType, secondaryType);
                // BakeCooling内部
                // Bake -> Cooling
                m_pActiveRobotTask = createTransferTask_bake_to_cooling(pBakeCooling);
                if (m_pActiveRobotTask != nullptr) {
                    std::string strDescription = m_pActiveRobotTask->getDescription();
                    unlock();
@@ -379,7 +381,20 @@
                    continue;
                }
                m_pActiveRobotTask = createTransferTask_bonder_to_bakecooling(pBonder2, pBakeCooling, primaryType, secondaryType);
                // Bonder -> BakeCooling
                m_pActiveRobotTask = createTransferTask_bonder_to_bakecooling(pBonder1, pBakeCooling);
                if (m_pActiveRobotTask != nullptr) {
                    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;
                }
                m_pActiveRobotTask = createTransferTask_bonder_to_bakecooling(pBonder2, pBakeCooling);
                if (m_pActiveRobotTask != nullptr) {
                    std::string strDescription = m_pActiveRobotTask->getDescription();
                    unlock();
@@ -525,6 +540,7 @@
                break;
            }
            // 读标志位
            for (auto item : m_listEquipment) {
                if (item->getID() == EQ_ID_Bonder1 ||
                    item->getID() == EQ_ID_Bonder2) {
@@ -1112,21 +1128,36 @@
        return pTask;
    }
    CRobotTask* CMaster::createTransferTask_bonder_to_bakecooling(CEquipment* pSrcEq, CEquipment* pTarEq,
        MaterialsType primaryType/* = MaterialsType::G1*/, MaterialsType secondaryType/* = MaterialsType::G2*/)
    CRobotTask* CMaster::createTransferTask_bonder_to_bakecooling(CEquipment* pSrcEq, CEquipment* pTarEq)
    {
        std::vector<int> slots = {1, 2};
        CRobotTask* pTask = nullptr;
        CSlot* pSrcSlot, * pTarSlot;
        pTarSlot = pTarEq->getAvailableSlotForGlass2(primaryType, slots);
        pSrcSlot = pSrcEq->getProcessedSlot(primaryType);
        if (pSrcSlot == nullptr || nullptr == pTarSlot) {
            pTarSlot = pTarEq->getAvailableSlotForGlass(secondaryType);
            pSrcSlot = pSrcEq->getProcessedSlot(secondaryType);
        pTarSlot = pTarEq->getAvailableSlotForGlass2(MaterialsType::G1, slots);
        pSrcSlot = pSrcEq->getProcessedSlot(MaterialsType::G1);
        if (pSrcSlot != nullptr && nullptr != pTarSlot) {
            pTask = new CRobotTask();
            pTask->setContext(pSrcSlot->getContext());
            pTask->setRobotTransferParam(++taskSeqNo, 1, pSrcSlot->getPosition(),
                pTarSlot->getPosition(), pSrcSlot->getNo(), pTarSlot->getNo());
        }
        return pTask;
    }
    CRobotTask* CMaster::createTransferTask_bake_to_cooling(CEquipment* pSrcEq)
    {
        std::vector<int> slotsTar = { 3, 4 };
        std::vector<int> slotsSrc = { 1, 2 };
        CRobotTask* pTask = nullptr;
        CSlot* pSrcSlot, * pTarSlot;
        pTarSlot = pSrcEq->getAvailableSlotForGlass2(MaterialsType::G1, slotsTar);
        pSrcSlot = pSrcEq->getProcessedSlot2(MaterialsType::G1, slotsSrc);
        if (pSrcSlot != nullptr && nullptr != pTarSlot) {
            pTask = new CRobotTask();
            pTask->setContext(pSrcSlot->getContext());
SourceCode/Bond/Servo/CMaster.h
@@ -86,8 +86,8 @@
        void setState(MASTERSTATE state);
        CRobotTask* createTransferTask(CEquipment* pSrcEq, CEquipment* pTarEq,
            MaterialsType primaryType = MaterialsType::G1, MaterialsType secondaryType = MaterialsType::G2);
        CRobotTask* createTransferTask_bonder_to_bakecooling(CEquipment* pSrcEq, CEquipment* pTarEq,
            MaterialsType primaryType = MaterialsType::G1, MaterialsType secondaryType = MaterialsType::G2);
        CRobotTask* createTransferTask_bonder_to_bakecooling(CEquipment* pSrcEq, CEquipment* pTarEq);
        CRobotTask* createTransferTask_bake_to_cooling(CEquipment* pSrcEq);
    private:
        CRITICAL_SECTION m_criticalSection;
SourceCode/Bond/Servo/CPageGraph2.cpp
@@ -128,6 +128,11 @@
        CHMPropertyDlg dlg(pEquipment->getName().c_str(), 658, 788);
        CEquipmentPage1* pPage1 = new CEquipmentPage1();
        pPage1->setEquipment(pEquipment);
        pPage1->Create(IDD_PAGE_EQUIPMENT1);
        dlg.addPage(pPage1, "Link Signal");
        if (_strcmpi(pEquipment->getClassName(), "CLoadPort") == 0) {
            CPagePortProperty* pPageA = new CPagePortProperty();
            pPageA->setLoadPort((SERVO::CLoadPort*)pEquipment);
@@ -259,6 +264,34 @@
        }
        else if (nCmd == ID_EQSGRAPHITEM_TEST4) {
            SERVO::CEquipment* pEquipment = (SERVO::CEquipment*)pItem->pData;
            if (pEquipment != nullptr) {
                pEquipment->setLinkSignal(0, SIGNAL_UPSTREAM_INLINE, TRUE);
                pEquipment->setLinkSignal(0, SIGNAL_UPSTREAM_TROUBLE, FALSE);
                pEquipment->setLinkSignal(0, SIGNAL_INTERLOCK, TRUE);
                pEquipment->setLinkSignal(0, 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->setLinkSignal(0, SIGNAL_UPSTREAM_INLINE, TRUE);
                pEquipment->setLinkSignal(0, SIGNAL_UPSTREAM_TROUBLE, TRUE);
                pEquipment->setLinkSignal(0, SIGNAL_INTERLOCK, TRUE);
                pEquipment->setLinkSignal(0, SIGNAL_SEND_ABLE, FALSE);
            }
        }
        else if (nCmd == ID_EQSGRAPHITEM_TEST6) {
            SERVO::CEquipment* pEquipment = (SERVO::CEquipment*)pItem->pData;
            // 测试下发Cim Message
SourceCode/Bond/Servo/Servo.rc
Binary files differ
SourceCode/Bond/Servo/ServoCommo.h
@@ -5,6 +5,8 @@
#define BLOCK_BUFFER_MAX            1024
#define ALIVE_TIMEOUT                15
#define VCR_MAX                        1
#define PATH_MAX                    8
#define SIGNAL_MAX                    8
#define ARM_ALL                        99
    enum class PortType {
SourceCode/Bond/Servo/resource.h
Binary files differ