LAPTOP-SNT8I5JK\Boounion
2025-06-03 61b2bfa09588f08accb13e98ee4cd73015cb2352
1.增加任务详情弹出对话框,但具体填充数据;
已添加2个文件
已修改8个文件
224 ■■■■■ 文件已修改
SourceCode/Bond/Servo/CMyStatusbar.cpp 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CMyStatusbar.h 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CRobotTaskDlg.cpp 124 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CRobotTaskDlg.h 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/Servo.rc 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/Servo.vcxproj 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/Servo.vcxproj.filters 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/ServoDlg.cpp 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/ServoDlg.h 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/resource.h 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CMyStatusbar.cpp
@@ -118,6 +118,22 @@
    // TODO: åœ¨æ­¤å¤„添加消息处理程序代码
}
BOOL CMyStatusbar::OnCommand(WPARAM wParam, LPARAM lParam)
{
    CWnd* pItem;
    CRect rcItem;
    switch (LOWORD(wParam)) {
    case IDC_BUTTON_ROBOTTASK:
        pItem = GetDlgItem(IDC_BUTTON_ROBOTTASK);
        pItem->GetWindowRect(rcItem);
        GetParent()->SendMessage(ID_MSG_STATUSBAR_BTN_CLICKED, rcItem.left, LOWORD(wParam));
        break;
    }
    return CDialogEx::OnCommand(wParam, lParam);
}
void CMyStatusbar::OnSize(UINT nType, int cx, int cy)
{
    CDialogEx::OnSize(nType, cx, cy);
SourceCode/Bond/Servo/CMyStatusbar.h
@@ -3,6 +3,8 @@
#include "ColorTransfer.h"
#define ID_MSG_STATUSBAR_BTN_CLICKED        WM_USER + 20398
// CMyStatusbar å¯¹è¯æ¡†
class CMyStatusbar : public CDialogEx
@@ -43,4 +45,5 @@
    afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
    afx_msg void OnDestroy();
    afx_msg void OnSize(UINT nType, int cx, int cy);
    virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
};
SourceCode/Bond/Servo/CRobotTaskDlg.cpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,124 @@
// CRobotTaskDlg.cpp: å®žçŽ°æ–‡ä»¶
//
#include "stdafx.h"
#include "Servo.h"
#include "CRobotTaskDlg.h"
#include "afxdialogex.h"
// CRobotTaskDlg å¯¹è¯æ¡†
IMPLEMENT_DYNAMIC(CRobotTaskDlg, CDialogEx)
CRobotTaskDlg::CRobotTaskDlg(CWnd* pParent /*=nullptr*/)
    : CDialogEx(IDD_DIALOG_ROBOT_TASK, pParent)
{
    m_pRobotTask = nullptr;
}
CRobotTaskDlg::~CRobotTaskDlg()
{
}
void CRobotTaskDlg::DoDataExchange(CDataExchange* pDX)
{
    CDialogEx::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CRobotTaskDlg, CDialogEx)
    ON_WM_CTLCOLOR()
    ON_WM_DESTROY()
    ON_WM_SIZE()
    ON_WM_ACTIVATE()
