| | |
| | | m_ullRunTime = 0; |
| | | m_state = MASTERSTATE::READY; |
| | | m_pActiveRobotTask = nullptr; |
| | | m_nLastError = 0; |
| | | m_nLastError = ER_CODE_NOERROR; |
| | | m_isCompareMapsBeforeProceeding = FALSE; |
| | | m_bJobMode = FALSE; |
| | | m_bEnableEventReport = true; |
| | |
| | | return 0; |
| | | } |
| | | |
| | | int CMaster::stop() |
| | | int CMaster::stop(int nErCode/* = ER_CODE_NOERROR*/) |
| | | { |
| | | // 运行时间为累加结果,本次停止时刷新; |
| | | lock(); |
| | |
| | | |
| | | |
| | | // 更新状态 |
| | | m_nLastError = nErCode; |
| | | setState(MASTERSTATE::STOPPING); |
| | | |
| | | |
| | |
| | | }); |
| | | if (nRet != 0) { |
| | | LOGE("<Master>EFEM切换Start状态失败"); |
| | | m_nLastError = ER_CODE_OPERATION_MODE_FAIL; |
| | | m_strLastError = "EFEM切换Start状态失败."; |
| | | goto WAIT; |
| | | } |
| | |
| | | }); |
| | | if (nRet != 0) { |
| | | LOGE("<Master>Bonder1切换Start状态失败"); |
| | | m_nLastError = ER_CODE_BONDER_OPERATION_MODE_FAIL; |
| | | m_strLastError = "Bonder1切换Start状态失败."; |
| | | goto WAIT; |
| | | } |
| | |
| | | }); |
| | | if (nRet != 0) { |
| | | LOGE("<Master>Bonder2切换Start状态失败"); |
| | | m_nLastError = ER_CODE_BONDER_OPERATION_MODE_FAIL; |
| | | m_strLastError = "Bonder2切换Start状态失败."; |
| | | goto WAIT; |
| | | } |
| | |
| | | }); |
| | | if (nRet != 0) { |
| | | LOGE("<Master>BakeCooling切换Start状态失败"); |
| | | m_nLastError = ER_CODE_OPERATION_MODE_FAIL; |
| | | m_strLastError = "BakeCooling切换Start状态失败."; |
| | | goto WAIT; |
| | | } |
| | |
| | | }); |
| | | if (nRet != 0) { |
| | | LOGE("<Master>VacuumBake切换Start状态失败"); |
| | | m_nLastError = ER_CODE_OPERATION_MODE_FAIL; |
| | | m_strLastError = "VacuumBake切换Start状态失败."; |
| | | goto WAIT; |
| | | } |
| | |
| | | }); |
| | | if (nRet != 0) { |
| | | LOGE("<Master>Measurement切换Start状态失败"); |
| | | m_nLastError = ER_CODE_OPERATION_MODE_FAIL; |
| | | m_strLastError = "Measurement切换Start状态失败."; |
| | | goto WAIT; |
| | | } |
| | |
| | | }); |
| | | if (nRet != 0) { |
| | | LOGE("<Master>%s切换Stop状态发送失败", pEq[i]->getName().c_str()); |
| | | m_nLastError = ER_CODE_OPERATION_MODE_FAIL; |
| | | m_strLastError = pEq[i]->getName() + "切换Stop状态发送失败."; |
| | | bIomcOk[i] = FALSE; |
| | | promises[i].set_value(); // 避免 wait 阻塞 |
| | |
| | | } |
| | | |
| | | LOGI("<Master>所有设备成功切换到 Stop 模式"); |
| | | setState(MASTERSTATE::READY); |
| | | if(m_nLastError == ER_CODE_NOERROR) |
| | | setState(MASTERSTATE::READY); |
| | | else |
| | | setState(MASTERSTATE::ATHERERROR); |
| | | |
| | | continue; |
| | | } |
| | | |
| | |
| | | continue; |
| | | } |
| | | |
| | | pGlass->queue(); |
| | | pGlass->start(); |
| | | pEFEM->setContext(m_pActiveRobotTask->getContext()); |
| | | goto PORT_GET; |
| | | } |
| | |
| | | if (m_pActiveRobotTask->getSrcPosition() == EQ_ID_MEASUREMENT) { |
| | | CGlass* pGlass = (CGlass*)m_pActiveRobotTask->getContext(); |
| | | pGlass->complete(); |
| | | CGlass* pBuddy = pGlass->getBuddy(); |
| | | if (pBuddy != nullptr) pBuddy->complete(); |
| | | this->saveState(); |
| | | bool bMoved = glassFromInPorcessToComplete(pGlass); |
| | | if (bMoved) { |
| | |
| | | strOut.append(szBuffer); |
| | | } |
| | | LOGD("<CMaster-%s>SVDataReport:%s", ((CEquipment*)pEquipment)->getName().c_str(), strOut.c_str()); |
| | | }; |
| | | listener.onPanelDataReport = [&](void* pEquipment, void* pContext) { |
| | | LOGD("<CMaster-%s>onPanelDataReport", ((CEquipment*)pEquipment)->getName().c_str()); |
| | | |
| | | CEquipment* pEq = (CEquipment*)pEquipment; |
| | | CGlass* pGlass = (CGlass*)pContext; |
| | | |
| | | // 如果AOI检测失败,要停机 |
| | | if (pEq->getID() == EQ_ID_MEASUREMENT) { |
| | | LOGD("<CMaster-%s>onPanelDataReport 01", ((CEquipment*)pEquipment)->getName().c_str()); |
| | | if (pGlass->getAOIInspResult() == InspResult::Fail) { |
| | | LOGD("<CMaster-%s>onPanelDataReport 02", ((CEquipment*)pEquipment)->getName().c_str()); |
| | | if (stop() == 0) { |
| | | m_nLastError = ER_CODE_AOI_NG; |
| | | m_strLastError = "AOI检测未通过."; |
| | | } |
| | | } |
| | | } |
| | | |
| | | }; |
| | | pEquipment->setListener(listener); |
| | | pEquipment->setCcLink(&m_cclink); |
| | |
| | | if (!m_inProcesGlasses.empty()) { |
| | | CGlass* pGlass = m_inProcesGlasses.front(); |
| | | pGlass->complete(); |
| | | CGlass* pBuddy = pGlass->getBuddy(); |
| | | if (pBuddy != nullptr) pBuddy->complete(); |
| | | glassFromInPorcessToComplete(pGlass); |
| | | this->saveState(); |
| | | |
| | |
| | | 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); |
| | | } |
| | |
| | | int eqid[] = { EQ_ID_LOADPORT1, EQ_ID_LOADPORT2, EQ_ID_LOADPORT3, EQ_ID_LOADPORT4 }; |
| | | CLoadPort* pPort = (CLoadPort*)getEquipment(eqid[index]); |
| | | pPort->localEanblePort(bEnable); |
| | | } |
| | | |
| | | int CMaster::getPortCassetteSnSeed(int port) |
| | | { |
| | | ASSERT(1 <= port && port <= 4); |
| | | int eqid[] = { EQ_ID_LOADPORT1, EQ_ID_LOADPORT2, EQ_ID_LOADPORT3, EQ_ID_LOADPORT4 }; |
| | | CLoadPort* pPort = (CLoadPort*)getEquipment(eqid[port - 1]); |
| | | return pPort->getPortCassetteSnSeed(); |
| | | } |
| | | |
| | | void CMaster::setPortCassetteSnSeed(int port, int seed) |
| | | { |
| | | ASSERT(1 <= port && port <= 4); |
| | | int eqid[] = { EQ_ID_LOADPORT1, EQ_ID_LOADPORT2, EQ_ID_LOADPORT3, EQ_ID_LOADPORT4 }; |
| | | CLoadPort* pPort = (CLoadPort*)getEquipment(eqid[port - 1]); |
| | | return pPort->setPortCassetteSnSeed(seed); |
| | | } |
| | | |
| | | void CMaster::setCompareMapsBeforeProceeding(BOOL bCompare) |
| | |
| | | |
| | | return (int)glasses.size(); |
| | | } |
| | | |
| | | int CMaster::getLastError() |
| | | { |
| | | return m_nLastError; |
| | | } |
| | | |
| | | std::string& CMaster::getLastErrorText() |
| | | { |
| | | return m_strLastError; |
| | | } |
| | | |
| | | void CMaster::test() |
| | | { |
| | | if (stop() == 0) { |
| | | m_nLastError = ER_CODE_AOI_NG; |
| | | 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; |
| | | } |
| | | } |