| | |
| | | #include "RecipeManager.h" |
| | | |
| | | |
| | | UINT btnID[] = { IDC_BUTTON_PORT1_PROCESS_START, |
| | | IDC_BUTTON_PORT2_PROCESS_START, |
| | | IDC_BUTTON_PORT3_PROCESS_START, |
| | | IDC_BUTTON_PORT4_PROCESS_START }; |
| | | |
| | | namespace { |
| | | void BuildCassetteCtrlMaps(SERVO::CLoadPort* pPort, short (&jobExistence)[12], short& slotProcess) |
| | | { |
| | | slotProcess = 0; |
| | | bool anyScheduled = false; |
| | | |
| | | // Prefer hardware scan map for job existence (first 16 slots). |
| | | const short scanMap = pPort->getScanCassetteMap(); |
| | | if (scanMap != 0) { |
| | | jobExistence[0] = scanMap; |
| | | } |
| | | |
| | | const int maxSlots = 12 * 16; |
| | | const int totalSlots = (SLOT_MAX < maxSlots) ? SLOT_MAX : maxSlots; |
| | | for (int slot = 1; slot <= totalSlots; ++slot) { |
| | | SERVO::CGlass* pGlass = pPort->getGlassFromSlot(slot); |
| | | if (pGlass == nullptr) continue; |
| | | |
| | | const int wordIndex = (slot - 1) / 16; |
| | | const int bitIndex = (slot - 1) % 16; |
| | | jobExistence[wordIndex] = (short)(jobExistence[wordIndex] | (1 << bitIndex)); |
| | | |
| | | if (slot <= 16 && pGlass->isScheduledForProcessing()) { |
| | | slotProcess = (short)(slotProcess | (1 << bitIndex)); |
| | | anyScheduled = true; |
| | | } |
| | | } |
| | | |
| | | if (!anyScheduled) { |
| | | slotProcess = jobExistence[0]; |
| | | } |
| | | } |
| | | } |
| | | |
| | | // CPjPage1 对话框 |
| | | |
| | | IMPLEMENT_DYNAMIC(CCjPage2, CCjPageBase) |
| | |
| | | ON_BN_CLICKED(IDC_RADIO4, &CCjPage2::OnBnClickedRadio4) |
| | | ON_NOTIFY(CSGN_SEL_CHANGED, IDC_GRID1, &CCjPage2::OnGridSelChanged) |
| | | ON_NOTIFY(CSGN_MAT_CHANGED, IDC_GRID1, &CCjPage2::OnGridMatChanged) |
| | | ON_BN_CLICKED(IDC_BUTTON_PORT1_PROCESS_START, &CCjPage2::OnBnClickedButtonPort1ProcessStart) |
| | | ON_BN_CLICKED(IDC_BUTTON_PORT2_PROCESS_START, &CCjPage2::OnBnClickedButtonPort2ProcessStart) |
| | | ON_BN_CLICKED(IDC_BUTTON_PORT3_PROCESS_START, &CCjPage2::OnBnClickedButtonPort3ProcessStart) |
| | | ON_BN_CLICKED(IDC_BUTTON_PORT4_PROCESS_START, &CCjPage2::OnBnClickedButtonPort4ProcessStart) |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | |
| | | m_grid.SetPortInfo(3, _T("Port 4"), _T("")); |
| | | |
| | | |
| | | // 测试数据 |
| | | char szBuffer[256]; |
| | | for (int port = 0; port < 4; port++) { |
| | | for (int slot = 0; slot < 8; slot++) { |
| | | sprintf_s(szBuffer, 256, "Gls%04d%04d", port + 1, slot + 1); |
| | | m_grid.SetSlotGlass(port, slot, TRUE, szBuffer, CCarrierSlotGrid::MAT_G1); |
| | | } |
| | | } |
| | | |
| | | UpdatePjData(); |
| | | |
| | | |
| | |
| | | pItem->GetWindowRect(&rcItem); |
| | | ScreenToClient(rcItem); |
| | | |
| | | |
| | | int x = rcItem.left + 100 + 18; |
| | | int y = 100; |
| | | |
| | | |
| | | // 让控件窗口尺寸自动匹配当前列宽/行数(不出现滚动条) |
| | | if (::IsWindow(m_grid.m_hWnd)) { |
| | | CSize best = m_grid.CalcBestWindowSize(TRUE, -1, 2, 2); |
| | | pItem->MoveWindow(rcItem.left, rcItem.top, best.cx, best.cy); |
| | | pItem->Invalidate(); |
| | | pItem->GetWindowRect(&rcItem); |
| | | ScreenToClient(rcItem); |
| | | y = rcItem.bottom; |
| | | y += 18; |
| | | } |
| | | |
| | | pItem = GetDlgItem(IDC_BUTTON_PORT1_PROCESS_START); |
| | | pItem->GetWindowRect(&rcItem); |
| | | pItem->MoveWindow(x, y, rcItem.Width(), rcItem.Height()); |
| | | x += 220; |
| | | |
| | | pItem = GetDlgItem(IDC_BUTTON_PORT2_PROCESS_START); |
| | | pItem->GetWindowRect(&rcItem); |
| | | pItem->MoveWindow(x, y, rcItem.Width(), rcItem.Height()); |
| | | x += 220; |
| | | |
| | | pItem = GetDlgItem(IDC_BUTTON_PORT3_PROCESS_START); |
| | | pItem->GetWindowRect(&rcItem); |
| | | pItem->MoveWindow(x, y, rcItem.Width(), rcItem.Height()); |
| | | x += 220; |
| | | |
| | | pItem = GetDlgItem(IDC_BUTTON_PORT4_PROCESS_START); |
| | | pItem->GetWindowRect(&rcItem); |
| | | pItem->MoveWindow(x, y, rcItem.Width(), rcItem.Height()); |
| | | x += 220; |
| | | } |
| | | |
| | | int CCjPage2::OnApply() |
| | |
| | | pButton->EnableWindow(enable[i]); |
| | | |
| | | m_grid.SetPortAllocated(i, !checked[i], _T("")); |
| | | GetDlgItem(btnID[i])->EnableWindow(checked[i]); |
| | | } |
| | | |
| | | |
| | | // 读取出真实数据 |
| | | auto& master = theApp.m_model.getMaster(); |
| | | int EQID[] = {EQ_ID_LOADPORT1, EQ_ID_LOADPORT2, EQ_ID_LOADPORT3, EQ_ID_LOADPORT4}; |
| | | for (int p = 0; p < 4; p++) { |
| | | SERVO::CLoadPort* pPort = (SERVO::CLoadPort*)master.getEquipment(EQID[p]); |
| | | m_grid.SetPortInfo(p, |
| | | (std::string("Port ") + std::to_string(p+1)).c_str(), |
| | | pPort->getCassetteId().c_str() |
| | | ); |
| | | for (int i = 0; i < SLOT_MAX; ++i) { |
| | | SERVO::CSlot* pSlot = pPort->getSlot(i); |
| | | if (!pSlot) { |
| | | continue; |
| | | } |
| | | |
| | | // 设置 Panel ID |
| | | SERVO::CGlass* pGlass = dynamic_cast<SERVO::CGlass*>(pSlot->getContext()); |
| | | SERVO::CJobDataS* pJobDataS = pGlass->getJobDataS(); |
| | | if (pGlass != nullptr && pJobDataS != nullptr) { |
| | | m_grid.SetSlotGlass(p, i, TRUE, |
| | | pGlass->getID().c_str(), |
| | | m_pjWarps[p].material[i]); |
| | | } |
| | | else { |
| | | m_grid.SetSlotGlass(p, i, FALSE, nullptr, CCarrierSlotGrid::MAT_G1); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | if (portIndex != -1) { |
| | | for (int i = 0; i < 8; i++) { |
| | | m_grid.SetSlotChecked(portIndex, i, ((PJWarp*)m_pContext)->checkSlot[i]); |
| | | m_grid.SetSlotMaterialType(portIndex, i, ((PJWarp*)m_pContext)->material[i]); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | for (int i = 0; i < 4; i++) { |
| | | m_grid.SetPortAllocated(i, lock[i], _T("")); |
| | | GetDlgItem(btnID[i])->EnableWindow(!lock[i]); |
| | | } |
| | | |
| | | ContentChanged(0); |
| | |
| | | |
| | | for (int i = 0; i < 4; i++) { |
| | | m_grid.SetPortAllocated(i, lock[i], _T("")); |
| | | GetDlgItem(btnID[i])->EnableWindow(!lock[i]); |
| | | } |
| | | |
| | | ContentChanged(0); |
| | |
| | | |
| | | for (int i = 0; i < 4; i++) { |
| | | m_grid.SetPortAllocated(i, lock[i], _T("")); |
| | | GetDlgItem(btnID[i])->EnableWindow(!lock[i]); |
| | | } |
| | | |
| | | ContentChanged(0); |
| | |
| | | |
| | | for (int i = 0; i < 4; i++) { |
| | | m_grid.SetPortAllocated(i, lock[i], _T("")); |
| | | GetDlgItem(btnID[i])->EnableWindow(!lock[i]); |
| | | } |
| | | |
| | | ContentChanged(0); |
| | |
| | | |
| | | *pResult = 0; |
| | | } |
| | | |
| | | void CCjPage2::OnBnClickedButtonPort1ProcessStart() |
| | | { |
| | | auto& master = theApp.m_model.getMaster(); |
| | | auto port = (SERVO::CLoadPort*)master.getEquipment(EQ_ID_LOADPORT1); |
| | | if (port == nullptr) return; |
| | | short jobExistence[12] = { 0 }; |
| | | short slotProcess = 0; |
| | | BuildCassetteCtrlMaps(port, jobExistence, slotProcess); |
| | | port->sendCassetteCtrlCmd(CCC_PROCESS_START, jobExistence, 12, slotProcess, 0, nullptr, nullptr); |
| | | |
| | | } |
| | | |
| | | void CCjPage2::OnBnClickedButtonPort2ProcessStart() |
| | | { |
| | | auto& master = theApp.m_model.getMaster(); |
| | | auto port = (SERVO::CLoadPort*)master.getEquipment(EQ_ID_LOADPORT2); |
| | | if (port == nullptr) return; |
| | | short jobExistence[12] = { 0 }; |
| | | short slotProcess = 0; |
| | | BuildCassetteCtrlMaps(port, jobExistence, slotProcess); |
| | | port->sendCassetteCtrlCmd(CCC_PROCESS_START, jobExistence, 12, slotProcess, 0, nullptr, nullptr); |
| | | } |
| | | |
| | | void CCjPage2::OnBnClickedButtonPort3ProcessStart() |
| | | { |
| | | auto& master = theApp.m_model.getMaster(); |
| | | auto port = (SERVO::CLoadPort*)master.getEquipment(EQ_ID_LOADPORT3); |
| | | if (port == nullptr) return; |
| | | short jobExistence[12] = { 0 }; |
| | | short slotProcess = 0; |
| | | BuildCassetteCtrlMaps(port, jobExistence, slotProcess); |
| | | port->sendCassetteCtrlCmd(CCC_PROCESS_START, jobExistence, 12, slotProcess, 0, nullptr, nullptr); |
| | | } |
| | | |
| | | void CCjPage2::OnBnClickedButtonPort4ProcessStart() |
| | | { |
| | | auto& master = theApp.m_model.getMaster(); |
| | | auto port = (SERVO::CLoadPort*)master.getEquipment(EQ_ID_LOADPORT4); |
| | | if (port == nullptr) return; |
| | | short jobExistence[12] = { 0 }; |
| | | short slotProcess = 0; |
| | | BuildCassetteCtrlMaps(port, jobExistence, slotProcess); |
| | | port->sendCassetteCtrlCmd(CCC_PROCESS_START, jobExistence, 12, slotProcess, 0, nullptr, nullptr); |
| | | } |
| | | |
| | | |