| | |
| | | for (int i = 0; i < SLOT_MAX; i++) { |
| | | CGlass* pGlass = (CGlass*)m_slot[i].getContext(); |
| | | if (pGlass != nullptr && compareJobData(pJobDataB, pGlass->getJobDataS())) { |
| | | // 取片成功后,回填当前路径节点的离开时间(优先匹配尚未离开的节点)。 |
| | | CPath* pPath = pGlass->getPath(); |
| | | if (pPath != nullptr) { |
| | | CPath* pScan = pPath->getHeadPath(); |
| | | CPath* pOpenNode = nullptr; |
| | | const unsigned int slotNo = (unsigned int)m_slot[i].getNo(); |
| | | const unsigned int unitNo = getSlotUnit((int)slotNo); |
| | | while (pScan != nullptr) { |
| | | if (pScan->getEqID() == m_nID |
| | | && pScan->getUnit() == unitNo |
| | | && pScan->getSlot() == slotNo |
| | | && pScan->getOutTime() == 0) { |
| | | pOpenNode = pScan; |
| | | } |
| | | pScan = pScan->getNext(); |
| | | } |
| | | if (pOpenNode != nullptr) { |
| | | pOpenNode->setOutTime(CToolUnits::getTimestamp()); |
| | | } |
| | | } |
| | | |
| | | pContext = pGlass; |
| | | if (pGlass != nullptr) pGlass->addRef(); |
| | | m_slot[i].setContext(nullptr); |
| | |
| | | return FALSE; |
| | | } |
| | | |
| | | // 如果没有可用位置,报错 |
| | | Lock(); |
| | | CSlot* pSlot = getSlot(putSlot - 1); |
| | | ASSERT(pSlot); |
| | | if (pSlot->getContext() != nullptr) { |
| | | Unlock(); |
| | | 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, port, pJobDataB, putSlot)) { |
| | | return FALSE; |
| | |
| | | } |
| | | } |
| | | |
| | | // 如果没有可用位置,报错(需在 listener 回调后拿到 putSlot) |
| | | if (putSlot <= 0) { |
| | | LOGE("<CEquipemnt-%s>onPreStoredJob, putSlot无效(port:%d).", m_strName.c_str(), port); |
| | | return FALSE; |
| | | } |
| | | Lock(); |
| | | CSlot* pSlot = getSlot(putSlot - 1); |
| | | ASSERT(pSlot); |
| | | if (pSlot->getContext() != nullptr) { |
| | | Unlock(); |
| | | LOGE("<CEquipemnt-%s>onPreStoredJob,指定slot(port:%d)有料,请注意风险!", m_strName.c_str(), port); |
| | | return FALSE; |
| | | } |
| | | Unlock(); |
| | | |
| | | return TRUE; |
| | | } |
| | | |