LAPTOP-SNT8I5JK\Boounion
2025-07-30 166fa1cb727d6fe6962bbd2b5c4a0c9da6088048
1.获取配方后自动刷新列表;
2.HsmsAction序列化和反序列化,将来用于缓存上报的数据;
已修改6个文件
83 ■■■■■ 文件已修改
SourceCode/Bond/HSMSSDK/Include/IMessage.h 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CPageGraph2.cpp 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/HsmsAction.cpp 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/HsmsAction.h 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/HsmsPassive.cpp 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/PageRecipe.cpp 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/HSMSSDK/Include/IMessage.h
@@ -29,4 +29,6 @@
    virtual HEADER* getHeader() = 0;
    virtual ISECS2Item* getBody() = 0;
    virtual const char* toString() = 0;
    virtual int serialize(char* pszBuffer, int nBufferSize) = 0;
    virtual int unserialize(const char* pszBuffer, int nBufferSize) = 0;
};
SourceCode/Bond/Servo/CPageGraph2.cpp
@@ -255,6 +255,7 @@
            */
            // 测试设置时间
            /*
            if (pEquipment->getID() == EQ_ID_EFEM) {
                CTime time = CTime::GetCurrentTime();
                pEquipment->setDateTime((short)time.GetYear(),
@@ -264,7 +265,7 @@
                    (short)time.GetMinute(),
                    (short)time.GetSecond());
            }
            */
            
            // 测试设置cim mode
            /*
@@ -282,6 +283,8 @@
                pEquipment->setEqMode((ii % 5) + 1);
            }
            */
            theApp.m_model.m_hsmsPassive.requestAlarmReport(1, 2, "abc");
        }
SourceCode/Bond/Servo/HsmsAction.cpp
@@ -107,3 +107,60 @@
    return nResponseTime >= m_nTimeout;
}
int CHsmsAction::serialize(char* pszBuffer, int nBufferSize)
{
    int index = 0;
    if (pszBuffer == nullptr) {
        index += sizeof(int);
        index += sizeof(m_nTimeout);
        index += sizeof(int);
        index += sizeof(BOOL);
        index += m_pSendMessage->serialize(pszBuffer, nBufferSize);
        return index;
    }
    else {
        memcpy(&pszBuffer[index], &m_nAction, sizeof(int));
        index += sizeof(int);
        memcpy(&pszBuffer[index], &m_nTimeout, sizeof(int));
        index += sizeof(int);
        memcpy(&pszBuffer[index], &m_nResponseTime, sizeof(int));
        index += sizeof(int);
        memcpy(&pszBuffer[index], &m_bNeedWaitReply, sizeof(BOOL));
        index += sizeof(BOOL);
        index += m_pSendMessage->serialize(&pszBuffer[index], nBufferSize - index);
        return index;
    }
}
int CHsmsAction::unserialize(const char* pszBuffer, int nBufferSize)
{
    int index = 0;
    if (index + sizeof(int) > nBufferSize) return -1;
    memcpy(&m_nAction, &pszBuffer[index], sizeof(int));
    index += sizeof(int);
    if (index + sizeof(int) > nBufferSize) return -1;
    memcpy(&m_nTimeout, &pszBuffer[index], sizeof(int));
    index += sizeof(int);
    if (index + sizeof(int) > nBufferSize) return -1;
    memcpy(&m_nResponseTime, &pszBuffer[index], sizeof(int));
    index += sizeof(int);
    if (index + sizeof(BOOL) > nBufferSize) return -1;
    memcpy(&m_bNeedWaitReply, &pszBuffer[index], sizeof(BOOL));
    index += sizeof(BOOL);
    HSMS_Create1Message(m_pSendMessage, 1, 1 | REPLY, 1, 1);
    int nRet = m_pSendMessage->unserialize(&pszBuffer[index], nBufferSize - index);
    if (nRet < 0) return nRet;
    return index + nRet;
}
SourceCode/Bond/Servo/HsmsAction.h
@@ -28,6 +28,8 @@
    HANDLE getEvent();
    int responseTimeIncrement();
    BOOL incrementAndCheckTimeout();
    int serialize(char* pszBuffer, int nBufferSize);
    int unserialize(const char* pszBuffer, int nBufferSize);
private:
    int m_nAction;
SourceCode/Bond/Servo/HsmsPassive.cpp
@@ -669,6 +669,7 @@
    SetEvent(m_hCimWorkEvent);
    Unlock();
    return ER_NOERROR;
}
@@ -1230,6 +1231,18 @@
    SetEvent(m_hCimWorkEvent);
    Unlock();
    int size = pAction->serialize(nullptr, 0);;
    if (size > 0) {
        char* pszBuffer = new char[size];
        pAction->serialize(pszBuffer, size);
        AfxMessageBox("abc");
        CHsmsAction* pAction2 = new CHsmsAction();
        pAction2->unserialize(pszBuffer, size);
        AfxMessageBox("def");
        m_pPassive->sendMessage(pAction2->getSendMessage());
    }
    return ER_NOERROR;
}
SourceCode/Bond/Servo/PageRecipe.cpp
@@ -440,7 +440,7 @@
    else {
        // enable port
        CMsgDlg msgDlg("请等待", "正在获取配方...");
        pEq->masterRecipeListRequest(0, [&](int status) -> void {
        pEq->masterRecipeListRequest(0, [&, pEq](int status) -> void {
            if (status == SS_FAILED || status == SS_TIMEOUT) {
                CString strMsg;
                strMsg.Format(status == SS_FAILED ? _T("获取配方失败!") : _T("获取配方超时!"));
@@ -460,6 +460,8 @@
                msgDlg.SetMessage((LPTSTR)(LPCTSTR)strMsg);
                msgDlg.SetMarquee(FALSE, 0);
                msgDlg.SetCompleteCode(0);
                SERVO::CRecipeList* pRecipeList = pEq->getRecipeList(0);
                FillRecipeListToListCtrl(pRecipeList);
            }
        });
        msgDlg.DoModal();