chenluhua1980
2025-11-11 abeaf384ca65153fa9c66f8953cd0f68ad5f9f9f
SourceCode/Bond/Servo/CServoUtilsTool.cpp
@@ -1,9 +1,40 @@
#include "stdafx.h"
#include "stdafx.h"
#include "CServoUtilsTool.h"
#include "Common.h"
namespace SERVO {
   static std::unordered_map<int, std::vector<std::string>> EQ_DATA_TYPES = {
      {MID_Bonder1, {
         "气囊压力", "上腔压力", "管道真空规值", "腔体真空规值",
         "上腔温度1", "上腔温度2", "上腔温度3", "上腔温度4",
         "上腔温度5", "上腔温度6", "下腔温度1", "下腔温度2",
         "下腔温度3", "下腔温度4", "下腔温度5", "下腔温度6"
      }},
      {MID_Bonder2, {
         "气囊压力", "上腔压力", "管道真空规值", "腔体真空规值",
         "上腔温度1", "上腔温度2", "上腔温度3", "上腔温度4",
         "上腔温度5", "上腔温度6", "下腔温度1", "下腔温度2",
         "下腔温度3", "下腔温度4", "下腔温度5", "下腔温度6"
      }},
      {MID_VacuumBakeA, {
         "真空规值", "温控1", "温控2", "温控4",
         "温控5", "温控6", "温控7"
      }},
      {MID_VacuumBakeB, {
         "真空规值", "温控1", "温控2", "温控4",
         "温控5", "温控6", "温控7"
      }},
      {MID_BakeCoolingA, {
         "烘烤温控1", "烘烤温控2", "烘烤温控4", "烘烤温控5",
         "烘烤温控6", "烘烤温控7"
      }},
      {MID_BakeCoolingB, {
         "烘烤温控1", "烘烤温控2", "烘烤温控4", "烘烤温控5",
         "烘烤温控6", "烘烤温控7"
      }}
   };
   CServoUtilsTool::CServoUtilsTool()
   {
@@ -14,33 +45,52 @@
   }
   std::string CServoUtilsTool::getEqName(int eqid)
   {
      switch (eqid)
      {
      case EQ_ID_LOADPORT1:
         return "Port1";
      case EQ_ID_LOADPORT2:
         return "Port2";
      case EQ_ID_LOADPORT3:
         return "Port3";
      case EQ_ID_LOADPORT4:
         return "Port4";
      case EQ_ID_ALIGNER:
         return "Aligner";
      case EQ_ID_FLIPER:
         return "Fliper";
      case EQ_ID_VACUUMBAKE:
         return "VacuumBake";
      case EQ_ID_Bonder1:
         return "Bonder1";
      case EQ_ID_Bonder2:
         return "Bonder2";
      case EQ_ID_BAKE_COOLING:
         return "BakeCooling";
      case EQ_ID_MEASUREMENT:
         return "AOI";
      case EQ_ID_ARM_TRAY1:
         return "ArmTray1";
      case EQ_ID_ARM_TRAY2:
         return "ArmTray2";
      default:
         break;
      }
      return "";
   }
   std::string CServoUtilsTool::getEqUnitName(int eqid, int unit)
   {
      /*
#define EQ_ID_LOADPORT1         1
#define EQ_ID_LOADPORT2         2
#define EQ_ID_LOADPORT3         3
#define EQ_ID_LOADPORT4         4
#define EQ_ID_ARM_TRAY1         5
#define EQ_ID_ARM_TRAY2         6
#define EQ_ID_ALIGNER         7
#define EQ_ID_FLIPER         8
#define EQ_ID_VACUUMBAKE      9
#define EQ_ID_Bonder1         10
#define EQ_ID_Bonder2         11
#define EQ_ID_BAKE_COOLING      12
#define EQ_ID_MEASUREMENT      13
#define EQ_ID_EFEM            100
#define EQ_ID_ARM            101
#define EQ_ID_OPERATOR_REMOVE   102
*/
      char szBuffer[256];
      if (eqid == EQ_ID_LOADPORT1
         || eqid == EQ_ID_LOADPORT2
         || eqid == EQ_ID_LOADPORT3
         || eqid == EQ_ID_LOADPORT4
         ) {
         sprintf_s(szBuffer, 256, "Port%d(Slot%d)", unit, eqid - EQ_ID_LOADPORT1 + 1);
         sprintf_s(szBuffer, 256, "Port%d(Slot%d)", eqid - EQ_ID_LOADPORT1 + 1, unit + 1);
         return std::string(szBuffer);
      }
@@ -53,13 +103,8 @@
      }
      if (eqid == EQ_ID_VACUUMBAKE) {
         if (unit == 0) return "烘烤A腔";
         if (unit == 1) return "烘烤B腔";
      }
      if (eqid == EQ_ID_VACUUMBAKE) {
         if (unit == 0) return "烘烤A腔";
         if (unit == 1) return "烘烤B腔";
         if (unit == 0) return "烘烤A腔";
         if (unit == 1) return "烘烤B腔";
      }
      if (eqid == EQ_ID_Bonder1) {
@@ -72,16 +117,158 @@
      if (eqid == EQ_ID_BAKE_COOLING) {
         if (unit == 0) return "后烘烤A腔";
         if (unit == 1) return "冷却A";
         if (unit == 0) return "后烘烤B腔";
         if (unit == 1) return "冷却B";
         if (unit == 0) return "后烘烤A腔";
         if (unit == 1) return "冷却A";
         if (unit == 2) return "后烘烤B腔";
         if (unit == 3) return "冷却B";
      }
      if (eqid == EQ_ID_MEASUREMENT) {
         return "AOI";
      }
      if (eqid == EQ_ID_ARM_TRAY1) {
         return "ARM1";
      }
      if (eqid == EQ_ID_ARM_TRAY2) {
         return "ARM2";
      }
      return "";
   }
   std::string CServoUtilsTool::getEqUnitName(int eqid, int unit, int slot)
   {
      char szBuffer[256];
      if (eqid == EQ_ID_LOADPORT1
         || eqid == EQ_ID_LOADPORT2
         || eqid == EQ_ID_LOADPORT3
         || eqid == EQ_ID_LOADPORT4
         ) {
         sprintf_s(szBuffer, 256, "Port%d(Slot%d)", eqid - EQ_ID_LOADPORT1 + 1, slot);
         return std::string(szBuffer);
      }
      if (eqid == EQ_ID_ALIGNER) {
         return "Aligner";
      }
      if (eqid == EQ_ID_FLIPER) {
         return "Fliper";
      }
      if (eqid == EQ_ID_VACUUMBAKE) {
         if (unit == 0) {
            sprintf_s(szBuffer, 256, "烘烤A腔(Slot%d)", slot);
            return std::string(szBuffer);
         }
         if (unit == 1) {
            sprintf_s(szBuffer, 256, "烘烤B腔(Slot%d)", slot);
            return std::string(szBuffer);
         }
      }
      if (eqid == EQ_ID_Bonder1) {
         sprintf_s(szBuffer, 256, "Bonder1(Slot%d)", slot);
         return std::string(szBuffer);
      }
      if (eqid == EQ_ID_Bonder2) {
         sprintf_s(szBuffer, 256, "Bonder2(Slot%d)", slot);
         return std::string(szBuffer);
      }
      if (eqid == EQ_ID_BAKE_COOLING) {
         if (slot == 0) return "后烘烤A腔";
         if (slot == 1) return "冷却A";
         if (slot == 2) return "后烘烤B腔";
         if (slot == 3) return "冷却B";
      }
      if (eqid == EQ_ID_MEASUREMENT) {
         return "AOI";
      }
      if (eqid == EQ_ID_ARM_TRAY1) {
         return "ARM1";
      }
      if (eqid == EQ_ID_ARM_TRAY2) {
         return "ARM2";
      }
      return "";
   }
   std::string CServoUtilsTool::getMaterialsTypeText(MaterialsType type)
   {
      if (type == MaterialsType::G1) {
         return "G1";
      }
      if (type == MaterialsType::G2) {
         return "G2";
      }
      return "";
   }
   std::string CServoUtilsTool::getGlassStateText(SERVO::GlsState state)
   {
      switch (state)
      {
      case SERVO::GlsState::NoState:
         return "NoState";
         break;
      case SERVO::GlsState::Queued:
         return "Queued";
         break;
      case SERVO::GlsState::InProcess:
         return "InProcess";
         break;
      case SERVO::GlsState::Paused:
         return "Paused";
         break;
      case SERVO::GlsState::Completed:
         return "Completed";
         break;
      case SERVO::GlsState::Aborted:
         return "Aborted";
         break;
      case SERVO::GlsState::Failed:
         return "Failed";
         break;
      default:
         return "";
         break;
      }
   }
   std::string CServoUtilsTool::getInspResultText(SERVO::InspResult result)
   {
      switch (result)
      {
      case SERVO::InspResult::NotInspected:
         return "";
         break;
      case SERVO::InspResult::Pass:
         return "Pass";
         break;
      case SERVO::InspResult::Fail:
         return "Fail";
         break;
      default:
         return "";
         break;
      }
   }
   std::unordered_map<int, std::vector<std::string>>& CServoUtilsTool::getEqDataTypes()
   {
      return EQ_DATA_TYPES;
   }
}