| | |
| | | m_slot[0].setPosition(m_nID); |
| | | m_slot[0].setNo(1); |
| | | m_slot[0].setName("Slot 1(Temp)"); |
| | | m_slot[1].enable(); |
| | | m_slot[1].setPosition(m_nID); |
| | | m_slot[1].setNo(2); |
| | | m_slot[1].setName("Slot 2(Temp)"); |
| | | } |
| | | |
| | | void CArm::onTimer(UINT nTimerid) |
| | |
| | | int CArm::tempStore(CGlass* pGlass) |
| | | { |
| | | // åï¼ä¿è¯å表ä¸åªåå¨ä¸ä¸ªç©æ |
| | | // ä¿®æ¹ä¸ºï¼å
æ¸
空ä¹åçï¼åæ·»å å½åpGlass, 妿pGlassæbuddyï¼ä¹è¦å å
¥åè¡¨ä¸ |
| | | // ä¿®æ¹ä¸ºï¼å
æ¸
空ä¹åçï¼åæ·»å å½åpGlass |
| | | Lock(); |
| | | CGlass* pPreviousGlass; |
| | | pPreviousGlass = (CGlass*)m_slot[0].getContext(); |
| | | if (pPreviousGlass != nullptr) { |
| | | pPreviousGlass->release(); |
| | | } |
| | | pPreviousGlass = (CGlass*)m_slot[1].getContext(); |
| | | if (pPreviousGlass != nullptr) { |
| | | pPreviousGlass->release(); |
| | | } |
| | | |
| | | m_slot[0].setContext(pGlass); |
| | | if (pGlass->getBuddy() != nullptr) { |
| | | m_slot[1].setContext(pGlass->getBuddy()); |
| | | } |
| | | Unlock(); |
| | | |
| | | if (m_listener.onDataChanged != nullptr) { |
| | |
| | | pGlass = pPreviousGlass; |
| | | pGlass->addRef(); |
| | | m_slot[0].setContext(nullptr); |
| | | CGlass* pBuddy = pGlass->getBuddy(); |
| | | if (pBuddy != nullptr) { |
| | | m_slot[1].setContext(nullptr); |
| | | } |
| | | Unlock(); |
| | | |
| | | if (m_listener.onDataChanged != nullptr) { |
| | |
| | | m_slot[0].setPosition(m_nID); |
| | | m_slot[0].setNo(1); |
| | | m_slot[0].setName("Slot 1"); |
| | | m_slot[1].enable(); |
| | | m_slot[1].setPosition(m_nID); |
| | | m_slot[1].setNo(2); |
| | | m_slot[1].setName("Slot 2"); |
| | | } |
| | | |
| | | void CArmTray::onTimer(UINT nTimerid) |
| | |
| | | { |
| | | // å å
¥Pinåå§å代ç |
| | | LOGI("<CBonder>initPins"); |
| | | addPin(SERVO::PinType::INPUT, _T("In")); |
| | | addPin(SERVO::PinType::INPUT, _T("In1")); |
| | | addPin(SERVO::PinType::INPUT, _T("In2")); |
| | | addPin(SERVO::PinType::OUTPUT, _T("Out")); |
| | | } |
| | | |
| | |
| | | return m_nIndex; |
| | | } |
| | | |
| | | BOOL CBonder::hasBondClass() |
| | | { |
| | | CGlass* pGlass = (CGlass*)m_slot[1].getContext(); |
| | | if (pGlass == nullptr) return FALSE; |
| | | CGlass* pBuddy = pGlass->getBuddy(); |
| | | return pBuddy != nullptr; |
| | | } |
| | | |
| | | int CBonder::onProcessData(CProcessData* pProcessData) |
| | | { |
| | | CEquipment::onProcessData(pProcessData); |
| | |
| | | |
| | | // æ£æ¥æ°æ®ï¼å½å两çç»çï¼ä¸ç为G1, ä¸ç为G2, ä¸pProcessDataä¸çidè½å¹é
G1æG2 |
| | | Lock(); |
| | | CGlass* pGlass1 = getGlassFromSlot(1); |
| | | CGlass* pGlass2 = getGlassFromSlot(2); |
| | | CGlass* pGlass2 = getGlassFromSlot(1); |
| | | CGlass* pGlass1 = getGlassFromSlot(2); |
| | | if (pGlass1 == nullptr || pGlass2 == nullptr) { |
| | | LOGE("<CBonder-%s>onProcessData,é误!䏿»¡è¶³ä¸¤çç»çä¸åå«ä¸ºG1ä¸G2çæ¡ä»¶ï¼è¯·æ£æ¥æ°æ®æ¯å¦æ£ç¡®!", m_strName.c_str()); |
| | | Unlock(); |
| | | return -1; |
| | | } |
| | | if (pGlass1->getBuddy() != nullptr || pGlass2->getBuddy() != nullptr) { |
| | | if (pGlass1->getBuddy() != nullptr) { |
| | | LOGE("<CBonder-%s>onProcessData,é误!ç»çè¾æ©å已被ç»å®ï¼è¯·æ£æ¥æ°æ®æ¯å¦æ£ç¡®!", m_strName.c_str()); |
| | | Unlock(); |
| | | return -1; |
| | | } |
| | | |
| | | if (pGlass1->getBuddy() != nullptr || pGlass2->getBuddy() != nullptr) { |
| | | LOGE("<CBonder-%s>onProcessData,é误!ç»çè¾æ©å已被贴åï¼è¯·æ£æ¥æ°æ®æ¯å¦æ£ç¡®!", m_strName.c_str()); |
| | | Unlock(); |
| | | return -1; |
| | | } |
| | | |
| | | if (pGlass1->getType() == pGlass2->getType()) { |
| | | if (pGlass1->getType() != MaterialsType::G1 || pGlass2->getType() != MaterialsType::G2) { |
| | | LOGE("<CBonder-%s>onProcessData,é误!两çç»çæªå¹é
ï¼å¿
é¡»åå«ä¸ºG1åG2ç±»åï¼è¯·æ£æ¥æ°æ®æ¯å¦æ£ç¡®!", m_strName.c_str()); |
| | | Unlock(); |
| | | return -1; |
| | | } |
| | | |
| | | pGlass1->setBuddy(pGlass2); |
| | | pGlass2->setBuddy(pGlass1); |
| | | getSlot(0)->setContext(nullptr); |
| | | LOGE("<CBonder-%s>onProcessData,%så%s已贴å!", m_strName.c_str(), |
| | | pGlass1->getID().c_str(), pGlass2->getID().c_str()); |
| | | Unlock(); |
| | |
| | | public: |
| | | void setIndex(unsigned int index); |
| | | unsigned int getIndex(); |
| | | BOOL hasBondClass(); |
| | | |
| | | private: |
| | | unsigned int m_nIndex; |
| | |
| | | m_pPort[3] = nullptr; |
| | | m_pAligner = nullptr; |
| | | m_pFliper = nullptr; |
| | | m_robotData.status = ROBOT_STATUS::Idle; |
| | | m_robotData.position = ROBOT_POSITION::Port1; |
| | | m_robotData.armState[0] = FALSE; |
| | | m_robotData.armState[1] = FALSE; |
| | | } |
| | | |
| | | CEFEM::~CEFEM() |
| | |
| | | cmds[1].rcmd = static_cast<short>(SERVO::RCMD::Robot_home); |
| | | |
| | | return robotCmds(cmds, 2, onWritedBlock); |
| | | } |
| | | |
| | | RMDATA& CEFEM::getRobotMonitoringData() |
| | | { |
| | | return m_robotData; |
| | | } |
| | | |
| | | void CEFEM::init() |
| | |
| | | { |
| | | __super::onReceiveLBData(pszData, size); |
| | | |
| | | // è§£éå¾å°Robotç¶æ |
| | | // å°åä»(0x3500 - 0x3000)å¼å§ |
| | | int index = 0x500; |
| | | for (int i = 0; i < 6; i++) { |
| | | if (isBitOn(pszData, size, index + i)) { |
| | | m_robotData.status = (ROBOT_STATUS)i; |
| | | break; |
| | | } |
| | | } |
| | | index += 8; |
| | | |
| | | for (int i = 0; i < 11; i++) { |
| | | if (isBitOn(pszData, size, index + i)) { |
| | | m_robotData.position = (ROBOT_POSITION)i; |
| | | break; |
| | | } |
| | | } |
| | | index += 16; |
| | | m_robotData.armState[0] = isBitOn(pszData, size, index); |
| | | m_robotData.armState[1] = isBitOn(pszData, size, index + 1); |
| | | |
| | | |
| | | for (unsigned int i = 0; i < 4; i++) { |
| | | if (m_pPort[i] != nullptr) { |
| | | m_pPort[i]->onReceiveLBData(pszData, size); |
| | |
| | | void setArmTray(unsigned int index, CArmTray* pArmTray); |
| | | int robotCmd(ROBOT_CMD_PARAM& robotCmdParam, ONWRITED onWritedBlock = nullptr); |
| | | int robotCmds(ROBOT_CMD_PARAM* robotCmdParam, unsigned int count, ONWRITED onWritedBlock = nullptr); |
| | | RMDATA& getRobotMonitoringData(); |
| | | |
| | | // å¿«æ·å°è£
|
| | | int robotSendHome(int seq, ONWRITED onWritedBlock = nullptr); |
| | |
| | | CAligner* m_pAligner; |
| | | CFliper* m_pFliper; |
| | | CArmTray* m_pArmTray[2]; |
| | | RMDATA m_robotData; |
| | | }; |
| | | } |
| | | |
| | |
| | | if (!m_slot[i].isEnable()) continue; |
| | | |
| | | CGlass* pGlass = (CGlass*)m_slot[i].getContext(); |
| | | CGlass* pBuddy = nullptr; |
| | | if (pGlass == nullptr) { |
| | | attrubutes.addAttribute(new CAttribute(m_slot[i].getName().c_str(), |
| | | "", "", weight++)); |
| | | } |
| | | else { |
| | | attrubutes.addAttribute(new CAttribute(m_slot[i].getName().c_str(), |
| | | pGlass->getID().c_str(), "", weight++)); |
| | | pBuddy = pGlass->getBuddy(); |
| | | if (pBuddy == nullptr) { |
| | | attrubutes.addAttribute(new CAttribute(m_slot[i].getName().c_str(), |
| | | pGlass->getID().c_str(), "", weight++)); |
| | | } |
| | | else { |
| | | attrubutes.addAttribute(new CAttribute(m_slot[i].getName().c_str(), |
| | | (pGlass->getID() + " -> " + pBuddy->getID()).c_str(), "", weight++)); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | Lock(); |
| | | for (int i = 0; i < SLOT_MAX; i++) { |
| | | m_slot[i].serialize(ar); |
| | | if (m_slot[i].getContext() != nullptr) { |
| | | ((CGlass*)m_slot[i].getContext())->serialize(ar); |
| | | CGlass* pGlass = (CGlass *)m_slot[i].getContext(); |
| | | if (pGlass != nullptr) { |
| | | pGlass->serialize(ar); |
| | | CGlass* pBuddy = pGlass->getBuddy(); |
| | | if (pBuddy != nullptr) { |
| | | pBuddy->serialize(ar); |
| | | } |
| | | } |
| | | } |
| | | Unlock(); |
| | |
| | | CGlass* pGlass = theApp.m_model.m_glassPool.allocaGlass(); |
| | | pGlass->serialize(ar); |
| | | m_slot[i].setContext(pGlass); |
| | | if (pGlass->getBuddy() != nullptr) { |
| | | CGlass* pBuddy = theApp.m_model.m_glassPool.allocaGlass(); |
| | | pBuddy->serialize(ar); |
| | | pGlass->forceSetBuddy(pBuddy); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 梳çåç»çä¹é´çç»å®å
³ç³» |
| | | /* |
| | | Lock(); |
| | | for (int i = 0; i < SLOT_MAX; i++) { |
| | | CGlass* pGlass = (CGlass*)m_slot[i].getContext(); |
| | |
| | | } |
| | | } |
| | | Unlock(); |
| | | */ |
| | | } |
| | | } |
| | | |
| | |
| | | return -3; |
| | | } |
| | | |
| | | // 妿æ¤ç»çå·²ç»è´´åï¼è´´åçç»çä¹è¦ä»å表ä¸ç§»é¤ |
| | | CGlass* pBuddy = pContext->getBuddy(); |
| | | if (pBuddy != nullptr) { |
| | | for (int i = 0; i < SLOT_MAX; i++) { |
| | | CGlass* pGlass = (CGlass*)m_slot[i].getContext(); |
| | | if (pGlass != nullptr && compareJobDataB(pBuddy->getJobDataB(), pGlass->getJobDataB())) { |
| | | m_slot[i].setContext(nullptr); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | ((CArm*)m_pArm)->tempStore(pContext); |
| | | pContext->release(); |
| | |
| | | |
| | | |
| | | // 妿æ¤ç»çå·²ç»è´´åï¼è´´åçç»çä¹è¦ä»å å
¥å°åè¡¨ä¸ |
| | | /* |
| | | CGlass* pBuddy = pGlass->getBuddy(); |
| | | if (pBuddy != nullptr) { |
| | | Lock(); |
| | |
| | | } |
| | | Unlock(); |
| | | } |
| | | |
| | | */ |
| | | |
| | | if (m_listener.onDataChanged != nullptr) { |
| | | m_listener.onDataChanged(this, EDCC_STORED_JOB); |
| | |
| | | { |
| | | // å å
¥Pinåå§å代ç |
| | | LOGI("<CFliper>initPins"); |
| | | addPin(SERVO::PinType::INPUT, _T("In1")); |
| | | addPin(SERVO::PinType::INPUT, _T("In2")); |
| | | addPin(SERVO::PinType::OUTPUT, _T("Out")); |
| | | addPin(SERVO::PinType::INPUT, _T("In")); |
| | | addPin(SERVO::PinType::OUTPUT, _T("Out1")); |
| | | addPin(SERVO::PinType::OUTPUT, _T("Out2")); |
| | | } |
| | | |
| | | // å¿
é¡»è¦å®ç°çè彿°ï¼å¨æ¤åå§åSlotä¿¡æ¯ |
| | |
| | | m_jobDataB.unserialize(temp, JOBDATAB_SIZE); |
| | | ar.Read(temp, JOBDATAS_SIZE); |
| | | m_jobDataS.unserialize(temp, JOBDATAS_SIZE); |
| | | ar >> ullPath; // è¿æ¯m_pBuddy, ç¨ä¸ä¸ |
| | | ar >> ullPath; m_pBuddy = (CGlass*)ullPath; |
| | | ReadString(ar, m_strBuddyId); |
| | | Unlock(); |
| | | } |
| | |
| | | if (m_pBuddy != nullptr) return FALSE; |
| | | if (pGlass->getType() == this->getType()) return FALSE; |
| | | m_pBuddy = pGlass; |
| | | if (m_type == MaterialsType::G1) { |
| | | m_pBuddy->addRef(); |
| | | } |
| | | m_pBuddy->addRef(); |
| | | m_strBuddyId = m_pBuddy->getID(); |
| | | |
| | | return TRUE; |
| | | } |
| | | |
| | | BOOL CGlass::forceSetBuddy(CGlass* pGlass) |
| | | { |
| | | m_pBuddy = pGlass; |
| | | m_pBuddy->addRef(); |
| | | m_strBuddyId = m_pBuddy->getID(); |
| | | |
| | | return TRUE; |
| | |
| | | void setJobDataS(CJobDataS* pJobDataS); |
| | | CJobDataS* getJobDataS(); |
| | | BOOL setBuddy(CGlass* pGlass); |
| | | BOOL forceSetBuddy(CGlass* pGlass); |
| | | CGlass* getBuddy(); |
| | | std::string& getBuddyId(); |
| | | void processEnd(unsigned int nEqId, unsigned int nUnit); |
| | |
| | | // å å
¥Pinåå§å代ç |
| | | LOGI("<CLoadPort>initPins"); |
| | | addPin(SERVO::PinType::INPUT, _T("In")); |
| | | addPin(SERVO::PinType::OUTPUT, _T("Out1")); |
| | | addPin(SERVO::PinType::OUTPUT, _T("Out2")); |
| | | addPin(SERVO::PinType::OUTPUT, _T("Out")); |
| | | } |
| | | |
| | | // å¿
é¡»è¦å®ç°çè彿°ï¼å¨æ¤åå§åSlotä¿¡æ¯ |
| | |
| | | |
| | | if (ar.IsStoring()) { |
| | | ar << m_nIndex; |
| | | ar << (int)m_portType; |
| | | ar << (int)m_portMode; |
| | | ar << (int)m_cassetteType; |
| | | ar << (int)m_transferMode; |
| | | ar << m_bEnable; |
| | | ar << m_bAutoChangeEnable; |
| | | //ar << (int)m_portType; |
| | | //ar << (int)m_portMode; |
| | | //ar << (int)m_cassetteType; |
| | | //ar << (int)m_transferMode; |
| | | //ar << m_bEnable; |
| | | //ar << m_bAutoChangeEnable; |
| | | m_portStatusReport.serialize(ar); |
| | | } |
| | | else { |
| | | int temp; |
| | | ar >> m_nIndex; |
| | | ar >> temp; m_portType = (PortType)temp; |
| | | ar >> temp; m_portMode = (PortMode)temp; |
| | | ar >> temp; m_cassetteType = (CassetteType)temp; |
| | | ar >> temp; m_transferMode = (TransferMode)temp; |
| | | ar >> m_bEnable; |
| | | ar >> m_bAutoChangeEnable; |
| | | //ar >> temp; m_portType = (PortType)temp; |
| | | //ar >> temp; m_portMode = (PortMode)temp; |
| | | //ar >> temp; m_cassetteType = (CassetteType)temp; |
| | | //ar >> temp; m_transferMode = (TransferMode)temp; |
| | | //ar >> m_bEnable; |
| | | //ar >> m_bAutoChangeEnable; |
| | | m_portStatusReport.serialize(ar); |
| | | } |
| | | } |
| | |
| | | return 0; |
| | | } |
| | | |
| | | void CLoadPort::localEanblePort(BOOL bEnable) |
| | | { |
| | | m_bEnable = bEnable; |
| | | } |
| | | |
| | | void CLoadPort::localSetPortType(PortType type) |
| | | { |
| | | m_portType = type; |
| | | } |
| | | |
| | | void CLoadPort::localSetPortMode(PortMode mode) |
| | | { |
| | | m_portMode = mode; |
| | | } |
| | | |
| | | void CLoadPort::localSetCessetteType(CassetteType type) |
| | | { |
| | | m_cassetteType = type; |
| | | } |
| | | |
| | | void CLoadPort::localSetTransferMode(TransferMode mode) |
| | | { |
| | | m_transferMode = mode; |
| | | } |
| | | |
| | | void CLoadPort::localAutoChangeEnable(BOOL bEnable) |
| | | { |
| | | m_bAutoChangeEnable = bEnable; |
| | | } |
| | | |
| | | /* |
| | | * çææµè¯ç¨çç»çå表 |
| | | */ |
| | |
| | | int setCassetteType(CassetteType type, ONWRITED onWritedBlock = nullptr); |
| | | int setTransferMode(TransferMode mode, ONWRITED onWritedBlock = nullptr); |
| | | int eableAutoChange(BOOL bEnable, ONWRITED onWritedBlock = nullptr); |
| | | void localEanblePort(BOOL bEnable); |
| | | void localSetPortType(PortType type); |
| | | void localSetPortMode(PortMode mode); |
| | | void localSetCessetteType(CassetteType type); |
| | | void localSetTransferMode(TransferMode mode); |
| | | void localAutoChangeEnable(BOOL bEnable); |
| | | |
| | | public: |
| | | void setIndex(unsigned int index); |
| | |
| | | CLoadPort* pLoadPort3 = (CLoadPort*)getEquipment(EQ_ID_LOADPORT3); |
| | | CLoadPort* pLoadPort4 = (CLoadPort*)getEquipment(EQ_ID_LOADPORT4); |
| | | CFliper* pFliper = (CFliper*)getEquipment(EQ_ID_FLIPER); |
| | | CVacuumBake* pVacuumBack = (CVacuumBake*)getEquipment(EQ_ID_VACUUMBAKE); |
| | | CVacuumBake* pVacuumBake = (CVacuumBake*)getEquipment(EQ_ID_VACUUMBAKE); |
| | | CAligner* pAligner = (CAligner*)getEquipment(EQ_ID_ALIGNER); |
| | | CBonder* pBonder1 = (CBonder*)getEquipment(EQ_ID_Bonder1); |
| | | CBonder* pBonder2 = (CBonder*)getEquipment(EQ_ID_Bonder2); |
| | |
| | | ASSERT(pLoadPort3); |
| | | ASSERT(pLoadPort4); |
| | | ASSERT(pFliper); |
| | | ASSERT(pVacuumBack); |
| | | ASSERT(pVacuumBake); |
| | | ASSERT(pAligner); |
| | | ASSERT(pBonder1); |
| | | ASSERT(pBonder2); |
| | |
| | | |
| | | // è°åº¦é»è¾å¤ç |
| | | else if (m_state == MASTERSTATE::RUNNING) { |
| | | unlock(); |
| | | // LOGI("è°åº¦å¤çä¸..."); |
| | | // æ£æµå¤ærobotç¶æ |
| | | RMDATA& rmd = pEFEM->getRobotMonitoringData(); |
| | | if (rmd.status != ROBOT_STATUS::Idle && rmd.status != ROBOT_STATUS::Run) { |
| | | unlock(); |
| | | continue; |
| | | } |
| | | |
| | | lock(); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | unlock(); |
| | | // æ£æµå°å½åææ£å¨ä¸åçä»»å¡ï¼ç¡®ä¿å½åä»»å¡å®ææä¸æ¢åç»§ç» |
| | |
| | | |
| | | |
| | | // Measurement -> LoadPort |
| | | LOGI("Arm1 %s, Arm2 %s.", rmd.armState[0] ? _T("ä¸å¯ç¨") : _T("å¯ç¨"), |
| | | rmd.armState[1] ? _T("ä¸å¯ç¨") : _T("å¯ç¨")); |
| | | CLoadPort* pEqLoadPort[] = { pLoadPort1, pLoadPort2, pLoadPort3, pLoadPort4 }; |
| | | CEquipment* pEqTar[] = { pVacuumBack, pFliper }; |
| | | CEquipment* pEqTar[] = { pVacuumBake, pFliper }; |
| | | if (primaryType == MaterialsType::G2) { |
| | | pEqTar[0] = pFliper; |
| | | pEqTar[1] = pVacuumBack; |
| | | pEqTar[1] = pVacuumBake; |
| | | } |
| | | for (int s = 0; s < 4; s++) { |
| | | if (pEqLoadPort[s]->isEnable() |
| | | if (!rmd.armState[0] && pEqLoadPort[s]->isEnable() |
| | | && pEqLoadPort[s]->getPortType() == PortType::Unloading |
| | | && pEqLoadPort[s]->getPortMode() == PortMode::ReadyToUnload) { |
| | | m_pActiveRobotTask = createTransferTask(pMeasurement, pEqLoadPort[s], primaryType, secondaryType); |
| | |
| | | |
| | | PORT_PUT: |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | m_pActiveRobotTask->run(); |
| | | m_pActiveRobotTask->pick(); |
| | | std::string strDescription = m_pActiveRobotTask->getDescription(); |
| | | unlock(); |
| | | if (m_listener.onRobotTaskEvent != nullptr) { |
| | |
| | | |
| | | |
| | | // BakeCooling ->Measurement |
| | | m_pActiveRobotTask = createTransferTask_bakecooling_to_measurement(pBakeCooling, pMeasurement); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | m_pActiveRobotTask->run(); |
| | | std::string strDescription = m_pActiveRobotTask->getDescription(); |
| | | unlock(); |
| | | if (m_listener.onRobotTaskEvent != nullptr) { |
| | | m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE); |
| | | if (!rmd.armState[0]) { |
| | | m_pActiveRobotTask = createTransferTask_bakecooling_to_measurement(pBakeCooling, pMeasurement); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | m_pActiveRobotTask->pick(); |
| | | std::string strDescription = m_pActiveRobotTask->getDescription(); |
| | | unlock(); |
| | | if (m_listener.onRobotTaskEvent != nullptr) { |
| | | m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE); |
| | | } |
| | | LOGI("å建æ°ä»»å¡<%s>...", strDescription.c_str()); |
| | | continue; |
| | | } |
| | | LOGI("å建æ°ä»»å¡<%s>...", strDescription.c_str()); |
| | | continue; |
| | | } |
| | | |
| | | |
| | | |
| | | // BakeCoolingå
é¨ |
| | | // Bake -> Cooling |
| | | m_pActiveRobotTask = createTransferTask_bake_to_cooling(pBakeCooling); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | m_pActiveRobotTask->run(); |
| | | std::string strDescription = m_pActiveRobotTask->getDescription(); |
| | | unlock(); |
| | | if (m_listener.onRobotTaskEvent != nullptr) { |
| | | m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE); |
| | | if (!rmd.armState[0]) { |
| | | m_pActiveRobotTask = createTransferTask_bake_to_cooling(pBakeCooling); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | m_pActiveRobotTask->pick(); |
| | | std::string strDescription = m_pActiveRobotTask->getDescription(); |
| | | unlock(); |
| | | if (m_listener.onRobotTaskEvent != nullptr) { |
| | | m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE); |
| | | } |
| | | LOGI("å建æ°ä»»å¡<%s>...", strDescription.c_str()); |
| | | continue; |
| | | } |
| | | LOGI("å建æ°ä»»å¡<%s>...", strDescription.c_str()); |
| | | continue; |
| | | } |
| | | |
| | | |
| | | // Bonder -> BakeCooling |
| | | m_pActiveRobotTask = createTransferTask_bonder_to_bakecooling(pBonder1, pBakeCooling); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | m_pActiveRobotTask->run(); |
| | | std::string strDescription = m_pActiveRobotTask->getDescription(); |
| | | unlock(); |
| | | if (m_listener.onRobotTaskEvent != nullptr) { |
| | | m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE); |
| | | if (!rmd.armState[0]) { |
| | | m_pActiveRobotTask = createTransferTask_bonder_to_bakecooling(pBonder1, pBakeCooling); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | m_pActiveRobotTask->pick(); |
| | | std::string strDescription = m_pActiveRobotTask->getDescription(); |
| | | unlock(); |
| | | if (m_listener.onRobotTaskEvent != nullptr) { |
| | | m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE); |
| | | } |
| | | LOGI("å建æ°ä»»å¡<%s>...", strDescription.c_str()); |
| | | continue; |
| | | } |
| | | LOGI("å建æ°ä»»å¡<%s>...", strDescription.c_str()); |
| | | continue; |
| | | } |
| | | |
| | | m_pActiveRobotTask = createTransferTask_bonder_to_bakecooling(pBonder2, pBakeCooling); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | m_pActiveRobotTask->run(); |
| | | std::string strDescription = m_pActiveRobotTask->getDescription(); |
| | | unlock(); |
| | | if (m_listener.onRobotTaskEvent != nullptr) { |
| | | m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE); |
| | | if (!rmd.armState[0]) { |
| | | m_pActiveRobotTask = createTransferTask_bonder_to_bakecooling(pBonder2, pBakeCooling); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | m_pActiveRobotTask->pick(); |
| | | std::string strDescription = m_pActiveRobotTask->getDescription(); |
| | | unlock(); |
| | | if (m_listener.onRobotTaskEvent != nullptr) { |
| | | m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE); |
| | | } |
| | | LOGI("å建æ°ä»»å¡<%s>...", strDescription.c_str()); |
| | | continue; |
| | | } |
| | | LOGI("å建æ°ä»»å¡<%s>...", strDescription.c_str()); |
| | | continue; |
| | | } |
| | | |
| | | // Aligner -> Bonder |
| | | m_pActiveRobotTask = createTransferTask(pAligner, pBonder1, primaryType, secondaryType); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | m_pActiveRobotTask->run(); |
| | | std::string strDescription = m_pActiveRobotTask->getDescription(); |
| | | unlock(); |
| | | if (m_listener.onRobotTaskEvent != nullptr) { |
| | | m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE); |
| | | } |
| | | LOGI("å建æ°ä»»å¡<%s>...", strDescription.c_str()); |
| | | continue; |
| | | } |
| | | |
| | | m_pActiveRobotTask = createTransferTask(pAligner, pBonder2, primaryType, secondaryType); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | m_pActiveRobotTask->run(); |
| | | std::string strDescription = m_pActiveRobotTask->getDescription(); |
| | | unlock(); |
| | | if (m_listener.onRobotTaskEvent != nullptr) { |
| | | m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE); |
| | | } |
| | | LOGI("å建æ°ä»»å¡<%s>...", strDescription.c_str()); |
| | | continue; |
| | | } |
| | | |
| | | |
| | | // Fliper(G2) -> Aligner |
| | | // VacuumBake(G1) -> Aligner |
| | | m_pActiveRobotTask = createTransferTask(pFliper, pAligner, primaryType, secondaryType); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | m_pActiveRobotTask->run(); |
| | | std::string strDescription = m_pActiveRobotTask->getDescription(); |
| | | unlock(); |
| | | if (m_listener.onRobotTaskEvent != nullptr) { |
| | | m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE); |
| | | // Fliper(G2) -> Bonder |
| | | // VacuumBake(G1) -> Bonder |
| | | if (!rmd.armState[1] && !pBonder1->hasBondClass()) { |
| | | m_pActiveRobotTask = createTransferTask(pFliper, pBonder1, primaryType, secondaryType, 2); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | m_pActiveRobotTask->pick(); |
| | | std::string strDescription = m_pActiveRobotTask->getDescription(); |
| | | unlock(); |
| | | if (m_listener.onRobotTaskEvent != nullptr) { |
| | | m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE); |
| | | } |
| | | LOGI("å建æ°ä»»å¡<%s>...", strDescription.c_str()); |
| | | continue; |
| | | } |
| | | LOGI("å建æ°ä»»å¡<%s>...", strDescription.c_str()); |
| | | continue; |
| | | } |
| | | |
| | | m_pActiveRobotTask = createTransferTask(pVacuumBack, pAligner, primaryType, secondaryType); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | m_pActiveRobotTask->run(); |
| | | std::string strDescription = m_pActiveRobotTask->getDescription(); |
| | | unlock(); |
| | | if (m_listener.onRobotTaskEvent != nullptr) { |
| | | m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE); |
| | | if (!rmd.armState[1] && !pBonder2->hasBondClass()) { |
| | | m_pActiveRobotTask = createTransferTask(pFliper, pBonder2, primaryType, secondaryType, 2); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | m_pActiveRobotTask->pick(); |
| | | std::string strDescription = m_pActiveRobotTask->getDescription(); |
| | | unlock(); |
| | | if (m_listener.onRobotTaskEvent != nullptr) { |
| | | m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE); |
| | | } |
| | | LOGI("å建æ°ä»»å¡<%s>...", strDescription.c_str()); |
| | | continue; |
| | | } |
| | | LOGI("å建æ°ä»»å¡<%s>...", strDescription.c_str()); |
| | | continue; |
| | | } |
| | | |
| | | if (!rmd.armState[0] && !pBonder1->hasBondClass()) { |
| | | m_pActiveRobotTask = createTransferTask(pVacuumBake, pBonder1, primaryType, secondaryType); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | m_pActiveRobotTask->pick(); |
| | | std::string strDescription = m_pActiveRobotTask->getDescription(); |
| | | unlock(); |
| | | if (m_listener.onRobotTaskEvent != nullptr) { |
| | | m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE); |
| | | } |
| | | LOGI("å建æ°ä»»å¡<%s>...", strDescription.c_str()); |
| | | continue; |
| | | } |
| | | } |
| | | |
| | | if (!rmd.armState[0] && !pBonder2->hasBondClass()) { |
| | | m_pActiveRobotTask = createTransferTask(pVacuumBake, pBonder2, primaryType, secondaryType); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | m_pActiveRobotTask->pick(); |
| | | std::string strDescription = m_pActiveRobotTask->getDescription(); |
| | | unlock(); |
| | | if (m_listener.onRobotTaskEvent != nullptr) { |
| | | m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE); |
| | | } |
| | | LOGI("å建æ°ä»»å¡<%s>...", strDescription.c_str()); |
| | | continue; |
| | | } |
| | | } |
| | | |
| | | |
| | | // LoadPort -> Fliper(G2) |
| | | // LoadPort -> VacuumBake(G1) |
| | | // Aligner -> Fliper(G2) |
| | | // Aligner -> VacuumBake(G1) |
| | | if (!rmd.armState[1]) { |
| | | m_pActiveRobotTask = createTransferTask(pAligner, pFliper, primaryType, secondaryType, 2); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | m_pActiveRobotTask->pick(); |
| | | std::string strDescription = m_pActiveRobotTask->getDescription(); |
| | | unlock(); |
| | | if (m_listener.onRobotTaskEvent != nullptr) { |
| | | m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE); |
| | | } |
| | | LOGI("å建æ°ä»»å¡<%s>...", strDescription.c_str()); |
| | | continue; |
| | | } |
| | | } |
| | | |
| | | if (!rmd.armState[0]) { |
| | | m_pActiveRobotTask = createTransferTask(pAligner, pVacuumBake, primaryType, secondaryType); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | m_pActiveRobotTask->pick(); |
| | | std::string strDescription = m_pActiveRobotTask->getDescription(); |
| | | unlock(); |
| | | if (m_listener.onRobotTaskEvent != nullptr) { |
| | | m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE); |
| | | } |
| | | LOGI("å建æ°ä»»å¡<%s>...", strDescription.c_str()); |
| | | continue; |
| | | } |
| | | } |
| | | |
| | | // LoadPort -> Aligner |
| | | for (int s = 0; s < 4; s++) { |
| | | for (int t = 0; t < 2; t++) { |
| | | if (pEqLoadPort[s]->isEnable() |
| | | && pEqLoadPort[s]->getPortType() == PortType::Loading |
| | | && pEqLoadPort[s]->getPortMode() == PortMode::ReadyToLoad) { |
| | | m_pActiveRobotTask = createTransferTask(pEqLoadPort[s], pEqTar[t], primaryType, secondaryType); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | goto PORT_GET; |
| | | } |
| | | if (!rmd.armState[0] && pEqLoadPort[s]->isEnable() |
| | | && pEqLoadPort[s]->getPortType() == PortType::Loading |
| | | && pEqLoadPort[s]->getPortMode() == PortMode::ReadyToLoad) { |
| | | m_pActiveRobotTask = createTransferTask(pEqLoadPort[s], pAligner, primaryType, secondaryType); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | goto PORT_GET; |
| | | } |
| | | } |
| | | } |
| | | |
| | | PORT_GET: |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | m_pActiveRobotTask->run(); |
| | | m_pActiveRobotTask->pick(); |
| | | std::string strDescription = m_pActiveRobotTask->getDescription(); |
| | | unlock(); |
| | | if (m_listener.onRobotTaskEvent != nullptr) { |
| | |
| | | BOOL bOk = FALSE; |
| | | lock(); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | if (m_pActiveRobotTask->getTarPosition() == p->getID()) { |
| | | // æ¯å¦å·²ç»è¿å
¥æè(å³åç宿),è¿å
¥ä¸ä¸æ¥ï¼æ¾ç |
| | | if (m_pActiveRobotTask->isPicking() && |
| | | ((m_pActiveRobotTask->getArmNo() == 1 && p->getID() == EQ_ID_ARM_TRAY1) |
| | | || (m_pActiveRobotTask->getArmNo() == 2 && p->getID() == EQ_ID_ARM_TRAY2)) |
| | | ) { |
| | | slot = 1; |
| | | bOk = TRUE; |
| | | } |
| | | |
| | | // æ¯å¦æ¾ç宿 |
| | | else if (m_pActiveRobotTask->isPlacing() && |
| | | m_pActiveRobotTask->getTarPosition() == p->getID()) { |
| | | CGlass* pGlass = p->getGlassFromSlot(m_pActiveRobotTask->getTarSlot()); |
| | | if (pGlass == nullptr) { |
| | | bOk = TRUE; |
| | | slot = m_pActiveRobotTask->getTarSlot(); |
| | | LOGI("<CMaster>onPreFethedOutJob, å·²æ ¡éªæ°æ®ä¸è´æ§."); |
| | | } |
| | | } |
| | | else if (p->getID() == EQ_ID_ARM_TRAY1 || p->getID() == EQ_ID_ARM_TRAY2) { |
| | | slot = 1; |
| | | bOk = TRUE; |
| | | } |
| | | } |
| | | unlock(); |
| | |
| | | if (code == EDCC_FETCHOUT_JOB) { |
| | | lock(); |
| | | if (m_pActiveRobotTask != nullptr && m_pActiveRobotTask->getSrcPosition() == p->getID()) { |
| | | m_pActiveRobotTask->fetchOut(); |
| | | LOGI("å¼å§åç..."); |
| | | } |
| | | unlock(); |
| | | } |
| | | else if (code == EDCC_STORED_JOB) { |
| | | lock(); |
| | | if (m_pActiveRobotTask != nullptr && m_pActiveRobotTask->getTarPosition() == p->getID()) { |
| | | if (m_pActiveRobotTask != nullptr |
| | | && m_pActiveRobotTask->isPicking() |
| | | && ((m_pActiveRobotTask->getArmNo() == 1 && p->getID() == EQ_ID_ARM_TRAY1) |
| | | || (m_pActiveRobotTask->getArmNo() == 2 && p->getID() == EQ_ID_ARM_TRAY2)) |
| | | ) { |
| | | LOGI("åç宿."); |
| | | m_pActiveRobotTask->fetchOut(); |
| | | m_pActiveRobotTask->place(); |
| | | } |
| | | |
| | | else if (m_pActiveRobotTask != nullptr |
| | | && m_pActiveRobotTask->isPlacing() |
| | | && m_pActiveRobotTask->getTarPosition() == p->getID()) { |
| | | m_pActiveRobotTask->stored(); |
| | | m_pActiveRobotTask->completed(); |
| | | LOGI("æ¾ç宿..."); |
| | | |
| | | // å®ææ¤æ¡æ¬éä»»å¡ï¼ä½è¦ææ°æ®åæ¶æ¯ä¸æåºç¨å± |
| | | unlock(); |
| | | |
| | | |
| | | |
| | | lock(); |
| | |
| | | CBakeCooling* pBakeCooling = (CBakeCooling*)getEquipment(EQ_ID_BAKE_COOLING); |
| | | CMeasurement* pMeasurement = (CMeasurement*)getEquipment(EQ_ID_MEASUREMENT); |
| | | |
| | | nRet = pLoadPort1->getPin("Out1")->connectPin(pFliper->getPin("In1")); |
| | | nRet = pLoadPort1->getPin("Out")->connectPin(pAligner->getPin("In1")); |
| | | if (nRet < 0) { |
| | | LOGE("è¿æ¥LoadPort1-Fliper失败"); |
| | | } |
| | | nRet = pLoadPort2->getPin("Out1")->connectPin(pFliper->getPin("In2")); |
| | | nRet = pLoadPort2->getPin("Out")->connectPin(pAligner->getPin("In2")); |
| | | if (nRet < 0) { |
| | | LOGE("è¿æ¥LoadPort1-Fliper失败"); |
| | | } |
| | | |
| | | nRet = pLoadPort1->getPin("Out2")->connectPin(pVacuumBake->getPin("In1")); |
| | | nRet = pAligner->getPin("Out1")->connectPin(pFliper->getPin("In")); |
| | | if (nRet < 0) { |
| | | LOGE("è¿æ¥LoadPort1-VacuumBake失败"); |
| | | LOGE("è¿æ¥Aligner-Fliper失败"); |
| | | } |
| | | nRet = pLoadPort2->getPin("Out2")->connectPin(pVacuumBake->getPin("In2")); |
| | | nRet = pAligner->getPin("Out2")->connectPin(pVacuumBake->getPin("In")); |
| | | if (nRet < 0) { |
| | | LOGE("è¿æ¥LoadPort1-VacuumBake失败"); |
| | | LOGE("è¿æ¥Aligner-VacuumBake失败"); |
| | | } |
| | | |
| | | nRet = pFliper->getPin("Out")->connectPin(pAligner->getPin("In1")); |
| | | nRet = pFliper->getPin("Out1")->connectPin(pBonder1->getPin("In1")); |
| | | if (nRet < 0) { |
| | | LOGE("è¿æ¥Fliper-Aligner失败"); |
| | | LOGE("è¿æ¥Fliper-Bonder1失败"); |
| | | } |
| | | nRet = pFliper->getPin("Out2")->connectPin(pBonder2->getPin("In1")); |
| | | if (nRet < 0) { |
| | | LOGE("è¿æ¥Fliper-Bonder2失败"); |
| | | } |
| | | |
| | | nRet = pVacuumBake->getPin("Out")->connectPin(pAligner->getPin("In2")); |
| | | nRet = pVacuumBake->getPin("Out1")->connectPin(pBonder1->getPin("In2")); |
| | | if (nRet < 0) { |
| | | LOGE("è¿æ¥VacuumBake-Aligner失败"); |
| | | LOGE("è¿æ¥VacuumBake-Bonder1失败"); |
| | | } |
| | | |
| | | nRet = pAligner->getPin("Out1")->connectPin(pBonder1->getPin("In")); |
| | | nRet = pVacuumBake->getPin("Out2")->connectPin(pBonder2->getPin("In2")); |
| | | if (nRet < 0) { |
| | | LOGE("è¿æ¥Aligner-Bondere1失败"); |
| | | } |
| | | |
| | | nRet = pAligner->getPin("Out2")->connectPin(pBonder2->getPin("In")); |
| | | if (nRet < 0) { |
| | | LOGE("è¿æ¥Aligner-Bondere2失败"); |
| | | LOGE("è¿æ¥VacuumBake-Bonder2失败"); |
| | | } |
| | | |
| | | nRet = pBonder1->getPin("Out")->connectPin(pBakeCooling->getPin("In1")); |
| | |
| | | |
| | | static int taskSeqNo = 0; |
| | | CRobotTask* CMaster::createTransferTask(CEquipment* pSrcEq, CEquipment* pTarEq, |
| | | MaterialsType primaryType/* = MaterialsType::G1*/, MaterialsType secondaryType/* = MaterialsType::G2*/) |
| | | MaterialsType primaryType/* = MaterialsType::G1*/, MaterialsType secondaryType/* = MaterialsType::G2*/, |
| | | int armNo/* = 1*/) |
| | | { |
| | | CRobotTask* pTask = nullptr; |
| | | CSlot* pSrcSlot, * pTarSlot; |
| | |
| | | pTask = new CRobotTask(); |
| | | pTask->setContext(pSrcSlot->getContext()); |
| | | pTask->setEFEM((CEFEM*)getEquipment(EQ_ID_EFEM)); |
| | | pTask->setRobotTransferParam(++taskSeqNo, 1, pSrcSlot->getPosition(), |
| | | taskSeqNo = pTask->setRobotTransferParam(taskSeqNo, armNo, pSrcSlot->getPosition(), |
| | | pTarSlot->getPosition(), pSrcSlot->getNo(), pTarSlot->getNo()); |
| | | } |
| | | |
| | |
| | | pTask = new CRobotTask(); |
| | | pTask->setContext(pSrcSlot->getContext()); |
| | | pTask->setEFEM((CEFEM*)getEquipment(EQ_ID_EFEM)); |
| | | pTask->setRobotTransferParam(++taskSeqNo, 1, pSrcSlot->getPosition(), |
| | | taskSeqNo = pTask->setRobotTransferParam(taskSeqNo, 1, pSrcSlot->getPosition(), |
| | | pTarSlot->getPosition(), pSrcSlot->getNo(), pTarSlot->getNo()); |
| | | } |
| | | |
| | |
| | | pTask = new CRobotTask(); |
| | | pTask->setContext(pSrcSlot->getContext()); |
| | | pTask->setEFEM((CEFEM*)getEquipment(EQ_ID_EFEM)); |
| | | pTask->setRobotTransferParam(++taskSeqNo, 1, pSrcSlot->getPosition(), |
| | | taskSeqNo = pTask->setRobotTransferParam(taskSeqNo, 1, pSrcSlot->getPosition(), |
| | | pTarSlot->getPosition(), pSrcSlot->getNo(), pTarSlot->getNo()); |
| | | } |
| | | |
| | |
| | | pTask = new CRobotTask(); |
| | | pTask->setContext(pSrcSlot->getContext()); |
| | | pTask->setEFEM((CEFEM*)getEquipment(EQ_ID_EFEM)); |
| | | pTask->setRobotTransferParam(++taskSeqNo, 1, pSrcSlot->getPosition(), |
| | | taskSeqNo = pTask->setRobotTransferParam(taskSeqNo, 1, pSrcSlot->getPosition(), |
| | | pTarSlot->getPosition(), pSrcSlot->getNo(), pTarSlot->getNo()); |
| | | } |
| | | |
| | |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | void CMaster::setPortType(unsigned int index, BOOL enable, int type, int mode, |
| | | int cassetteType, int transferMode, BOOL autoChangeEnable) |
| | | { |
| | | ASSERT(index < 4); |
| | | int eqid[] = { EQ_ID_LOADPORT1, EQ_ID_LOADPORT2, EQ_ID_LOADPORT3, EQ_ID_LOADPORT4}; |
| | | CLoadPort* pPort = (CLoadPort*)getEquipment(eqid[index]); |
| | | pPort->localEanblePort(enable); |
| | | pPort->localSetPortType((SERVO::PortType)type); |
| | | pPort->localSetPortMode((SERVO::PortMode)mode); |
| | | pPort->localSetCessetteType((SERVO::CassetteType)cassetteType); |
| | | pPort->localSetTransferMode((SERVO::TransferMode)transferMode); |
| | | pPort->localAutoChangeEnable(autoChangeEnable); |
| | | } |
| | | } |
| | |
| | | CEquipment* getEquipment(int id); |
| | | void setCacheFilepath(const char* pszFilepath); |
| | | int abortCurrentTask(); |
| | | void setPortType(unsigned int index, BOOL enable, int type, int mode, |
| | | int cassetteType, int transferMode, BOOL autoChangeEnable); |
| | | |
| | | private: |
| | | inline void lock() { EnterCriticalSection(&m_criticalSection); } |
| | |
| | | void serialize(CArchive& ar); |
| | | void setState(MASTERSTATE state); |
| | | CRobotTask* createTransferTask(CEquipment* pSrcEq, CEquipment* pTarEq, |
| | | MaterialsType primaryType = MaterialsType::G1, MaterialsType secondaryType = MaterialsType::G2); |
| | | MaterialsType primaryType = MaterialsType::G1, MaterialsType secondaryType = MaterialsType::G2, |
| | | int armNo = 1); |
| | | CRobotTask* createTransferTask_bonder_to_bakecooling(CEquipment* pSrcEq, CEquipment* pTarEq); |
| | | CRobotTask* createTransferTask_bake_to_cooling(CEquipment* pSrcEq); |
| | | CRobotTask* createTransferTask_bakecooling_to_measurement(CEquipment* pSrcEq, CEquipment* pTarEq); |
| | |
| | | m_slot[0].setPosition(m_nID); |
| | | m_slot[0].setNo(1); |
| | | m_slot[0].setName("Slot 1"); |
| | | m_slot[1].enable(); |
| | | m_slot[1].setPosition(m_nID); |
| | | m_slot[1].setNo(2); |
| | | m_slot[1].setName("Slot 2"); |
| | | } |
| | | |
| | | void CMeasurement::onTimer(UINT nTimerid) |
| | |
| | | CComboBox* pComboBox; |
| | | std::string strTemp; |
| | | |
| | | |
| | | ((CButton*)GetDlgItem(IDC_CHECK_ENABLE))->SetCheck(m_pPort->isEnable() ? BST_CHECKED : BST_UNCHECKED); |
| | | pComboBox = (CComboBox*)GetDlgItem(IDC_COMBO_PORT_TYPE); |
| | | for (int i = 1; i <= 7; i++) { |
| | | pComboBox->InsertString(i - 1, SERVO::CLoadPort::getPortTypeDescription((SERVO::PortType)i, strTemp).c_str()); |
| | |
| | | std::string CRobotTask::getDescription() const |
| | | { |
| | | std::string strOut = "CRobotTask<ID:"; |
| | | strOut = strOut + std::to_string(m_robotCmdParam.sequenceNo); |
| | | strOut = strOut + std::to_string(m_robotCmdParam[ACTION_TRANSFER].sequenceNo); |
| | | strOut = strOut + ",Arm:"; |
| | | strOut = strOut + std::to_string(m_robotCmdParam.armNo); |
| | | strOut = strOut + std::to_string(m_robotCmdParam[ACTION_TRANSFER].armNo); |
| | | strOut = strOut + ",GetPossion:"; |
| | | strOut = strOut + std::to_string(m_robotCmdParam.getPosition); |
| | | strOut = strOut + std::to_string(m_robotCmdParam[ACTION_TRANSFER].getPosition); |
| | | strOut = strOut + ",GetSlot:"; |
| | | strOut = strOut + std::to_string(m_robotCmdParam.getSlotNo); |
| | | strOut = strOut + std::to_string(m_robotCmdParam[ACTION_TRANSFER].getSlotNo); |
| | | strOut = strOut + ",PutPossion:"; |
| | | strOut = strOut + std::to_string(m_robotCmdParam.putPosition); |
| | | strOut = strOut + std::to_string(m_robotCmdParam[ACTION_TRANSFER].putPosition); |
| | | strOut = strOut + ",PutSlot:"; |
| | | strOut = strOut + std::to_string(m_robotCmdParam.putSlotNo); |
| | | strOut = strOut + std::to_string(m_robotCmdParam[ACTION_TRANSFER].putSlotNo); |
| | | strOut = strOut + ">"; |
| | | |
| | | return strOut; |
| | |
| | | std::string CRobotTask::getSimpleDescription() const |
| | | { |
| | | std::string strOut = "CRobotTask<ID:"; |
| | | strOut = strOut + std::to_string(m_robotCmdParam.sequenceNo); |
| | | strOut = strOut + std::to_string(m_robotCmdParam[ACTION_TRANSFER].sequenceNo); |
| | | strOut = strOut + ",Arm:"; |
| | | strOut = strOut + std::to_string(m_robotCmdParam.armNo); |
| | | strOut = strOut + std::to_string(m_robotCmdParam[ACTION_TRANSFER].armNo); |
| | | strOut = strOut + ",GetPossion:"; |
| | | strOut = strOut + std::to_string(m_robotCmdParam.getPosition); |
| | | strOut = strOut + std::to_string(m_robotCmdParam[ACTION_TRANSFER].getPosition); |
| | | strOut = strOut + ",GetSlot:"; |
| | | strOut = strOut + std::to_string(m_robotCmdParam.getSlotNo); |
| | | strOut = strOut + std::to_string(m_robotCmdParam[ACTION_TRANSFER].getSlotNo); |
| | | strOut = strOut + ",PutPossion:"; |
| | | strOut = strOut + std::to_string(m_robotCmdParam.putPosition); |
| | | strOut = strOut + std::to_string(m_robotCmdParam[ACTION_TRANSFER].putPosition); |
| | | strOut = strOut + ",PutSlot:"; |
| | | strOut = strOut + std::to_string(m_robotCmdParam.putSlotNo); |
| | | strOut = strOut + std::to_string(m_robotCmdParam[ACTION_TRANSFER].putSlotNo); |
| | | strOut = strOut + ">"; |
| | | |
| | | return strOut; |
| | |
| | | return m_strId; |
| | | } |
| | | |
| | | void CRobotTask::setRobotTransferParam(int seq, int armNo, int fromPos, int toPos, int fromSlot, int toSlot) |
| | | int CRobotTask::setRobotTransferParam(int seq, int armNo, int fromPos, int toPos, int fromSlot, int toSlot) |
| | | { |
| | | m_robotCmdParam = {}; |
| | | m_robotCmdParam.sequenceNo = static_cast<short>(seq); |
| | | m_robotCmdParam.rcmd = static_cast<short>(SERVO::RCMD::Transfer); |
| | | m_robotCmdParam.armNo = static_cast<short>(armNo); |
| | | m_robotCmdParam.getPosition = static_cast<short>(fromPos); |
| | | m_robotCmdParam.getSlotNo = static_cast<short>(fromSlot); |
| | | m_robotCmdParam.putPosition = static_cast<short>(toPos); |
| | | m_robotCmdParam.putSlotNo = static_cast<short>(toSlot); |
| | | // è¿æ¯ç´æ¥ä½¿ç¨æ¬è¿æ¨¡å¼çåæ°ï¼ |
| | | // 妿EFEM䏿¯æï¼è¿éè¦æè§£ä¸ºååæ¾çå¨ä½ååæ¾åä½ç½®çå
¶å®3å¥åæ° |
| | | m_robotCmdParam[ACTION_TRANSFER] = {}; |
| | | m_robotCmdParam[ACTION_TRANSFER].sequenceNo = static_cast<short>(seq+1); |
| | | m_robotCmdParam[ACTION_TRANSFER].rcmd = static_cast<short>(SERVO::RCMD::Transfer); |
| | | m_robotCmdParam[ACTION_TRANSFER].armNo = static_cast<short>(armNo); |
| | | m_robotCmdParam[ACTION_TRANSFER].getPosition = static_cast<short>(fromPos); |
| | | m_robotCmdParam[ACTION_TRANSFER].getSlotNo = static_cast<short>(fromSlot); |
| | | m_robotCmdParam[ACTION_TRANSFER].putPosition = static_cast<short>(toPos); |
| | | m_robotCmdParam[ACTION_TRANSFER].putSlotNo = static_cast<short>(toSlot); |
| | | |
| | | // 转æ¢ä¸ä¸æºåç®æ ç«å· |
| | | int srcPos, srcSlot, tarPos, tarSlot; |
| | | transformPosAndSlot(fromPos, fromSlot, srcPos, srcSlot); |
| | | transformPosAndSlot(toPos, toSlot, tarPos, tarSlot); |
| | | |
| | | m_robotCmdParam[ACTION_PICK] = {}; |
| | | m_robotCmdParam[ACTION_PICK].sequenceNo = static_cast<short>(seq+2); |
| | | m_robotCmdParam[ACTION_PICK].rcmd = static_cast<short>(SERVO::RCMD::Get); |
| | | m_robotCmdParam[ACTION_PICK].armNo = static_cast<short>(armNo); |
| | | m_robotCmdParam[ACTION_PICK].getPosition = static_cast<short>(srcPos); |
| | | m_robotCmdParam[ACTION_PICK].getSlotNo = static_cast<short>(srcSlot); |
| | | |
| | | m_robotCmdParam[ACTION_PLACE] = {}; |
| | | m_robotCmdParam[ACTION_PLACE].sequenceNo = static_cast<short>(seq + 2); |
| | | m_robotCmdParam[ACTION_PLACE].rcmd = static_cast<short>(SERVO::RCMD::Put); |
| | | m_robotCmdParam[ACTION_PLACE].armNo = static_cast<short>(armNo); |
| | | m_robotCmdParam[ACTION_PLACE].putPosition = static_cast<short>(tarPos); |
| | | m_robotCmdParam[ACTION_PLACE].putSlotNo = static_cast<short>(tarSlot); |
| | | |
| | | m_robotCmdParam[ACTION_RESTORE] = {}; |
| | | m_robotCmdParam[ACTION_RESTORE].sequenceNo = static_cast<short>(seq + 1); |
| | | m_robotCmdParam[ACTION_RESTORE].rcmd = static_cast<short>(SERVO::RCMD::Put); |
| | | m_robotCmdParam[ACTION_RESTORE].armNo = static_cast<short>(armNo); |
| | | m_robotCmdParam[ACTION_RESTORE].putPosition = static_cast<short>(srcPos); |
| | | m_robotCmdParam[ACTION_RESTORE].putSlotNo = static_cast<short>(srcSlot); |
| | | |
| | | return seq + 1; |
| | | } |
| | | |
| | | ROBOT_CMD_PARAM& CRobotTask::getRobotCmdParam() |
| | | ROBOT_CMD_PARAM& CRobotTask::getRobotCmdParam(int index) |
| | | { |
| | | return m_robotCmdParam; |
| | | ASSERT(ACTION_PICK <= index && index <= ACTION_TRANSFER); |
| | | return m_robotCmdParam[index]; |
| | | } |
| | | |
| | | time_t CRobotTask::getCreateTime() |
| | |
| | | return m_timeFinish; |
| | | } |
| | | |
| | | int CRobotTask::getArmNo() |
| | | { |
| | | return m_robotCmdParam[ACTION_PICK].armNo; |
| | | |
| | | } |
| | | |
| | | ROBOT_TASK_STATE CRobotTask::getState() |
| | | { |
| | | return m_state; |
| | | } |
| | | |
| | | bool CRobotTask::isPicking() |
| | | { |
| | | return m_state == ROBOT_TASK_STATE::Picking; |
| | | } |
| | | |
| | | bool CRobotTask::isPlacing() |
| | | { |
| | | return m_state == ROBOT_TASK_STATE::Placing; |
| | | } |
| | | |
| | | bool CRobotTask::isRestoring() |
| | | { |
| | | return m_state == ROBOT_TASK_STATE::Restoring; |
| | | } |
| | | |
| | | void CRobotTask::run() |
| | |
| | | |
| | | static int seq = 0; |
| | | m_pEFEM->robotSendTransfer(++seq, |
| | | m_robotCmdParam.armNo, |
| | | m_robotCmdParam.getPosition, |
| | | m_robotCmdParam.putPosition, |
| | | m_robotCmdParam.getSlotNo, |
| | | m_robotCmdParam.putSlotNo, |
| | | m_robotCmdParam[ACTION_TRANSFER].armNo, |
| | | m_robotCmdParam[ACTION_TRANSFER].getPosition, |
| | | m_robotCmdParam[ACTION_TRANSFER].putPosition, |
| | | m_robotCmdParam[ACTION_TRANSFER].getSlotNo, |
| | | m_robotCmdParam[ACTION_TRANSFER].putSlotNo, |
| | | [&](int code) -> int { |
| | | if (code == WOK) { |
| | | LOGI(_T("RobotTaskå·²ä¸åå°EFEM")); |
| | | } |
| | | else { |
| | | LOGI(_T("RobotTaskå·²ä¸å失败")); |
| | | } |
| | | |
| | | return 0; |
| | | }); |
| | | } |
| | | |
| | | void CRobotTask::pick() |
| | | { |
| | | ASSERT(m_pEFEM); |
| | | m_state = ROBOT_TASK_STATE::Picking; |
| | | |
| | | m_pEFEM->robotSendMoveToGet(m_robotCmdParam->sequenceNo, |
| | | m_robotCmdParam[ACTION_PICK].armNo, |
| | | m_robotCmdParam[ACTION_PICK].getPosition, |
| | | m_robotCmdParam[ACTION_PICK].getSlotNo, |
| | | [&](int code) -> int { |
| | | if (code == WOK) { |
| | | LOGI(_T("RobotTask/getå·²ä¸åå°EFEM")); |
| | | } |
| | | else { |
| | | LOGI(_T("RobotTask/getå·²ä¸å失败")); |
| | | } |
| | | |
| | | return 0; |
| | | }); |
| | | } |
| | | |
| | | void CRobotTask::place() |
| | | { |
| | | ASSERT(m_pEFEM); |
| | | m_state = ROBOT_TASK_STATE::Placing; |
| | | |
| | | m_pEFEM->robotSendMoveToPut(m_robotCmdParam->sequenceNo, |
| | | m_robotCmdParam[ACTION_PLACE].armNo, |
| | | m_robotCmdParam[ACTION_PLACE].putPosition, |
| | | m_robotCmdParam[ACTION_PLACE].putSlotNo, |
| | | [&](int code) -> int { |
| | | if (code == WOK) { |
| | | LOGI(_T("RobotTask/putå·²ä¸åå°EFEM")); |
| | | } |
| | | else { |
| | | LOGI(_T("RobotTask/putå·²ä¸å失败")); |
| | | } |
| | | |
| | | return 0; |
| | | }); |
| | | } |
| | | |
| | | void CRobotTask::restore() |
| | | { |
| | | ASSERT(m_pEFEM); |
| | | m_state = ROBOT_TASK_STATE::Restoring; |
| | | |
| | | m_pEFEM->robotSendMoveToPut(m_robotCmdParam->sequenceNo, |
| | | m_robotCmdParam[ACTION_RESTORE].armNo, |
| | | m_robotCmdParam[ACTION_RESTORE].putPosition, |
| | | m_robotCmdParam[ACTION_RESTORE].putSlotNo, |
| | | [&](int code) -> int { |
| | | if (code == WOK) { |
| | | LOGI(_T("RobotTask/restore-putå·²ä¸åå°EFEM")); |
| | | } |
| | | else { |
| | | LOGI(_T("RobotTask/restore-putå·²ä¸å失败")); |
| | | } |
| | | |
| | | return 0; |
| | |
| | | |
| | | int CRobotTask::getSrcPosition() |
| | | { |
| | | return m_robotCmdParam.getPosition; |
| | | return m_robotCmdParam[ACTION_TRANSFER].getPosition; |
| | | } |
| | | |
| | | int CRobotTask::getTarPosition() |
| | | { |
| | | return m_robotCmdParam.putPosition; |
| | | return m_robotCmdParam[ACTION_TRANSFER].putPosition; |
| | | } |
| | | |
| | | int CRobotTask::getSrcSlot() |
| | | { |
| | | return m_robotCmdParam.getSlotNo; |
| | | return m_robotCmdParam[ACTION_TRANSFER].getSlotNo; |
| | | } |
| | | |
| | | int CRobotTask::getTarSlot() |
| | | { |
| | | return m_robotCmdParam.putSlotNo; |
| | | return m_robotCmdParam[ACTION_TRANSFER].putSlotNo; |
| | | } |
| | | |
| | | CString CRobotTask::getStateString() |
| | |
| | | switch (m_state) { |
| | | case ROBOT_TASK_STATE::Ready: return _T("Ready"); |
| | | case ROBOT_TASK_STATE::Running: return _T("Running"); |
| | | case ROBOT_TASK_STATE::Picking: return _T("Picking"); |
| | | case ROBOT_TASK_STATE::Placing: return _T("Placing"); |
| | | case ROBOT_TASK_STATE::Restoring: return _T("Restoring"); |
| | | case ROBOT_TASK_STATE::Error: return _T("Error"); |
| | | case ROBOT_TASK_STATE::Abort: return _T("Abort"); |
| | | case ROBOT_TASK_STATE::Completed: return _T("Completed"); |
| | |
| | | { |
| | | m_timeStored = CToolUnits::getUnixTimestamp();; |
| | | } |
| | | |
| | | void CRobotTask::transformPosAndSlot(int srcPos, int srcSlot, int& tarPos, int& tarSlot) |
| | | { |
| | | switch (srcPos) |
| | | { |
| | | case EQ_ID_LOADPORT1: |
| | | case EQ_ID_LOADPORT2: |
| | | case EQ_ID_LOADPORT3: |
| | | case EQ_ID_LOADPORT4: |
| | | case EQ_ID_ARM_TRAY1: |
| | | case EQ_ID_ARM_TRAY2: |
| | | case EQ_ID_ALIGNER: |
| | | case EQ_ID_FLIPER: |
| | | tarPos = srcPos; |
| | | tarSlot = 1; |
| | | break; |
| | | case EQ_ID_Bonder1: |
| | | if (1 <= srcSlot && srcSlot <= 2) { |
| | | tarPos = 9 + srcSlot; |
| | | tarSlot = 1; |
| | | } |
| | | break; |
| | | case EQ_ID_Bonder2: |
| | | if (1 <= srcSlot && srcSlot <= 2) { |
| | | tarPos = 11 + srcSlot; |
| | | tarSlot = 1; |
| | | } |
| | | break; |
| | | case EQ_ID_VACUUMBAKE: |
| | | if (1 <= srcSlot && srcSlot <= 2) { |
| | | tarPos = 13 + srcSlot; |
| | | tarSlot = 1; |
| | | } |
| | | break; |
| | | case EQ_ID_BAKE_COOLING: |
| | | if (1 <= srcSlot && srcSlot <= 4) { |
| | | tarPos = 15 + srcSlot; |
| | | tarSlot = 1; |
| | | } |
| | | break; |
| | | case EQ_ID_MEASUREMENT: |
| | | tarPos = 19; |
| | | tarSlot = 1; |
| | | break; |
| | | default: |
| | | tarPos = srcPos; |
| | | tarSlot = srcSlot; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | |
| | | #include "CEFEM.h" |
| | | |
| | | |
| | | #define ACTION_PICK 0 /* È¡ */ |
| | | #define ACTION_PLACE 1 /* æ¾ */ |
| | | #define ACTION_RESTORE 2 /* ååç¹ */ |
| | | #define ACTION_TRANSFER 3 /* æ¬è¿ */ |
| | | |
| | | namespace SERVO { |
| | | class CRobotTask |
| | | { |
| | |
| | | void setContext(CContext* pContext); |
| | | CContext* getContext(); |
| | | void setEFEM(CEFEM* pEFEM); |
| | | void setRobotTransferParam(int seq, int armNo, int fromPos, int toPos, int fromSlot, int toSlot); |
| | | ROBOT_CMD_PARAM& getRobotCmdParam(); |
| | | int setRobotTransferParam(int seq, int armNo, int fromPos, int toPos, int fromSlot, int toSlot); |
| | | ROBOT_CMD_PARAM& getRobotCmdParam(int index); |
| | | time_t getCreateTime(); |
| | | time_t getFetchoutTime(); |
| | | time_t getStoredTime(); |
| | | time_t getFinishTime(); |
| | | int getArmNo(); |
| | | ROBOT_TASK_STATE getState(); |
| | | bool isPicking(); |
| | | bool isPlacing(); |
| | | bool isRestoring(); |
| | | void run(); |
| | | void pick(); |
| | | void place(); |
| | | void restore(); |
| | | void completed(); |
| | | void error(); |
| | | void abort(); |
| | |
| | | |
| | | private: |
| | | static std::string& generateId(std::string& out); |
| | | void transformPosAndSlot(int srcPos, int srcSlot, int& tarPos, int& tarSlot); |
| | | |
| | | private: |
| | | ROBOT_TASK_STATE m_state; /* ä»»å¡ç¶æ */ |
| | |
| | | time_t m_timeFetchOut; /* åçæ¶é´*/ |
| | | time_t m_timeStored; /* æ¾çæ¶é´ */ |
| | | time_t m_timeFinish; /* ç»ææ¶é´ */ |
| | | ROBOT_CMD_PARAM m_robotCmdParam; /* åæ° */ |
| | | ROBOT_CMD_PARAM m_robotCmdParam[4]; /* åæ° */ |
| | | CContext* m_pContext; |
| | | CEFEM* m_pEFEM; |
| | | }; |
| | |
| | | CEquipment* pSrcEq = theApp.m_model.getMaster().getEquipment(pRobotTask->getSrcPosition()); |
| | | CEquipment* pDstEq = theApp.m_model.getMaster().getEquipment(pRobotTask->getTarPosition()); |
| | | |
| | | ROBOT_CMD_PARAM& param = pRobotTask->getRobotCmdParam(); |
| | | ROBOT_CMD_PARAM& param = pRobotTask->getRobotCmdParam(ACTION_TRANSFER); |
| | | |
| | | auto format_time = [](time_t t) -> CString { |
| | | if (t == 0) { |
| | |
| | | { |
| | | // å å
¥Pinåå§å代ç |
| | | LOGI("<CVacuumBake>initPins"); |
| | | addPin(SERVO::PinType::INPUT, _T("In1")); |
| | | addPin(SERVO::PinType::INPUT, _T("In2")); |
| | | addPin(SERVO::PinType::OUTPUT, _T("Out")); |
| | | addPin(SERVO::PinType::INPUT, _T("In")); |
| | | addPin(SERVO::PinType::OUTPUT, _T("Out1")); |
| | | addPin(SERVO::PinType::OUTPUT, _T("Out2")); |
| | | } |
| | | |
| | | void CVacuumBake::initSteps() |
| | |
| | | std::to_string(second).c_str(), m_strFilepath); |
| | | } |
| | | |
| | | BOOL CConfiguration::getPortParms(unsigned int index, BOOL& bEnable, int& type, int& mode, |
| | | int& cassetteType, int& transferMode, BOOL& bAutoChangeEnable) |
| | | { |
| | | if (index >= 4) return FALSE; |
| | | |
| | | static char* pszSection[] = {"Port1", "Port2", "Port3", "Port4"}; |
| | | bEnable = GetPrivateProfileInt(pszSection[index], _T("Enable"), 0, m_strFilepath) == 1; |
| | | type = GetPrivateProfileInt(pszSection[index], _T("Type"), 0, m_strFilepath); |
| | | mode = GetPrivateProfileInt(pszSection[index], _T("Mode"), 0, m_strFilepath); |
| | | cassetteType = GetPrivateProfileInt(pszSection[index], _T("CassetteType"), 0, m_strFilepath); |
| | | transferMode = GetPrivateProfileInt(pszSection[index], _T("TransferMode"), 0, m_strFilepath); |
| | | bAutoChangeEnable = GetPrivateProfileInt(pszSection[index], _T("AutoChangeEnable"), 0, m_strFilepath) == 1; |
| | | |
| | | // type, mode, cassetteType, transferMode èå´æ£æ¥ |
| | | type = max(1, min(type, 7)); |
| | | mode = max(0, min(mode, 5)); |
| | | cassetteType = max(1, min(cassetteType, 3)); |
| | | transferMode = max(1, min(transferMode, 3)); |
| | | |
| | | return TRUE; |
| | | } |
| | | |
| | |
| | | void setLogcatIncludeRegex(BOOL bRegex); |
| | | BOOL isLogcatIncludeRegex(); |
| | | int getCustomLogcatIncludeTexts(std::vector<std::string>& texts); |
| | | BOOL getPortParms(unsigned int index, BOOL& bEnable, int& type, int& mode, |
| | | int& cassetteType, int& transferMode, BOOL& bAutoChangeEnable); |
| | | |
| | | public: |
| | | void setP2RemoteEqReconnectInterval(int second); |
| | |
| | | m_strWorkDir = pszWorkDir; |
| | | } |
| | | |
| | | void CModel::loadPortParams() |
| | | { |
| | | BOOL portEnable, autoChangeEnable; |
| | | int portType, portMode, cassetteType, transferMode; |
| | | for (int i = 0; i < 4; i++) { |
| | | m_configuration.getPortParms(i, portEnable, portType, portMode, |
| | | cassetteType, transferMode, autoChangeEnable); |
| | | m_master.setPortType(i, portEnable, portType, portMode, cassetteType, |
| | | transferMode, autoChangeEnable); |
| | | } |
| | | } |
| | | |
| | | int CModel::init() |
| | | { |
| | | CString strIniFile; |
| | |
| | | break; |
| | | case ROBOT_EVENT_FINISH: |
| | | LOGI("<CModel>onRobotTaskEvent: ä»»å¡å®æ(%s, ClassID=%s).", strDesc.c_str(), strClassID.c_str()); |
| | | pTask->completed(); |
| | | break; |
| | | case ROBOT_EVENT_ERROR: |
| | | LOGE("<CModel>onRobotTaskEvent: ä»»å¡é误(%s, ClassID=%s).", strDesc.c_str(), strClassID.c_str()); |
| | |
| | | |
| | | // ç¶ææ å° |
| | | static const char* STATUS_STR[] = { |
| | | "Unknown", "Ready", "Running", "Error", "Abort", "Completed" |
| | | "Unknown", "Ready", "Running", "Picking", "Placing", "Restoring", "Error", "Abort", "Completed" |
| | | }; |
| | | auto state = pTask->getState(); |
| | | int index = static_cast<int>(state); |
| | |
| | | IObservable* getObservable(); |
| | | SERVO::CMaster& getMaster(); |
| | | void setWorkDir(const char* pszWorkDir); |
| | | void loadPortParams(); |
| | | int init(); |
| | | int term(); |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "stdafx.h" |
| | | #include "RecipeManager.h" |
| | | #include <sstream> |
| | | #include <iomanip> |
| | | #include <fstream> |
| | | #include <iostream> |
| | | |
| | | std::recursive_mutex RecipeManager::m_mutex; |
| | | |
| | | RecipeManager& RecipeManager::getInstance() { |
| | | static RecipeManager instance; |
| | | return instance; |
| | | } |
| | | |
| | | RecipeManager::RecipeManager() { |
| | | m_pDB = new BL::SQLiteDatabase(); |
| | | } |
| | | |
| | | RecipeManager::~RecipeManager() { |
| | | if (m_pDB) { |
| | | delete m_pDB; |
| | | m_pDB = nullptr; |
| | | } |
| | | } |
| | | |
| | | bool RecipeManager::initRecipeTable() { |
| | | char szPath[MAX_PATH]; |
| | | GetModuleFileNameA(NULL, szPath, MAX_PATH); |
| | | std::string exePath(szPath); |
| | | std::string dbDir = exePath.substr(0, exePath.find_last_of("\\/")) + "\\DB"; |
| | | CreateDirectoryA(dbDir.c_str(), NULL); |
| | | |
| | | std::string dbPath = dbDir + "\\RecipeManager.db"; |
| | | if (!m_pDB->connect(dbPath, true)) { |
| | | return false; |
| | | } |
| | | |
| | | // å¯ç¨ SQLite çå¤é®çº¦ææ¯æ |
| | | if (!m_pDB->executeQuery("PRAGMA foreign_keys = ON;")) { |
| | | std::cerr << "Failed to enable foreign keys." << std::endl; |
| | | return false; |
| | | } |
| | | |
| | | const std::string createRecipeTable = R"( |
| | | CREATE TABLE IF NOT EXISTS recipes ( |
| | | ppid TEXT PRIMARY KEY NOT NULL, |
| | | description TEXT, |
| | | create_time TEXT DEFAULT (datetime('now', 'localtime')) |
| | | ); |
| | | )"; |
| | | |
| | | const std::string createDeviceTable = R"( |
| | | CREATE TABLE IF NOT EXISTS recipe_devices ( |
| | | id INTEGER PRIMARY KEY AUTOINCREMENT, |
| | | ppid TEXT NOT NULL, |
| | | device_id INTEGER NOT NULL, |
| | | device_name TEXT NOT NULL, |
| | | recipe_id INTEGER NOT NULL, |
| | | FOREIGN KEY(ppid) REFERENCES recipes(ppid) ON DELETE CASCADE, |
| | | UNIQUE (ppid, device_id), |
| | | UNIQUE (ppid, device_name) |
| | | ); |
| | | )"; |
| | | |
| | | return m_pDB->executeQuery(createRecipeTable) |
| | | && m_pDB->executeQuery(createDeviceTable); |
| | | } |
| | | |
| | | void RecipeManager::termRecipeTable() { |
| | | if (!m_pDB) { |
| | | return; |
| | | } |
| | | |
| | | m_pDB->disconnect(); |
| | | } |
| | | |
| | | bool RecipeManager::destroyRecipeTable() { |
| | | if (!m_pDB) { |
| | | return false; |
| | | } |
| | | |
| | | return m_pDB->executeQuery("DROP TABLE IF EXISTS recipe_devices;") && m_pDB->executeQuery("DROP TABLE IF EXISTS recipes;"); |
| | | } |
| | | |
| | | bool RecipeManager::ppidExists(const std::string& ppid) { |
| | | std::ostringstream oss; |
| | | oss << "SELECT COUNT(*) FROM recipes WHERE ppid = '" << ppid << "';"; |
| | | auto result = m_pDB->fetchResults(oss.str()); |
| | | return (!result.empty() && !result[0].empty() && result[0][0] != "0"); |
| | | } |
| | | |
| | | bool RecipeManager::deviceExists(const std::string& ppid, int nDeviceID) { |
| | | std::ostringstream oss; |
| | | oss << "SELECT COUNT(*) FROM recipe_devices WHERE ppid = '" << ppid |
| | | << "' AND device_id = " << nDeviceID << ";"; |
| | | auto result = m_pDB->fetchResults(oss.str()); |
| | | return (!result.empty() && !result[0].empty() && result[0][0] != "0"); |
| | | } |
| | | |
| | | bool RecipeManager::addRecipe(const RecipeInfo& recipe) { |
| | | if (!m_pDB || recipe.strPPID.empty() || recipe.vecDeviceList.empty()) { |
| | | std::cerr << "[AddRecipe] Invalid input." << std::endl; |
| | | return false; |
| | | } |
| | | |
| | | std::string strTime = recipe.strCreateTime; |
| | | if (strTime.empty()) { |
| | | std::time_t now = std::time(nullptr); |
| | | std::tm tm_now = {}; |
| | | localtime_s(&tm_now, &now); |
| | | std::stringstream ss; |
| | | ss << std::put_time(&tm_now, "%Y-%m-%d %H:%M:%S"); |
| | | strTime = ss.str(); |
| | | } |
| | | |
| | | std::lock_guard<std::recursive_mutex> lock(m_mutex); |
| | | |
| | | // å¼å§äºå¡ |
| | | m_pDB->executeQuery("BEGIN TRANSACTION;"); |
| | | |
| | | std::ostringstream oss; |
| | | oss << "INSERT OR REPLACE INTO recipes (ppid, description, create_time) VALUES ('" |
| | | << recipe.strPPID << "', '" |
| | | << recipe.strDescription << "', '" |
| | | << strTime << "');"; |
| | | |
| | | if (!m_pDB->executeQuery(oss.str())) { |
| | | std::cerr << "[AddRecipe] Failed to insert recipe: " << recipe.strPPID << std::endl; |
| | | m_pDB->executeQuery("ROLLBACK;"); |
| | | return false; |
| | | } |
| | | |
| | | for (const auto& device : recipe.vecDeviceList) { |
| | | std::ostringstream devSql; |
| | | devSql << "INSERT OR REPLACE INTO recipe_devices (ppid, device_id, device_name, recipe_id) VALUES ('" |
| | | << recipe.strPPID << "', " |
| | | << device.nDeviceID << ", '" |
| | | << device.strDeviceName << "', " |
| | | << device.nRecipeID << ");"; |
| | | |
| | | if (!m_pDB->executeQuery(devSql.str())) { |
| | | std::cerr << "[AddRecipe] Failed to insert device mapping: " << device.nDeviceID << std::endl; |
| | | m_pDB->executeQuery("ROLLBACK;"); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | // æäº¤äºå¡ |
| | | m_pDB->executeQuery("COMMIT;"); |
| | | return true; |
| | | } |
| | | |
| | | bool RecipeManager::addRecipeDevice(const std::string& ppid, const DeviceRecipe& device) { |
| | | if (!m_pDB || ppid.empty() || device.nDeviceID <= 0 || device.nRecipeID <= 0) { |
| | | std::cerr << "[addRecipeDevice] Invalid input." << std::endl; |
| | | return false; |
| | | } |
| | | |
| | | // æ£æ¥ ppid æ¯å¦åå¨ |
| | | if (!ppidExists(ppid)) { |
| | | std::cerr << "[addRecipeDevice] PPID does not exist: " << ppid << std::endl; |
| | | return false; |
| | | } |
| | | |
| | | // æå
¥è®¾å¤è®°å½ |
| | | std::ostringstream oss; |
| | | oss << "INSERT OR REPLACE INTO recipe_devices (ppid, device_id, device_name, recipe_id) VALUES ('" |
| | | << ppid << "', " |
| | | << device.nDeviceID << ", '" |
| | | << device.strDeviceName << "', " |
| | | << device.nRecipeID << ");"; |
| | | |
| | | std::lock_guard<std::recursive_mutex> lock(m_mutex); |
| | | return m_pDB->executeQuery(oss.str()); |
| | | } |
| | | |
| | | bool RecipeManager::deleteRecipeDeviceByID(const std::string& ppid, int nDeviceID) { |
| | | if (!m_pDB || ppid.empty() || nDeviceID <= 0) { |
| | | std::cerr << "[deleteRecipeDeviceByID] Invalid input." << std::endl; |
| | | return false; |
| | | } |
| | | |
| | | std::ostringstream oss; |
| | | oss << "DELETE FROM recipe_devices WHERE ppid = '" << ppid << "' AND device_id = " << nDeviceID << ";"; |
| | | |
| | | std::lock_guard<std::recursive_mutex> lock(m_mutex); |
| | | return m_pDB->executeQuery(oss.str()); |
| | | } |
| | | |
| | | bool RecipeManager::deleteRecipeDeviceByName(const std::string& ppid, const std::string& strDeviceName) { |
| | | if (!m_pDB || ppid.empty() || strDeviceName.empty()) { |
| | | std::cerr << "[deleteRecipeDeviceByName] Invalid input." << std::endl; |
| | | return false; |
| | | } |
| | | |
| | | std::ostringstream oss; |
| | | oss << "DELETE FROM recipe_devices WHERE ppid = '" << ppid << "' AND device_name = '" << strDeviceName << "';"; |
| | | |
| | | std::lock_guard<std::recursive_mutex> lock(m_mutex); |
| | | return m_pDB->executeQuery(oss.str()); |
| | | } |
| | | |
| | | std::vector<RecipeInfo> RecipeManager::getAllRecipes() { |
| | | if (!m_pDB) { |
| | | return {}; |
| | | } |
| | | |
| | | std::vector<RecipeInfo> recipes; |
| | | auto rows = m_pDB->fetchResults("SELECT ppid, description, create_time FROM recipes;"); |
| | | |
| | | for (const auto& row : rows) { |
| | | RecipeInfo info; |
| | | info.strPPID = row[0]; |
| | | info.strDescription = row[1]; |
| | | info.strCreateTime = row[2]; |
| | | |
| | | std::ostringstream devQuery; |
| | | devQuery << "SELECT device_id, device_name, recipe_id FROM recipe_devices WHERE ppid = '" << info.strPPID << "';"; |
| | | auto devs = m_pDB->fetchResults(devQuery.str()); |
| | | |
| | | for (const auto& dev : devs) { |
| | | DeviceRecipe dr; |
| | | dr.strPPID = info.strPPID; |
| | | try { |
| | | dr.nDeviceID = std::stoi(dev[0]); |
| | | dr.strDeviceName = dev[1]; |
| | | dr.nRecipeID = std::stoi(dev[2]); |
| | | } |
| | | catch (...) { |
| | | std::cerr << "Invalid data in recipe_devices for PPID: " << info.strPPID << std::endl; |
| | | continue; |
| | | } |
| | | info.vecDeviceList.push_back(dr); |
| | | } |
| | | recipes.push_back(info); |
| | | } |
| | | |
| | | return recipes; |
| | | } |
| | | |
| | | RecipeInfo RecipeManager::getRecipeByPPID(const std::string& ppid) { |
| | | RecipeInfo info; |
| | | auto rows = m_pDB->fetchResults("SELECT ppid, description, create_time FROM recipes WHERE ppid = '" + ppid + "';"); |
| | | if (rows.empty()) { |
| | | return info; |
| | | } |
| | | |
| | | info.strPPID = rows[0][0]; |
| | | info.strDescription = rows[0][1]; |
| | | info.strCreateTime = rows[0][2]; |
| | | |
| | | auto devs = m_pDB->fetchResults("SELECT device_id, device_name, recipe_id FROM recipe_devices WHERE ppid = '" + ppid + "';"); |
| | | for (const auto& dev : devs) { |
| | | DeviceRecipe dr; |
| | | dr.strPPID = ppid; |
| | | try { |
| | | dr.nDeviceID = std::stoi(dev[0]); |
| | | dr.strDeviceName = dev[1]; |
| | | dr.nRecipeID = std::stoi(dev[2]); |
| | | } |
| | | catch (...) { |
| | | std::cerr << "Invalid data in recipe_devices for PPID: " << ppid << std::endl; |
| | | continue; |
| | | } |
| | | info.vecDeviceList.push_back(dr); |
| | | } |
| | | return info; |
| | | } |
| | | |
| | | int RecipeManager::getDeviceRecipeIDByID(const std::string& ppid, int nDeviceID) { |
| | | if (!m_pDB || ppid.empty() || nDeviceID <= 0) { |
| | | return -1; |
| | | } |
| | | |
| | | std::ostringstream query; |
| | | query << "SELECT recipe_id FROM recipe_devices WHERE ppid = '" << ppid << "' AND device_id = " << nDeviceID << ";"; |
| | | |
| | | auto result = m_pDB->fetchResults(query.str()); |
| | | if (!result.empty() && !result[0].empty()) { |
| | | try { |
| | | return std::stoi(result[0][0]); |
| | | } |
| | | catch (...) { |
| | | return -1; |
| | | } |
| | | } |
| | | return -1; |
| | | } |
| | | |
| | | int RecipeManager::getDeviceRecipeIDByName(const std::string& ppid, const std::string& strDeviceName) { |
| | | if (!m_pDB || ppid.empty() || strDeviceName.empty()) { |
| | | return -1; |
| | | } |
| | | |
| | | std::ostringstream query; |
| | | query << "SELECT recipe_id FROM recipe_devices WHERE ppid = '" << ppid << "' AND device_name = '" << strDeviceName << "';"; |
| | | |
| | | auto result = m_pDB->fetchResults(query.str()); |
| | | if (!result.empty() && !result[0].empty()) { |
| | | try { |
| | | return std::stoi(result[0][0]); |
| | | } |
| | | catch (...) { |
| | | return -1; |
| | | } |
| | | } |
| | | return -1; |
| | | } |
| | | |
| | | bool RecipeManager::deleteRecipeByPPID(const std::string& ppid) { |
| | | if (!m_pDB) { |
| | | return false; |
| | | } |
| | | |
| | | std::lock_guard<std::recursive_mutex> lock(m_mutex); |
| | | return m_pDB->executeQuery("DELETE FROM recipes WHERE ppid = '" + ppid + "';"); |
| | | } |
| | | |
| | | bool RecipeManager::updateRecipe(const RecipeInfo& recipe) { |
| | | if (!m_pDB) { |
| | | return false; |
| | | } |
| | | |
| | | if (recipe.strPPID.empty()) { |
| | | std::cerr << "Recipe PPID cannot be empty." << std::endl; |
| | | return false; |
| | | } |
| | | |
| | | std::lock_guard<std::recursive_mutex> lock(m_mutex); |
| | | deleteRecipeByPPID(recipe.strPPID); |
| | | return addRecipe(recipe); |
| | | } |
| | | |
| | | bool RecipeManager::updateDeviceRecipeIDByID(const std::string& ppid, int nDeviceID, int nNewRecipeID) { |
| | | if (!m_pDB || ppid.empty() || nDeviceID <= 0 || nNewRecipeID <= 0) { |
| | | return false; |
| | | } |
| | | |
| | | std::ostringstream query; |
| | | std::lock_guard<std::recursive_mutex> lock(m_mutex); |
| | | query << "UPDATE recipe_devices SET recipe_id = " << nNewRecipeID |
| | | << " WHERE ppid = '" << ppid << "' AND device_id = " << nDeviceID << ";"; |
| | | return m_pDB->executeQuery(query.str()); |
| | | } |
| | | |
| | | bool RecipeManager::updateDeviceRecipeIDByName(const std::string& ppid, const std::string& strDeviceName, int nNewRecipeID) { |
| | | if (!m_pDB || ppid.empty() || strDeviceName.empty() || nNewRecipeID <= 0) { |
| | | return false; |
| | | } |
| | | std::ostringstream query; |
| | | std::lock_guard<std::recursive_mutex> lock(m_mutex); |
| | | query << "UPDATE recipe_devices SET recipe_id = " << nNewRecipeID |
| | | << " WHERE ppid = '" << ppid << "' AND device_name = '" << strDeviceName << "';"; |
| | | return m_pDB->executeQuery(query.str()); |
| | | } |
| | | |
| | | void RecipeManager::insertMockData() { |
| | | if (!m_pDB) { |
| | | return; |
| | | } |
| | | |
| | | RecipeInfo recipe; |
| | | recipe.strPPID = "P1001"; |
| | | recipe.strDescription = "Main Board Burn-in"; |
| | | |
| | | recipe.vecDeviceList = { |
| | | {1, 101, "P1001","Burner A"}, |
| | | {2, 102, "P1001", "Burner B"} |
| | | }; |
| | | |
| | | addRecipe(recipe); |
| | | } |
| | | |
| | | bool RecipeManager::readRecipeFile(const std::string& filename) { |
| | | if (!m_pDB) { |
| | | return false; |
| | | } |
| | | |
| | | std::ifstream file(filename); |
| | | if (!file.is_open()) { |
| | | return false; |
| | | } |
| | | |
| | | std::unordered_map<std::string, RecipeInfo> recipeMap; |
| | | std::string line; |
| | | std::getline(file, line); // skip header |
| | | |
| | | while (std::getline(file, line)) { |
| | | std::stringstream ss(line); |
| | | std::string cell; |
| | | std::string ppid, description, createTime; |
| | | DeviceRecipe dev; |
| | | |
| | | std::getline(ss, ppid, ','); |
| | | std::getline(ss, cell, ','); |
| | | try { dev.nDeviceID = std::stoi(cell); } |
| | | catch (...) { continue; } |
| | | std::getline(ss, dev.strDeviceName, ','); |
| | | std::getline(ss, cell, ','); |
| | | try { dev.nRecipeID = std::stoi(cell); } |
| | | catch (...) { continue; } |
| | | std::getline(ss, description, ','); |
| | | std::getline(ss, createTime, ','); |
| | | |
| | | dev.strPPID = ppid; |
| | | auto& recipe = recipeMap[ppid]; |
| | | recipe.strPPID = ppid; |
| | | recipe.strDescription = description; |
| | | recipe.strCreateTime = createTime; |
| | | recipe.vecDeviceList.push_back(dev); |
| | | } |
| | | |
| | | for (const auto& pair : recipeMap) { |
| | | if (!updateRecipe(pair.second)) { |
| | | std::cerr << "Failed to update recipe from file: " << pair.first << std::endl; |
| | | } |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | bool RecipeManager::saveRecipeFile(const std::string& filename) { |
| | | if (!m_pDB) { |
| | | return false; |
| | | } |
| | | |
| | | std::ofstream file(filename); |
| | | if (!file.is_open()) { |
| | | return false; |
| | | } |
| | | |
| | | file << "PPID,DeviceID,DeviceName,RecipeID,Description,CreateTime\n"; |
| | | auto recipes = getAllRecipes(); |
| | | for (const auto& recipe : recipes) { |
| | | for (const auto& dev : recipe.vecDeviceList) { |
| | | file << recipe.strPPID << "," |
| | | << dev.nDeviceID << "," |
| | | << dev.strDeviceName << "," |
| | | << dev.nRecipeID << "," |
| | | << recipe.strDescription << "," |
| | | << recipe.strCreateTime << "\n"; |
| | | } |
| | | } |
| | | |
| | | return true; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #ifndef RECIPE_MANAGER_H |
| | | #define RECIPE_MANAGER_H |
| | | |
| | | #include <string> |
| | | #include <vector> |
| | | #include <mutex> |
| | | #include <unordered_map> |
| | | #include "Database.h" |
| | | |
| | | // å个设å¤é
æ¹æ å°ä¿¡æ¯ |
| | | struct DeviceRecipe { |
| | | int nDeviceID; // 设å¤ID |
| | | int nRecipeID; // 该设å¤å¯¹åºçåé
æ¹ID |
| | | std::string strPPID; // é
æ¹IDï¼ä¸»é®ï¼ |
| | | std::string strDeviceName; // 设å¤åç§° |
| | | }; |
| | | |
| | | // é
æ¹ä¿¡æ¯ |
| | | struct RecipeInfo { |
| | | std::string strPPID; // é
æ¹ID |
| | | std::string strDescription; // é
æ¹æè¿° |
| | | std::string strCreateTime; // å建æ¶é´ |
| | | std::vector<DeviceRecipe> vecDeviceList; // å
³èç设å¤ä¿¡æ¯å表 |
| | | }; |
| | | |
| | | using RecipeMap = std::unordered_map<std::string, RecipeInfo>; // æ PPID æ å°çé
æ¹è¡¨ |
| | | |
| | | class RecipeManager { |
| | | public: |
| | | // è·ååä¾ |
| | | static RecipeManager& getInstance(); |
| | | |
| | | // åå§åé
æ¹æ°æ®åº |
| | | bool initRecipeTable(); |
| | | |
| | | // éæ¯è¡¨æå
³éè¿æ¥ |
| | | void termRecipeTable(); |
| | | bool destroyRecipeTable(); |
| | | |
| | | // æ£æ¥ PPID æ¯å¦åå¨ |
| | | bool ppidExists(const std::string& ppid); |
| | | |
| | | // æ£æ¥è®¾å¤æ¯å¦åå¨äºæå® PPID çé
æ¹ä¸ |
| | | bool deviceExists(const std::string& ppid, int nDeviceID); |
| | | |
| | | // æ·»å ä¸ä¸ªé
æ¹åå
¶è®¾å¤æ å° |
| | | bool addRecipe(const RecipeInfo& recipe); |
| | | |
| | | // æ·»å 设å¤å°æå®é
æ¹ |
| | | bool addRecipeDevice(const std::string& ppid, const DeviceRecipe& device); |
| | | |
| | | // å é¤æå® PPID ç设å¤é
æ¹ |
| | | bool deleteRecipeDeviceByID(const std::string& ppid, int nDeviceID); |
| | | |
| | | // å é¤æå® PPID ç设å¤é
æ¹ï¼éè¿è®¾å¤åç§°ï¼ |
| | | bool deleteRecipeDeviceByName(const std::string& ppid, const std::string& strDeviceName); |
| | | |
| | | // æ¥è¯¢ææé
æ¹ |
| | | std::vector<RecipeInfo> getAllRecipes(); |
| | | |
| | | // æ PPID æ¥è¯¢é
æ¹ |
| | | RecipeInfo getRecipeByPPID(const std::string& ppid); |
| | | |
| | | // æ ¹æ® PPID å设å¤ID è·å设å¤é
æ¹ID |
| | | int getDeviceRecipeIDByID(const std::string& ppid, int nDeviceID); |
| | | |
| | | // æ ¹æ® PPID å设å¤åç§° è·å设å¤é
æ¹ID |
| | | int getDeviceRecipeIDByName(const std::string& ppid, const std::string& strDeviceName); |
| | | |
| | | // å é¤æå® PPID çé
æ¹ |
| | | bool deleteRecipeByPPID(const std::string& ppid); |
| | | |
| | | // æ´æ°æå® PPID çé
æ¹ |
| | | bool updateRecipe(const RecipeInfo& recipe); |
| | | |
| | | // æ´æ°è®¾å¤é
æ¹IDï¼éè¿ PPID å设å¤IDï¼ |
| | | bool updateDeviceRecipeIDByID(const std::string& ppid, int nDeviceID, int nNewRecipeID); |
| | | |
| | | // æ´æ°è®¾å¤é
æ¹IDï¼éè¿ PPID å设å¤åç§°ï¼ |
| | | bool updateDeviceRecipeIDByName(const std::string& ppid, const std::string& strDeviceName, int nNewRecipeID); |
| | | |
| | | // 模ææå
¥æ°æ®ï¼æµè¯ç¨ï¼ |
| | | void insertMockData(); |
| | | |
| | | // 读åé
æ¹æä»¶ï¼CSV æ JSONï¼ |
| | | bool readRecipeFile(const std::string& filename); |
| | | |
| | | // ä¿åé
æ¹å°æä»¶ |
| | | bool saveRecipeFile(const std::string& filename); |
| | | |
| | | private: |
| | | RecipeManager(); |
| | | ~RecipeManager(); |
| | | |
| | | RecipeManager(const RecipeManager&) = delete; |
| | | RecipeManager& operator=(const RecipeManager&) = delete; |
| | | |
| | | private: |
| | | BL::Database* m_pDB; |
| | | static std::recursive_mutex m_mutex; |
| | | }; |
| | | |
| | | #endif // RECIPE_MANAGER_H |
| | |
| | | #include "TransferManager.h" |
| | | #include "SystemLogManager.h" |
| | | #include "UserManager.h" |
| | | #include "RecipeManager.h" |
| | | #include "VerticalLine.h" |
| | | #include "HorizontalLine.h" |
| | | #include "EqsGraphWnd.h" |
| | |
| | | AfxMessageBox(errorMsg, MB_ICONERROR); |
| | | return FALSE; |
| | | } |
| | | AlarmManager::getInstance().insertMockData(); |
| | | |
| | | // åå§åSECSè¿è¡è®¾ç½®ç®¡çåº |
| | | try { |
| | |
| | | return FALSE; |
| | | } |
| | | |
| | | // åå§åé
æ¹ç®¡çåº |
| | | try { |
| | | if (!RecipeManager::getInstance().initRecipeTable()) { |
| | | AfxMessageBox("åå§åé
æ¹ç®¡çåºå¤±è´¥ï¼"); |
| | | return FALSE; |
| | | } |
| | | } |
| | | catch (const std::exception& ex) { |
| | | CString errorMsg; |
| | | errorMsg.Format(_T("åå§åé
æ¹ç®¡çåºå¤±è´¥ï¼%s"), CString(ex.what())); |
| | | AfxMessageBox(errorMsg, MB_ICONERROR); |
| | | return FALSE; |
| | | } |
| | | |
| | | |
| | | CServoDlg dlg; |
| | |
| | | <ClInclude Include="PageTransferLog.h" /> |
| | | <ClInclude Include="PortConfigurationDlg.h" /> |
| | | <ClInclude Include="ProductionLogManager.h" /> |
| | | <ClInclude Include="RecipeManager.h" /> |
| | | <ClInclude Include="Resource.h" /> |
| | | <ClInclude Include="SECSRuntimeManager.h" /> |
| | | <ClInclude Include="SecsTestDlg.h" /> |
| | |
| | | <ClCompile Include="PageTransferLog.cpp" /> |
| | | <ClCompile Include="PortConfigurationDlg.cpp" /> |
| | | <ClCompile Include="ProductionLogManager.cpp" /> |
| | | <ClCompile Include="RecipeManager.cpp" /> |
| | | <ClCompile Include="SECSRuntimeManager.cpp" /> |
| | | <ClCompile Include="SecsTestDlg.cpp" /> |
| | | <ClCompile Include="Servo.cpp" /> |
| | |
| | | <ClCompile Include="SystemLogManager.cpp" /> |
| | | <ClCompile Include="UserManager.cpp" /> |
| | | <ClCompile Include="InputDialog.cpp" /> |
| | | <ClCompile Include="RecipeManager.cpp" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ClInclude Include="AlarmManager.h" /> |
| | |
| | | <ClInclude Include="UserManager.h" /> |
| | | <ClInclude Include="SystemLogManager.h" /> |
| | | <ClInclude Include="InputDialog.h" /> |
| | | <ClInclude Include="RecipeManager.h" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ResourceCompile Include="Servo.rc" /> |
| | |
| | | enum class ROBOT_TASK_STATE { |
| | | Ready = 0, |
| | | Running, |
| | | Picking, |
| | | Placing, |
| | | Restoring, |
| | | Error, |
| | | Abort, |
| | | Completed |
| | | }; |
| | | |
| | | enum class ROBOT_STATUS { |
| | | Setup = 0, |
| | | Idle, |
| | | Run, |
| | | Pause, |
| | | Stop, |
| | | Moving, |
| | | }; |
| | | |
| | | enum class ROBOT_POSITION { |
| | | Port1 = 0, |
| | | Port2, |
| | | Port3, |
| | | Port4, |
| | | Aligner, |
| | | Fliper, |
| | | Bonder1, |
| | | Bonder2, |
| | | Bake, |
| | | Cooling, |
| | | Measurement |
| | | }; |
| | | |
| | | /* Indexer Monitoring Status */ |
| | | /* Robot Monitoring Data */ |
| | | typedef struct _ROBOT_MONITORING_DATA { |
| | | ROBOT_STATUS status; |
| | | ROBOT_POSITION position; |
| | | BOOL armState[2]; |
| | | } ROBOT_MONITORING_DATA, RMDATA; |
| | | |
| | | |
| | | /* EQ Data changed code */ |
| | | #define EDCC_FETCHOUT_JOB 1000 /* ȡƬ */ |
| | | #define EDCC_STORED_JOB 1001 /* æ¾ç */ |
| | |
| | | |
| | | // ç¸å½äºå»¶æ¶è°ç¨masterçåå§å |
| | | theApp.m_model.m_master.init(); |
| | | theApp.m_model.loadPortParams(); |
| | | |
| | | |
| | | // åå§åmaster以åéè¦æ§ä»¶ç»å®æ°æ® |
| | |
| | | } |
| | | |
| | | // æé æ°æ®åºè·¯å¾ |
| | | std::string dbPath = dbDir + "\\SystemLog.db"; |
| | | std::string dbPath = dbDir + "\\SystemLogManager.db"; |
| | | |
| | | // è¿æ¥æ°æ®åº |
| | | if (!m_pDB->connect(dbPath, true)) { |
| | |
| | | } |
| | | } |
| | | |
| | | // ä»»å¡ç¶æè½¬æ¢æ int ç±»å |
| | | int TransferManager::statusToInt(TransferStatus status) { |
| | | return static_cast<int>(status); |
| | | } |
| | | |
| | | // int ç±»åè½¬æ¢æä»»å¡ç¶æ |
| | | TransferStatus TransferManager::intToStatus(int value) { |
| | | switch (value) { |
| | | case 0: return TransferStatus::Ready; |
| | | case 1: return TransferStatus::Running; |
| | | case 2: return TransferStatus::Error; |
| | | case 3: return TransferStatus::Abort; |
| | | case 4: return TransferStatus::Completed; |
| | | default: return TransferStatus::Error; |
| | | } |
| | | } |
| | | |
| | | // ä»»å¡ç¶æè½¬æ¢æå符串 |
| | | std::string TransferManager::statusToString(TransferStatus status) { |
| | | switch (status) { |
| | | case TransferStatus::Ready: return "Ready"; |
| | | case TransferStatus::Running: return "Running"; |
| | | case TransferStatus::Error: return "Error"; |
| | | case TransferStatus::Abort: return "Abort"; |
| | | case TransferStatus::Completed: return "Completed"; |
| | | default: return "Unknown"; |
| | | } |
| | | } |
| | | |
| | | // åç¬¦ä¸²è½¬æ¢æä»»å¡ç¶æ |
| | | TransferStatus TransferManager::stringToStatus(const std::string& str) { |
| | | if (str == "Ready") return TransferStatus::Ready; |
| | | if (str == "Running") return TransferStatus::Running; |
| | | if (str == "Error") return TransferStatus::Error; |
| | | if (str == "Abort") return TransferStatus::Abort; |
| | | if (str == "Completed") return TransferStatus::Completed; |
| | | return TransferStatus::Error; |
| | | } |
| | | |
| | | // æ¬å°ç¼ç 转为 UTF-8 |
| | | std::string TransferManager::ansiToUtf8(const std::string& ansiStr) { |
| | | // 1. ANSI â UTF-16 |
| | |
| | | } |
| | | |
| | | // æå
¥æµè¯æ¬è¿è®°å½ |
| | | void TransferManager::insertTestTransferRecord() { |
| | | if (nullptr != m_pDB) { |
| | | int nCount = 10000; |
| | | void TransferManager::insertTestTransferRecord(int nCount /*=10000*/) { |
| | | if (nullptr != m_pDB) { |
| | | static const char* STATUS_STR[] = { |
| | | "Unknown", "Ready", "Running", "Picking", "Placing", |
| | | "Restoring", "Error", "Abort", "Completed" |
| | | }; |
| | | |
| | | auto formatTime = [](const std::tm& time) { |
| | | char szTime[64]; |
| | | strftime(szTime, sizeof(szTime), "%Y-%m-%d %H:%M:%S", &time); |
| | | return std::string(szTime); |
| | | }; |
| | | |
| | | std::time_t startTime = std::time(nullptr); |
| | | for (int i = 0; i < nCount; ++i) { |
| | | TransferData data; |
| | | data.strClassID = "T-" + std::to_string(1000 + i); |
| | | data.strStatus = statusToString(static_cast<TransferStatus>(i % 5)); |
| | | data.strStatus = STATUS_STR[i % 9]; |
| | | |
| | | std::time_t now = std::time(nullptr) + i * 60; // æ¯æ¡è®°å½é´é1åé |
| | | std::time_t baseTime = startTime + i * 60; |
| | | std::time_t pickTime = baseTime + 60; |
| | | std::time_t placeTime = pickTime + 60; |
| | | std::time_t endTime = placeTime + 60; |
| | | |
| | | std::tm tmCreate = {}, tmPick = {}, tmPlace = {}, tmEnd = {}; |
| | | localtime_s(&tmCreate, &now); |
| | | localtime_s(&tmPick, &(now += 60)); |
| | | localtime_s(&tmPlace, &(now += 60)); |
| | | localtime_s(&tmEnd, &(now += 60)); |
| | | localtime_s(&tmCreate, &baseTime); |
| | | localtime_s(&tmPick, &pickTime); |
| | | localtime_s(&tmPlace, &placeTime); |
| | | localtime_s(&tmEnd, &endTime); |
| | | |
| | | char szTime[64]; |
| | | strftime(szTime, sizeof(szTime), "%Y-%m-%d %H:%M:%S", &tmCreate); |
| | | data.strCreateTime = szTime; |
| | | strftime(szTime, sizeof(szTime), "%Y-%m-%d %H:%M:%S", &tmPick); |
| | | data.strPickTime = szTime; |
| | | strftime(szTime, sizeof(szTime), "%Y-%m-%d %H:%M:%S", &tmPlace); |
| | | data.strPlaceTime = szTime; |
| | | strftime(szTime, sizeof(szTime), "%Y-%m-%d %H:%M:%S", &tmEnd); |
| | | data.strEndTime = szTime; |
| | | |
| | | data.strCreateTime = formatTime(tmCreate); |
| | | data.strPickTime = formatTime(tmPick); |
| | | data.strPlaceTime = formatTime(tmPlace); |
| | | data.strEndTime = formatTime(tmEnd); |
| | | data.strDescription = "Mock transfer task " + std::to_string(i); |
| | | |
| | | int nRecordId = 0; |
| | | addTransferRecord(data, nRecordId); |
| | | if (!addTransferRecord(data, nRecordId)) { |
| | | std::cerr << "[Error] æå
¥ç¬¬ " << i << " æ¡è®°å½å¤±è´¥" << std::endl; |
| | | } |
| | | } |
| | | |
| | | std::cout << "[Mock] æåæå
¥ " << nCount << " æ¡æµè¯æ¬è¿è®°å½ã" << std::endl; |
| | |
| | | #include "Database.h" |
| | | |
| | | /** |
| | | * ä»»å¡ç¶ææä¸¾ç±»å |
| | | */ |
| | | enum class TransferStatus { |
| | | Ready = 0, |
| | | Running, |
| | | Error, |
| | | Abort, |
| | | Completed |
| | | }; |
| | | |
| | | /** |
| | | * æ¬è¿è®°å½ç»æä½ |
| | | */ |
| | | struct TransferData { |
| | |
| | | /** |
| | | * æå
¥æµè¯æ¬è¿è®°å½ |
| | | */ |
| | | void insertTestTransferRecord(); |
| | | void insertTestTransferRecord(int nCount = 10000); |
| | | |
| | | /** |
| | | * ç»æ¢æ°æ®åºè¿æ¥ |
| | |
| | | TransferManager& operator=(const TransferManager&) = delete; |
| | | |
| | | // å
è彿° |
| | | inline int statusToInt(TransferStatus status); |
| | | inline TransferStatus intToStatus(int value); |
| | | inline std::string statusToString(TransferStatus status); |
| | | inline TransferStatus stringToStatus(const std::string& str); |
| | | inline std::string ansiToUtf8(const std::string& ansiStr); |
| | | inline std::string utf8ToAnsi(const std::string& utf8Str); |
| | | |
| | |
| | | #include <sstream> |
| | | |
| | | const std::string SESSION_FILE = R"(session.dat)"; |
| | | const std::string DATABASE_FILE = R"(BondEq.db)"; |
| | | const std::string DATABASE_FILE = R"(UserManager.db)"; |
| | | |
| | | const std::string INITIAL_ADMIN_USERNAME = "admin"; |
| | | const std::string INITIAL_ADMIN_PASSWORD = "admin"; |
| | |
| | | char szPath[MAX_PATH]; |
| | | GetModuleFileName(NULL, szPath, MAX_PATH); |
| | | std::string exePath(szPath); |
| | | std::string dbDir = exePath.substr(0, exePath.find_last_of("\\/")) + "\\DB"; |
| | | std::string dbDir = exePath.substr(0, exePath.find_last_of("\\/")) + "\\DB\\"; |
| | | |
| | | // æ£æ¥å¹¶å建configæä»¶å¤¹ |
| | | DWORD fileAttr = GetFileAttributes(dbDir.c_str()); |
| | |
| | | Left=279 |
| | | Top=297 |
| | | [Aligner] |
| | | Left=446 |
| | | Top=363 |
| | | Left=210 |
| | | Top=317 |
| | | [VacuumBake] |
| | | Left=279 |
| | | Top=437 |
| | |
| | | Left=467 |
| | | Top=167 |
| | | [Fliper(G2)] |
| | | Left=238 |
| | | Top=251 |
| | | Left=413 |
| | | Top=285 |
| | | [VacuumBake(G1)] |
| | | Left=238 |
| | | Top=386 |
| | | Left=413 |
| | | Top=437 |
| | | [Measurement] |
| | | Left=1041 |
| | | Top=363 |