LAPTOP-SNT8I5JK\Boounion
2025-06-30 dba7d2725cefc162ef58a53bb12b4656434c8bc0
SourceCode/Bond/Servo/CEquipment.cpp
@@ -406,10 +406,12 @@
         m_bLinkSignalToUpstream[i][SIGNAL_INTERLOCK] = isBitOn(pszData, size, index + 2);
         m_bLinkSignalToUpstream[i][SIGNAL_SEND_ABLE] = isBitOn(pszData, size, index + 3);
         index += 0x40;
         if (m_bLinkSignalToUpstream[i][SIGNAL_SEND_ABLE]) {
            onSendAble(i+1);
         }
      }       
      if(m_bLinkSignalToUpstream[0][SIGNAL_SEND_ABLE]) {
         onSendAble();
      }
      index += 0x40 * 2;
      for (int i = 0; i < 8; i++) {
@@ -418,10 +420,12 @@
         m_bLinkSignalToDownstream[i][SIGNAL_INTERLOCK] = isBitOn(pszData, size, index + 2);
         m_bLinkSignalToDownstream[i][SIGNAL_RECEIVE_ABLE] = isBitOn(pszData, size, index + 3);
         index += 0x40;
         if (m_bLinkSignalToDownstream[0][SIGNAL_RECEIVE_ABLE]) {
            onReceiveAble(i + 1);
         }
      }
      if (m_bLinkSignalToDownstream[0][SIGNAL_RECEIVE_ABLE]) {
         onReceiveAble();
      }
      // 其它信号及响应
      index = 0x540;
@@ -844,17 +848,23 @@
      // 找到指定的glass id, 
      Lock();
      CGlass* pGlass = (CGlass*)m_slot[port - 1].getContext();
      if (pGlass == nullptr && !compareJobData(pJobDataB, pGlass->getJobDataS())) {
      CGlass* pContext = nullptr;
      for (int i = 0; i < SLOT_MAX; i++) {
         CGlass* pGlass = (CGlass*)m_slot[i].getContext();
         if (pGlass != nullptr && compareJobData(pJobDataB, pGlass->getJobDataS())) {
            pContext = pGlass;
            if (pGlass != nullptr) pGlass->addRef();
            m_slot[i].setContext(nullptr);
            break;
         }
      }
      if (pContext == nullptr) {
         Unlock();
         return -3;
      }
      if (pGlass != nullptr) pGlass->addRef();
      m_slot[port - 1].setContext(nullptr);
      ((CArm*)m_pArm)->tempStore(pGlass);
      pGlass->release();
      ((CArm*)m_pArm)->tempStore(pContext);
      pContext->release();
      Unlock();
@@ -869,7 +879,7 @@
      return 0;
   }
   int CEquipment::storedJob(int port, CJobDataB* pJobDataB)
   int CEquipment::storedJob(int port, CJobDataB* pJobDataB, short putSlot)
   {
      if (m_pArm == nullptr) {
         return -1;
@@ -883,8 +893,8 @@
      ASSERT(pGlass);
      Lock();
      pGlass->addPath(m_nID, port);
      m_slot[port - 1].setContext(pGlass);
      pGlass->addPath(m_nID, getSlotUnit(putSlot));
      m_slot[putSlot - 1].setContext(pGlass);
      pGlass->release();            // tempFetchOut需要调用一次release
      Unlock();
@@ -895,7 +905,7 @@
      if (m_listener.onDataChanged != nullptr) {
         m_listener.onDataChanged(this, EDCC_STORED_JOB);
      }
      return 0;
   }
@@ -943,7 +953,6 @@
   CGlass* CEquipment::getGlassWithCassette(int cassetteSequenceNo, int jobSequenceNo)
   {
      CSlot* pSlot = nullptr;
      for (int i = 0; i < SLOT_MAX; i++) {
         if (!m_slot[i].isEnable()) continue;
         CGlass* pGlass = (CGlass*)m_slot[i].getContext();
@@ -1297,7 +1306,7 @@
         if (!m_slot[i].isEnable()) continue;
         if (m_slot[i].isLock()) continue;
         CGlass* pGlass = (CGlass*)m_slot[i].getContext();
         if (!isSlotProcessed(i+1)) continue;
         if (!isSlotProcessed(i)) continue;
         if (pGlass == nullptr) continue;
         int lsPath = m_slot[i].getLinkSignalPath();
         if(!m_bLinkSignalToUpstream[lsPath][SIGNAL_UPSTREAM_INLINE]
@@ -1787,14 +1796,23 @@
      if (m_processState != PROCESS_STATE::Complete) {
         setProcessState(PROCESS_STATE::Complete);
      }
      CGlass* pGlass = getGlassFromSlot(port);
      CGlass* pGlass = getGlassFromSlot(slotNo);
      if (pGlass == nullptr) {
         LOGE("<CEquipment-%s>decodeJobProcessEndReport, 找不到对应glass", getName().c_str());
      }
      else {
         pGlass->processEnd(m_nID, port);
         if (m_processState != PROCESS_STATE::Complete) {
            setProcessState(PROCESS_STATE::Complete);
         CJobDataS* pJs = pGlass->getJobDataS();
         if (pJs->getCassetteSequenceNo() == cassetteNo
            && pJs->getJobSequenceNo() == jobSequenceNo) {
            pGlass->processEnd(m_nID, getSlotUnit(slotNo));
            if (m_processState != PROCESS_STATE::Complete) {
               setProcessState(PROCESS_STATE::Complete);
            }
         }
         else {
            LOGE("<CEquipment-%s>decodeJobProcessEndReport, jobSequenceNo或jobSequenceNo不匹配",
               getName().c_str());
         }
      }
@@ -1844,7 +1862,7 @@
      // 如果没有可用位置,报错
      Lock();
      CSlot* pSlot = getSlot(port - 1);
      CSlot* pSlot = getSlot(putSlot - 1);
      ASSERT(pSlot);
      if (pSlot->getContext() != nullptr) {
         Unlock();
@@ -1874,12 +1892,12 @@
      short putSlot = 0;
      BOOL bCheck = onPreStoredJob(port, pJobDataB, putSlot);
      if (bCheck && port == putSlot) {
         return storedJob(port, pJobDataB);
      if (bCheck) {
         return storedJob(port, pJobDataB, putSlot);
      }
      // 数据异常,处理或显示
      LOGI("<CEquipment-%s>onStoredJob Error.ort:%d|GlassId:%s",
      LOGI("<CEquipment-%s>onStoredJob Error.port:%d|GlassId:%s",
         m_strName.c_str(), port, pJobDataB->getGlassId().c_str());
      return -1;
   }
@@ -1895,19 +1913,16 @@
    * 当从CC-Link检测到设备Send Able为On时调用此函数
    * 可能会多次重复调用(根据扫描频率), 注意防呆
    */
   int CEquipment::onSendAble()
   int CEquipment::onSendAble(int port)
   {
      LOGI("<CEquipment-%s>onSendAble.", m_strName.c_str());
      if (m_processState != PROCESS_STATE::Complete) {
         setProcessState(PROCESS_STATE::Complete);
      }
      LOGI("<CEquipment-%s>onSendAble.port:%d", m_strName.c_str(), port);
      return 0;
   }
   int CEquipment::onReceiveAble()
   int CEquipment::onReceiveAble(int port)
   {
      LOGI("<CEquipment-%s>onReceiveAble.", m_strName.c_str());
      LOGI("<CEquipment-%s>onReceiveAble.port:%d", m_strName.c_str(), port);
      return 0;
   }