6708de638614ace717045551552b745e015c0864..3460128b4722b53bf92551fb00ce276177efc003
2025-07-28 LAPTOP-SNT8I5JK\Boounion
1..再次修改调度逻辑,G2和G1分别进入Bonder的间隔不要太长,防止G2先进入Bonder,等待烘烤中的G1太久,在高温Bonder下出问题;
346012 对比 | 目录
2025-07-25 mrDarker
1. 配置port时下发配方数据
2cb68e 对比 | 目录
2025-07-24 mrDarker
Merge branch 'clh' into liuyang
2c7d54 对比 | 目录
2025-07-24 mrDarker
1. 根据文档更新JobDataS
703403 对比 | 目录
2025-07-24 mrDarker
1. 完善获取配方列表的功能 2. 添加获取配方超时警告
709602 对比 | 目录
2025-07-24 mrDarker
1. EFEM添加获取配方列表事件
98d66d 对比 | 目录
2025-07-24 LAPTOP-SNT8I5JK\Boounion
1.LoadPort状态变为InUse的时候不自动弹出LoadPort配置对话框; 2.修改调度逻辑,G2和G1分别进入Bonder的间隔不要太长,防...
30847e 对比 | 目录
2025-07-23 mrDarker
1. 优化设备配方绑定界面; 2. 获取设备的配方列表,并显示在下拉框中。
fb98a2 对比 | 目录
2025-07-23 mrDarker
1. 修复合并后的资源文件问题
88d2e2 对比 | 目录
2025-07-23 mrDarker
Merge branch 'clh' into liuyang
5a66d2 对比 | 目录
2025-07-23 LAPTOP-SNT8I5JK\Boounion
1.停止任务,不需要停止运行
613f7d 对比 | 目录
2025-07-23 LAPTOP-SNT8I5JK\Boounion
1.Port状态 map图对话框,增加全选和全不选。增加 Process Start和Process Cancel按钮,并下发相关指定到Cassette
0b05e3 对比 | 目录
2025-07-22 LAPTOP-SNT8I5JK\Boounion
1.将原来的设置CassetteType更新到EFEM的功能,修改为本地保存,因为EFEM不需要这些数据; 2.配置是否需要比较map的一致性; 3....
e9c66d 对比 | 目录
2025-07-22 mrDarker
1. 配方主界面列表添加设备的配方ID
b25d01 对比 | 目录
2025-07-22 mrDarker
1. PPID配方绑定界面优化,动态控件获取窗口画笔
c3f30f 对比 | 目录
2025-07-22 mrDarker
1. 本地测试Port配置修改,需要通过EFEM扫描结果设置可勾选项
2246e8 对比 | 目录
2025-07-21 mrDarker
1. 添加新建配方和部分编辑配方绑定的功能
f6b143 对比 | 目录
2025-07-21 LAPTOP-SNT8I5JK\Boounion
1.Cassette Ctrl cmd宏定义到ServoCommo.h中;
654c80 对比 | 目录
2025-07-21 LAPTOP-SNT8I5JK\Boounion
1.回撤任务修改为重发任务;
5e6c63 对比 | 目录
2025-07-21 LAPTOP-SNT8I5JK\Boounion
1.调整信号分隔线
cffbfe 对比 | 目录
2025-07-21 LAPTOP-SNT8I5JK\Boounion
1.信号页面,增加下游信号的显示;
66d8ca 对比 | 目录
已添加2个文件
已修改46个文件
1729 ■■■■■ 文件已修改
.gitignore 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CBonder.cpp 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CBonder.h 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CCustomCheckBox.cpp 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CCustomCheckBox.h 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CEFEM.cpp 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CEquipment.cpp 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CEquipment.h 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CGlass.cpp 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CGlass.h 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CJobDataS.cpp 125 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CJobDataS.h 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CLoadPort.cpp 110 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CLoadPort.h 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CMaster.cpp 208 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CMaster.h 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CPageGraph2.cpp 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CPageLinkSignal.cpp 92 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CPageLinkSignal.h 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CPagePortProperty.cpp 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CPortStatusReport.cpp 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CPortStatusReport.h 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CRecipeList.cpp 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CRecipeList.h 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CRecipesManager.cpp 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CRecipesManager.h 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CRobotTask.cpp 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CRobotTask.h 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CRobotTaskDlg.cpp 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/Common.h 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/Configuration.cpp 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/Configuration.h 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/Model.cpp 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/Model.h 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/PageRecipe.cpp 319 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/PageRecipe.h 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/PortConfigurationDlg.cpp 220 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/PortConfigurationDlg.h 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/RecipeDeviceBindDlg.cpp 255 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/RecipeDeviceBindDlg.h 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/RecipeManager.cpp 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/RecipeManager.h 3 ●●●● 补丁 | 查看 | 原始文档 | 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/ServoCommo.h 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/ServoDlg.cpp 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/resource.h 补丁 | 查看 | 原始文档 | blame | 历史
.gitignore
@@ -55,3 +55,6 @@
SourceCode/Bond/x64/Debug/Master.dat
SourceCode/Bond/x64/Debug/Config/signals.csv
SourceCode/Bond/x64/Debug/Config/robot_offset.ini
*.tlog
*.pch
SourceCode/Bond/EAPSimulator/x64/Debug/
SourceCode/Bond/Servo/CBonder.cpp
@@ -464,6 +464,12 @@
        return pBuddy != nullptr;
    }
    BOOL CBonder::hasG2Class()
    {
        CGlass* pGlass = (CGlass*)m_slot[0].getContext();
        return (pGlass != nullptr);
    }
    int CBonder::onProcessData(CProcessData* pProcessData)
    {
        CEquipment::onProcessData(pProcessData);
SourceCode/Bond/Servo/CBonder.h
@@ -29,6 +29,7 @@
        void setIndex(unsigned int index);
        unsigned int getIndex();
        BOOL hasBondClass();
        BOOL hasG2Class();
    private:
        unsigned int m_nIndex;
SourceCode/Bond/Servo/CCustomCheckBox.cpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,56 @@
#include "stdafx.h"
#include "CCustomCheckBox.h"
CCustomCheckBox::CCustomCheckBox()
    : m_bgColor(RGB(255, 255, 255)), m_textColor(RGB(0, 0, 0))
{
    m_brush.CreateSolidBrush(m_bgColor);
}
CCustomCheckBox::~CCustomCheckBox()
{
}
void CCustomCheckBox::SetBackgroundColor(COLORREF color)
{
    m_bgColor = color;
    if (m_brush.GetSafeHandle())
        m_brush.DeleteObject();
    m_brush.CreateSolidBrush(m_bgColor);
    Invalidate();
}
void CCustomCheckBox::SetTextColor(COLORREF color)
{
    m_textColor = color;
    Invalidate();
}
void CCustomCheckBox::SetNotifyHwnd(HWND hWnd)
{
    m_hNotifyWnd = hWnd;
}
void CCustomCheckBox::OnClicked()
{
    BOOL bChecked = (GetCheck() == BST_CHECKED);
    // ä½ å¯ä»¥å®šä¹‰è‡ªå·±çš„自定义消息
    if (m_hNotifyWnd && ::IsWindow(m_hNotifyWnd)) {
        ::PostMessage(m_hNotifyWnd, WM_CHECKBOX_STATE_CHANGED, GetDlgCtrlID(), bChecked);
    }
}
BEGIN_MESSAGE_MAP(CCustomCheckBox, CButton)
    ON_WM_CTLCOLOR_REFLECT()
    ON_CONTROL_REFLECT(BN_CLICKED, &CCustomCheckBox::OnClicked)
END_MESSAGE_MAP()
HBRUSH CCustomCheckBox::CtlColor(CDC* pDC, UINT /*nCtlColor*/)
{
    pDC->SetBkMode(TRANSPARENT);
    pDC->SetTextColor(m_textColor);
    return (HBRUSH)m_brush.GetSafeHandle();
}
SourceCode/Bond/Servo/CCustomCheckBox.h
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,28 @@
#pragma once
#define WM_CHECKBOX_STATE_CHANGED       WM_USER + 1003
class CCustomCheckBox : public CButton
{
public:
    CCustomCheckBox();
    virtual ~CCustomCheckBox();
public:
    void SetBackgroundColor(COLORREF color);
    void SetTextColor(COLORREF color);
    void SetNotifyHwnd(HWND hWnd);  // è®¾ç½®æ¶ˆæ¯æŽ¥æ”¶çª—口
protected:
    afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
    afx_msg void OnClicked();
    DECLARE_MESSAGE_MAP()
private:
    COLORREF m_bgColor;
    COLORREF m_textColor;
    CBrush   m_brush;
    HWND     m_hNotifyWnd;
};
SourceCode/Bond/Servo/CEFEM.cpp
@@ -545,6 +545,28 @@
            }
        }
        {
            // master recipe list report
            CEqReadStep* pStep = new CEqReadStep(0x6955, 255 * 2,
                [&](void* pFrom, int code, const char* pszData, size_t size) -> int {
                    /*CEqReadStep* pTmpStep = dynamic_cast<CEqReadStep*>((CEqReadStep*)pFrom);*/
                    CEqReadStep* pTmpStep = (CEqReadStep*)pFrom;
                    short ret = MRLRC_OK;
                    if (code == ROK && pszData != nullptr && size > 0) {
                        // æ­¤å¤„解释配方数据
                        ret = decodeRecipeListReport(pszData, size);
                    }
                    pTmpStep->setReturnCode(ret);
                    return -1;
                });
            pStep->setName(STEP_EQ_MASTER_RECIPE_LIST);
            pStep->setWriteSignalDev(0x4b);
            pStep->setReturnDev(0x91d);
            if (addStep(STEP_ID_MASTER_RECIPE_LIST_REPORT, pStep) != 0) {
                delete pStep;
            }
        }
        // ä½¿ç”¨CEqReadStep替换CEqJobEventStep
        {
            // Received Job Report Upstream #1~9
SourceCode/Bond/Servo/CEquipment.cpp
@@ -1318,6 +1318,7 @@
            CGlass* pGlass = (CGlass*)m_slot[i].getContext();
            if (!isSlotProcessed(i)) continue;
            if (pGlass == nullptr) continue;
            if (!pGlass->isScheduledForProcessing()) continue;
            if(pGlass->getInspResult(m_nID, 0) == InspResult::Fail) continue;
            int lsPath = m_slot[i].getLinkSignalPath();
            if(!m_bLinkSignalToUpstream[lsPath][SIGNAL_UPSTREAM_INLINE]
@@ -1370,6 +1371,7 @@
            if (m_slot[i].isLock()) continue;
            CGlass* pGlass = (CGlass*)m_slot[i].getContext();
            if (pGlass == nullptr) continue;
            if (!pGlass->isScheduledForProcessing()) continue;
            if (pGlass->getInspResult(m_nID, 0) != InspResult::Fail) continue;
            int lsPath = m_slot[i].getLinkSignalPath();
            if (!m_bLinkSignalToUpstream[lsPath][SIGNAL_UPSTREAM_INLINE]
SourceCode/Bond/Servo/CEquipment.h
@@ -55,6 +55,7 @@
    typedef std::function<BOOL(void* pEiuipment, int port, CJobDataB* pJobDataB, short& putSlot)> ONPRESTOREDJOB;
    typedef std::function<void(void* pEiuipment, PROCESS_STATE state)> ONPROCESSSTATE;
    typedef std::function<void(void* pEiuipment, short scanMap, short downMap)> ONMAPMISMATCH;
    typedef std::function<void(void* pEiuipment, short scanMap)> ONPORTINUSE;
    typedef struct _EquipmentListener
    {
        ONALIVE                onAlive;
@@ -66,6 +67,8 @@
        ONPRESTOREDJOB        onPreStoredJob;
        ONPROCESSSTATE        onProcessStateChanged;
        ONMAPMISMATCH        onMapMismatch;
        ONPORTINUSE            onPortInUse;
    } EquipmentListener;
SourceCode/Bond/Servo/CGlass.cpp
@@ -10,6 +10,7 @@
        m_pBuddy = nullptr;
        m_nOriginPort = 0;
        m_nOriginSlot = 0;
        m_bScheduledForProcessing = FALSE;
    }
    CGlass::~CGlass()
@@ -80,6 +81,16 @@
        slot = m_nOriginSlot;
    }
    BOOL CGlass::isScheduledForProcessing()
    {
        return m_bScheduledForProcessing;
    }
    void CGlass::setScheduledForProcessing(BOOL bProcessing)
    {
        m_bScheduledForProcessing = bProcessing;
    }
    CPath* CGlass::getPath()
    {
        return m_pPath;
@@ -119,6 +130,7 @@
            WriteString(ar, m_strID);
            ar << m_nOriginPort;
            ar << m_nOriginSlot;
            ar << m_bScheduledForProcessing;
            ar << (ULONGLONG)m_pPath;
            if (m_pPath != nullptr) {
                m_pPath->serialize(ar);
@@ -141,6 +153,7 @@
            ReadString(ar, m_strID);
            ar >> m_nOriginPort;
            ar >> m_nOriginSlot;
            ar >> m_bScheduledForProcessing;
            ar >> ullPath;
            if (ullPath != 0) {
                m_pPath = new CPath();
SourceCode/Bond/Servo/CGlass.h
@@ -26,6 +26,8 @@
        std::string& getID();
        void setOriginPort(int port, int slot);
        void getOrginPort(int& port, int& slot);
        BOOL isScheduledForProcessing();
        void setScheduledForProcessing(BOOL bProcessing);
        CPath* getPathWithEq(unsigned int nEqId, unsigned int nUnit);
        CPath* getPath();
        void addPath(unsigned int nEqId, unsigned int nUnit);
@@ -51,6 +53,7 @@
        std::string m_strBuddyId;
        int m_nOriginPort;
        int m_nOriginSlot;
        BOOL m_bScheduledForProcessing;            /* æ˜¯å¦å°†åŠ å·¥å¤„ç† */
    };
}
SourceCode/Bond/Servo/CJobDataS.cpp
@@ -20,15 +20,17 @@
        m_nProcessResonCode = 0;
        m_nLastGlassFlag = 0;
        m_nFirstGlassFlag = 0;
        m_nQTime[3] = {0};
        m_nQTime[3] = { 0 };
        m_nQTimeOverFlag = 0;
        m_nMasterRecipe = 0;
        m_nRecipeIds[DEVICE_COUNT] = { 0 };
        m_nMode = 0;
        m_nSlotUnitSelectFlag = 0;
        m_nSourcePortNo = 0;
        m_nSourceSlotNo = 0;
        m_nTargetPortNo = 0;
        m_nTargetSlotNo = 0;
        m_nProductJudge = 0;
        m_pRawData = nullptr;
        m_pOwner = nullptr;
        if (ENABLE_JOBDATAS_RAWDATA) {
@@ -75,9 +77,7 @@
        m_nQTime[2] = pScr->m_nQTime[2];
        m_nQTimeOverFlag = pScr->m_nQTimeOverFlag;
        m_nMasterRecipe = pScr->m_nMasterRecipe;
        m_strProductRecipeId = pScr->m_strProductRecipeId;
        m_strPCode = pScr->m_strPCode;
        m_strUseType = pScr->m_strUseType;
        memcpy(m_nRecipeIds, pScr->m_nRecipeIds, sizeof(m_nRecipeIds));
        m_strPanelMeasure = pScr->m_strPanelMeasure;
        m_nMode = pScr->m_nMode;
        m_nSlotUnitSelectFlag = pScr->m_nSlotUnitSelectFlag;
@@ -85,6 +85,7 @@
        m_nSourceSlotNo = pScr->m_nSourceSlotNo;
        m_nTargetPortNo = pScr->m_nTargetPortNo;
        m_nTargetSlotNo = pScr->m_nTargetSlotNo;
        m_nProductJudge = pScr->m_nProductJudge;
        m_pOwner = pScr->m_pOwner;
    }
@@ -111,9 +112,7 @@
        m_nQTime[2] = pScr->m_nQTime[2];
        m_nQTimeOverFlag = pScr->m_nQTimeOverFlag;
        m_nMasterRecipe = pScr->m_nMasterRecipe;
        m_strProductRecipeId = pScr->m_strProductRecipeId;
        m_strPCode = pScr->m_strPCode;
        m_strUseType = pScr->m_strUseType;
        memcpy(m_nRecipeIds, pScr->m_nRecipeIds, sizeof(m_nRecipeIds));
        m_strPanelMeasure = pScr->m_strPanelMeasure;
        m_nMode = pScr->m_nMode;
        m_nSlotUnitSelectFlag = pScr->m_nSlotUnitSelectFlag;
@@ -121,6 +120,7 @@
        m_nSourceSlotNo = pScr->m_nSourceSlotNo;
        m_nTargetPortNo = pScr->m_nTargetPortNo;
        m_nTargetSlotNo = pScr->m_nTargetSlotNo;
        m_nProductJudge = pScr->m_nProductJudge;
        m_pOwner = pScr->m_pOwner;
    }
@@ -339,34 +339,40 @@
        m_nMasterRecipe = recipe;
    }
    std::string& CJobDataS::getProductRecipeId()
    short CJobDataS::getDeviceRecipeId(int nDeviceIndex) const
    {
        return m_strProductRecipeId;
        if (nDeviceIndex < 0 || nDeviceIndex >= DEVICE_COUNT) {
            return 0;
        }
        return m_nRecipeIds[nDeviceIndex];
    }
    void CJobDataS::setProductRecipeId(const char* pszId)
    void CJobDataS::setDeviceRecipeId(int nDeviceIndex, short nRecipeId)
    {
        m_strProductRecipeId = pszId;
        if (nDeviceIndex < 0 || nDeviceIndex >= DEVICE_COUNT) {
            return;
        }
        m_nRecipeIds[nDeviceIndex] = nRecipeId;
    }
    std::string& CJobDataS::getPCode()
    {
        return m_strPCode;
    const short* CJobDataS::getRecipeIds() const
    {
        return m_nRecipeIds;
    }
    void CJobDataS::setPCode(const char* pszCode)
    void CJobDataS::setRecipeIds(const short* pIds, int nCount)
    {
        m_strPCode = pszCode;
    }
        int nCopyCount = nCount > DEVICE_COUNT ? DEVICE_COUNT : nCount;
        for (int i = 0; i < nCopyCount; ++i) {
            m_nRecipeIds[i] = pIds[i];
        }
    std::string& CJobDataS::getUseType()
    {
        return m_strPCode;
    }
    void CJobDataS::setUseType(const char* pszType)
    {
        m_strPCode = pszType;
        // å¦‚æžœ nCount < DEVICE_COUNT,可以选择补零
        for (int i = nCopyCount; i < DEVICE_COUNT; ++i) {
            m_nRecipeIds[i] = 0;
        }
    }
    std::string& CJobDataS::getPanelMeasure()
@@ -437,6 +443,16 @@
    void CJobDataS::setTargetSlotNo(int no)
    {
        m_nTargetSlotNo = no;
    }
    short CJobDataS::getProductJudge() const
    {
        return m_nProductJudge;
    }
    void CJobDataS::setProductJudge(short nProductJudge)
    {
        m_nProductJudge = nProductJudge;
    }
    int CJobDataS::serialize(char* pszBuffer, int nBufferSize)
@@ -515,17 +531,10 @@
        memcpy(&pszBuffer[index], &m_nMasterRecipe, sizeof(short));
        index += sizeof(short);
        strLen = min(10, (int)m_strProductRecipeId.size());
        memcpy(&pszBuffer[index], m_strProductRecipeId.c_str(), strLen);
        index += 10;
        strLen = min(10, (int)m_strPCode.size());
        memcpy(&pszBuffer[index], m_strPCode.c_str(), strLen);
        index += 10;
        strLen = min(10, (int)m_strUseType.size());
        memcpy(&pszBuffer[index], m_strUseType.c_str(), strLen);
        index += 10;
        for (int i = 0; i < DEVICE_COUNT; i++) {
            memcpy(&pszBuffer[index], &m_nRecipeIds[i], sizeof(short));
            index += sizeof(short);
        }
        strLen = min(80, (int)m_strPanelMeasure.size());
        memcpy(&pszBuffer[index], m_strPanelMeasure.c_str(), strLen);
@@ -547,6 +556,9 @@
        index += sizeof(short);
        memcpy(&pszBuffer[index], &m_nTargetSlotNo, sizeof(short));
        index += sizeof(short);
        memcpy(&pszBuffer[index], &m_nProductJudge, sizeof(short));
        index += sizeof(short);
        return 256 * 2;
@@ -620,16 +632,12 @@
        memcpy(&m_nMasterRecipe, &pszBuffer[index], sizeof(short));
        index += sizeof(short);
        CToolUnits::convertString(&pszBuffer[index], 10, m_strProductRecipeId);
        index += 10;
        for (int i = 0; i < DEVICE_COUNT; i++) {
            memcpy(&m_nRecipeIds[i], &pszBuffer[index], sizeof(short));
            index += sizeof(short);
        }
        CToolUnits::convertString(&pszBuffer[index], 10, m_strProductRecipeId);
        index += 10;
        CToolUnits::convertString(&pszBuffer[index], 10, m_strProductRecipeId);
        index += 10;
        CToolUnits::convertString(&pszBuffer[index], 80, m_strProductRecipeId);
        CToolUnits::convertString(&pszBuffer[index], 80, m_strPanelMeasure);
        index += 80;
        memcpy(&m_nMode, &pszBuffer[index], sizeof(short));
@@ -650,12 +658,13 @@
        memcpy(&m_nTargetSlotNo, &pszBuffer[index], sizeof(short));
        index += sizeof(short);
        memcpy(&m_nProductJudge, &pszBuffer[index], sizeof(short));
        index += sizeof(short);
        // ç¼“存原始数据
        if (m_pRawData != nullptr) {
            memcpy(m_pRawData, pszBuffer, JOBDATAS_SIZE);
        }
        return JOBDATAS_SIZE;
    }
