LAPTOP-SNT8I5JK\Boounion
2025-07-14 375342c11638685d6b7fecc2a979825c56d770f9
1.CCollectionEvent,CLoadPort, CVariable类实现;
2.从.txt或csv中加载CVariable列表;
3.添加菜单,准备添加相关查看或编辑 CVariable列表的界面;
已添加8个文件
已修改9个文件
435 ■■■■■ 文件已修改
Document/VariableList.txt 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CCollectionEvent.cpp 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CCollectionEvent.h 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CReport.cpp 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CReport.h 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CVariable.cpp 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CVariable.h 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/HsmsPassive.cpp 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/HsmsPassive.h 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/Model.cpp 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/Servo.rc 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/Servo.vcxproj 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/Servo.vcxproj.filters 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/ServoDlg.cpp 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/ServoDlg.h 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/resource.h 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/x64/Debug/VariableList.txt 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Document/VariableList.txt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,37 @@
SVID,SV Name,SV Format,SV Remark
100,PortTransferState,U1,"0=OutOfService\r\n1=TransferBlocked\r\n2=ReadyToLoad\r\n3=ReadyToUnload\r\n4=InService\r\n5=TransferReady"
300,AccessMode,U1,"1=Manual\r\n2=Auto"
500,Clock,A50,
600,CurrentControlState,U1,"0:Offline:equipment\r\n1:Offline-Attempt\r\n2:Online\r\n3:Offline:host\r\n4:Online:Local\r\n5:Online:Remote"
601,PreviousControlState,U1,
700,CurrentProcessState,U1,"0:DOWN\r\n1:IDLE\r\n2.SETUP\r\n3.EXCUTING\r\n4.MAINTAIN\r\n5.ALARM"
701,PreviousProcessState,U1,
800,EFEMPPExecName,A20,
801,EQPPExecName,A20,
1000,CJobSpace,U1,
2000,RbRAxisTorque,I2,机器人R轴扭矩
2001,RbLAxisTorque,l2,机器人L轴扭矩
2002,RbZAxisTorque,l2,机器人Z轴扭矩
2003,RbTHAxisTorque,l2,机器人TH轴扭矩
2004,RbXAxisTorque,l2,机器人X轴扭矩
2005,AxisX111,l2,X111相机前移栽电机扭矩
2006,AxisX112,l2,X112相机后移栽电机扭矩
2007,AxisU113,l2,U113产品旋转电机扭矩
2008,AxisX114,l2,X114产品左整列电机扭矩
2009,AxisY121,l2,Y121产品右整列电机扭矩
2010,AxisY122,l2,Y122产品前整列电机扭矩
2011,AxisY123,l2,Y123产品后阵列电机扭矩
2012,MainAir,U2,总进气压力值
2013,MainVacuum,l2,总真空压力值
2014,RbMainVacuum,l2,机器人真空值
2015,LPMainVacuum,l2,LP真空值#D265
2016,LPMainAir,U2,LP压空值
2017,ALVacuum,l2,Aligner真空值
2018,FFU1RPM,U2,FFU1转速
2019,FFU2RPM,U2,FFU2转速
2020,FFU3RPM,U2,FFU3转速
2021,FFU4RPM,U2,FFU4转速
2022,ESDValue,I2,静电检测值
2023,OCREnable,U2,"OCR使能:O:开启 1:屏蔽"
2024,CCDEnable,U2,"CCD使能:O:开启 1:屏蔽"
2025,FFUParameter,U2,FFU设定值
SourceCode/Bond/Servo/CCollectionEvent.cpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,56 @@
#include "stdafx.h"
#include "CCollectionEvent.h"
namespace SERVO {
    CCollectionEvent::CCollectionEvent()
    {
        m_nCEID = 0;
    }
    CCollectionEvent::~CCollectionEvent()
    {
    }
    unsigned int CCollectionEvent::getEventId()
    {
        return m_nCEID;
    }
    BOOL CCollectionEvent::addReport(CReport* pReport)
    {
        ASSERT(pReport);
        if (getReport(pReport->getReportId()) != nullptr) {
            return FALSE;
        }
        m_reports.push_back(pReport);
        return TRUE;
    }
    BOOL CCollectionEvent::deleteReport(unsigned int nReportId)
    {
        BOOL bDelete = FALSE;
        for (auto iter = m_reports.begin(); iter != m_reports.end(); ++iter) {
            if (nReportId == (*iter)->getReportId()) {
                m_reports.erase(iter);
                bDelete = TRUE;
                break;
            }
        }
        return bDelete;
    }
    CReport* CCollectionEvent::getReport(unsigned int nReportId)
    {
        for (auto item : m_reports) {
            if (nReportId == item->getReportId()) {
                return item;
            }
        }
        return nullptr;
    }
}
SourceCode/Bond/Servo/CCollectionEvent.h
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,23 @@
#pragma once
#include "CReport.h"
#include <vector>
namespace SERVO {
    class CCollectionEvent
    {
    public:
        CCollectionEvent();
        virtual ~CCollectionEvent();
    public:
        unsigned int getEventId();
        BOOL addReport(CReport* pReport);
        BOOL deleteReport(unsigned int nReportId);
        CReport* getReport(unsigned int nReportId);
    private:
        unsigned int m_nCEID;
        std::vector<CReport*> m_reports;
    };
}
SourceCode/Bond/Servo/CReport.cpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,56 @@
#include "stdafx.h"
#include "CReport.h"
namespace SERVO {
    CReport::CReport()
    {
    }
    CReport::~CReport()
    {
    }
    unsigned int CReport::getReportId()
    {
        return m_nReportId;
    }
    BOOL CReport::addVariable(CVariable* pVariable)
    {
        ASSERT(pVariable);
        if (getVariable(pVariable->getVarialbleId()) != nullptr) {
            return FALSE;
        }
        m_variabels.push_back(pVariable);
        return TRUE;
    }
    BOOL CReport::deleteVarialble(unsigned int nVarialbleId)
    {
        BOOL bDelete = FALSE;
        for (auto iter = m_variabels.begin(); iter != m_variabels.end(); ++iter) {
            if (nVarialbleId == (*iter)->getVarialbleId()) {
                m_variabels.erase(iter);
                bDelete = TRUE;
                break;
            }
        }
        return bDelete;
    }
    CVariable* CReport::getVariable(unsigned int nVarialbleId)
    {
        for (auto item : m_variabels) {
            if (nVarialbleId == item->getVarialbleId()) {
                return item;
            }
        }
        return nullptr;
    }
}
SourceCode/Bond/Servo/CReport.h
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,23 @@
#pragma once
#include "CVariable.h"
#include <vector>
namespace SERVO {
    class CReport
    {
    public:
        CReport();
        virtual ~CReport();
    public:
        unsigned int getReportId();
        BOOL addVariable(CVariable* pVariable);
        BOOL deleteVarialble(unsigned int nVarialbleId);
        CVariable* getVariable(unsigned int nVarialbleId);
    private:
        unsigned int m_nReportId;
        std::vector<CVariable*> m_variabels;
    };
}
SourceCode/Bond/Servo/CVariable.cpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,68 @@
#include "stdafx.h"
#include "CVariable.h"
namespace SERVO {
    CVariable::CVariable()
    {
        m_nVarialbeId = 0;
        m_format = SVFromat::U1;
    }
    CVariable::CVariable(const char* pszId, const char* pszName, const char* pszFormat, const char* pszRemark)
    {
        m_nVarialbeId = atoi(pszId);
        m_strName = pszName;
        m_format = toFormat(pszFormat);
        m_strRemark = pszRemark;
        TRACE("CVariable .....%d,%s,%d,%s\n", m_nVarialbeId, m_strName.c_str(),
            m_format, m_strRemark.c_str());
    }
    CVariable::~CVariable()
    {
    }
    SVFromat CVariable::toFormat(const char* pszFormat)
    {
        if (_strcmpi("U1", pszFormat) == 0) {
            return SVFromat::U1;
        }
        if (_strcmpi("U2", pszFormat) == 0) {
            return SVFromat::U2;
        }
        if (_strcmpi("I2", pszFormat) == 0) {
            return SVFromat::I2;
        }
        if (_strcmpi("A50", pszFormat) == 0) {
            return SVFromat::A50;
        }
        if (_strcmpi("A20", pszFormat) == 0) {
            return SVFromat::A20;
        }
        return SVFromat::U1;
    }
    unsigned int CVariable::getVarialbleId()
    {
        return m_nVarialbeId;
    }
    std::string& CVariable::getName()
    {
        return m_strName;
    }
    SVFromat CVariable::getFormat()
    {
        return m_format;
    }
    std::string& CVariable::getRemark()
    {
        return m_strRemark;
    }
}
SourceCode/Bond/Servo/CVariable.h
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,36 @@
#pragma once
#include <string>
namespace SERVO {
    // å˜é‡æ ¼å¼
    enum class SVFromat {
        U1 = 0,
        U2,
        I2,
        A20,
        A50
    };
    class CVariable
    {
    public:
        CVariable();
        CVariable(const char* pszId, const char* pszName, const char* pszFormat, const char* pszRemark);
        ~CVariable();
    public:
        static SVFromat toFormat(const char* pszFormat);
        unsigned int getVarialbleId();
        std::string& getName();
        SVFromat getFormat();
        std::string& getRemark();
    private:
        unsigned int m_nVarialbeId;
        std::string m_strName;
        SVFromat m_format;
        std::string m_strRemark;
    };
}
SourceCode/Bond/Servo/HsmsPassive.cpp
@@ -8,6 +8,7 @@
#include <time.h>  
#include <stdlib.h>  
#include <string.h>  
#include <regex>
const char ACK[2] = {0, 1};
@@ -195,6 +196,64 @@
    return 0;
}
int CHsmsPassive::loadVarialbleList(const char* pszFilepath)
{
    CStdioFile file;
    if (!file.Open(pszFilepath, CFile::modeRead)) {
        return -1;
    }
    std::regex pattern("^\\d+,.*");  // åŒ¹é…ä»¥æ•°å­—+逗号开头的字符串
    std::vector<SERVO::CVariable*> variables;
    int index, last;
    CString strLine;
    CString strId, strName, strFormat, strRemark;
    while (file.ReadString(strLine)) {
        if (!std::regex_match((LPTSTR)(LPCTSTR)strLine, pattern)) {
            continue;
        }
        last = 0;
        index = strLine.Find(",", last);
        if (index < 0) continue;
        strId = strLine.Left(index);
        last = index + 1;
        index = strLine.Find(",", last);
        if (index < 0) continue;
        strName = strLine.Mid(last, index - last);
        last = index + 1;
        index = strLine.Find(",", last);
        if (index < 0) continue;
        strFormat = strLine.Mid(last, index - last);
        strRemark = strLine.Right(strLine.GetLength() - index - 1);
        SERVO::CVariable* pVarialble = new SERVO::CVariable(
            (LPTSTR)(LPCTSTR)strId, (LPTSTR)(LPCTSTR)strName, (LPTSTR)(LPCTSTR)strFormat, (LPTSTR)(LPCTSTR)strRemark);
        variables.push_back(pVarialble);
    }
    if (!variables.empty()) {
        clearAllVariabel();
        for (auto item : variables) {
            m_variabels.push_back(item);
        }
    }
    file.Close();
    return 0;
}
void CHsmsPassive::clearAllVariabel()
{
    for (auto item : m_variabels) {
        delete item;
    }
    m_variabels.clear();
}
int CHsmsPassive::init(CModel* pModel, const char* pszName, unsigned int port)
{
    m_pModel = pModel;
@@ -326,6 +385,8 @@
        m_pPassive = NULL;
    }
    clearAllVariabel();
    return 0;
}
SourceCode/Bond/Servo/HsmsPassive.h
@@ -5,6 +5,7 @@
#include <functional>
#include <vector>
#include <map>
#include "CCollectionEvent.h"
#define EQCONSTANT_VALUE_MAX    64
@@ -110,6 +111,10 @@
    // å–消/删除所有 define report
    void deleteAllReport();
    // ä»Žæ–‡ä»¶ä¸­åŠ è½½CVariable列表
    int loadVarialbleList(const char* pszFilepath);
    void setListener(SECSListener listener);
    unsigned OnCimWork();
    void OnTimer(UINT nTimerid);
