| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // DeviceRecipeParamDlg.cpp: å®ç°æä»¶ |
| | | // |
| | | |
| | | #include "stdafx.h" |
| | | #include "Servo.h" |
| | | #include "afxdialogex.h" |
| | | #include "DeviceRecipeParamDlg.h" |
| | | |
| | | |
| | | // CDeviceRecipeParamDlg å¯¹è¯æ¡ |
| | | |
| | | IMPLEMENT_DYNAMIC(CDeviceRecipeParamDlg, CDialogEx) |
| | | |
| | | CDeviceRecipeParamDlg::CDeviceRecipeParamDlg(CWnd* pParent /*=nullptr*/) |
| | | : CDialogEx(IDD_DIALOG_DEVICE_RECIPE_PARAM, pParent) |
| | | { |
| | | m_pEquipment = nullptr; |
| | | m_nDeviceRecipeID = 0; |
| | | m_strDeviceRecipeName = _T(""); |
| | | } |
| | | |
| | | CDeviceRecipeParamDlg::~CDeviceRecipeParamDlg() |
| | | { |
| | | } |
| | | |
| | | void CDeviceRecipeParamDlg::setEquipment(SERVO::CEquipment* pEquipment) |
| | | { |
| | | m_pEquipment = pEquipment; |
| | | } |
| | | |
| | | void CDeviceRecipeParamDlg::setDeviceRecipeID(int nDeviceRecipeID) |
| | | { |
| | | m_nDeviceRecipeID = nDeviceRecipeID; |
| | | } |
| | | |
| | | void CDeviceRecipeParamDlg::setDeviceRecipeName(const CString& strDeviceRecipeName) |
| | | { |
| | | m_strDeviceRecipeName = strDeviceRecipeName; |
| | | } |
| | | |
| | | void CDeviceRecipeParamDlg::DoDataExchange(CDataExchange* pDX) |
| | | { |
| | | CDialogEx::DoDataExchange(pDX); |
| | | DDX_Control(pDX, IDC_LIST_RECIPE_PARAM, m_wndRecipeParamList); |
| | | } |
| | | |
| | | |
| | | BEGIN_MESSAGE_MAP(CDeviceRecipeParamDlg, CDialogEx) |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | | // CDeviceRecipeParamDlg æ¶æ¯å¤çç¨åº |
| | | |
| | | BOOL CDeviceRecipeParamDlg::OnInitDialog() |
| | | { |
| | | CDialogEx::OnInitDialog(); |
| | | |
| | | // TODO: 卿¤æ·»å é¢å¤çåå§å |
| | | CRect rc; |
| | | m_wndRecipeParamList.GetClientRect(&rc); |
| | | int nColWidth = rc.Width() / 2; |
| | | m_wndRecipeParamList.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES); |
| | | m_wndRecipeParamList.InsertColumn(0, _T("åæ°å"), LVCFMT_LEFT, nColWidth); |
| | | m_wndRecipeParamList.InsertColumn(1, _T("åæ°å¼"), LVCFMT_LEFT, nColWidth); |
| | | |
| | | if (nullptr == m_pEquipment) { |
| | | return FALSE; |
| | | } |
| | | |
| | | CString strTitle; |
| | | if (!m_strDeviceRecipeName.IsEmpty()) { |
| | | strTitle.Format(_T("%s - %s é
æ¹åæ°"), m_pEquipment->getName().c_str(), m_strDeviceRecipeName); |
| | | } |
| | | else { |
| | | strTitle.Format(_T("%s é
æ¹åæ°"), m_pEquipment->getName().c_str()); |
| | | } |
| | | SetWindowText(strTitle); |
| | | |
| | | SERVO::CRecipeList* pRecipeList = m_pEquipment->getRecipeList(0); |
| | | ASSERT(pRecipeList); |
| | | auto rawDatas = pRecipeList->getParamsRawData(); |
| | | for (auto item : rawDatas) { |
| | | if (m_nDeviceRecipeID != 0 && item.first != m_nDeviceRecipeID) { |
| | | continue; |
| | | } |
| | | |
| | | std::vector<CParam> params; |
| | | m_pEquipment->parsingParams((const char*)item.second.data(), item.second.size(), params); |
| | | for (auto p : params) { |
| | | CString strName(p.getName().c_str()); |
| | | CString strValue; |
| | | |
| | | switch (p.getValueType()) { |
| | | case PVT_INT: |
| | | strValue.Format(_T("%d"), p.getIntValue()); |
| | | break; |
| | | case PVT_DOUBLE: |
| | | strValue.Format(_T("%.6f"), p.getDoubleValue()); |
| | | break; |
| | | default: |
| | | strValue = _T("æªç¥ç±»å"); |
| | | break; |
| | | } |
| | | |
| | | int nCount = m_wndRecipeParamList.GetItemCount(); |
| | | int nIndex = m_wndRecipeParamList.InsertItem(nCount, strName); |
| | | m_wndRecipeParamList.SetItemText(nIndex, 1, strValue); |
| | | } |
| | | } |
| | | |
| | | return TRUE; // return TRUE unless you set the focus to a control |
| | | // å¼å¸¸: OCX 屿§é¡µåºè¿å FALSE |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | #include "afxdialogex.h" |
| | | |
| | | |
| | | // CDeviceRecipeParamDlg å¯¹è¯æ¡ |
| | | |
| | | class CDeviceRecipeParamDlg : public CDialogEx |
| | | { |
| | | DECLARE_DYNAMIC(CDeviceRecipeParamDlg) |
| | | |
| | | public: |
| | | CDeviceRecipeParamDlg(CWnd* pParent = nullptr); // æ åæé 彿° |
| | | virtual ~CDeviceRecipeParamDlg(); |
| | | |
| | | void setEquipment(SERVO::CEquipment* pEquipment); |
| | | void setDeviceRecipeID(int nDeviceRecipeID); |
| | | void setDeviceRecipeName(const CString& strDeviceRecipeName); |
| | | |
| | | // å¯¹è¯æ¡æ°æ® |
| | | #ifdef AFX_DESIGN_TIME |
| | | enum { IDD = IDD_DIALOG_DEVICE_RECIPE_PARAM }; |
| | | #endif |
| | | |
| | | protected: |
| | | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV æ¯æ |
| | | virtual BOOL OnInitDialog(); |
| | | DECLARE_MESSAGE_MAP() |
| | | |
| | | private: |
| | | int m_nDeviceRecipeID; |
| | | CString m_strDeviceRecipeName; |
| | | SERVO::CEquipment* m_pEquipment; |
| | | CListCtrl m_wndRecipeParamList; |
| | | }; |
| | |
| | | #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; |
| | |
| | | |
| | | 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); |
| | | } |
| | | } |
| | | |
| | |
| | | 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); |
| | | } |
| | | } |
| | |
| | | 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; |
| | | } |
| | |
| | | DECLARE_MESSAGE_MAP() |
| | | |
| | | private: |
| | | std::string SanitizeName(const std::string& name); |
| | | |
| | | CListCtrlEx m_listPPID; |
| | | }; |
| | |
| | | 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); |
| | | } |
| | |
| | | << "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 |
| | |
| | | |
| | | 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) { |
| | |
| | | <ClInclude Include="CRobotTaskDlg.h" /> |
| | | <ClInclude Include="CSVData.h" /> |
| | | <ClInclude Include="CVariable.h" /> |
| | | <ClInclude Include="DeviceRecipeParamDlg.h" /> |
| | | <ClInclude Include="GlassJson.h" /> |
| | | <ClInclude Include="GridControl\CellRange.h" /> |
| | | <ClInclude Include="GridControl\GridCell.h" /> |
| | |
| | | <ClCompile Include="CRobotTaskDlg.cpp" /> |
| | | <ClCompile Include="CSVData.cpp" /> |
| | | <ClCompile Include="CVariable.cpp" /> |
| | | <ClCompile Include="DeviceRecipeParamDlg.cpp" /> |
| | | <ClCompile Include="GlassJson.cpp" /> |
| | | <ClCompile Include="GridControl\GridCell.cpp" /> |
| | | <ClCompile Include="GridControl\GridCellBase.cpp" /> |
| | |
| | | <ClCompile Include="..\jsoncpp\lib_json\json_writer.cpp"> |
| | | <Filter>JsonCpp</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="DeviceRecipeParamDlg.cpp" /> |
| | | <ClCompile Include="CSVData.cpp" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | |
| | | <ClInclude Include="..\jsoncpp\lib_json\json_batchallocator.h"> |
| | | <Filter>JsonCpp</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="DeviceRecipeParamDlg.h" /> |
| | | <ClInclude Include="CSVData.h" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |