1.修复:
CEID 校验恒通过:ceidDefined 返回 true,PauseEvent ID 不做有效性检查。Host 若下发无效 CEID,将被接受但运行时无法触发暂停,风险难以察觉。
指定事件发生时暂停;
已修改4个文件
43 ■■■■■ 文件已修改
SourceCode/Bond/Servo/CMaster.cpp 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CMaster.h 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/HsmsPassive.cpp 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/Model.cpp 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CMaster.cpp
@@ -3,6 +3,7 @@
#include "CMaster.h"
#include <future>
#include <vector>
#include <algorithm>
#include "RecipeManager.h"
#include <fstream>
#include "SerializeUtil.h"
@@ -2972,7 +2973,30 @@
    bool CMaster::ceidDefined(uint32_t ceid) const
    {
        return true;
        if (m_allowedCeids.empty()) return true; // backward compatible: treat as all allowed when not configured
        return m_allowedCeids.find(ceid) != m_allowedCeids.end();
    }
    void CMaster::handleCollectionEvent(uint32_t ceid)
    {
        // 遍历当前 PJ,命中 pauseEvents 时可在此扩展暂停动作
        for (auto pj : m_processJobs) {
            if (pj == nullptr) continue;
            const auto& pauseList = pj->pauseEvents();
            if (std::find(pauseList.begin(), pauseList.end(), ceid) != pauseList.end()) {
                LOGW("<Master>PauseEvent hit: CEID=%u, PJ=%s, state=%d", ceid, pj->id().c_str(), (int)pj->state());
                // TODO: 衔接具体暂停策略(如暂停 PJ/CJ、停止调度/搬送),此处仅留桩位
            }
        }
    }
    void CMaster::setAllowedCeids(const std::vector<unsigned int>& ceids)
    {
        m_allowedCeids.clear();
        m_allowedCeids.reserve(ceids.size());
        for (auto id : ceids) {
            m_allowedCeids.insert(id);
        }
    }
    bool CMaster::saveState() const
SourceCode/Bond/Servo/CMaster.h
@@ -1,5 +1,6 @@
#pragma once
#include <list>
#include <unordered_set>
#include "CEquipment.h"
#include "CEFEM.h"
#include "CBonder.h"
@@ -189,6 +190,8 @@
        bool carrierPresent(const std::string& carrierId) const override;
        bool slotUsable(const std::string& carrierId, uint16_t slot) const override;
        bool ceidDefined(uint32_t ceid) const override;
        void setAllowedCeids(const std::vector<unsigned int>& ceids);
        void handleCollectionEvent(uint32_t ceid);
    public:
        int getLastError();
@@ -276,6 +279,7 @@
        int m_nTestFlag;
        std::list<CGlass*> m_bufGlass;
        std::unordered_set<uint32_t> m_allowedCeids;
    private:
        Collector* m_pCollector = nullptr;
SourceCode/Bond/Servo/HsmsPassive.cpp
@@ -3569,6 +3569,10 @@
    if (pEvent == nullptr) {
        return ER_NO_EVENT;
    }
    // 触发 PauseEvent 检测桩(由 Master 负责实际策略)
    if (m_pModel != nullptr) {
        m_pModel->getMaster().handleCollectionEvent(CEID);
    }
    SERVO::CReport* pReport = pEvent->getFirstReport();
SourceCode/Bond/Servo/Model.cpp
@@ -315,6 +315,15 @@
    m_hsmsPassive.loadReports((LPTSTR)(LPCTSTR)strVarialbleFile);
    strVarialbleFile.Format(_T("%s\\CollectionEventList.txt"), (LPTSTR)(LPCTSTR)m_strWorkDir);
    m_hsmsPassive.loadCollectionEvents((LPTSTR)(LPCTSTR)strVarialbleFile);
    {
        auto events = m_hsmsPassive.getCollectionEvents();
        std::vector<unsigned int> ceids;
        ceids.reserve(events.size());
        for (auto e : events) {
            if (e != nullptr) ceids.push_back(e->getEventId());
        }
        m_master.setAllowedCeids(ceids);
    }
    strVarialbleFile.Format(_T("%s\\HsmsPassive.cache"), (LPTSTR)(LPCTSTR)m_strWorkDir);
    m_hsmsPassive.loadCacheFromFile(strVarialbleFile);