LAPTOP-SNT8I5JK\Boounion
2025-05-30 ebf96874b6a994e3b09b69f272416cb482cf25bb
1.Fliper(G2) -> Aligner
VacuumBake(G1) -> Aligner搬送逻辑和模拟测试;
2.在状态栏增加当前搬送状态显示(按钮,下一步用于实现点击按钮展开搬送任务详情,中断操作等)
已修改12个文件
178 ■■■■ 文件已修改
SourceCode/Bond/Servo/CEquipmentPage2.cpp 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CMaster.cpp 75 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CMaster.h 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CMyStatusbar.cpp 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CMyStatusbar.h 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CRobotTask.cpp 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CRobotTask.h 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/Common.h 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/Model.cpp 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/Servo.rc 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/ServoDlg.cpp 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/resource.h 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CEquipmentPage2.cpp
@@ -82,14 +82,15 @@
    ASSERT(m_pEquipment);
    for (int i = 0; i < SLOT_MAX; i++) {
        SERVO::CGlass* pGlass = m_pEquipment->getGlassFromSlot(i+1);
        pGlass->addRef();
        SERVO::CGlass* pBuddy = pGlass->getBuddy();
        int index = m_listCtrl.InsertItem(m_listCtrl.GetItemCount(), _T(""));
        m_listCtrl.SetItemData(index, (DWORD_PTR)pGlass);
        m_listCtrl.SetItemText(index, 1, pGlass->getID().c_str());
        if (pBuddy != nullptr) {
            m_listCtrl.SetItemText(index, 2, pBuddy->getID().c_str());
        if (pGlass != nullptr) {
            pGlass->addRef();
            SERVO::CGlass* pBuddy = pGlass->getBuddy();
            int index = m_listCtrl.InsertItem(m_listCtrl.GetItemCount(), _T(""));
            m_listCtrl.SetItemData(index, (DWORD_PTR)pGlass);
            m_listCtrl.SetItemText(index, 1, pGlass->getID().c_str());
            if (pBuddy != nullptr) {
                m_listCtrl.SetItemText(index, 2, pBuddy->getID().c_str());
            }
        }
    }
SourceCode/Bond/Servo/CMaster.cpp
@@ -279,6 +279,19 @@
    unsigned CMaster::DispatchProc()
    {
        // 各种机器
        CLoadPort* pLoadPort1 = (CLoadPort*)getEquipment(EQ_ID_LOADPORT1);
        CLoadPort* pLoadPort2 = (CLoadPort*)getEquipment(EQ_ID_LOADPORT2);
        CFliper* pFliper = (CFliper*)getEquipment(EQ_ID_FLIPER);
        CVacuumBake* pVacuumBack = (CVacuumBake*)getEquipment(EQ_ID_VACUUMBAKE);
        CAligner* pAligner = (CAligner*)getEquipment(EQ_ID_ALIGNER);
        ASSERT(pLoadPort1);
        ASSERT(pLoadPort2);
        ASSERT(pFliper);
        ASSERT(pVacuumBack);
        ASSERT(pAligner);
        while (1) {
            // 待退出信号或时间到
            HANDLE hEvents[] = { m_hEventDispatchThreadExit[0], m_hDispatchEvent };
@@ -310,30 +323,24 @@
            // 调度逻辑处理
            else if (m_state == MASTERSTATE::RUNNING) {
                unlock();
                LOGI("调度处理中...");
                // LOGI("调度处理中...");
                lock();
                if (m_pActiveRobotTask != nullptr) {
                    unlock();
                    // 检测到当前有正在下午的任务,确保当前任务完成或中止后继续
                    LOGI("检测到当前有正在下午的任务,确保当前任务完成或中止后继续...");
                    // LOGI("检测到当前有正在下午的任务,确保当前任务完成或中止后继续...");
                    continue;
                }
                // LoadPort -> Fliper(G2)
                CLoadPort* pLoadPort1 = (CLoadPort*)getEquipment(EQ_ID_LOADPORT1);
                CLoadPort* pLoadPort2 = (CLoadPort*)getEquipment(EQ_ID_LOADPORT2);
                CFliper* pFliper = (CFliper*)getEquipment(EQ_ID_FLIPER);
                CVacuumBake* pVacuumBack = (CVacuumBake*)getEquipment(EQ_ID_VACUUMBAKE);
                ASSERT(pLoadPort1);
                ASSERT(pLoadPort2);
                ASSERT(pFliper);
                ASSERT(pVacuumBack);
                m_pActiveRobotTask = createTransferTask(pLoadPort1, pFliper);
                if (m_pActiveRobotTask != nullptr) {
                    std::string strDescription = m_pActiveRobotTask->getDescription();
                    unlock();
                    if (m_listener.onRobotTaskEvent != nullptr) {
                        m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, 0);
                    }
                    LOGI("创建新任务<%s>...", strDescription.c_str());
                    continue;
                }
@@ -342,6 +349,9 @@
                if (m_pActiveRobotTask != nullptr) {
                    std::string strDescription = m_pActiveRobotTask->getDescription();
                    unlock();
                    if (m_listener.onRobotTaskEvent != nullptr) {
                        m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, 0);
                    }
                    LOGI("创建新任务<%s>...", strDescription.c_str());
                    continue;
                }
@@ -353,7 +363,10 @@
                if (m_pActiveRobotTask != nullptr) {
                    std::string strDescription = m_pActiveRobotTask->getDescription();
                    unlock();
                    LOGI("创建新任务1<%s>...", strDescription.c_str());
                    if (m_listener.onRobotTaskEvent != nullptr) {
                        m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, 0);
                    }
                    LOGI("创建新任务<%s>...", strDescription.c_str());
                    continue;
                }
@@ -361,16 +374,40 @@
                if (m_pActiveRobotTask != nullptr) {
                    std::string strDescription = m_pActiveRobotTask->getDescription();
                    unlock();
                    LOGI("创建新任务2<%s>...", strDescription.c_str());
                    if (m_listener.onRobotTaskEvent != nullptr) {
                        m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, 0);
                    }
                    LOGI("创建新任务<%s>...", strDescription.c_str());
                    continue;
                }
                // Fliper(G2) -> Aligner
                // VacuumBake(G1) -> Aligner
                m_pActiveRobotTask = createTransferTask(pFliper, pAligner);
                if (m_pActiveRobotTask != nullptr) {
                    std::string strDescription = m_pActiveRobotTask->getDescription();
                    unlock();
                    if (m_listener.onRobotTaskEvent != nullptr) {
                        m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, 0);
                    }
                    LOGI("创建新任务<%s>...", strDescription.c_str());
                    continue;
                }
                m_pActiveRobotTask = createTransferTask(pVacuumBack, pAligner);
                if (m_pActiveRobotTask != nullptr) {
                    std::string strDescription = m_pActiveRobotTask->getDescription();
                    unlock();
                    if (m_listener.onRobotTaskEvent != nullptr) {
                        m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, 0);
                    }
                    LOGI("创建新任务<%s>...", strDescription.c_str());
                    continue;
                }
                // Fliper(G2) -> Aligner
                // VacuumBake(G1) -> Aligner
                // Aligner -> Bonder
