LAPTOP-T815PCOQ\25526
2024-11-25 6365b1d493ca23688fa1fb9a8fc51513dc6bb6d8
SourceCode/Bond/BondEq/View/AxisSettingsDlg.cpp
@@ -190,6 +190,19 @@
   label.UpdateWindow();            // 立即刷新
}
int CAxisSettingsDlg::getCurrentSelectedAxisID()
{
   int currentIndex = m_comboAxisNO.GetCurSel();
   if (currentIndex == CB_ERR) {
      AfxMessageBox(_T("请选择一个有效的轴编号!"));
      return -1;
   }
   CString axisIDStr;
   m_comboAxisNO.GetLBText(currentIndex, axisIDStr);
   return _ttoi(axisIDStr);
}
void CAxisSettingsDlg::initializeAxisIDCombo()
{
   // 获取所有轴的轴NO
@@ -214,15 +227,7 @@
void CAxisSettingsDlg::refreshAxisDetails()
{
   // 获取当前选中的轴ID
   int currentIndex = m_comboAxisNO.GetCurSel();
   if (currentIndex == CB_ERR) {
      AfxMessageBox(_T("请选择一个有效的轴编号!"));
      return;
   }
   CString axisIDStr;
   m_comboAxisNO.GetLBText(currentIndex, axisIDStr);
   int axisId = _ttoi(axisIDStr);
   int axisId = getCurrentSelectedAxisID();
   // 获取轴信息
   auto axisDetails = AxisManager::getInstance().getAxis(axisId);
@@ -255,15 +260,7 @@
   const int pageSize = 5;
   // 获取当前选中的轴ID
   int currentIndex = m_comboAxisNO.GetCurSel();
   if (currentIndex == CB_ERR) {
      AfxMessageBox(_T("请选择一个有效的轴编号!"));
      return;
   }
   CString axisIDStr;
   m_comboAxisNO.GetLBText(currentIndex, axisIDStr);
   int axisId = _ttoi(axisIDStr);
   int axisId = getCurrentSelectedAxisID();
   // 获取定位点数据
   auto positions = AxisManager::getInstance().getPositions(axisId, pageNumber, pageSize);
@@ -311,6 +308,27 @@
         if (pPosition) pPosition->SetWindowText(_T(""));
      }
   }
}
void CAxisSettingsDlg::updateAxisSelection(int offset)
{
   int currentIndex = m_comboAxisNO.GetCurSel();
   if (currentIndex == CB_ERR) {
      AfxMessageBox(_T("请选择一个有效的轴编号!"));
      return;
   }
   int newIndex = currentIndex + offset;
   if (newIndex < 0 || newIndex >= m_comboAxisNO.GetCount()) {
      CString error;
      error.Format(_T("已经到达%s一个轴!"), offset < 0 ? _T("上") : _T("下"));
      AfxMessageBox(error);
      return;
   }
   m_comboAxisNO.SetCurSel(newIndex);
   refreshAxisDetails();
   refreshPositionDetails(1);
}
BEGIN_MESSAGE_MAP(CAxisSettingsDlg, CDialogEx)
@@ -465,11 +483,27 @@
void CAxisSettingsDlg::OnBnClickedButtonAxisLast()
{
   // TODO: 在此添加控件通知处理程序代码
   try {
      updateAxisSelection(-1);
   }
   catch (const std::exception& ex) {
      CString errorMsg;
      errorMsg.Format(_T("获取下一个轴失败:%s"), CString(ex.what()));
      AfxMessageBox(errorMsg, MB_ICONERROR);
   }
}
void CAxisSettingsDlg::OnBnClickedButtonAxisNext()
{
   // TODO: 在此添加控件通知处理程序代码
   try {
      updateAxisSelection(1);
   }
   catch (const std::exception& ex) {
      CString errorMsg;
      errorMsg.Format(_T("获取上一个轴失败:%s"), CString(ex.what()));
      AfxMessageBox(errorMsg, MB_ICONERROR);
   }
}
void CAxisSettingsDlg::OnBnClickedButtonAxisAnchorPointGroup1()