| | |
| | | #include "CJobDataB.h" |
| | | #include "CJobDataC.h" |
| | | #include "CJobDataS.h" |
| | | #include "ServoCommo.h" |
| | | #include "ProcessJob.h" |
| | | #include "CParam.h" |
| | | |
| | | |
| | | namespace SERVO { |
| | | enum MaterialsType { |
| | | G1 = 0, |
| | | G2 = 1, |
| | | G1G2 = 2 |
| | | /// PJ 生命周期(贴近 E40 常见状态) |
| | | enum class GlsState : uint8_t { |
| | | NoState = 0, |
| | | Queued, |
| | | InProcess, |
| | | Paused, |
| | | Completed, |
| | | Aborted, |
| | | Failed |
| | | }; |
| | | |
| | | class CGlass : public CContext |
| | |
| | | public: |
| | | virtual std::string& getClassName(); |
| | | virtual std::string toString(); |
| | | MaterialsType getType(); |
| | | short getCassetteSequenceNo() const { return m_jobDataS.getCassetteSequenceNo(); } |
| | | short getJobSequenceNo() const { return m_jobDataS.getJobSequenceNo(); } |
| | | MaterialsType getType() const; |
| | | void setType(MaterialsType type); |
| | | void setID(const char* pszID); |
| | | std::string& getID(); |
| | | CPath* getPathWithSiteID(unsigned int nSiteId); |
| | | const std::string& getID() const; |
| | | void setOriginPort(int port, int slot); |
| | | void getOrginPort(int& port, int& slot); |
| | | BOOL isScheduledForProcessing(); |
| | | void setScheduledForProcessing(BOOL bProcessing); |
| | | CProcessJob* getProcessJob(); |
| | | void setProcessJob(CProcessJob* pProcessJob); |
| | | CPath* getPathWithEq(unsigned int nEqId, unsigned int nUnit) const; |
| | | CPath* getPath(); |
| | | void addPath(unsigned int nSiteId); |
| | | void addPath(unsigned int nEqId, unsigned int nUnit, unsigned int slot); |
| | | std::string getPathDescription() const; |
| | | std::string getParamsDescription() const; |
| | | void serialize(CArchive& ar); |
| | | void setJobDataB(CJobDataB* pJobDataB); |
| | | CJobDataB* getJobDataB(); |
| | | void setJobDataS(CJobDataS* pJobDataS); |
| | | void updateJobDataS(CJobDataS* pJobDataS); |
| | | CJobDataS* getJobDataS(); |
| | | BOOL setBuddy(CGlass* pGlass); |
| | | BOOL forceSetBuddy(CGlass* pGlass); |
| | | CGlass* getBuddy(); |
| | | std::string& getBuddyId(); |
| | | const std::string& getBuddyId() const; |
| | | void setBuddyId(std::string& strId); |
| | | int processEnd(unsigned int nEqId, unsigned int nUnit); |
| | | BOOL isProcessed(unsigned int nEqId, unsigned int nUnit); |
| | | int setInspResult(unsigned int nEqId, unsigned int nUnit, InspResult result); |
| | | InspResult getInspResult(unsigned int nEqId, unsigned int nUnit) const; |
| | | InspResult getAOIInspResult() const; |
| | | |
| | | public: |
| | | // 新增状态 |
| | | GlsState state() const noexcept { return m_state; } |
| | | std::string getStateText(); |
| | | GlsState m_state{ GlsState::NoState }; |
| | | static void clampString(std::string& s, size_t maxLen); |
| | | static std::string trimCopy(std::string s); |
| | | std::string m_failReason; |
| | | |
| | | // —— 状态机(带守卫)—— |
| | | bool queue(); // NoState -> Queued |
| | | bool start(); // Queued -> InProcess |
| | | bool pause(); // InProcess -> Paused |
| | | bool resume(); // Paused -> InProcess |
| | | bool complete(); // InProcess -> Completed |
| | | bool abort(); // Any (未终态) -> Aborted |
| | | bool fail(std::string reason); // 任意态 -> Failed(记录失败原因) |
| | | |
| | | // 时间戳 |
| | | std::optional<std::chrono::system_clock::time_point> m_tQueued; |
| | | std::optional<std::chrono::system_clock::time_point> m_tStart; |
| | | std::optional<std::chrono::system_clock::time_point> m_tEnd; |
| | | |
| | | // 时间戳(可用于报表/追溯) |
| | | std::optional<std::chrono::system_clock::time_point> tQueued() const { return m_tQueued; } |
| | | std::optional<std::chrono::system_clock::time_point> tStart() const { return m_tStart; } |
| | | std::optional<std::chrono::system_clock::time_point> tEnd() const { return m_tEnd; } |
| | | void markQueued(); |
| | | void markStart(); |
| | | void markEnd(); |
| | | |
| | | // 工艺参数 |
| | | void addParams(std::vector<CParam>& params); |
| | | std::vector<CParam>& getParams(); |
| | | |
| | | private: |
| | | MaterialsType m_type; |
| | | std::string m_strID; |
| | | CPath* m_pPath; |
| | | CJobDataB m_jobDataB; |
| | | CJobDataS m_jobDataS; |
| | | CGlass* m_pBuddy; |
| | | std::string m_strBuddyId; |
| | | int m_nOriginPort; |
| | | int m_nOriginSlot; |
| | | BOOL m_bScheduledForProcessing; /* 是否将加工处理 */ |
| | | CProcessJob* m_pProcessJob; |
| | | std::vector<CParam> m_params; // 工艺参数 |
| | | }; |
| | | } |
| | | |