LAPTOP-SNT8I5JK\Boounion
2025-03-25 9d3e2ee8831bdd443bce96590fc023b8af5c790a
1.为Glass增加移动路线记录,便于物料生产追踪,数据保存分析等;
已添加2个文件
已修改10个文件
252 ■■■■■ 文件已修改
SourceCode/Bond/Servo/CEquipment.cpp 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CEquipment.h 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CGlass.cpp 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CGlass.h 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CPageGraph2.cpp 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CPath.cpp 125 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CPath.h 33 ●●●●● 补丁 | 查看 | 原始文档 | 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 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/resource.h 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CEquipment.cpp
@@ -548,6 +548,7 @@
        // æ¨¡æ‹Ÿå–出第一张Panel,传送到下一环节
        ULONGLONG time = CToolUnits::getTimestamp();
        Lock();
        if (m_glassList.empty()) {
            Unlock();
@@ -562,6 +563,10 @@
            LOGE("<CEquipment>对方拒绝接收Intent.");
        }
        else if (nRet == FLOW_ACCEPT) {
            CPath* pPath = pContext->getPathWithSiteID(m_nID);
            if (pPath != nullptr) {
                pPath->setOutTime(time);
            }
            m_glassList.pop_front();
            pContext->release();        // æ·»åŠ åˆ°åˆ—é˜Ÿæ—¶addRef, å–出时release
            if (m_listener.onDataChanged != nullptr) {
@@ -583,6 +588,7 @@
    int CEquipment::glassArrived(CGlass* pGlass)
    {
        Lock();
        pGlass->addPath(m_nID);
        pGlass->addRef();
        m_glassList.push_back(pGlass);
        Unlock();
@@ -607,4 +613,17 @@
            m_listener.onDataChanged(this, 0);
        }
    }
    CGlass* CEquipment::getFrontGlass()
    {
        CGlass* pGlass = nullptr;
        Lock();
        if (!m_glassList.empty()) {
            pGlass = m_glassList.front();
        }
        Unlock();
        return pGlass;
    }
}
SourceCode/Bond/Servo/CEquipment.h
@@ -94,6 +94,7 @@
        virtual BOOL glassWillArrive(CGlass* pGlass);
        virtual int outputGlass(int port);
        virtual int glassArrived(CGlass* pGlass);
        CGlass* getFrontGlass();
    // ä»¥ä¸‹ä¸ºä»ŽCC-Link读取到的Bit标志位检测函数
    public:
SourceCode/Bond/Servo/CGlass.cpp
@@ -5,12 +5,18 @@
namespace SERVO {
    CGlass::CGlass()
    {
        m_pPath = nullptr;
    }
    CGlass::~CGlass()
    {
        CPath* pPath = m_pPath;
        while (pPath != nullptr) {
            CPath* pTemp = pPath->getNext();
            delete pPath;
            pPath = pTemp;
        }
        m_pPath = nullptr;
    }
    std::string& CGlass::getClassName()
@@ -39,18 +45,58 @@
        return m_strID;
    }
    CPath* CGlass::getPathWithSiteID(unsigned int nSiteId)
    {
        CPath* pPath = m_pPath;
        while (pPath != nullptr) {
            if (nSiteId == pPath->getSiteID()) {
                return pPath;
            }
            pPath = pPath->getNext();
        }
        return nullptr;
    }
    CPath* CGlass::getPath()
    {
        return m_pPath;
    }
    void CGlass::addPath(unsigned int nSiteId)
    {
        CPath* pPath = new CPath(nSiteId);
        if (m_pPath == nullptr) {
            m_pPath = pPath;
        }
        else {
            m_pPath->addPath(pPath);
        }
    }
    void CGlass::serialize(CArchive& ar)
    {
        if (ar.IsStoring())
        {
            Lock();
            WriteString(ar, m_strID);
            ar << (ULONGLONG)m_pPath;
            if (m_pPath != nullptr) {
                m_pPath->serialize(ar);
            }
            Unlock();
        }
        else
        {
            Lock();
            ReadString(ar, m_strID);
            ULONGLONG ullPath;
            ar >> ullPath;
            if (ullPath != 0) {
                m_pPath = new CPath();
                m_pPath->serialize(ar);
            }
            Unlock();
        }
    }
