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.

528 lines
16 KiB
C++

#include "StdAfx.h"
#include "WaferRecipeDataMgr.h"
#include "GlobalFunction.h"
#include "LogMgr.h"
#include "WorkTime.h"
#include "FileMgr.h"
#include "WorkFileMgr.h"
#include "Layer.h"
#include "ObjFillMgr.h"
#include "Laser.h"
#include "Propertie.h"
#include "PropertieMgr.h"
#include "AuthorityMgr.h"
#include "MsgBox.h"
#include "CStringFuc.h"
#include "Layer.h"
#include "PenParMgr.h"
#include "ObjBase.h"
#include "ObjContainer.h"
#include "ExceptionMsg.h"
#include "WorkRecord.h"
#include "WorkCmdInvoker.h"
#include "WorkCmdContainer.h"
#include "WorkAreaMgr.h"
#include "PenParMgr.h"
#include "CommonFlowMgr.h"
#include "LaserPowCheckMgr.h"
#include "EncryptionMgr.h"
#include "ObjPline.h"
#include "CommomText.h"
#include "ProgramLaserTuiHuo.h"
#include "WorkAreaMgr.h"
#define WORK_AREA_PATH _T("\\WorkMode")
#define SCAN_AREA_FILE_PATH _T("\\ScanArea") //<2F>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7>
#define RECIPE_FILE_PATH _T("\\RecipeFile")
CSlotRecipeDataMgr *gWaferRecipeDataMgr = new CSlotRecipeDataMgr;
CSlotRecipeDataMgr::CSlotRecipeDataMgr(void)
{
m_bScanEnd = true;//ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬,<2C><><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7>ɨ<EFBFBD><C9A8><EFBFBD>ߵ<EFBFBD><DFB5><EFBFBD>ɫ
m_EndScanLineIdx = -1;//<2F><><EFBFBD><EFBFBD>ɨ<EFBFBD><C9A8>ʱɨ<CAB1><C9A8><EFBFBD>ߵ<EFBFBD><DFB5><EFBFBD><EFBFBD><EFBFBD>ֵ(<28><><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>жϵ<D0B6><CFB5><EFBFBD><EFBFBD><EFBFBD>)
m_TotalScanLineCnt = 0;//ɨ<><C9A8><EFBFBD>ߵ<EFBFBD><DFB5><EFBFBD><EFBFBD><EFBFBD>
}
CSlotRecipeDataMgr::~CSlotRecipeDataMgr(void)
{
}
void CSlotRecipeDataMgr::OnAppInitialize()
{
//Ĭ<><C4AC><EFBFBD><EFBFBD>ʾѡ<CABE><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>idx
gLayer.SetbShowObjIdx(true);
//<2F><><EFBFBD><EFBFBD>recipe <20>ļ<EFBFBD>·<EFBFBD><C2B7>
CString RecordPath;
CFileMgr FileMgr;
FileMgr.GetFullFilePath(RecordPath,RECIPE_FILE_PATH);
if(!FileMgr.IsFileExist(RecordPath))//<2F><><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD><EFBFBD>Ŀ¼
{
FileMgr.CreatDir(RecordPath);
}
CString OffsetTabPath = gProgramLaserTuiHuo->GetLaipuLaserDataDir(OFFSET_TAB_FILE_PATH);
if(!FileMgr.IsFileExist(OffsetTabPath))//<2F><><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD><EFBFBD>Ŀ¼
{
FileMgr.CreatDir(OffsetTabPath);
}
}
//<2F><><EFBFBD><EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD>ݵİ<DDB5>ȫ<EFBFBD><C8AB>
bool CSlotRecipeDataMgr::CheckScanPathSecurity()
{
gLogMgr->WriteDebugLog("Func---->CheckScanPathSecurity");
CObjContainer &ObjContainer = gLayer.GetObjContainer();
bool Ret = true;
vector<Sptr<CObjBase>> &m_ObjVec = ObjContainer.GetObjVec();
int size = m_ObjVec.size();
for(int k=0;k<size;k++)
{
vector<CDataPoint>&PtContainer = m_ObjVec[k]->GetPtContainer();
int size1 = PtContainer.size();
for(int i=0;i<size1;i++)
{
if(!gWorkAreaMgr->IsPtInWorkArea(PtContainer[i].GetPt()))
{
Ret = false;
break;
}
}
}
if(!Ret)
{
CMsgBox MsgBox;
MsgBox.Show("ɨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><EFBFBD>ڰ<EFBFBD>ȫ<EFBFBD>ķ<EFBFBD>Χ<EFBFBD><EFBFBD>!");
}
return Ret;
}
#if 1
//<2F><><EFBFBD><EFBFBD>ɨ<EFBFBD><C9A8>·<EFBFBD><C2B7>,SelObjVec <20><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>obj <20><><EFBFBD><EFBFBD>
void CSlotRecipeDataMgr::CreatScanPath(vector<bool> SelObjVec)
{
CObjContainer &ObjContainer = gLayer.GetObjContainer();
ObjContainer.DelAllFillObj();//<2F><>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>obj
ObjContainer.SelObjByIdxVec(SelObjVec);//<2F><><EFBFBD><EFBFBD>obj <20><>ѡ<EFBFBD><D1A1>״̬
gPenParMgr->SetParSelectState(SelObjVec);//<2F><><EFBFBD>ö<EFBFBD>Ӧ<EFBFBD>ʺŵ<CABA>ѡ<EFBFBD><D1A1>״̬
m_CurSelStateVec = SelObjVec;//<2F><>¼<EFBFBD><C2BC>ǰѡ<C7B0><D1A1>״̬
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>obj
gObjFillMgr.FillAllSelObj();
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɺ<EFBFBD>ȡ<EFBFBD><C8A1>ѡ<EFBFBD><D1A1>״̬
//ObjContainer.NotSelAllObj();
//<2F><><EFBFBD>õ<EFBFBD>һ<EFBFBD><D2BB>ѡ<EFBFBD><D1A1><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
gPenParMgr->SetFirstSelPenAsWorkPen();
//<2F><>¼<EFBFBD><C2BC>ǰɨ<C7B0><C9A8><EFBFBD>ߵ<EFBFBD><DFB5><EFBFBD><EFBFBD><EFBFBD>
CScanState &ScanState = gWorkRecordMgr->GetCurScanState();
ScanState.m_TotalScanLineCnt = ObjContainer.GetScanLineCnt();
}
//ͨ<><CDA8><EFBFBD>ƶ<EFBFBD>area <20>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɨ<EFBFBD><C9A8>·<EFBFBD><C2B7>
void CSlotRecipeDataMgr::CreatScanPath(int AreaIdx)
{
vector<bool> SelObjVec;
CObjContainer &ObjContainer = gLayer.GetObjContainer();
int AreaCnt = ObjContainer.GetScanAreaCnt();
for(int k=0;k<AreaCnt;k++)
{
if(AreaIdx==k)
SelObjVec.push_back(true);
else
SelObjVec.push_back(false);
}
CreatScanPath(SelObjVec);
}
//<2F><>ȡѡ<C8A1><D1A1>recipe <20><><EFBFBD>ļ<EFBFBD>·<EFBFBD><C2B7>
CString CSlotRecipeDataMgr::GetSelRecipePath(int idx)
{
CString path;
int size = m_RecipeFilePathVec.size();
if(idx>=0 && idx<size)
{
path = m_RecipeFilePathVec[idx];
}
return path;
}
//<2F>ص<EFBFBD><D8B5><EFBFBD><><C6B5>/<2F><><EFBFBD>߳ߴ<DFB3>---->ɨ<><C9A8><EFBFBD>ٶ<EFBFBD>
double CSlotRecipeDataMgr::CalScanSpeedByOverlapRatio(double OverlapRatio,double Fre)
{
if(Fre<=0 || (OverlapRatio<=0 || OverlapRatio>99.9))
{
return -1;
}
//<2F><>ǰ<EFBFBD><C7B0><EFBFBD>ߵijߴ<C4B3>
DbSize MainSpotSize = gLaser->GetSpotSize(_LaserDeviceType_MainLaser1);
double SpotSize;
if(gLaser->IsbScanByDirX())
SpotSize = MainSpotSize.w;
else
SpotSize = MainSpotSize.h;
double SpotGap = SpotSize*(OverlapRatio/100);
double ScanSpeed = (SpotSize - SpotGap)*Fre;
//Ƶ<><C6B5>Fre = 500
//<2F><><EFBFBD><EFBFBD>X<EFBFBD><58><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SpotSize = 0.686
//<2F>ص<EFBFBD><D8B5><EFBFBD> OverlapRatio = 10%
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>X <20><>ɨ<EFBFBD><C9A8><EFBFBD>ٶ<EFBFBD>ScanSpeed = 308.7
//ScanSpeed = (664.9 - (664.9-623.79))*500; = 311.895
return ScanSpeed;
}
//[<5B><><EFBFBD><EFBFBD><EFBFBD>ܶ<EFBFBD><><C6B5>/<2F><><EFBFBD>߳ߴ<DFB3>]--->[˥<><CBA5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD>Ƕ<EFBFBD>]
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƕȶ<C7B6>Ӧ<EFBFBD><D3A6>Edi
double TestAng = Edi;
double TestEdi = cos(_360ToAngle(2*(TestAng)));
TestEdi *= TestEdi;
TestEdi *= Pow;//pow
TestEdi /= (Fre*LaserSpotX*LaserSpotY);
CString log;
log.Format("Test Edi = %lf",TestEdi);
gLogMgr->WriteDebugLog(log);
*/
//<2F><><EFBFBD>ʽ: Edi = (P(cos2<73><32>)^2)/(F*H*L)
double CSlotRecipeDataMgr::CalRotatoDimmerAng(double LaserSpotX,double LaserSpotY,double Edi,double Fre,double Pow)
{
double Ang = 0;
LaserSpotX *= 0.1;//mm-->cm
LaserSpotY *= 0.1;
double Ret = (LaserSpotX*LaserSpotY);
Ret *= (Edi*Fre);
Ret /= Pow;
Ret = sqrt(Ret);//<2F><><EFBFBD><EFBFBD>
Ret = acos(Ret);//cos<6F>ķ<EFBFBD><C4B7><EFBFBD><EFBFBD>Ǻ<EFBFBD><C7BA><EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>н<EFBFBD>)
Ret /=2;
Ang = Ret/2;
Ang = AngleTo360(Ret);//<2F><><EFBFBD><EFBFBD><EFBFBD>н<EFBFBD>ת<EFBFBD><D7AA>Ϊ360 <20><>
Ang *= -1;
return Ang;
}
//ͨ<><CDA8><EFBFBD>ٶȺ<D9B6>Ƶ<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD>
double CSlotRecipeDataMgr::CalOverlapRatioByScanSpeed(double ScanSpeed,double Fre)
{
if(Fre<=0 || ScanSpeed<=0)
{
return -1;
}
//<2F><>ǰ<EFBFBD><C7B0><EFBFBD>ߵijߴ<C4B3>
DbSize MainSpotSize = gLaser->GetSpotSize(_LaserDeviceType_MainLaser1);
double SpotSize;
if(gLaser->IsbScanByDirX())
SpotSize = MainSpotSize.w;
else
SpotSize = MainSpotSize.h;
double SpotGap = SpotSize - ScanSpeed/Fre;
double OverlapRatio = (SpotGap/SpotSize)*100;
if(OverlapRatio<0 || OverlapRatio>99)
return -1;
return OverlapRatio;
}
#endif
#if 1
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void CSlotRecipeDataMgr::InitScanAreaComb(CComboBox &ComboBox)
{
ComboBox.ResetContent();//<2F><><EFBFBD><EFBFBD>
//<2F><>ȡ<EFBFBD>ӹ<EFBFBD><D3B9>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
vector<CString> Vec;
GetScanAreaName(Vec);
int size = Vec.size();
for(int i=0;i<size;i++)
{
ComboBox.InsertString(i,Vec[i]);
}
}
//ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
bool CSlotRecipeDataMgr::SelScanAreaByName(CString SelScanAreaName)
{
//<2F><>ȡ<EFBFBD>ӹ<EFBFBD><D3B9>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
vector<CString> Vec;
GetScanAreaName(Vec);
int size = Vec.size();
for(int i=0;i<size;i++)
{
if(Vec[i] == SelScanAreaName)
{
SelScanArea(i);
return true;
}
}
return false;
}
//<2F><>ȡ<EFBFBD>ӹ<EFBFBD><D3B9>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void CSlotRecipeDataMgr::GetScanAreaName(vector<CString> &Vec)
{
Vec.clear();
CFileMgr FileMgr;
CString filepath;
//FileMgr.GetFullFilePath(filepath,SCAN_AREA_FILE_PATH);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>·<EFBFBD><C2B7>
filepath = gProgramLaserTuiHuo->GetScanAreaFilePath();
FileMgr.GetChildFileOrDirName(false,filepath,Vec,".obj");
m_ScanAreaPathVec = Vec;//<2F><>¼ <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7>
int size = Vec.size();
for(int i=0;i<size;i++)
{
Vec[i] = FileMgr.GetFileNameFromPath(Vec[i],true);
}
}
//ѡ<><D1A1><EFBFBD>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɨ<EFBFBD><C9A8>·<EFBFBD><C2B7>,<2C><><EFBFBD><EFBFBD>Area <20><><EFBFBD><EFBFBD>)
CString CSlotRecipeDataMgr::SelScanArea(int idx)
{
CString AreaName;
gLayer.DelAllObj();
vector<CString> &ScanAreaPathVec = m_ScanAreaPathVec;
int size = ScanAreaPathVec.size();
for(int i=0;i<size;i++)
{
if(idx == i)
{
CString Path = ScanAreaPathVec[i];
//<2F><><EFBFBD><EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
gWorkFileMgr->ReadObjTemplateFile(Path);
//<2F><>¼<EFBFBD><C2BC>ǰʹ<C7B0>õ<EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CFileMgr FileMgr;
FileMgr.GetFileNameFromPath(Path,true);
AreaName = FileMgr.GetFileNameFromPath(Path,true);
break;
}
}
return AreaName;
}
#endif
#if 1
void CSlotRecipeDataMgr::IniRecipeParList(CListCtrl &list)
{
//<2F><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD>
list.SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int idx = 0;
list.InsertColumn(idx,"Idx",LVCFMT_LEFT,50,-1);
idx++;
list.InsertColumn(idx,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",LVCFMT_LEFT,155,-1);
idx++;
list.InsertColumn(idx,"ֵ",LVCFMT_LEFT,130,-1);
idx++;
vector<CRecipePar> &RecipeParVec = gPenParMgr->GetRecipeParVec();
int size = RecipeParVec.size();
for(int k=0;k<size;k++)
{
int idx = 0;
list.InsertItem(k," ");//<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
list.SetItemText(k,idx++,Int2CString(k+1));//<2F><><EFBFBD><EFBFBD>
list.SetItemText(k,idx++,RecipeParVec[k].m_RecipeParName);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
list.SetItemText(k,idx++,"");//<2F><><EFBFBD><EFBFBD>ֵ
}
}
//<2F><>ȡ<EFBFBD><C8A1>һ<EFBFBD><D2BB>ѡ<EFBFBD><D1A1>obj <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
int CSlotRecipeDataMgr::GetFristSelOutLineObjIdx()
{
vector<CPenPar> &ParVec = gPenParMgr->GetParVec();
int PenParCnt = ParVec.size();
CObjContainer &ObjContainer = gLayer.GetObjContainer();
int ObjCnt = ObjContainer.GetScanAreaCnt();
for(int k=0;(k<ObjCnt)||(k>=PenParCnt);k++)
{
CPenPar &PenPar =ParVec[k];
if(PenPar.m_bSelected)
return k;
}
return -1;
}
#endif
#if 1
void CSlotRecipeDataMgr::InitOffsetTableList(CListCtrl &List)
{
//<2F><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD>
List.SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int idx = 0;
List.InsertColumn(idx,"Idx",LVCFMT_CENTER,35,-1);
idx++;
List.InsertColumn(idx,"ParName",LVCFMT_LEFT,140,-1);
idx++;
List.InsertColumn(idx,"Unit",LVCFMT_CENTER,80,-1);
idx++;
List.InsertColumn(idx,"Value",LVCFMT_LEFT,100,-1);
idx++;
}
void CSlotRecipeDataMgr::UpdateOffsetTableList(CListCtrl &List,CString FilePath)
{
//<2F><><EFBFBD>ļ<EFBFBD><C4BC>ж<EFBFBD>ȡOffsetTable
m_CurEditOffsetTable.ReadOffsetTableFile(FilePath);
//<2F><>ʾ<EFBFBD><CABE><EFBFBD>б<EFBFBD>
vector<COffsetTablePar> &OffsetTableParVec = m_CurEditOffsetTable.m_OffsetTableParVec;
{
List.DeleteAllItems();
int size = OffsetTableParVec.size();
for(int k=0;k<size;k++)
{
int idx = 0;
COffsetTablePar &TablePar = OffsetTableParVec[k];
List.InsertItem(k," ");//<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
List.SetItemText(k,idx++,Int2CString(k+1));//<2F><><EFBFBD><EFBFBD>
List.SetItemText(k,idx++,TablePar.m_ParShowName);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
List.SetItemText(k,idx++,TablePar.m_ParUnit);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ
List.SetItemText(k,idx++,Db2CString(TablePar.m_ParVal));//<2F><><EFBFBD><EFBFBD>ֵ
}
}
}
void CSlotRecipeDataMgr::SaveRcpOffsetTable(CListCtrl &List,CString FilePath)
{
CMsgBox MsgBox;
CFileMgr FileMgr;
vector<COffsetTablePar> &OffsetTableParVec = m_CurEditOffsetTable.m_OffsetTableParVec;
int size = OffsetTableParVec.size();
for(int k=0;k<size;k++)
{
int idx = 0;
COffsetTablePar &TablePar = OffsetTableParVec[k];
CString ParValStr = List.GetItemText(k,OffsetTab_List_Val_Col);
double Val = CStringToDouble(ParValStr);
TablePar.m_ParVal = Val;
gLogMgr->WriteDebugLog(ParValStr);
}
m_CurEditOffsetTable.SaveOffsetTableFile(FilePath);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼
CString Name = FileMgr.GetFileNameFromPath(FilePath,true);
SaveOffsetTableHistory(OffsetTableParVec,"Change",Name);
CString s = FilePath;
s += "\nSave Succes";
MsgBox.Show(s);
}
//<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>µ<EFBFBD>OffsetTable
void CSlotRecipeDataMgr::CreateNewOffsetTable(CString Name)
{
CMsgBox MsgBox;
CString s;
CString Path = gProgramLaserTuiHuo->GetLaipuLaserDataDir(OFFSET_TAB_FILE_PATH);
Path += Name;
Path += ".";
Path += OFFSET_TAB_FILE_SUFFIX;
CFileMgr FileMgr;
if(FileMgr.IsFileExist(Path))
{
s = Name + "<EFBFBD>Ѵ<EFBFBD><EFBFBD><EFBFBD>";
MsgBox.Show(s);
return;
}
COffsetTable OffsetTable;
//д<><D0B4><EFBFBD>ļ<EFBFBD>
OffsetTable.SaveOffsetTableFile(Path);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼
SaveOffsetTableHistory(OffsetTable.m_OffsetTableParVec,"Create",Name);
}
//ɾ<><C9BE>OffsetTable
void CSlotRecipeDataMgr::DelOffsetTable(CString FilePath)
{
CMsgBox MsgBox;
CString s;
CFileMgr FileMgr;
if(!FileMgr.IsFileExist(FilePath))
{
s = FilePath + "\nNot Exist";
MsgBox.Show(s);
return;
}
s = "Delete: \n" + FilePath;
if(MsgBox.ConfirmOkCancel(s))
{
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼
CString Name = FileMgr.GetFileNameFromPath(FilePath,true);
SaveOffsetTableHistory(m_CurEditOffsetTable.m_OffsetTableParVec,"Delete",Name);
CFileMgr FileMgr;
FileMgr.DeleteFolder(FilePath);
}
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼
void CSlotRecipeDataMgr::SaveOffsetTableHistory(vector<COffsetTablePar>&OffsetTableParVec,CString OperateType,CString TableName)
{
CWorkTime WorkTime;
CCsvData CsvData;
CsvData.AddData("User Name",false);
CsvData.AddData(gAuthorityMgr->GetCurUserName(),true);
CsvData.AddData("Operate Time",false);
CsvData.AddData(WorkTime.GetDateTime("/",":"),true);
CsvData.AddData("OperateType",false);
CsvData.AddData(OperateType,true);
CsvData.AddData("Offset Table Name",false);
CsvData.AddData(TableName,true);
int size = OffsetTableParVec.size();
for(int k=0;k<size;k++)
{
COffsetTablePar &TablePar = OffsetTableParVec[k];
CsvData.AddData(TablePar.m_ParShowName,false);
CsvData.AddData(Db2CString(TablePar.m_ParVal),true);
}
CString FileName = WorkTime.GetCurTime("_");
FileName += "_";
FileName += TableName;
CString DataPath = CreatDataTimePath(gProgramLaserTuiHuo->GetLaipuLaserDataDir(OFFSET_TAB_HISTORY_PATH));
CFileMgr FileMgr;
FileMgr.WriteDataToExcel(DataPath,FileName,CsvData,false);
}
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>Offset Table
void CSlotRecipeDataMgr::InitOffsetTableComb(CComboBox &ComboBox)
{
ComboBox.ResetContent();//<2F><><EFBFBD><EFBFBD>
//<2F><>ȡ<EFBFBD>ӹ<EFBFBD><D3B9>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
vector<CString> Vec;
GetOffsetTableName(Vec);
ComboBox.InsertString(0,RECIPE_OFFSET_TBL_NULL);//<2F><>һ<EFBFBD><D2BB>Ϊ<EFBFBD><CEAA>,<2C><>ʾ<EFBFBD><CABE>ѡ<EFBFBD><D1A1>OffsetTable
int size = Vec.size();
for(int i=0;i<size;i++)
{
ComboBox.InsertString(i+1,Vec[i]);
}
}
//<2F><>ȡ<EFBFBD>ӹ<EFBFBD><D3B9>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void CSlotRecipeDataMgr::GetOffsetTableName(vector<CString> &Vec)
{
Vec.clear();
CFileMgr FileMgr;
CString filepath;
filepath = gProgramLaserTuiHuo->GetLaipuLaserDataDir(OFFSET_TAB_FILE_PATH);
FileMgr.GetChildFileOrDirName(false,filepath,Vec,".tbl");
m_OffsetTablePathVec = Vec;//<2F><>¼ <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7>
int size = Vec.size();
for(int i=0;i<size;i++)
{
Vec[i] = FileMgr.GetFileNameFromPath(Vec[i],true);
}
}
//ѡ<><D1A1>OffsetTable
CString CSlotRecipeDataMgr::SelOffsetTable(int idx)
{
idx--;//ȥ<><C8A5>
CString Name = RECIPE_OFFSET_TBL_NULL;
vector<CString> &OffsetTablePathVec = m_OffsetTablePathVec;
int size = OffsetTablePathVec.size();
for(int i=0;i<size;i++)
{
if(idx == i)
{
CString Path = OffsetTablePathVec[i];
CFileMgr FileMgr;
FileMgr.GetFileNameFromPath(Path,true);
Name = FileMgr.GetFileNameFromPath(Path,true);
break;
}
}
return Name;
}
#endif