@@ -728,14 +737,23 @@
        attrubutes.addAttribute(new CAttribute("MasterRecipe",
            std::to_string(getMasterRecipe()).c_str(), "", weight++));
        attrubutes.addAttribute(new CAttribute("ProductRecipeId",
            getProductRecipeId().c_str(), "", weight++));
        attrubutes.addAttribute(new CAttribute("Recipe ID(EFEM)",
            std::to_string(getDeviceRecipeId(0)).c_str(), "", weight++));
        attrubutes.addAttribute(new CAttribute("PCode",
            getPCode().c_str(), "", weight++));
        attrubutes.addAttribute(new CAttribute("Recipe ID(BONDER1)",
            std::to_string(getDeviceRecipeId(1)).c_str(), "", weight++));
        attrubutes.addAttribute(new CAttribute("UseType",
            getUseType().c_str(), "", weight++));
        attrubutes.addAttribute(new CAttribute("Recipe ID(BONDER2)",
            std::to_string(getDeviceRecipeId(2)).c_str(), "", weight++));
        attrubutes.addAttribute(new CAttribute("Recipe ID(Bake Cooling)",
            std::to_string(getDeviceRecipeId(3)).c_str(), "", weight++));
        attrubutes.addAttribute(new CAttribute("Recipe ID(Vacuum Bake)",
            std::to_string(getDeviceRecipeId(4)).c_str(), "", weight++));
        attrubutes.addAttribute(new CAttribute("Recipe ID(Measurement)",
            std::to_string(getDeviceRecipeId(5)).c_str(), "", weight++));
        attrubutes.addAttribute(new CAttribute("PanelMeasure",
            getPanelMeasure().c_str(), "", weight++));
@@ -754,5 +772,8 @@
        attrubutes.addAttribute(new CAttribute("TargetSlotNo",
            std::to_string(getTargetSlotNo()).c_str(), "", weight++));
        attrubutes.addAttribute(new CAttribute("ProductJudge",
            std::to_string(getProductJudge()).c_str(), "", weight++));
    }
}
SourceCode/Bond/Servo/CJobDataS.h
@@ -2,7 +2,7 @@
#include "CAttributeVector.h"
#include "CJobDataB.h"
#define DEVICE_COUNT        15
#define JOBDATAS_SIZE        (256 * 2)
namespace SERVO {
    class CJobDataS
@@ -56,12 +56,10 @@
        void setQTimeOverFlag(int flag);
        int getMasterRecipe();
        void setMasterRecipe(int recipe);
        std::string& getProductRecipeId();
        void setProductRecipeId(const char* pszId);
        std::string& getPCode();
        void setPCode(const char* pszCode);
        std::string& getUseType();
        void setUseType(const char* pszType);
        short getDeviceRecipeId(int nDeviceIndex) const;
        void setDeviceRecipeId(int nDeviceIndex, short nRecipeId);
        const short* getRecipeIds() const;
        void setRecipeIds(const short* pIds, int nCount);
        std::string& getPanelMeasure();
        void setPanelMeasure(const char* pszMeasure);
        int getMode();
@@ -76,6 +74,8 @@
        void setTargetPortNo(int no);
        int getTargetSlotNo();
        void setTargetSlotNo(int no);
        short getProductJudge() const;
        void setProductJudge(short nProductJudge);
        int serialize(char* pszBuffer, int nBufferSize);
        int unserialize(const char* pszBuffer, int nBufferSize);
        void getAttributeVector(CAttributeVector& attrubutes, int beginWeight);
@@ -102,9 +102,7 @@
        int m_nQTime[3];
        int m_nQTimeOverFlag;
        int m_nMasterRecipe;
        std::string m_strProductRecipeId;
        std::string m_strPCode;
        std::string m_strUseType;
        short m_nRecipeIds[DEVICE_COUNT];
        std::string m_strPanelMeasure;
        int m_nMode;
        int m_nSlotUnitSelectFlag;
@@ -112,6 +110,7 @@
        int m_nSourceSlotNo;
        int m_nTargetPortNo;
        int m_nTargetSlotNo;
        short m_nProductJudge;
    private:
        char* m_pRawData;
SourceCode/Bond/Servo/CLoadPort.cpp
@@ -16,6 +16,7 @@
        m_bEnable = FALSE;
        m_bAutoChangeEnable = FALSE;
        m_nNextCassetteSequenceNo = 0;
        m_isCompareMapsBeforeProceeding = FALSE;
    }
    CLoadPort::~CLoadPort()
@@ -134,7 +135,7 @@
            CEqReadStep* pStep = new CEqReadStep(dev[m_nIndex], sizeof(short),
                [&](void* pFrom, int code, const char* pszData, size_t size) -> int {
                    if (code == ROK && pszData != nullptr && size > 0) {
                        m_cassetteType = (CassetteType)CToolUnits::toInt16(pszData);
                        //m_cassetteType = (CassetteType)CToolUnits::toInt16(pszData);
                    }
                    return 0;
                });
@@ -347,6 +348,23 @@
    void CLoadPort::onTimer(UINT nTimerid)
    {
        CEquipment::onTimer(nTimerid);
        // æ¨¡æ‹Ÿæµ‹è¯•
        /*
        if (m_nIndex == 0) {
            static int ii = 0;
            ii++;
            if (ii == 20) {
                char szBuffer[64];
                CStep* pStep = getStepWithName(STEP_EQ_PORT1_INUSE);
                CPortStatusReport portStatusReport;
                portStatusReport.setPortStatus(PORT_INUSE);
                portStatusReport.setJobExistenceSlot(0xf);
                int nRet = portStatusReport.serialize(szBuffer, 64);
                decodePortStatusReport(pStep, szBuffer, 64);
            }
        }
        */
    }
    void CLoadPort::serialize(CArchive& ar)
@@ -887,17 +905,27 @@
        // å½“port状态为InUse, æ¯”较map
        if (m_portStatusReport.getPortStatus() == PORT_INUSE) {
            short scanMap = m_portStatusReport.getJobExistenceSlot();
            short downMap = getCassetteMap();
            if (scanMap == downMap) {
                this->sendCassetteCtrlCmd(5, nullptr, 0, 0, 0, nullptr, nullptr);
            if (m_isCompareMapsBeforeProceeding) {
                short scanMap = getScanCassetteMap();
                short downloadMap = getDownloadCassetteMap();
                if (scanMap == downloadMap) {
                    generateGlassList(scanMap);
                    this->sendCassetteCtrlCmd(CCC_PROCESS_START, nullptr, 0, 0, 0, nullptr, nullptr);
                }
                else {
                    this->sendCassetteCtrlCmd(CCC_PROCESS_CANCEL, nullptr, 0, 0, 0, nullptr, nullptr);
                    // æŠ›å‡ºåˆ°åº”用层做提示
                    if (m_listener.onMapMismatch != nullptr) {
                        m_listener.onMapMismatch(this, scanMap, downloadMap);
                    }
                }
            }
            else {
                this->sendCassetteCtrlCmd(10, nullptr, 0, 0, 0, nullptr, nullptr);
                // æŠ›å‡ºåˆ°åº”用层做提示
                if (m_listener.onMapMismatch != nullptr) {
                    m_listener.onMapMismatch(this, scanMap, downMap);
                // æŠ›å‡ºåˆ°åº”用层做选择要加工的片子
                generateGlassList(getScanCassetteMap());
                if (m_listener.onPortInUse != nullptr) {
                    m_listener.onPortInUse(this, getScanCassetteMap());
                }
            }
        }
@@ -1011,6 +1039,7 @@
    int CLoadPort::setCassetteType(CassetteType type, ONWRITED onWritedBlock/* = nullptr*/)
    {
        m_cassetteType = type;
        static char* pszName[] = { STEP_PORT1_CASSETTE_TYPE_CHANGE, STEP_PORT2_CASSETTE_TYPE_CHANGE, STEP_PORT3_CASSETTE_TYPE_CHANGE, STEP_PORT4_CASSETTE_TYPE_CHANGE };
        SERVO::CEqWriteStep* pStep = (SERVO::CEqWriteStep*)getStepWithName(pszName[m_nIndex]);
        if (pStep == nullptr) {
@@ -1023,7 +1052,6 @@
            // test
            code = WOK;
            if (code == WOK) {
                m_cassetteType = type;
                LOGI("<CLoadPort-%d>设置Cassette Type成功.", m_nIndex);
            }
            else {
@@ -1126,15 +1154,15 @@
        m_bAutoChangeEnable = bEnable;
    }
    short CLoadPort::getCassetteMap()
    short CLoadPort::getScanCassetteMap()
    {
        short map = 0;
        for (int i = 0; i < SLOT_MAX; i++) {
            if (!m_slot[i].isEnable()) continue;
            if (m_slot[i].getContext() == nullptr) continue;
            map |= (1 << i);
        }
        return m_portStatusReport.getJobExistenceSlot();
    }
    short CLoadPort::getDownloadCassetteMap()
    {
        // æš‚时未实现此功能
        short map = 0;
        return map;
    }
@@ -1176,6 +1204,47 @@
        return 0;
    }
    /*
     * æ ¹æ®efem扫描到的map,生成玻璃列表
     */
    int CLoadPort::generateGlassList(short map)
    {
        // å…ˆé‡Šæ”¾è¾ƒæ—©å‰çš„æ•°æ®
        Lock();
        for (int i = 0; i < SLOT_MAX; i++) {
            m_slot[i].setContext(nullptr);
        }
        Unlock();
        // æ ¹æ®map生成新的
        char szBuffer[64];
        for (int i = 0; i < SLOT_MAX; i++) {
            if (!m_slot[i].isEnable()) continue;
            if (!(map >> i) & 1) continue;
            CJobDataS js;
            js.setCassetteSequenceNo(getNextCassetteSequenceNo());
            js.setJobSequenceNo(m_slot[i].getNo());
            sprintf_s(szBuffer, 64, "%05d%05d", js.getCassetteSequenceNo(), js.getJobSequenceNo());
            js.setJobType(1);
            js.setMaterialsType((int)m_cassetteType);
            CGlass* pGlass = theApp.m_model.m_glassPool.allocaGlass();
            pGlass->setOriginPort(m_nIndex, i);
            pGlass->setScheduledForProcessing(i % 2 == 1);
            pGlass->addPath(m_nID, 0);
            pGlass->processEnd(m_nID, 0);
            pGlass->setID(szBuffer);
            pGlass->setType(m_cassetteType);
            pGlass->setJobDataS(&js);
            m_slot[i].setContext(pGlass);
        }
        return 0;
    }
    int CLoadPort::testGenerateGlassListFromConfig(const SERVO::PortConfig& config)
    {
        char szBuffer[64];
@@ -1215,4 +1284,9 @@
        return 0;
    }
    void CLoadPort::setCompareMapsBeforeProceeding(BOOL bCompare)
    {
        m_isCompareMapsBeforeProceeding = bCompare;
    }
}
SourceCode/Bond/Servo/CLoadPort.h
@@ -37,7 +37,8 @@
        void localSetCessetteType(CassetteType type);
        void localSetTransferMode(TransferMode mode);
        void localAutoChangeEnable(BOOL bEnable);
        short getCassetteMap();
        short getScanCassetteMap();
        short getDownloadCassetteMap();
    public:
        short getNextCassetteSequenceNo();
@@ -57,6 +58,7 @@
        int getCassetteMappingState();
        int getCassetteStatus();
        int testGenerateGlassList(MaterialsType type);
        int generateGlassList(short map);
        int testGenerateGlassListFromConfig(const SERVO::PortConfig& config);
    public:
@@ -80,6 +82,7 @@
            CJobDataA* pJobDataA,
            ONWRITED onWritedBlock);
        CStep* getCassetteCtrlCmdStep();
        void setCompareMapsBeforeProceeding(BOOL bCompare);
    private:
        int decodePortStatusReport(CStep* pStep, const char* pszData, size_t size);
@@ -94,6 +97,9 @@
        BOOL m_bAutoChangeEnable;
        CPortStatusReport m_portStatusReport;
        int m_nNextCassetteSequenceNo;
        // åœ¨å¼€å§‹å·¥è‰ºå‰æ˜¯å¦å…ˆéœ€è¦å…ˆæ¯”较map
        BOOL m_isCompareMapsBeforeProceeding;
    };
}
SourceCode/Bond/Servo/CMaster.cpp
@@ -51,6 +51,7 @@
        m_state = MASTERSTATE::READY;
        m_pActiveRobotTask = nullptr;
        m_nLastError = 0;
        m_isCompareMapsBeforeProceeding = FALSE;
        InitializeCriticalSection(&m_criticalSection);
    }