END_MESSAGE_MAP()
// CRobotTaskDlg æ¶ˆæ¯å¤„理程序
void CRobotTaskDlg::SetRobotTask(SERVO::CRobotTask* pRobotTask)
{
    m_pRobotTask = pRobotTask;
    // å„控件是否显示;
    GetDlgItem(IDC_LABEL_NO_TASK)->ShowWindow(m_pRobotTask == nullptr ? SW_SHOW : SW_HIDE);
    GetDlgItem(IDC_LABEL_GET_PUT)->ShowWindow(m_pRobotTask != nullptr ? SW_SHOW : SW_HIDE);
    if (m_pRobotTask != nullptr) {
        SERVO::CEquipment* pEq1, * pEq2;
        pEq1 = theApp.m_model.getMaster().getEquipment(m_pRobotTask->getSrcPosition());
        pEq2 = theApp.m_model.getMaster().getEquipment(m_pRobotTask->getTarPosition());
        CString strText;
        strText.Format(_T("%s --> %s"), pEq1->getName().c_str(), pEq2->getName().c_str());
        SetDlgItemText(IDC_LABEL_GET_PUT, strText);
    }
}
BOOL CRobotTaskDlg::OnInitDialog()
{
    CDialogEx::OnInitDialog();
    // TODO:  åœ¨æ­¤æ·»åŠ é¢å¤–çš„åˆå§‹åŒ–
    return TRUE;  // return TRUE unless you set the focus to a control
                  // å¼‚常: OCX å±žæ€§é¡µåº”返回 FALSE
}
HBRUSH CRobotTaskDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
    HBRUSH hbr = CDialogEx::OnCtlColor(pDC, pWnd, nCtlColor);
    // TODO:  åœ¨æ­¤æ›´æ”¹ DC çš„任何特性
    // TODO:  å¦‚果默认的不是所需画笔,则返回另一个画笔
    return hbr;
}
void CRobotTaskDlg::OnDestroy()
{
    CDialogEx::OnDestroy();
    // TODO: åœ¨æ­¤å¤„添加消息处理程序代码
}
void CRobotTaskDlg::OnSize(UINT nType, int cx, int cy)
{
    CDialogEx::OnSize(nType, cx, cy);
    if (GetDlgItem(IDC_LABEL_NO_TASK) == nullptr) return;
    Resize();
}
void CRobotTaskDlg::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized)
{
    CWnd::OnActivate(nState, pWndOther, bMinimized);
    if (nState == WA_INACTIVE) {
        ShowWindow(SW_HIDE);
    }
}
void CRobotTaskDlg::Resize()
{
    CRect rcClient, rcItem;
    CWnd* pItem;
    GetClientRect(&rcClient);
    pItem = GetDlgItem(IDC_LABEL_NO_TASK);
    pItem->GetClientRect(&rcItem);
    pItem->MoveWindow((rcClient.Width() - rcItem.Width()) / 2,
        (rcClient.Height() - rcItem.Height()) / 2, rcItem.Width(), rcItem.Height());
    pItem = GetDlgItem(IDC_LABEL_GET_PUT);
    pItem->GetClientRect(&rcItem);
    pItem->MoveWindow(12,
        12, rcItem.Width(), rcItem.Height());
}
SourceCode/Bond/Servo/CRobotTaskDlg.h
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,41 @@
#pragma once
#include "CRobotTask.h"
// CRobotTaskDlg å¯¹è¯æ¡†
class CRobotTaskDlg : public CDialogEx
{
    DECLARE_DYNAMIC(CRobotTaskDlg)
public:
    CRobotTaskDlg(CWnd* pParent = nullptr);   // æ ‡å‡†æž„造函数
    virtual ~CRobotTaskDlg();
public:
    void SetRobotTask(SERVO::CRobotTask* pRobotTask);
private:
    void Resize();
private:
    SERVO::CRobotTask* m_pRobotTask;
// å¯¹è¯æ¡†æ•°æ®
#ifdef AFX_DESIGN_TIME
    enum { IDD = IDD_DIALOG_ROBOT_TASK };
#endif
protected:
    virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV æ”¯æŒ
    DECLARE_MESSAGE_MAP()
public:
    virtual BOOL OnInitDialog();
    afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
    afx_msg void OnDestroy();
    afx_msg void OnSize(UINT nType, int cx, int cy);
    afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized);
};
SourceCode/Bond/Servo/Servo.rc
Binary files differ
SourceCode/Bond/Servo/Servo.vcxproj
@@ -205,6 +205,7 @@
    <ClInclude Include="CRobotCmdTestDlg.h" />
    <ClInclude Include="CPagePortStatus.h" />
    <ClInclude Include="CPortStatusReport.h" />
    <ClInclude Include="CRobotTaskDlg.h" />
    <ClInclude Include="GridControl\CellRange.h" />
    <ClInclude Include="GridControl\GridCell.h" />
    <ClInclude Include="GridControl\GridCellBase.h" />
@@ -333,6 +334,7 @@
    <ClCompile Include="CRobotCmdTestDlg.cpp" />
    <ClCompile Include="CPagePortStatus.cpp" />
    <ClCompile Include="CPortStatusReport.cpp" />
    <ClCompile Include="CRobotTaskDlg.cpp" />
    <ClCompile Include="GridControl\GridCell.cpp" />
    <ClCompile Include="GridControl\GridCellBase.cpp" />
    <ClCompile Include="GridControl\GridCellButton.cpp" />
SourceCode/Bond/Servo/Servo.vcxproj.filters
@@ -155,6 +155,7 @@
    <ClCompile Include="CMyStatusbar.cpp" />
    <ClCompile Include="CRobotTask.cpp" />
    <ClCompile Include="CSlot.cpp" />
    <ClCompile Include="CRobotTaskDlg.cpp" />
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="AlarmManager.h" />
@@ -315,6 +316,7 @@
    <ClInclude Include="CMyStatusbar.h" />
    <ClInclude Include="CRobotTask.h" />
    <ClInclude Include="CSlot.h" />
    <ClInclude Include="CRobotTaskDlg.h" />
  </ItemGroup>
  <ItemGroup>
    <ResourceCompile Include="Servo.rc" />