@@ -146,6 +151,7 @@
    inline void Lock() { EnterCriticalSection(&m_criticalSection); }
    inline void Unlock() { LeaveCriticalSection(&m_criticalSection); }
    int onRecvMsg(IMessage* pMessage);
    void clearAllVariabel();
private:
    CModel* m_pModel;
@@ -179,5 +185,8 @@
    // VID to Report
    std::map<unsigned int, VALUE> m_mapValue;
    // CVariable vector
    std::vector<SERVO::CVariable*> m_variabels;
};
SourceCode/Bond/Servo/Model.cpp
@@ -128,6 +128,9 @@
    m_hsmsPassive.setListener(listener);
    m_hsmsPassive.setEquipmentModelType((LPTSTR)(LPCTSTR)strModeType);
    m_hsmsPassive.setSoftRev((LPTSTR)(LPCTSTR)strSoftRev);
    CString strVarialbleFile;
    strVarialbleFile.Format(_T("%s\\VariableList.txt"), (LPTSTR)(LPCTSTR)m_strWorkDir);
    m_hsmsPassive.loadVarialbleList((LPTSTR)(LPCTSTR)strVarialbleFile);
    m_hsmsPassive.init(this, "APP", 7000);
SourceCode/Bond/Servo/Servo.rc
Binary files differ
SourceCode/Bond/Servo/Servo.vcxproj
@@ -200,16 +200,19 @@
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="CBaseDlg.h" />
    <ClInclude Include="CCollectionEvent.h" />
    <ClInclude Include="CEquipmentPage3.h" />
    <ClInclude Include="CGlassPool.h" />
    <ClInclude Include="ChangePasswordDlg.h" />
    <ClInclude Include="CMyStatusbar.h" />
    <ClInclude Include="CPageLinkSignal.h" />
    <ClInclude Include="CReport.h" />
    <ClInclude Include="CRobotCmdContainerDlg.h" />
    <ClInclude Include="CRobotCmdTestDlg.h" />
    <ClInclude Include="CPagePortStatus.h" />
    <ClInclude Include="CPortStatusReport.h" />
    <ClInclude Include="CRobotTaskDlg.h" />
    <ClInclude Include="CVariable.h" />
    <ClInclude Include="GridControl\CellRange.h" />
    <ClInclude Include="GridControl\GridCell.h" />
    <ClInclude Include="GridControl\GridCellBase.h" />
