LAPTOP-SNT8I5JK\Boounion
2025-07-21 5e6c63c80e146e9f0800afc39ec33f0c7eb7a572
1.回撤任务修改为重发任务;
已修改5个文件
32 ■■■■■ 文件已修改
SourceCode/Bond/Servo/CMaster.cpp 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CMaster.h 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CRobotTask.cpp 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CRobotTask.h 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CRobotTaskDlg.cpp 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CMaster.cpp
@@ -1584,6 +1584,18 @@
        return 0;
    }
    int CMaster::resendCurrentTask()
    {
        lock();
        if (m_pActiveRobotTask != nullptr) {
            m_pActiveRobotTask->resend();
        }
        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
@@ -67,6 +67,7 @@
        void setCacheFilepath(const char* pszFilepath);
        int abortCurrentTask();
        int restoreCurrentTask();
        int resendCurrentTask();
        void setPortType(unsigned int index, BOOL enable, int type, int mode,
            int cassetteType, int transferMode, BOOL autoChangeEnable);
SourceCode/Bond/Servo/CRobotTask.cpp
@@ -286,6 +286,17 @@
            });
    }
    void CRobotTask::resend()
    {
        // 重新下发命令,无非是下发取料或下发放料的命令,根据当前状态来
        if (ROBOT_TASK_STATE::Picking == m_state  || ROBOT_TASK_STATE::Picked == m_state) {
            pick();
        }
        else if (ROBOT_TASK_STATE::Placing == m_state) {
            place();
        }
    }
    void CRobotTask::completed()
    {
        m_state = ROBOT_TASK_STATE::Completed;
SourceCode/Bond/Servo/CRobotTask.h
@@ -41,6 +41,7 @@
        void place();
        void restore();
        void restored();
        void resend();
        void completed();
        void error();
        void abort();
SourceCode/Bond/Servo/CRobotTaskDlg.cpp
@@ -103,7 +103,7 @@
    // 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);
    m_btnRestore.Create(_T("重发指令"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, CRect(0, 0, 100, 30), this, IDC_BUTTON_RESTORE);
    // 动态按钮创建后设置字体
    if (m_fontButton.GetSafeHandle() == nullptr) {
@@ -216,10 +216,11 @@
void CRobotTaskDlg::OnBnClickedRestore()
{
    int ret = AfxMessageBox(_T("物料将会被搬运回原位置,确认要回撤当前任务吗?除非发生了异常,否则请不要回撤任务!"), MB_OKCANCEL | MB_ICONEXCLAMATION);
    // 回撤任务修改为重发任务
    int ret = AfxMessageBox(_T("确认要重新下发任务吗?"), MB_OKCANCEL | MB_ICONEXCLAMATION);
    if (ret != IDOK) {
        return;
    }
    theApp.m_model.getMaster().restoreCurrentTask();
    theApp.m_model.getMaster().resendCurrentTask();
}