mrDarker
2025-05-14 0d2da4a2507a5a8d34bf7f736727917d791df0d2
SourceCode/Bond/Servo/PageRecipe.cpp
@@ -32,15 +32,21 @@
   pListCtrl->DeleteAllItems();
   // 遍历数据并插入到CListCtrl中
   int nIndex = 0;
   for (const auto& row : vecData) {
      int nNewItem = pListCtrl->InsertItem(nIndex, _T(""));
   for (int i = 0; i < static_cast<int>(vecData.size()); ++i) {
      // 插入行
      pListCtrl->InsertItem(i, _T(""));
      CString str;
      str.Format(_T("%d"), nIndex++);
      pListCtrl->SetItemText(nNewItem, 1, str); // Recipe No
      str.Format(_T("%s"), row.c_str());
      pListCtrl->SetItemText(nNewItem, 2, str); // PPID
      // 设置 Recipe No(第1列)
      CString strRecipeNo;
      strRecipeNo.Format(_T("%d"), i);
      pListCtrl->SetItemText(i, 1, strRecipeNo);
      // 设置 PPID(第2列)
      CString strPPID = CA2T(vecData[i].c_str());
      if (strPPID.CompareNoCase(_T("NULL")) == 0) {
         strPPID.Empty();
      }
      pListCtrl->SetItemText(i, 2, strPPID);
   }
   // 获取列数
@@ -147,18 +153,13 @@
void CPageRecipe::OnBnClickedButtonSave()
{
   // TODO: 在此添加控件通知处理程序代码
   std::vector<std::string> vecPPID;
   int nCount = m_listPPID.GetItemCount();
   for (int i = 0; i < nCount; ++i) {
      std::string strPPID = CT2A(m_listPPID.GetItemText(i, 2));
      SECSRuntimeManager::getInstance().updatePPIDForRecipe(i, strPPID);
      CString str = m_listPPID.GetItemText(i, 2);
      vecPPID.emplace_back(CT2A(str));
   }
   //if (!SECSRuntimeManager::getInstance().saveAllPPID(vecData)) {
   //   AfxMessageBox(_T("保存失败"));
   //}
   //else {
   //   AfxMessageBox(_T("保存成功"));
   //}
   SECSRuntimeManager::getInstance().setAllPPID(vecPPID);
}
void CPageRecipe::OnBnClickedButtonRefresh()