@@ -342,16 +345,19 @@
  </ItemGroup>
  <ItemGroup>
    <ClCompile Include="CBaseDlg.cpp" />
    <ClCompile Include="CCollectionEvent.cpp" />
    <ClCompile Include="CEquipmentPage3.cpp" />
    <ClCompile Include="CGlassPool.cpp" />
    <ClCompile Include="ChangePasswordDlg.cpp" />
    <ClCompile Include="CMyStatusbar.cpp" />
    <ClCompile Include="CPageLinkSignal.cpp" />
    <ClCompile Include="CReport.cpp" />
    <ClCompile Include="CRobotCmdContainerDlg.cpp" />
    <ClCompile Include="CRobotCmdTestDlg.cpp" />
    <ClCompile Include="CPagePortStatus.cpp" />
    <ClCompile Include="CPortStatusReport.cpp" />
    <ClCompile Include="CRobotTaskDlg.cpp" />
    <ClCompile Include="CVariable.cpp" />
    <ClCompile Include="GridControl\GridCell.cpp" />
    <ClCompile Include="GridControl\GridCellBase.cpp" />
    <ClCompile Include="GridControl\GridCellButton.cpp" />
SourceCode/Bond/Servo/Servo.vcxproj.filters
@@ -169,6 +169,9 @@
    <ClCompile Include="InputDialog.cpp" />
    <ClCompile Include="RecipeManager.cpp" />
    <ClCompile Include="RecipeDeviceBindDlg.cpp" />
    <ClCompile Include="CCollectionEvent.cpp" />
    <ClCompile Include="CReport.cpp" />
    <ClCompile Include="CVariable.cpp" />
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="AlarmManager.h" />
@@ -343,6 +346,9 @@
    <ClInclude Include="InputDialog.h" />
    <ClInclude Include="RecipeManager.h" />
    <ClInclude Include="RecipeDeviceBindDlg.h" />
    <ClInclude Include="CCollectionEvent.h" />
    <ClInclude Include="CReport.h" />
    <ClInclude Include="CVariable.h" />
  </ItemGroup>
  <ItemGroup>
    <ResourceCompile Include="Servo.rc" />
