#pragma once #include "Context.h" #include #include "CPath.h" #include "CJobDataA.h" #include "CJobDataB.h" #include "CJobDataC.h" #include "CJobDataS.h" #include "ServoCommo.h" #include "ProcessJob.h" #include "CParam.h" namespace SERVO { /// PJ ÉúÃüÖÜÆÚ£¨Ìù½ü E40 ³£¼û״̬£© enum class GlsState : uint8_t { NoState = 0, Queued, InProcess, Paused, Completed, Aborted, Failed }; class CGlass : public CContext { public: CGlass(); virtual ~CGlass(); void reset(); public: virtual std::string& getClassName(); virtual std::string toString(); MaterialsType getType(); void setType(MaterialsType type); void setID(const char* pszID); std::string& getID(); 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); CPath* getPath(); void addPath(unsigned int nEqId, unsigned int nUnit); void serialize(CArchive& ar); void setJobDataS(CJobDataS* pJobDataS); void updateJobDataS(CJobDataS* pJobDataS); CJobDataS* getJobDataS(); BOOL setBuddy(CGlass* pGlass); BOOL forceSetBuddy(CGlass* pGlass); CGlass* getBuddy(); std::string& getBuddyId(); 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); 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 m_tQueued; std::optional m_tStart; std::optional m_tEnd; // ʱ¼ä´Á£¨¿ÉÓÃÓÚ±¨±í/×·ËÝ£© std::optional tQueued() const { return m_tQueued; } std::optional tStart() const { return m_tStart; } std::optional tEnd() const { return m_tEnd; } void markQueued(); void markStart(); void markEnd(); // ¹¤ÒÕ²ÎÊý void addParams(std::vector& params); std::vector& getParams(); private: MaterialsType m_type; std::string m_strID; CPath* m_pPath; CJobDataS m_jobDataS; CGlass* m_pBuddy; std::string m_strBuddyId; int m_nOriginPort; int m_nOriginSlot; BOOL m_bScheduledForProcessing; /* ÊÇ·ñ½«¼Ó¹¤´¦Àí */ CProcessJob* m_pProcessJob; std::vector m_params; // ¹¤ÒÕ²ÎÊý }; }