@@ -562,157 +563,65 @@
                }
            PORT_PUT:
                if (m_pActiveRobotTask != nullptr) {
                    m_pActiveRobotTask->pick();
                    std::string strDescription = m_pActiveRobotTask->getDescription();
                    unlock();
                    if (m_listener.onRobotTaskEvent != nullptr) {
                        m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
                    }
                    LOGI("创建新任务<%s>...", strDescription.c_str());
                    continue;
                }
                CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask);
                // Measurement NG -> LoadPort
                // NG回原位
                if (!rmd.armState[1]) {
                    m_pActiveRobotTask = createTransferTask_restore(pMeasurement, pLoadPorts);
                    if (m_pActiveRobotTask != nullptr) {
                        m_pActiveRobotTask->pick();
                        std::string strDescription = m_pActiveRobotTask->getDescription();
                        unlock();
                        if (m_listener.onRobotTaskEvent != nullptr) {
                            m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
                        }
                        LOGI("创建Measurement回退任务<%s>...", strDescription.c_str());
                        continue;
                    }
                    CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask);
                }
                // BakeCooling ->Measurement
                if (!rmd.armState[0]) {
                    m_pActiveRobotTask = createTransferTask_bakecooling_to_measurement(pBakeCooling, pMeasurement);
                    if (m_pActiveRobotTask != nullptr) {
                        m_pActiveRobotTask->pick();
                        std::string strDescription = m_pActiveRobotTask->getDescription();
                        unlock();
                        if (m_listener.onRobotTaskEvent != nullptr) {
                            m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
                        }
                        LOGI("创建新任务<%s>...", strDescription.c_str());
                        continue;
                    }
                    CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask);
                }
                
                // BakeCooling内部
                // Bake -> Cooling
                if (!rmd.armState[0]) {
                    m_pActiveRobotTask = createTransferTask_bake_to_cooling(pBakeCooling);
                    if (m_pActiveRobotTask != nullptr) {
                        m_pActiveRobotTask->pick();
                        std::string strDescription = m_pActiveRobotTask->getDescription();
                        unlock();
                        if (m_listener.onRobotTaskEvent != nullptr) {
                            m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
                        }
                        LOGI("创建新任务<%s>...", strDescription.c_str());
                        continue;
                    }
                    CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask);
                }
                // Bonder -> BakeCooling
                if (!rmd.armState[0]) {
                    m_pActiveRobotTask = createTransferTask_bonder_to_bakecooling(pBonder1, pBakeCooling);
                    if (m_pActiveRobotTask != nullptr) {
                        m_pActiveRobotTask->pick();
                        std::string strDescription = m_pActiveRobotTask->getDescription();
                        unlock();
                        if (m_listener.onRobotTaskEvent != nullptr) {
                            m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
                        }
                        LOGI("创建新任务<%s>...", strDescription.c_str());
                        continue;
                    }
                    CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask);
                }
                if (!rmd.armState[0]) {
                    m_pActiveRobotTask = createTransferTask_bonder_to_bakecooling(pBonder2, pBakeCooling);
                    if (m_pActiveRobotTask != nullptr) {
                        m_pActiveRobotTask->pick();
                        std::string strDescription = m_pActiveRobotTask->getDescription();
                        unlock();
                        if (m_listener.onRobotTaskEvent != nullptr) {
                            m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
                        }
                        LOGI("创建新任务<%s>...", strDescription.c_str());
                        continue;
                    }
                    CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask);
                }
                // Fliper(G2) -> Bonder
                // VacuumBake(G1) -> Bonder
                if (!rmd.armState[1] && !pBonder1->hasBondClass()) {
                auto pSrcSlot = pVacuumBake->getProcessedSlot(primaryType);
                if (pSrcSlot != nullptr && !rmd.armState[1] && !pBonder1->hasBondClass()) {
                    m_pActiveRobotTask = createTransferTask(pFliper, pBonder1, primaryType, secondaryType, 2);
                    if (m_pActiveRobotTask != nullptr) {
                        m_pActiveRobotTask->pick();
                        std::string strDescription = m_pActiveRobotTask->getDescription();
                        unlock();
                        if (m_listener.onRobotTaskEvent != nullptr) {
                            m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
                        }
                        LOGI("创建新任务<%s>...", strDescription.c_str());
                        continue;
                    }
                    CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask);
                }
                if (!rmd.armState[1] && !pBonder2->hasBondClass()) {
                if (pSrcSlot != nullptr && !rmd.armState[1] && !pBonder2->hasBondClass()) {
                    m_pActiveRobotTask = createTransferTask(pFliper, pBonder2, primaryType, secondaryType, 2);
                    if (m_pActiveRobotTask != nullptr) {
                        m_pActiveRobotTask->pick();
                        std::string strDescription = m_pActiveRobotTask->getDescription();
                        unlock();
                        if (m_listener.onRobotTaskEvent != nullptr) {
                            m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
                        }
                        LOGI("创建新任务<%s>...", strDescription.c_str());
                        continue;
                    }
                    CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask);
                }
                // VacuumBake(G1) -> Bonder
                if (!rmd.armState[0] && !pBonder1->hasBondClass()) {
                    m_pActiveRobotTask = createTransferTask(pVacuumBake, pBonder1, primaryType, secondaryType);
                    if (m_pActiveRobotTask != nullptr) {
                        m_pActiveRobotTask->pick();
                        std::string strDescription = m_pActiveRobotTask->getDescription();
                        unlock();
                        if (m_listener.onRobotTaskEvent != nullptr) {
                            m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
                        }
                        LOGI("创建新任务<%s>...", strDescription.c_str());
                        continue;
                    }
                    CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask);
                }
                if (!rmd.armState[0] && !pBonder2->hasBondClass()) {
                    m_pActiveRobotTask = createTransferTask(pVacuumBake, pBonder2, primaryType, secondaryType);
                    if (m_pActiveRobotTask != nullptr) {
                        m_pActiveRobotTask->pick();
                        std::string strDescription = m_pActiveRobotTask->getDescription();
                        unlock();
                        if (m_listener.onRobotTaskEvent != nullptr) {
                            m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
                        }
                        LOGI("创建新任务<%s>...", strDescription.c_str());
                        continue;
                    }
                    CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask);
                }
@@ -720,48 +629,20 @@
                // Aligner -> VacuumBake(G1)
                if (!rmd.armState[1]) {
                    m_pActiveRobotTask = createTransferTask(pAligner, pFliper, primaryType, secondaryType);
                    if (m_pActiveRobotTask != nullptr) {
                        m_pActiveRobotTask->pick();
                        std::string strDescription = m_pActiveRobotTask->getDescription();
                        unlock();
                        if (m_listener.onRobotTaskEvent != nullptr) {
                            m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
                        }
                        LOGI("创建新任务<%s>...", strDescription.c_str());
                        continue;
                    }
                    CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask);
                }
                if (!rmd.armState[0]) {
                    m_pActiveRobotTask = createTransferTask(pAligner, pVacuumBake, primaryType, secondaryType);
                    if (m_pActiveRobotTask != nullptr) {
                        m_pActiveRobotTask->pick();
                        std::string strDescription = m_pActiveRobotTask->getDescription();
                        unlock();
                        if (m_listener.onRobotTaskEvent != nullptr) {
                            m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
                        }
                        LOGI("创建新任务<%s>...", strDescription.c_str());
                        continue;
                    }
                    CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask);
                }
                // Aligner -> LoadPort
                if (!rmd.armState[1]) {
                    m_pActiveRobotTask = createTransferTask_restore(pAligner, pLoadPorts);
                    if (m_pActiveRobotTask != nullptr) {
                        m_pActiveRobotTask->pick();
                        std::string strDescription = m_pActiveRobotTask->getDescription();
                        unlock();
                        if (m_listener.onRobotTaskEvent != nullptr) {
                            m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
                        }
                        LOGI("创建Aligner回退任务<%s>...", strDescription.c_str());
                        continue;
                    }
                    CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask);
                }
                // LoadPort -> Aligner
@@ -778,19 +659,11 @@
                }
PORT_GET:
                if (m_pActiveRobotTask != nullptr) {
                    m_pActiveRobotTask->pick();
                    std::string strDescription = m_pActiveRobotTask->getDescription();
                    unlock();
                    if (m_listener.onRobotTaskEvent != nullptr) {
                        m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
                    }
                    LOGI("创建新任务<%s>...", strDescription.c_str());
                    continue;
                }
                CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask);
                unlock();
                continue;
            }
            unlock();
        }
@@ -1016,6 +889,12 @@
            LOGE("<Master-%s>Port InUse, map(%d!=%d)不一致,请检查。",
                ((CEquipment*)pEquipment)->getName().c_str(), scanMap, downMap);
        };
        listener.onPortInUse = [&](void* pEquipment, short scanMap) {
            LOGE("<Master-%s>Port InUse。scanMap=%d", ((CEquipment*)pEquipment)->getName().c_str(), scanMap);
            if (m_listener.onLoadPortInUse != nullptr) {
                m_listener.onLoadPortInUse(this, (CEquipment*)pEquipment, scanMap);
            }
        };
        pEquipment->setListener(listener);
        pEquipment->setCcLink(&m_cclink);
        m_listEquipment.push_back(pEquipment);
@@ -1053,6 +932,7 @@
        pEquipment->setID(EQ_ID_LOADPORT1 + index);
        pEquipment->setName(szName);
        pEquipment->setDescription(szName);
        pEquipment->setCompareMapsBeforeProceeding(m_isCompareMapsBeforeProceeding);
        addToEquipmentList(pEquipment);
@@ -1567,7 +1447,8 @@
        unlock();
        // å½“前任务手动中止后,停止调度,需要操作员在解决问题后,重新启动
        stop();
        // 25å¹´7月23日后修改为不停止任务
        // stop();
        return 0;
    }
@@ -1577,6 +1458,18 @@
        lock();
        if (m_pActiveRobotTask != nullptr) {
            m_pActiveRobotTask->restore();
        }
        unlock();
        return 0;
    }
    int CMaster::resendCurrentTask()
    {
        lock();
        if (m_pActiveRobotTask != nullptr) {
            m_pActiveRobotTask->resend();
        }
        unlock();
@@ -1597,4 +1490,17 @@
        pPort->localSetTransferMode((SERVO::TransferMode)transferMode);
        pPort->localAutoChangeEnable(autoChangeEnable);
    }
    void CMaster::setPortCassetteType(unsigned int index, SERVO::CassetteType type)
    {
        ASSERT(index < 4);
        int eqid[] = { EQ_ID_LOADPORT1, EQ_ID_LOADPORT2, EQ_ID_LOADPORT3, EQ_ID_LOADPORT4 };
        CLoadPort* pPort = (CLoadPort*)getEquipment(eqid[index]);
        pPort->localSetCessetteType(type);
    }
    void CMaster::setCompareMapsBeforeProceeding(BOOL bCompare)
    {
        m_isCompareMapsBeforeProceeding = bCompare;
    }
}
SourceCode/Bond/Servo/CMaster.h
@@ -31,6 +31,7 @@
    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 std::function<void(void* pMaster, CEquipment* pEquipment, short scanMap)> ONLOADPORTINUSE;
    typedef struct _MasterListener
    {
        ONMASTERSTATECHANGED    onMasterStateChanged;
@@ -40,6 +41,7 @@
        ONEQVCREVENTREPORT        onEqVcrEventReport;
        ONEQDATACHANGED         onEqDataChanged;
        ONROBOTTASKEVENT        onRobotTaskEvent;
        ONLOADPORTINUSE            onLoadPortInUse;
    } MasterListener;
    class CMaster
@@ -67,8 +69,11 @@
        void setCacheFilepath(const char* pszFilepath);
        int abortCurrentTask();
        int restoreCurrentTask();
        int resendCurrentTask();
        void setPortType(unsigned int index, BOOL enable, int type, int mode,
            int cassetteType, int transferMode, BOOL autoChangeEnable);
        void setPortCassetteType(unsigned int index, SERVO::CassetteType type);
        void setCompareMapsBeforeProceeding(BOOL bCompare);
    private:
        inline void lock() { EnterCriticalSection(&m_criticalSection); }
@@ -130,6 +135,9 @@
        // é”™è¯¯ä»£ç 
        int m_nLastError;
        std::string m_strLastError;
        // åœ¨å¼€å§‹å·¥è‰ºå‰æ˜¯å¦å…ˆéœ€è¦å…ˆæ¯”较map
        BOOL m_isCompareMapsBeforeProceeding;
    };
}
SourceCode/Bond/Servo/CPageGraph2.cpp
@@ -127,7 +127,7 @@
        ASSERT(pItem);
        SERVO::CEquipment* pEquipment = (SERVO::CEquipment*)pItem->pData;
        CHMPropertyDlg dlg(pEquipment->getName().c_str(), 658, 788);
        CHMPropertyDlg dlg(pEquipment->getName().c_str(), 1258, 788);
        CPageLinkSignal* pPage1 = new CPageLinkSignal();
        pPage1->setEquipment(pEquipment);
