#pragma once #include "../config/bean/IOCfg.h" #include "../config/bean/SystemBase.h" #include "../plc/SysParam.h" #include "../plc/SignalState.h" #include "../LanguageManager.h" #include "../plc/Axis.h" #include "../config/bean/ParamLimitCfg.h" #include "../UI/UIBean.h" #include "../config/bean/ExtCfg.h" class Machine { public: Machine(MachineTypeCfg::MachineTypeId type); virtual ~Machine(); static Machine* CreateInstance(int type); //void SetIO (IOCfgWrapper* io){ // m_IOCfgWrapper = io; //} void Init(); virtual void InitSignal(SignalStateWrapper* ssw, void* cc) = 0; virtual void InitSysParam(SysParamWrapper* spw, void* cc) = 0; virtual void DrawPowderCtrl(bool* winShow) = 0; void SetAxisAndSignal(SysParamWrapper* sysParamWrapper, AxisRecordWrapper* axisRecordWrapper, PLCAxis* axis){ m_SysParamWrapper = sysParamWrapper; m_AxisRecordWrapper = axisRecordWrapper; m_Axis = axis; } virtual void CheckIO() {} void DrawIO(bool* isShow); virtual void DrawAnalogExt(); void Update(const ReadData& rd); protected: int GetLoadInResult() { int rel = 0; EnterCriticalSection(&m_LoadCS); rel = m_LoadInResut; LeaveCriticalSection(&m_LoadCS); return rel; } int GetLoadOutResult() { int rel = 0; EnterCriticalSection(&m_LoadCS); rel = m_LoadOutResut; LeaveCriticalSection(&m_LoadCS); return rel; } int GetLoadInProcStep() { int rel = 0; EnterCriticalSection(&m_LoadCS); rel = m_LoadInProcStep; LeaveCriticalSection(&m_LoadCS); return rel; } int GetLoadOutProcSetp() { int rel = 0; EnterCriticalSection(&m_LoadCS); rel = m_LoadOutProcStep; LeaveCriticalSection(&m_LoadCS); return rel; } string GetLoadInfo() { string rel = ""; EnterCriticalSection(&m_LoadCS); rel = m_LoadInfo; LeaveCriticalSection(&m_LoadCS); return rel; } bool IsWaitConnectBoxCommit() { bool rel = false; EnterCriticalSection(&m_LoadCS); rel = m_WaitConnectBoxCommit; LeaveCriticalSection(&m_LoadCS); return rel; } void SetWaitConnectBoxCommit(bool commit); bool IsLoadIn() { bool rel = false; EnterCriticalSection(&m_LoadCS); rel = m_isLoadIn; LeaveCriticalSection(&m_LoadCS); return rel; } bool IsLoadOut() { bool rel = false; EnterCriticalSection(&m_LoadCS); rel = m_isLoadOut; LeaveCriticalSection(&m_LoadCS); return rel; } protected: MachineTypeCfg::MachineTypeId m_Type; SysParamWrapper* m_SysParamWrapper; AxisRecordWrapper* m_AxisRecordWrapper; SignalStateWrapper* m_SignalStateWrapper; SignalState m_SignalState; void* m_PLC; //wxxtest PLCAxis* m_Axis; //AlarmCfgWrapper* m_AlarmCfgWrapper; IOCfgWrapper* m_IOCfgWrapper; RunCfg* m_RunCfg; ExtCfgNew* m_ExtCfg; PowderAssistBean m_PowderAssist; ParamLimitCfgNew* m_ParamLimitCfg; AxisCfg* m_MoldAxisCfg; AxisCfg* m_LoadAxisCfg; AxisCfg* m_ArmAxisCfg; AxisCfg* m_SupplyAxisCfg; AxisCfg* m_CleanAxisCfg; int m_LoadInResut; string m_LoadInfo; int m_LoadOutResut; int m_LoadInProcStep; int m_LoadOutProcStep; bool m_isLoadIn; //是否载入 bool m_isLoadOut; //是否载出 bool m_WaitConnectBoxCommit; CRITICAL_SECTION m_LoadCS; };