LAPTOP-SNT8I5JK\Boounion
2025-05-06 5bcbdac9793e19713d41b58c9eeefbd0818d192b
1.暂存配方参数获取
已修改6个文件
202 ■■■■■ 文件已修改
SourceCode/Bond/Servo/CBonder.cpp 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CEquipment.cpp 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CEquipment.h 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CRecipesManager.cpp 115 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CRecipesManager.h 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/Common.h 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CBonder.cpp
@@ -203,6 +203,37 @@
        }
        {
            // 请求配方参数
            CEqWriteStep* pStep = new CEqWriteStep();
            pStep->setName(STEP_EQ_RECIPE_PARAMETER_REQ);
            pStep->setWriteSignalDev(m_nIndex == 0 ? 0x367 : 0x667);
            pStep->setDataDev(m_nIndex == 0 ? 0x125b : 0x1bab);
            if (addStep(STEP_ID_RECIPE_PARAMETER_CMD_REPLY, pStep) != 0) {
                delete pStep;
            }
        }
        {
            // recipe parameter report
            CEqReadStep* pStep = new CEqReadStep(m_nIndex == 0 ? 0xaa54 : 0xea54, 257 * 2,
                [&](int code, const char* pszData, size_t size) -> int {
                    if (code == ROK && pszData != nullptr && size > 0) {
                        // 此处解释配方数据
                        short ret = decodeRecipeParameterReport(pszData, size);
                        pStep->setReturnCode(ret);
                    }
                    pStep->setReturnCode(MRLRC_OK);
                    return -1;
                });
            pStep->setName(STEP_EQ_RECIPE_PARAMETER);
            pStep->setWriteSignalDev(m_nIndex == 0 ? 0x34c : 0x64c);
            pStep->setReturnDev(m_nIndex == 0 ? 0x126c : 0x1bbc);
            if (addStep(STEP_ID_RECIPE_PARAMETER_REPORT, pStep) != 0) {
                delete pStep;
            }
        }
        {
            CEqJobEventStep* pStep = new CEqJobEventStep();
            pStep->setName(STEP_EQ_RECEIVED_JOB_UPS1);
            pStep->setWriteSignalDev(m_nIndex == 0 ? 0x300 : 0x600);
SourceCode/Bond/Servo/CEquipment.cpp
@@ -904,8 +904,38 @@
        return 0;
    }
    int CEquipment::recipeParameterRequest(short masterRecipeId, short localRecipeId, short unitNo)
    {
        SERVO::CEqWriteStep* pStep = (SERVO::CEqWriteStep*)getStepWithName(STEP_EQ_MASTER_RECIPE_LIST_REQ);
        if (pStep == nullptr) {
            return -1;
        }
        LOGI("<CEquipment-%s>正在请求单元<%d>主配方列表", m_strName.c_str(), unitNo);
        if (m_recipesManager.syncing() != 0) {
            return -2;
        }
        pStep->writeShort(unitNo, [&, unitNo](int code) -> int {
            if (code == WOK) {
                LOGI("<CEquipment-%s>请求单元<%d>主配方列表成功,正在等待数据.", m_strName.c_str(), unitNo);
            }
            else {
                m_recipesManager.syncFailed();
                LOGI("<CEquipment-%s>请求单元<%d>主配方列表失败,code:%d", m_strName.c_str(), unitNo, code);
            }
            return 0;
            });
        return 0;
    }
    short CEquipment::decodeRecipeListReport(const char* pszData, size_t size)
    {
        return m_recipesManager.decodeRecipeListReport(pszData, size);
    }
    short CEquipment::decodeRecipeParameterReport(const char* pszData, size_t size)
    {
        return m_recipesManager.decodeRecipeParameterReport(pszData, size);
    }
}
SourceCode/Bond/Servo/CEquipment.h
@@ -133,6 +133,12 @@
        // unitNo: 0:local; Others:unit No
        int masterRecipeListRequest(short unitNo);
        // 请求配方参数
        // masterRecipeId: 主配方id
        // localRecipeId: 本地配方id
        // unitNo: 0:local; Others:unit No
        int recipeParameterRequest(short masterRecipeId, short localRecipeId, short unitNo);
    // 以下为从CC-Link读取到的Bit标志位检测函数
    public:
