chenluhua1980
2025-12-15 cacf29e9e6a5c080688e25e87850ddfb5148f0f2
SourceCode/Bond/Servo/CPageGraph2.cpp
@@ -9,6 +9,7 @@
#include "CEquipmentPage1.h"
#include "CEquipmentPage2.h"
#include "CEquipmentPage3.h"
#include "CPageLinkSignal.h"
#include "CPagePortProperty.h"
#include "CPagePortStatus.h"
#include "CPageCassetteCtrlCmd.h"
@@ -63,10 +64,8 @@
         if (RX_CODE_EQ_DATA_CHANGED == code) {
            // 通知设备状态
            SERVO::CEquipment* pEquipment = nullptr;
            if (pAny->getPtrValue("ptr", (void*&)pEquipment)) {
               if (pEquipment != nullptr) {
                  m_pEqsGraphWnd->ShowItemIndicator((DWORD_PTR)pEquipment, !pEquipment->isGlassListEmpty());
               }
            if (pAny->getPtrValue("ptr", (void*&)pEquipment) && pEquipment != nullptr) {
               UpdateItemIndicators(pEquipment);
            }
         }
@@ -126,7 +125,12 @@
      ASSERT(pItem);
      SERVO::CEquipment* pEquipment = (SERVO::CEquipment*)pItem->pData;
      CHMPropertyDlg dlg(pEquipment->getName().c_str(), 658, 788);
      CHMPropertyDlg dlg(pEquipment->getName().c_str(), 1258, 788);
      CPageLinkSignal* pPage1 = new CPageLinkSignal();
      pPage1->setEquipment(pEquipment);
      pPage1->Create(IDD_PAGE_LINK_SIGNAL);
      dlg.addPage(pPage1, "Link Signal");
      if (_strcmpi(pEquipment->getClassName(), "CLoadPort") == 0) {
         CPagePortProperty* pPageA = new CPagePortProperty();
@@ -143,7 +147,7 @@
      CEquipmentPage2* pPage2 = new CEquipmentPage2();
      pPage2->setEquipment(pEquipment);
      pPage2->Create(IDD_PAGE_EQUIPMENT2);
      dlg.addPage(pPage2, "Glass");
      dlg.addPage(pPage2, "Slots");
      if (pEquipment->getID() == EQ_ID_EFEM) {
         CEquipmentPage3* pPage3 = new CEquipmentPage3();
@@ -153,7 +157,9 @@
      }
      if (pEquipment->getID() == EQ_ID_LOADPORT1
         || pEquipment->getID() == EQ_ID_LOADPORT2) {
         || pEquipment->getID() == EQ_ID_LOADPORT2
         || pEquipment->getID() == EQ_ID_LOADPORT3
         || pEquipment->getID() == EQ_ID_LOADPORT4) {
         CPageCassetteCtrlCmd* pPage = new CPageCassetteCtrlCmd();
         pPage->setEquipment(pEquipment);
         pPage->Create(IDD_PAGE_CASSETTE_CTRL_CMD);
@@ -204,82 +210,17 @@
      // 测试
      else if (nCmd == ID_EQSGRAPHITEM_TEST1) {
         SERVO::CEquipment* pEquipment = (SERVO::CEquipment*)pItem->pData;
         if (pEquipment->getID() == EQ_ID_LOADPORT1) {
            ((SERVO::CLoadPort*)pEquipment)->testGenerateGlassList(SERVO::MaterialsType::G1, 10,
               "P20250320G1X", 1);
         }
         else if (pEquipment->getID() == EQ_ID_LOADPORT2) {
            ((SERVO::CLoadPort*)pEquipment)->testGenerateGlassList(SERVO::MaterialsType::G2, 10,
               "P20250320G2X", 1);
         }
         SERVO::CGlass* pGlass = pEquipment->getFrontGlass();
         if (pGlass != nullptr) {
            SERVO::CJobDataB* pJobDataB = pGlass->getJobDataB();
            SERVO::CJobDataS* pJobDataS = pGlass->getJobDataS();
            if (pJobDataB != nullptr && pJobDataS != nullptr) {
               pEquipment->fetchedOutJob(pJobDataB);
               pEquipment->onSentOutJob(0, pJobDataS);
            }
         }
      }
      else if (nCmd == ID_EQSGRAPHITEM_TEST2) {
         SERVO::CEquipment* pEquipment = (SERVO::CEquipment*)pItem->pData;
         SERVO::CArm* pArm = (SERVO::CArm*)pEquipment->getArm();
         if (pArm != nullptr) {
            SERVO::CGlass* pGlass = pArm->getFrontGlass();
            if (pGlass != nullptr) {
               SERVO::CJobDataB* pJobDataB = pGlass->getJobDataB();
               SERVO::CJobDataS* pJobDataS = pGlass->getJobDataS();
               if (pJobDataB != nullptr && pJobDataS != nullptr) {
                  pEquipment->onReceivedJob(0, pJobDataS);
                  Sleep(600);
                  pEquipment->onStoredJob(0, pJobDataB);
               }
            }
         }
      }
      else if (nCmd == ID_EQSGRAPHITEM_TEST3) {
         SERVO::CEquipment* pEquipment = (SERVO::CEquipment*)pItem->pData;
         if (pEquipment != nullptr) {
            SERVO::CGlass* pGlass = pEquipment->getFrontGlass();
            if (pGlass != nullptr) {
               SERVO::CProcessData pd;
               pd.setGlassId(pGlass->getID().c_str());
               pEquipment->onProcessData(&pd);
            }
         }
      }
      else if (nCmd == ID_EQSGRAPHITEM_TEST4) {
      }
      else if (nCmd == ID_EQSGRAPHITEM_TEST5) {
      }
      else if (nCmd == ID_EQSGRAPHITEM_TEST6) {
         SERVO::CEquipment* pEquipment = (SERVO::CEquipment*)pItem->pData;
         /* 测试 RobotCMD */
         if (pEquipment->getID() == EQ_ID_EFEM) {
            SERVO::CEFEM* pEFEM = (SERVO::CEFEM*)pEquipment;
            SERVO::ROBOT_CMD_PARAM cmds[4];
            cmds[0].sequenceNo = 1;
            cmds[0].rcmd = (short)SERVO::RCMD::Move;
            cmds[0].armNo = 1;
            cmds[0].getPosition = 1;
            cmds[0].putPosition = 2;
            cmds[0].getSlotNo = 3;
            cmds[0].putSlotNo = 4;
            cmds[0].subCmd = 5;
            cmds[1].sequenceNo = 2;
            cmds[1].rcmd = (short)SERVO::RCMD::Transfer;
            cmds[1].armNo = 2;
            cmds[1].getPosition = 6;
            cmds[1].putPosition = 7;
            cmds[1].getSlotNo = 8;
            cmds[1].putSlotNo = 9;
            cmds[1].subCmd = 10;
            pEFEM->robotCmds(cmds, 2);
         }
         // 测试下发Cim Message
@@ -313,8 +254,7 @@
         // 测试设置时间
         /*
         if (pEquipment->getID() == EQ_ID_Bonder1
            || pEquipment->getID() == EQ_ID_Bonder2) {
         if (pEquipment->getID() == EQ_ID_EFEM) {
            CTime time = CTime::GetCurrentTime();
            pEquipment->setDateTime((short)time.GetYear(),
               (short)time.GetMonth(),
@@ -324,7 +264,6 @@
               (short)time.GetSecond());
         }
         */
         
         // 测试设置cim mode
         /*
@@ -335,32 +274,18 @@
         }
         */
         
         /*
         if (pEquipment->getID() == EQ_ID_Bonder1
            || pEquipment->getID() == EQ_ID_Bonder2) {
            static int ii = 0; ii++;
            pEquipment->setEqMode((ii % 5) + 1);
         }
         /*
         SERVO::CGlass* pGlass = pEquipment->getFrontGlass();
         if (pGlass != nullptr) {
            std::string strDescription;
            SERVO::CPath* pPath = pGlass->getPath();
            while (pPath != nullptr) {
               pPath->getDescription(strDescription);
               AfxMessageBox(strDescription.c_str());
               pPath = pPath->getNext();
            }
         }
         */
         // 请求主配方列表
         if (pEquipment != nullptr) {
            pEquipment->masterRecipeListRequest(0);
         }
         static int i = 0;
         i++;
         static char* pszText[] = {"123", "456", "789", "abc", "def"};
         theApp.m_model.m_hsmsPassive.requestAlarmReport(i%3, i, pszText[i%5]);
      }
@@ -378,6 +303,12 @@
   m_pEqsGraphWnd->SetBkgndColor(m_crBkgnd);
   m_pEqsGraphWnd->SetOnListener(listener);
   CString strIniFile, strItem;
   strIniFile.Format(_T("%s\\configuration.ini"), (LPTSTR)(LPCTSTR)theApp.m_strAppDir);
   int nIndicatorSize = GetPrivateProfileInt("PageGraph2", _T("IndicatorSize"), 10, strIniFile);
   int nIndicatorMargin = GetPrivateProfileInt("PageGraph2", _T("IndicatorMargin"), 0, strIniFile);
   m_pEqsGraphWnd->SetIndicatorSize(nIndicatorSize);
   m_pEqsGraphWnd->SetIndicatorMargin(nIndicatorMargin);
   return TRUE;  // return TRUE unless you set the focus to a control
              // 异常: OCX 属性页应返回 FALSE
@@ -450,7 +381,20 @@
      m_pEqsGraphWnd->AddPin(pItem, OUTPIN, outPin->getName().c_str(), (DWORD_PTR)outPin);
   }
   m_pEqsGraphWnd->ShowItemIndicator((DWORD_PTR)pEquipment, !pEquipment->isGlassListEmpty());
   UpdateItemIndicators(pEquipment);
}
void CPageGraph2::UpdateItemIndicators(SERVO::CEquipment* pEquipment)
{
   for (int i = 0; i < SLOT_MAX; i++) {
      auto pSlot = pEquipment->getSlot(i);
      int state = 0;
      if (pSlot->isEnable()) {
         state = pSlot->getContext() != nullptr ? 1 : 2;
      }
      m_pEqsGraphWnd->ShowItemIndicator((DWORD_PTR)pEquipment, state, i);
   }
}
void CPageGraph2::OnTimer(UINT_PTR nIDEvent)