SourceCode/Bond/Servo/ServoDlg.cpp
@@ -118,6 +118,8 @@
    ON_UPDATE_COMMAND_UI(ID_MENU_FILE_SETTINGS, &CServoDlg::OnUpdateMenuFileSettings)
    ON_COMMAND(ID_MENU_FILE_SECSTEST, &CServoDlg::OnMenuFileSecsTest)
    ON_UPDATE_COMMAND_UI(ID_MENU_FILE_SECSTEST, &CServoDlg::OnUpdateMenuFileSecsTest)
    ON_COMMAND(ID_MENU_PROJECT_VARIABLE_LIST, &CServoDlg::OnMenuProjectVarialbleList)
    ON_UPDATE_COMMAND_UI(ID_MENU_PROJECT_VARIABLE_LIST, &CServoDlg::OnUpdateMenuProjectVarialbleList)
    ON_COMMAND(ID_MENU_TEST_MESSAGE_SET, &CServoDlg::OnMenuTestMessageSet)
    ON_UPDATE_COMMAND_UI(ID_MENU_TEST_MESSAGE_SET, &CServoDlg::OnUpdateMenuTestMessageSet)
    ON_COMMAND(ID_MENU_TEST_MESSAGE_CLEAR, &CServoDlg::OnMenuTestMessageClear)
