259 lines
6.7 KiB
C++
259 lines
6.7 KiB
C++
#pragma once
|
|
#include <string>
|
|
#include <vector>
|
|
#include "../config/bean/IOCfg.h"
|
|
#include "../config/bean/AlarmCfg.h"
|
|
#include "../config/bean/AxisCfg.h"
|
|
#include "../config/bean/SystemBase.h"
|
|
#include "../config/bean/CoverCfg.h"
|
|
#include "../config/bean/ExtCfg.h"
|
|
#include "../config/bean/CommunicationCfg.h"
|
|
#include "../config/bean/MachineCfg.h"
|
|
#include "../config/bean/ParamLimitCfg.h"
|
|
#include "../Communication/IPGLaserClient.h"
|
|
//#include "../Purifier/BasePurifier.h"
|
|
#include "../PLC/SignalState.h"
|
|
#include "../PLC/MachineCtrl.h"
|
|
//#include "../UI/UIBean.h"
|
|
#include "../PLC/Axis.h"
|
|
#include <bitset>
|
|
#include "../DataManage/ClientInfo.h"
|
|
#include "../LanguageManager.h"
|
|
|
|
|
|
using namespace std;
|
|
|
|
class Machine {
|
|
typedef void(*IoVersionCheck)(vector<string>&, IOCfgWrapper*, string str, int type);
|
|
public:
|
|
Machine(MachineTypeCfg::MachineTypeId type);
|
|
virtual ~Machine();
|
|
static Machine* CreateInstance(int type);
|
|
|
|
virtual void Init();
|
|
virtual string GetFindIOStr();
|
|
virtual string GetInsertIOStr();
|
|
virtual void GetStartupIO(vector<IOCfg*>& vec);
|
|
virtual void BindLaser();
|
|
virtual void CheckIO(vector<string>&ins, IOCfgWrapper* iocfgWrapper , int vid);
|
|
//virtual void CheckIO_NEW(vector<string>&ins, IOCfgWrapper* iocfgWrapper) = 0;
|
|
//virtual void DrawIO(bool* isShow);
|
|
|
|
virtual AxisCfg* CreateMoldAxisCfg() = 0;
|
|
virtual AxisCfg* CreateLoadAxisCfg() = 0;
|
|
virtual AxisCfg* CreateArmAxisCfg() = 0;
|
|
virtual AxisCfg* CreateSupplyAxisCfg() = 0;
|
|
virtual AxisCfg* CreateCleanAxisCfg() = 0;
|
|
virtual AxisCfg* CreateEleAxisCfg();
|
|
|
|
static void InitMachineCfg(MachineCfg* cfg);
|
|
|
|
//virtual void CheckStopAlarm(vector<string>&ins, AlarmCfgWrapper* alarmWrapper);
|
|
//virtual void CheckPauseAlarm(vector<string>&ins, AlarmCfgWrapper* alarmWrapper);
|
|
//virtual void CheckWarnAlarm(vector<string>&ins, AlarmCfgWrapper* alarmWrapper);
|
|
|
|
//virtual void Machine::CheckAlarm()
|
|
//{
|
|
//}
|
|
//virtual void CheckCoverCfgWhenCreate(CoverCfg* cfg) {}
|
|
//virtual void CheckExtCfgWhenCreate(ExtCfg* cfg) {}
|
|
//virtual void CheckRunCfgWhenCreate(RunCfg* cfg) {}
|
|
//virtual void InitScanParamBeforeFind(ScanCfgWrapper* cfgWrapper) {}
|
|
|
|
// virtual void CheckRealtimeAlarm();
|
|
virtual void ReleaseGTExt(){}
|
|
virtual void InitGTExt(){}
|
|
virtual void AutoCtrlLamp(){}
|
|
virtual void GetDebugRTC(vector<CardSerialPair>& vec) {
|
|
CardSerialPair pair;
|
|
pair.cardNo = 1;
|
|
pair.serialNo = 123456;
|
|
vec.push_back(pair);
|
|
|
|
CardSerialPair pair2;
|
|
pair2.cardNo = 2;
|
|
pair2.serialNo = 234567;
|
|
vec.push_back(pair2);
|
|
|
|
CardSerialPair pair3;
|
|
pair3.cardNo = 3;
|
|
pair3.serialNo = 345678;
|
|
vec.push_back(pair3);
|
|
|
|
CardSerialPair pair4;
|
|
pair4.cardNo = 4;
|
|
pair4.serialNo = 456789;
|
|
vec.push_back(pair4);
|
|
}
|
|
|
|
//void SetPurifier(BasePurifier* bp) { m_Purifier = bp; }
|
|
|
|
//virtual void DrawSignal(bool *isshow)=0;
|
|
|
|
//virtual void DrawAxisCfg() = 0;
|
|
|
|
//virtual void DrawPowderCtrl(bool* winShow) = 0;
|
|
|
|
//virtual void DrawAnalogExt();
|
|
|
|
//virtual void DrawServoState(bool* winShow) = 0;
|
|
|
|
void SetAxisAndSignal(SysParamWrapper* sysParamWrapper,AxisRecordWrapper* axisRecordWrapper, PLCAxis* axis)
|
|
{
|
|
m_SysParamWrapper = sysParamWrapper;
|
|
m_AxisRecordWrapper = axisRecordWrapper;
|
|
m_Axis = axis;
|
|
}
|
|
|
|
void SetMachineCtrl(MachineCtrl* mc) {
|
|
m_MachineCtrl = mc;
|
|
}
|
|
|
|
virtual void InitSignal(SignalStateWrapper* ssw, PLCReveiver* cc) = 0;
|
|
|
|
virtual void InitSysParam(SysParamWrapper* spw, PLCReveiver* cc) = 0;
|
|
|
|
virtual void InitPLCCommand(vector<S7Command*>& vecs) = 0;
|
|
|
|
//virtual void GetAlarmState(SignalState& signalState) = 0;
|
|
|
|
virtual void LoadIn();
|
|
virtual void LoadOut();
|
|
|
|
//virtual bool CheckPrintMoldReady() = 0;
|
|
|
|
bool IsWaitConnectBoxCommit() { return m_WaitConnectBoxCommit; }
|
|
void SetWaitConnectBoxCommit(bool commit) { m_WaitConnectBoxCommit = commit; }
|
|
|
|
virtual bool CheckPrintHigh(float jobhigh) {
|
|
return true;
|
|
}
|
|
|
|
void UpdateClients(const list<ClientInfo*>& clientList) {
|
|
m_clientUser = clientList;
|
|
}
|
|
|
|
protected:
|
|
virtual void LoadOutRun() = 0;
|
|
virtual void LoadInRun() = 0;
|
|
bool IsLoadIn() { return m_LoadInThread != INVALID_HANDLE_VALUE; }
|
|
bool IsLoadOut() { return m_LoadOutThread != INVALID_HANDLE_VALUE; }
|
|
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;
|
|
}
|
|
void SetLoadInResult(int res,string info) {
|
|
EnterCriticalSection(&m_LoadCS);
|
|
m_LoadInResut = res;
|
|
m_LoadInfo = info;
|
|
LeaveCriticalSection(&m_LoadCS);
|
|
}
|
|
void SetLoadOutResult(int res,string info) {
|
|
EnterCriticalSection(&m_LoadCS);
|
|
m_LoadOutResut = res;
|
|
m_LoadInfo = info;
|
|
LeaveCriticalSection(&m_LoadCS);
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
void SetLoadInProcStep(int res) {
|
|
EnterCriticalSection(&m_LoadCS);
|
|
m_LoadInProcStep = res;
|
|
LeaveCriticalSection(&m_LoadCS);
|
|
}
|
|
void SetLoadOutProcStep(int res) {
|
|
EnterCriticalSection(&m_LoadCS);
|
|
m_LoadOutProcStep = res;
|
|
LeaveCriticalSection(&m_LoadCS);
|
|
}
|
|
|
|
string GetLoadInfo() {
|
|
string rel = "";
|
|
EnterCriticalSection(&m_LoadCS);
|
|
rel = m_LoadInfo;
|
|
LeaveCriticalSection(&m_LoadCS);
|
|
return rel;
|
|
}
|
|
|
|
void InterceptLoad();
|
|
private:
|
|
static DWORD WINAPI LoadOutProc(Machine* _this);
|
|
static DWORD WINAPI LoadInProc(Machine* _this);
|
|
protected:
|
|
MachineTypeCfg::MachineTypeId m_Type;
|
|
map<string, bool> m_AlarmEnableMap;
|
|
map<string, bool> m_CommunicationEnableMap;
|
|
uint64_t m_SSRCheckTick;
|
|
|
|
AlarmCfgWrapper* m_AlarmCfgWrapper;
|
|
IOCfgWrapper* m_IOCfgWrapper;
|
|
SysParamWrapper* m_SysParamWrapper;
|
|
PLCAxis* m_Axis;
|
|
MachineCtrl* m_MachineCtrl;
|
|
SignalState m_SignalState;
|
|
|
|
AxisRecordWrapper* m_AxisRecordWrapper;
|
|
SignalStateWrapper* m_SignalStateWrapper;
|
|
ExtCfg* m_ExtCfg;
|
|
RunCfg* m_RunCfg;
|
|
CoverCfg* m_CoverCfg;
|
|
ParamLimitCfg* m_ParamLimitCfg;
|
|
|
|
AxisCfg* m_MoldAxisCfg;
|
|
AxisCfg* m_LoadAxisCfg;
|
|
AxisCfg* m_ArmAxisCfg;
|
|
AxisCfg* m_SupplyAxisCfg;
|
|
AxisCfg* m_CleanAxisCfg;
|
|
//BasePurifier* m_Purifier;
|
|
|
|
map<int, IoVersionCheck> m_IoRef;
|
|
//PowderAssistBean m_PowderAssist;
|
|
|
|
PLCReveiver* m_PLC;
|
|
|
|
HANDLE m_LoadInThread;
|
|
HANDLE m_LoadOutThread;
|
|
bool m_LoadCtrlFlag;
|
|
int m_LoadInResut;
|
|
string m_LoadInfo;
|
|
int m_LoadOutResut;
|
|
int m_LoadInProcStep;
|
|
int m_LoadOutProcStep;
|
|
bool m_WaitConnectBoxCommit;
|
|
bool m_NeedWaitSelectOutPos;
|
|
bool m_WaitSelectOutPosCommit;
|
|
int m_SelectOutPos;
|
|
CRITICAL_SECTION m_LoadCS;
|
|
|
|
vector<string> m_AxisTabs;
|
|
|
|
list<ClientInfo*> m_clientUser; //连接客户端
|
|
};
|
|
|
|
|