You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

230 lines
8.4 KiB
C++

#pragma once
#include "module.h"
#include "WorkCmdContainer.h"
#include "EnumDirection.h"
#include "WorkCmdInvoker.h"
//简易执行指令的流程
enum eExcuteFlowType
{
_ExcuteFlow_Null = 0,
_ExcuteFlow_Foup_LoadMap_Port1,
_ExcuteFlow_Foup_LoadMap_Port2,
_ExcuteFlow_Foup_Unload_Port1,
_ExcuteFlow_Foup_Unload_Port2,
_ExcuteFlow_Manual_Anneal_Start,//启动手动退火
};
//打光斑测试参数
class CLaserSpotMarkPar
{
public:
CLaserSpotMarkPar(void)
{
m_SpotGap = 2;//光斑点的X 方向间隔mm
m_SpotOffsetZ = 0.1;//光斑点的Z 轴间隔mm
m_SpotCntZ = 30;//正向点数
m_SpotCntF = 30;//负向点数
m_SpotMarkDelay = 2;//每个点开光时间ms
};
public:
double m_SpotGap;//光斑点的X 方向间隔mm
double m_SpotOffsetZ;//光斑点的Z 轴间隔mm
int m_SpotCntZ;//正向点数
int m_SpotCntF;//负向点数
int m_SpotMarkDelay;//每个点开光时间s
};
class CLaserSpotPt
{
public:
CLaserSpotPt(void)
{
m_AdjustZVal = 0;//Z轴调整值
};
public:
Dbxy m_Coord;
double m_AdjustZVal;//Z轴调整值
};
//XY 运动测试参数
class CXyMoveTestPar
{
public:
CXyMoveTestPar(void)
{
m_CycleTimes = 10;//循环次数
m_MoveSpeed = 200;// 移动速度X
};
public:
int m_CycleTimes;//循环次数
double m_MoveSpeed;// 移动速度
};
//运动测试移动点的数据
class CMovePtData
{
public:
CMovePtData(void)
{
};
public:
Dbxy m_MaxCoord;//最大值
Dbxy m_MinCoord;//最小值
Dbxy m_AvgCoord;//平均值
vector<Dbxy> m_PtVec;//测量点
};
class CTestLine
{
public:
CTestLine(void)
{
};
public:
Dbxy m_pt1;
Dbxy m_pt2;
};
//管理常用 的流程
class CCommonFlowMgr :public CModule
{
public:
CCommonFlowMgr(void);
~CCommonFlowMgr(void);
virtual CMFCPropertyGridProperty *CreatGridProperty();
virtual MODULE GetModuleType(){return _COMMON_FLOW_PROP;};
virtual void OnAppInitialize();
virtual void Draw(CDC* pDC);
virtual CString GetParDirName();
bool InitDeviceFlow(bool bConfirmMsgBox);
bool IsbConnectObj(){return m_bConnectObj;};
bool IsbShowErrMsg(){return m_bShowErrMsg;};
bool IsbStopWorkMsg(){return m_bStopWorkMsg;};
bool IsbShowStartMsg(){return m_bShowStartMsg;};
void SetErrMsg(CString s){m_ErrMsg = s;};
CString GetErrMsg(){return m_ErrMsg;};
bool MoveToPos(Dbxy MovePt,Dbxy TargetPt,double MotorZCoord);
bool CheckDeviceInitState();
double GetOneLineScanSpeed(){return m_OneLineScanSpeed;};
void SetOneLineScanSpeed(double val){m_OneLineScanSpeed = val;};
void OneLineLaserTest();
bool AtLaserSafePlace(Dbxy PlatformCoord);
void ManualMoveAsixXY(double MoveDis,DIRECTION MoveDir);
void ManualMoveAsixZ(double dis);
CXyMoveTestPar GetCurXyMoveTestPar(){return m_CurXyMoveTestPar;};
void SetCurXyMoveTestPar(CXyMoveTestPar par){m_CurXyMoveTestPar = par;};
void XyMoveTestFlow();
bool IsbXyMoveTesting(){return m_bXyMoveTesting;};
void XYMoveSaveCoord();
void OpenMoveTestObj();
void InitMoveRetList(CListCtrl &List);
void InsertMoveRetList(CListCtrl &List);
bool LaserPowCheckFlow();
CLaserSpotMarkPar GetLaserSpotMarkPar(){return m_LaserSpotMarkPar;};
void SetLaserSpotMarkPar(CLaserSpotMarkPar par){m_LaserSpotMarkPar = par;};
void CreatLaserSpotMarkPt();
void LaserSpotMarkFlow();
void SetbLaserSpotMarkMode(bool b);
bool IsbLaserSpotMarkMode(){return m_bLaserSpotMarkMode;};
bool IsbIniMotorZ(){return m_bIniMotorZ;};
bool IsbIniPlatfrom(){return m_bIniPlatfrom;};
int GetLightAlamTime(){return m_LightAlamTime;};
int CollectMultiMovePoint();
void CollectMultiPointVecToFile();
void PlanenessMeasureFlow();
bool CheckLaserBeamFlow();
bool CheckRecipeEnergyDensityFlow(double Laser1Curr);
bool MoveToPowMeasureFlow();
bool IsbKeepJobN2Air(){return m_bKeepJobN2Air;};
bool ManualTransferWaferFlow();
void JobQueueCtrlFlow();
void PauseJobQueueCtrlFlow();
void StopJobQueueCtrlFlow();
bool ExcuteSimpleFlowType(eExcuteFlowType FlowType);
void AutoFindFocusFlow();
void ManualCtrlPlatWaferFlow(bool bWaferOn);
void CloseLaserLddFlow();
bool IsbAutomationWorking(){return m_bAutomationWorking;};
bool IsbStopAutomationWork(){return m_bStopAutomationWork;};
void StartAutomationWorkFlowThread();
void StartAutomationWorkFlow();
void StopAutomationWorkFlow();
private:
bool CommWorkStart();
void CommWorkEnd();
void CreatAnnealScanCmd(CWorkCmdInvoker &CmdInvoker);
void InsertMoveRetListExt(CListCtrl &List,int line,int Idx,CMovePtData &MovePtData,X_OR_Y Xy);
void OneLineLaserTestExt(Dbxy Pt1,Dbxy Pt2);
void CalXYMoveTestResult(int MeasurePtCnt);
bool LaserPowCheckFlowExt();
void DrawLaserSpotPt(CDC* pDC);
bool CheckLaserSpotData();
void DrawTestLineVec(CDC* pDC);
void CreatAutoFindFocusInvokerCmd(CWorkCmdInvoker &WorkCmdInvoker,bool bToLaserFocus);
void CreatPowCheckPrepareCmd(CWorkCmdInvoker &CmdInvoker);
private:
//共通设定
bool m_bNeedInit;//是否需要初始化才能进行操作
bool m_bShowStartMsg;//在开始加工时是否对话框提示
bool m_bShowErrMsg;//运行时出错后对话框提示
CString m_ErrMsg;//错误信息
bool m_bStopWorkMsg;//点了停止按钮后是否提示对话框
double m_OneLineScanSpeed;//单条扫描线的速度
//初始化相关参数-----------------------------------------------------
bool m_bIniConfirmMsgBox;//是否弹出初始化确认对话框
bool m_bIniPlatfrom;//是否初始化电机平台
bool m_bIniMotorZ;//是否初始化电机Z
bool m_bInitedToProductPt;//初始化完成后是否返回上料点
bool m_bConnectObj;//是否连接多个obj 数据
bool m_bSetLightState;//是否设置警示灯状态
double m_MotorZSafeCoord;//Z 轴的安全坐标位置(保存值)
int m_CurDrawLineCnt;//当前绘制的线段计数器
int m_DrawLineGapCnt;//每间隔几条线绘制一次(保存值)
int m_TransferTestDelay;//传片测试延时ms
int m_OneLineAnnealTimeAdjsut;//单条线段退火时间的调整量ms
CXyMoveTestPar m_CurXyMoveTestPar;//当前的XY 运动测试参数
bool m_bXyMoveTesting;//是否正在XY 移动测试
int m_MoveTestDelay;//移动测试延时ms
vector<Dbxy> m_XyMoveTestVec;//移动测试坐标结果容器
vector<CMovePtData> m_MovePtDataVec;//测量点结果容器
bool m_bLaserSpotMarkMode;//当前是否为打光斑模式
vector<CLaserSpotPt> m_LaserSpotPtVec;//光斑点容器
CLaserSpotMarkPar m_LaserSpotMarkPar;//打光斑的参数
int m_LightAlamTime;//蜂鸣器时间
vector<CTestLine> m_CTestLineVec;
bool m_bKeepJobN2Air;//在job 运行时一直保持吹气
bool m_bCtrlN2Air;//是否控制氮气开关(调试时可以关闭)
bool m_bAutomationWorking;//是否正在自动生产中
bool m_bStopAutomationWork;//停止自动运行
};
extern CCommonFlowMgr *gCommonFlowMgr;