From 62bec5118f5e5fe750017cf2f12d4a428ab092df Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期三, 17 九月 2025 18:06:30 +0800
Subject: [PATCH] 1.继续CControlJobManagerDlg的功能实现;
---
SourceCode/Bond/Servo/PageRobotCmd.cpp | 156 +++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 135 insertions(+), 21 deletions(-)
diff --git a/SourceCode/Bond/Servo/PageRobotCmd.cpp b/SourceCode/Bond/Servo/PageRobotCmd.cpp
index bd89ce1..c498aa2 100644
--- a/SourceCode/Bond/Servo/PageRobotCmd.cpp
+++ b/SourceCode/Bond/Servo/PageRobotCmd.cpp
@@ -10,19 +10,32 @@
// CPageRobotCmd 瀵硅瘽妗�
std::map<CString, int> g_deviceSlotCount = {
- {_T("PORT 1"), 1},
- {_T("PORT 2"), 1},
- {_T("PORT 3"), 1},
- {_T("PORT 4"), 1},
+ {_T("PORT 1"), 8},
+ {_T("PORT 2"), 8},
+ {_T("PORT 3"), 8},
+ {_T("PORT 4"), 8},
{_T("RB1"), 1},
{_T("RB2"), 1},
{_T("ALIGN"), 1},
{_T("FLIP"), 1},
- {_T("VAC BAKE"), 2},
+ {_T("VAC BAKE"), 4},
{_T("BONDER1"), 2},
{_T("BONDER2"), 2},
- {_T("POST BAKE(COOLING)"), 4},
+ {_T("POST BAKE(COOLING)"), 2},
{_T("MEASUREMENT"), 1}
+};
+
+static const std::map < SERVO:: RCMD, RCMDFieldMask > g_cmdFieldMap = {
+ { SERVO::RCMD::Robot_home, { false, false, false, false, false, false } },
+ { SERVO::RCMD::Transfer, { true, true, true, true, true, false } },
+ { SERVO::RCMD::Move, { true, true, true, true, true, true } },
+ { SERVO::RCMD::Get, { true, true, false, true, false, false } },
+ { SERVO::RCMD::Put, { true, false, true, false, true, false } },
+ { SERVO::RCMD::One_Action_Exchange, { true, true, true, true, true, false } },
+ { SERVO::RCMD::Two_Action_Exchange, { true, true, true, true, true, false } },
+ { SERVO::RCMD::Command_Clear, { false, false, false, false, false, false } },
+ { SERVO::RCMD::Batch_get, { false, true, false, true, false, false } },
+ { SERVO::RCMD::Batch_put, { false, false, true, false, true, false } }
};
IMPLEMENT_DYNAMIC(CPageRobotCmd, CDialogEx)
@@ -55,22 +68,67 @@
}
}
-SERVO::ROBOT_CMD_PARAM CPageRobotCmd::GetRobotCmdParam()
+BOOL CPageRobotCmd::SetControlsEnabled(BOOL bEnable)
{
- // 绐楀彛閿�姣佹椂涓嶅彲鐢�
- if (IsWindow(m_hWnd)) {
- UpdateData(TRUE); // 鍚屾鎴愬憳鍙橀噺鍒扮晫闈�
+ if (!IsWindow(m_hWnd)) {
+ return FALSE;
}
- SERVO::ROBOT_CMD_PARAM param;
+ if (bEnable) {
+ UpdateData(TRUE);
+ UpdateInputUI(static_cast<SERVO::RCMD>(m_nRcmd + 1));
+ }
+ else {
+ // 閬嶅巻鎵�鏈夊瓙鎺т欢骞惰缃姸鎬�
+ CWnd* pChild = GetWindow(GW_CHILD);
+ while (pChild) {
+ pChild->EnableWindow(bEnable);
+ pChild = pChild->GetNextWindow();
+ }
+ }
+
+ return CDialogEx::EnableWindow(bEnable);
+}
+
+SERVO::ROBOT_CMD_PARAM CPageRobotCmd::GetRobotCmdParam()
+{
+ if (!IsWindow(m_hWnd)) {
+ return {};
+ }
+ UpdateData(TRUE); // 鍚屾 UI 鍒板彉閲�
+
+ SERVO::ROBOT_CMD_PARAM param = {};
param.sequenceNo = static_cast<short>(m_nSequenceNo);
param.rcmd = static_cast<short>(m_nRcmd + 1);
- param.armNo = static_cast<short>(m_nArmNo);
- param.getPosition = static_cast<short>(m_nGetPosition + 1);
- param.putPosition = static_cast<short>(m_nPutPosition + 1);
- param.getSlotNo = static_cast<short>(m_nGetSlotNo + 1);
- param.putSlotNo = static_cast<short>(m_nPutSlotNo + 1);
- param.subCmd = static_cast<short>(m_nSubCmd + 1);
+
+ const auto it = g_cmdFieldMap.find(static_cast<SERVO::RCMD>(param.rcmd));
+ if (it == g_cmdFieldMap.end()) {
+ return {};
+ }
+
+ const RCMDFieldMask& mask = it->second;
+ if (mask.useArm) param.armNo = static_cast<short>(m_nArmNo + 1);
+ if (mask.useGetPos) param.getPosition = static_cast<short>(m_nGetPosition + 1);
+ if (mask.usePutPos) param.putPosition = static_cast<short>(m_nPutPosition + 1);
+ if (mask.useGetSlot) param.getSlotNo = static_cast<short>(m_nGetSlotNo + 1);
+ if (mask.usePutSlot) param.putSlotNo = static_cast<short>(m_nPutSlotNo + 1);
+ if (mask.useSubCmd) param.subCmd = static_cast<short>(m_nSubCmd + 1);
+
+ // 鐗规畩鍛戒护澶勭悊
+ const auto enRcmd = static_cast<SERVO::RCMD>(m_nRcmd + 1);
+ if (SERVO::RCMD::Move == enRcmd) {
+ if (m_nSubCmd == 0) {
+ param.putPosition = 0;
+ param.putSlotNo = 0;
+ }
+ else if (m_nSubCmd == 1) {
+ param.getPosition = 0;
+ param.getSlotNo = 0;
+ }
+ }
+ else if (SERVO::RCMD::Batch_get == enRcmd || SERVO::RCMD::Batch_put == enRcmd) {
+ param.armNo = ARM_ALL;
+ }
return param;
}
@@ -90,8 +148,10 @@
BEGIN_MESSAGE_MAP(CPageRobotCmd, CDialogEx)
+ ON_CBN_SELCHANGE(IDC_COMBO_RCMD, &CPageRobotCmd::OnCbnSelchangeComboRcmd)
ON_CBN_SELCHANGE(IDC_COMBO_GET_POS, &CPageRobotCmd::OnCbnSelchangeComboGetPos)
ON_CBN_SELCHANGE(IDC_COMBO_PUT_POS, &CPageRobotCmd::OnCbnSelchangeComboPutPos)
+ ON_CBN_SELCHANGE(IDC_COMBO_SUB_CMD, &CPageRobotCmd::OnCbnSelchangeComboSubCmd)
END_MESSAGE_MAP()
@@ -154,22 +214,29 @@
pComboSubCmd->AddString(_T("2: Put Ready"));
pComboSubCmd->SetCurSel(0);
- // 鍒濆鍖栧崟閫夋
+ // 鍒濆鍖� ARM 鍗曢�夋
CButton* pRadioArmA = (CButton*)GetDlgItem(IDC_RADIO_ARM_A);
CButton* pRadioArmB = (CButton*)GetDlgItem(IDC_RADIO_ARM_B);
pRadioArmA->SetCheck(BST_CHECKED);
pRadioArmB->SetCheck(BST_UNCHECKED);
+ // 鍒濆鍖栬緭鍏ユ帶浠剁姸鎬�
+ UpdateInputUI(SERVO::RCMD::Robot_home);
+
return TRUE; // return TRUE unless you set the focus to a control
// 寮傚父: OCX 灞炴�ч〉搴旇繑鍥� FALSE
}
-
void CPageRobotCmd::UpdateSlotList(CComboBox* pComboDevice, CComboBox* pComboSlot)
{
- if (pComboDevice == nullptr || pComboSlot == nullptr) return;
+ if (pComboDevice == nullptr || pComboSlot == nullptr) {
+ return;
+ }
+
int nSelIndex = pComboDevice->GetCurSel();
- if (nSelIndex < 0) return;
+ if (nSelIndex < 0) {
+ return;
+ }
CString strDeviceName;
pComboDevice->GetLBText(nSelIndex, strDeviceName);
@@ -191,6 +258,48 @@
pComboSlot->SetCurSel(0);
}
+void CPageRobotCmd::UpdateMoveSubFields()
+{
+ UpdateData(TRUE);
+ if (SERVO::RCMD::Move == static_cast<SERVO::RCMD>(m_nRcmd + 1)) {
+ const bool bMoveToGet = (m_nSubCmd == 0); // Move to Get
+ const bool bMoveToPut = (m_nSubCmd == 1); // Move to Put
+
+ GetDlgItem(IDC_COMBO_GET_POS)->EnableWindow(bMoveToGet);
+ GetDlgItem(IDC_COMBO_GET_SLOT)->EnableWindow(bMoveToGet);
+ GetDlgItem(IDC_COMBO_PUT_POS)->EnableWindow(bMoveToPut);
+ GetDlgItem(IDC_COMBO_PUT_SLOT)->EnableWindow(bMoveToPut);
+ }
+}
+
+void CPageRobotCmd::UpdateInputUI(SERVO::RCMD cmd)
+{
+ const auto it = g_cmdFieldMap.find(cmd);
+ if (it == g_cmdFieldMap.end()) {
+ return;
+ }
+
+ const RCMDFieldMask& mask = it->second;
+ GetDlgItem(IDC_EDIT_SEQ_NO)->EnableWindow(TRUE);
+ GetDlgItem(IDC_COMBO_RCMD)->EnableWindow(TRUE);
+ GetDlgItem(IDC_RADIO_ARM_A)->EnableWindow(mask.useArm);
+ GetDlgItem(IDC_RADIO_ARM_B)->EnableWindow(mask.useArm);
+ GetDlgItem(IDC_COMBO_GET_POS)->EnableWindow(mask.useGetPos);
+ GetDlgItem(IDC_COMBO_PUT_POS)->EnableWindow(mask.usePutPos);
+ GetDlgItem(IDC_COMBO_GET_SLOT)->EnableWindow(mask.useGetSlot);
+ GetDlgItem(IDC_COMBO_PUT_SLOT)->EnableWindow(mask.usePutSlot);
+ GetDlgItem(IDC_COMBO_SUB_CMD)->EnableWindow(mask.useSubCmd);
+
+ // 鐗规畩澶勭悊 Move 绫诲瀷
+ UpdateMoveSubFields();
+}
+
+void CPageRobotCmd::OnCbnSelchangeComboRcmd()
+{
+ UpdateData(TRUE);
+ UpdateInputUI(static_cast<SERVO::RCMD>(m_nRcmd + 1));
+}
+
void CPageRobotCmd::OnCbnSelchangeComboGetPos()
{
CComboBox* pDevice = (CComboBox*)GetDlgItem(IDC_COMBO_GET_POS);
@@ -205,4 +314,9 @@
CComboBox* pDevice = (CComboBox*)GetDlgItem(IDC_COMBO_PUT_POS);
CComboBox* pSlot = (CComboBox*)GetDlgItem(IDC_COMBO_PUT_SLOT);
UpdateSlotList(pDevice, pSlot);
+}
+
+void CPageRobotCmd::OnCbnSelchangeComboSubCmd()
+{
+ UpdateMoveSubFields();
}
\ No newline at end of file
--
Gitblit v1.9.3