| | |
| | | return &m_slot[index]; |
| | | } |
| | | |
| | | CSlot* CEquipment::getSlotWithNo(int slotNo) |
| | | { |
| | | CSlot* pSlot = nullptr; |
| | | for (int i = 0; i < SLOT_MAX; i++) { |
| | | if (!m_slot[i].isEnable()) continue; |
| | | if (m_slot[i].getNo() != slotNo) continue; |
| | | pSlot = &m_slot[i]; |
| | | break; |
| | | } |
| | | |
| | | return pSlot; |
| | | } |
| | | |
| | | CGlass* CEquipment::getAnyGlass() |
| | | { |
| | | CSlot* pSlot = nullptr; |
| | |
| | | } |
| | | |
| | | auto rawData = processData.getParamsRawData(); |
| | | std::vector<CParam> params; |
| | | this->parsingParams((const char*)rawData.data(), rawData.size(), params); |
| | | std::vector<CParam> tempParams; |
| | | this->parsingParams((const char*)rawData.data(), rawData.size(), tempParams); |
| | | int n = processData.getTotalParameter(); |
| | | std::vector<CParam> params(tempParams.begin(), tempParams.begin() + min(n, (int)tempParams.size())); |
| | | pGlass->addParams(params); |
| | | |
| | | // 关联的Glass也要更新 |
| | |
| | | |
| | | // 获取指定的Slot |
| | | CSlot* getSlot(int index); |
| | | CSlot* getSlotWithNo(int slotNo); |
| | | |
| | | // 获取一个可用的槽位 |
| | | CSlot* getAvailableSlot(); |
| | |
| | | ON_WM_SIZE() |
| | | ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST1, &CEquipmentPage2::OnLvnItemchangedList1) |
| | | ON_BN_CLICKED(IDC_BUTTON_REMOVE, &CEquipmentPage2::OnBnClickedButtonRemove) |
| | | ON_BN_CLICKED(IDC_BUTTON_PUT, &CEquipmentPage2::OnBnClickedButtonPut) |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | |
| | | GetClientRect(&rcClient); |
| | | |
| | | int x = 12; |
| | | int x1 = x; |
| | | int y2 = rcClient.bottom - 12; |
| | | pItem = GetDlgItem(IDC_BUTTON_REMOVE); |
| | | pItem->GetWindowRect(&rcItem); |
| | | pItem->MoveWindow(x, y2 - rcItem.Height(), rcItem.Width(), rcItem.Height()); |
| | | x1 += rcItem.Width(); |
| | | x1 += 12; |
| | | |
| | | pItem = GetDlgItem(IDC_BUTTON_PUT); |
| | | pItem->GetWindowRect(&rcItem); |
| | | pItem->MoveWindow(x1, y2 - rcItem.Height(), rcItem.Width(), rcItem.Height()); |
| | | y2 -= rcItem.Height(); |
| | | y2 -= 8; |
| | | |
| | |
| | | if (index >= 0) { |
| | | SERVO::CSlot* pSlot = (SERVO::CSlot*)m_listCtrl.GetItemData(index); |
| | | ASSERT(pSlot); |
| | | int bRet = m_pEquipment->removeGlass(pSlot->getNo()); |
| | | if (bRet == 0) { |
| | | if (theApp.m_model.getMaster().moveGlassToBuf(m_pEquipment->getID(), |
| | | pSlot->getNo())) { |
| | | UpdateSlots(); |
| | | AfxMessageBox("物料已取出到Buffer中!"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | void CEquipmentPage2::OnBnClickedButtonPut() |
| | | { |
| | | int index = GetSelectedItemIndex(); |
| | | if (index >= 0) { |
| | | SERVO::CSlot* pSlot = (SERVO::CSlot*)m_listCtrl.GetItemData(index); |
| | | ASSERT(pSlot); |
| | | if (theApp.m_model.getMaster().moveGlassToSlot(m_pEquipment->getID(), |
| | | pSlot->getNo())) { |
| | | UpdateSlots(); |
| | | AfxMessageBox("物料已放入指定位置!"); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | afx_msg void OnSize(UINT nType, int cx, int cy); |
| | | afx_msg void OnLvnItemchangedList1(NMHDR* pNMHDR, LRESULT* pResult); |
| | | afx_msg void OnBnClickedButtonRemove(); |
| | | afx_msg void OnBnClickedButtonPut(); |
| | | }; |
| | |
| | | pTarSlot = pTarEq->getAvailableSlotForGlass(primaryType); |
| | | pSrcSlot = pSrcEq->getProcessedSlot(primaryType, bJobMode); |
| | | if (m_nTestFlag == 1) LOGD("createTransferTask 003 %x, %x", pTarSlot, pSrcSlot); |
| | | if (pSrcSlot == nullptr || nullptr == pTarSlot && secondaryType != SERVO::MaterialsType::G0) { |
| | | if ((pSrcSlot == nullptr || nullptr == pTarSlot) && secondaryType != SERVO::MaterialsType::G0) { |
| | | pTarSlot = pTarEq->getAvailableSlotForGlass(secondaryType); |
| | | pSrcSlot = pSrcEq->getProcessedSlot(secondaryType, bJobMode); |
| | | } |
| | |
| | | m_strLastError = "AOI检测未通过."; |
| | | } |
| | | } |
| | | |
| | | bool CMaster::moveGlassToBuf(int eqid, int slotNo) |
| | | { |
| | | CEquipment* pEquipment = getEquipment(eqid); |
| | | if (pEquipment == nullptr) return false; |
| | | |
| | | CSlot* pSlot = pEquipment->getSlotWithNo(slotNo); |
| | | if (pSlot == nullptr) return false; |
| | | |
| | | CGlass* pGlass = (CGlass*)pSlot->getContext(); |
| | | m_bufGlass.push_back(pGlass); |
| | | pGlass->addRef(); |
| | | pSlot->setContext(nullptr); |
| | | |
| | | m_bDataModify = TRUE; |
| | | if (m_listener.onEqDataChanged != nullptr) { |
| | | m_listener.onEqDataChanged(this, pEquipment, 0); |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | bool CMaster::moveGlassToSlot(int eqid, int slotNo) |
| | | { |
| | | CEquipment* pEquipment = getEquipment(eqid); |
| | | if (pEquipment == nullptr) return false; |
| | | |
| | | CSlot* pSlot = pEquipment->getSlotWithNo(slotNo); |
| | | if (pSlot == nullptr) return false; |
| | | if (m_bufGlass.empty()) return false; |
| | | |
| | | CGlass* pGlass = m_bufGlass.front(); |
| | | m_bufGlass.pop_front(); |
| | | if (pGlass == nullptr) return false; |
| | | pSlot->setContext(pGlass); |
| | | pGlass->release(); |
| | | |
| | | m_bDataModify = TRUE; |
| | | if (m_listener.onEqDataChanged != nullptr) { |
| | | m_listener.onEqDataChanged(this, pEquipment, 0); |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | } |
| | |
| | | bool loadState(const std::string& path); |
| | | int getWipGlasses(std::vector<CGlass*>& glasses); |
| | | void test(); |
| | | bool moveGlassToBuf(int eqid, int slotNo); |
| | | bool moveGlassToSlot(int eqid, int slotNo); |
| | | int getPortCassetteSnSeed(int port); |
| | | void setPortCassetteSnSeed(int port, int seed); |
| | | |
| | |
| | | std::string m_strStatePath; |
| | | |
| | | int m_nTestFlag; |
| | | std::list<CGlass*> m_bufGlass; |
| | | }; |
| | | } |
| | | |
| | |
| | | |
| | | int CModel::term() |
| | | { |
| | | m_configuration.setPortCassetteSnSeed(1, m_master.getPortCassetteSnSeed(1)); |
| | | m_configuration.setPortCassetteSnSeed(2, m_master.getPortCassetteSnSeed(2)); |
| | | m_configuration.setPortCassetteSnSeed(3, m_master.getPortCassetteSnSeed(3)); |
| | | m_configuration.setPortCassetteSnSeed(4, m_master.getPortCassetteSnSeed(4)); |
| | | m_hsmsPassive.saveCache(); |
| | | m_hsmsPassive.term(); |
| | | CLog::GetLog()->SetOnLogCallback(nullptr); |
| | |
| | | m_pMyStatusbar->setForegroundColor(RGB(0, 0, 0)); |
| | | m_pMyStatusbar->setRunTimeText("启动失败."); |
| | | m_pTopToolbar->GetBtn(IDC_BUTTON_ALARM)->EnableWindow(TRUE); |
| | | KillTimer(TIMER_ID_UPDATE_RUMTIME); |
| | | } |
| | | else if (state == SERVO::MASTERSTATE::ATHERERROR) { |
| | | m_pTopToolbar->GetBtn(IDC_BUTTON_RUN)->EnableWindow(TRUE); |
| | |
| | | AfxMessageBox(_T("AOI检测失败,请操作员介入解决问题!")); |
| | | } |
| | | m_pTopToolbar->GetBtn(IDC_BUTTON_ALARM)->EnableWindow(TRUE); |
| | | KillTimer(TIMER_ID_UPDATE_RUMTIME); |
| | | } |
| | | else if (state == SERVO::MASTERSTATE::RUNNING || state == SERVO::MASTERSTATE::RUNNING_CONTINUOUS_TRANSFER |
| | | || state == SERVO::MASTERSTATE::RUNNING_BATCH) { |