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.

329 lines
13 KiB
C++

#pragma once
#include "GlobalDefine.h"
#include "module.h"
#include "OffsetTable.h"
#define Rcp_AreaName_Idx 18 //扫描区域名称参数索引值(前面增加了参数要改这个值)
#define Rcp_AreaIdx_Idx (Rcp_AreaName_Idx+1)
#define Rcp_N2_Idx (Rcp_AreaIdx_Idx+1)//N2开关
#define Rcp_UseCurN2Val_Idx (Rcp_N2_Idx+1)//使用Recipe的MFC流量值开关
#define Rcp_OffsetTab_Idx (Rcp_UseCurN2Val_Idx+1)//补偿表
#define Rcp_RunTimes_Idx (Rcp_OffsetTab_Idx+1)//运行次数
#define Rcp_Cassette_Tier_Idx (Rcp_RunTimes_Idx+1)//料盒层数
#define Rcp_CalInfo_Start_Idx (Rcp_Cassette_Tier_Idx+1) //计算参数开始的索引值
#define Rcp_EdiScope_Idx 9 //功率密度复检精度
#define Rcp_OverlapX_Idx (Rcp_EdiScope_Idx+1)
#define Rcp_OverlapY_Idx (Rcp_OverlapX_Idx+1)
#define Rcp_FixSpeed_Idx (Rcp_OverlapY_Idx+2)
#define Rcp_FixGap_Idx (Rcp_FixSpeed_Idx+1)
#define Rcp_List_Val_Col 6//参数在list 中的列号
//参数的类型
enum ERecipeParType
{
_RecipeParType_Null = 0,
_RecipeParType_Double,
_RecipeParType_Bool,
_RecipeParType_CString,
_RecipeParType_Int,
};
enum ERecipeCtrlType
{
_RecipeCtrl_AddGroup = 0,
_RecipeCtrl_DelGroup,
_RecipeCtrl_GroupName,
_RecipeCtrl_AddRecipe,
_RecipeCtrl_DelRecipe,
_RecipeCtrl_CopyRecipe,
_RecipeCtrl_MoveRecipe,
_RecipeCtrl_RecipeName,
_RecipeCtrl_AddSubRecipe,
_RecipeCtrl_DelSubRecipe,
_RecipeCtrl_SubRecipeName,
};
//一个recipe 参数
class CRecipeParameter
{
public:
CRecipeParameter()
{
m_ParDoubleVal = 0;//参数数字值
m_DoubleMinVal = 0;//参数最小值
m_DoubleMaxVal = 0;//参数最大值
m_ParIntVal = 0;
m_ParType = _RecipeParType_Double;//参数的类型
m_ListItemWidht = 100;//列表宽度
m_bRcpInfoPar = false;//是否为计算参数(不能被编辑)
m_ParUnit = "/";//参数的单位,用于显示
m_DetailInfo = "未定义";
};
CString GetParStr();
void SetValByStr(CString s);
CString GetParTypeStr();
void SetTypeByStr(CString TypeStr);
void GetRangeStr(CString &Min,CString &Max);
public:
CString m_ParName;//参数的名字(保存)
double m_ParDoubleVal;//参数数字值(保存)
bool m_ParBoolVal;//bool 值(保存)
CString m_ParStrVal;//字符串值(保存)
int m_ParIntVal;//参数数字值(保存)
CString m_ParShowName;//参数的名字
ERecipeParType m_ParType;//参数的类型
int m_ListItemWidht;//列表宽度
double m_DoubleMinVal;//参数最小值
double m_DoubleMaxVal;//参数最大值
bool m_bRcpInfoPar;//是否为计算参数(不能被编辑)
CString m_ParUnit;//参数的单位,用于显示
CString m_DetailInfo;//详细参数信息
};
class CRecipeCtrlItem
{
public:
CRecipeCtrlItem(){};
public:
CString m_DlgTitle;
CString *m_EditName1;
CString *m_EditName2;
CComboBox *m_RecipeCtrlGroupComb;
CString m_SelGroupName;
};
class CRecipeParCtrlItem
{
public:
CRecipeParCtrlItem(){};
public:
double *m_EditParVal;
CString *m_EditParName;
CComboBox *m_SelScanAreaComb;
CComboBox *m_SelScanAreaIdxComb;
CComboBox *m_SelBoolValComb;
CComboBox *m_SelOffsetTableComb;
CString m_SelScanAreaStr;
};
class CSubRecipe
{
public:
CSubRecipe();
void IntiRecipeParVec();
void ReadMFCCtrlScalFile();
public:
CString m_SubRecipeName;
bool m_bUseSubRecipe;//生产中是否使用
vector<CRecipeParameter> m_RecipeParVec;//参数容器
COffsetTable m_OffsetTable;//补偿表
vector<vector<CString>> MFCScalStrVec;
};
class CRecipeCtrlPar
{
public:
CRecipeCtrlPar(){};
public:
ERecipeCtrlType m_CtrlType;
CString m_FilePath;
CString m_NewFilePath;
CString m_RcpName;
CString m_RcpNameNew;
CString m_SubRcpName;
CString m_SubRcpNameNew;
};
//一个Recipe (可以整个类进行赋值)
class CRecipe
{
public:
CRecipe();
void RecipeReset();
bool IsValid();
void SaveRecipeParToFile(CString FilePath);
void ReadRecipeParFromFile(CString FilePath);
CRecipeParameter GetRecipePar(CString ParName);//获取参数名为ParName 的值
void SetRecipePar(CString ParName,CRecipeParameter RecipePar);//设置参数名为ParName 的值
bool CheckParRange(bool bShowMsg);
bool CheckParRangeByName(CString ParName,double val);
bool CheckParRangeExt(CRecipeParameter &RecipePar,double ParVal,bool bShowMsg);
CString GetShowName();
vector<CRecipeParameter> &GetRecipeParVec();
vector<CSubRecipe> &GetSubRecipeVec(){return m_SubRecipeVec;};
void AddSubRecipe(CString SubRecipeName);
int GetCurSubRecipeIdx(){return m_CurSubRecipeIdx;};
void SetCurSubRecipeIdx(int idx){m_CurSubRecipeIdx = idx;};
CString GetCurSubRecipeName();
void SetCurSubRecipeName(CString Name);
void DelSubRecipe(CString SubRecipeName);
bool ReadOffsetTableFile(CString TableName);
double GetOffsetParVal(CString ParName);
public:
int m_GroupIdx;//组的编号(1~10)
int m_RecipeIdx;//在组中的编号(1~50)
double m_DoubleValCnt;//double 类型参数的数量
//新的参数
CString m_RecipeName;//Recipe 名
CString m_FilePath;//存储的目录
bool m_bEnableEdit;//当前时候可以编辑
int m_CurSubRecipeIdx;//当前使用的SubRecipe 索引号(这个值不能超过范围)(编辑和加工时会用到)
vector<CSubRecipe> m_SubRecipeVec;//用于一片wafer 多recipe 执行(最少要保留一个SubRecipe ,否则会报错)
};
//recipe 参数管理
class CRecipeMgr:public CModule
{
public:
CRecipeMgr(void);
virtual ~CRecipeMgr(void);
virtual void OnAppInitialize();
void InitRecipeGourpFile();
CRecipeParameter GetCurRecipePar(CString ParName);
void SelRecipeScanArea(CComboBox &ComboBox);
void SetCurSelGourpIdx(int Idx);
void SetCurSelRecipeIdx(int Idx);
void SetbChangeName(bool b){m_bChangeGroupName = b;};
bool GetbChangeName(){return m_bChangeGroupName;};
void SaveCurSelRecipe(CRecipe Recipe);
CRecipe GetCurWorkRecipe(){return m_CurWorkRecipe;};
void SetCurWorkRecipe(CRecipe Recipe){m_CurWorkRecipe = Recipe;};
CString GetCurSelGroupName();
CString GetSelGroupRecipeStr();
void UpdateSelRecipeList(CListCtrl &List,bool bInsert);
void CreatRecipeScanPath(CRecipe *pRecipe,int SubRecipeIdx);
bool EditRecipeByCtrlType(ERecipeCtrlType t);
ERecipeCtrlType GetCurRecipeCtrlType(){return m_CurRecipeCtrlType;};
CString RecipeCtrlExcute(CRecipeCtrlItem &CtrlItem);
void BindingRecipeGroupComb(CComboBox *p);
void RecipeCtrlInit(CRecipeCtrlItem &CtrlItem);
void InitGroupRecipeList(CListCtrl &List);
void UpdateGroupRecipeList(CListCtrl &List);
void InitEditRecipeList(CListCtrl &List,bool bShowParRange);
void InitEditSubRecipeList(CListCtrl &List);
void UpdateEditRecipeList(CListCtrl &RecipeList,CListCtrl &RecipeInfoList,bool bResetErrRangeParIdxSet=true);
void UpdateEditSubRecipeList(CListCtrl &List);
bool SaveEditRecipePar(CListCtrl &ListCtrl,CListCtrl &RecipeInfoList);
void AddSubRecipe(CString SubRecipeName);
void SetSubRecipeIdx(int idx);
bool MoveSubRecipe(bool bMoveUp);
void OnSelRecipeIdxChange(int idx);
bool ReadEditRecipeFromFile();
CString GetCurEditRecipeInfo();
CString GetCurEditSubRecipeInfo();
void ChangeRecipeName(CString NewRcpName);
void DelSubRecipe(CString SubRecipeName);
void SetCurSelRecipeName(CString s){m_CurSelRecipeName = s;};
void UpdatParBoolComb(CComboBox &Comb);
void UpdateAreaIdxCombo(CComboBox &AreaIdxComb);
bool UpdateRecipeInfoPar(CRecipe &Recipe);
void UpdateRecipeGroupComb(CComboBox *pComb);
void UpdateSelRecipeComb(CComboBox &ComboBox,vector<CString> &SelGroupRecipeNameVec);
bool ReadEditRecipeFromFile(CRecipe &Recipe,int SelGroupIdx,CString SelRecipeName);
void UpdateAllRecipeParToList(CRecipe Recipe,CListCtrl &RecipeList);
CString GetCtrlRecipeFilePath(CString GroupName,CString RecipeName);
void UpdateSelSubRecipeComb(CComboBox &ComboBox,CRecipe Recipe);
void CreatScanPath(CString AreaName,int AreaIdx);
CRecipe GetCurEditRecipe(){return m_CurEditRecipe;};
void CreatCurEditRecipeScanPath();
void UpdateRecipeGroupVec();
void UpdateEditRecipeListExt(CRecipe &Recipe,CListCtrl &RecipeList,CListCtrl &RecipeInfoList);
void UpdateEditSubRecipeListExt(CRecipe &Recipe,CListCtrl &List);
CString GetAreaIdxStr(int k);
CString CreatCurParDataPath();
void SaveRecipeHistoy(CRecipeCtrlPar RecipeCtrlPar);
bool CheckRecipeNameExist(CString RecipeName);
CString GetRecipePathByName(CString RecipeName);
void DeleteRecipeGroup(CString GroupName);
bool IsErrRangeParIdx(int idx){return m_ErrRangeParIdxSet.count(idx);};
bool IsChangeParIdx(int idx){return m_ChangeParIdxSet.count(idx);};
bool IsInvalidParIdx(int idx){return m_InvalidParIdxSet.count(idx);};
void UpdateEditRecipeListExt(CListCtrl &RecipeList,CRecipe &Recipe);
void UpdateInvalidParIdxSet(CRecipe &Recipe);
void UpdateLaserFocusProp();
void UpdateRecipeGroupInfo();
CString GetOffsetTablePath(CString TabName);
CString GetShowParText(int Row);
private:
CString GetGroupDirPath(int GroupIdx);
CString GetRecipeNameListPath();
CString GetRecipeFilePath(int GroupIdx,int RecipeIdx);
CString GetRecipePath();
void CreatRecipeFilePath();
void AddRecipeGroup(CString GroupName);
void AddRecipe(CString GroupName,CString RecipeName);
void ChangeGroupName(CString NewGroupName);
CString GetRecipeCtrlName(ERecipeCtrlType RecipeCtrlType);
void ChangeSubRecipeName(CString NewRcpName);
void SaveRecipeToXml(CString FilePath,CRecipe &Recipe);
void ReadCurGroupRecipeName(vector<CString> &SelGroupRecipeNameVec);
bool ReadRecipeFromXml(CString FilePath,CRecipe &Recipe);
void MoveRecipe(CString GroupName,CString RecipeName);
void CopyRecipe(CString NewRecipeName);
void DeletRecipe(CString RecipeName);
bool IsbSelEditRecipe();
void ResetParIdxSet();
private:
CRecipe m_CurWorkRecipe;//当前加工使用的recipe
bool m_bChangeGroupName;//true 设置group 名称,false 设置recipe 名称
vector<CString> m_RecipeGroupNameVec;
int m_CurSelGroupIdx;//当前选择的gourp 索引值
vector<CRecipe> m_CurGroupRecipeVec;//当前组的recipe 容器
int m_CurSelRecipeIdx;//当前选择的recipe 索引值
//新的参数
vector<CString> m_NewRecipeGroupNameVec;//组名称容器
vector<CString> m_CurSelGroupRecipeNameVec;//当前选中的组recipe 名称
ERecipeCtrlType m_CurRecipeCtrlType;//当前的操作类型
CComboBox *m_pRecipeGroupComb;
int m_CurSelRecipeParIdx;//当前选择的par 索引值
CString m_CurSelGroupName;//当前选中Group 的名称
CString m_CurSelRecipeName;//当前选中recipe 的名称
CRecipe m_CurEditRecipe;//当前编辑的recipe
//用于recipe list 显示的索引值
set<int> m_ErrRangeParIdxSet;//参数超出范围的索引值
set<int> m_ChangeParIdxSet;//变化参数的索引值
set<int> m_InvalidParIdxSet;//无效参数的索引值
double m_FocusAdjustMin;//焦距调整范围最小值
double m_FocusAdjustMax;//焦距调整范围最大值
};
extern CRecipeMgr *gRecipeMgr;