| | |
| | | m_nContinuousTransferCount = 0; |
| | | m_nContinuousTransferStep = CTStep_Unknow; |
| | | m_pControlJob = nullptr; |
| | | m_nTestFlag = 0; |
| | | InitializeCriticalSection(&m_criticalSection); |
| | | } |
| | | |
| | |
| | | BoardVersion version{}; |
| | | int nRet = m_cclink.GetBoardVersion(version); |
| | | if (nRet == 0) { |
| | | LOGI("版本信息:%s.", version.toString().c_str()); |
| | | LOGD("版本信息:%s.", version.toString().c_str()); |
| | | } |
| | | else { |
| | | LOGE("获取CC-Link版本信息失败."); |
| | |
| | | BoardStatus status; |
| | | nRet = m_cclink.GetBoardStatus(status); |
| | | if (nRet == 0) { |
| | | LOGI("状态:%s.", status.toString().c_str()); |
| | | LOGD("状态:%s.", status.toString().c_str()); |
| | | } |
| | | else { |
| | | LOGE("获取CC-Link状态失败."); |
| | |
| | | TRACE("a0001\n", writeCode, retCode); |
| | | }); |
| | | if (nRet != 0) { |
| | | LOGI("<Master>EFEM切换Start状态失败"); |
| | | LOGE("<Master>EFEM切换Start状态失败"); |
| | | m_strLastError = "EFEM切换Start状态失败."; |
| | | goto WAIT; |
| | | } |
| | |
| | | TRACE("a0002\n"); |
| | | }); |
| | | if (nRet != 0) { |
| | | LOGI("<Master>Bonder1切换Start状态失败"); |
| | | LOGE("<Master>Bonder1切换Start状态失败"); |
| | | m_strLastError = "Bonder1切换Start状态失败."; |
| | | goto WAIT; |
| | | } |
| | |
| | | TRACE("a0003\n"); |
| | | }); |
| | | if (nRet != 0) { |
| | | LOGI("<Master>Bonder2切换Start状态失败"); |
| | | LOGE("<Master>Bonder2切换Start状态失败"); |
| | | m_strLastError = "Bonder2切换Start状态失败."; |
| | | goto WAIT; |
| | | } |
| | |
| | | TRACE("a0004\n"); |
| | | }); |
| | | if (nRet != 0) { |
| | | LOGI("<Master>BakeCooling切换Start状态失败"); |
| | | LOGE("<Master>BakeCooling切换Start状态失败"); |
| | | m_strLastError = "BakeCooling切换Start状态失败."; |
| | | goto WAIT; |
| | | } |
| | |
| | | TRACE("a0005\n"); |
| | | }); |
| | | if (nRet != 0) { |
| | | LOGI("<Master>VacuumBake切换Start状态失败"); |
| | | LOGE("<Master>VacuumBake切换Start状态失败"); |
| | | m_strLastError = "VacuumBake切换Start状态失败."; |
| | | goto WAIT; |
| | | } |
| | |
| | | TRACE("a0006\n"); |
| | | }); |
| | | if (nRet != 0) { |
| | | LOGI("<Master>Measurement切换Start状态失败"); |
| | | LOGE("<Master>Measurement切换Start状态失败"); |
| | | m_strLastError = "Measurement切换Start状态失败."; |
| | | goto WAIT; |
| | | } |
| | |
| | | for (int i = 0; i < 6; i++) { |
| | | if (!bIomcOk[i]) { |
| | | bIomcOk[6] = FALSE; |
| | | LOGI("<Master>%s切换Start状态失败", pEq[i]->getName().c_str()); |
| | | LOGE("<Master>%s切换Start状态失败", pEq[i]->getName().c_str()); |
| | | } |
| | | } |
| | | |
| | | // 检查看是否都已经切换到START状态 |
| | | /* |
| | | if (!bIomcOk[6]) { |
| | | unlock(); |
| | | setState(MASTERSTATE::MSERROR); |
| | | continue; |
| | | } |
| | | */ |
| | | |
| | | unlock(); |
| | | if(m_bContinuousTransfer) |
| | |
| | | TRACE("s000%d: ret=%d\n", i + 1, retCode); |
| | | }); |
| | | if (nRet != 0) { |
| | | LOGI("<Master>%s切换Stop状态发送失败", pEq[i]->getName().c_str()); |
| | | LOGE("<Master>%s切换Stop状态发送失败", pEq[i]->getName().c_str()); |
| | | m_strLastError = pEq[i]->getName() + "切换Stop状态发送失败."; |
| | | bIomcOk[i] = FALSE; |
| | | promises[i].set_value(); // 避免 wait 阻塞 |
| | |
| | | for (int i = 0; i < 6; ++i) { |
| | | if (!bIomcOk[i]) { |
| | | bIomcOk[6] = FALSE; |
| | | LOGI("<Master>%s切换Stop状态失败", pEq[i]->getName().c_str()); |
| | | LOGE("<Master>%s切换Stop状态失败", pEq[i]->getName().c_str()); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | // 此处检测优先类型和次要类型(G1或G2) |
| | | // 如果其中一Bonder有单个玻璃,优先取它的配对类型,否则无所谓了 |
| | | primaryType = MaterialsType::G1; |
| | | secondaryType = MaterialsType::G2; |
| | | if ((!pBonder1->canPlaceGlassInSlot(0) && !pBonder1->canPlaceGlassInSlot(1)) |
| | | && (!pBonder2->canPlaceGlassInSlot(0) && !pBonder2->canPlaceGlassInSlot(1))) { |
| | | // 如果G1和G2都满了,那就看Aligner, 如果Aligner有玻璃为G1, 则取G2 |
| | | CGlass* pGlass = pAligner->getGlassFromSlot(1); |
| | | if (pGlass != nullptr && pGlass->getType() == MaterialsType::G1) { |
| | | primaryType = MaterialsType::G2; |
| | | secondaryType = MaterialsType::G1; |
| | | } |
| | | // Bonder1、Bonder2、Fliper、VacuumBake、Aligner,统计G2和G1的数量, 配对组数, 多出的类型 |
| | | int nG2Count = 0, nG1Count = 0, nGlassGroup, nExtraType; |
| | | if (pBonder1->slotHasGlass(0)) { |
| | | nG2Count++; |
| | | } |
| | | else if ((pBonder1->canPlaceGlassInSlot(0) && !pBonder1->canPlaceGlassInSlot(1)) |
| | | || (pBonder2->canPlaceGlassInSlot(0) && !pBonder2->canPlaceGlassInSlot(1))) { |
| | | primaryType = MaterialsType::G2; |
| | | secondaryType = MaterialsType::G1; |
| | | if (pBonder1->slotHasGlass(1)) { |
| | | nG1Count++; |
| | | } |
| | | |
| | | if (pBonder2->slotHasGlass(0)) { |
| | | nG2Count++; |
| | | } |
| | | if (pBonder2->slotHasGlass(1)) { |
| | | nG1Count++; |
| | | } |
| | | |
| | | if (pFliper->slotHasGlass(0)) { |
| | | nG2Count++; |
| | | } |
| | | |
| | | if (pVacuumBake->slotHasGlass(0)) { |
| | | nG1Count++; |
| | | } |
| | | if (pVacuumBake->slotHasGlass(1)) { |
| | | nG1Count++; |
| | | } |
| | | |
| | | CGlass* pTempGlass = pAligner->getGlassFromSlot(0); |
| | | if (pTempGlass != nullptr) { |
| | | MaterialsType type = pTempGlass->getType(); |
| | | if(type == MaterialsType::G1) |
| | | nG1Count++; |
| | | else if (type == MaterialsType::G2) |
| | | nG2Count++; |
| | | } |
| | | nGlassGroup = min(nG1Count, nG2Count); |
| | | |
| | | if (nG1Count == nG2Count) { |
| | | nExtraType = 0; |
| | | } |
| | | else if (nG1Count > nG2Count) { |
| | | nExtraType = 1; |
| | | } |
| | | else { |
| | | nExtraType = 2; |
| | | } |
| | | secondaryType = MaterialsType::G0; |
| | | |
| | | |
| | | // Measurement -> LoadPort |
| | | if (rmd.armState[0] || rmd.armState[1]) { |
| | | LOGI("Arm1 %s, Arm2 %s.", rmd.armState[0] ? _T("不可用") : _T("可用"), |
| | | rmd.armState[1] ? _T("不可用") : _T("可用")); |
| | | } |
| | | for (int s = 0; s < 4; s++) { |
| | | PortType pt = pLoadPorts[s]->getPortType(); |
| | | if (!rmd.armState[0] && pLoadPorts[s]->isEnable() |
| | | && (pt == PortType::Unloading || pt == PortType::Both) |
| | | && pLoadPorts[s]->getPortStatus() == PORT_INUSE) { |
| | | m_pActiveRobotTask = createTransferTask(pMeasurement, pLoadPorts[s], primaryType, secondaryType); |
| | | m_pActiveRobotTask = createTransferTask(pMeasurement, pLoadPorts[s], MaterialsType::G1, secondaryType); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | goto PORT_PUT; |
| | | } |
| | |
| | | |
| | | |
| | | // Fliper(G2) -> Bonder |
| | | auto pSrcSlot = pVacuumBake->getProcessedSlot(primaryType); |
| | | if (pSrcSlot != nullptr && !rmd.armState[1] && !pBonder1->hasBondClass()) { |
| | | m_pActiveRobotTask = createTransferTask(pFliper, pBonder1, primaryType, secondaryType, 2); |
| | | //m_nTestFlag = 1; |
| | | //pVacuumBake->m_nTestFlag = 1; |
| | | auto pSrcSlot = pVacuumBake->getProcessedSlot(MaterialsType::G1); |
| | | //LOGI("<Master>pSrcSlot = %x", pSrcSlot,); |
| | | if (pSrcSlot != nullptr && !rmd.armState[1] |
| | | && pBonder1->canPlaceGlassInSlot(0)) { |
| | | m_pActiveRobotTask = createTransferTask(pFliper, pBonder1, MaterialsType::G2, MaterialsType::G0, 2); |
| | | CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask); |
| | | } |
| | | if (pSrcSlot != nullptr && !rmd.armState[1] && !pBonder2->hasBondClass()) { |
| | | m_pActiveRobotTask = createTransferTask(pFliper, pBonder2, primaryType, secondaryType, 2); |
| | | if (pSrcSlot != nullptr && !rmd.armState[1] |
| | | && pBonder2->canPlaceGlassInSlot(0)) { |
| | | m_pActiveRobotTask = createTransferTask(pFliper, pBonder2, MaterialsType::G2, MaterialsType::G0, 2); |
| | | CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask); |
| | | } |
| | | |
| | | |
| | | //m_nTestFlag = 0 |
| | | ; |
| | | // VacuumBake(G1) -> Bonder |
| | | if (!rmd.armState[0] && !pBonder1->hasBondClass()) { |
| | | m_pActiveRobotTask = createTransferTask(pVacuumBake, pBonder1, primaryType, secondaryType); |
| | | if (!rmd.armState[0] && pBonder1->slotHasGlass(0) && !pBonder1->slotHasGlass(1)) { |
| | | m_pActiveRobotTask = createTransferTask(pVacuumBake, pBonder1, MaterialsType::G1, MaterialsType::G0); |
| | | CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask); |
| | | } |
| | | |
| | | if (!rmd.armState[0] && !pBonder2->hasBondClass()) { |
| | | m_pActiveRobotTask = createTransferTask(pVacuumBake, pBonder2, primaryType, secondaryType); |
| | | if (!rmd.armState[0] && pBonder2->slotHasGlass(0) && !pBonder2->slotHasGlass(1)) { |
| | | m_pActiveRobotTask = createTransferTask(pVacuumBake, pBonder2, MaterialsType::G1, MaterialsType::G0); |
| | | CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask); |
| | | } |
| | | |
| | |
| | | // Aligner -> Fliper(G2) |
| | | // Aligner -> VacuumBake(G1) |
| | | if (!rmd.armState[1]) { |
| | | m_pActiveRobotTask = createTransferTask(pAligner, pFliper, primaryType, secondaryType); |
| | | m_pActiveRobotTask = createTransferTask(pAligner, pFliper, MaterialsType::G2, secondaryType); |
| | | CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask); |
| | | } |
| | | |
| | | if (!rmd.armState[0]) { |
| | | m_pActiveRobotTask = createTransferTask(pAligner, pVacuumBake, primaryType, secondaryType); |
| | | // m_nTestFlag = 1; |
| | | if (m_nTestFlag == 1) LOGD("createTransferTask 004df %d, %d", MaterialsType::G1, secondaryType); |
| | | m_pActiveRobotTask = createTransferTask(pAligner, pVacuumBake, MaterialsType::G1, secondaryType); |
| | | CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask); |
| | | m_nTestFlag = 0; |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | // LoadPort -> Aligner |
| | | if (nGlassGroup >= 2) { |
| | | unlock(); |
| | | continue; |
| | | } |
| | | |
| | | if(nExtraType == 0) |
| | | primaryType = MaterialsType::G2; |
| | | else { |
| | | primaryType = MaterialsType::G1; |
| | | } |
| | | |
| | | for (int s = 0; s < 4; s++) { |
| | | PortType pt = pLoadPorts[s]->getPortType(); |
| | | if (!rmd.armState[0] && pLoadPorts[s]->isEnable() |
| | |
| | | && pLoadPorts[s]->getPortStatus() == PORT_INUSE) { |
| | | m_pActiveRobotTask = createTransferTask(pLoadPorts[s], pAligner, primaryType, secondaryType, 1, m_bJobMode); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | CGlass* pGlass = (CGlass*)m_pActiveRobotTask->getContext(); |
| | | if (pGlass->getBuddy() != nullptr) { |
| | | delete m_pActiveRobotTask; |
| | | m_pActiveRobotTask = nullptr; |
| | | continue; |
| | | } |
| | | |
| | | pGlass->start(); |
| | | pEFEM->setContext(m_pActiveRobotTask->getContext()); |
| | | goto PORT_GET; |
| | | } |
| | |
| | | CJState state = m_pControlJob->state(); |
| | | if (state == CJState::Completed || state == CJState::Aborted || state == CJState::Failed) { |
| | | // ConrolJpb已完成 |
| | | LOGI("<Master>ControlJob已经完成或失败中断"); |
| | | LOGE("<Master>ControlJob已经完成或失败中断"); |
| | | unlock(); |
| | | continue; |
| | | } |
| | |
| | | if (m_pControlJob->state() == CJState::Queued) { |
| | | LOGI("<Master>ControlJob已经启动"); |
| | | m_pControlJob->start(); |
| | | |
| | | if (m_listener.onCjStart != nullptr) { |
| | | m_listener.onCjStart(this, m_pControlJob); |
| | | } |
| | | } |
| | | if (m_pControlJob->state() == CJState::Paused) { |
| | | LOGI("<Master>ControlJob已经恢复运行"); |
| | |
| | | } |
| | | } |
| | | if (m_inProcesJobs.empty()) { |
| | | LOGI("<Master>选择当前ProcessJob失败!"); |
| | | LOGE("<Master>选择当前ProcessJob失败!"); |
| | | unlock(); |
| | | continue; |
| | | } |
| | |
| | | |
| | | // Measurement -> LoadPort |
| | | if (rmd.armState[0] || rmd.armState[1]) { |
| | | LOGI("Arm1 %s, Arm2 %s.", rmd.armState[0] ? _T("不可用") : _T("可用"), |
| | | LOGD("Arm1 %s, Arm2 %s.", rmd.armState[0] ? _T("不可用") : _T("可用"), |
| | | rmd.armState[1] ? _T("不可用") : _T("可用")); |
| | | } |
| | | for (int s = 0; s < 4; s++) { |
| | |
| | | |
| | | // Fliper(G2) -> Bonder |
| | | auto pSrcSlot = pVacuumBake->getProcessedSlot(primaryType); |
| | | if (pSrcSlot != nullptr && !rmd.armState[1] && !pBonder1->hasBondClass()) { |
| | | if (pSrcSlot != nullptr && !rmd.armState[1] && !pBonder1->hasBondGlass()) { |
| | | m_pActiveRobotTask = createTransferTask(pFliper, pBonder1, primaryType, secondaryType, 2); |
| | | CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask); |
| | | } |
| | | if (pSrcSlot != nullptr && !rmd.armState[1] && !pBonder2->hasBondClass()) { |
| | | if (pSrcSlot != nullptr && !rmd.armState[1] && !pBonder2->hasBondGlass()) { |
| | | m_pActiveRobotTask = createTransferTask(pFliper, pBonder2, primaryType, secondaryType, 2); |
| | | CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask); |
| | | } |
| | | |
| | | |
| | | // VacuumBake(G1) -> Bonder |
| | | if (!rmd.armState[0] && !pBonder1->hasBondClass()) { |
| | | if (!rmd.armState[0] && !pBonder1->hasBondGlass()) { |
| | | m_pActiveRobotTask = createTransferTask(pVacuumBake, pBonder1, primaryType, secondaryType); |
| | | CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask); |
| | | } |
| | | |
| | | if (!rmd.armState[0] && !pBonder2->hasBondClass()) { |
| | | if (!rmd.armState[0] && !pBonder2->hasBondGlass()) { |
| | | m_pActiveRobotTask = createTransferTask(pVacuumBake, pBonder2, primaryType, secondaryType); |
| | | CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask); |
| | | } |
| | |
| | | && pLoadPorts[s]->getPortStatus() == PORT_INUSE) { |
| | | m_pActiveRobotTask = createTransferTask(pLoadPorts[s], pAligner, primaryType, secondaryType, m_bJobMode); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | pEFEM->setContext(m_pActiveRobotTask->getContext()); |
| | | bool bMoved = glassFromQueueToInPorcess((CGlass*)m_pActiveRobotTask->getContext()); |
| | | CGlass* pGlass = (CGlass*)m_pActiveRobotTask->getContext(); |
| | | if (pGlass->getBuddy() != nullptr) { |
| | | delete m_pActiveRobotTask; |
| | | m_pActiveRobotTask = nullptr; |
| | | continue; |
| | | } |
| | | |
| | | pEFEM->setContext(pGlass); |
| | | pGlass->start(); |
| | | bool bMoved = glassFromQueueToInPorcess(pGlass); |
| | | if (bMoved) { |
| | | LOGI("<Master>Glass(%s)从等待列队到工艺列队转移成功.", |
| | | ((CGlass*)m_pActiveRobotTask->getContext())->getID().c_str()); |
| | | pGlass->getID().c_str()); |
| | | } |
| | | else { |
| | | LOGE("<Master>Glass(%s)从等待列队到工艺列队转移失败.", |
| | | ((CGlass*)m_pActiveRobotTask->getContext())->getID().c_str()); |
| | | pGlass->getID().c_str()); |
| | | } |
| | | |
| | | // 这里上报Panel Start事件 |
| | | if (m_listener.onPanelStart != nullptr) { |
| | | m_listener.onPanelStart(this, pGlass); |
| | | } |
| | | |
| | | goto BATCH_PORT_GET; |
| | |
| | | |
| | | // Bonder1 -> Bonder2 |
| | | if ((m_nContinuousTransferStep == CTStep_Unknow || m_nContinuousTransferStep == CTStep_Fliper_Bonder1) |
| | | && !rmd.armState[0] && !pBonder2->hasBondClass()) { |
| | | && !rmd.armState[0] && !pBonder2->hasBondGlass()) { |
| | | m_pActiveRobotTask = createTransferTask_continuous_transfer(pBonder1, |
| | | 1, pBonder2, 1); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | |
| | | |
| | | // Fliper(G2) -> Bonder1 |
| | | if ((m_nContinuousTransferStep == CTStep_Unknow || m_nContinuousTransferStep == CTStep_Aligner_Fliper) |
| | | &&!rmd.armState[0] && !pBonder1->hasBondClass()) { |
| | | &&!rmd.armState[0] && !pBonder1->hasBondGlass()) { |
| | | m_pActiveRobotTask = createTransferTask_continuous_transfer(pFliper, |
| | | 0, pBonder1, 1); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | |
| | | BOOL bOk = FALSE; |
| | | lock(); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | LOGI("<CMaster>onPreFethedOutJob 0001."); |
| | | LOGD("<CMaster>onPreFethedOutJob 0001."); |
| | | if (m_pActiveRobotTask->getSrcPosition() == p->getID()) { |
| | | LOGI("<CMaster>onPreFethedOutJob 0002."); |
| | | LOGD("<CMaster>onPreFethedOutJob 0002."); |
| | | CGlass* pGlass = p->getGlassFromSlot(m_pActiveRobotTask->getSrcSlot()); |
| | | if (pGlass != nullptr) { |
| | | LOGI("<CMaster>onPreFethedOutJob 0003."); |
| | | LOGD("<CMaster>onPreFethedOutJob 0003."); |
| | | CJobDataS* pJobDataS = pGlass->getJobDataS(); |
| | | if (pJobDataS != nullptr |
| | | && pJobDataS->getCassetteSequenceNo() == pJobDataB->getCassetteSequenceNo() |
| | | && pJobDataS->getJobSequenceNo() == pJobDataB->getJobSequenceNo()) { |
| | | bOk = TRUE; |
| | | LOGI("<CMaster>onPreFethedOutJob, 已校验数据一致性."); |
| | | LOGD("<CMaster>onPreFethedOutJob, 已校验数据一致性."); |
| | | } |
| | | LOGD("<CMaster>onPreFethedOutJob 0004."); |
| | | if (pJobDataS != nullptr) { |
| | | LOGD("<CMaster>onPreFethedOutJob 0005. %d,%d,%d,%d", |
| | | pJobDataS->getCassetteSequenceNo(), |
| | | pJobDataB->getCassetteSequenceNo(), |
| | | pJobDataS->getJobSequenceNo(), |
| | | pJobDataB->getJobSequenceNo() |
| | | ); |
| | | } |
| | | } |
| | | } |
| | |
| | | if (pGlass == nullptr) { |
| | | bOk = TRUE; |
| | | slot = m_pActiveRobotTask->getTarSlot(); |
| | | LOGI("<CMaster>onPreFethedOutJob, 已校验数据一致性."); |
| | | LOGI("<CMaster>onPreStoredJob, 已校验数据一致性."); |
| | | } |
| | | } |
| | | |
| | |
| | | if (pGlass == nullptr && m_pActiveRobotTask->getSrcSlot() == port) { |
| | | bOk = TRUE; |
| | | slot = m_pActiveRobotTask->getSrcSlot(); |
| | | LOGI("<CMaster>onPreFethedOutJob, 已校验数据一致性."); |
| | | LOGI("<CMaster>onPreStoredJob, 已校验数据一致性."); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | // 如果是搬送回从AOI搬送回Port, 则glass工艺完成 |
| | | if (m_pActiveRobotTask->getSrcPosition() == EQ_ID_MEASUREMENT) { |
| | | bool bMoved = glassFromInPorcessToComplete((CGlass*)m_pActiveRobotTask->getContext()); |
| | | CGlass* pGlass = (CGlass*)m_pActiveRobotTask->getContext(); |
| | | pGlass->complete(); |
| | | this->saveState(); |
| | | bool bMoved = glassFromInPorcessToComplete(pGlass); |
| | | if (bMoved) { |
| | | LOGI("<Master>Glass(%s)从工艺列队到完成列队转移成功.", |
| | | ((CGlass*)m_pActiveRobotTask->getContext())->getID().c_str()); |
| | | pGlass->getID().c_str()); |
| | | } |
| | | else { |
| | | LOGE("<Master>Glass(%s)从工艺列队到完成列队转移失败.", |
| | | ((CGlass*)m_pActiveRobotTask->getContext())->getID().c_str()); |
| | | pGlass->getID().c_str()); |
| | | } |
| | | if (m_listener.onPanelEnd != nullptr) { |
| | | m_listener.onPanelEnd(this, pGlass); |
| | | } |
| | | |
| | | // 检查PJ是否已经完成 |
| | | CProcessJob* pJob = getGlassProcessJob((CGlass*)m_pActiveRobotTask->getContext()); |
| | | if (pJob != nullptr && checkAndUpdatePjComplete(pJob)) { |
| | | this->saveState(); |
| | | LOGE("<Master>ProcessJob(%s)完成.", |
| | | pJob->id().c_str()); |
| | | if (m_listener.onPjEnd != nullptr) { |
| | | m_listener.onPjEnd(this, pJob); |
| | | } |
| | | |
| | | // 检查CJ是否已经完成 |
| | | ASSERT(m_pControlJob); |
| | | if (checkAndUpdateCjComplete(m_pControlJob)) { |
| | | this->saveState(); |
| | | LOGE("<Master>ControlJob(%s)完成.", |
| | | m_pControlJob->id().c_str()); |
| | | if (m_listener.onCjEnd != nullptr) { |
| | | m_listener.onCjEnd(this, pJob); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | unlock(); |
| | |
| | | if (m_listener.onLoadPortStatusChanged != nullptr) { |
| | | m_listener.onLoadPortStatusChanged(this, (CEquipment*)pEquipment, status, data); |
| | | } |
| | | }; |
| | | listener.onSVDataReport = [&](void* pEquipment, void* pData) { |
| | | CSVData* pSVData = (CSVData*)pData; |
| | | auto rawData = pSVData->getSVRawData(); |
| | | std::vector<CParam> params; |
| | | ((CEquipment*)pEquipment)->parsingSVData((const char*)rawData.data(), rawData.size(), params); |
| | | |
| | | std::string strOut; |
| | | char szBuffer[256]; |
| | | for (auto p : params) { |
| | | if (!strOut.empty()) strOut.append(","); |
| | | if (p.getValueType() == PVT_INT) { |
| | | sprintf_s(szBuffer, 256, "%s:%d", p.getName().c_str(), p.getIntValue()); |
| | | } |
| | | else if (p.getValueType() == PVT_DOUBLE) { |
| | | sprintf_s(szBuffer, 256, "%s:%f", p.getName().c_str(), p.getDoubleValue()); |
| | | } |
| | | strOut.append(szBuffer); |
| | | } |
| | | LOGD("<CMaster-%s>SVDataReport:%s", ((CEquipment*)pEquipment)->getName().c_str(), strOut.c_str()); |
| | | }; |
| | | pEquipment->setListener(listener); |
| | | pEquipment->setCcLink(&m_cclink); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | // 模拟测试 |
| | | static int aaa = 0; |
| | | aaa++; |
| | | if (aaa % 30 == 0) { |
| | | if (!m_queueGlasses.empty()) { |
| | | CGlass* pGlass = m_queueGlasses.front(); |
| | | pGlass->start(); |
| | | glassFromQueueToInPorcess(pGlass); |
| | | this->saveState(); |
| | | |
| | | // 这里上报Panel Start事件 |
| | | if (m_listener.onPanelStart != nullptr) { |
| | | m_listener.onPanelStart(this, pGlass); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (aaa % 45 == 0) { |
| | | if (!m_inProcesGlasses.empty()) { |
| | | CGlass* pGlass = m_inProcesGlasses.front(); |
| | | pGlass->complete(); |
| | | glassFromInPorcessToComplete(pGlass); |
| | | this->saveState(); |
| | | |
| | | // 这里上报Panel End事件 |
| | | if (m_listener.onPanelEnd != nullptr) { |
| | | m_listener.onPanelEnd(this, pGlass); |
| | | } |
| | | |
| | | CProcessJob* pJob = getGlassProcessJob(pGlass); |
| | | if (pJob != nullptr && checkAndUpdatePjComplete(pJob)) { |
| | | processJobFromInPorcessToComplete(pJob); |
| | | this->saveState(); |
| | | LOGE("<Master>ProcessJob(%s)完成.", |
| | | pJob->id().c_str()); |
| | | if (m_listener.onPjEnd != nullptr) { |
| | | m_listener.onPjEnd(this, pJob); |
| | | } |
| | | |
| | | // 检查CJ是否已经完成 |
| | | ASSERT(m_pControlJob); |
| | | if (checkAndUpdateCjComplete(m_pControlJob)) { |
| | | this->saveState(); |
| | | LOGE("<Master>ControlJob(%s)完成.", |
| | | m_pControlJob->id().c_str()); |
| | | if (m_listener.onCjEnd != nullptr) { |
| | | m_listener.onCjEnd(this, pJob); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | void CMaster::connectEquipments() |
| | |
| | | if (!pSrcEq->IsEnabled()) { |
| | | return nullptr; |
| | | } |
| | | |
| | | CRobotTask* pTask = nullptr; |
| | | CSlot* pSrcSlot, * pTarSlot; |
| | | pSrcEq->m_nTestFlag = m_nTestFlag; |
| | | pTarSlot = pTarEq->getAvailableSlotForGlass(primaryType); |
| | | pSrcSlot = pSrcEq->getProcessedSlot(primaryType, bJobMode); |
| | | if (pSrcSlot == nullptr || nullptr == pTarSlot) { |
| | | if (m_nTestFlag == 1) LOGD("createTransferTask 003 %x, %x", pTarSlot, pSrcSlot); |
| | | if (pSrcSlot == nullptr || nullptr == pTarSlot && secondaryType != SERVO::MaterialsType::G0) { |
| | | pTarSlot = pTarEq->getAvailableSlotForGlass(secondaryType); |
| | | pSrcSlot = pSrcEq->getProcessedSlot(secondaryType, bJobMode); |
| | | } |
| | | |
| | | if (m_nTestFlag == 1) LOGD("createTransferTask 004 %x, %x", pTarSlot, pSrcSlot); |
| | | |
| | | if (pSrcSlot != nullptr && nullptr != pTarSlot) { |
| | | pTask = new CRobotTask(); |
| | |
| | | m_pControlJob = new CControlJob(); |
| | | if (!CControlJob::deserialize(ifs, *m_pControlJob)) return false; |
| | | } |
| | | |
| | | else { |
| | | return false; |
| | | } |
| | | |
| | | // 读取 ProcessJob 列表 |
| | | uint32_t count = 0; |
| | |
| | | for (const auto pj : pjs) { |
| | | if (pj->state() == PJState::Queued) { |
| | | pj->start(); |
| | | return pj; |
| | | } |
| | | return pj; |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | bool CMaster::processJobFromInPorcessToComplete(CProcessJob* pProcessJob) |
| | | { |
| | | auto it = std::find(m_inProcesJobs.begin(), m_inProcesJobs.end(), pProcessJob); |
| | | if (it != m_inProcesJobs.end()) { |
| | | m_completeProcessJobs.push_back(*it); |
| | | m_inProcesJobs.erase(it); |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | bool CMaster::checkAndUpdatePjComplete(CProcessJob* pJob) |
| | | { |
| | | ASSERT(pJob); |
| | | auto state = pJob->state(); |
| | | if (state != PJState::InProcess && state != PJState::Paused) return false; |
| | | |
| | | for (auto c : pJob->carriers()) { |
| | | for (auto g : c.contexts) { |
| | | auto state = ((CGlass*)g)->state(); |
| | | if (state != GlsState::Aborted && state != GlsState::Completed |
| | | && state != GlsState::Failed) return false; |
| | | } |
| | | } |
| | | |
| | | return pJob->complete(); |
| | | } |
| | | |
| | | bool CMaster::checkAndUpdateCjComplete(CControlJob* pJob) |
| | | { |
| | | ASSERT(pJob); |
| | | auto state = pJob->state(); |
| | | if (state != CJState::Executing && state != CJState::Paused) return false; |
| | | |
| | | for (auto pj : pJob->getPjs()) { |
| | | auto state = pj->state(); |
| | | if (state != PJState::Aborted && state != PJState::Completed |
| | | && state != PJState::Failed) { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | return pJob->complete(); |
| | | } |
| | | |
| | | CProcessJob* CMaster::getGlassProcessJob(CGlass* pGlass) |
| | | { |
| | | if (m_pControlJob == nullptr) return nullptr; |
| | | for (auto pj : m_pControlJob->getPjs()) { |
| | | for (auto c : pj->carriers()) { |
| | | for (auto g : c.contexts) { |
| | | if (g == pGlass) return pj; |
| | | } |
| | | } |
| | | } |
| | | |
| | | return nullptr; |
| | | } |
| | | |
| | | int CMaster::getWipGlasses(std::vector<CGlass*>& glasses) |
| | | { |
| | | for (auto eq : m_listEquipment) { |
| | | auto p = dynamic_cast<CLoadPort*>(eq); |
| | | if (p == nullptr) { |
| | | eq->getAllGlass(glasses); |
| | | } |
| | | |
| | | } |
| | | |
| | | return (int)glasses.size(); |
| | | } |
| | | } |