| | |
| | | #include "CJobDataC.h" |
| | | #include "CJobDataS.h" |
| | | #include "ServoCommo.h" |
| | | #include "ProcessJob.h" |
| | | |
| | | |
| | | namespace SERVO { |
| | | /// PJ 生命周期(贴近 E40 常见状态) |
| | | enum class GlsState : uint8_t { |
| | | NoState = 0, |
| | | Queued, |
| | | InProcess, |
| | | Paused, |
| | | Completed, |
| | | Aborted, |
| | | Failed |
| | | }; |
| | | |
| | | class CGlass : public CContext |
| | | { |
| | | public: |
| | |
| | | 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); |
| | | CPath* getPath(); |
| | | void addPath(unsigned int nEqId, unsigned int nUnit); |
| | |
| | | int setInspResult(unsigned int nEqId, unsigned int nUnit, InspResult result); |
| | | InspResult getInspResult(unsigned int nEqId, unsigned int nUnit); |
| | | |
| | | 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(); |
| | | |
| | | private: |
| | | MaterialsType m_type; |
| | | std::string m_strID; |
| | |
| | | int m_nOriginPort; |
| | | int m_nOriginSlot; |
| | | BOOL m_bScheduledForProcessing; /* 是否将加工处理 */ |
| | | CProcessJob* m_pProcessJob; |
| | | }; |
| | | } |
| | | |