@@ -212,30 +212,7 @@
        // æµ‹è¯•
        else if (nCmd == ID_EQSGRAPHITEM_TEST1) {
            BOOL bTestGenerate = FALSE;
            SERVO::CEquipment* pEquipment = (SERVO::CEquipment*)pItem->pData;
            if (pEquipment->getID() == EQ_ID_LOADPORT4 && !pEquipment->hasGlass()) {
                ((SERVO::CLoadPort*)pEquipment)->testGenerateGlassList(SERVO::MaterialsType::G1);
                bTestGenerate = TRUE;
            }
            /*
            else if (pEquipment->getID() == EQ_ID_LOADPORT1 && !pEquipment->hasGlass()) {
                ((SERVO::CLoadPort*)pEquipment)->testGenerateGlassList(SERVO::MaterialsType::G2);
                bTestGenerate = TRUE;
            }
            */
            if (!bTestGenerate) {
                SERVO::CRobotTask* pTask = theApp.m_model.getMaster().getActiveRobotTask();
                if (pTask != nullptr) {
                    SERVO::CGlass* pGlass = (SERVO::CGlass*)pTask->getContext();
                    SERVO::CJobDataS* pJobDataS = pGlass->getJobDataS();
                    if (pJobDataS != nullptr) {
                        SERVO::CJobDataB jobDataB;
                        pEquipment->onFetchedOutJob(0, &pJobDataS->getJobDataB(jobDataB));
                        pEquipment->onSentOutJob(0, pJobDataS);
                    }
                }
            }
        }
        else if (nCmd == ID_EQSGRAPHITEM_TEST2) {
            SERVO::CEquipment* pEquipment = (SERVO::CEquipment*)pItem->pData;
SourceCode/Bond/Servo/CPageLinkSignal.cpp
@@ -89,10 +89,20 @@
    // TODO: åœ¨æ­¤å¤„添加消息处理程序代码
    for (int i = 0; i < 8; i++) {
        for (int j = 0; j < 8; j++) {
            if (m_pBtn[i][j] != nullptr) {
                m_pBtn[i][j]->DestroyWindow();
                delete m_pBtn[i][j];
                m_pBtn[i][j] = nullptr;
            if (m_pBtnUpstream[i][j] != nullptr) {
                m_pBtnUpstream[i][j]->DestroyWindow();
                delete m_pBtnUpstream[i][j];
                m_pBtnUpstream[i][j] = nullptr;
            }
        }
    }
    for (int i = 0; i < 8; i++) {
        for (int j = 0; j < 4; j++) {
            if (m_pBtnDwonstream[i][j] != nullptr) {
                m_pBtnDwonstream[i][j]->DestroyWindow();
                delete m_pBtnDwonstream[i][j];
                m_pBtnDwonstream[i][j] = nullptr;
            }
        }
    }
@@ -119,11 +129,28 @@
        y = BTN_Y + (BTN_WIDTH + marginy) * row;
        for (int col = 0; col < 8; col++) {
            x = BTN_X + (BTN_WIDTH + marginx) * col;
            m_pBtn[row][col] = new CBlButton();
            m_pBtn[row][col]->Create("", WS_VISIBLE, { x, y, x + 36, y + 36 }, this, 1000);
            m_pBtn[row][col]->SetFaceColor(FACECOLOR_OFF);
            m_pBtn[row][col]->SetFrameColor(RGB(28, 28, 28));
            m_pBtn[row][col]->SetTextColor(RGB(238, 238, 238));
            m_pBtnUpstream[row][col] = new CBlButton();
            m_pBtnUpstream[row][col]->Create("", WS_VISIBLE, { x, y, x + 36, y + 36 }, this, 1000);
            m_pBtnUpstream[row][col]->SetFaceColor(FACECOLOR_OFF);
            m_pBtnUpstream[row][col]->SetFrameColor(RGB(28, 28, 28));
            m_pBtnUpstream[row][col]->SetTextColor(RGB(238, 238, 238));
        }
    }
    CRect rcLine;
    GetDlgItem(IDC_LINE1)->GetWindowRect(&rcLine);
    GetDlgItem(IDC_LINE1)->MoveWindow(BTN_X + (BTN_WIDTH + marginx) * 8 - marginx / 2, BTN_Y,
        rcLine.Width(), (BTN_WIDTH + marginy) * 7 + BTN_WIDTH);
    for (int row = 0; row < 8; row++) {
        y = BTN_Y + (BTN_WIDTH + marginy) * row;
        for (int col = 0; col < 4; col++) {
            x = BTN_X + (BTN_WIDTH + marginx) * (col + 8);
            m_pBtnDwonstream[row][col] = new CBlButton();
            m_pBtnDwonstream[row][col]->Create("", WS_VISIBLE, { x, y, x + 36, y + 36 }, this, 1000);
            m_pBtnDwonstream[row][col]->SetFaceColor(FACECOLOR_OFF);
            m_pBtnDwonstream[row][col]->SetFrameColor(RGB(28, 28, 28));
            m_pBtnDwonstream[row][col]->SetTextColor(RGB(238, 238, 238));
        }
    }
@@ -140,8 +167,9 @@
    }
    int idy[] = { IDC_LABEL_NAME1, IDC_LABEL_NAME2, IDC_LABEL_NAME3, IDC_LABEL_NAME4, IDC_LABEL_NAME5,
        IDC_LABEL_NAME6, IDC_LABEL_NAME7, IDC_LABEL_NAME8 };
    for (int i = 0; i < 8; i++) {
        IDC_LABEL_NAME6, IDC_LABEL_NAME7, IDC_LABEL_NAME8, IDC_LABEL_NAME9, IDC_LABEL_NAME10,
        IDC_LABEL_NAME11, IDC_LABEL_NAME12};
    for (int i = 0; i < sizeof(idy) / sizeof(int); i++) {
        pItem = GetDlgItem(idy[i]);
        pItem->GetWindowRect(&rcItem);
        pItem->MoveWindow(BTN_X + (BTN_WIDTH + marginx) * i,
@@ -162,35 +190,61 @@
{
    if (nIDEvent == TIMER_ID_SIGNAL_UPDATE) {
        if (m_pEquipment) {
            UpdateAllSignalStatesFromDevice();
            UpdateAllUpstreamSignalStatesFromDevice();
            UpdateAllDownstreamSignalStatesFromDevice();
        }
    }
    CHMPropertyPage::OnTimer(nIDEvent);
}
void CPageLinkSignal::UpdateAllSignalStatesFromDevice()
void CPageLinkSignal::UpdateAllUpstreamSignalStatesFromDevice()
{
    ASSERT(m_pEquipment);
    for (int nRow = 0; nRow < 8; ++nRow) {
        for (int nCol = 0; nCol < 8; ++nCol) {
            BOOL bCurrentState = m_pEquipment->isLinkSignalUpstreamOn(nRow, nCol) && m_pEquipment->IsEnabled();
            UpdateSignalState(nRow, nCol, bCurrentState);
            UpdateUpstreamSignalState(nRow, nCol, bCurrentState);
        }
    }
}
void CPageLinkSignal::UpdateSignalState(int nRow, int nCol, bool bNewState)
void CPageLinkSignal::UpdateAllDownstreamSignalStatesFromDevice()
{
    if (!::IsWindow(m_pBtn[nRow][nCol]->GetSafeHwnd())) {
    ASSERT(m_pEquipment);
    for (int nRow = 0; nRow < 8; ++nRow) {
        for (int nCol = 0; nCol < 4; ++nCol) {
            BOOL bCurrentState = m_pEquipment->isLinkSignalDownstreamOn(nRow, nCol) && m_pEquipment->IsEnabled();
            UpdateDownstreamSignalState(nRow, nCol, bCurrentState);
        }
    }
}
void CPageLinkSignal::UpdateUpstreamSignalState(int nRow, int nCol, bool bNewState)
{
    if (!::IsWindow(m_pBtnUpstream[nRow][nCol]->GetSafeHwnd())) {
        return;
    }
    bool bState = ::GetProp(m_pBtn[nRow][nCol]->GetSafeHwnd(), _T("State")) == (void*)1;
    bool bState = ::GetProp(m_pBtnUpstream[nRow][nCol]->GetSafeHwnd(), _T("State")) == (void*)1;
    if (bState != bNewState) {
        m_pBtn[nRow][nCol]->SetFaceColor(bNewState ? FACECOLOR_ON : FACECOLOR_OFF);
        ::SetProp(m_pBtn[nRow][nCol]->GetSafeHwnd(), _T("State"), bNewState ? (void*)1 : (void*)0);
        m_pBtnUpstream[nRow][nCol]->SetFaceColor(bNewState ? FACECOLOR_ON : FACECOLOR_OFF);
        ::SetProp(m_pBtnUpstream[nRow][nCol]->GetSafeHwnd(), _T("State"), bNewState ? (void*)1 : (void*)0);
    }
}
void CPageLinkSignal::UpdateDownstreamSignalState(int nRow, int nCol, bool bNewState)
{
    if (!::IsWindow(m_pBtnDwonstream[nRow][nCol]->GetSafeHwnd())) {
        return;
    }
    bool bState = ::GetProp(m_pBtnDwonstream[nRow][nCol]->GetSafeHwnd(), _T("State")) == (void*)1;
    if (bState != bNewState) {
        m_pBtnDwonstream[nRow][nCol]->SetFaceColor(bNewState ? FACECOLOR_ON : FACECOLOR_OFF);
        ::SetProp(m_pBtnDwonstream[nRow][nCol]->GetSafeHwnd(), _T("State"), bNewState ? (void*)1 : (void*)0);
    }
}
SourceCode/Bond/Servo/CPageLinkSignal.h
@@ -14,13 +14,16 @@
    virtual ~CPageLinkSignal();
    void setEquipment(SERVO::CEquipment* pEquipment);
    void CreateSignalButtons();
    void UpdateAllSignalStatesFromDevice();
    void UpdateSignalState(int nRow, int nCol, bool bNewState);
    void UpdateAllUpstreamSignalStatesFromDevice();
    void UpdateAllDownstreamSignalStatesFromDevice();
    void UpdateUpstreamSignalState(int nRow, int nCol, bool bNewState);
    void UpdateDownstreamSignalState(int nRow, int nCol, bool bNewState);
private:
    SERVO::CEquipment* m_pEquipment;
    CBlButton* m_pBtn[8][8];
    CBlButton* m_pBtnUpstream[8][8];
    CBlButton* m_pBtnDwonstream[8][4];
    BOOL m_bEnable;
// å¯¹è¯æ¡†æ•°æ®
SourceCode/Bond/Servo/CPagePortProperty.cpp
@@ -280,6 +280,13 @@
void CPagePortProperty::OnCbnSelchangeComboPortCassertType()
{
    // ç”±åŽŸæ¥çš„æ›´æ–°åˆ°EFEM, ä¿®æ”¹ä¸ºä¿å­˜åˆ°æœ¬åœ°ini文件
    ASSERT(m_pPort != nullptr);
    int index = ((CComboBox*)GetDlgItem(IDC_COMBO_PORT_CASSERT_TYPE))->GetCurSel();
    theApp.m_model.setPortCassetteType(m_pPort->getIndex(), SERVO::CassetteType(index + 1));
    /*
    g_nMsgDlgShow = 0;
    CMsgDlg msgDlg("请等待", "正在操作,请等待...");
    msgDlg.SetData((DWORD_PTR)this);
@@ -322,6 +329,7 @@
    msgDlg.DoModal();
    g_nMsgDlgShow = 1;
    */
}
void CPagePortProperty::OnCbnSelchangeComboPortTransferMode()
SourceCode/Bond/Servo/CPortStatusReport.cpp
@@ -51,6 +51,11 @@
        return m_nPortStatus;
    }
    void CPortStatusReport::setPortStatus(short status)
    {
        m_nPortStatus = status;
    }
    short CPortStatusReport::getCassetteSequenceNo()
    {
        return m_nCassetteSequenceNo;
@@ -146,7 +151,7 @@
        memcpy(&m_nCassetteStatus, &pszBuffer[index], sizeof(short));
        index += sizeof(short);
        return 15 * 2;
        return 32 * 2;
    }
    void CPortStatusReport::getAttributeVector(CAttributeVector& attrubutes, int beginWeight)
@@ -242,6 +247,11 @@
        return m_nJobExistenceSlot[0];
    }
    void CPortStatusReport::setJobExistenceSlot(short map)
    {
        m_nJobExistenceSlot[0] = map;
    }
    void CPortStatusReport::WriteString(CArchive& ar, std::string& string)
    {
        CString strTemp = string.c_str();
SourceCode/Bond/Servo/CPortStatusReport.h
@@ -14,6 +14,7 @@
    public:
        void copyEx(CPortStatusReport& other);
        short getPortStatus();
        void setPortStatus(short status);
        short getCassetteSequenceNo();
        std::string& getCassetteId();
        short getLoadingCassetteType();
@@ -29,6 +30,7 @@
        bool canPickFromPort();
        bool isJobExistenceSlot();
        short getJobExistenceSlot();
        void setJobExistenceSlot(short map);
    private:
        void WriteString(CArchive& ar, std::string& string);
SourceCode/Bond/Servo/CRecipeList.cpp
@@ -26,7 +26,7 @@
        return m_nUnitNo;
    }
    int CRecipeList::addRecipePacket(int totalGroup, int currentGroup, const char* pszData, size_t size)
    int CRecipeList::addRecipePacket(int totalCount, int totalGroup, int currentGroup, const char* pszData, size_t size)
    {
        if (m_nToatlGroupCount == 0) m_nToatlGroupCount = totalGroup;
        if (m_nToatlGroupCount != totalGroup) {
@@ -47,7 +47,9 @@
        for (int i = 0; i < size; i += 4) {
            int index = CToolUnits::toInt16(&pszData[i]);
            short id = CToolUnits::toInt16(&pszData[i + 2]);
            addRecipe(index, id);
            if (index != 0 && id != 0) {
                addRecipe(index, id);
            }
        }
        if (m_nCurrentGroupCount == m_nToatlGroupCount) {
@@ -67,7 +69,7 @@
        }
        m_ids[index] = id;
        return 0;
        return (int)m_ids.size();
    }
    std::map<int, short>& CRecipeList::getIds()
SourceCode/Bond/Servo/CRecipeList.h
@@ -12,7 +12,7 @@
    public:
        int getUnitNo();
        int addRecipePacket(int totalGroup, int currentGroup, const char* pszData, size_t size);
        int addRecipePacket(int totalCount,int totalGroup, int currentGroup, const char* pszData, size_t size);
        int addRecipe(int index, short id);
        std::map<int, short>& getIds();
        void reset();
SourceCode/Bond/Servo/CRecipesManager.cpp
@@ -86,7 +86,18 @@
        if (m_onSyncingStateChanged != nullptr) {
            m_onSyncingStateChanged(m_nSyncStatus);
        }
    }
    void CRecipesManager::syncTimeout()
    {
        lock();
        m_nSyncStatus = SS_TIMEOUT;
        m_nTimeoutCount = 0;
        unlock();
        if (m_onSyncingStateChanged != nullptr) {
            m_onSyncingStateChanged(m_nSyncStatus);
        }
    }
    short CRecipesManager::decodeRecipeListReport(const char* pszData, size_t size)
@@ -150,7 +161,7 @@
        }
        else if (reportType == RT_REQUEST_FROM_EAS) {
            int nRet = pRecipeList->addRecipePacket(toatlGroupCount, currentGroupCount, pszIdsData, 250 * 2);
            int nRet = pRecipeList->addRecipePacket(totalMasterRecipeCount, toatlGroupCount, currentGroupCount, pszIdsData, 250 * 2);
            if (MRLRC_CURRENT_RECIPE_COMPLETE == nRet) {
                lock();
                for (auto item : m_mapRecipes) {
@@ -304,9 +315,10 @@
            if (m_nSyncStatus == SS_SYNCING) {
                m_nTimeoutCount++;
                if (m_nTimeoutCount > 10) {
                    m_nSyncStatus = SS_TIMEOUT;
                    unlock();
                    syncTimeout();
                    TRACE("CRecipesManager::TimeoutCheckWorkingProc è¶…时退出\n");
                    lock();
                }
            }
SourceCode/Bond/Servo/CRecipesManager.h
@@ -24,6 +24,7 @@
        unsigned TimeoutCheckWorkingProc();
        int syncing();
        void syncFailed();
        void syncTimeout();
        short decodeRecipeListReport(const char* pszData, size_t size);
        short decodeRecipeParameterReport(const char* pszData, size_t size);
        CRecipeList* getRecipeListFromTemp(int unitNo);
SourceCode/Bond/Servo/CRobotTask.cpp
@@ -286,6 +286,17 @@
            });
    }
    void CRobotTask::resend()
    {
        // é‡æ–°ä¸‹å‘命令,无非是下发取料或下发放料的命令,根据当前状态来
        if (ROBOT_TASK_STATE::Picking == m_state  || ROBOT_TASK_STATE::Picked == m_state) {
            pick();
        }
        else if (ROBOT_TASK_STATE::Placing == m_state) {
            place();
        }
    }
    void CRobotTask::completed()
    {
        m_state = ROBOT_TASK_STATE::Completed;
SourceCode/Bond/Servo/CRobotTask.h
@@ -41,6 +41,7 @@
        void place();
        void restore();
        void restored();
        void resend();
        void completed();
        void error();
        void abort();
SourceCode/Bond/Servo/CRobotTaskDlg.cpp
@@ -103,7 +103,7 @@
    // TODO:  åœ¨æ­¤æ·»åŠ é¢å¤–çš„åˆå§‹åŒ–
    // åˆ›å»ºâ€œåœæ­¢ä»»åŠ¡â€æŒ‰é’®å’Œâ€œæ’¤å›žâ€æŒ‰é’®
    m_btnAbortTask.Create(_T("停止任务"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, CRect(0, 0, 100, 30), this, IDC_BUTTON_ABORT_TASK);
    m_btnRestore.Create(_T("撤回"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, CRect(0, 0, 100, 30), this, IDC_BUTTON_RESTORE);
    m_btnRestore.Create(_T("重发指令"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, CRect(0, 0, 100, 30), this, IDC_BUTTON_RESTORE);
    // åŠ¨æ€æŒ‰é’®åˆ›å»ºåŽè®¾ç½®å­—ä½“
    if (m_fontButton.GetSafeHandle() == nullptr) {
@@ -216,10 +216,11 @@
void CRobotTaskDlg::OnBnClickedRestore()
{
    int ret = AfxMessageBox(_T("物料将会被搬运回原位置,确认要回撤当前任务吗?除非发生了异常,否则请不要回撤任务!"), MB_OKCANCEL | MB_ICONEXCLAMATION);
    // å›žæ’¤ä»»åŠ¡ä¿®æ”¹ä¸ºé‡å‘ä»»åŠ¡
    int ret = AfxMessageBox(_T("确认要重新下发任务吗?"), MB_OKCANCEL | MB_ICONEXCLAMATION);
    if (ret != IDOK) {
        return;
    }
    theApp.m_model.getMaster().restoreCurrentTask();
    theApp.m_model.getMaster().resendCurrentTask();
}
SourceCode/Bond/Servo/Common.h
@@ -18,6 +18,7 @@
#define RX_CODE_EQ_DATA_CHANGED            1010
#define RX_CODE_MASTER_STATE_CHANGED    1011
#define RX_CODE_EQ_ROBOT_TASK            1012
#define RX_CODE_LOADPORT_INUSE            1013
/* Channel Name */
SourceCode/Bond/Servo/Configuration.cpp
@@ -136,3 +136,18 @@
    return TRUE;
}
BOOL CConfiguration::setPortCassetteType(unsigned int index, int cassetteType)
{
    if (index >= 4) return FALSE;
    if (cassetteType < 1 || 3 < cassetteType) return FALSE;
    static char* pszSection[] = { "Port1", "Port2", "Port3", "Port4" };
    WritePrivateProfileString(pszSection[index], _T("CassetteType"), std::to_string(cassetteType).c_str(), m_strFilepath);
    return true;
}
BOOL CConfiguration::isCompareMapsBeforeProceeding()
{
    return GetPrivateProfileInt(_T("Master"), _T("CompareMapsBeforeProceeding"), 0, m_strFilepath);
}
SourceCode/Bond/Servo/Configuration.h
@@ -24,6 +24,8 @@
    int getFilterMode();
    BOOL getPortParms(unsigned int index, BOOL& bEnable, int& type, int& mode,
        int& cassetteType, int& transferMode, BOOL& bAutoChangeEnable);
    BOOL setPortCassetteType(unsigned int index, int cassetteType);
    BOOL isCompareMapsBeforeProceeding();
public:
    void setP2RemoteEqReconnectInterval(int second);
SourceCode/Bond/Servo/Model.cpp
@@ -52,6 +52,12 @@
    }
}
void CModel::setPortCassetteType(unsigned int index, SERVO::CassetteType type)
{
    m_master.setPortCassetteType(index, type);
    m_configuration.setPortCassetteType(index, (int)type);
}
int CModel::init()
{
    CString strIniFile;
@@ -274,6 +280,10 @@
        notifyPtrAndInt(RX_CODE_EQ_ROBOT_TASK, pTask, nullptr, code);
    };
    masterListener.onLoadPortInUse = [&] (void* pMaster, SERVO::CEquipment* pEquipment, short scanMap) {
        LOGE("<CModel>onLoadPortInUse. scanMap = %d", scanMap);
        notifyPtr(RX_CODE_LOADPORT_INUSE, pEquipment);
    };
    m_master.setListener(masterListener);
@@ -281,7 +291,7 @@
    CString strMasterDataFile;
    strMasterDataFile.Format(_T("%s\\Master.dat"), (LPTSTR)(LPCTSTR)m_strWorkDir);
    m_master.setCacheFilepath((LPTSTR)(LPCTSTR)strMasterDataFile);
    m_master.setCompareMapsBeforeProceeding(m_configuration.isCompareMapsBeforeProceeding());
    // åŠ è½½è­¦å‘Šä¿¡æ¯
    AlarmManager& alarmManager = AlarmManager::getInstance();
SourceCode/Bond/Servo/Model.h
@@ -15,6 +15,7 @@
    SERVO::CMaster& getMaster();
    void setWorkDir(const char* pszWorkDir);
    void loadPortParams();
    void setPortCassetteType(unsigned int index, SERVO::CassetteType type);
    int init();
    int term();
SourceCode/Bond/Servo/PageRecipe.cpp
@@ -6,7 +6,7 @@
#include "afxdialogex.h"
#include "PageRecipe.h"
#include "MsgDlg.h"
#include "RecipeDeviceBindDlg.h"
// CPageRecipe å¯¹è¯æ¡†
@@ -22,6 +22,60 @@
{
}
void CPageRecipe::UpdateRecipeByPPID(const CString& strPPID)
{
    if (strPPID.IsEmpty()) {
        AfxMessageBox(_T("请选择一个配方!"));
        return;
    }
    auto& mgr = RecipeManager::getInstance();
    // æŸ¥è¯¢é€‰ä¸­é…æ–¹çš„详细数据
    std::string oldPPID = CT2A(strPPID);
    RecipeInfo oldRecipe = mgr.getRecipeByPPID(oldPPID);
    if (oldRecipe.strPPID.empty()) {
        AfxMessageBox(_T("获取配方数据失败!"));
        return;
    }
    // å¼¹å‡ºç¼–辑对话框,并初始化为当前内容
    CRecipeDeviceBindDlg dlg(this);
    dlg.SetRecipeInfo(oldRecipe);
    if (dlg.DoModal() == IDOK) {
        const RecipeInfo& newRecipe = dlg.GetRecipeInfo();
        bool success = false;
        // åˆ¤æ–­PPID是否有改动
        if (oldRecipe.strPPID != newRecipe.strPPID) {
            // å…ˆæ›´æ–°PPID,再整体更新内容
            if (mgr.updatePPID(oldRecipe.strPPID, newRecipe.strPPID)) {
                success = mgr.updateRecipe(newRecipe);
                if (!success) {
                    AfxMessageBox(_T("已更改PPID,但更新配方内容失败,请检查日志"));
                }
            }
            else {
                AfxMessageBox(_T("更新PPID失败,请检查日志"));
                return;
            }
        }
        else {
            // åªæ›´æ–°å†…容
            success = mgr.updateRecipe(newRecipe);
            if (!success) {
                AfxMessageBox(_T("更新配方失败,请检查日志"));
            }
        }
        if (success) {
            auto vecData = mgr.getAllRecipes();
            FillDataToListCtrl(vecData);
        }
    }
}
void CPageRecipe::FillDataToListCtrl(const std::vector<RecipeInfo>& vecRecipe) {
    CListCtrl* pListCtrl = (CListCtrl*)GetDlgItem(IDC_LIST_PPID);
    if (pListCtrl == nullptr || !::IsWindow(pListCtrl->m_hWnd)) {
@@ -34,16 +88,25 @@
    // éåŽ†æ•°æ®å¹¶æ’å…¥åˆ°CListCtrl中
    for (int i = 0; i < static_cast<int>(vecRecipe.size()); ++i) {
        const RecipeInfo& recipe = vecRecipe[i];
        if (recipe.vecDeviceList.empty() || recipe.vecDeviceList.size() > 6){
            continue;
        }
        m_listPPID.InsertItem(i, _T("")); // ç¬¬0列空白
        CString strNo;
        strNo.Format(_T("%d"), i + 1);
        m_listPPID.SetItemText(i, 1, strNo);
        m_listPPID.SetItemText(i, 2, CA2T(recipe.strPPID.c_str()));
        m_listPPID.SetItemText(i, 3, CA2T(recipe.strDescription.c_str()));
        m_listPPID.SetItemText(i, 4, CA2T(recipe.strCreateTime.c_str()));
        for (int j = 0; j < recipe.vecDeviceList.size(); j++){
            CString str;
            str.Format(_T("%d"), recipe.vecDeviceList.at(j).nRecipeID);
            m_listPPID.SetItemText(i, j + 3, str);
        }
        m_listPPID.SetItemText(i, 9, CA2T(recipe.strCreateTime.c_str()));
        m_listPPID.SetItemText(i, 10, CA2T(recipe.strDescription.c_str()));
    }
    // èŽ·å–åˆ—æ•°
@@ -63,7 +126,6 @@
    if (pList == nullptr) {
        return;
    }
    // éåŽ†æ•°æ®å¹¶æ’å…¥åˆ°CListCtrl中
    std::map<int, short>& ids = pList->getIds();
@@ -87,15 +149,16 @@
BEGIN_MESSAGE_MAP(CPageRecipe, CDialogEx)
    ON_WM_SIZE()
    ON_WM_DESTROY()
    ON_WM_SHOWWINDOW()
    ON_BN_CLICKED(IDC_BUTTON_NEW, &CPageRecipe::OnBnClickedButtonNew)
    ON_BN_CLICKED(IDC_BUTTON_SEARCH, &CPageRecipe::OnBnClickedButtonSearch)
    ON_BN_CLICKED(IDC_BUTTON_MODIFY, &CPageRecipe::OnBnClickedButtonModify)
    ON_BN_CLICKED(IDC_BUTTON_DELETE, &CPageRecipe::OnBnClickedButtonDelete)
    ON_BN_CLICKED(IDC_BUTTON_DELETE_ALL, &CPageRecipe::OnBnClickedButtonDeleteAll)
    ON_BN_CLICKED(IDC_BUTTON_REFRESH, &CPageRecipe::OnBnClickedButtonRefresh)
    ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST_PPID, &CPageRecipe::OnLvnItemChangedListPPID)
    ON_WM_DESTROY()
    ON_CBN_SELCHANGE(IDC_COMBO_EQUIPMENT, &CPageRecipe::OnCbnSelchangeComboEquipment)
    ON_WM_SHOWWINDOW()
END_MESSAGE_MAP()
@@ -108,12 +171,11 @@
    // è¯»å‡ºåˆ—宽
    CString strIniFile, strItem;
    strIniFile.Format(_T("%s\\configuration.ini"), (LPTSTR)(LPCTSTR)theApp.m_strAppDir);
    int width[8] = { 0, 80, 180, 80, 80, 100, 80, 180 };
    for (int i = 0; i < 8; i++) {
    int width[12] = { 0, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 180 };
    for (int i = 0; i < 12; i++) {
        strItem.Format(_T("Col_%d_Width"), i);
        width[i] = GetPrivateProfileInt("PageRecipeListCtrl", strItem, width[i], strIniFile);
    }
    // TODO:  åœ¨æ­¤æ·»åŠ é¢å¤–çš„åˆå§‹åŒ–
    CListCtrl* pListCtrl = (CListCtrl*)GetDlgItem(IDC_LIST_PPID);
@@ -127,10 +189,15 @@
    pListCtrl->InsertColumn(0, _T(""), LVCFMT_RIGHT, 0); // éšè—åˆ—
    pListCtrl->InsertColumn(1, _T("No."), LVCFMT_LEFT, width[1]);
    pListCtrl->InsertColumn(2, _T("PPID/Recipe ID"), LVCFMT_LEFT, width[2]);
    pListCtrl->InsertColumn(3, _T("描述"), LVCFMT_LEFT, width[3]);
    pListCtrl->InsertColumn(4, _T("创建时间"), LVCFMT_LEFT, width[4]);
    pListCtrl->SetColumnWidth(4, LVSCW_AUTOSIZE_USEHEADER);
    pListCtrl->InsertColumn(3, _T("真空烘烤"), LVCFMT_LEFT, width[6]);
    pListCtrl->InsertColumn(4, _T("Bonder1"), LVCFMT_LEFT, width[4]);
    pListCtrl->InsertColumn(5, _T("Bonder2"), LVCFMT_LEFT, width[5]);
    pListCtrl->InsertColumn(6, _T("后烘冷却"), LVCFMT_LEFT, width[7]);
    pListCtrl->InsertColumn(7, _T("精度检查"), LVCFMT_LEFT, width[8]);
    pListCtrl->InsertColumn(8, _T("EFEM"), LVCFMT_LEFT, width[3]);
    pListCtrl->InsertColumn(9, _T("创建时间"), LVCFMT_LEFT, width[9]);
    pListCtrl->InsertColumn(10, _T("描述"), LVCFMT_LEFT, width[10]);
    pListCtrl->SetColumnWidth(10, LVSCW_AUTOSIZE_USEHEADER);
    // èŽ·å–æ‰€æœ‰æ•°æ®
    auto vecData = RecipeManager::getInstance().getAllRecipes();
@@ -172,9 +239,10 @@
    // æŒ‰é’®ç«–直排列在右侧
    CWnd* buttons[] = {
        GetDlgItem(IDC_BUTTON_REFRESH),
        GetDlgItem(IDC_BUTTON_NEW),
        GetDlgItem(IDC_BUTTON_MODIFY),
        GetDlgItem(IDC_BUTTON_DELETE),
        GetDlgItem(IDC_BUTTON_DELETE_ALL),
        GetDlgItem(IDC_BUTTON_MODIFY)
        GetDlgItem(IDC_BUTTON_DELETE_ALL)
    };
    for (auto pBtn : buttons) {
@@ -185,74 +253,130 @@
    }
}
void CPageRecipe::OnDestroy()
{
    CDialogEx::OnDestroy();
    // ä¿å­˜åˆ—宽
    CString strIniFile, strItem, strTemp;
    strIniFile.Format(_T("%s\\configuration.ini"), (LPTSTR)(LPCTSTR)theApp.m_strAppDir);
    CHeaderCtrl* pHeader = m_listPPID.GetHeaderCtrl();
    for (int i = 0; i < pHeader->GetItemCount(); i++) {
        RECT rect;
        pHeader->GetItemRect(i, &rect);
        strItem.Format(_T("Col_%d_Width"), i);
        strTemp.Format(_T("%d"), rect.right - rect.left);
        WritePrivateProfileString("PageRecipeListCtrl", strItem, strTemp, strIniFile);
    }
}
void CPageRecipe::OnShowWindow(BOOL bShow, UINT nStatus)
{
    CDialogEx::OnShowWindow(bShow, nStatus);
    if (bShow) {
        CComboBox* pComboBox = (CComboBox*)GetDlgItem(IDC_COMBO_EQUIPMENT);
        if (pComboBox->GetCount() == 0) {
            SERVO::CMaster& master = theApp.m_model.getMaster();
            SERVO::CEquipment* pEq[] = {
                nullptr,
                master.getEquipment(EQ_ID_EFEM),
                master.getEquipment(EQ_ID_Bonder1),
                master.getEquipment(EQ_ID_Bonder2),
                master.getEquipment(EQ_ID_BAKE_COOLING),
                master.getEquipment(EQ_ID_VACUUMBAKE),
                master.getEquipment(EQ_ID_MEASUREMENT),
            };
            CComboBox* pComboBox = (CComboBox*)GetDlgItem(IDC_COMBO_EQUIPMENT);
            for (int i = 0; i < sizeof(pEq) / sizeof(pEq[0]); i++) {
                pComboBox->InsertString(i,
                    pEq[i] == nullptr ? _T("Master") : pEq[i]->getName().c_str());
                pComboBox->SetItemDataPtr(i, pEq[i]);
            }
            pComboBox->SetCurSel(0);
        }
    }
}
void CPageRecipe::OnBnClickedButtonNew()
{
    // TODO: åœ¨æ­¤æ·»åŠ æŽ§ä»¶é€šçŸ¥å¤„ç†ç¨‹åºä»£ç 
    //CComboBox* pComboBox = (CComboBox*)GetDlgItem(IDC_COMBO_EQUIPMENT);
    //int nSel = pComboBox->GetCurSel();
    //SERVO::CEquipment* pEq = (SERVO::CEquipment*)pComboBox->GetItemDataPtr(nSel);
    //if (pEq == nullptr) {
    //    return;
    //}
    CRecipeDeviceBindDlg dlg(this);
    if (dlg.DoModal() == IDOK) {
        const RecipeInfo& newRecipe = dlg.GetRecipeInfo();
        auto& mgr = RecipeManager::getInstance();
        if (mgr.ppidExists(newRecipe.strPPID)) {
            // å·²å­˜åœ¨ï¼Œè¯¢é—®æ˜¯å¦è¦†ç›–
            int ret = AfxMessageBox(_T("该 PPID å·²å­˜åœ¨ï¼Œæ˜¯å¦è¦†ç›–原配方?"), MB_YESNO | MB_ICONQUESTION);
            if (ret == IDYES) {
                if (mgr.updateRecipe(newRecipe)) {
                    auto vecData = mgr.getAllRecipes();
                    FillDataToListCtrl(vecData);
                }
                else {
                    AfxMessageBox(_T("更新配方失败,请检查日志"));
                }
            }
        }
        else {
            // ä¸å­˜åœ¨ï¼Œç›´æŽ¥æ–°å¢ž
            if (mgr.addRecipe(newRecipe)) {
                auto vecData = mgr.getAllRecipes();
                FillDataToListCtrl(vecData);
            }
            else {
                AfxMessageBox(_T("添加配方失败,请检查日志"));
            }
        }
    }
}
void CPageRecipe::OnBnClickedButtonSearch()
{
    CString strKeyword;
    GetDlgItemText(IDC_EDIT_KEYWORD, strKeyword);
    AfxMessageBox(strKeyword);
    strKeyword.Trim();
    std::vector<RecipeInfo> vecData;
    if (strKeyword.IsEmpty()) {
        // å…³é”®è¯ä¸ºç©ºï¼Œæ˜¾ç¤ºå…¨éƒ¨é…æ–¹
        vecData = RecipeManager::getInstance().getAllRecipes();
    }
    else {
        // æ ¹æ®å…³é”®è¯æœç´¢é…æ–¹
        vecData = RecipeManager::getInstance().getRecipesByKeyword(std::string(CT2A(strKeyword)));
    }
    // å¦‚果没有数据,弹出提示
    if (vecData.empty()) {
        AfxMessageBox(_T("未找到匹配的配方!"));
        return;
    }
    FillDataToListCtrl(vecData);
}
void CPageRecipe::OnBnClickedButtonModify()
{
    // TODO: åœ¨æ­¤æ·»åŠ æŽ§ä»¶é€šçŸ¥å¤„ç†ç¨‹åºä»£ç 
    /*
    POSITION pos = m_listPPID.GetFirstSelectedItemPosition();
    if (!pos) {
        AfxMessageBox(_T("请选择要修改的配方"));
        AfxMessageBox(_T("请先选择一条配方记录进行修改!"));
        return;
    }
    int nSel = m_listPPID.GetNextSelectedItem(pos);
    CString strOldPPID = m_listPPID.GetItemText(nSel, 2);
    CString strOldDesc = m_listPPID.GetItemText(nSel, 3);
    CString strNewPPID, strNewDesc;
    m_editPPID.GetWindowText(strNewPPID);
    m_editDesc.GetWindowText(strNewDesc);
    // åˆ¤ç©º
    if (strOldPPID.IsEmpty() || strNewPPID.IsEmpty()) {
        AfxMessageBox(_T("PPID ä¸èƒ½ä¸ºç©º"));
        return;
    }
    std::string oldPPID = CT2A(strOldPPID);
    std::string newPPID = CT2A(strNewPPID);
    std::string newDesc = CT2A(strNewDesc);
    bool bPPIDChanged = (strOldPPID.Compare(strNewPPID) != 0);
    bool bDescChanged = (strOldDesc.Compare(strNewDesc) != 0);
    if (!bPPIDChanged && !bDescChanged) {
        return;
    }
    if (bPPIDChanged) {
        // æ–° PPID ä¸å¯é‡å¤
        if (RecipeManager::getInstance().ppidExists(newPPID)) {
            AfxMessageBox(_T("新 PPID å·²å­˜åœ¨ï¼Œè¯·ä½¿ç”¨å…¶ä»–值"));
            return;
        }
        // è°ƒç”¨ updatePPID,同时更新描述
        if (RecipeManager::getInstance().updatePPID(oldPPID, newPPID)) {
            m_listPPID.SetItemText(nSel, 2, strNewPPID);
        }
        else {
            AfxMessageBox(_T("更新失败,请检查日志"));
        }
    }
    if (bDescChanged) {
        // æ›´æ–°æè¿°
        if (RecipeManager::getInstance().updateDescription(oldPPID, newDesc)) {
            m_listPPID.SetItemText(nSel, 3, strNewDesc);
        }
        else {
            AfxMessageBox(_T("描述更新失败"));
        }
    }
    */
    CString strPPID = m_listPPID.GetItemText(nSel, 2);
    UpdateRecipeByPPID(strPPID);
}
void CPageRecipe::OnBnClickedButtonDelete()
@@ -317,9 +441,9 @@
        // enable port
        CMsgDlg msgDlg("请等待", "正在获取配方...");
        pEq->masterRecipeListRequest(0, [&](int status) -> void {
            if (status == SS_FAILED) {
            if (status == SS_FAILED || status == SS_TIMEOUT) {
                CString strMsg;
                strMsg.Format(_T("获取配方失败!"));
                strMsg.Format(status == SS_FAILED ? _T("获取配方失败!") : _T("获取配方超时!"));
                msgDlg.DelayClose(3000);
                msgDlg.SetIcon(MSG_BOX_ERROR);
                msgDlg.SetTitle(_T("操作失败"));
@@ -337,7 +461,7 @@
                msgDlg.SetMarquee(FALSE, 0);
                msgDlg.SetCompleteCode(0);
            }
            });
        });
        msgDlg.DoModal();
    }
}
@@ -376,56 +500,5 @@
    else {
        SERVO::CRecipeList* pRecipeList = pEq->getRecipeList(0);
        FillRecipeListToListCtrl(pRecipeList);
    }
}
void CPageRecipe::OnDestroy()
{
    CDialogEx::OnDestroy();
    // ä¿å­˜åˆ—宽
    CString strIniFile, strItem, strTemp;
    strIniFile.Format(_T("%s\\configuration.ini"), (LPTSTR)(LPCTSTR)theApp.m_strAppDir);
    CHeaderCtrl* pHeader = m_listPPID.GetHeaderCtrl();
    for (int i = 0; i < pHeader->GetItemCount(); i++) {
        RECT rect;
        pHeader->GetItemRect(i, &rect);
        strItem.Format(_T("Col_%d_Width"), i);
        strTemp.Format(_T("%d"), rect.right - rect.left);
        WritePrivateProfileString("PageRecipeListCtrl", strItem, strTemp, strIniFile);
    }
}
void CPageRecipe::OnShowWindow(BOOL bShow, UINT nStatus)
{
    CDialogEx::OnShowWindow(bShow, nStatus);
    if (bShow) {
        CComboBox* pComboBox = (CComboBox*)GetDlgItem(IDC_COMBO_EQUIPMENT);
        if (pComboBox->GetCount() == 0) {
            SERVO::CMaster& master = theApp.m_model.getMaster();
            SERVO::CEquipment* pEq[] = {
                nullptr,
                master.getEquipment(EQ_ID_EFEM),
                master.getEquipment(EQ_ID_Bonder1),
                master.getEquipment(EQ_ID_Bonder2),
                master.getEquipment(EQ_ID_BAKE_COOLING),
                master.getEquipment(EQ_ID_VACUUMBAKE),
                master.getEquipment(EQ_ID_MEASUREMENT),
            };
            CComboBox* pComboBox = (CComboBox*)GetDlgItem(IDC_COMBO_EQUIPMENT);
            for (int i = 0; i < sizeof(pEq) / sizeof(pEq[0]); i++) {
                pComboBox->InsertString(i,
                    pEq[i] == nullptr ? _T("Master") : pEq[i]->getName().c_str());
                pComboBox->SetItemDataPtr(i, pEq[i]);
            }
            pComboBox->SetCurSel(0);
        }
    }
}
SourceCode/Bond/Servo/PageRecipe.h
@@ -13,6 +13,7 @@
    virtual ~CPageRecipe();
