| | |
| | | CPortConfigurationDlg::CPortConfigurationDlg(CWnd* pParent /*=nullptr*/) |
| | | : CDialogEx(IDD_DIALOG_PORT_CONFIGURATION, pParent) |
| | | { |
| | | |
| | | // 初始化成员变量 |
| | | m_pPort[0] = dynamic_cast<SERVO::CLoadPort*>(theApp.m_model.m_master.getEquipment(EQ_ID_LOADPORT1)); |
| | | m_pPort[1] = dynamic_cast<SERVO::CLoadPort*>(theApp.m_model.m_master.getEquipment(EQ_ID_LOADPORT2)); |
| | | m_pPort[2] = dynamic_cast<SERVO::CLoadPort*>(theApp.m_model.m_master.getEquipment(EQ_ID_LOADPORT3)); |
| | | m_pPort[3] = dynamic_cast<SERVO::CLoadPort*>(theApp.m_model.m_master.getEquipment(EQ_ID_LOADPORT4)); |
| | | } |
| | | |
| | | CPortConfigurationDlg::~CPortConfigurationDlg() |
| | |
| | | return -1; // 未知端口 |
| | | } |
| | | |
| | | void CPortConfigurationDlg::LoadPortConfigToUI(SERVO::CLoadPort* pPort) |
| | | { |
| | | if (!pPort) { |
| | | return; |
| | | } |
| | | |
| | | SetDlgItemText(IDC_EDIT_LOTID, ""); |
| | | SetDlgItemText(IDC_EDIT_PRODUCTID, ""); |
| | | SetDlgItemText(IDC_EDIT_OPERATIONID, ""); |
| | | m_comboMaterialsType.SetCurSel(0); |
| | | |
| | | bool bJobInfoSet = false; |
| | | for (int i = 0; i < SLOT_MAX; ++i) { |
| | | SERVO::CSlot* pSlot = pPort->getSlot(i); |
| | | if (!pSlot) { |
| | | continue; |
| | | } |
| | | |
| | | SERVO::CGlass* pGlass = dynamic_cast<SERVO::CGlass*>(pSlot->getContext()); |
| | | int nRow = i + 1; |
| | | |
| | | // 设置 Panel ID 和勾选框 |
| | | CGridCellCheck* pCheck = static_cast<CGridCellCheck*>(m_wndGrid.GetCell(nRow, 1)); |
| | | if (pCheck && pGlass) { |
| | | pCheck->SetCheck(pSlot->isEnable() ? TRUE : FALSE); |
| | | pCheck->SetText(pGlass ? pGlass->getID().c_str() : _T("")); |
| | | } |
| | | else { |
| | | pCheck->SetCheck(FALSE); |
| | | pCheck->SetText(_T("")); |
| | | } |
| | | |
| | | // 回填 Job 信息(只取第一个有效 Glass) |
| | | if (!bJobInfoSet && pGlass) { |
| | | SERVO::CJobDataS* pJS = pGlass->getJobDataS(); |
| | | if (pJS) { |
| | | SetDlgItemText(IDC_EDIT_LOTID, CString(pJS->getLotId().c_str())); |
| | | SetDlgItemText(IDC_EDIT_PRODUCTID, CString(pJS->getProductId().c_str())); |
| | | SetDlgItemText(IDC_EDIT_OPERATIONID, CString(pJS->getOperationId().c_str())); |
| | | m_comboMaterialsType.SetCurSel(pJS->getMaterialsType() - 1); |
| | | bJobInfoSet = true; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | void CPortConfigurationDlg::InitGrid() |
| | | { |
| | | if (m_wndGrid.GetSafeHwnd() == NULL) { |
| | |
| | | |
| | | const int nCols = 2; |
| | | const int nFixRows = 1; |
| | | const int nRows = 9; |
| | | const int nRows = SLOT_MAX + 1; // 存在表头,所以 +1 |
| | | |
| | | int nColIdx = 0; |
| | | m_wndGrid.DeleteAllItems(); |
| | |
| | | // 设置列宽 |
| | | m_wndGrid.SetColumnWidth(nColIdx, 50); |
| | | m_wndGrid.SetItemText(0, nColIdx++, _T("Slot ID")); |
| | | m_wndGrid.SetColumnWidth(nColIdx, 150); |
| | | m_wndGrid.SetItemText(0, nColIdx++, _T("Panel ID")); |
| | | m_wndGrid.SetColumnWidth(nColIdx, 60); |
| | | m_wndGrid.SetItemText(0, nColIdx++, _T("启用")); |
| | | |
| | |
| | | |
| | | |
| | | BEGIN_MESSAGE_MAP(CPortConfigurationDlg, CDialogEx) |
| | | ON_CBN_SELCHANGE(IDC_COMBO_PORT, &CPortConfigurationDlg::OnSelchangeComboPort) |
| | | ON_BN_CLICKED(IDC_BUTTON_APPLY, &CPortConfigurationDlg::OnBnClickedButtonApply) |
| | | END_MESSAGE_MAP() |
| | | |
| | |
| | | |
| | | InitGrid(); |
| | | |
| | | LoadPortConfigToUI(m_pPort[0]); // 默认加载第一个端口的配置 |
| | | |
| | | // 设置对话框标题 |
| | | SetWindowText(_T("Port Configuration")); |
| | | |
| | | return TRUE; // return TRUE unless you set the focus to a control |
| | | // 异常: OCX 属性页应返回 FALSE |
| | | } |
| | | |
| | | void CPortConfigurationDlg::OnSelchangeComboPort() |
| | | { |
| | | // TODO: 在此添加控件通知处理程序代码 |
| | | int selPort = m_comboPort.GetCurSel(); |
| | | if (selPort < 0 || selPort >= 4) { |
| | | return; // 无效选择 |
| | | } |
| | | |
| | | // 加载选中端口的配置到 UI |
| | | LoadPortConfigToUI(m_pPort[selPort]); |
| | | } |
| | | |
| | | void CPortConfigurationDlg::OnBnClickedButtonApply() |
| | | { |
| | | // TODO: 在此添加控件通知处理程序代码 |