chenluhua1980
2026-01-04 3afd6812c6bcb156297a9000db44caf23ede568c
SourceCode/Bond/Servo/HsmsPassive.cpp
@@ -950,7 +950,8 @@
      return -1;
   }
   std::wregex pattern(L"^\\d+,[^,]*,[^,]*,\\(\\d+(,\\d+)*\\).*");  // 匹配以数字+逗号开头的字符串
   // 允许 Attached RPTID 为空:()
   std::wregex pattern(L"^\\d+,[^,]*,[^,]*,\\(\\d*(,\\d+)*\\).*");  // 匹配以数字+逗号开头的字符串
   std::vector<SERVO::CCollectionEvent*> events;
   int index, last;
   CStringW strLine, strRPTIDs;
@@ -1020,12 +1021,58 @@
   return m_collectionEvents;
}
unsigned int CHsmsPassive::getMaxCollectionEventId() const
{
   unsigned int maxId = 0;
   for (auto item : m_collectionEvents) {
      if (item && item->getEventId() > maxId) {
         maxId = item->getEventId();
      }
   }
   return maxId;
}
int CHsmsPassive::deleteCollectionEvent(unsigned short CEID)
{
   for (auto iter = m_collectionEvents.begin(); iter != m_collectionEvents.end(); ++iter) {
      if ((*iter)->getEventId() == CEID) {
         delete (*iter);
         m_collectionEvents.erase(iter);
         return writeCollectionEventsToFile(m_strCollectionEventFilepath);
      }
   }
   return -1;
}
int CHsmsPassive::addCollectionEvent(unsigned int CEID, const char* name, const char* desc, const std::vector<unsigned int>& rptids)
{
   if (getEvent((unsigned short)CEID) != nullptr) {
      return -1;
   }
   auto* pEvent = new SERVO::CCollectionEvent(CEID, name, desc, const_cast<std::vector<unsigned int>&>(rptids));
   for (auto rptid : rptids) {
      SERVO::CReport* pReport = getReport((int)rptid);
      if (pReport != nullptr) {
         pEvent->addReport(pReport);
      }
   }
   m_collectionEvents.push_back(pEvent);
   return writeCollectionEventsToFile(m_strCollectionEventFilepath);
}
int CHsmsPassive::updateCollectionEvent(unsigned int CEID, const char* name, const char* desc, const std::vector<unsigned int>& rptids)
{
   for (auto iter = m_collectionEvents.begin(); iter != m_collectionEvents.end(); ++iter) {
      if ((*iter)->getEventId() == CEID) {
         delete (*iter);
         auto* pEvent = new SERVO::CCollectionEvent(CEID, name, desc, const_cast<std::vector<unsigned int>&>(rptids));
         for (auto rptid : rptids) {
            SERVO::CReport* pReport = getReport((int)rptid);
            if (pReport != nullptr) {
               pEvent->addReport(pReport);
            }
         }
         *iter = pEvent;
         return writeCollectionEventsToFile(m_strCollectionEventFilepath);
      }
   }
@@ -1571,18 +1618,18 @@
   ASSERT(pMessage);
   unsigned char SVU1 = 0;
   unsigned int SVID = 0;
   unsigned short SVID = 0;
   ISECS2Item* pBody = pRecv->getBody();
   if (pBody == nullptr || pBody->getType() != SITYPE::L) {
      pMessage->getBody()->addU1Item(SVU1, "SV");
      goto MYREPLY;
   }
   if (!pBody->getSubItemU4(0, SVID)) {
   if (!pBody->getSubItemU2(0, SVID)) {
      pMessage->getBody()->addU1Item(SVU1, "SV");
      goto MYREPLY;
   }
   SERVO::CVariable* pVariable = getVariable(SVID);
   SERVO::CVariable* pVariable = getVariable((int)SVID);
   if (pVariable == nullptr) {
      pMessage->getBody()->addU1Item(SVU1, "SV");
      goto MYREPLY;
@@ -2413,7 +2460,7 @@
}
// S6F11
static unsigned int DATAID = 1;
static unsigned short DATAID = 0;
int CHsmsPassive::requestEventReportSend(unsigned int CEID)
{
   SERVO::CCollectionEvent* pEvent = getEvent(CEID);
@@ -2422,9 +2469,6 @@
   }
   SERVO::CReport* pReport = pEvent->getFirstReport();
   if (pReport == nullptr) {
      return ER_UNLINK_EVENT_REPORT;
   }
   Lock();
@@ -2433,16 +2477,19 @@
   HSMS_Create1Message(pMessage, m_nSessionId, 6 | REPLY, 11, ++m_nSystemByte);
   ASSERT(pMessage);
   ISECS2Item* pItem = pMessage->getBody();
   pItem->addU4Item(++DATAID, "DATAID");
   // pItem->addU2Item(++DATAID, "DATAID");      // 根据别的日志显示DATAID恒为0,所以我们先照使用0
   pItem->addU2Item(0, "DATAID");
   pItem->addU4Item(CEID, "CEID");
   ISECS2Item* pItemList1 = pItem->addItem();
   ISECS2Item* pItemList2 = pItemList1->addItem();
   pItemList2->addU4Item(pReport->getReportId(), "RPTID");
   ISECS2Item* pItemList3 = pItemList2->addItem();
   ISECS2Item* pItemList1 = pItem->addItem(); // L[n] reports
   if (pReport != nullptr) {
      ISECS2Item* pItemList2 = pItemList1->addItem();
      pItemList2->addU4Item(pReport->getReportId(), "RPTID");
      ISECS2Item* pItemList3 = pItemList2->addItem();
   auto vars = pReport->getVariables();
   for (auto var : vars) {
      addVariableValueToItem(pItemList3, var);
      auto vars = pReport->getVariables();
      for (auto var : vars) {
         addVariableValueToItem(pItemList3, var);
      }
   }
   pAction->setSendMessage(pMessage);
   if (m_pPassive == NULL || STATE::SELECTED != m_pPassive->getState()) {
@@ -2477,6 +2524,21 @@
   return requestEventReportSend("CarrierID_Readed");
}
int CHsmsPassive::requestEventReportSend_CheckSlotMap()
{
   return requestEventReportSend("CheckSlotMap");
}
int CHsmsPassive::requestEventReportSend_SlotMapVerificationOK()
{
   return requestEventReportSend("SlotMapVerificationOK");
}
int CHsmsPassive::requestEventReportSend_SlotMapVerificationNG()
{
   return requestEventReportSend("SlotMapVerificationNG");
}
int CHsmsPassive::requestEventReportSend_Port_Unload_Ready()
{
   return requestEventReportSend("Port_Unload_Ready");
@@ -2485,6 +2547,11 @@
int CHsmsPassive::requestEventReportSend_Port_Load_Ready()
{
   return requestEventReportSend("Port_Load_Ready");
}
int CHsmsPassive::requestEventReportSend_Port_Ready_To_Release()
{
   return requestEventReportSend("Port_Ready_To_Release");
}
int CHsmsPassive::requestEventReportSend_Port_Blocked()
@@ -2532,5 +2599,24 @@
   return requestEventReportSend("OCR_PanelID_Read_OK");
}
int CHsmsPassive::requestEventReportSend_LoadPortNotAssoc()
{
   return requestEventReportSend("LoadPortNotAssoc");
}
int CHsmsPassive::requestEventReportSend_ProcessDataReport()
{
   return requestEventReportSend("ProcessDataReport");
}
int CHsmsPassive::requestEventReportSend_SubEqpStart()
{
   return requestEventReportSend("SubEqpStart");
}
int CHsmsPassive::requestEventReportSend_SubEqpEnd()
{
   return requestEventReportSend("SubEqpEnd");
}