@@ -554,6 +591,10 @@
                    lock();
                    delete m_pActiveRobotTask;
                    m_pActiveRobotTask = nullptr;
                    if (m_listener.onRobotTaskEvent != nullptr) {
                        m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, 0);
                    }
                }
                unlock();
            }
SourceCode/Bond/Servo/CMaster.h
@@ -29,6 +29,7 @@
    typedef std::function<void(void* pMaster, CEquipment* pEquipment, int state, int alarmId, int unitId, int level)> ONEQALARM;
    typedef std::function<void(void* pMaster, CEquipment* pEquipment, CVcrEventReport* pReport)> ONEQVCREVENTREPORT;
    typedef std::function<void(void* pMaster, CEquipment* pEquipment, int code)> ONEQDATACHANGED;
    typedef std::function<void(void* pMaster, CRobotTask* pTask, int code)> ONROBOTTASKEVENT;
    typedef struct _MasterListener
    {
        ONMASTERSTATECHANGED    onMasterStateChanged;
@@ -37,6 +38,7 @@
        ONEQALARM               onEqAlarm;
        ONEQVCREVENTREPORT        onEqVcrEventReport;
        ONEQDATACHANGED         onEqDataChanged;
        ONROBOTTASKEVENT        onRobotTaskEvent;
    } MasterListener;
    class CMaster