private:
    void UpdateRecipeByPPID(const CString& strPPID);
    void FillDataToListCtrl(const std::vector<RecipeInfo>& vecRecipe);
    void FillRecipeListToListCtrl(SERVO::CRecipeList* pList);
@@ -25,18 +26,18 @@
    virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV æ”¯æŒ
    virtual BOOL OnInitDialog();
    afx_msg void OnSize(UINT nType, int cx, int cy);
    afx_msg void OnDestroy();
    afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
    afx_msg void OnBnClickedButtonNew();
    afx_msg void OnBnClickedButtonSearch();
    afx_msg void OnBnClickedButtonModify();
    afx_msg void OnBnClickedButtonDelete();
    afx_msg void OnBnClickedButtonDeleteAll();
    afx_msg void OnBnClickedButtonRefresh();
    afx_msg void OnLvnItemChangedListPPID(NMHDR* pNMHDR, LRESULT* pResult);
    afx_msg void OnCbnSelchangeComboEquipment();
    DECLARE_MESSAGE_MAP()
private:
    CListCtrl m_listPPID;
public:
    afx_msg void OnDestroy();
    afx_msg void OnCbnSelchangeComboEquipment();
    afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
};
SourceCode/Bond/Servo/PortConfigurationDlg.cpp
@@ -12,6 +12,9 @@
#include "ServoCommo.h"
#define CHECKBOX_ALL_ID        0x1234
// CPortConfigurationDlg å¯¹è¯æ¡†
IMPLEMENT_DYNAMIC(CPortConfigurationDlg, CDialogEx)
@@ -24,10 +27,18 @@
    m_pPort[1] = dynamic_cast<SERVO::CLoadPort*>(theApp.m_model.m_master.getEquipment(EQ_ID_LOADPORT2));
    m_pPort[2] = dynamic_cast<SERVO::CLoadPort*>(theApp.m_model.m_master.getEquipment(EQ_ID_LOADPORT3));
    m_pPort[3] = dynamic_cast<SERVO::CLoadPort*>(theApp.m_model.m_master.getEquipment(EQ_ID_LOADPORT4));
    m_nCurSelPort = -1;
    m_pCheckBox = nullptr;
    m_bCheckedAll = FALSE;
}
CPortConfigurationDlg::~CPortConfigurationDlg()
{
}
void CPortConfigurationDlg::setCurSelPort(int sel)
{
    m_nCurSelPort = sel;
}
int CPortConfigurationDlg::GetLoadPortEqID(const std::string& strPortName)
@@ -57,19 +68,21 @@
            continue;
        }
        SERVO::CGlass* pGlass = dynamic_cast<SERVO::CGlass*>(pSlot->getContext());
        int nRow = i + 1;
        // è®¾ç½® Panel ID å’Œå‹¾é€‰æ¡†
        CGridCellCheck* pCheck = static_cast<CGridCellCheck*>(m_wndGrid.GetCell(nRow, 1));
        if (pCheck && pGlass) {
            pCheck->SetCheck(pSlot->isEnable() ? TRUE : FALSE);
            pCheck->SetText(pGlass ? pGlass->getID().c_str() : _T(""));
        SERVO::CGlass* pGlass = dynamic_cast<SERVO::CGlass*>(pSlot->getContext());
        int nRow = i + 1;
        if (pGlass != nullptr) {
            m_wndGrid.SetItemState(nRow, 0, GVIS_READONLY);
            m_wndGrid.SetItemText(nRow, 0, pSlot->getName().c_str());
            m_wndGrid.SetCellType(nRow, 1, RUNTIME_CLASS(CGridCellCheck));
            CGridCellCheck* pCheck = dynamic_cast<CGridCellCheck*>(m_wndGrid.GetCell(nRow, 1));
            ASSERT(pCheck);
            pCheck->SetCheck(pGlass->isScheduledForProcessing());
            pCheck->SetText(pGlass->getID().c_str());
        }
        else {
            pCheck->SetCheck(FALSE);
            pCheck->SetText(_T(""));
        }
        m_wndGrid.SetItemData(nRow, 0, (LPARAM)pGlass);
        // å›žå¡« Job ä¿¡æ¯ï¼ˆåªå–第一个有效 Glass)
        if (!bJobInfoSet && pGlass) {
@@ -83,6 +96,7 @@
            }
        }
    }
    m_pCheckBox->SetCheck(IsCheckedAll() ? BST_CHECKED : BST_UNCHECKED);
}
void CPortConfigurationDlg::InitGrid()
@@ -115,7 +129,8 @@
    m_wndGrid.SetColumnWidth(nColIdx, 50);
    m_wndGrid.SetItemText(0, nColIdx++, _T("Slot ID"));
    m_wndGrid.SetColumnWidth(nColIdx, 60);
    m_wndGrid.SetItemText(0, nColIdx++, _T("启用"));
    m_wndGrid.SetItemText(0, nColIdx++, _T("Glass ID"));
    // è®¾ç½®è¡Œä¸ºæ ·å¼
    m_wndGrid.SetFixedRowSelection(FALSE);
