LAPTOP-SNT8I5JK\Boounion
2025-10-13 047c7cbd047e11fba8d7872e69a11a13e463aec4
SourceCode/Bond/Servo/CMaster.cpp
@@ -9,6 +9,32 @@
namespace SERVO {
   static std::unordered_map<int, std::vector<std::string>> MACHINE_DATA_TYPES = {
   {EQ_ID_Bonder1, {
      "气囊压力", "上腔压力", "管道真空规值", "腔体真空规值",
      "上腔温度1", "上腔温度2", "上腔温度3", "上腔温度4",
      "上腔温度5", "上腔温度6", "下腔温度1", "下腔温度2",
      "下腔温度3", "下腔温度4", "下腔温度5", "下腔温度6"
   }},
   {EQ_ID_Bonder2, {
      "气囊压力", "上腔压力", "管道真空规值", "腔体真空规值",
      "上腔温度1", "上腔温度2", "上腔温度3", "上腔温度4",
      "上腔温度5", "上腔温度6", "下腔温度1", "下腔温度2",
      "下腔温度3", "下腔温度4", "下腔温度5", "下腔温度6"
   }},
   {EQ_ID_VACUUMBAKE, {
      "A腔真空规值", "A腔温控1", "A腔温控2", "A腔温控4",
      "A腔温控5", "A腔温控6", "A腔温控7", "B腔真空规值",
      "B腔温控1", "B腔温控2", "B腔温控4", "B腔温控5",
      "B腔温控6", "B腔温控7"
   }},
   {EQ_ID_BAKE_COOLING, {
      "A烘烤温控1", "A烘烤温控2", "A烘烤温控4", "A烘烤温控5",
      "A烘烤温控6", "A烘烤温控7", "B烘烤温控1", "B烘烤温控2",
      "B烘烤温控4", "B烘烤温控5", "B烘烤温控6", "B烘烤温控7"
   }}
   };
   static inline int64_t now_ms_epoch() {
      using namespace std::chrono;
      return duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count();
@@ -1624,55 +1650,72 @@
      
         // 以下加入到曲线数据中
         const int64_t ts = now_ms_epoch();
         int eqid = ((CEquipment*)pEquipment)->getID();
         if (eqid == EQ_ID_Bonder1 || eqid == EQ_ID_Bonder2) {
            m_pCollector->buffersPush(eqid, 1, ts, params.at(1).getDoubleValue());
            m_pCollector->buffersPush(eqid, 2, ts, params.at(2).getDoubleValue());
            m_pCollector->buffersPush(eqid, 3, ts, params.at(3).getDoubleValue());
            m_pCollector->buffersPush(eqid, 4, ts, params.at(4).getDoubleValue());
            m_pCollector->buffersPush(eqid, 5, ts, params.at(5).getDoubleValue());
            m_pCollector->buffersPush(eqid, 6, ts, params.at(6).getDoubleValue());
            m_pCollector->buffersPush(eqid, 7, ts, params.at(7).getDoubleValue());
            m_pCollector->buffersPush(eqid, 8, ts, params.at(8).getDoubleValue());
            m_pCollector->buffersPush(eqid, 9, ts, params.at(9).getDoubleValue());
            m_pCollector->buffersPush(eqid, 10, ts, params.at(10).getDoubleValue());
            m_pCollector->buffersPush(eqid, 11, ts, params.at(11).getDoubleValue());
            m_pCollector->buffersPush(eqid, 12, ts, params.at(12).getDoubleValue());
            m_pCollector->buffersPush(eqid, 13, ts, params.at(13).getDoubleValue());
            m_pCollector->buffersPush(eqid, 14, ts, params.at(14).getDoubleValue());
            m_pCollector->buffersPush(eqid, 15, ts, params.at(15).getDoubleValue());
            m_pCollector->buffersPush(eqid, 16, ts, params.at(16).getDoubleValue());
            // 定义 Bonder 的特定映射
            std::vector<std::pair<int, int>> bonderMapping = {
               {1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}, {7, 7},
               {8, 8}, {9, 9}, {10, 10}, {11, 11}, {12, 12}, {13, 13}, {14, 14}, {15, 15}, {16, 16}
            };
            CGlass* pGlass = ((CEquipment*)pEquipment)->getGlassFromSlot(0);
            auto& bonderTypes = MACHINE_DATA_TYPES[eqid];
            for (const auto& mapping : bonderMapping) {
               int paramIndex = mapping.first;
               int channel = mapping.second;
               if (paramIndex < params.size() && channel - 1 < bonderTypes.size()) {
                  if(m_pCollector != nullptr)
                     m_pCollector->buffersPush(eqid, channel, ts, params.at(paramIndex).getDoubleValue());
                  if(pGlass != nullptr)
                     pGlass->addSVData(eqid, bonderTypes[channel], ts, params.at(paramIndex).getDoubleValue());
               }
            }
         }
         else if (eqid == EQ_ID_VACUUMBAKE) {
            m_pCollector->buffersPush(eqid, 1, ts, params.at(1).getDoubleValue());
            m_pCollector->buffersPush(eqid, 2, ts, params.at(2).getDoubleValue());
            m_pCollector->buffersPush(eqid, 3, ts, params.at(3).getDoubleValue());
            m_pCollector->buffersPush(eqid, 4, ts, params.at(4).getDoubleValue());
            m_pCollector->buffersPush(eqid, 5, ts, params.at(5).getDoubleValue());
            m_pCollector->buffersPush(eqid, 6, ts, params.at(6).getDoubleValue());
            m_pCollector->buffersPush(eqid, 7, ts, params.at(7).getDoubleValue());
            m_pCollector->buffersPush(eqid, 8, ts, params.at(10).getDoubleValue());
            m_pCollector->buffersPush(eqid, 9, ts, params.at(11).getDoubleValue());
            m_pCollector->buffersPush(eqid, 10, ts, params.at(12).getDoubleValue());
            m_pCollector->buffersPush(eqid, 11, ts, params.at(13).getDoubleValue());
            m_pCollector->buffersPush(eqid, 12, ts, params.at(14).getDoubleValue());
            m_pCollector->buffersPush(eqid, 13, ts, params.at(15).getDoubleValue());
            m_pCollector->buffersPush(eqid, 14, ts, params.at(16).getDoubleValue());
            // 定义 VACUUMBAKE 的特定映射
            std::vector<std::pair<int, int>> vacuumMapping = {
               {1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}, {7, 7},
               {10, 8}, {11, 9}, {12, 10}, {13, 11}, {14, 12}, {15, 13}, {16, 14}
            };
            CGlass* pGlass = ((CEquipment*)pEquipment)->getGlassFromSlot(0);
            auto& bonderTypes = MACHINE_DATA_TYPES[eqid];
            for (const auto& mapping : vacuumMapping) {
               int paramIndex = mapping.first;
               int channel = mapping.second;
               if (paramIndex < params.size() && channel - 1 < bonderTypes.size()) {
                  if (m_pCollector != nullptr)
                     m_pCollector->buffersPush(eqid, channel, ts, params.at(paramIndex).getDoubleValue());
                  if (pGlass != nullptr)
                     pGlass->addSVData(eqid, bonderTypes[channel], ts, params.at(paramIndex).getDoubleValue());
               }
            }
         }
         else if (eqid == EQ_ID_BAKE_COOLING) {
            m_pCollector->buffersPush(eqid, 1, ts, params.at(1).getDoubleValue());
            m_pCollector->buffersPush(eqid, 2, ts, params.at(2).getDoubleValue());
            m_pCollector->buffersPush(eqid, 3, ts, params.at(3).getDoubleValue());
            m_pCollector->buffersPush(eqid, 4, ts, params.at(4).getDoubleValue());
            m_pCollector->buffersPush(eqid, 5, ts, params.at(5).getDoubleValue());
            m_pCollector->buffersPush(eqid, 6, ts, params.at(6).getDoubleValue());
            m_pCollector->buffersPush(eqid, 7, ts, params.at(11).getDoubleValue());
            m_pCollector->buffersPush(eqid, 8, ts, params.at(12).getDoubleValue());
            m_pCollector->buffersPush(eqid, 9, ts, params.at(13).getDoubleValue());
            m_pCollector->buffersPush(eqid, 10, ts, params.at(14).getDoubleValue());
            m_pCollector->buffersPush(eqid, 11, ts, params.at(15).getDoubleValue());
            m_pCollector->buffersPush(eqid, 12, ts, params.at(16).getDoubleValue());
            // 定义 BAKE_COOLING 的特定映射
            std::vector<std::pair<int, int>> coolingMapping = {
               {1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6},
               {11, 7}, {12, 8}, {13, 9}, {14, 10}, {15, 11}, {16, 12}
            };
            CGlass* pGlass = ((CEquipment*)pEquipment)->getGlassFromSlot(0);
            auto& coolingTypes = MACHINE_DATA_TYPES[eqid];
            for (const auto& mapping : coolingMapping) {
               int paramIndex = mapping.first;
               int channel = mapping.second;
               if (paramIndex < params.size() && channel - 1 < coolingTypes.size()) {
                  if (m_pCollector != nullptr)
                     m_pCollector->buffersPush(eqid, channel, ts, params.at(paramIndex).getDoubleValue());
                  if (pGlass != nullptr)
                     pGlass->addSVData(eqid, coolingTypes[channel], ts, params.at(paramIndex).getDoubleValue());
               }
            }
         }
@@ -3118,67 +3161,21 @@
         // 2) 为通道设置“曲线名称”
         m_pCollector->buffersSetChannelName(EQ_ID_Bonder1, 1, "气囊压力");
         m_pCollector->buffersSetChannelName(EQ_ID_Bonder1, 2, "上腔压力");
         m_pCollector->buffersSetChannelName(EQ_ID_Bonder1, 3, "管道真空规值");
         m_pCollector->buffersSetChannelName(EQ_ID_Bonder1, 4, "腔体真空规值");
         m_pCollector->buffersSetChannelName(EQ_ID_Bonder1, 5, "上腔温度1");
         m_pCollector->buffersSetChannelName(EQ_ID_Bonder1, 6, "上腔温度2");
         m_pCollector->buffersSetChannelName(EQ_ID_Bonder1, 7, "上腔温度3");
         m_pCollector->buffersSetChannelName(EQ_ID_Bonder1, 8, "上腔温度4");
         m_pCollector->buffersSetChannelName(EQ_ID_Bonder1, 9, "上腔温度5");
         m_pCollector->buffersSetChannelName(EQ_ID_Bonder1, 10, "上腔温度6");
         m_pCollector->buffersSetChannelName(EQ_ID_Bonder1, 11, "下腔温度1");
         m_pCollector->buffersSetChannelName(EQ_ID_Bonder1, 12, "下腔温度2");
         m_pCollector->buffersSetChannelName(EQ_ID_Bonder1, 13, "下腔温度3");
         m_pCollector->buffersSetChannelName(EQ_ID_Bonder1, 14, "下腔温度4");
         m_pCollector->buffersSetChannelName(EQ_ID_Bonder1, 15, "下腔温度5");
         m_pCollector->buffersSetChannelName(EQ_ID_Bonder1, 16, "下腔温度6");
         auto& bonderTypes = MACHINE_DATA_TYPES[EQ_ID_Bonder1];
         for (size_t i = 0; i < bonderTypes.size(); ++i) {
            m_pCollector->buffersSetChannelName(EQ_ID_Bonder1, i + 1, bonderTypes[i].c_str());
            m_pCollector->buffersSetChannelName(EQ_ID_Bonder2, i + 1, bonderTypes[i].c_str());
         }
         m_pCollector->buffersSetChannelName(EQ_ID_Bonder2, 1, "气囊压力");
         m_pCollector->buffersSetChannelName(EQ_ID_Bonder2, 2, "上腔压力");
         m_pCollector->buffersSetChannelName(EQ_ID_Bonder2, 3, "管道真空规值");
         m_pCollector->buffersSetChannelName(EQ_ID_Bonder2, 4, "腔体真空规值");
         m_pCollector->buffersSetChannelName(EQ_ID_Bonder2, 5, "上腔温度1");
         m_pCollector->buffersSetChannelName(EQ_ID_Bonder2, 6, "上腔温度2");
         m_pCollector->buffersSetChannelName(EQ_ID_Bonder2, 7, "上腔温度3");
         m_pCollector->buffersSetChannelName(EQ_ID_Bonder2, 8, "上腔温度4");
         m_pCollector->buffersSetChannelName(EQ_ID_Bonder2, 9, "上腔温度5");
         m_pCollector->buffersSetChannelName(EQ_ID_Bonder2, 10, "上腔温度6");
         m_pCollector->buffersSetChannelName(EQ_ID_Bonder2, 11, "下腔温度1");
         m_pCollector->buffersSetChannelName(EQ_ID_Bonder2, 12, "下腔温度2");
         m_pCollector->buffersSetChannelName(EQ_ID_Bonder2, 13, "下腔温度3");
         m_pCollector->buffersSetChannelName(EQ_ID_Bonder2, 14, "下腔温度4");
         m_pCollector->buffersSetChannelName(EQ_ID_Bonder2, 15, "下腔温度5");
         m_pCollector->buffersSetChannelName(EQ_ID_Bonder2, 16, "下腔温度6");
         auto& vacuumbakeTypes = MACHINE_DATA_TYPES[EQ_ID_VACUUMBAKE];
         for (size_t i = 0; i < bonderTypes.size(); ++i) {
            m_pCollector->buffersSetChannelName(EQ_ID_VACUUMBAKE, i + 1, vacuumbakeTypes[i].c_str());
         }
         m_pCollector->buffersSetChannelName(EQ_ID_VACUUMBAKE, 1, "A腔真空规值");
         m_pCollector->buffersSetChannelName(EQ_ID_VACUUMBAKE, 2, "A腔温控1");
         m_pCollector->buffersSetChannelName(EQ_ID_VACUUMBAKE, 3, "A腔温控2");
         m_pCollector->buffersSetChannelName(EQ_ID_VACUUMBAKE, 4, "A腔温控4");
         m_pCollector->buffersSetChannelName(EQ_ID_VACUUMBAKE, 5, "A腔温控5");
         m_pCollector->buffersSetChannelName(EQ_ID_VACUUMBAKE, 6, "A腔温控6");
         m_pCollector->buffersSetChannelName(EQ_ID_VACUUMBAKE, 7, "A腔温控7");
         m_pCollector->buffersSetChannelName(EQ_ID_VACUUMBAKE, 8, "B腔真空规值");
         m_pCollector->buffersSetChannelName(EQ_ID_VACUUMBAKE, 9, "B腔温控1");
         m_pCollector->buffersSetChannelName(EQ_ID_VACUUMBAKE, 10, "B腔温控2");
         m_pCollector->buffersSetChannelName(EQ_ID_VACUUMBAKE, 11, "B腔温控4");
         m_pCollector->buffersSetChannelName(EQ_ID_VACUUMBAKE, 12, "B腔温控5");
         m_pCollector->buffersSetChannelName(EQ_ID_VACUUMBAKE, 13, "B腔温控6");
         m_pCollector->buffersSetChannelName(EQ_ID_VACUUMBAKE, 14, "B腔温控7");
         m_pCollector->buffersSetChannelName(EQ_ID_BAKE_COOLING, 1, "A烘烤温控1");
         m_pCollector->buffersSetChannelName(EQ_ID_BAKE_COOLING, 2, "A烘烤温控2");
         m_pCollector->buffersSetChannelName(EQ_ID_BAKE_COOLING, 3, "A烘烤温控4");
         m_pCollector->buffersSetChannelName(EQ_ID_BAKE_COOLING, 4, "A烘烤温控5");
         m_pCollector->buffersSetChannelName(EQ_ID_BAKE_COOLING, 5, "A烘烤温控6");
         m_pCollector->buffersSetChannelName(EQ_ID_BAKE_COOLING, 6, "A烘烤温控7");
         m_pCollector->buffersSetChannelName(EQ_ID_BAKE_COOLING, 7, "B烘烤温控1");
         m_pCollector->buffersSetChannelName(EQ_ID_BAKE_COOLING, 8, "B烘烤温控2");
         m_pCollector->buffersSetChannelName(EQ_ID_BAKE_COOLING, 9, "B烘烤温控4");
         m_pCollector->buffersSetChannelName(EQ_ID_BAKE_COOLING, 10, "B烘烤温控5");
         m_pCollector->buffersSetChannelName(EQ_ID_BAKE_COOLING, 11, "B烘烤温控6");
         m_pCollector->buffersSetChannelName(EQ_ID_BAKE_COOLING, 12, "B烘烤温控7");
         auto& coolingTypes = MACHINE_DATA_TYPES[EQ_ID_BAKE_COOLING];
         for (size_t i = 0; i < bonderTypes.size(); ++i) {
            m_pCollector->buffersSetChannelName(EQ_ID_VACUUMBAKE, i + 1, coolingTypes[i].c_str());
         }
      }
   }
}