已修改13个文件
153 ■■■■■ 文件已修改
SourceCode/Bond/Servo/CEFEM.cpp 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CLoadPort.cpp 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CMaster.cpp 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CMaster.h 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CRobotTask.cpp 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CRobotTask.h 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CRobotTaskDlg.cpp 40 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CRobotTaskDlg.h 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/Common.h 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/Model.cpp 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/ServoCommo.h 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/ServoDlg.cpp 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/resource.h 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CEFEM.cpp
@@ -728,7 +728,6 @@
                            CJobDataS* pJobDataS = ((CGlass*)m_pActiveContext)->getJobDataS();
                            if (pJobDataS != nullptr) {
                                pJobDataS->serialize(szBuffer, 1024);
                                pJobDataS->serialize(szBuffer, 1024);
                                ack = (short)JobDataRequestAck::OK;
                            }
                        }
SourceCode/Bond/Servo/CLoadPort.cpp
@@ -348,53 +348,6 @@
                }
            }
        }
        /*
        {
            // Fetched Out Job Report #1~15
            char szBuffer[256];
            CEqReadStep* pStep = new CEqReadStep(0x5c31 + 18 * m_nIndex, 18 * 2,
                [&](void* pFrom, int code, const char* pszData, size_t size) -> int {
                    if (code == ROK && pszData != nullptr && size > 0) {
                        int port = (int)(__int64)((CEqReadStep*)pFrom)->getProp("Port");
                        if (port > 0) {
                            decodeFetchedOutJobReport((CStep*)pFrom, port, pszData, size);
                        }
                    }
                    return -1;
                });
            sprintf_s(szBuffer, "%s%d", STEP_EQ_FETCHED_OUT_JOBn, m_nIndex + 1);
            pStep->setName(szBuffer);
            pStep->setProp("Port", (void*)(__int64)(m_nIndex + 1));
            pStep->setWriteSignalDev(0x023 + m_nIndex);
            if (addStep(STEP_ID_FETCHED_OUT_JOB_REPORT1 + m_nIndex, pStep) != 0) {
                delete pStep;
            }
        }
        {
            // Store Job Report #1~15
            char szBuffer[256];
            CEqReadStep* pStep = new CEqReadStep(0x5b23 + 18 * m_nIndex, 18 * 2,
                [&](void* pFrom, int code, const char* pszData, size_t size) -> int {
                    if (code == ROK && pszData != nullptr && size > 0) {
                        int port = (int)(__int64)((CEqReadStep*)pFrom)->getProp("Port");
                        if (port > 0) {
                            decodeStoredJobReport((CStep*)pFrom, port, pszData, size);
                        }
                    }
                    return -1;
                });
            sprintf_s(szBuffer, "%s%d", STEP_EQ_STORED_JOBn, m_nIndex + 1);
            pStep->setName(szBuffer);
            pStep->setProp("Port", (void*)(__int64)(m_nIndex + 1));
            pStep->setWriteSignalDev(0x014 + m_nIndex);
            if (addStep(STEP_ID_STORE_JOB_REPORT1 + m_nIndex, pStep) != 0) {
                delete pStep;
            }
        }
        */
    }
    void CLoadPort::onTimer(UINT nTimerid)
SourceCode/Bond/Servo/CMaster.cpp
@@ -882,11 +882,22 @@
                        LOGI("<CMaster>onPreFethedOutJob, 已校验数据一致性.");
                    }
                }
                // 是否回撤
                else if (m_pActiveRobotTask->isRestoring() &&
                    m_pActiveRobotTask->getSrcPosition() == p->getID()) {
                    CGlass* pGlass = p->getGlassFromSlot(m_pActiveRobotTask->getSrcSlot());
                    if (pGlass == nullptr) {
                        bOk = TRUE;
                        slot = m_pActiveRobotTask->getSrcSlot();
                        LOGI("<CMaster>onPreFethedOutJob, 已校验数据一致性.");
                    }
                }
            }
            unlock();
            if (!bOk) {
                LOGE("<CMaster>onPreFethedOutJob, 数据校验失败.");
                LOGE("<CMaster>onPreStoredJob, 数据校验失败.");
            }
            return bOk;
