mrDarker
2025-08-02 91632a114b5cf43f213626af1ad0382b75cc3899
1. 配方界面区分Master和设备列表
已修改2个文件
105 ■■■■ 文件已修改
SourceCode/Bond/Servo/PageRecipe.cpp 103 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/PageRecipe.h 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/PageRecipe.cpp
@@ -22,6 +22,51 @@
{
}
void CPageRecipe::InitListCtrlHeaderForMaster()
{
    m_listPPID.DeleteAllItems();
    while (m_listPPID.DeleteColumn(0));
    CString strIniFile, strItem;
    strIniFile.Format(_T("%s\\configuration.ini"), (LPTSTR)(LPCTSTR)theApp.m_strAppDir);
    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);
    }
    m_listPPID.InsertColumn(0, _T(""), LVCFMT_RIGHT, 0); // 隐藏列
    m_listPPID.InsertColumn(1, _T("No."), LVCFMT_LEFT, 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]);
    m_listPPID.InsertColumn(5, _T("Bonder2"), LVCFMT_LEFT, width[5]);
    m_listPPID.InsertColumn(6, _T("后烘冷却"), LVCFMT_LEFT, width[7]);
    m_listPPID.InsertColumn(7, _T("精度检查"), LVCFMT_LEFT, width[8]);
    m_listPPID.InsertColumn(8, _T("EFEM"), LVCFMT_LEFT, width[3]);
    m_listPPID.InsertColumn(9, _T("创建时间"), LVCFMT_LEFT, width[9]);
    m_listPPID.InsertColumn(10, _T("描述"), LVCFMT_LEFT, width[10]);
}
void CPageRecipe::InitListCtrlHeaderForDevice()
{
    m_listPPID.DeleteAllItems();
    while (m_listPPID.DeleteColumn(0));
    CString strIniFile, strItem;
    strIniFile.Format(_T("%s\\configuration.ini"), (LPCTSTR)theApp.m_strAppDir);
    int width[3] = { 0, 60, 150 };
    for (int i = 0; i < 3; i++) {
        strItem.Format(_T("Col_Device_%d_Width"), i);
        width[i] = GetPrivateProfileInt(_T("PageRecipeListCtrl"), strItem, width[i], strIniFile);
    }
    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]);
}
void CPageRecipe::UpdateRecipeByPPID(const CString& strPPID)
{
    if (strPPID.IsEmpty()) {
@@ -168,15 +213,6 @@
{
    CDialogEx::OnInitDialog();
    // 读出列宽
    CString strIniFile, strItem;
    strIniFile.Format(_T("%s\\configuration.ini"), (LPTSTR)(LPCTSTR)theApp.m_strAppDir);
    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);
    DWORD dwStyle = pListCtrl->GetExtendedStyle();
@@ -186,18 +222,7 @@
    HIMAGELIST imageList = ImageList_Create(24, 24, ILC_COLOR24, 1, 1);
    ListView_SetImageList(pListCtrl->GetSafeHwnd(), imageList, LVSIL_SMALL);
    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[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);
    InitListCtrlHeaderForMaster();
    // 获取所有数据
    auto vecData = RecipeManager::getInstance().getAllRecipes();
@@ -255,19 +280,37 @@
void CPageRecipe::OnDestroy()
{
    CDialogEx::OnDestroy();
    CComboBox* pComboBox = (CComboBox*)GetDlgItem(IDC_COMBO_EQUIPMENT);
    int nSel = pComboBox->GetCurSel();
    SERVO::CEquipment* pEq = (SERVO::CEquipment*)pComboBox->GetItemDataPtr(nSel);
    // 保存列宽
    CString strIniFile, strItem, strTemp;
    strIniFile.Format(_T("%s\\configuration.ini"), (LPTSTR)(LPCTSTR)theApp.m_strAppDir);
    strIniFile.Format(_T("%s\\configuration.ini"), (LPCTSTR)theApp.m_strAppDir);
    CHeaderCtrl* pHeader = m_listPPID.GetHeaderCtrl();
    if (!pHeader || pHeader->GetItemCount() == 0) {
        return;
    }
    for (int i = 0; i < pHeader->GetItemCount(); i++) {
        RECT rect;
        pHeader->GetItemRect(i, &rect);
        strItem.Format(_T("Col_%d_Width"), i);
        if (!pHeader->GetItemRect(i, &rect)) {
            continue;
        }
        if (pEq == nullptr) {
            strItem.Format(_T("Col_%d_Width"), i);
        }
        else {
            strItem.Format(_T("Col_Device_%d_Width"), i);
        }
        strTemp.Format(_T("%d"), rect.right - rect.left);
        WritePrivateProfileString("PageRecipeListCtrl", strItem, strTemp, strIniFile);
        WritePrivateProfileString(_T("PageRecipeListCtrl"), strItem, strTemp, strIniFile);
    }
    CDialogEx::OnDestroy();
}
void CPageRecipe::OnShowWindow(BOOL bShow, UINT nStatus)
@@ -293,6 +336,10 @@
                pComboBox->InsertString(i,
                    pEq[i] == nullptr ? _T("Master") : pEq[i]->getName().c_str());
                pComboBox->SetItemDataPtr(i, pEq[i]);
                if (pEq[i]) {
                    pEq[i]->masterRecipeListRequest(0, nullptr);
                }
            }
            pComboBox->SetCurSel(0);
        }
