| | |
| | | #include "CMaster.h" |
| | | #include <future> |
| | | #include <vector> |
| | | #include "RecipeManager.h" |
| | | |
| | | |
| | | namespace SERVO { |
| | |
| | | |
| | | CMaster::~CMaster() |
| | | { |
| | | for (auto item : m_processJobs) { |
| | | delete item; |
| | | } |
| | | m_processJobs.clear(); |
| | | |
| | | if (m_hEventReadBitsThreadExit[0] != nullptr) { |
| | | ::CloseHandle(m_hEventReadBitsThreadExit[0]); |
| | | m_hEventReadBitsThreadExit[0] = nullptr; |
| | |
| | | return nullptr; |
| | | } |
| | | |
| | | CEquipment* CMaster::getEquipment(int id) const |
| | | { |
| | | for (auto item : m_listEquipment) { |
| | | if (item->getID() == id) return item; |
| | | } |
| | | |
| | | return nullptr; |
| | | } |
| | | |
| | | /* |
| | | * 添加LoadPort1 |
| | | * index -- 0~3 |
| | |
| | | { |
| | | m_nContinuousTransferCount = round; |
| | | } |
| | | |
| | | int CMaster::setProcessJobs(std::vector<SERVO::CProcessJob*>& pjs) |
| | | { |
| | | std::vector<SERVO::CProcessJob*> temp; |
| | | for (auto p : pjs) { |
| | | if (p->validate(*this)) { |
| | | temp.push_back(p); |
| | | } |
| | | } |
| | | |
| | | m_processJobs = temp; |
| | | return m_processJobs.size(); |
| | | } |
| | | |
| | | CLoadPort* CMaster::getPortWithCarrierId(const std::string& carrierId) const |
| | | { |
| | | CLoadPort* pPort; |
| | | int eqid[] = { EQ_ID_LOADPORT1, EQ_ID_LOADPORT2, EQ_ID_LOADPORT3, EQ_ID_LOADPORT4}; |
| | | for (int i = 0; i < 4; i++) { |
| | | pPort = (CLoadPort*)getEquipment(eqid[i]); |
| | | ASSERT(pPort); |
| | | if (pPort->getCassetteId().compare(carrierId) == 0) return pPort; |
| | | } |
| | | |
| | | return nullptr; |
| | | } |
| | | |
| | | bool CMaster::isProcessJobsEmpty() const |
| | | { |
| | | return m_processJobs.empty(); |
| | | } |
| | | |
| | | bool CMaster::recipeExists(const std::string& ppid) const |
| | | { |
| | | std::vector<std::string> vecRecipe = RecipeManager::getInstance().getAllPPID(); |
| | | bool exists = std::find(vecRecipe.begin(), vecRecipe.end(), ppid) != vecRecipe.end(); |
| | | return exists; |
| | | } |
| | | |
| | | bool CMaster::carrierPresent(const std::string& carrierId) const |
| | | { |
| | | CLoadPort* pPort = getPortWithCarrierId(carrierId); |
| | | return pPort != nullptr; |
| | | } |
| | | |
| | | bool CMaster::slotUsable(const std::string& carrierId, uint16_t slot) const |
| | | { |
| | | CLoadPort* pPort = getPortWithCarrierId(carrierId); |
| | | if(pPort == nullptr) return false; |
| | | CSlot* pSlot = pPort->getSlot(slot); |
| | | if (pSlot == nullptr) return false; |
| | | return pSlot->isEnable(); |
| | | } |
| | | |
| | | bool CMaster::ceidDefined(uint32_t ceid) const |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | } |