| | |
| | | { |
| | | } |
| | | |
| | | 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[] = { 0, 60, 150, 150 }; |
| | | |
| | | for (int i = 0; i < 4; 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]); |
| | | m_listPPID.InsertColumn(3, _T("Recipe 名称"), LVCFMT_CENTER, width[3]); |
| | | } |
| | | |
| | | void CPageRecipe::UpdateRecipeByPPID(const CString& strPPID) |
| | | { |
| | | if (strPPID.IsEmpty()) { |
| | |
| | | { |
| | | 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(); |
| | |
| | | |
| | | 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(); |
| | |
| | | |
| | | 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) |
| | |
| | | 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); |
| | | } |
| | |
| | | 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); |
| | |
| | | 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); |
| | |
| | | |
| | | 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); |
| | | } |