SourceCode/Bond/Servo/ServoDlg.cpp
@@ -84,6 +84,7 @@
    m_pPageRecipe = nullptr;
    m_pTopToolbar = nullptr;
    m_pMyStatusbar = nullptr;
    m_pRobotTaskDlg = nullptr;
}
void CServoDlg::DoDataExchange(CDataExchange* pDX)
@@ -119,6 +120,7 @@
    ON_MESSAGE(ID_MSG_PANEL_RESIZE, OnPanelResize)
    ON_NOTIFY(BYHMTAB_SEL_CHANGED, IDC_TAB1, &CServoDlg::OnTabSelChanged)
    ON_MESSAGE(ID_MSG_TOOLBAR_BTN_CLICKED, &CServoDlg::OnToolbarBtnClicked)
    ON_MESSAGE(ID_MSG_STATUSBAR_BTN_CLICKED, &CServoDlg::OnStatusbarBtnClicked)
END_MESSAGE_MAP()
@@ -187,6 +189,9 @@
            }
            else if (RX_CODE_EQ_ROBOT_TASK == code) {
                SERVO::CRobotTask* pTask = theApp.m_model.getMaster().getActiveRobotTask();
                if (m_pRobotTaskDlg != nullptr) {
                    m_pRobotTaskDlg->SetRobotTask(pTask);
                }
                if (pTask == nullptr) {
                    m_pMyStatusbar->setCurTaskBtnText("无");
                }
@@ -562,6 +567,12 @@
        m_pMyStatusbar = nullptr;
    }
    if (m_pRobotTaskDlg != nullptr) {
        m_pRobotTaskDlg->DestroyWindow();
        delete m_pRobotTaskDlg;
        m_pRobotTaskDlg = nullptr;
    }
    if (m_pTerminalDisplayDlg != nullptr) {
        m_pTerminalDisplayDlg->DestroyWindow();
        delete m_pTerminalDisplayDlg;
@@ -793,6 +804,27 @@
    return 0;
}
LRESULT CServoDlg::OnStatusbarBtnClicked(WPARAM wParam, LPARAM lParam)
{
    int id = (int)lParam;
    int x = (int)wParam;
    if (id == IDC_BUTTON_ROBOTTASK) {
        if (m_pRobotTaskDlg == nullptr) {
            m_pRobotTaskDlg = new CRobotTaskDlg();
            m_pRobotTaskDlg->Create(IDD_DIALOG_ROBOT_TASK, this);
        }
        CRect rcBar;
        int h = 258;
        int w = 388;
        m_pRobotTaskDlg->SetRobotTask(theApp.m_model.getMaster().getActiveRobotTask());
        m_pMyStatusbar->GetWindowRect(rcBar);
        m_pRobotTaskDlg->MoveWindow(x, rcBar.top - h, w, h);
        m_pRobotTaskDlg->ShowWindow(SW_SHOW);
    }
    return 0;
}
CString& CServoDlg::GetRuntimeFormatText(CString& strText, const char* pszSuffix)
{
    ULONGLONG ullRunTime = (ULONGLONG)(theApp.m_model.getMaster().getRunTime() * 0.001);
SourceCode/Bond/Servo/ServoDlg.h
@@ -15,6 +15,7 @@
#include "CPageGraph2.h"
#include "TopToolbar.h"
#include "CMyStatusbar.h"
#include "CRobotTaskDlg.h"
// CServoDlg å¯¹è¯æ¡†
@@ -37,12 +38,12 @@
private:
    IObserver* m_pObserver;
    CTerminalDisplayDlg* m_pTerminalDisplayDlg;
    CRobotTaskDlg* m_pRobotTaskDlg;
    CPageGraph1* m_pPageGraph1;
    CPageGraph2* m_pPageGraph2;
    CPageRecipe* m_pPageRecipe;
    CPageAlarm*     m_pPageAlarm;
    CPageLog*     m_pPageLog;
// å¯¹è¯æ¡†æ•°æ®
#ifdef AFX_DESIGN_TIME
@@ -95,4 +96,5 @@
    afx_msg LRESULT OnPanelResize(WPARAM wParam, LPARAM lParam);
    afx_msg void OnTabSelChanged(NMHDR* nmhdr, LRESULT* result);
    LRESULT OnToolbarBtnClicked(WPARAM wParam, LPARAM lParam);
    LRESULT OnStatusbarBtnClicked(WPARAM wParam, LPARAM lParam);
};
SourceCode/Bond/Servo/resource.h
Binary files differ