SourceCode/Bond/Servo/CMyStatusbar.cpp
@@ -43,7 +43,15 @@
        m_brBkgnd.DeleteObject();
    }
    m_crBkgnd = color;
    m_brBkgnd.CreateSolidBrush(color);
    m_btnCurTask.SetFaceColor(m_crBkgnd);
    m_btnCurTask.SetFrameColor(m_crBkgnd);
    m_btnCurTask.SetFrameColor(BS_HOVER, CColorTransfer::ApproximateColor(m_crBkgnd, 0.05));
    m_btnCurTask.SetFrameColor(BS_PRESS, CColorTransfer::ApproximateColor(m_crBkgnd, 0.12));
    m_btnCurTask.SetBkgndColor(BS_HOVER, CColorTransfer::ApproximateColor(m_crBkgnd, 0.05));
    m_btnCurTask.SetBkgndColor(BS_PRESS, CColorTransfer::ApproximateColor(m_crBkgnd, 0.12));
    Invalidate(); 
    UpdateWindow();
}
@@ -51,6 +59,8 @@
void CMyStatusbar::setForegroundColor(COLORREF cr)
{
    m_crForeground = cr;
    m_btnCurTask.SetTextColor(m_crForeground);
    Invalidate();
    UpdateWindow();
}
@@ -60,11 +70,23 @@
    SetDlgItemText(IDC_LABEL_RUNTIME, pszText);
}
void CMyStatusbar::setCurTaskBtnText(const char* pszText)
{
    SetDlgItemText(IDC_BUTTON_ROBOTTASK, pszText);
}
BOOL CMyStatusbar::OnInitDialog()
{
    CDialogEx::OnInitDialog();
    // TODO:  在此添加额外的初始化
    m_btnCurTask.SubclassDlgItem(IDC_BUTTON_ROBOTTASK, this);
    // m_btnCurTask.SetIcon(hIcon1, hIcon1, 24);
    m_btnCurTask.SetFaceColor(m_crBkgnd);
    m_btnCurTask.SetFrameColor(m_crBkgnd);
    m_btnCurTask.SetFrameColor(BS_HOVER, RGB(218, 218, 218));
    m_btnCurTask.SetFrameColor(BS_PRESS, RGB(168, 168, 168));
    return TRUE;  // return TRUE unless you set the focus to a control
                  // 异常: OCX 属性页应返回 FALSE
@@ -110,8 +132,21 @@
    int x;
    GetClientRect(&rcClient);
    x = 120;
    x = 20;
    pItem = GetDlgItem(IDC_LABEL_RUNTIME);
    pItem->GetClientRect(rcItem);
    pItem->MoveWindow(x, (rcClient.Height() - rcItem.Height()) / 2, rcItem.Width(), rcItem.Height());
    x += rcItem.Width();
    x += 8;
    pItem = GetDlgItem(IDC_LABEL_CUR_TASK_L);
    pItem->GetClientRect(rcItem);
    pItem->MoveWindow(x, (rcClient.Height() - rcItem.Height()) / 2, rcItem.Width(), rcItem.Height());
    x += rcItem.Width();
    x += 8;
    pItem = GetDlgItem(IDC_BUTTON_ROBOTTASK);
    pItem->GetClientRect(rcItem);
    pItem->MoveWindow(x, (rcClient.Height() - rcItem.Height()) / 2, rcItem.Width(), rcItem.Height());
    x += rcItem.Width();
}
SourceCode/Bond/Servo/CMyStatusbar.h
@@ -1,4 +1,6 @@
#pragma once
#include "BlButton.h"
#include "ColorTransfer.h"
// CMyStatusbar 对话框
@@ -16,6 +18,7 @@
    void setBackgroundColor(COLORREF color);
    void setForegroundColor(COLORREF cr);
    void setRunTimeText(const char* pszText);
    void setCurTaskBtnText(const char* pszText);
