LAPTOP-SNT8I5JK\Boounion
2025-09-08 a056810ab4c5fa63777f6fdddfeb190bbd9a6f54
Merge branch 'liuyang'

# Conflicts:
# SourceCode/Bond/Servo/Servo.vcxproj.filters
已添加2个文件
已修改5个文件
162 ■■■■■ 文件已修改
SourceCode/Bond/Servo/DeviceRecipeParamDlg.cpp 113 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/DeviceRecipeParamDlg.h 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/PageRecipe.cpp 11 ●●●●● 补丁 | 查看 | 原始文档 | 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/resource.h 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/DeviceRecipeParamDlg.cpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,113 @@
// DeviceRecipeParamDlg.cpp: å®žçŽ°æ–‡ä»¶
//
#include "stdafx.h"
#include "Servo.h"
#include "afxdialogex.h"
#include "DeviceRecipeParamDlg.h"
// CDeviceRecipeParamDlg å¯¹è¯æ¡†
IMPLEMENT_DYNAMIC(CDeviceRecipeParamDlg, CDialogEx)
CDeviceRecipeParamDlg::CDeviceRecipeParamDlg(CWnd* pParent /*=nullptr*/)
    : CDialogEx(IDD_DIALOG_DEVICE_RECIPE_PARAM, pParent)
{
    m_pEquipment = nullptr;
    m_nDeviceRecipeID = 0;
    m_strDeviceRecipeName = _T("");
}
CDeviceRecipeParamDlg::~CDeviceRecipeParamDlg()
{
}
void CDeviceRecipeParamDlg::setEquipment(SERVO::CEquipment* pEquipment)
{
    m_pEquipment = pEquipment;
}
void CDeviceRecipeParamDlg::setDeviceRecipeID(int nDeviceRecipeID)
{
    m_nDeviceRecipeID = nDeviceRecipeID;
}
void CDeviceRecipeParamDlg::setDeviceRecipeName(const CString& strDeviceRecipeName)
{
    m_strDeviceRecipeName = strDeviceRecipeName;
}
void CDeviceRecipeParamDlg::DoDataExchange(CDataExchange* pDX)
{
    CDialogEx::DoDataExchange(pDX);
    DDX_Control(pDX, IDC_LIST_RECIPE_PARAM, m_wndRecipeParamList);
}
BEGIN_MESSAGE_MAP(CDeviceRecipeParamDlg, CDialogEx)
END_MESSAGE_MAP()
// CDeviceRecipeParamDlg æ¶ˆæ¯å¤„理程序
BOOL CDeviceRecipeParamDlg::OnInitDialog()
{
    CDialogEx::OnInitDialog();
    // TODO:  åœ¨æ­¤æ·»åŠ é¢å¤–çš„åˆå§‹åŒ–
    CRect rc;
    m_wndRecipeParamList.GetClientRect(&rc);
    int nColWidth = rc.Width() / 2;
    m_wndRecipeParamList.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES);
    m_wndRecipeParamList.InsertColumn(0, _T("参数名"), LVCFMT_LEFT, nColWidth);
    m_wndRecipeParamList.InsertColumn(1, _T("参数值"), LVCFMT_LEFT, nColWidth);
    if (nullptr == m_pEquipment) {
        return FALSE;
    }
    CString strTitle;
    if (!m_strDeviceRecipeName.IsEmpty()) {
        strTitle.Format(_T("%s - %s é…æ–¹å‚æ•°"), m_pEquipment->getName().c_str(), m_strDeviceRecipeName);
    }
    else {
        strTitle.Format(_T("%s é…æ–¹å‚æ•°"), m_pEquipment->getName().c_str());
    }
    SetWindowText(strTitle);
    SERVO::CRecipeList* pRecipeList = m_pEquipment->getRecipeList(0);
    ASSERT(pRecipeList);
    auto rawDatas = pRecipeList->getParamsRawData();
    for (auto item : rawDatas) {
        if (m_nDeviceRecipeID != 0 && item.first != m_nDeviceRecipeID) {
            continue;
        }
        std::vector<CParam> params;
        m_pEquipment->parsingParams((const char*)item.second.data(), item.second.size(), params);
        for (auto p : params) {
            CString strName(p.getName().c_str());
            CString strValue;
            switch (p.getValueType()) {
            case PVT_INT:
                strValue.Format(_T("%d"), p.getIntValue());
                break;
            case PVT_DOUBLE:
                strValue.Format(_T("%.6f"), p.getDoubleValue());
                break;
            default:
                strValue = _T("未知类型");
                break;
            }
            int nCount = m_wndRecipeParamList.GetItemCount();
            int nIndex = m_wndRecipeParamList.InsertItem(nCount, strName);
            m_wndRecipeParamList.SetItemText(nIndex, 1, strValue);
        }
    }
    return TRUE;  // return TRUE unless you set the focus to a control
    // å¼‚常: OCX å±žæ€§é¡µåº”返回 FALSE
}
SourceCode/Bond/Servo/DeviceRecipeParamDlg.h
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,34 @@
#pragma once
#include "afxdialogex.h"
// CDeviceRecipeParamDlg å¯¹è¯æ¡†
class CDeviceRecipeParamDlg : public CDialogEx
{
    DECLARE_DYNAMIC(CDeviceRecipeParamDlg)
public:
    CDeviceRecipeParamDlg(CWnd* pParent = nullptr);   // æ ‡å‡†æž„造函数
    virtual ~CDeviceRecipeParamDlg();
    void setEquipment(SERVO::CEquipment* pEquipment);
    void setDeviceRecipeID(int nDeviceRecipeID);
    void setDeviceRecipeName(const CString& strDeviceRecipeName);
// å¯¹è¯æ¡†æ•°æ®
#ifdef AFX_DESIGN_TIME
    enum { IDD = IDD_DIALOG_DEVICE_RECIPE_PARAM };
#endif
protected:
    virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV æ”¯æŒ
    virtual BOOL OnInitDialog();
    DECLARE_MESSAGE_MAP()
private:
    int m_nDeviceRecipeID;
    CString m_strDeviceRecipeName;
    SERVO::CEquipment* m_pEquipment;
    CListCtrl m_wndRecipeParamList;
};
SourceCode/Bond/Servo/PageRecipe.cpp
@@ -8,6 +8,7 @@
#include "MsgDlg.h"
#include "InputDialog.h"
#include "RecipeDeviceBindDlg.h"
#include "DeviceRecipeParamDlg.h"
// CPageRecipe å¯¹è¯æ¡†
@@ -588,17 +589,25 @@
        return;
    }
    CString strText = m_listPPID.GetItemText(nItem, 2);
    CString strRecipeID = m_listPPID.GetItemText(nItem, 2);
    CString strRecipeName = m_listPPID.GetItemText(nItem, 3);
    CComboBox* pComboBox = (CComboBox*)GetDlgItem(IDC_COMBO_EQUIPMENT);
    int nEqSel = pComboBox->GetCurSel();
    if (nEqSel == CB_ERR) {
        return;
    }
    int nRecipeID = _ttoi(strRecipeID);
    SERVO::CEquipment* pEq = (SERVO::CEquipment*)pComboBox->GetItemDataPtr(nEqSel);
    if (pEq == nullptr) {
        return;
    }
    CDeviceRecipeParamDlg dlg(this);
    dlg.setDeviceRecipeID(nRecipeID);
    dlg.setDeviceRecipeName(strRecipeName);
    dlg.setEquipment(pEq);
    dlg.DoModal();
}
void CPageRecipe::OnCbnSelchangeComboEquipment()
SourceCode/Bond/Servo/Servo.rc
Binary files differ
SourceCode/Bond/Servo/Servo.vcxproj
@@ -233,6 +233,7 @@
    <ClInclude Include="CRobotTaskDlg.h" />
    <ClInclude Include="CSVData.h" />
    <ClInclude Include="CVariable.h" />
    <ClInclude Include="DeviceRecipeParamDlg.h" />
    <ClInclude Include="GlassJson.h" />
    <ClInclude Include="GridControl\CellRange.h" />
    <ClInclude Include="GridControl\GridCell.h" />
