| | |
| | | |
| | | |
| | | namespace SERVO { |
| | | /// 数据项:时间戳 + 数值 |
| | | struct SVDataItem { |
| | | std::chrono::system_clock::time_point timestamp; |
| | | double value; // 或者根据实际情况使用其他类型 |
| | | |
| | | SVDataItem(std::chrono::system_clock::time_point ts, double val) |
| | | : timestamp(ts), value(val) {} |
| | | }; |
| | | |
| | | /// PJ 生命周期(贴近 E40 常见状态) |
| | | enum class GlsState : uint8_t { |
| | | NoState = 0, |
| | |
| | | void addParams(std::vector<CParam>& params); |
| | | std::vector<CParam>& getParams(); |
| | | |
| | | // ========== SV数据管理接口(新设计)========== |
| | | |
| | | // 添加数据到指定机器的指定数据类型 |
| | | void addSVData(int machineId, const std::string& dataType, const SVDataItem& dataItem); |
| | | void addSVData(int machineId, const std::string& dataType, double value); // 自动使用当前时间 |
| | | void addSVData(int machineId, const std::string& dataType, int64_t timestamp, double value); |
| | | |
| | | // 批量添加数据到指定机器的指定数据类型 |
| | | void addSVData(int machineId, const std::string& dataType, const std::vector<SVDataItem>& dataItems); |
| | | |
| | | // 获取指定机器的指定数据类型的所有数据 |
| | | std::vector<SVDataItem> getSVData(int machineId, const std::string& dataType) const; |
| | | |
| | | // 获取指定机器的所有数据类型 |
| | | std::vector<std::string> getSVDataTypes(int machineId) const; |
| | | |
| | | // 获取指定机器的所有数据(按数据类型组织) |
| | | std::unordered_map<std::string, std::vector<SVDataItem>> getMachineSVData(int machineId) const; |
| | | |
| | | // 获取所有机器的数据 |
| | | const std::unordered_map<int, std::unordered_map<std::string, std::vector<SVDataItem>>>& getAllSVData() const; |
| | | |
| | | // 检查指定机器是否有指定类型的数据 |
| | | bool hasSVData(int machineId, const std::string& dataType) const; |
| | | |
| | | // 检查指定机器是否有任何数据 |
| | | bool hasMachineSVData(int machineId) const; |
| | | |
| | | // 获取所有有SV数据的机器ID |
| | | std::vector<int> getMachineIdsWithSVData() const; |
| | | |
| | | // 清空指定机器的指定数据类型的数据 |
| | | void clearSVData(int machineId, const std::string& dataType); |
| | | |
| | | // 清空指定机器的所有数据 |
| | | void clearMachineSVData(int machineId); |
| | | |
| | | // 清空所有机器的所有数据 |
| | | void clearAllSVData(); |
| | | |
| | | // 获取指定机器的指定数据类型的数据数量 |
| | | size_t getSVDataCount(int machineId, const std::string& dataType) const; |
| | | |
| | | // 获取指定机器的总数据数量 |
| | | size_t getMachineSVDataCount(int machineId) const; |
| | | |
| | | // 获取所有机器的总数据数量 |
| | | size_t getTotalSVDataCount() const; |
| | | |
| | | // 获取指定数据类型在所有机器中的数据 |
| | | std::vector<std::pair<int, SVDataItem>> findSVDataByType(const std::string& dataType) const; |
| | | |
| | | private: |
| | | MaterialsType m_type; |
| | | std::string m_strID; |
| | |
| | | BOOL m_bScheduledForProcessing; /* 是否将加工处理 */ |
| | | CProcessJob* m_pProcessJob; |
| | | std::vector<CParam> m_params; // 工艺参数 |
| | | |
| | | // 新的三层数据结构:机器ID -> 数据类型 -> 数据列表 |
| | | std::unordered_map<int, std::unordered_map<std::string, std::vector<SVDataItem>>> m_svDatas; |
| | | }; |
| | | } |
| | | |