@@ -139,32 +154,16 @@
        m_wndGrid.SetRowHeight(i, nEachRowHeight);
    }
    FillGrid();
}
void CPortConfigurationDlg::FillGrid()
{
    //CStringArray recipeOptions;
    //recipeOptions.Add(_T("Recipe A"));
    //recipeOptions.Add(_T("Recipe B"));
    //recipeOptions.Add(_T("Recipe C"));
    for (int i = 1; i < 9; ++i) {
        CString strIndex;
        strIndex.Format(_T("%d"), i);
        m_wndGrid.SetItemText(i, 0, strIndex);
        m_wndGrid.SetItemState(i, 0, GVIS_READONLY);
        // Checkbox
        m_wndGrid.SetCellType(i, 1, RUNTIME_CLASS(CGridCellCheck));
        CGridCellCheck* pCheck = static_cast<CGridCellCheck*>(m_wndGrid.GetCell(i, 1));
        if (pCheck) {
            pCheck->SetCheck(FALSE);
        }
    }
    m_wndGrid.Invalidate();
    m_wndGrid.UpdateWindow();
    CRect rect;
    BOOL bOK = m_wndGrid.GetCellRect(0, 1, rect);
    m_pCheckBox = new CCustomCheckBox();
    m_pCheckBox->Create(_T("选择所有"),
        WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, // è‡ªåЍ勾选
        CRect(0, 0, 150, 32), &m_wndGrid, CHECKBOX_ALL_ID);
    m_pCheckBox->SetFont(GetFont());
    m_pCheckBox->MoveWindow(rect.left + 5, rect.top + 3, 150, rect.Height() - 6);
    m_pCheckBox->SetBackgroundColor(g_nGridFixCellColor);
    m_pCheckBox->SetNotifyHwnd(GetSafeHwnd());
}
void CPortConfigurationDlg::DoDataExchange(CDataExchange* pDX)
@@ -180,6 +179,10 @@
BEGIN_MESSAGE_MAP(CPortConfigurationDlg, CDialogEx)
    ON_CBN_SELCHANGE(IDC_COMBO_PORT, &CPortConfigurationDlg::OnSelchangeComboPort)
    ON_BN_CLICKED(IDC_BUTTON_APPLY, &CPortConfigurationDlg::OnBnClickedButtonApply)
    ON_MESSAGE(WM_CHECKBOX_STATE_CHANGED, &CPortConfigurationDlg::OnCheckAllClicked)
    ON_WM_DESTROY()
    ON_BN_CLICKED(IDC_BUTTON_PROCESS_START, &CPortConfigurationDlg::OnBnClickedButtonProcessStart)
    ON_BN_CLICKED(IDC_BUTTON_PROCESS_CANCEL, &CPortConfigurationDlg::OnBnClickedButtonProcessCancel)
