mrDarker
2025-09-05 51cabe7f277738039ed1a1efe93a72c475bb0915
Merge branch 'liuyang'
已修改4个文件
68 ■■■■ 文件已修改
SourceCode/Bond/Servo/PageRecipe.cpp 40 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/PageRecipe.h 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/RecipeDeviceBindDlg.cpp 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/RecipeManager.cpp 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/PageRecipe.cpp
@@ -38,7 +38,7 @@
    }
    m_listPPID.InsertColumn(0, _T(""), LVCFMT_RIGHT, 0); // 隐藏列
    m_listPPID.InsertColumn(1, _T("No."), LVCFMT_LEFT, width[1]);
    m_listPPID.InsertColumn(1, _T("No."), LVCFMT_CENTER, width[1]);
    m_listPPID.InsertColumn(2, _T("PPID"), LVCFMT_LEFT, width[2]);
    m_listPPID.InsertColumn(3, _T("真空烘烤"), LVCFMT_LEFT, width[6]);
    m_listPPID.InsertColumn(4, _T("Bonder1"), LVCFMT_LEFT, width[4]);
@@ -66,9 +66,9 @@
    m_listPPID.InsertColumn(0, _T(""), LVCFMT_RIGHT, width[0]);
    m_listPPID.InsertColumn(1, _T("No."), LVCFMT_CENTER, width[1]);
    m_listPPID.InsertColumn(2, _T("Recipe ID"), LVCFMT_CENTER, width[2]);
    m_listPPID.InsertColumn(3, _T("Recipe 名称"), LVCFMT_CENTER, width[3]);
    m_listPPID.InsertColumn(4, _T("Recipe 参数"), LVCFMT_CENTER, width[4]);
    m_listPPID.InsertColumn(2, _T("Recipe ID"), LVCFMT_LEFT, width[2]);
    m_listPPID.InsertColumn(3, _T("Recipe 名称"), LVCFMT_LEFT, width[3]);
    m_listPPID.InsertColumn(4, _T("Recipe 参数"), LVCFMT_LEFT, width[4]);
}
void CPageRecipe::UpdateRecipeByPPID(const CString& strPPID)
@@ -158,7 +158,7 @@
                str.Format(_T("%d"), recipe.vecDeviceList.at(j).nRecipeID);
            }
            else {
                str.Format(_T("%s"), CA2T(strRecipeName.c_str()));
                str.Format(_T("%s"), strRecipeName.c_str());
            }
    
            m_listPPID.SetItemText(i, j + 3, str);
@@ -196,7 +196,7 @@
        m_listPPID.SetItemText(index, 1, std::to_string(item.first).c_str());
        m_listPPID.SetItemText(index, 2, std::to_string(item.second).c_str());
        std::string strRecipeName = mgr.getDeviceRecipeName(pEq->getName(), item.second);
        std::string strRecipeName = mgr.getDeviceRecipeName(SanitizeName(pEq->getName()), item.second);
        m_listPPID.SetItemText(index, 3, strRecipeName.c_str());
        std::string strDescription;
@@ -208,7 +208,7 @@
        if (strRecipeName.empty()) {
            strRecipeName = std::to_string(item.second);
            mgr.addDeviceRecipe(pEq->getName(), item.second, strRecipeName, strDescription);
            mgr.addDeviceRecipe(SanitizeName(pEq->getName()), item.second, strRecipeName, strDescription);
        }
    }
@@ -483,7 +483,7 @@
            return;
        }
        if (RecipeManager::getInstance().updateDeviceRecipeName(pEq->getName(), _ttoi(strID), std::string(CT2A(strText)))) {
        if (RecipeManager::getInstance().updateDeviceRecipeName(SanitizeName(pEq->getName()), _ttoi(strID), std::string(CT2A(strText)))) {
            m_listPPID.SetItemText(nLine, 3, strText);
        }
    }
@@ -746,3 +746,27 @@
    return 0;
}
std::string CPageRecipe::SanitizeName(const std::string& name)
{
    std::string result;
    result.reserve(name.size());
    for (char c : name) {
        if (c == '(' || c == '(') {
            break;
        }
        unsigned char uc = static_cast<unsigned char>(c);
        if (std::isalnum(uc) || c == '_') {
            result.push_back(c);
        }
        else if (std::isspace(uc)) {
            continue;
        }
        else {
            result.push_back('_');
        }
    }
    return result;
}
SourceCode/Bond/Servo/PageRecipe.h
@@ -49,5 +49,7 @@
    DECLARE_MESSAGE_MAP()
private:
    std::string SanitizeName(const std::string& name);
    CListCtrlEx m_listPPID;
};
SourceCode/Bond/Servo/RecipeDeviceBindDlg.cpp
@@ -96,7 +96,14 @@
    for (const auto& pair : mapRecipeIds) {
        int nRecipeID = pair.second;
        std::string strRecipeName = RecipeManager::getInstance().getDeviceRecipeName(pEq->getName(), nRecipeID);
        std::string strDeviceName;
        for (const auto& dev : g_vecBindDevices) {
            if (dev.nDeviceID == pEq->getID()) {
                strDeviceName = dev.strDeviceName;
            }
        }
        std::string strRecipeName = RecipeManager::getInstance().getDeviceRecipeName(strDeviceName, nRecipeID);
        if (strRecipeName.empty()) {
            strRecipeName = std::to_string(nRecipeID);
        }
SourceCode/Bond/Servo/RecipeManager.cpp
@@ -491,7 +491,10 @@
        << "recipe_name TEXT NOT NULL,"
        << "recipe_para TEXT NOT NULL"
        << ");";
    m_pDB->executeQuery(sql.str());
    bool bRet = m_pDB->executeQuery(sql.str());
    if (!bRet) {
        return false;
    }
    std::ostringstream ins;
    ins << "INSERT OR REPLACE INTO " << strDeviceName
@@ -610,13 +613,13 @@
    addRecipe(recipe);
    addDeviceRecipe("Bonder1", 101, "标准工艺", "");
    addDeviceRecipe("Bonder1", 102, "改良工艺", "");
    addDeviceRecipe("Bonder1", 103, "高速模式", "");
    addDeviceRecipe("Bonder1", 101, "标准工艺", "00");
    addDeviceRecipe("Bonder1", 102, "改良工艺", "00");
    addDeviceRecipe("Bonder1", 103, "高速模式", "00");
    addDeviceRecipe("Bonder2", 101, "标准工艺", "");
    addDeviceRecipe("Bonder2", 102, "改良工艺", "");
    addDeviceRecipe("Bonder2", 103, "高速模式", "");
    addDeviceRecipe("Bonder2", 101, "标准工艺", "00");
    addDeviceRecipe("Bonder2", 102, "改良工艺", "00");
    addDeviceRecipe("Bonder2", 103, "高速模式", "00");
}
bool RecipeManager::readRecipeFile(const std::string& filename) {