| | |
| | | #include "MsgDlg.h" |
| | | #include "InputDialog.h" |
| | | #include "RecipeDeviceBindDlg.h" |
| | | #include "DeviceRecipeParamDlg.h" |
| | | |
| | | |
| | | // CPageRecipe 对话框 |
| | |
| | | } |
| | | |
| | | 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]); |
| | |
| | | |
| | | 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) |
| | |
| | | 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); |
| | |
| | | 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; |
| | | auto iter = rawDatas.find(item.second); |
| | | if (iter != rawDatas.end()) { |
| | | std::string strDescription; |
| | | pEq->parsingParams((const char*)iter->second.data(), iter->second.size(), strDescription); |
| | | m_listPPID.SetItemText(index, 4, strDescription.c_str()); |
| | | } |
| | | |
| | | if (strRecipeName.empty()) { |
| | | strRecipeName = std::to_string(item.second); |
| | | mgr.addDeviceRecipe(pEq->getName(), item.second, strRecipeName); |
| | | mgr.addDeviceRecipe(SanitizeName(pEq->getName()), item.second, strRecipeName, strDescription); |
| | | } |
| | | } |
| | | |
| | |
| | | AfxMessageBox(_T("配方名称不能为空!")); |
| | | return; |
| | | } |
| | | if (RecipeManager::getInstance().updateDeviceRecipe(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); |
| | | } |
| | | } |
| | |
| | | return; |
| | | } |
| | | |
| | | CString strText = m_listPPID.GetItemText(nItem, 2); |
| | | CString strRecipeID = m_listPPID.GetItemText(nItem, 2); |
| | | CString strRecipeName = m_listPPID.GetItemText(nItem, 3); |
| | | CComboBox* pComboBox = (CComboBox*)GetDlgItem(IDC_COMBO_EQUIPMENT); |
| | | int nEqSel = pComboBox->GetCurSel(); |
| | | if (nEqSel == CB_ERR) { |
| | | return; |
| | | } |
| | | |
| | | int nRecipeID = _ttoi(strRecipeID); |
| | | SERVO::CEquipment* pEq = (SERVO::CEquipment*)pComboBox->GetItemDataPtr(nEqSel); |
| | | if (pEq == nullptr) { |
| | | return; |
| | | } |
| | | |
| | | CDeviceRecipeParamDlg dlg(this); |
| | | dlg.setDeviceRecipeID(nRecipeID); |
| | | dlg.setDeviceRecipeName(strRecipeName); |
| | | dlg.setEquipment(pEq); |
| | | dlg.DoModal(); |
| | | } |
| | | |
| | | void CPageRecipe::OnCbnSelchangeComboEquipment() |
| | |
| | | |
| | | 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; |
| | | } |
| | | |
| | | BOOL CPageRecipe::PreTranslateMessage(MSG* pMsg) |
| | | { |
| | | if (pMsg->wParam == VK_RETURN || pMsg->wParam == VK_ESCAPE) { |
| | | return TRUE; |
| | | } |
| | | |
| | | return CDialogEx::PreTranslateMessage(pMsg); |
| | | } |