Merge branch 'clh' into liuyang
| | |
| | | return 0; |
| | | } |
| | | |
| | | int CHsmsActive::hsmsCarrierActionRequest(unsigned int DATAID, |
| | | const char* pszCarrierAction, |
| | | const char* pszCarrierId, |
| | | unsigned char PTN) |
| | | { |
| | | IMessage* pMessage = nullptr; |
| | | int nRet = HSMS_Create1Message(pMessage, m_nSessionId, 3 | REPLY, 17, ++m_nSystemByte); |
| | | pMessage->getBody()->addU4Item(DATAID, "DATAID"); |
| | | pMessage->getBody()->addItem(pszCarrierAction, "CARRIERACTION"); |
| | | pMessage->getBody()->addItem(pszCarrierId, "CARRIERID"); |
| | | pMessage->getBody()->addU1Item(PTN, "PTN"); |
| | | pMessage->getBody()->addItem(); |
| | | m_pActive->sendMessage(pMessage); |
| | | HSMS_Destroy1Message(pMessage); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CHsmsActive::hsmsProceedWithCarrier(unsigned int DATAID, |
| | | const char* pszCarrierId, |
| | | unsigned char PTN) |
| | | { |
| | | return hsmsCarrierActionRequest(DATAID, "ProceedWithCarrier", pszCarrierId, PTN); |
| | | } |
| | | |
| | | int CHsmsActive::hsmsCarrierRelease(unsigned int DATAID, |
| | | const char* pszCarrierId, |
| | | unsigned char PTN) |
| | | { |
| | | return hsmsCarrierActionRequest(DATAID, "CarrierRelease", pszCarrierId, PTN); |
| | | } |
| | | |
| | | int CHsmsActive::replyAck0(IMessage* pMessage) |
| | | { |
| | | return 0; |
| | |
| | | // æ¥è¯¢PPID List |
| | | int hsmsQueryPPIDList(); |
| | | |
| | | // S3F17 |
| | | // å¡å£å¨ä½è¯·æ± |
| | | int hsmsCarrierActionRequest(unsigned int DATAID, |
| | | const char* pszCarrierAction, |
| | | const char* pszCarrierId, |
| | | unsigned char PTN); |
| | | int hsmsProceedWithCarrier(unsigned int DATAID, |
| | | const char* pszCarrierId, |
| | | unsigned char PTN); |
| | | int CHsmsActive::hsmsCarrierRelease(unsigned int DATAID, |
| | | const char* pszCarrierId, |
| | | unsigned char PTN); |
| | | |
| | | |
| | | // éè¿çreply彿° |
| | | void replyAck(int s, int f, unsigned int systemBytes, BYTE ack, const char* pszAckName); |
| | | |
| | |
| | | ON_BN_CLICKED(IDC_BUTTON_TRANSMIT_SPOOLED_DATA, &CEAPSimulatorDlg::OnBnClickedButtonTransmitSpooledData) |
| | | ON_BN_CLICKED(IDC_BUTTON_PURGE_SPOOLED_DATA, &CEAPSimulatorDlg::OnBnClickedButtonPurgeSpooledData) |
| | | ON_BN_CLICKED(IDC_BUTTON_QUERY_PPID_LIST, &CEAPSimulatorDlg::OnBnClickedButtonQueryPpidList) |
| | | ON_BN_CLICKED(IDC_BUTTON_PROCEED_WITH_CARRIER, &CEAPSimulatorDlg::OnBnClickedButtonProceedWithCarrier) |
| | | ON_BN_CLICKED(IDC_BUTTON_CARRIER_RELEASE, &CEAPSimulatorDlg::OnBnClickedButtonCarrierRelease) |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | |
| | | GetDlgItem(IDC_BUTTON_TRANSMIT_SPOOLED_DATA)->EnableWindow(enabled); |
| | | GetDlgItem(IDC_BUTTON_PURGE_SPOOLED_DATA)->EnableWindow(enabled); |
| | | GetDlgItem(IDC_BUTTON_QUERY_PPID_LIST)->EnableWindow(enabled); |
| | | GetDlgItem(IDC_BUTTON_PROCEED_WITH_CARRIER)->EnableWindow(enabled); |
| | | GetDlgItem(IDC_BUTTON_CARRIER_RELEASE)->EnableWindow(enabled); |
| | | } |
| | | |
| | | void CEAPSimulatorDlg::OnBnClickedButtonConnect() |
| | |
| | | { |
| | | theApp.m_model.m_pHsmsActive->hsmsQueryPPIDList(); |
| | | } |
| | | |
| | | static int DATAID = 1; |
| | | void CEAPSimulatorDlg::OnBnClickedButtonProceedWithCarrier() |
| | | { |
| | | theApp.m_model.m_pHsmsActive->hsmsProceedWithCarrier(DATAID++, "CSX 52078", 1); |
| | | } |
| | | |
| | | void CEAPSimulatorDlg::OnBnClickedButtonCarrierRelease() |
| | | { |
| | | theApp.m_model.m_pHsmsActive->hsmsCarrierRelease(DATAID++, "CSX 52078", 2); |
| | | } |
| | |
| | | afx_msg void OnBnClickedButtonTransmitSpooledData(); |
| | | afx_msg void OnBnClickedButtonPurgeSpooledData(); |
| | | afx_msg void OnBnClickedButtonQueryPpidList(); |
| | | afx_msg void OnBnClickedButtonProceedWithCarrier(); |
| | | afx_msg void OnBnClickedButtonCarrierRelease(); |
| | | }; |
| | |
| | | #define IDC_BUTTON_CONFIGURE_SPOOLING 1029 |
| | | #define IDC_BUTTON_PURGE_SPOOLED_DATA 1030 |
| | | #define IDC_EDIT_CE_NAME 1031 |
| | | #define IDC_BUTTON_QUERY_PPID_LIST 1032 |
| | | #define IDC_BUTTON_QUERY_PPID_LIST 1032 |
| | | #define IDC_EDIT_CE_RPTID 1033 |
| | | #define IDC_BUTTON_PROCEED_WITH_CARRIER 1033 |
| | | #define IDC_BUTTON_TRANSMIT_SPOOLED_DATA 1034 |
| | | |
| | | #define IDC_BUTTON_PROCEED_WITH_CARRIER2 1035 |
| | | #define IDC_BUTTON_CARRIER_RELEASE 1035 |
| | | |
| | | // Next default values for new objects |
| | | // |
| | |
| | | } |
| | | } |
| | | |
| | | unsigned int CCollectionEvent::getPortID() |
| | | unsigned int CCollectionEvent::getFirstPortID() |
| | | { |
| | | if (m_reports.empty()) return -1; |
| | | return m_reports.front()->getReportId(); |
| | |
| | | return nullptr; |
| | | } |
| | | |
| | | CReport* CCollectionEvent::getFirstReport() |
| | | { |
| | | if (m_reports.empty()) return nullptr; |
| | | return m_reports.front(); |
| | | } |
| | | |
| | | std::vector<CReport*>& CCollectionEvent::getReports() |
| | | { |
| | | return m_reports; |
| | |
| | | |
| | | /* 妿ä¸ä¸ªCEIDåªæä¸ä¸ªReportçåºæ¯,è°ç¨æ¤å½æ°è®¾ç½®æåæ¶ */ |
| | | void setReport(CReport* pReport); |
| | | unsigned int getPortID(); |
| | | unsigned int getFirstPortID(); |
| | | CReport* getFirstReport(); |
| | | |
| | | private: |
| | | unsigned int m_nCEID; |
| | | std::string m_strName; |
| | |
| | | */ |
| | | int CEquipment::onSendAble(int port) |
| | | { |
| | | LOGI("<CEquipment-%s>onSendAble.port:%d", m_strName.c_str(), port); |
| | | // LOGI("<CEquipment-%s>onSendAble.port:%d", m_strName.c_str(), port); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CEquipment::onReceiveAble(int port) |
| | | { |
| | | LOGI("<CEquipment-%s>onReceiveAble.port:%d", m_strName.c_str(), port); |
| | | // LOGI("<CEquipment-%s>onReceiveAble.port:%d", m_strName.c_str(), port); |
| | | |
| | | return 0; |
| | | } |
| | |
| | | { |
| | | CEquipment::onTimer(nTimerid); |
| | | |
| | | |
| | | // ä»é
置读åºçenableï¼åå§åæ¶åç»efem |
| | | static int i_enable[4] = { 0 }; |
| | | if ((++i_enable[m_nIndex]) == 10 + m_nIndex) { |
| | | eablePort(m_bEnable, [&](int code) -> int { |
| | | LOGI("<LoadPort-%d>eablePort:code=%d", m_nIndex, code); |
| | | return 0; |
| | | }); |
| | | } |
| | | |
| | | |
| | | |
| | | // æ¨¡ææµè¯ |
| | | /* |
| | | if (m_nIndex == 0) { |
| | | static int ii = 0; |
| | | ii++; |
| | | if (ii == 20) { |
| | | if (ii == 50) { |
| | | char szBuffer[64] = {0}; |
| | | CStep* pStep = getStepWithName(STEP_EQ_PORT1_INUSE); |
| | | CPortStatusReport portStatusReport; |
| | | portStatusReport.setPortStatus(PORT_UNLOAD_READY); |
| | | portStatusReport.setPortStatus(PORT_INUSE); |
| | | portStatusReport.setJobExistenceSlot(0xf); |
| | | portStatusReport.setCassetteId("CID1984113"); |
| | | int nRet = portStatusReport.serialize(szBuffer, 64); |
| | | decodePortStatusReport(pStep, szBuffer, 64); |
| | | } |
| | |
| | | else { |
| | | // æåºå°åºç¨å±åéæ©è¦å å·¥ççå |
| | | generateGlassList(getScanCassetteMap()); |
| | | if (m_listener.onPortStatusChanged != nullptr) { |
| | | m_listener.onPortStatusChanged(this, portStatusReport.getPortStatus(), |
| | | getScanCassetteMap()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (m_listener.onPortStatusChanged != nullptr) { |
| | | m_listener.onPortStatusChanged(this, portStatusReport.getPortStatus(), |
| | | getScanCassetteMap()); |
| | | } |
| | | |
| | | |
| | | // ç¼åAttributeï¼ç¨äºè°è¯æ¶æ¾ç¤ºä¿¡æ¯ |
| | |
| | | m_bEnableEventReport = true; |
| | | m_bEnableAlarmReport = true; |
| | | m_bContinuousTransfer = false; |
| | | m_nContinuousTransferCount = 0; |
| | | m_nContinuousTransferStep = CTStep_begin; |
| | | InitializeCriticalSection(&m_criticalSection); |
| | | } |
| | | |
| | |
| | | |
| | | ULONGLONG CMaster::getRunTime() |
| | | { |
| | | if (m_state == MASTERSTATE::RUNNING) |
| | | if (m_state == MASTERSTATE::RUNNING || m_state == MASTERSTATE::RUNNING_CONTINUOUS_TRANSFER) |
| | | return m_ullRunTime + (GetTickCount64() - m_ullStartTime); |
| | | else |
| | | return m_ullRunTime; |
| | |
| | | while (1) { |
| | | // å¾
éåºä¿¡å·ææ¶é´å° |
| | | HANDLE hEvents[] = { m_hEventDispatchThreadExit[0], m_hDispatchEvent }; |
| | | int nRet = WaitForMultipleObjects(2, hEvents, FALSE, 1000); |
| | | int nRet = WaitForMultipleObjects(2, hEvents, FALSE, 500); |
| | | if (nRet == WAIT_OBJECT_0) { |
| | | break; |
| | | } |
| | |
| | | m_pActiveRobotTask = createTransferTask_continuous_transfer(pMeasurement, |
| | | 0, pLoadPorts[s], slot); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | m_nContinuousTransferStep = CTStep_end; |
| | | goto CT_PORT_PUT; |
| | | } |
| | | } |
| | |
| | | if (!rmd.armState[0]) { |
| | | m_pActiveRobotTask = createTransferTask_continuous_transfer(pBakeCooling, |
| | | 3, pMeasurement, 0); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | LOGI("<ContinuousTransfer>åä¼ æµè¯ï¼å¼å§æ¬éä»»å¡(BakeCooling -> Measurement)..."); |
| | | } |
| | | CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask); |
| | | } |
| | | |
| | |
| | | if (!rmd.armState[0]) { |
| | | m_pActiveRobotTask = createTransferTask_continuous_transfer(pBakeCooling, |
| | | 2, pBakeCooling, 3); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | LOGI("<ContinuousTransfer>åä¼ æµè¯ï¼å¼å§æ¬éä»»å¡(BakeCooling-2 -> BakeCooling-3)..."); |
| | | } |
| | | CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask); |
| | | } |
| | | if (!rmd.armState[0]) { |
| | | m_pActiveRobotTask = createTransferTask_continuous_transfer(pBakeCooling, |
| | | 1, pBakeCooling, 2); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | LOGI("<ContinuousTransfer>åä¼ æµè¯ï¼å¼å§æ¬éä»»å¡(BakeCooling-1 -> BakeCooling-2)..."); |
| | | } |
| | | CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask); |
| | | } |
| | | if (!rmd.armState[0]) { |
| | | m_pActiveRobotTask = createTransferTask_continuous_transfer(pBakeCooling, |
| | | 0, pBakeCooling, 1); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | LOGI("<ContinuousTransfer>åä¼ æµè¯ï¼å¼å§æ¬éä»»å¡(BakeCooling-0 -> BakeCooling-1)..."); |
| | | } |
| | | CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask); |
| | | } |
| | | |
| | | // Bonder2 -> BakeCooling |
| | | // VacuumBake(G1) -> BakeCooling |
| | | if (!rmd.armState[0]) { |
| | | m_pActiveRobotTask = createTransferTask_continuous_transfer(pVacuumBake, |
| | | 1, pBakeCooling, 0); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | LOGI("<ContinuousTransfer>åä¼ æµè¯ï¼å¼å§æ¬éä»»å¡(VacuumBake(G1) -> BakeCooling)..."); |
| | | } |
| | | CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask); |
| | | } |
| | | |
| | | // VacuumBake(G1) -> VacuumBake(G1) |
| | | if (!rmd.armState[0]) { |
| | | m_pActiveRobotTask = createTransferTask_continuous_transfer(pVacuumBake, |
| | | 0, pVacuumBake, 1); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | LOGI("<ContinuousTransfer>åä¼ æµè¯ï¼å¼å§æ¬éä»»å¡(VacuumBake(G1-0) -> VacuumBake(G1-1))..."); |
| | | } |
| | | CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask); |
| | | } |
| | | |
| | | // Bonder2 -> VacuumBake(G1) |
| | | if (!rmd.armState[0]) { |
| | | m_pActiveRobotTask = createTransferTask_continuous_transfer(pBonder2, |
| | | 0, pBakeCooling, 0); |
| | | 1, pVacuumBake, 0); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | LOGI("<ContinuousTransfer>åä¼ æµè¯ï¼å¼å§æ¬éä»»å¡(Bonder2 -> VacuumBake(G1))..."); |
| | | } |
| | | CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask); |
| | | } |
| | | |
| | | |
| | | // Bonder1 -> Bonder2 |
| | | if (!rmd.armState[0] && !pBonder2->hasBondClass()) { |
| | | m_pActiveRobotTask = createTransferTask_continuous_transfer(pBonder1, |
| | | 0, pBonder2, 0); |
| | | 1, pBonder2, 1); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | LOGI("<ContinuousTransfer>åä¼ æµè¯ï¼å¼å§æ¬éä»»å¡(Bonder1 -> Bonder2)..."); |
| | | } |
| | | CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask); |
| | | } |
| | | |
| | | // VacuumBake(G1) -> Bonder1 |
| | | // Fliper(G2) -> Bonder1 |
| | | if (!rmd.armState[0] && !pBonder1->hasBondClass()) { |
| | | m_pActiveRobotTask = createTransferTask_continuous_transfer(pVacuumBake, |
| | | 0, pBonder1, 0); |
| | | CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask); |
| | | } |
| | | |
| | | // Fliper(G2) -> VacuumBake(G1) |
| | | if (!rmd.armState[0]) { |
| | | m_pActiveRobotTask = createTransferTask_continuous_transfer(pFliper, |
| | | 0, pVacuumBake, 0); |
| | | 0, pBonder1, 1, 2); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | LOGI("<ContinuousTransfer>åä¼ æµè¯ï¼å¼å§æ¬éä»»å¡(Fliper(G2) -> Bonder1)..."); |
| | | } |
| | | CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask); |
| | | } |
| | | |
| | |
| | | if (!rmd.armState[1]) { |
| | | m_pActiveRobotTask = createTransferTask_continuous_transfer(pAligner, |
| | | 0, pFliper, 0); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | LOGI("<ContinuousTransfer>åä¼ æµè¯ï¼å¼å§æ¬éä»»å¡(Aligner -> Fliper(G2))..."); |
| | | } |
| | | CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask); |
| | | } |
| | | |
| | |
| | | m_pActiveRobotTask = createTransferTask_continuous_transfer(pLoadPorts[s], |
| | | slot, pAligner, 0); |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | LOGI("<ContinuousTransfer>åä¼ æµè¯ï¼å¼å§æ¬éä»»å¡(LoadPort -> Aligner)..."); |
| | | pEFEM->setContext(m_pActiveRobotTask->getContext()); |
| | | goto CT_PORT_GET; |
| | | } |
| | |
| | | } |
| | | |
| | | CT_PORT_GET: |
| | | if (m_pActiveRobotTask != nullptr) { |
| | | m_nContinuousTransferStep = CTStep_begin; |
| | | LOGI("<ContinuousTransfer>åä¼ æµè¯ï¼å¼å§ç¬¬ %d è½®", m_nContinuousTransferCount + 1); |
| | | } |
| | | CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask); |
| | | |
| | | |
| | |
| | | |
| | | unsigned CMaster::ReadBitsProc() |
| | | { |
| | | // æ å¿ä½æ¸
0å¤ä½ |
| | | { |
| | | StationIdentifier station; |
| | | station.nNetNo = 0; |
| | | station.nStNo = 255; |
| | | char szBuffer[528] = { 0 }; // 0x0, 0x1087 |
| | | m_cclink.WriteData(station, (long)DeviceType::B, 0, 528, (short*)szBuffer); |
| | | } |
| | | |
| | | |
| | | while (1) { |
| | | // å¾
éåºä¿¡å·ææ¶é´å° |
| | | int nRet = ::WaitForSingleObject(m_hEventReadBitsThreadExit[0], 1000); |
| | |
| | | listener.onPreFethedOutJob = [&](void* pEquipment, int port, CJobDataB* pJobDataB) -> BOOL { |
| | | CEquipment* p = (CEquipment*)pEquipment; |
| | | |
| | | // å¯è½è¦å è¿ä¸å¥ |
| | | Sleep(750); |
| | | |
| | | // åçï¼æ´æ°å½åæ¬éä»»å¡ |
| | | BOOL bOk = FALSE; |
| | |
| | | listener.onPreStoredJob = [&](void* pEquipment, int port, CJobDataB* pJobDataB, short& slot) -> BOOL { |
| | | CEquipment* p = (CEquipment*)pEquipment; |
| | | |
| | | // å¯è½è¦å è¿ä¸å¥ |
| | | Sleep(750); |
| | | |
| | | // æ¾çï¼æ´æ°å½åæ¬éä»»å¡ |
| | | BOOL bOk = FALSE; |
| | |
| | | && m_pActiveRobotTask->getTarPosition() == p->getID()) { |
| | | m_pActiveRobotTask->stored(); |
| | | m_pActiveRobotTask->completed(); |
| | | |
| | | if (m_state == MASTERSTATE::RUNNING_CONTINUOUS_TRANSFER) { |
| | | if (m_nContinuousTransferStep == CTStep_end) { |
| | | m_nContinuousTransferCount++; |
| | | LOGI("<ContinuousTransfer>åä¼ æµè¯ï¼ç¬¬ %d è½®ç»æ", m_nContinuousTransferCount); |
| | | if (m_listener.onCTRoundEnd != nullptr) { |
| | | m_listener.onCTRoundEnd(this, m_nContinuousTransferCount); |
| | | } |
| | | } |
| | | } |
| | | |
| | | LOGI("æ¾ç宿..."); |
| | | // å®ææ¤æ¡æ¬éä»»å¡ï¼ä½è¦ææ°æ®åæ¶æ¯ä¸æåºç¨å± |
| | | unlock(); |
| | |
| | | ((CEquipment*)pEquipment)->getName().c_str(), scanMap, downMap); |
| | | }; |
| | | listener.onPortStatusChanged = [&](void* pEquipment, short status, __int64 data) { |
| | | LOGE("<Master-%s>Port InUseãstatus=%d, data=%lld", ((CEquipment*)pEquipment)->getName().c_str(), status); |
| | | LOGE("<Master-%s>onPortStatusChangedãstatus=%d, data=%lld", ((CEquipment*)pEquipment)->getName().c_str(), status); |
| | | if (m_listener.onLoadPortStatusChanged != nullptr) { |
| | | m_listener.onLoadPortStatusChanged(this, (CEquipment*)pEquipment, status, data); |
| | | } |
| | |
| | | } |
| | | |
| | | CRobotTask* pTask = nullptr; |
| | | CSlot* pTarSlot = pTarEq->isSlotAvailable(nTarSlot); |
| | | CSlot* pSrcSlot = pSrcEq->getProcessedSlotCt(nSrcSlot); |
| | | if (pSrcSlot != nullptr && pSrcEq->getID() == EQ_ID_MEASUREMENT |
| | | && (pTarEq->getID() == EQ_ID_LOADPORT1 || pTarEq->getID() == EQ_ID_LOADPORT2 || pTarEq->getID() == EQ_ID_LOADPORT3 || pTarEq->getID() == EQ_ID_LOADPORT4)) { |
| | | pTarEq->removeGlass(1); |
| | | } |
| | | CSlot* pTarSlot = pTarEq->isSlotAvailable(nTarSlot); |
| | | if (pSrcSlot != nullptr && nullptr != pTarSlot) { |
| | | pTask = new CRobotTask(); |
| | | pTask->setContext(pSrcSlot->getContext()); |
| | |
| | | { |
| | | return m_bEnableAlarmReport; |
| | | } |
| | | |
| | | int CMaster::proceedWithCarrier(unsigned int port) |
| | | { |
| | | if (port >= 4) return -1; |
| | | |
| | | static int pid[] = { EQ_ID_LOADPORT1, EQ_ID_LOADPORT2, EQ_ID_LOADPORT3, EQ_ID_LOADPORT4}; |
| | | CLoadPort* pPort = (CLoadPort*)getEquipment(pid[port]); |
| | | pPort->sendCassetteCtrlCmd(CCC_PROCESS_START, nullptr, 0, 0, 0, nullptr, nullptr); |
| | | return 0; |
| | | } |
| | | |
| | | int CMaster::carrierRelease(unsigned int port) |
| | | { |
| | | if (port >= 4) return -1; |
| | | |
| | | static int pid[] = { EQ_ID_LOADPORT1, EQ_ID_LOADPORT2, EQ_ID_LOADPORT3, EQ_ID_LOADPORT4 }; |
| | | CLoadPort* pPort = (CLoadPort*)getEquipment(pid[port]); |
| | | pPort->sendCassetteCtrlCmd(CCC_PROCESS_CANCEL, nullptr, 0, 0, 0, nullptr, nullptr); |
| | | return 0; |
| | | } |
| | | |
| | | int CMaster::getContinuousTransferCount() |
| | | { |
| | | return m_nContinuousTransferCount; |
| | | } |
| | | |
| | | void CMaster::setContinuousTransferCount(int round) |
| | | { |
| | | m_nContinuousTransferCount = round; |
| | | } |
| | | } |
| | |
| | | #include "CRobotTask.h" |
| | | |
| | | |
| | | #define CTStep_begin 0 |
| | | #define CTStep_end 99 |
| | | |
| | | namespace SERVO { |
| | | enum class MASTERSTATE { |
| | | READY = 0, |
| | |
| | | typedef std::function<void(void* pMaster, CEquipment* pEquipment, int code)> ONEQDATACHANGED; |
| | | typedef std::function<void(void* pMaster, CRobotTask* pTask, int code)> ONROBOTTASKEVENT; |
| | | typedef std::function<void(void* pMaster, CEquipment* pEquipment, short status, __int64 data)> ONLOADPORTSTATUSCHANGED; |
| | | typedef std::function<void(void* pMaster, int round)> ONCTROUNDEND; |
| | | typedef struct _MasterListener |
| | | { |
| | | ONMASTERSTATECHANGED onMasterStateChanged; |
| | |
| | | ONEQDATACHANGED onEqDataChanged; |
| | | ONROBOTTASKEVENT onRobotTaskEvent; |
| | | ONLOADPORTSTATUSCHANGED onLoadPortStatusChanged; |
| | | ONCTROUNDEND onCTRoundEnd; |
| | | } MasterListener; |
| | | |
| | | class CMaster |
| | |
| | | void enableEventReport(bool bEnable); |
| | | void enableAlarmReport(bool bEnable); |
| | | bool isAlarmReportEnable(); |
| | | int proceedWithCarrier(unsigned int port); |
| | | int carrierRelease(unsigned int port); |
| | | int getContinuousTransferCount(); |
| | | void setContinuousTransferCount(int round); |
| | | |
| | | private: |
| | | inline void lock() { EnterCriticalSection(&m_criticalSection); } |
| | |
| | | |
| | | // å¨å¼å§å·¥èºåæ¯å¦å
éè¦å
æ¯è¾map |
| | | BOOL m_isCompareMapsBeforeProceeding; |
| | | |
| | | // åä¼ åæ°è®¡æ° |
| | | int m_nContinuousTransferCount; |
| | | int m_nContinuousTransferStep; |
| | | |
| | | private: |
| | | bool m_bEnableEventReport; |
| | | bool m_bEnableAlarmReport; |
| | |
| | | theApp.m_model.setPortCassetteType(m_pPort->getIndex(), SERVO::CassetteType(index + 1)); |
| | | |
| | | |
| | | /* |
| | | g_nMsgDlgShow = 0; |
| | | CMsgDlg msgDlg("请çå¾
", "æ£å¨æä½ï¼è¯·çå¾
..."); |
| | | msgDlg.SetData((DWORD_PTR)this); |
| | | |
| | | ASSERT(m_pPort != nullptr); |
| | | int index = ((CComboBox*)GetDlgItem(IDC_COMBO_PORT_CASSERT_TYPE))->GetCurSel(); |
| | | m_pPort->setCassetteType(SERVO::CassetteType(index + 1), [&](int code) -> int { |
| | | Sleep(100); |
| | | CString strMsg; |
| | |
| | | |
| | | msgDlg.DoModal(); |
| | | g_nMsgDlgShow = 1; |
| | | */ |
| | | } |
| | | |
| | | void CPagePortProperty::OnCbnSelchangeComboPortTransferMode() |
| | |
| | | m_nJobExistenceSlot[0] = map; |
| | | } |
| | | |
| | | void CPortStatusReport::setCassetteId(const char* pszId) |
| | | { |
| | | m_strCassetteID = pszId; |
| | | } |
| | | |
| | | void CPortStatusReport::WriteString(CArchive& ar, std::string& string) |
| | | { |
| | | CString strTemp = string.c_str(); |
| | |
| | | bool isJobExistenceSlot(); |
| | | short getJobExistenceSlot(); |
| | | void setJobExistenceSlot(short map); |
| | | void setCassetteId(const char* pszId); |
| | | |
| | | private: |
| | | void WriteString(CArchive& ar, std::string& string); |
| | |
| | | { |
| | | m_nVarialbeId = 0; |
| | | m_format = SVFromat::U1; |
| | | m_nValue = 0; |
| | | } |
| | | |
| | | CVariable::CVariable(const char* pszId, const char* pszName, const char* pszFormat, const char* pszRemark) |
| | |
| | | { |
| | | return m_strRemark; |
| | | } |
| | | |
| | | void CVariable::setValue(__int64 value) |
| | | { |
| | | if (m_format == SVFromat::U1 || m_format == SVFromat::U2 || m_format == SVFromat::I2) { |
| | | m_nValue = value; |
| | | } |
| | | } |
| | | |
| | | void CVariable::setValue(const char* pszValue) |
| | | { |
| | | std::string strTemp = pszValue; |
| | | if (m_format == SVFromat::A20) { |
| | | if (strTemp.length() > 20) { |
| | | strTemp = strTemp.substr(0, 20); |
| | | } |
| | | } |
| | | else if (m_format == SVFromat::A50) { |
| | | if (strTemp.length() > 50) { |
| | | strTemp = strTemp.substr(0, 50); |
| | | } |
| | | } |
| | | |
| | | m_strValue = strTemp; |
| | | } |
| | | |
| | | std::string CVariable::getValue() |
| | | { |
| | | std::string strRet; |
| | | if (m_format == SVFromat::U1 || m_format == SVFromat::U2 || m_format == SVFromat::I2) { |
| | | strRet = std::to_string(m_nValue); |
| | | } |
| | | else if(m_format == SVFromat::A20 || m_format == SVFromat::A50) { |
| | | strRet = m_strValue; |
| | | } |
| | | |
| | | return strRet; |
| | | } |
| | | } |
| | |
| | | std::string& getName(); |
| | | SVFromat getFormat(); |
| | | std::string& getRemark(); |
| | | void setValue(__int64 value); |
| | | void setValue(const char* pszValue); |
| | | std::string getValue(); |
| | | |
| | | private: |
| | | unsigned int m_nVarialbeId; |
| | | std::string m_strName; |
| | | SVFromat m_format; |
| | | std::string m_strRemark; |
| | | __int64 m_nValue; |
| | | std::string m_strValue; |
| | | }; |
| | | } |
| | | |
| | |
| | | return GetPrivateProfileInt(_T("Master"), _T("CompareMapsBeforeProceeding"), 0, m_strFilepath); |
| | | } |
| | | |
| | | void CConfiguration::setContinuousTransferCount(int round) |
| | | { |
| | | WritePrivateProfileString(_T("Master"), _T("CTRound"), |
| | | std::to_string(round).c_str(), m_strFilepath); |
| | | } |
| | | |
| | | int CConfiguration::getContinuousTransferCount() |
| | | { |
| | | return GetPrivateProfileInt(_T("Master"), _T("CTRound"), 0, m_strFilepath); |
| | | } |
| | | |
| | |
| | | BOOL setPortCassetteType(unsigned int index, int cassetteType); |
| | | BOOL setPortEnable(unsigned int index, BOOL bEnable); |
| | | BOOL isCompareMapsBeforeProceeding(); |
| | | void setContinuousTransferCount(int round); |
| | | int getContinuousTransferCount(); |
| | | |
| | | public: |
| | | void setP2RemoteEqReconnectInterval(int second); |
| | |
| | | return nullptr; |
| | | } |
| | | |
| | | SERVO::CVariable* CHsmsPassive::getVariable(const char* pszName) |
| | | { |
| | | for (auto item : m_variabels) { |
| | | if (item->getName().compare(pszName) == 0) { |
| | | return item; |
| | | } |
| | | } |
| | | |
| | | return nullptr; |
| | | } |
| | | |
| | | void CHsmsPassive::clearAllVariabel() |
| | | { |
| | | for (auto item : m_variabels) { |
| | | delete item; |
| | | } |
| | | m_variabels.clear(); |
| | | } |
| | | |
| | | void CHsmsPassive::setVariableValue(const char* pszName, __int64 value) |
| | | { |
| | | auto v = getVariable(pszName); |
| | | if (v != nullptr) { |
| | | v->setValue(value); |
| | | } |
| | | } |
| | | |
| | | void CHsmsPassive::setVariableValue(const char* pszName, const char* value) |
| | | { |
| | | auto v = getVariable(pszName); |
| | | if (v != nullptr) { |
| | | v->setValue(value); |
| | | } |
| | | } |
| | | |
| | | int CHsmsPassive::loadReports(const char* pszFilepath) |
| | |
| | | } |
| | | else if (nStream == 2 && pHeader->function == 43) { |
| | | replyConfigureSpooling(pMessage); |
| | | } |
| | | else if (nStream == 3 && pHeader->function == 17) { |
| | | replyCarrierAction(pMessage); |
| | | } |
| | | else if (nStream == 5 && pHeader->function == 3) { |
| | | replyEanbleDisableAlarmReport(pMessage); |
| | |
| | | |
| | | // æ£éªç»ææ¯å¦æ£ç¡® |
| | | for (auto item : m_collectionEvents) { |
| | | LOGE("=== ceid:%d, prtid:%d", item->getEventId(), item->getPortID()); |
| | | LOGE("=== ceid:%d, prtid:%d", item->getEventId(), item->getFirstPortID()); |
| | | } |
| | | |
| | | MYREPLY: |
| | |
| | | } |
| | | MYREPLY: |
| | | replyAck(2, 42, pRecv->getHeader()->systemBytes, BYTE(0), "ERACK"); |
| | | return 0; |
| | | } |
| | | |
| | | // S3F17 |
| | | int CHsmsPassive::replyCarrierAction(IMessage* pRecv) |
| | | { |
| | | if (m_pPassive == NULL || STATE::SELECTED != m_pPassive->getState()) { |
| | | return ER_NOTSELECT; |
| | | } |
| | | |
| | | unsigned char CAACK = CAACK_0; |
| | | unsigned int ERRCODE = 0; |
| | | std::string strError = "no error"; |
| | | if (m_listener.onCarrierAction == nullptr) { |
| | | CAACK = 5; |
| | | ERRCODE = CAACK_5; |
| | | strError = "Not supported"; |
| | | goto MYREPLY; |
| | | } |
| | | |
| | | |
| | | ISECS2Item* pBody = pRecv->getBody(); |
| | | if (pBody == nullptr || pBody->getType() != SITYPE::L) ER_PARAM_ERROR; |
| | | |
| | | unsigned int DATAID; |
| | | unsigned char PTN; |
| | | const char* pszCarrierAction, *pszCarrierId; |
| | | pBody->getSubItemU4(0, DATAID); |
| | | pBody->getSubItemString(1, pszCarrierAction); |
| | | pBody->getSubItemString(2, pszCarrierId); |
| | | pBody->getSubItemU1(3, PTN); |
| | | ERRCODE = m_listener.onCarrierAction(this, |
| | | DATAID, |
| | | pszCarrierAction, |
| | | pszCarrierId, |
| | | PTN, |
| | | strError); |
| | | CAACK = ERRCODE; |
| | | |
| | | // åå¤ |
| | | MYREPLY: |
| | | IMessage* pMessage = NULL; |
| | | HSMS_Create1Message(pMessage, m_nSessionId, 3, 18, pRecv->getHeader()->systemBytes); |
| | | pMessage->getBody()->addU1Item(CAACK, "CAACK"); |
| | | ISECS2Item* pErrItem = pMessage->getBody()->addItem(); |
| | | pErrItem->addU4Item(ERRCODE, "ERRCODE"); |
| | | pErrItem->addItem(strError.c_str(), "ERRTEXT"); |
| | | m_pPassive->sendMessage(pMessage); |
| | | LOGI("<HSMS>[SECS Msg SEND]S3F18 (SysByte=%u)", pMessage->getHeader()->systemBytes); |
| | | HSMS_Destroy1Message(pMessage); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | // S6F11 |
| | | int CHsmsPassive::requestEventReportSend(unsigned int DATAID, unsigned int CEID, const std::vector<std::string>& values) |
| | | static unsigned int DATAID = 1; |
| | | int CHsmsPassive::requestEventReportSend(unsigned int CEID) |
| | | { |
| | | SERVO::CCollectionEvent* pEvent = getEvent(CEID); |
| | | if (pEvent == nullptr) { |
| | | return ER_NO_EVENT; |
| | | } |
| | | if (pEvent == nullptr) { |
| | | |
| | | SERVO::CReport* pReport = pEvent->getFirstReport(); |
| | | if (pReport == nullptr) { |
| | | return ER_UNLINK_EVENT_REPORT; |
| | | } |
| | | |
| | | |
| | | Lock(); |
| | | CHsmsAction* pAction = new CHsmsAction(ACTION_EVENT_REPORT, TRUE, m_nActionTimeout); |
| | |
| | | HSMS_Create1Message(pMessage, m_nSessionId, 6 | REPLY, 11, ++m_nSystemByte); |
| | | ASSERT(pMessage); |
| | | ISECS2Item* pItem = pMessage->getBody(); |
| | | pItem->addU4Item(DATAID, "DATAID"); |
| | | pItem->addU4Item(++DATAID, "DATAID"); |
| | | pItem->addU4Item(CEID, "CEID"); |
| | | ISECS2Item* pItemList1 = pItem->addItem(); |
| | | ISECS2Item* pItemList2 = pItemList1->addItem(); |
| | | pItemList2->addU4Item(pEvent->getPortID(), "RPTID"); |
| | | pItemList2->addU4Item(pReport->getReportId(), "RPTID"); |
| | | ISECS2Item* pItemList3 = pItemList2->addItem(); |
| | | |
| | | auto values = pReport->getVariables(); |
| | | for (auto item : values) { |
| | | pItemList3->addItem(item.c_str(), "V"); |
| | | pItemList3->addItem(item->getValue().c_str(), "V"); |
| | | } |
| | | pAction->setSendMessage(pMessage); |
| | | if (m_pPassive == NULL || STATE::SELECTED != m_pPassive->getState()) { |
| | |
| | | return ER_NOERROR; |
| | | } |
| | | |
| | | int CHsmsPassive::requestEventReportSend(const char* pszEventName) |
| | | { |
| | | SERVO::CCollectionEvent* pEvent = nullptr; |
| | | for (auto e : m_collectionEvents) { |
| | | if (e->getName().compare(pszEventName) == 0) { |
| | | pEvent = e; |
| | | break; |
| | | } |
| | | } |
| | | if (pEvent == nullptr) { |
| | | return ER_NO_EVENT; |
| | | } |
| | | return requestEventReportSend(pEvent->getEventId()); |
| | | } |
| | | |
| | | int CHsmsPassive::requestEventReportSend_CarrierID_Readed() |
| | | { |
| | | return requestEventReportSend("CarrierID_Readed"); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | |
| | | #define ER_NO_EVENT -4 |
| | | #define ER_UNLINK_EVENT_REPORT -5 |
| | | #define ER_NO_PPID_LIST -6 |
| | | #define ER_NOT_SUPPORTED -7 |
| | | |
| | | |
| | | /* CAACK */ |
| | | |
| | | #define CAACK_0 0 /* ok */ |
| | | #define CAACK_1 1 /* invalid command */ |
| | | #define CAACK_2 2 /* cannot perform now */ |
| | | #define CAACK_3 3 /* invalid data or argument */ |
| | | #define CAACK_4 4 /* initiated for asynchronous completion */ |
| | | #define CAACK_5 5 /* rejected - invalid state */ |
| | | #define CAACK_6 6 /* command performed with errors */ |
| | | |
| | | /* |
| | | * 叏鿰æ®ç»æ |
| | |
| | | typedef std::function<void(void* pFrom, bool bEnable, std::vector<unsigned int>& ids)> EDEVENTREPORT; |
| | | typedef std::function<void(void* pFrom, bool bEnable, unsigned int id)> EDALARMREPORT; |
| | | typedef std::function<std::vector<std::string> (void* pFrom)> QUERYPPIDLIST; |
| | | typedef std::function<unsigned int (void* pFrom, |
| | | unsigned int DATAID, |
| | | const char* pszCarrierAction, |
| | | const char* pszCarrierId, |
| | | unsigned char PTN, |
| | | std::string& strErrorTxt)> CARRIERACTION; |
| | | typedef struct _SECSListener |
| | | { |
| | | SECSEQOFFLINE onEQOffLine; |
| | |
| | | EDEVENTREPORT onEnableDisableEventReport; |
| | | EDALARMREPORT onEnableDisableAlarmReport; |
| | | QUERYPPIDLIST onQueryPPIDList; |
| | | CARRIERACTION onCarrierAction; |
| | | } SECSListener; |
| | | |
| | | |
| | |
| | | |
| | | // å徿å®Variable |
| | | SERVO::CVariable* getVariable(int variableId); |
| | | SERVO::CVariable* getVariable(const char* pszName); |
| | | |
| | | // 设置åéå¼ |
| | | void setVariableValue(const char* pszName, __int64 value); |
| | | void setVariableValue(const char* pszName, const char* value); |
| | | |
| | | // 仿件ä¸å è½½CReportå表 |
| | | int loadReports(const char* pszFilepath); |
| | |
| | | /* requestå¼å¤´ç彿°ä¸ºä¸»å¨åéæ°æ®ç彿° */ |
| | | int requestAreYouThere(); |
| | | int requestAlarmReport(int ALCD, int ALID, const char* ALTX); |
| | | int requestEventReportSend(unsigned int DATAID, unsigned int CEID, const std::vector<std::string>& values); |
| | | int requestEventReportSend(unsigned int CEID); |
| | | int requestEventReportSend(const char* pszEventName); |
| | | int requestEventReportSend_CarrierID_Readed(); |
| | | |
| | | private: |
| | | void replyAck(int s, int f, unsigned int systemBytes, BYTE ack, const char* pszAckName); |
| | |
| | | int replyEanbleDisableEventReport(IMessage* pRecv); |
| | | int replyCommand(IMessage* pRecv); |
| | | int replyConfigureSpooling(IMessage* pRecv); |
| | | int replyCarrierAction(IMessage* pRecv); |
| | | int replyEanbleDisableAlarmReport(IMessage* pRecv); |
| | | int replyPurgeSpooledData(IMessage* pRecv); |
| | | int replyQueryPPIDList(IMessage* pRecv); |
| | |
| | | } |
| | | return ppids; |
| | | }; |
| | | listener.onCarrierAction = [&](void* pFrom, |
| | | unsigned int DATAID, |
| | | const char* pszCarrierAction, |
| | | const char* pszCarrierId, |
| | | unsigned char PTN, |
| | | std::string& strErrorTxt) -> unsigned int { |
| | | if (PTN < 1 || 4 < PTN) { |
| | | strErrorTxt = "invalid data or argument"; |
| | | return CAACK_3; |
| | | } |
| | | |
| | | if (_strcmpi(pszCarrierAction, "ProceedWithCarrier") == 0) { |
| | | m_master.proceedWithCarrier(PTN); |
| | | return CAACK_0; |
| | | } |
| | | else if (_strcmpi(pszCarrierAction, "CarrierRelease") == 0) { |
| | | m_master.carrierRelease(PTN); |
| | | return CAACK_0; |
| | | } |
| | | |
| | | strErrorTxt = "rejected - invalid state"; |
| | | return CAACK_5; |
| | | LOGI("<Model>onCarrierAction %d, %s, %d, %d", DATAID, pszCarrierAction, pszCarrierId, PTN); |
| | | }; |
| | | m_hsmsPassive.setListener(listener); |
| | | m_hsmsPassive.setEquipmentModelType((LPTSTR)(LPCTSTR)strModeType); |
| | | m_hsmsPassive.setSoftRev((LPTSTR)(LPCTSTR)strSoftRev); |
| | |
| | | }; |
| | | masterListener.onLoadPortStatusChanged = [&] (void* pMaster, SERVO::CEquipment* pEquipment, short status, __int64 data) { |
| | | LOGE("<CModel>onLoadPortStatusChanged. status = %d", status); |
| | | if (status == PORT_INUSE) { |
| | | SERVO::CLoadPort* pLoadPort = dynamic_cast<SERVO::CLoadPort*>(pEquipment); |
| | | if (pLoadPort != nullptr) { |
| | | m_hsmsPassive.setVariableValue("CarrierID", pLoadPort->getCassetteId().c_str()); |
| | | } |
| | | m_hsmsPassive.requestEventReportSend_CarrierID_Readed(); |
| | | } |
| | | notifyPtr(RX_CODE_LOADPORT_STATUS_CHANGED, pEquipment); |
| | | }; |
| | | masterListener.onCTRoundEnd = [&](void* pMaster, int round) { |
| | | m_configuration.setContinuousTransferCount(round); |
| | | }; |
| | | m_master.setListener(masterListener); |
| | | m_master.setContinuousTransferCount(m_configuration.getContinuousTransferCount()); |
| | | |
| | | |
| | | // master 设置ç¼åæä»¶ |
| | |
| | | else { |
| | | CString strTemp = strText; |
| | | strTemp.TrimRight(); |
| | | bMatch = std::regex_match((LPTSTR)(LPCTSTR)strTemp, |
| | | std::regex((LPTSTR)(LPCTSTR)m_strFilterText)); |
| | | try { |
| | | bMatch = std::regex_match((LPTSTR)(LPCTSTR)strTemp, |
| | | std::regex((LPTSTR)(LPCTSTR)m_strFilterText)); |
| | | } |
| | | catch (const std::regex_error& e) { |
| | | |
| | | } |
| | | } |
| | | if (m_filterMode == FilterMode::Exclude) { |
| | | bMatch = !bMatch; |
| | |
| | | pEq2 = theApp.m_model.getMaster().getEquipment(pTask->getTarPosition()); |
| | | if (pEq1 != nullptr && pEq2 != nullptr) { |
| | | CString strText; |
| | | strText.Format(_T("%s --> %s"), pEq1->getName().c_str(), pEq2->getName().c_str()); |
| | | if (theApp.m_model.getMaster().getContinuousTransferCount() > 0) { |
| | | strText.Format(_T("[%d]%s --> %s"), |
| | | theApp.m_model.getMaster().getContinuousTransferCount(), |
| | | pEq1->getName().c_str(), pEq2->getName().c_str()); |
| | | } |
| | | else { |
| | | strText.Format(_T("%s --> %s"), |
| | | pEq1->getName().c_str(), pEq2->getName().c_str()); |
| | | } |
| | | m_pMyStatusbar->setCurTaskBtnText((LPTSTR)(LPCTSTR)strText); |
| | | } |
| | | } |
| | |
| | | 31032,CJobResume,,(31000) |
| | | 40000,E90_SPSM_NoState_To_NeedsProcessing,,(40000) |
| | | 40001,E90_SPSM_InProcess_To_ProcessCompleted,,(40000) |
| | | 50000,CarrierID_Readed,,(50000) |
| | |
| | | 30000,(1,30000,30001) |
| | | 31000,(1,31000,31001) |
| | | 40000,(1,10203,20000) |
| | | 50000,(5000) |
| | | |
| | |
| | | 2023,OCREnable,U2,"OCR使è½ï¼O:å¼å¯ 1ï¼å±è½" |
| | | 2024,CCDEnable,U2,"CCD使è½ï¼O:å¼å¯ 1ï¼å±è½" |
| | | 2025,FFUParameter,U2,FFU设å®å¼ |
| | | 5000,CarrierID,A20,å¡å£ID |