SourceCode/Bond/Servo/CGlass.h
@@ -1,6 +1,7 @@
#pragma once
#include "Context.h"
#include <string>
#include "CPath.h"
namespace SERVO {
@@ -15,10 +16,14 @@
        virtual std::string toString();
        void setID(const char* pszID);
        std::string& getID();
        CPath* getPathWithSiteID(unsigned int nSiteId);
        CPath* getPath();
        void addPath(unsigned int nSiteId);
        void serialize(CArchive& ar);
    private:
        std::string m_strID;
        CPath* m_pPath;
    };
}
SourceCode/Bond/Servo/CPageGraph2.cpp
@@ -130,6 +130,19 @@
            SERVO::CEquipment* pEquipment = (SERVO::CEquipment*)pItem->pData;
            pEquipment->outputGlass(1);
        }
        else if (nCmd == ID_EQSGRAPHITEM_TEST3) {
            SERVO::CEquipment* pEquipment = (SERVO::CEquipment*)pItem->pData;
            SERVO::CGlass* pGlass = pEquipment->getFrontGlass();
            if (pGlass != nullptr) {
                std::string strDescription;
                SERVO::CPath* pPath = pGlass->getPath();
                while (pPath != nullptr) {
                    pPath->getDescription(strDescription);
                    AfxMessageBox(strDescription.c_str());
                    pPath = pPath->getNext();
                }
            }
        }
        return true;
