| | |
| | | #include "CLoadPort.h" |
| | | |
| | | |
| | | #define CHECK_READ_STEP_SIGNAL2(addr, data, size) { \ |
| | | BOOL bFlag = isBitOn(data, size, addr); \ |
| | | SERVO::CStep* pStep = getStep(addr); \ |
| | | if (pStep != nullptr) { \ |
| | | ((CReadStep*)pStep)->onReadSignal(bFlag ? addr : 0); \ |
| | | } \ |
| | | } |
| | | |
| | | namespace SERVO { |
| | | CLoadPort::CLoadPort() : CEquipment() |
| | | { |
| | | |
| | | m_nIndex = 0; |
| | | m_nType = 1; |
| | | m_nMode = 1; |
| | | m_nCassetteType = 1; |
| | | m_nTransferMode = 1; |
| | | m_bEnable = FALSE; |
| | | m_bAutoChangeEnable = FALSE; |
| | | } |
| | | |
| | | CLoadPort::~CLoadPort() |
| | |
| | | void CLoadPort::getAttributeVector(CAttributeVector& attrubutes) |
| | | { |
| | | __super::getAttributeVector(attrubutes); |
| | | |
| | | std::string strTemp; |
| | | attrubutes.addAttribute(new CAttribute("Index", |
| | | std::to_string(m_nIndex).c_str(), "")); |
| | | attrubutes.addAttribute(new CAttribute("Type", |
| | | getPortTypeDescription(m_nType, strTemp).c_str(), "")); |
| | | attrubutes.addAttribute(new CAttribute("Mode", |
| | | getPortModeDescription(m_nMode, strTemp).c_str(), "")); |
| | | attrubutes.addAttribute(new CAttribute("CassetteType", |
| | | getPortCassetteTypeDescription(m_nCassetteType, strTemp).c_str(), "")); |
| | | attrubutes.addAttribute(new CAttribute("TransferMode", |
| | | getPortTransferModeDescription(m_nTransferMode, strTemp).c_str(), "")); |
| | | attrubutes.addAttribute(new CAttribute("Enable", |
| | | m_bEnable ? "Eanble" : "Disable", "")); |
| | | attrubutes.addAttribute(new CAttribute("Auto Change", |
| | | m_bAutoChangeEnable ? "Eanble" : "Disable", "")); |
| | | } |
| | | |
| | | int CLoadPort::recvIntent(CPin* pPin, CIntent* pIntent) |
| | |
| | | |
| | | return __super::outputGlass(port); |
| | | } |
| | | |
| | | BOOL CLoadPort::glassWillArrive(CGlass* pGlass) |
| | | { |
| | | BOOL bRet = __super::glassWillArrive(pGlass); |
| | | if (!bRet) { |
| | | return FALSE; |
| | | } |
| | | |
| | | return (m_glassList.size() < 8); |
| | | } |
| | | |
| | | int CLoadPort::sendCassetteCtrlCmd(short cmd, |
| | | short* jobExistence, |
| | | int jobExistenceSize, |
| | | short slotProcess, |
| | | short jopCount, |
| | | CJobDataA* pJobDataA) |
| | | { |
| | | int id = getID(); |
| | | if ( !(id == EQ_ID_LOADPORT1 || id == EQ_ID_LOADPORT2) ) { |
| | | return -1; |
| | | } |
| | | |
| | | |
| | | SERVO::CEqCassetteCtrlCmdStep* pStep = (SERVO::CEqCassetteCtrlCmdStep*)getCassetteCtrlCmdStep(); |
| | | ASSERT(pStep); |
| | | return pStep->sendCtrlCmd(cmd, jobExistence, jobExistenceSize, slotProcess, jopCount, pJobDataA); |
| | | } |
| | | |
| | | CStep* CLoadPort::getCassetteCtrlCmdStep() |
| | | { |
| | | CStep* pStep = nullptr; |
| | | Lock(); |
| | | for (auto item : m_mapStep) { |
| | | if (item.second->getName().find(STEP_EQ_P1_CASSETTE_CTRL_CMD) == 0 |
| | | || item.second->getName().find(STEP_EQ_P2_CASSETTE_CTRL_CMD) == 0 |
| | | || item.second->getName().find(STEP_EQ_P3_CASSETTE_CTRL_CMD) == 0 |
| | | || item.second->getName().find(STEP_EQ_P4_CASSETTE_CTRL_CMD) == 0) { |
| | | pStep = item.second; |
| | | } |
| | | } |
| | | Unlock(); |
| | | |
| | | return pStep; |
| | | } |
| | | |
| | | void CLoadPort::setIndex(unsigned int index) |
| | | { |
| | | m_nIndex = index; |
| | | } |
| | | |
| | | unsigned int CLoadPort::getIndex() |
| | | { |
| | | return m_nIndex; |
| | | } |
| | | |
| | | BOOL CLoadPort::isEnable() |
| | | { |
| | | return m_bEnable; |
| | | } |
| | | |
| | | int CLoadPort::getPortType() |
| | | { |
| | | return m_nType; |
| | | } |
| | | |
| | | int CLoadPort::getPortMode() |
| | | { |
| | | return m_nMode; |
| | | } |
| | | |
| | | int CLoadPort::getCessetteType() |
| | | { |
| | | return m_nCassetteType; |
| | | } |
| | | |
| | | int CLoadPort::getTransferMode() |
| | | { |
| | | return m_nTransferMode; |
| | | } |
| | | |
| | | BOOL CLoadPort::isAutoChange() |
| | | { |
| | | return m_bAutoChangeEnable; |
| | | } |
| | | |
| | | /* |
| | | 1: Loading Port |
| | | 2: Unloading Port |
| | | 3: Both Port |
| | | 4: Buffer Port-Buffer Type |
| | | 5: Buffer Port-Loader in Buffer Type |
| | | 6: Buffer Port-Un-loader in Buffer Type |
| | | 7: Unloading Partial Port |
| | | */ |
| | | std::string& CLoadPort::getPortTypeDescription(int portType, std::string& strDescription) |
| | | { |
| | | switch (portType) { |
| | | case 1: |
| | | strDescription = _T("Loading Port"); |
| | | break; |
| | | case 2: |
| | | strDescription = _T("Unloading Port"); |
| | | break; |
| | | case 3: |
| | | strDescription = _T("Both Port"); |
| | | break; |
| | | case 4: |
| | | strDescription = _T("Buffer Port - Buffer Type"); |
| | | break; |
| | | case 5: |
| | | strDescription = _T("Buffer Port - Loader in Buffer Type"); |
| | | break; |
| | | case 6: |
| | | strDescription = _T("Buffer Port - Un-loader in Buffer Type"); |
| | | break; |
| | | case 7: |
| | | strDescription = _T("Unloading Partial Port"); |
| | | break; |
| | | default: |
| | | strDescription = _T(""); |
| | | break; |
| | | } |
| | | |
| | | return strDescription; |
| | | } |
| | | |
| | | /* |
| | | 0: OutOfService |
| | | 1: TransferBlocked |
| | | 2: ReadyToLoad |
| | | 3: ReadyToUnload |
| | | 4: InService |
| | | 5: TransferReady |
| | | */ |
| | | std::string& CLoadPort::getPortModeDescription(int portMode, std::string& strDescription) |
| | | { |
| | | switch (portMode) { |
| | | case 0: |
| | | strDescription = _T("OutOfService"); |
| | | break; |
| | | case 1: |
| | | strDescription = _T("TransferBlocked"); |
| | | break; |
| | | case 2: |
| | | strDescription = _T("ReadyToLoad"); |
| | | break; |
| | | case 3: |
| | | strDescription = _T("ReadyToUnload"); |
| | | break; |
| | | case 4: |
| | | strDescription = _T("InService"); |
| | | break; |
| | | case 5: |
| | | strDescription = _T("TransferReady"); |
| | | break; |
| | | default: |
| | | strDescription = _T(""); |
| | | break; |
| | | } |
| | | |
| | | return strDescription; |
| | | } |
| | | |
| | | /* |
| | | 1: G1 |
| | | 2: G2 |
| | | 3: G1&G2 |
| | | */ |
| | | std::string& CLoadPort::getPortCassetteTypeDescription(int casseteType, std::string& strDescription) |
| | | { |
| | | switch (casseteType) { |
| | | case 1: |
| | | strDescription = _T("G1"); |
| | | break; |
| | | case 2: |
| | | strDescription = _T("G2"); |
| | | break; |
| | | case 3: |
| | | strDescription = _T("G1&G2"); |
| | | break; |
| | | default: |
| | | strDescription = _T(""); |
| | | break; |
| | | } |
| | | |
| | | return strDescription; |
| | | } |
| | | |
| | | /* |
| | | 1: MGV Mode |
| | | 2: AGV Mode |
| | | 3: Stocker Inline Mode |
| | | */ |
| | | std::string& CLoadPort::getPortTransferModeDescription(int mode, std::string& strDescription) |
| | | { |
| | | switch (mode) { |
| | | case 1: |
| | | strDescription = _T("MGV Mode"); |
| | | break; |
| | | case 2: |
| | | strDescription = _T("AGV Mode"); |
| | | break; |
| | | case 3: |
| | | strDescription = _T("Stocker Inline Mode"); |
| | | break; |
| | | default: |
| | | strDescription = _T(""); |
| | | break; |
| | | } |
| | | |
| | | return strDescription; |
| | | } |
| | | |
| | | |
| | | /* |
| | | 1 : Enable |
| | | 2 : Disable |
| | | */ |
| | | std::string& CLoadPort::getEnableModeDescription(int mode, std::string& strDescription) |
| | | { |
| | | switch (mode) { |
| | | case 1: |
| | | strDescription = _T("Enable"); |
| | | break; |
| | | case 2: |
| | | strDescription = _T("Disable"); |
| | | break; |
| | | default: |
| | | strDescription = _T(""); |
| | | break; |
| | | } |
| | | |
| | | return strDescription; |
| | | } |
| | | |
| | | void CLoadPort::onReceiveLBData(const char* pszData, size_t size) |
| | | { |
| | | static int type[] = { STEP_ID_PORT1_TYPE_CHANGE, STEP_ID_PORT2_TYPE_CHANGE, |
| | | STEP_ID_PORT3_TYPE_CHANGE, STEP_ID_PORT4_TYPE_CHANGE }; |
| | | static int mode[] = { STEP_ID_PORT1_MODE_CHANGE, STEP_ID_PORT2_MODE_CHANGE, |
| | | STEP_ID_PORT3_MODE_CHANGE, STEP_ID_PORT4_MODE_CHANGE }; |
| | | static int cassetteType[] = { STEP_ID_PORT1_CASSETTE_TYPE_CHANGE, STEP_ID_PORT2_CASSETTE_TYPE_CHANGE, |
| | | STEP_ID_PORT3_CASSETTE_TYPE_CHANGE, STEP_ID_PORT4_CASSETTE_TYPE_CHANGE }; |
| | | static int transferMode[] = { STEP_ID_PORT1_TRANSFER_MODE_CHANGE, STEP_ID_PORT2_TRANSFER_MODE_CHANGE, |
| | | STEP_ID_PORT3_TRANSFER_MODE_CHANGE, STEP_ID_PORT4_TRANSFER_MODE_CHANGE }; |
| | | static int enable[] = { STEP_ID_PORT1_ENABLE_MODE_CHANGE, STEP_ID_PORT2_ENABLE_MODE_CHANGE, |
| | | STEP_ID_PORT3_ENABLE_MODE_CHANGE, STEP_ID_PORT4_ENABLE_MODE_CHANGE }; |
| | | static int autoType[] = { STEP_ID_PORT1_TYPE_AUTO_CHANGE, STEP_ID_PORT2_TYPE_AUTO_CHANGE, |
| | | STEP_ID_PORT3_TYPE_AUTO_CHANGE, STEP_ID_PORT4_TYPE_AUTO_CHANGE }; |
| | | |
| | | CHECK_READ_STEP_SIGNAL2(type[m_nIndex], pszData, size); |
| | | CHECK_READ_STEP_SIGNAL2(mode[m_nIndex], pszData, size); |
| | | CHECK_READ_STEP_SIGNAL2(cassetteType[m_nIndex], pszData, size); |
| | | CHECK_READ_STEP_SIGNAL2(transferMode[m_nIndex], pszData, size); |
| | | CHECK_READ_STEP_SIGNAL2(enable[m_nIndex], pszData, size); |
| | | CHECK_READ_STEP_SIGNAL2(autoType[m_nIndex], pszData, size); |
| | | } |
| | | |
| | | int CLoadPort::onStepEvent(CStep* pStep, int code) |
| | | { |
| | | int nRet = CEquipment::onStepEvent(pStep, code); |
| | | if (nRet > 0) return nRet; |
| | | |
| | | if (code == STEP_EVENT_READDATA) { |
| | | if (isPortTypeStep(pStep)) { |
| | | SERVO::CEqReadIntStep* pReadIntStep = (SERVO::CEqReadIntStep*)pStep; |
| | | m_nType = pReadIntStep->getValue(); |
| | | } |
| | | else if(isPortModeStep(pStep)) { |
| | | SERVO::CEqReadIntStep* pReadIntStep = (SERVO::CEqReadIntStep*)pStep; |
| | | m_nMode = pReadIntStep->getValue(); |
| | | } |
| | | else if (isPortCassetteTypeStep(pStep)) { |
| | | SERVO::CEqReadIntStep* pReadIntStep = (SERVO::CEqReadIntStep*)pStep; |
| | | m_nCassetteType = pReadIntStep->getValue(); |
| | | } |
| | | else if (isPortTransferModeStep(pStep)) { |
| | | SERVO::CEqReadIntStep* pReadIntStep = (SERVO::CEqReadIntStep*)pStep; |
| | | m_nTransferMode = pReadIntStep->getValue(); |
| | | } |
| | | else if (isPortEnableStep(pStep)) { |
| | | SERVO::CEqReadIntStep* pReadIntStep = (SERVO::CEqReadIntStep*)pStep; |
| | | m_bEnable = pReadIntStep->getValue() == 1; |
| | | } |
| | | else if (isPortTypeAutoChangeEnableStep(pStep)) { |
| | | SERVO::CEqReadIntStep* pReadIntStep = (SERVO::CEqReadIntStep*)pStep; |
| | | m_bAutoChangeEnable = pReadIntStep->getValue() == 1; |
| | | } |
| | | } |
| | | |
| | | |
| | | return 0; |
| | | } |
| | | } |