@@ -403,6 +404,7 @@
    <ClCompile Include="CRobotTaskDlg.cpp" />
    <ClCompile Include="CSVData.cpp" />
    <ClCompile Include="CVariable.cpp" />
    <ClCompile Include="DeviceRecipeParamDlg.cpp" />
    <ClCompile Include="GlassJson.cpp" />
    <ClCompile Include="GridControl\GridCell.cpp" />
    <ClCompile Include="GridControl\GridCellBase.cpp" />
SourceCode/Bond/Servo/Servo.vcxproj.filters
@@ -192,6 +192,7 @@
    <ClCompile Include="..\jsoncpp\lib_json\json_writer.cpp">
      <Filter>JsonCpp</Filter>
    </ClCompile>
    <ClCompile Include="DeviceRecipeParamDlg.cpp" />
    <ClCompile Include="CSVData.cpp" />
  </ItemGroup>
  <ItemGroup>
@@ -409,6 +410,7 @@
    <ClInclude Include="..\jsoncpp\lib_json\json_batchallocator.h">
      <Filter>JsonCpp</Filter>
    </ClInclude>
    <ClInclude Include="DeviceRecipeParamDlg.h" />
    <ClInclude Include="CSVData.h" />
  </ItemGroup>
  <ItemGroup>
SourceCode/Bond/Servo/resource.h
Binary files differ