@@ -477,6 +524,7 @@
    int nEqSel = pComboBox->GetCurSel();
    int selectedCount = ListView_GetSelectedCount(m_listPPID.GetSafeHwnd());
    GetDlgItem(IDC_BUTTON_NEW)->EnableWindow(nEqSel == 0 && selectedCount > 0);
    GetDlgItem(IDC_BUTTON_MODIFY)->EnableWindow(nEqSel == 0 && selectedCount > 0);
    GetDlgItem(IDC_BUTTON_DELETE)->EnableWindow(nEqSel == 0 && selectedCount > 0);
    GetDlgItem(IDC_BUTTON_DELETE_ALL)->EnableWindow(nEqSel == 0 && selectedCount > 0);
@@ -488,6 +536,7 @@
    int nEqSel = pComboBox->GetCurSel();
    int selectedCount = ListView_GetSelectedCount(m_listPPID.GetSafeHwnd());
    GetDlgItem(IDC_BUTTON_NEW)->EnableWindow(nEqSel == 0 && selectedCount > 0);
    GetDlgItem(IDC_BUTTON_MODIFY)->EnableWindow(nEqSel == 0 && selectedCount > 0);
    GetDlgItem(IDC_BUTTON_DELETE)->EnableWindow(nEqSel == 0 && selectedCount > 0);
    GetDlgItem(IDC_BUTTON_DELETE_ALL)->EnableWindow(nEqSel == 0 && selectedCount > 0);
@@ -496,10 +545,12 @@
    SERVO::CEquipment* pEq = (SERVO::CEquipment*)pComboBox->GetItemDataPtr(nEqSel);
    if (pEq == nullptr) {
        InitListCtrlHeaderForMaster();
        auto vecData = RecipeManager::getInstance().getAllRecipes();
        FillDataToListCtrl(vecData);
    }
    else {
        InitListCtrlHeaderForDevice();
        SERVO::CRecipeList* pRecipeList = pEq->getRecipeList(0);
        FillRecipeListToListCtrl(pRecipeList);
    }
SourceCode/Bond/Servo/PageRecipe.h
@@ -13,6 +13,8 @@
    virtual ~CPageRecipe();
private:
    void InitListCtrlHeaderForMaster();
    void InitListCtrlHeaderForDevice();
    void UpdateRecipeByPPID(const CString& strPPID);
    void FillDataToListCtrl(const std::vector<RecipeInfo>& vecRecipe);
    void FillRecipeListToListCtrl(SERVO::CRecipeList* pList);