private:
    void Resize();
@@ -24,7 +27,7 @@
    COLORREF m_crForeground;
    COLORREF m_crBkgnd;
    CBrush m_brBkgnd;
    CBlButton m_btnCurTask;
// 对话框数据
#ifdef AFX_DESIGN_TIME
SourceCode/Bond/Servo/CRobotTask.cpp
@@ -42,6 +42,25 @@
        return strOut;
    }
    std::string CRobotTask::getSimpleDescription() const
    {
        std::string strOut = "CRobotTask<ID:";
        strOut = strOut + std::to_string(m_robotCmdParam.sequenceNo);
        strOut = strOut + ",Arm:";
        strOut = strOut + std::to_string(m_robotCmdParam.armNo);
        strOut = strOut + ",GetPossion:";
        strOut = strOut + std::to_string(m_robotCmdParam.getPosition);
        strOut = strOut + ",GetSlot:";
        strOut = strOut + std::to_string(m_robotCmdParam.getSlotNo);
        strOut = strOut + ",PutPossion:";
        strOut = strOut + std::to_string(m_robotCmdParam.putPosition);
        strOut = strOut + ",PutSlot:";
        strOut = strOut + std::to_string(m_robotCmdParam.putSlotNo);
        strOut = strOut + ">";
        return strOut;
    }
    void CRobotTask::setContext(CContext* pContext)
    {
        if (pContext != nullptr) {
SourceCode/Bond/Servo/CRobotTask.h
@@ -13,6 +13,7 @@
    public:
        std::string& getId();
        std::string getDescription() const;
        std::string getSimpleDescription() const;
        void setContext(CContext* pContext);
        CContext* getContext();
        void setRobotTransferParam(int seq, int armNo, int fromPos, int toPos, int fromSlot, int toSlot);
SourceCode/Bond/Servo/Common.h
@@ -17,6 +17,7 @@
#define RX_CODE_ALARM_CLEAR                1009
#define RX_CODE_EQ_DATA_CHANGED            1010
#define RX_CODE_MASTER_STATE_CHANGED    1011
#define RX_CODE_EQ_ROBOT_TASK            1012
/* Channel Name */
SourceCode/Bond/Servo/Model.cpp
@@ -170,6 +170,9 @@
        LOGE("<CModel>onEqDataChanged.");
        notifyPtr(RX_CODE_EQ_DATA_CHANGED, pEquipment);
    };
    masterListener.onRobotTaskEvent = [&](void* pMaster, SERVO::CRobotTask* pTask, int code) {
        notifyPtr(RX_CODE_EQ_ROBOT_TASK, pTask);
    };
    m_master.setListener(masterListener);
SourceCode/Bond/Servo/Servo.rc
Binary files differ
SourceCode/Bond/Servo/ServoDlg.cpp
@@ -185,6 +185,22 @@
                    SetTimer(TIMER_ID_UPDATE_RUMTIME, 500, nullptr);
                }
            }
            else if (RX_CODE_EQ_ROBOT_TASK == code) {
                SERVO::CRobotTask* pTask = theApp.m_model.getMaster().getActiveRobotTask();
                if (pTask == nullptr) {
                    m_pMyStatusbar->setCurTaskBtnText("无");
                }
                else {
                    SERVO::CEquipment* pEq1, * pEq2;
                    pEq1 = theApp.m_model.getMaster().getEquipment(pTask->getSrcPosition());
                    pEq2 = theApp.m_model.getMaster().getEquipment(pTask->getTarPosition());
                    if (pEq1 != nullptr && pEq2 != nullptr) {
                        CString strText;
                        strText.Format(_T("%s --> %s"), pEq1->getName().c_str(), pEq2->getName().c_str());
                        m_pMyStatusbar->setCurTaskBtnText((LPTSTR)(LPCTSTR)strText);
                    }
                }
            }
            pAny->release();
        }, [&]() -> void {
SourceCode/Bond/Servo/resource.h
Binary files differ