@@ -151,6 +157,7 @@
        inline BOOL equalBool(BOOL b1, BOOL b2);
        void addGlassToList(CGlass* pGlass);
        short decodeRecipeListReport(const char* pszData, size_t size);
        short decodeRecipeParameterReport(const char* pszData, size_t size);
    protected:
        EquipmentListener m_listener;
SourceCode/Bond/Servo/CRecipesManager.cpp
@@ -15,6 +15,7 @@
    {
        m_nSyncStatus = SS_NONE;
        m_nTotalMasterRecipeCount = 0;
        m_nTotalParameterCount = 0;
        m_nWordThreadAddr = 0;
        m_hWorkStop = nullptr;
        m_hWorkThreadHandle = nullptr;
@@ -124,8 +125,22 @@
        ASSERT(pRecipeList);
        // 这里暂时只处理reportType=4,即Request from EAS
        if (reportType == 4) {
        /*
         1: Create
         2: Modify
         3: Delete
         4: Request from EAS
         */
        if (reportType == RT_CREATE) {
        }
        else if (reportType == RT_MODIFY) {
        }
        else if (reportType == RT_DELETE) {
        }
        else if (reportType == RT_REQUEST_FROM_EAS) {
            int nRet = pRecipeList->addRecipePacket(toatlGroupCount, currentGroupCount, pszIdsData, 250 * 2);
            if (MRLRC_CURRENT_RECIPE_COMPLETE == nRet) {
                lock();
@@ -150,6 +165,102 @@
        return MRLRC_OK;
    }
    short CRecipesManager::decodeRecipeParameterReport(const char* pszData, size_t size)
    {
        int index = 0;
        int masterRecipeId, localRecipeId, unitNo, reportType;
        int totalParameterCount;
        int toatlGroupCount, currentGroupCount;
        const char* pszParameterData;
        masterRecipeId = CToolUnits::toInt16(&pszData[index]);
        index += 2;
        localRecipeId = CToolUnits::toInt16(&pszData[index]);
        index += 2;
        unitNo = CToolUnits::toInt16(&pszData[index]);
        index += 2;
        reportType = CToolUnits::toInt16(&pszData[index]);
        index += 2;
        totalParameterCount = CToolUnits::toInt16(&pszData[index]);
        index += 2;
        toatlGroupCount = CToolUnits::toInt16(&pszData[index]);
        index += 2;
        currentGroupCount = CToolUnits::toInt16(&pszData[index]);
        index += 2;
        pszParameterData = &pszData[index];
        lock();
        if (m_nTotalParameterCount == 0) m_nTotalParameterCount = toatlGroupCount;
        if (m_nTotalParameterCount != toatlGroupCount) {
            return MRLRC_MASTER_RECIPE_LIST_COUNT_NG;
        }
        m_nTimeoutCount = 0;
        unlock();
        // 找到对应CRecipeList, 找不到则新建
        /*
        lock();
        CRecipeList* pRecipeList = getRecipeListFromTemp(unitNo);
        if (pRecipeList == nullptr) {
            pRecipeList = new CRecipeList(unitNo);
            m_mapRecipesTemp[unitNo] = pRecipeList;
        }
        unlock();
        ASSERT(pRecipeList);
        */
        /*
         1: Create
         2: Modify
         3: Delete
         4: Request from EAS
         */
        /*
        if (reportType == RT_CREATE) {
        }
        else if (reportType == RT_MODIFY) {
        }
        else if (reportType == RT_DELETE) {
        }
        else if (reportType == RT_REQUEST_FROM_EAS) {
            int nRet = pRecipeList->addRecipePacket(toatlGroupCount, currentGroupCount, pszIdsData, 250 * 2);
            if (MRLRC_CURRENT_RECIPE_COMPLETE == nRet) {
                lock();
                if (m_nTotalMasterRecipeCount == m_mapRecipesTemp.size()) {
                    for (auto item : m_mapRecipes) {
                        delete item.second;
                    }
                    m_mapRecipes = m_mapRecipesTemp;
                    m_mapRecipesTemp.clear();
                    m_nSyncStatus = SS_COMPLETE;
                    unlock();
                    return MRLRC_OK;
                }
                unlock();
            }
            else if (MRLRC_CONTINUE == nRet) {
                return MRLRC_CONTINUE;
            }
        }
        */
        return MRLRC_OK;
    }
    CRecipeList* CRecipesManager::getRecipeListFromTemp(int unitNo)
    {
        auto iter = m_mapRecipesTemp.find(unitNo);
SourceCode/Bond/Servo/CRecipesManager.h
@@ -21,6 +21,7 @@
        int syncing();
        void syncFailed();
        short decodeRecipeListReport(const char* pszData, size_t size);
        short decodeRecipeParameterReport(const char* pszData, size_t size);
        CRecipeList* getRecipeListFromTemp(int unitNo);
    public:
@@ -35,6 +36,7 @@
        CRITICAL_SECTION m_cs;        // 同步锁
        int m_nSyncStatus;
        int m_nTotalMasterRecipeCount;
        int m_nTotalParameterCount;
        std::map<int, CRecipeList*> m_mapRecipes;
        std::map<int, CRecipeList*> m_mapRecipesTemp;
    };
SourceCode/Bond/Servo/Common.h
@@ -141,6 +141,8 @@
#define STEP_EQ_RURRENT_RECIPE_CHANGE    _T("EQCurrentRecipeChange")
#define STEP_EQ_MASTER_RECIPE_LIST_REQ    _T("EQMasterRecipeListReq")
#define STEP_EQ_MASTER_RECIPE_LIST        _T("EQMasterRecipeListReport")
#define STEP_EQ_RECIPE_PARAMETER_REQ    _T("EQRecipeParameterReq")
#define STEP_EQ_RECIPE_PARAMETER        _T("EQRecipeParameterReport")
/* Step ID */
@@ -151,6 +153,7 @@
#define STEP_ID_VCR_ENABLE_CMD_REPLY            0x554
#define STEP_ID_EQMODE_CHANGE_CMD_REPLY            0x555
#define STEP_ID_MASTER_RECIPE_LIST_CMD_REPLY    0x556
#define STEP_ID_RECIPE_PARAMETER_CMD_REPLY        0x557
#define STEP_ID_EQMODE_CHANGED                    0x560
#define STEP_ID_EQSTATUS_CHANGED                0x561
#define STEP_ID_EQALARM1                        0x562
@@ -163,6 +166,7 @@
#define STEP_ID_CIM_MSG_CONFIRM_REPORT            0x569
#define STEP_ID_VCR1_EVENT_REPORT                0x56A
#define STEP_ID_MASTER_RECIPE_LIST_REPORT        0x56B
#define STEP_ID_RECIPE_PARAMETER_REPORT            0x56C
#define STEP_ID_RECIVE_JOB_UPS1                    0x580
#define STEP_ID_RECIVE_JOB_UPS2                    0x581
#define STEP_ID_SENT_OUT_JOB_DOWNS1                0x590
@@ -298,3 +302,16 @@
#define ORDER_BY_GROUP_COUNT_NG                7
/*
 Report type
 1: Create
 2: Modify
 3: Delete
 4: Request from EAS
 */
#define RT_CREATE                1
#define RT_MODIFY                2
#define RT_DELETE                3
#define RT_REQUEST_FROM_EAS        4