SourceCode/Bond/Servo/CPath.cpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,125 @@
#include "stdafx.h"
#include "CPath.h"
#include "ToolUnits.h"
namespace SERVO {
    CPath::CPath()
    {
        m_nSiteID = 0;
        m_timeOut = 0;
        m_timeIn = CToolUnits::getTimestamp();
        m_pPrev = nullptr;
        m_pNext = nullptr;
    }
    CPath::CPath(unsigned int nSiteId)
    {
        m_nSiteID = nSiteId;
        m_timeOut = 0;
        m_timeIn = CToolUnits::getTimestamp();
        m_pPrev = nullptr;
        m_pNext = nullptr;
    }
    CPath::~CPath()
    {
    }
    void CPath::getDescription(std::string& strOut)
    {
        strOut.clear();
        strOut = "CPath<SiteID:";
        strOut = strOut + std::to_string(m_nSiteID);
        strOut = strOut + ",InTime:";
        strOut = strOut + CToolUnits::timeToString2(m_timeIn);
        strOut = strOut + ",OutTime:";
        strOut = strOut + (m_timeOut == 0 ? "" : CToolUnits::timeToString2(m_timeOut));
        strOut = strOut + ">";
    }
    void CPath::serialize(CArchive& ar)
    {
        if (ar.IsStoring()) {
            ar << m_nSiteID;
            ar << m_timeIn;
            ar << m_timeOut;
            ar << (ULONGLONG)m_pNext;
            if (m_pNext != nullptr) {
                m_pNext->serialize(ar);
            }
        }
        else {
            ar >> m_nSiteID;
            ar >> m_timeIn;
            ar >> m_timeOut;
            ULONGLONG ulNext;
            ar >> ulNext;
            if ((CPath*)ulNext != nullptr) {
                CPath* pPath = new CPath();
                pPath->serialize(ar);
                pPath->m_pPrev = this;
                this->m_pNext = pPath;
            }
        }
    }
    unsigned int CPath::getSiteID()
    {
        return m_nSiteID;
    }
    ULONGLONG CPath::getInTime()
    {
        return m_timeIn;
    }
    void CPath::setOutTime(ULONGLONG time)
    {
        m_timeOut = time;
    }
    ULONGLONG CPath::getOutTime()
    {
        return m_timeOut;
    }
    CPath* CPath::getPrev()
    {
        return m_pPrev;
    }
    CPath* CPath::getNext()
    {
        return m_pNext;
    }
    void CPath::addPath(CPath* pPath)
    {
        CPath* pTail = getTailPath();
        ASSERT(pTail);
        pTail->m_pNext = pPath;
        pPath->m_pPrev = this;
    }
    CPath* CPath::getTailPath()
    {
        CPath* pPath = this;
        while (pPath->m_pNext != nullptr) {
            pPath = pPath->m_pNext;
        }
        return pPath;
    }
    CPath* CPath::getHeadPath()
    {
        CPath* pPath = this;
        while (pPath->m_pPrev != nullptr) {
            pPath = pPath->m_pPrev;
        }
        return pPath;
    }
}
SourceCode/Bond/Servo/CPath.h
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,33 @@
#pragma once
namespace SERVO {
    class CPath
    {
    public:
        CPath();
        CPath(unsigned int nSiteId);
        ~CPath();
    public:
        void getDescription(std::string& strOut);
        void serialize(CArchive& ar);
        CPath* getPrev();
        CPath* getNext();
        void addPath(CPath* pPath);
        CPath* getTailPath();
        CPath* getHeadPath();
        unsigned int getSiteID();
        ULONGLONG getInTime();
        void setOutTime(ULONGLONG time);
        ULONGLONG getOutTime();
    private:
        unsigned int m_nSiteID;
        ULONGLONG m_timeIn;
        ULONGLONG m_timeOut;
        CPath* m_pPrev;
        CPath* m_pNext;
    };
}
SourceCode/Bond/Servo/Servo.rc
Binary files differ
SourceCode/Bond/Servo/Servo.vcxproj
@@ -226,6 +226,7 @@
    <ClInclude Include="CPanelAttributes.h" />
    <ClInclude Include="CPanelEquipment.h" />
    <ClInclude Include="CPanelMaster.h" />
    <ClInclude Include="CPath.h" />
    <ClInclude Include="CPin.h" />
    <ClInclude Include="CReadStep.h" />
    <ClInclude Include="CSample.h" />
@@ -294,6 +295,7 @@
    <ClCompile Include="CPanelAttributes.cpp" />
    <ClCompile Include="CPanelEquipment.cpp" />
    <ClCompile Include="CPanelMaster.cpp" />
    <ClCompile Include="CPath.cpp" />
    <ClCompile Include="CPin.cpp" />
    <ClCompile Include="CReadStep.cpp" />
    <ClCompile Include="CSample.cpp" />
SourceCode/Bond/Servo/Servo.vcxproj.filters
@@ -74,6 +74,7 @@
    <ClCompile Include="CPageGraph1.cpp" />
    <ClCompile Include="CPageGraph2.cpp" />
    <ClCompile Include="CGlass.cpp" />
    <ClCompile Include="CPath.cpp" />
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="AlarmManager.h" />
@@ -146,6 +147,7 @@
    <ClInclude Include="CPageGraph1.h" />
    <ClInclude Include="CPageGraph2.h" />
    <ClInclude Include="CGlass.h" />
    <ClInclude Include="CPath.h" />
  </ItemGroup>
  <ItemGroup>
    <ResourceCompile Include="Servo.rc" />
SourceCode/Bond/Servo/ServoDlg.cpp
@@ -218,7 +218,7 @@
    SetIcon(m_hIcon, FALSE);        // è®¾ç½®å°å›¾æ ‡
                                    // èœå•
    // èœå•
    CMenu menu;
    menu.LoadMenu(IDR_MENU_APP);
    SetMenu(&menu);
SourceCode/Bond/Servo/resource.h
Binary files differ