| | |
| | | |
| | | // Job Data Request |
| | | CHECK_READ_STEP_SIGNAL(STEP_ID_JOB_DATA_REQUEST, pszData, size); |
| | | |
| | | // job process start/end report |
| | | CHECK_READ_STEP_SIGNAL(STEP_ID_JOB_PROCESS_START_REPORT, pszData, size); |
| | | CHECK_READ_STEP_SIGNAL(STEP_ID_JOB_PROCESS_END_REPORT, pszData, size); |
| | | } |
| | | |
| | | BOOL CEquipment::isBitOn(const char* pszData, size_t size, int index) |
| | |
| | | return 0; |
| | | } |
| | | |
| | | int CEquipment::fetchedOutJob(CJobDataB* pJobDataB) |
| | | int CEquipment::fetchedOutJob(int port, CJobDataB* pJobDataB) |
| | | { |
| | | if (m_pArm == nullptr) { |
| | | return -1; |
| | |
| | | |
| | | // 找到指定的glass id, |
| | | Lock(); |
| | | CGlass* pContext = nullptr; |
| | | for (int i = 0; i < SLOT_MAX; i++) { |
| | | CGlass* pGlass = (CGlass*)m_slot[i].getContext(); |
| | | if (pGlass != nullptr && compareJobData(pJobDataB, pGlass->getJobDataS())) { |
| | | pContext = pGlass; |
| | | if (pGlass != nullptr) pGlass->addRef(); |
| | | m_slot[i].setContext(nullptr); |
| | | break; |
| | | } |
| | | } |
| | | if (pContext == nullptr) { |
| | | CGlass* pGlass = (CGlass*)m_slot[port - 1].getContext(); |
| | | if (pGlass == nullptr && !compareJobData(pJobDataB, pGlass->getJobDataS())) { |
| | | Unlock(); |
| | | return -3; |
| | | } |
| | | |
| | | if (pGlass != nullptr) pGlass->addRef(); |
| | | m_slot[port - 1].setContext(nullptr); |
| | | |
| | | ((CArm*)m_pArm)->tempStore(pContext); |
| | | pContext->release(); |
| | | ((CArm*)m_pArm)->tempStore(pGlass); |
| | | pGlass->release(); |
| | | Unlock(); |
| | | |
| | | |
| | |
| | | return 0; |
| | | } |
| | | |
| | | int CEquipment::storedJob(CJobDataB* pJobDataB, short putSlot) |
| | | int CEquipment::storedJob(int port, CJobDataB* pJobDataB) |
| | | { |
| | | if (m_pArm == nullptr) { |
| | | return -1; |
| | |
| | | |
| | | ASSERT(pGlass); |
| | | Lock(); |
| | | pGlass->addPath(m_nID, getSlotUnit(putSlot)); |
| | | m_slot[putSlot - 1].setContext(pGlass); |
| | | pGlass->addPath(m_nID, port); |
| | | m_slot[port - 1].setContext(pGlass); |
| | | pGlass->release(); // tempFetchOut需要调用一次release |
| | | Unlock(); |
| | | |
| | |
| | | if (!m_slot[i].isEnable()) continue; |
| | | if (m_slot[i].isLock()) continue; |
| | | CGlass* pGlass = (CGlass*)m_slot[i].getContext(); |
| | | if (!isSlotProcessed(i+1)) continue; |
| | | if (pGlass == nullptr) continue; |
| | | int lsPath = m_slot[i].getLinkSignalPath(); |
| | | if(!m_bLinkSignalToUpstream[lsPath][SIGNAL_UPSTREAM_INLINE] |
| | |
| | | if (m_slot[i].isLock()) continue; |
| | | CGlass* pGlass = (CGlass*)m_slot[i].getContext(); |
| | | if (pGlass == nullptr) continue; |
| | | if (!isSlotProcessed(i+1)) continue; |
| | | int lsPath = m_slot[i].getLinkSignalPath(); |
| | | if (!m_bLinkSignalToUpstream[lsPath][SIGNAL_UPSTREAM_INLINE] |
| | | || m_bLinkSignalToUpstream[lsPath][SIGNAL_UPSTREAM_TROUBLE] |
| | |
| | | |
| | | // 缓存Attribute,用于调试时显示信息 |
| | | unsigned int weight = 201; |
| | | CAttributeVector attrubutes; |
| | | CAttributeVector& attrubutes = pStep->attributeVector(); |
| | | processData.getAttributeVector(attrubutes, weight); |
| | | pStep->addAttributeVector(attrubutes); |
| | | |
| | | |
| | | onProcessData(&processData); |
| | | |
| | | return nRet; |
| | |
| | | |
| | | // 缓存Attribute,用于调试时显示信息 |
| | | unsigned int weight = 201; |
| | | CAttributeVector attrubutes; |
| | | CAttributeVector& attrubutes = pStep->attributeVector(); |
| | | jobDataS.getAttributeVector(attrubutes, weight); |
| | | pStep->addAttributeVector(attrubutes); |
| | | |
| | | |
| | | onReceivedJob(port, &jobDataS); |
| | | |
| | | return nRet; |
| | |
| | | int CEquipment::onReceivedJob(int port, CJobDataS* pJobDataS) |
| | | { |
| | | LOGI("<CEquipment-%s>onReceivedJob.", m_strName.c_str()); |
| | | |
| | | // 可以在此更新JobDataS数据了 |
| | | CGlass* pGlass = getGlassFromSlot(port); |
| | | if (pGlass == nullptr) { |
| | | LOGE("<CEquipment-%s>onSentOutJob,没有找到对应的Glass(CassetteSequenceNo:%d, JobSequenceNo:%d, ID=%s),请检查数据,注意风险。", |
| | | m_strName.c_str(), pJobDataS->getCassetteSequenceNo(), pJobDataS->getJobSequenceNo(), |
| | | pJobDataS->getGlass1Id().c_str()); |
| | | return -1; |
| | | } |
| | | pGlass->updateJobDataS(pJobDataS); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | |
| | | |
| | | // 缓存Attribute,用于调试时显示信息 |
| | | unsigned int weight = 201; |
| | | CAttributeVector attrubutes; |
| | | CAttributeVector& attrubutes = pStep->attributeVector(); |
| | | jobDataS.getAttributeVector(attrubutes, weight); |
| | | pStep->addAttributeVector(attrubutes); |
| | | |
| | | |
| | | onSentOutJob(port, &jobDataS); |
| | | |
| | | return nRet; |
| | |
| | | int CEquipment::onSentOutJob(int port, CJobDataS* pJobDataS) |
| | | { |
| | | LOGI("<CEquipment-%s>onSentOutJob.", m_strName.c_str()); |
| | | |
| | | |
| | | // 可以在此更新JobDataS数据了 |
| | | CGlass* pGlass = getGlass(pJobDataS->getGlass1Id().c_str()); |
| | | if (pGlass == nullptr) { |
| | | LOGE("<CEquipment-%s>onSentOutJob,没有找到对应的Glass(CassetteSequenceNo:%d, JobSequenceNo:%d, ID=%s),请检查数据,注意风险。", |
| | | m_strName.c_str(), pJobDataS->getCassetteSequenceNo(), pJobDataS->getJobSequenceNo(), |
| | | pJobDataS->getGlass1Id().c_str()); |
| | | return -1; |
| | | } |
| | | pGlass->updateJobDataS(pJobDataS); |
| | | |
| | | return 0; |
| | | } |
| | |
| | | LOGI("<CEquipment-%s>onPreFetchedOutJob:port:%d|GlassId:%s", |
| | | m_strName.c_str(), port, pJobDataB->getGlassId().c_str()); |
| | | if (m_listener.onPreFethedOutJob != nullptr) { |
| | | return m_listener.onPreFethedOutJob(this, pJobDataB); |
| | | return m_listener.onPreFethedOutJob(this, port, pJobDataB); |
| | | } |
| | | |
| | | return TRUE; |
| | |
| | | |
| | | BOOL bCheck = onPreFetchedOutJob(port, pJobDataB); |
| | | if (bCheck) { |
| | | return fetchedOutJob(pJobDataB); |
| | | return fetchedOutJob(port, pJobDataB); |
| | | } |
| | | |
| | | // 数据异常,处理或显示 |
| | |
| | | |
| | | // 缓存Attribute,用于调试时显示信息 |
| | | unsigned int weight = 201; |
| | | CAttributeVector attrubutes; |
| | | CAttributeVector& attrubutes = pStep->attributeVector(); |
| | | vcrEventReport.getAttributeVector(attrubutes, weight); |
| | | pStep->addAttributeVector(attrubutes); |
| | | |
| | | // 0426, 先固定返回1(OK) |
| | | ((CReadStep*)pStep)->setReturnCode((short)VCR_Reply_Code::OK); |
| | |
| | | return 0; |
| | | } |
| | | |
| | | int CEquipment::decodeJobProcessStartReport(CStep* pStep, const char* pszData, size_t size) |
| | | { |
| | | int port = (int)(__int64)pStep->getProp("Port"); |
| | | LOGI("<CEquipment-%s>decodeJobProcessStartReport, port:%d", getName().c_str(), port); |
| | | |
| | | short cassetteNo, jobSequenceNo, unitNo, subUnitNo, slotNo; |
| | | int year, month, day, hour, minute, second; |
| | | |
| | | int index = 0; |
| | | memcpy(&cassetteNo, &pszData[index], sizeof(short)); |
| | | index += sizeof(short); |
| | | memcpy(&jobSequenceNo, &pszData[index], sizeof(short)); |
| | | index += sizeof(short); |
| | | memcpy(&unitNo, &pszData[index], sizeof(short)); |
| | | index += sizeof(short); |
| | | memcpy(&subUnitNo, &pszData[index], sizeof(short)); |
| | | index += sizeof(short); |
| | | memcpy(&slotNo, &pszData[index], sizeof(short)); |
| | | index += sizeof(short); |
| | | |
| | | memcpy(&year, &pszData[index], sizeof(short)); |
| | | index += sizeof(short); |
| | | month = (int)pszData[index]; |
| | | index += 1; |
| | | day = (int)pszData[index]; |
| | | index += 1; |
| | | hour = (int)pszData[index]; |
| | | index += 1; |
| | | minute = (int)pszData[index]; |
| | | index += 1; |
| | | second = (int)pszData[index]; |
| | | index += 1; |
| | | |
| | | LOGI("<CEquipment-%s>cassetteNo:%d, jobSequenceNo:%d,unitNo:%d, subUnitNo:%d, slotNo:%d %d-%d-%d %d:%d:%d", |
| | | getName().c_str(), |
| | | cassetteNo, |
| | | jobSequenceNo, |
| | | unitNo, |
| | | subUnitNo, |
| | | slotNo, |
| | | year, month, day, hour, minute, second |
| | | ); |
| | | |
| | | |
| | | if (m_processState != PROCESS_STATE::Processing) { |
| | | setProcessState(PROCESS_STATE::Processing); |
| | | } |
| | | |
| | | |
| | | // 缓存Attribute,用于调试时显示信息 |
| | | unsigned int weight = 201; |
| | | pStep->addAttribute(new CAttribute("CassetteNo", |
| | | std::to_string(cassetteNo).c_str(), "", weight++)); |
| | | pStep->addAttribute(new CAttribute("JobSequenceNo", |
| | | std::to_string(jobSequenceNo).c_str(), "", weight++)); |
| | | pStep->addAttribute(new CAttribute("UnitNo", |
| | | std::to_string(unitNo).c_str(), "", weight++)); |
| | | pStep->addAttribute(new CAttribute("SubUnitNo", |
| | | std::to_string(subUnitNo).c_str(), "", weight++)); |
| | | pStep->addAttribute(new CAttribute("SlotNo", |
| | | std::to_string(slotNo).c_str(), "", weight++)); |
| | | pStep->addAttribute(new CAttribute("ProcessStartTime", |
| | | (std::to_string(year) + std::to_string(day) + std::to_string(day) + std::to_string(hour) + std::to_string(minute) + std::to_string(second)).c_str() |
| | | , "", weight++)); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CEquipment::decodeJobProcessEndReport(CStep* pStep, const char* pszData, size_t size) |
| | | { |
| | | int port = (int)(__int64)pStep->getProp("Port"); |
| | | LOGI("<CEquipment-%s>decodeJobProcessEndReport, port:%d", getName().c_str(), port); |
| | | |
| | | short cassetteNo, jobSequenceNo, unitNo, subUnitNo, slotNo; |
| | | int year, month, day, hour, minute, second; |
| | | |
| | | int index = 0; |
| | | std::string strPanelJudgeData, strPanelGradeData; |
| | | memcpy(&cassetteNo, &pszData[index], sizeof(short)); |
| | | index += sizeof(short); |
| | | memcpy(&jobSequenceNo, &pszData[index], sizeof(short)); |
| | | index += sizeof(short); |
| | | memcpy(&unitNo, &pszData[index], sizeof(short)); |
| | | index += sizeof(short); |
| | | memcpy(&subUnitNo, &pszData[index], sizeof(short)); |
| | | index += sizeof(short); |
| | | memcpy(&slotNo, &pszData[index], sizeof(short)); |
| | | index += sizeof(short); |
| | | |
| | | memcpy(&year, &pszData[index], sizeof(short)); |
| | | index += sizeof(short); |
| | | month = (int)pszData[index]; |
| | | index += 1; |
| | | day = (int)pszData[index]; |
| | | index += 1; |
| | | hour = (int)pszData[index]; |
| | | index += 1; |
| | | minute = (int)pszData[index]; |
| | | index += 1; |
| | | second = (int)pszData[index]; |
| | | index += 1; |
| | | |
| | | LOGI("<CEquipment-%s>cassetteNo:%d, jobSequenceNo:%d,unitNo:%d, subUnitNo:%d, slotNo:%d %d-%d-%d %d:%d:%d", |
| | | getName().c_str(), |
| | | cassetteNo, |
| | | jobSequenceNo, |
| | | unitNo, |
| | | subUnitNo, |
| | | slotNo, |
| | | year, month, day, hour, minute, second |
| | | ); |
| | | |
| | | |
| | | if (m_processState != PROCESS_STATE::Complete) { |
| | | setProcessState(PROCESS_STATE::Complete); |
| | | } |
| | | CGlass* pGlass = getGlassFromSlot(port); |
| | | if (pGlass == nullptr) { |
| | | LOGE("<CEquipment-%s>decodeJobProcessEndReport, 找不到对应glass", getName().c_str()); |
| | | } |
| | | else { |
| | | pGlass->processEnd(m_nID, port); |
| | | if (m_processState != PROCESS_STATE::Complete) { |
| | | setProcessState(PROCESS_STATE::Complete); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | // 缓存Attribute,用于调试时显示信息 |
| | | unsigned int weight = 201; |
| | | pStep->addAttribute(new CAttribute("CassetteNo", |
| | | std::to_string(cassetteNo).c_str(), "", weight++)); |
| | | pStep->addAttribute(new CAttribute("JobSequenceNo", |
| | | std::to_string(jobSequenceNo).c_str(), "", weight++)); |
| | | pStep->addAttribute(new CAttribute("UnitNo", |
| | | std::to_string(unitNo).c_str(), "", weight++)); |
| | | pStep->addAttribute(new CAttribute("SubUnitNo", |
| | | std::to_string(subUnitNo).c_str(), "", weight++)); |
| | | pStep->addAttribute(new CAttribute("SlotNo", |
| | | std::to_string(slotNo).c_str(), "", weight++)); |
| | | pStep->addAttribute(new CAttribute("ProcessStartTime", |
| | | (std::to_string(year) + std::to_string(day) + std::to_string(day) + std::to_string(hour) + std::to_string(minute) + std::to_string(second)).c_str() |
| | | , "", weight++)); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CEquipment::onPreStoredJob(int port, CJobDataB* pJobDataB, short& putSlot) |
| | | { |
| | | LOGI("<CEquipment-%s>onPreStoredJob:port:%d|GlassId:%s", |
| | |
| | | CJobDataS* pJobDataS = pGlass->getJobDataS(); |
| | | ASSERT(pJobDataS); |
| | | if (!compareJobData(pJobDataB, pJobDataS)) { |
| | | LOGE("<CEquipemnt-%s>onPreFetchedOutJob,JobData数据不匹配(JobDataB(%d, %d),JobDataS(%d, %d)), 注意排查风险!", m_strName.c_str(), |
| | | LOGE("<CEquipemnt-%s>onPreStoredJob,JobData数据不匹配(JobDataB(%d, %d),JobDataS(%d, %d)), 注意排查风险!", m_strName.c_str(), |
| | | pJobDataB->getCassetteSequenceNo(), pJobDataB->getJobSequenceNo(), |
| | | pJobDataS->getCassetteSequenceNo(), pJobDataS->getJobSequenceNo()); |
| | | return FALSE; |
| | |
| | | |
| | | // 如果没有可用位置,报错 |
| | | Lock(); |
| | | CSlot* pSlot = getAvailableSlotForGlassExcludeSignal((MaterialsType)pJobDataS->getMaterialsType()); |
| | | if (pSlot == nullptr) { |
| | | CSlot* pSlot = getSlot(port - 1); |
| | | ASSERT(pSlot); |
| | | if (pSlot->getContext() != nullptr) { |
| | | Unlock(); |
| | | LOGE("<CEquipemnt-%s>onPreFetchedOutJob,找不到匹配的Slot,不能进料,请注意风险!", m_strName.c_str()); |
| | | LOGE("<CEquipemnt-%s>onPreStoredJob,指定slot(port:%d)有料,请注意风险!", m_strName.c_str(), port); |
| | | return FALSE; |
| | | } |
| | | Unlock(); |
| | | |
| | | |
| | | if (m_listener.onPreStoredJob != nullptr) { |
| | | if (!m_listener.onPreStoredJob(this, pJobDataB, putSlot)) { |
| | | if (!m_listener.onPreStoredJob(this, port, pJobDataB, putSlot)) { |
| | | return FALSE; |
| | | } |
| | | |
| | |
| | | |
| | | short putSlot = 0; |
| | | BOOL bCheck = onPreStoredJob(port, pJobDataB, putSlot); |
| | | if (bCheck) { |
| | | return storedJob(pJobDataB, putSlot); |
| | | if (bCheck && port == putSlot) { |
| | | return storedJob(port, pJobDataB); |
| | | } |
| | | |
| | | // 数据异常,处理或显示 |
| | |
| | | int CEquipment::onSendAble() |
| | | { |
| | | LOGI("<CEquipment-%s>onSendAble.", m_strName.c_str()); |
| | | |
| | | if (m_processState != PROCESS_STATE::Complete) { |
| | | setProcessState(PROCESS_STATE::Complete); |
| | | } |