@@ -935,6 +946,25 @@
                    }
                    delete m_pActiveRobotTask;
                    m_pActiveRobotTask = nullptr;
                }
                else if (m_pActiveRobotTask != nullptr
                    && m_pActiveRobotTask->isRestoring()
                    && m_pActiveRobotTask->getSrcPosition() == p->getID()) {
                    m_pActiveRobotTask->stored();
                    m_pActiveRobotTask->restored();
                    LOGI("回撤完成...");
                    // 完成此条搬送任务,但要把数据和消息上抛应用层
                    unlock();
                    lock();
                    if (m_listener.onRobotTaskEvent != nullptr) {
                        m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_RESTORE);
                    }
                    delete m_pActiveRobotTask;
                    m_pActiveRobotTask = nullptr;
                    stop();
                }
                unlock();
            }
@@ -1465,6 +1495,18 @@
        return 0;
    }
    int CMaster::restoreCurrentTask()
    {
        lock();
        if (m_pActiveRobotTask != nullptr) {
            m_pActiveRobotTask->restore();
        }
        unlock();
        return 0;
    }
    void CMaster::setPortType(unsigned int index, BOOL enable, int type, int mode,
        int cassetteType, int transferMode, BOOL autoChangeEnable)
    {
SourceCode/Bond/Servo/CMaster.h
@@ -66,6 +66,7 @@
        CEquipment* getEquipment(int id);
        void setCacheFilepath(const char* pszFilepath);
        int abortCurrentTask();
        int restoreCurrentTask();
        void setPortType(unsigned int index, BOOL enable, int type, int mode,
            int cassetteType, int transferMode, BOOL autoChangeEnable);
SourceCode/Bond/Servo/CRobotTask.cpp
@@ -291,6 +291,11 @@
        m_state = ROBOT_TASK_STATE::Completed;
    }
    void CRobotTask::restored()
    {
        m_state = ROBOT_TASK_STATE::Restored;
    }
    void CRobotTask::error()
    {
        m_state = ROBOT_TASK_STATE::Error;
SourceCode/Bond/Servo/CRobotTask.h
@@ -40,6 +40,7 @@
        void picked();
        void place();
        void restore();
        void restored();
        void completed();
        void error();
        void abort();
SourceCode/Bond/Servo/CRobotTaskDlg.cpp
@@ -33,6 +33,7 @@
    ON_WM_SIZE()
    ON_WM_ACTIVATE()
    ON_BN_CLICKED(IDC_BUTTON_ABORT_TASK, &CRobotTaskDlg::OnBnClickedAbortTask)
    ON_BN_CLICKED(IDC_BUTTON_RESTORE, &CRobotTaskDlg::OnBnClickedRestore)
END_MESSAGE_MAP()
@@ -51,7 +52,10 @@
    if (m_btnAbortTask.m_hWnd) {
        m_btnAbortTask.ShowWindow(m_pRobotTask ? SW_SHOW : SW_HIDE);
    }
    if (m_btnRestore.m_hWnd) {
        m_btnRestore.ShowWindow(m_pRobotTask ? SW_SHOW : SW_HIDE);
    }
    if (m_pRobotTask != nullptr) {
        using namespace SERVO;
@@ -97,14 +101,16 @@
    CDialogEx::OnInitDialog();
    // TODO:  在此添加额外的初始化
    // 创建“停止任务”按钮
    // 创建“停止任务”按钮和“撤回”按钮
    m_btnAbortTask.Create(_T("停止任务"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, CRect(0, 0, 100, 30), this, IDC_BUTTON_ABORT_TASK);
    m_btnRestore.Create(_T("撤回"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, CRect(0, 0, 100, 30), this, IDC_BUTTON_RESTORE);
    // 动态按钮创建后设置字体
    if (m_fontButton.GetSafeHandle() == nullptr) {
        m_fontButton.CreatePointFont(110, _T("微软雅黑")); // 或 "Segoe UI"
    }
    m_btnAbortTask.SetFont(&m_fontButton);
    m_btnRestore.SetFont(&m_fontButton);
    // 设置 LABEL 控件的字体
    if (m_fontDetail.GetSafeHandle() == nullptr) {
@@ -180,15 +186,21 @@
    }
    // 设置“停止任务”按钮位置(右下角)
    const int nBtnWidth = 100;
    const int nBtnHeight = 28;
    const int nMargin = 12;
    const int nMargin2 = 8;
    const int x = rcClient.right - nBtnWidth - nMargin;
    int y = rcClient.bottom - nMargin;
    if (m_btnAbortTask.m_hWnd != nullptr) {
        const int nBtnWidth = 100;
        const int nBtnHeight = 28;
        const int nMargin = 12;
        m_btnAbortTask.MoveWindow(x, y - nBtnHeight, nBtnWidth, nBtnHeight);
        y -= nBtnHeight;
        y -= nMargin2;
    }
        const int nPosX = rcClient.right - nBtnWidth - nMargin;
        const int nPosY = rcClient.bottom - nBtnHeight - nMargin;
        m_btnAbortTask.MoveWindow(nPosX, nPosY, nBtnWidth, nBtnHeight);
    // 设置“停止任务”按钮位置(右下角)
    if (m_btnRestore.m_hWnd != nullptr) {
        m_btnRestore.MoveWindow(x, y - nBtnHeight, nBtnWidth, nBtnHeight);
    }
}
@@ -200,4 +212,14 @@
    }
    theApp.m_model.getMaster().abortCurrentTask();
}
void CRobotTaskDlg::OnBnClickedRestore()
{
    int ret = AfxMessageBox(_T("物料将会被搬运回原位置,确认要回撤当前任务吗?除非发生了异常,否则请不要回撤任务!"), MB_OKCANCEL | MB_ICONEXCLAMATION);
    if (ret != IDOK) {
        return;
    }
    theApp.m_model.getMaster().restoreCurrentTask();
}
SourceCode/Bond/Servo/CRobotTaskDlg.h
@@ -22,6 +22,7 @@
private:
    SERVO::CRobotTask* m_pRobotTask;
    CButton m_btnAbortTask;
    CButton m_btnRestore;
    CFont m_fontButton;
    CFont m_fontDetail;
@@ -42,4 +43,5 @@
    afx_msg void OnSize(UINT nType, int cx, int cy);
    afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized);
    afx_msg void OnBnClickedAbortTask();
    afx_msg void OnBnClickedRestore();
};
SourceCode/Bond/Servo/Common.h
@@ -494,4 +494,5 @@
#define ROBOT_EVENT_CREATE        0   // 新任务创建
#define ROBOT_EVENT_FINISH        1   // 正常完成
#define ROBOT_EVENT_ERROR        2   // 出现错误
#define ROBOT_EVENT_ABORT        3   // 人为中止
#define ROBOT_EVENT_ABORT        3   // 人为中止
#define ROBOT_EVENT_RESTORE        4   // 回撤
SourceCode/Bond/Servo/Model.cpp
@@ -203,11 +203,12 @@
            break;
        case ROBOT_EVENT_ERROR:
            LOGE("<CModel>onRobotTaskEvent: 任务错误(%s, ClassID=%s).", strDesc.c_str(), strClassID.c_str());
            pTask->error();
            break;
        case ROBOT_EVENT_ABORT:
            LOGE("<CModel>onRobotTaskEvent: 任务停止(%s, ClassID=%s).", strDesc.c_str(), strClassID.c_str());
            pTask->abort();
            break;
        case ROBOT_EVENT_RESTORE:
            LOGE("<CModel>onRobotTaskEvent: 任务回撤(%s, ClassID=%s).", strDesc.c_str(), strClassID.c_str());
            break;
        default:
            LOGE("<CModel>onRobotTaskEvent: 未知事件 code=%d, 任务=%s", code, strDesc.c_str());
SourceCode/Bond/Servo/ServoCommo.h
@@ -122,6 +122,7 @@
        Restoring,
        Error,
        Abort,
        Restored,
        Completed
    };
SourceCode/Bond/Servo/ServoDlg.cpp
@@ -235,6 +235,9 @@
                    else if (exCode == ROBOT_EVENT_ABORT) {
                        m_pMyStatusbar->setCurTaskBtnText("无");
                    }
                    else if (exCode == ROBOT_EVENT_RESTORE) {
                        m_pMyStatusbar->setCurTaskBtnText("无");
                    }
                }
            }
SourceCode/Bond/Servo/resource.h
Binary files differ