END_MESSAGE_MAP()
@@ -195,7 +198,13 @@
    for (const auto& item : ports) {
        m_comboPort.AddString(item);
    }
    m_comboPort.SetCurSel(0); // é»˜è®¤é€‰æ‹©ç¬¬ä¸€ä¸ªç«¯å£
    if (0 <= m_nCurSelPort && m_nCurSelPort <= 3) {
        m_comboPort.SetCurSel(m_nCurSelPort);
        m_comboPort.EnableWindow(FALSE);
    }
    else {
        m_comboPort.SetCurSel(0);
    }
    // åˆå§‹åŒ–配方下拉框内容
    std::vector<std::string> vecRecipe = RecipeManager::getInstance().getAllPPID();
@@ -216,7 +225,20 @@
    LoadPortConfigToUI(m_pPort[0]);     // é»˜è®¤åŠ è½½ç¬¬ä¸€ä¸ªç«¯å£çš„é…ç½®
    // è®¾ç½®å¯¹è¯æ¡†æ ‡é¢˜
    SetWindowText(_T("Port Configuration"));
    BOOL bAutoPopup = 0 <= m_nCurSelPort && m_nCurSelPort <= 3;
    if (bAutoPopup) {
        CString strTitle;
        strTitle.Format(_T("%s Configuration"), ports[m_nCurSelPort]);
        SetWindowText(strTitle);
    }
    else {
        SetWindowText(_T("Port Configuration"));
    }
    // Porcess Start / Process Cancel æŒ‰é’®çŠ¶æ€
    GetDlgItem(IDC_BUTTON_PROCESS_START)->EnableWindow(FALSE);
    GetDlgItem(IDC_BUTTON_PROCESS_CANCEL)->EnableWindow(FALSE);
    return TRUE;  // return TRUE unless you set the focus to a control
    // å¼‚常: OCX å±žæ€§é¡µåº”返回 FALSE