@@ -552,6 +554,16 @@
    pCmdUI->Enable(TRUE);
}
void CServoDlg::OnMenuProjectVarialbleList()
{
    AfxMessageBox("OnMenuProjectVarialbleList");
}
void CServoDlg::OnUpdateMenuProjectVarialbleList(CCmdUI* pCmdUI)
{
    pCmdUI->Enable(TRUE);
}
void CServoDlg::OnMenuTestMessageSet()
{
    SERVO::CEquipment* pEquipment = m_pPanelMaster->GetActiveEquipment();
SourceCode/Bond/Servo/ServoDlg.h
@@ -90,6 +90,8 @@
    afx_msg void OnUpdateMenuFileSecsTest(CCmdUI* pCmdUI);
    afx_msg void OnMenuFileExit();
    afx_msg void OnUpdateMenuFileExit(CCmdUI* pCmdUI);
    afx_msg void OnMenuProjectVarialbleList();
    afx_msg void OnUpdateMenuProjectVarialbleList(CCmdUI* pCmdUI);
    afx_msg void OnMenuTestMessageSet();
    afx_msg void OnUpdateMenuTestMessageSet(CCmdUI* pCmdUI);
    afx_msg void OnMenuTestMessageClear();
SourceCode/Bond/Servo/resource.h
Binary files differ
SourceCode/Bond/x64/Debug/VariableList.txt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,37 @@
SVID,SV Name,SV Format,SV Remark
100,PortTransferState,U1,"0=OutOfService\r\n1=TransferBlocked\r\n2=ReadyToLoad\r\n3=ReadyToUnload\r\n4=InService\r\n5=TransferReady"
300,AccessMode,U1,"1=Manual\r\n2=Auto"
500,Clock,A50,
600,CurrentControlState,U1,"0:Offline:equipment\r\n1:Offline-Attempt\r\n2:Online\r\n3:Offline:host\r\n4:Online:Local\r\n5:Online:Remote"
601,PreviousControlState,U1,
700,CurrentProcessState,U1,"0:DOWN\r\n1:IDLE\r\n2.SETUP\r\n3.EXCUTING\r\n4.MAINTAIN\r\n5.ALARM"
701,PreviousProcessState,U1,
800,EFEMPPExecName,A20,
801,EQPPExecName,A20,
1000,CJobSpace,U1,
2000,RbRAxisTorque,I2,机器人R轴扭矩
2001,RbLAxisTorque,l2,机器人L轴扭矩
2002,RbZAxisTorque,l2,机器人Z轴扭矩
2003,RbTHAxisTorque,l2,机器人TH轴扭矩
2004,RbXAxisTorque,l2,机器人X轴扭矩
2005,AxisX111,l2,X111相机前移栽电机扭矩
2006,AxisX112,l2,X112相机后移栽电机扭矩
2007,AxisU113,l2,U113产品旋转电机扭矩
2008,AxisX114,l2,X114产品左整列电机扭矩
2009,AxisY121,l2,Y121产品右整列电机扭矩
2010,AxisY122,l2,Y122产品前整列电机扭矩
2011,AxisY123,l2,Y123产品后阵列电机扭矩
2012,MainAir,U2,总进气压力值
2013,MainVacuum,l2,总真空压力值
2014,RbMainVacuum,l2,机器人真空值
2015,LPMainVacuum,l2,LP真空值#D265
2016,LPMainAir,U2,LP压空值
2017,ALVacuum,l2,Aligner真空值
2018,FFU1RPM,U2,FFU1转速
2019,FFU2RPM,U2,FFU2转速
2020,FFU3RPM,U2,FFU3转速
2021,FFU4RPM,U2,FFU4转速
2022,ESDValue,I2,静电检测值
2023,OCREnable,U2,"OCR使能:O:开启 1:屏蔽"
2024,CCDEnable,U2,"CCD使能:O:开启 1:屏蔽"
2025,FFUParameter,U2,FFU设定值