@@ -231,6 +253,12 @@
    }
    // åŠ è½½é€‰ä¸­ç«¯å£çš„é…ç½®åˆ° UI
    for (int i = 1; i <= 8; i++) {
        m_wndGrid.SetItemText(i, 0, "");
        m_wndGrid.SetItemText(i, 1, "");
        m_wndGrid.SetCellType(i, 1, RUNTIME_CLASS(CGridCellNumeric));
    }
    m_wndGrid.Invalidate();
    LoadPortConfigToUI(m_pPort[selPort]);
}
@@ -289,35 +317,103 @@
    }
    // èŽ·å– Grid è¡¨æ ¼ä¸­ Slot çŠ¶æ€ï¼ˆç¬¬1~8行)
    for (int i = 1; i <= 8; ++i) {
        SERVO::SlotConfig slot;
        slot.nSlotID = i;
    for (int i = 1; i <= SLOT_MAX; ++i) {
        SERVO::CGlass* pGlass = (SERVO::CGlass*)m_wndGrid.GetItemData(i, 0);
        if (pGlass != nullptr) {
            CGridCellCheck* pCheck = dynamic_cast<CGridCellCheck*>(m_wndGrid.GetCell(i, 1));
            ASSERT(pCheck);
            pGlass->setScheduledForProcessing(pCheck->GetCheck());
            pGlass->setType(static_cast<SERVO::MaterialsType>(config.nMaterialType));
        CGridCellCheck* pCheck = static_cast<CGridCellCheck*>(m_wndGrid.GetCell(i, 1));
        if (pCheck) {
            slot.isEnabled = pCheck->GetCheck();
            SERVO::CJobDataS* pJobDataS = pGlass->getJobDataS();
            pJobDataS->setLotId(config.strLotID.c_str());
            pJobDataS->setProductId(config.strProductID.c_str());
            pJobDataS->setOperationId(config.strOperationID.c_str());
            pJobDataS->setMaterialsType(config.nMaterialType);
            RecipeInfo stRecipeInfo = RecipeManager::getInstance().getRecipeByPPID(config.strRecipe);
            std::vector<DeviceRecipe> vecRecipeInfo = stRecipeInfo.vecDeviceList;
            for (const auto& info : vecRecipeInfo) {
                const std::string& name = info.strDeviceName;
                short nRecipeID = (short)info.nRecipeID;
                if (name == EQ_NAME_EFEM) {
                    pJobDataS->setDeviceRecipeId(0, nRecipeID);
                }
                else if (name == EQ_NAME_BONDER1) {
                    pJobDataS->setDeviceRecipeId(1, nRecipeID);
                }
                else if (name == EQ_NAME_BONDER2) {
                    pJobDataS->setDeviceRecipeId(2, nRecipeID);
                }
                else if (name == EQ_NAME_BAKE_COOLING) {
                    pJobDataS->setDeviceRecipeId(3, nRecipeID);
                }
                else if (name == EQ_NAME_VACUUMBAKE) {
                    pJobDataS->setDeviceRecipeId(4, nRecipeID);
                }
                else if (name == EQ_NAME_MEASUREMENT) {
                    pJobDataS->setDeviceRecipeId(5, nRecipeID);
                }
            }
        }
        config.vecSlot.push_back(slot);
    }
    int nEqID = GetLoadPortEqID(config.strPortName);
    if (nEqID < 0) {
        AfxMessageBox(_T("未知的端口名称!"));
        return;
    GetDlgItem(IDC_BUTTON_PROCESS_START)->EnableWindow(TRUE);
    GetDlgItem(IDC_BUTTON_PROCESS_CANCEL)->EnableWindow(TRUE);
}
void CPortConfigurationDlg::OnDestroy()
{
    CDialogEx::OnDestroy();
    if (m_pCheckBox != nullptr) {
        m_pCheckBox->DestroyWindow();
        delete m_pCheckBox;
        m_pCheckBox = nullptr;
    }
}
LRESULT  CPortConfigurationDlg::OnCheckAllClicked(WPARAM wParam, LPARAM lParam)
{
    UINT ctrlID = (UINT)wParam;
    BOOL bChecked = (BOOL)lParam;
    for (int i = 1; i <= SLOT_MAX; ++i) {
        CGridCellCheck* pCheck = dynamic_cast<CGridCellCheck*>(m_wndGrid.GetCell(i, 1));
        if (pCheck != nullptr) {
            pCheck->SetCheck(bChecked);
        }
    }
    SERVO::CLoadPort* pPort = dynamic_cast<SERVO::CLoadPort*>(theApp.m_model.m_master.getEquipment(nEqID));
    if (!pPort) {
        AfxMessageBox(_T("找不到对应的 LoadPort è®¾å¤‡ï¼"));
        return;
    return 0;
}
BOOL CPortConfigurationDlg::IsCheckedAll()
{
    for (int i = 1; i <= SLOT_MAX; ++i) {
        CGridCellCheck* pCheck = dynamic_cast<CGridCellCheck*>(m_wndGrid.GetCell(i, 1));
        if (pCheck != nullptr) {
            if (!pCheck->GetCheck()) return FALSE;
        }
    }
    // åº”用配置(例如测试生成玻璃)
    if (pPort->testGenerateGlassListFromConfig(config) < 0) {
        AfxMessageBox(_T("Failed to generate glass list from configuration!"));
        return;
    }
    return TRUE;
}
    OnOK();
}
void CPortConfigurationDlg::OnBnClickedButtonProcessStart()
{
    int selPort = (0 <= m_nCurSelPort && m_nCurSelPort <= 3) ? m_nCurSelPort
        : m_comboPort.GetCurSel();
    if (selPort < 0 || selPort >= 4) return;
    m_pPort[selPort]->sendCassetteCtrlCmd(CCC_PROCESS_START, nullptr, 0, 0, 0, nullptr, nullptr);
}
void CPortConfigurationDlg::OnBnClickedButtonProcessCancel()
{
    int selPort = (0 <= m_nCurSelPort && m_nCurSelPort <= 3) ? m_nCurSelPort
        : m_comboPort.GetCurSel();
    if (selPort < 0 || selPort >= 4) return;
    m_pPort[selPort]->sendCassetteCtrlCmd(CCC_PROCESS_CANCEL, nullptr, 0, 0, 0, nullptr, nullptr);
}
SourceCode/Bond/Servo/PortConfigurationDlg.h
@@ -2,6 +2,8 @@
#include "afxdialogex.h"
#include "GridCtrl.h"
#include "CLoadPort.h"
#include "CCustomCheckBox.h"
// CPortConfigurationDlg å¯¹è¯æ¡†
@@ -13,6 +15,10 @@
    CPortConfigurationDlg(CWnd* pParent = nullptr);   // æ ‡å‡†æž„造函数
    virtual ~CPortConfigurationDlg();
public:
    void setCurSelPort(int sel);
    BOOL IsCheckedAll();
// å¯¹è¯æ¡†æ•°æ®
#ifdef AFX_DESIGN_TIME
    enum { IDD = IDD_DIALOG_PORT_CONFIGURATION };
@@ -23,18 +29,28 @@
    virtual BOOL OnInitDialog();
    afx_msg void OnSelchangeComboPort();
    afx_msg void OnBnClickedButtonApply();
    afx_msg LRESULT OnCheckAllClicked(WPARAM wParam, LPARAM lParam);
    DECLARE_MESSAGE_MAP()
private:
    int GetLoadPortEqID(const std::string& strPortName);
    void LoadPortConfigToUI(SERVO::CLoadPort* pPort);
    void InitGrid();
    void FillGrid();
private:
    SERVO::CLoadPort* m_pPort[4];
    int m_nCurSelPort;
    CGridCtrl m_wndGrid;
    CComboBox m_comboPort;
    CComboBox m_comboRecipe;
    CComboBox m_comboMaterialsType;
    CCustomCheckBox* m_pCheckBox;
    BOOL m_bCheckedAll;
public:
    afx_msg void OnDestroy();
    afx_msg void OnBnClickedButtonProcessStart();
    afx_msg void OnBnClickedButtonProcessCancel();
};
SourceCode/Bond/Servo/RecipeDeviceBindDlg.cpp
@@ -28,6 +28,8 @@
CRecipeDeviceBindDlg::CRecipeDeviceBindDlg(CWnd* pParent /*=nullptr*/)
    : CDialogEx(IDD_DIALOG_RECIPE_DEVICE_BIND, pParent)
    , m_strPPID(_T(""))
    , m_strDesc(_T(""))
{
}
@@ -36,15 +38,117 @@
{
}
void CRecipeDeviceBindDlg::DoDataExchange(CDataExchange* pDX)
{
    CDialogEx::DoDataExchange(pDX);
const RecipeInfo& CRecipeDeviceBindDlg::GetRecipeInfo() const {
    return m_recipe;
}
void CRecipeDeviceBindDlg::SetRecipeInfo(const RecipeInfo& info)
{
    m_recipe = info;
}
void CRecipeDeviceBindDlg::ReleaseDeviceControls()
{
    for (auto& ctrl : m_vecDevices) {
        delete ctrl.editDeviceID;    ctrl.editDeviceID = nullptr;
        delete ctrl.editDeviceName;  ctrl.editDeviceName = nullptr;
        delete ctrl.comboRecipeID;   ctrl.comboRecipeID = nullptr;
    }
    m_vecDevices.clear();
}
void CRecipeDeviceBindDlg::CreateDeviceControls(int nXStart, int nYStart, int nTotalControlWidth, int nRowHeight)
{
    for (size_t i = 0; i < g_vecBindDevices.size(); ++i) {
        int y = nYStart + static_cast<int>(i) * nRowHeight;
        auto* pEditID = new CEdit;
        pEditID->Create(WS_CHILD | WS_VISIBLE | WS_BORDER | ES_CENTER, CRect(nXStart, y, nXStart + 100, y + 25), this, (UINT)(IDC_EDIT_DEVICEID_BASE + i));
        pEditID->SetFont(&m_font);
        auto* pEditName = new CEdit;
        pEditName->Create(WS_CHILD | WS_VISIBLE | WS_BORDER | ES_CENTER, CRect(nXStart + 110, y, nXStart + 210, y + 25), this, (UINT)(IDC_EDIT_DEVICENAME_BASE + i));
        pEditName->SetFont(&m_font);
        auto* pCombo = new CComboBox;
        pCombo->Create(WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST, CRect(nXStart + 220, y, nXStart + nTotalControlWidth, y + 25), this, (UINT)(IDC_COMBO_RECIPEID_BASE + i));
        pCombo->SetFont(&m_font);
        m_vecDevices.push_back({ pEditID, pEditName, pCombo });
    }
}
bool CRecipeDeviceBindDlg::FillComboRecipeList(CComboBox* pCombo, int nDeviceID, int nSelectedRecipeID)
{
    auto& master = theApp.m_model.getMaster();
    auto* pEq = master.getEquipment(nDeviceID);
    if (!pEq) {
        return false;
    }
    auto* pRecipeList = pEq->getRecipeList(0);
    if (!pRecipeList) {
        return false;
    }
    auto& mapRecipeIds = pRecipeList->getIds();
    bool bFound = false;
    pCombo->ResetContent();
    for (const auto& pair : mapRecipeIds) {
        int nRecipeID = pair.second;
        CString strRecipeName;
        strRecipeName.Format(_T("%d"), nRecipeID);
        int idx = pCombo->AddString(strRecipeName);
        pCombo->SetItemData(idx, nRecipeID);
        if (nSelectedRecipeID == nRecipeID) {
            pCombo->SetCurSel(idx);
            bFound = true;
        }
    }
    if (nSelectedRecipeID != -1 && !bFound) {
        pCombo->SetCurSel(CB_ERR);
    }
    else if (pCombo->GetCount() > 0 && nSelectedRecipeID == -1) {
        pCombo->SetCurSel(0);
    }
    return true;
}
bool CRecipeDeviceBindDlg::FillDeviceInfo(int idx, int nDeviceID, const CString& strDeviceName, int nSelectedRecipeID)
{
    if (idx < 0 || idx >= (int)m_vecDevices.size()) {
        return false;
    }
    auto& ctrl = m_vecDevices[idx];
    CString strID;
    strID.Format(_T("%d"), nDeviceID);
    ctrl.editDeviceID->SetWindowText(strID);
    ctrl.editDeviceID->SetReadOnly(TRUE);
    ctrl.editDeviceName->SetWindowText(strDeviceName);
    ctrl.editDeviceName->SetReadOnly(TRUE);
    if (!FillComboRecipeList(ctrl.comboRecipeID, nDeviceID, nSelectedRecipeID)) {
        CString str;
        str.Format(_T("设备 [%s] æˆ–其配方列表未找到,请检查设备配置"), strDeviceName.GetString());
        AfxMessageBox(str);
        return false;
    }
    return true;
}
void CRecipeDeviceBindDlg::DoDataExchange(CDataExchange* pDX)
{
    CDialogEx::DoDataExchange(pDX);
    DDX_Text(pDX, IDC_EDIT_PPID, m_strPPID);
    DDX_Text(pDX, IDC_EDIT_DESC, m_strDesc);
}
BEGIN_MESSAGE_MAP(CRecipeDeviceBindDlg, CDialogEx)
    ON_WM_CLOSE()
    ON_WM_SIZE()
    ON_BN_CLICKED(IDOK, &CRecipeDeviceBindDlg::OnBnClickedOk)
END_MESSAGE_MAP()
@@ -54,43 +158,63 @@
{
    CDialogEx::OnInitDialog();
    // TODO:  åœ¨æ­¤æ·»åŠ é¢å¤–çš„åˆå§‹åŒ–
    // è®¾ç½®å›ºå®šå¤§å°ï¼ˆä¾‹å¦‚ 600x400)
    SetWindowPos(nullptr, 0, 0, 600, 400, SWP_NOMOVE | SWP_NOZORDER);
    // è®¾ç½®å¯¹è¯æ¡†æ ‡é¢˜
    SetWindowText(m_recipe.vecDeviceList.empty() ? _T("新建配方") : _T("编辑配方"));
    // åˆ›å»ºæŽ§ä»¶
    const int totalControlWidth = 340;
    CRect clientRect;
    GetClientRect(&clientRect);
    int xStart = (clientRect.Width() - totalControlWidth) / 2;
    const int nRowHeight = 30;
    const int yStart = 30; // é¡¶éƒ¨èµ·å§‹é«˜åº¦
    const int nRowCount = static_cast<int>(g_vecBindDevices.size());
    for (int i = 0; i < nRowCount; ++i) {
        int y = yStart + i * nRowHeight;
        const auto& meta = g_vecBindDevices[i];
        CEdit* pEditID = new CEdit();
        pEditID->Create(WS_CHILD | WS_VISIBLE | WS_BORDER, CRect(xStart, y, xStart + 100, y + 25), this, IDC_EDIT_DEVICEID_BASE + i);
        CString strID;
        strID.Format(_T("%d"), meta.nDeviceID);
        pEditID->SetWindowText(strID);
        pEditID->SetReadOnly(TRUE);     // è®¾å¤‡ID只读
        CEdit* pEditName = new CEdit();
        pEditName->Create(WS_CHILD | WS_VISIBLE | WS_BORDER, CRect(xStart + 110, y, xStart + 210, y + 25), this, IDC_EDIT_DEVICENAME_BASE + i);
        pEditName->SetWindowText(CA2T(meta.strDeviceName));
        pEditName->SetReadOnly(TRUE);   // è®¾å¤‡åç§°åªè¯»
        CComboBox* pCombo = new CComboBox();
        pCombo->Create(WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST, CRect(xStart + 220, y, xStart + 340, y + 300), this, IDC_COMBO_RECIPEID_BASE + i);
        // æ·»åŠ é€‰é¡¹åˆ° ComboBox
        m_vecDevices.push_back({ pEditID, pEditName, pCombo });
    // åˆ›å»ºåŠ¨æ€æŽ§ä»¶å­—ä½“
    if (!m_font.m_hObject) {
        CFont* pDlgFont = GetFont();
        LOGFONT lf;
        if (pDlgFont && pDlgFont->GetLogFont(&lf)) {
            lf.lfHeight = -16;
            m_font.CreateFontIndirect(&lf);
        }
    }
    // è®¡ç®—坐标
    CRect rDesc;
    int nXStart = 30, nYStart = 30, nTotalControlWidth = 340;
    if (auto* pWndDesc = GetDlgItem(IDC_STATIC_DESC)) {
        pWndDesc->GetWindowRect(&rDesc); ScreenToClient(&rDesc);
        nXStart = rDesc.left;
    }
    if (auto* pWndEdit = GetDlgItem(IDC_EDIT_DESC)) {
        pWndEdit->GetWindowRect(&rDesc); ScreenToClient(&rDesc);
        nYStart = rDesc.bottom + 20;
    }
    CRect rClient; GetClientRect(&rClient);
    nTotalControlWidth = rClient.Width() - nXStart * 2;
    const int nRowHeight = 30;
    // æ¸…空旧控件
    ReleaseDeviceControls();
    // åˆ›å»ºæ–°æŽ§ä»¶
    CreateDeviceControls(nXStart, nYStart, nTotalControlWidth, nRowHeight);
    auto& master = theApp.m_model.getMaster();
    // å¡«å……内容
    if (m_recipe.vecDeviceList.empty()) {
        // æ–°å»º
        for (size_t i = 0; i < g_vecBindDevices.size(); ++i) {
            const auto& meta = g_vecBindDevices[i];
            FillDeviceInfo((int)i, meta.nDeviceID, meta.strDeviceName);
        }
    }
    else {
        // ç¼–辑
        m_strPPID = CA2T(m_recipe.strPPID.c_str());
        m_strDesc = CA2T(m_recipe.strDescription.c_str());
        UpdateData(FALSE);
        for (size_t i = 0; i < m_recipe.vecDeviceList.size() && i < m_vecDevices.size(); ++i) {
            const auto& d = m_recipe.vecDeviceList[i];
            FillDeviceInfo((int)i, d.nDeviceID, d.strDeviceName.c_str(), d.nRecipeID);
        }
    }
    CenterWindow();
    return TRUE;  // return TRUE unless you set the focus to a control
    // å¼‚常: OCX å±žæ€§é¡µåº”返回 FALSE
@@ -102,21 +226,7 @@
    CDialogEx::OnClose();
    // æ¸…理控件
    for (auto& device : m_vecDevices) {
        if (device.editDeviceID) {
            device.editDeviceID->DestroyWindow();
            delete device.editDeviceID;
        }
        if (device.editDeviceName) {
            device.editDeviceName->DestroyWindow();
            delete device.editDeviceName;
        }
        if (device.comboRecipeID) {
            device.comboRecipeID->DestroyWindow();
            delete device.comboRecipeID;
        }
    }
    m_vecDevices.clear();
    ReleaseDeviceControls();
}
void CRecipeDeviceBindDlg::OnSize(UINT nType, int cx, int cy)
@@ -124,4 +234,41 @@
    CDialogEx::OnSize(nType, cx, cy);
    // TODO: åœ¨æ­¤å¤„添加消息处理程序代码
}
}
void CRecipeDeviceBindDlg::OnBnClickedOk()
{
    // TODO: åœ¨æ­¤æ·»åŠ æŽ§ä»¶é€šçŸ¥å¤„ç†ç¨‹åºä»£ç 
    UpdateData(TRUE);
    // æ”¶é›†æ‰€æœ‰è®¾å¤‡æ˜ å°„
    m_recipe.vecDeviceList.clear();
    for (const auto& dev : m_vecDevices) {
        DeviceRecipe info;
        CString strID, strName;
        dev.editDeviceID->GetWindowText(strID);
        dev.editDeviceName->GetWindowText(strName);
        int sel = dev.comboRecipeID->GetCurSel();
        info.nRecipeID = -1;
        if (sel != CB_ERR) {
            info.nRecipeID = (int)dev.comboRecipeID->GetItemData(sel);
        }
        info.nDeviceID = _ttoi(strID);
        info.strDeviceName = CT2A(strName);
        m_recipe.vecDeviceList.push_back(info);
    }
    // æ£€æŸ¥ PPID æ˜¯å¦ä¸ºç©º
    if (m_strPPID.IsEmpty()) {
        AfxMessageBox(_T("配方 PPID ä¸èƒ½ä¸ºç©º"));
        return;
    }
    // PPID和描述
    m_recipe.strPPID = CT2A(m_strPPID);
    m_recipe.strDescription = CT2A(m_strDesc);
    CDialogEx::OnOK();
}
SourceCode/Bond/Servo/RecipeDeviceBindDlg.h
@@ -1,6 +1,6 @@
#pragma once
#include "afxdialogex.h"
#include "RecipeManager.h"
// CRecipeDeviceBindDlg å¯¹è¯æ¡†
@@ -12,6 +12,9 @@
    CRecipeDeviceBindDlg(CWnd* pParent = nullptr);   // æ ‡å‡†æž„造函数
    virtual ~CRecipeDeviceBindDlg();
    const RecipeInfo& GetRecipeInfo() const;
    void SetRecipeInfo(const RecipeInfo& info);
// å¯¹è¯æ¡†æ•°æ®
#ifdef AFX_DESIGN_TIME
    enum { IDD = IDD_DIALOG_RECIPE_DEVICE_BIND };
@@ -22,14 +25,24 @@
    virtual BOOL OnInitDialog();
    afx_msg void OnClose();
    afx_msg void OnSize(UINT nType, int cx, int cy);
    afx_msg void OnBnClickedOk();
    DECLARE_MESSAGE_MAP()
private:
    void ReleaseDeviceControls();
    void CreateDeviceControls(int nXStart, int nYStart, int nTotalControlWidth, int nRowHeight);
    bool FillDeviceInfo(int idx, int nDeviceID, const CString& strDeviceName, int nSelectedRecipeID = -1);
    bool FillComboRecipeList(CComboBox* pCombo, int nDeviceID, int nSelectedRecipeID = -1);
    struct DeviceWidget {
        CEdit* editDeviceID;
        CEdit* editDeviceName;
        CComboBox* comboRecipeID;
    };
    CFont m_font;
    CString m_strPPID;
    CString m_strDesc;
    RecipeInfo m_recipe;
    std::vector<DeviceWidget> m_vecDevices;
};
SourceCode/Bond/Servo/RecipeManager.cpp
@@ -220,7 +220,6 @@
        for (const auto& dev : devs) {
            DeviceRecipe dr;
            dr.strPPID = info.strPPID;
            try {
                dr.nDeviceID = std::stoi(dev[0]);
                dr.strDeviceName = dev[1];
@@ -294,7 +293,6 @@
    auto devs = m_pDB->fetchResults("SELECT device_id, device_name, recipe_id FROM recipe_devices WHERE ppid = '" + ppid + "';");
    for (const auto& dev : devs) {
        DeviceRecipe dr;
        dr.strPPID = ppid;
        try {
            dr.nDeviceID = std::stoi(dev[0]);
            dr.strDeviceName = dev[1];
@@ -448,8 +446,8 @@
    recipe.strDescription = "Main Board Burn-in";
    recipe.vecDeviceList = {
        {1, 101, "P1001","Burner A"},
        {2, 102, "P1001", "Burner B"}
        {1, 101, "Burner A"},
        {2, 102, "Burner B"}
    };
    addRecipe(recipe);
@@ -486,7 +484,6 @@
        std::getline(ss, description, ',');
        std::getline(ss, createTime, ',');
        dev.strPPID = ppid;
        auto& recipe = recipeMap[ppid];
        recipe.strPPID = ppid;
        recipe.strDescription = description;
SourceCode/Bond/Servo/RecipeManager.h
@@ -10,8 +10,7 @@
// å•个设备配方映射信息
struct DeviceRecipe {
    int nDeviceID;               // è®¾å¤‡ID
    int nRecipeID;               // è¯¥è®¾å¤‡å¯¹åº”的子配方ID
    std::string strPPID;         // é…æ–¹ID(主键)
    int nRecipeID;               // å­é…æ–¹ID
    std::string strDeviceName;   // è®¾å¤‡åç§° 
};
SourceCode/Bond/Servo/Servo.rc
Binary files differ
SourceCode/Bond/Servo/Servo.vcxproj
@@ -200,6 +200,7 @@
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="CBaseDlg.h" />
    <ClInclude Include="CCustomCheckBox.h" />
    <ClInclude Include="CEquipmentPage3.h" />
    <ClInclude Include="CGlassPool.h" />
    <ClInclude Include="ChangePasswordDlg.h" />
@@ -342,6 +343,7 @@
  </ItemGroup>
  <ItemGroup>
    <ClCompile Include="CBaseDlg.cpp" />
    <ClCompile Include="CCustomCheckBox.cpp" />
    <ClCompile Include="CEquipmentPage3.cpp" />
    <ClCompile Include="CGlassPool.cpp" />
    <ClCompile Include="ChangePasswordDlg.cpp" />
SourceCode/Bond/Servo/Servo.vcxproj.filters
@@ -169,6 +169,7 @@
    <ClCompile Include="InputDialog.cpp" />
    <ClCompile Include="RecipeManager.cpp" />
    <ClCompile Include="RecipeDeviceBindDlg.cpp" />
    <ClCompile Include="CCustomCheckBox.cpp" />
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="AlarmManager.h" />
@@ -343,6 +344,7 @@
    <ClInclude Include="InputDialog.h" />
    <ClInclude Include="RecipeManager.h" />
    <ClInclude Include="RecipeDeviceBindDlg.h" />
    <ClInclude Include="CCustomCheckBox.h" />
  </ItemGroup>
  <ItemGroup>
    <ResourceCompile Include="Servo.rc" />
SourceCode/Bond/Servo/ServoCommo.h
@@ -19,6 +19,19 @@
    }                                                                        \
}
#define CHECK_RUN_ACTIVE_ROBOT_TASK(art) {                                    \
    if (art != nullptr) {                                                    \
        art->pick();                                                        \
        std::string strDescription = art->getDescription();                    \
        unlock();                                                            \
        if (m_listener.onRobotTaskEvent != nullptr) {                        \
            m_listener.onRobotTaskEvent(this, art, ROBOT_EVENT_CREATE);        \
        }                                                                    \
        LOGI("创建新任务<%s>...", strDescription.c_str());                    \
        continue;                                                            \
    }                                                                        \
}
namespace SERVO {
#define BLOCK_BUFFER_MAX            1024
#define ALIVE_TIMEOUT                15
@@ -209,5 +222,21 @@
    /* EQ Data changed code */
#define EDCC_FETCHOUT_JOB                1000    /* È¡Æ¬ */
#define EDCC_STORED_JOB                    1001    /* æ”¾ç‰‡ */
    /* Cassette Ctrl CMD */
#define CCC_MAP_DOWNLOAD            1
#define CCC_CLAMP                    2
#define CCC_UNCLAMP                    3
#define CCC_RECLAMP                    4
#define CCC_PROCESS_START            5
#define CCC_PROCESS_START_BY_COUNT    6
#define CCC_PROCESS_PAUSE            7
#define CCC_PROCESS_RESUME            8
#define CCC_PROCESS_ABORT            9
#define CCC_PROCESS_CANCEL            10
#define CCC_PROCESS_END                11
#define CCC_ID_UPDATE                12
#define CCC_MAP_UPDATE                13
}
SourceCode/Bond/Servo/ServoDlg.cpp
@@ -241,6 +241,14 @@
                    }
                }
            }
            else if (RX_CODE_LOADPORT_INUSE == code) {
                SERVO::CLoadPort* pLoadPort = nullptr;
                if (pAny->getPtrValue("ptr", (void*&)pLoadPort)) {
                    //CPortConfigurationDlg dlg;
                    //dlg.setCurSelPort(pLoadPort->getIndex());
                    //dlg.DoModal();
                }
            }
            pAny->release();
        }, [&]() -> void {
SourceCode/Bond/Servo/resource.h
Binary files differ