|
|
|
|
#include "StdAfx.h"
|
|
|
|
|
#include "ProgramCutMgr.h"
|
|
|
|
|
#include "Layer.h"
|
|
|
|
|
#include "DxfReadMgr.h"
|
|
|
|
|
#include "GlobalFunction.h"
|
|
|
|
|
#include "ObjComponentMgr.h"
|
|
|
|
|
#include "ProductMgr.h"
|
|
|
|
|
#include "CommonFlowMgr.h"
|
|
|
|
|
#include "CameraHawkvis.h"
|
|
|
|
|
#include "MsgBox.h"
|
|
|
|
|
#include "PropertieMgr.h"
|
|
|
|
|
#include "WorkTime.h"
|
|
|
|
|
#include "WorkRecord.h"
|
|
|
|
|
#include "WorkFileMgr.h"
|
|
|
|
|
#include "CommandMgr.h"
|
|
|
|
|
#include "EasyOperationMgr.h"
|
|
|
|
|
#include "FileMgr.h"
|
|
|
|
|
#include "LaserDeviceMgr.h"
|
|
|
|
|
#include "MarkParMgr.h"
|
|
|
|
|
#include "CStringFuc.h"
|
|
|
|
|
#include "LogMgr.h"
|
|
|
|
|
#include "ProductMgr.h"
|
|
|
|
|
#include "ObjSortMgr.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define PRODUCT_CNT 1 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
CProgramCutMgr *gProgramCutMgr = new CProgramCutMgr;
|
|
|
|
|
CProgramCutMgr::CProgramCutMgr(void)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
CProgramCutMgr::~CProgramCutMgr(void)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
void CProgramCutMgr::Ini()
|
|
|
|
|
{
|
|
|
|
|
GetFrame()->m_DlgCutDeviceCtrl.SetPar();
|
|
|
|
|
}
|
|
|
|
|
#if 1
|
|
|
|
|
//<2F>ӹ<F2BFAABC><D3B9>ļ<EFBFBD>(bOpenDxf Ϊfalse <20><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD>´<EFBFBD><C2B4><EFBFBD>dxf)
|
|
|
|
|
void CProgramCutMgr::OpenWorkFile(bool bDxf,bool bOpenDxf)
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD>ö<EFBFBD>λ
|
|
|
|
|
gProductMgr->ResetRealMarkPt();
|
|
|
|
|
//ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>obj Ԫ<><D4AA>
|
|
|
|
|
gObjComponentMgr->SetShapeLockState(false);//<2F><EFBFBD>obj <20><><EFBFBD><EFBFBD>
|
|
|
|
|
gObjComponentMgr->DelAll();
|
|
|
|
|
//ɾ<><C9BE>ͼ<EFBFBD>ζ<EFBFBD><CEB6><EFBFBD>
|
|
|
|
|
CLayer &Layer = GetLayerInstance();
|
|
|
|
|
if(bOpenDxf)
|
|
|
|
|
{
|
|
|
|
|
Layer.DelAllObj();
|
|
|
|
|
}
|
|
|
|
|
CObjContainer &ObjContainer = Layer.GetObjContainer();
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (bDxf)
|
|
|
|
|
{
|
|
|
|
|
//<2F><>ȡdxf <20>ļ<EFBFBD>,<2C><><EFBFBD><EFBFBD>layer obj <20><><EFBFBD><EFBFBD>
|
|
|
|
|
if (bOpenDxf)
|
|
|
|
|
{
|
|
|
|
|
gDxfReadMgr->OpenDxfFileDlg(0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else//<2F><><EFBFBD><EFBFBD>mak <20>ļ<EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
OpenMarkFile();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (CString) { return; };
|
|
|
|
|
|
|
|
|
|
Layer.NotSelAllObj();
|
|
|
|
|
gProductMgr->SetDefualtRect(ObjContainer.GetObjRect(false));
|
|
|
|
|
|
|
|
|
|
//<2F><>obj <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
CObjSortMgr ObjSortMgr;
|
|
|
|
|
ObjSortMgr.SortObjByDir(_DIR_R);
|
|
|
|
|
|
|
|
|
|
//ͨ<><CDA8>layer <20><><EFBFBD><EFBFBD>obj <20><><EFBFBD><EFBFBD>
|
|
|
|
|
gObjComponentMgr->CreatObjByLayerObj();
|
|
|
|
|
//<2F><>obj <20>з<EFBFBD><D0B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λmark <20><>λ<EFBFBD><CEBB>
|
|
|
|
|
gObjComponentMgr->AnalyseMarkPt();
|
|
|
|
|
|
|
|
|
|
gCommandMgr.DelAllCmd();//ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>
|
|
|
|
|
}
|
|
|
|
|
//<2F>ƶ<EFBFBD><C6B6>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void CProgramCutMgr::MoveObjData(Dbxy BasePt)
|
|
|
|
|
{
|
|
|
|
|
gLogMgr->WriteDebugLog("CProgramCutMgr::MoveObjData");
|
|
|
|
|
//<2F><><EFBFBD>ö<EFBFBD>λ
|
|
|
|
|
gProductMgr->ResetRealMarkPt();
|
|
|
|
|
//<2F>Ƚ<EFBFBD><C8BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>obj <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
|
|
|
|
|
gObjComponentMgr->SetShapeLockState(false);
|
|
|
|
|
//<2F><>layer obj<62>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD>ǰproduct <20>Ļ<EFBFBD><EFBFBD><D7BC><EFBFBD><EFBFBD>
|
|
|
|
|
gProductMgr->MoveObjToBasePt(BasePt);
|
|
|
|
|
CLayer &Layer = GetLayerInstance();
|
|
|
|
|
CObjContainer ObjContainer = Layer.GetObjContainer();
|
|
|
|
|
ObjContainer.NotSelAllObj();
|
|
|
|
|
gEasyOperationMgr->Refresh();
|
|
|
|
|
//ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>
|
|
|
|
|
gCommandMgr.DelAllCmd();
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
gObjComponentMgr->SetShapeLockState(true);
|
|
|
|
|
//GetCurViewPtr()->RefreshView();
|
|
|
|
|
}
|
|
|
|
|
void CProgramCutMgr::OpenMarkFile()
|
|
|
|
|
{
|
|
|
|
|
CWorkFileMgr WorkFileMgr;
|
|
|
|
|
WorkFileMgr.OnOpenFile();
|
|
|
|
|
gDrawPropertieMgr.SaveAllPropertie();
|
|
|
|
|
gDevicePropertieMgr.SaveAllPropertie();
|
|
|
|
|
}
|
|
|
|
|
void CProgramCutMgr::SaveMarkFile()
|
|
|
|
|
{
|
|
|
|
|
CWorkFileMgr WorkFileMgr;
|
|
|
|
|
WorkFileMgr.OnSaveFileAs();
|
|
|
|
|
}
|
|
|
|
|
//ͨ<><CDA8>ͼ<EFBFBD><CDBC>ֱ<EFBFBD>ӱ<EFBFBD><D3B1><EFBFBD>Ϊmak (<28><>Ҫ<EFBFBD><D2AA>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD>dxf <20>ļ<EFBFBD>)
|
|
|
|
|
void CProgramCutMgr::SaveMarkFile2()
|
|
|
|
|
{
|
|
|
|
|
OpenWorkFile(true,false);
|
|
|
|
|
CWorkFileMgr WorkFileMgr;
|
|
|
|
|
WorkFileMgr.OnSaveFileAs();
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
#if 1
|
|
|
|
|
//<2F><>ʼ<EFBFBD><CABC><EFBFBD>豸
|
|
|
|
|
bool CProgramCutMgr::InitDevice()
|
|
|
|
|
{
|
|
|
|
|
if(gCommonFlowMgr->InitDevice())
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
//<2F>ƶ<EFBFBD>ƽ̨֮ǰ<D6AE>IJ<EFBFBD><C4B2><EFBFBD>(<28><>Ҫ<EFBFBD><D2AA>Ҫͣ<D2AA><CDA3>ռcpu <20>Ĺ<EFBFBD><C4B9><EFBFBD>)
|
|
|
|
|
void CProgramCutMgr::OnPlatformMoveStart()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
void CProgramCutMgr::OnPlatformMoveEnd()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
void CProgramCutMgr::CameraCatchTwoMark()
|
|
|
|
|
{
|
|
|
|
|
//<2F><>ץһ֡,<2C><>CCD ͣ<><CDA3>
|
|
|
|
|
//gCommonFlowMgr->CameraCatch();
|
|
|
|
|
gCommonFlowMgr->CameraCatchTwoMark();
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ӹ<EFBFBD>
|
|
|
|
|
bool CProgramCutMgr::StartWork(CProduct &Product,bool bSel)
|
|
|
|
|
{
|
|
|
|
|
/* CMsgBox MsgBox;
|
|
|
|
|
if(Product.IsMarkReady())
|
|
|
|
|
{*/
|
|
|
|
|
//gWorkRecordMgr->SetStartWorkTime(gWorkTime.GetCurTime(":"));
|
|
|
|
|
if(gCommonFlowMgr->MultipleAreaMark(Product,bSel))
|
|
|
|
|
{
|
|
|
|
|
//gWorkRecordMgr->SetEndWorkTime(gWorkTime.GetCurTime(":"));
|
|
|
|
|
//CString WorkTime = gWorkTime.GetTimeSpanStr();//<2F>ӹ<EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
|
|
//gWorkRecordMgr->SetWorkTime(WorkTime);
|
|
|
|
|
//gWorkRecordMgr->WriteRecordToFile();//<2F><>¼<EFBFBD>ӹ<EFBFBD><D3B9>ļ<EFBFBD>
|
|
|
|
|
//Product.ResetRealMarkPt();
|
|
|
|
|
//<2F><>¼<EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
|
|
//gWorkTime.SaveLastWorkTime();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
/*}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MsgBox.Show("<EFBFBD><EFBFBD><EFBFBD>Ƚ<EFBFBD><EFBFBD>ж<EFBFBD>λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}*/
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
#if 1
|
|
|
|
|
//<2F><><EFBFBD>浱ǰ<E6B5B1><EFBFBD>dxf <20>ļ<EFBFBD><C4BC><EFBFBD>Ӧ<EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>
|
|
|
|
|
void CProgramCutMgr::SaveWorkParFile()
|
|
|
|
|
{
|
|
|
|
|
CString OpenFileName = GetCurOpenFileName();
|
|
|
|
|
if(OpenFileName != "")
|
|
|
|
|
{
|
|
|
|
|
CString FileName = "\\WorkPar\\"+OpenFileName+".txt";
|
|
|
|
|
CFileMgr FileMgr;
|
|
|
|
|
char filepath[1024];
|
|
|
|
|
FileMgr.GetFullFilePath(filepath,FileName);
|
|
|
|
|
|
|
|
|
|
ofstream file;
|
|
|
|
|
file.open(filepath);
|
|
|
|
|
//<2F><>λ<EFBFBD>Ļ<EFBFBD><EFBFBD><D7BC>
|
|
|
|
|
vector<CProduct> &ProductVec = gProductMgr->GetProductVec();
|
|
|
|
|
int ProductCnt = ProductVec.size();
|
|
|
|
|
file<<ProductCnt<<"\n";
|
|
|
|
|
for(int k=0;k<ProductCnt;k++)
|
|
|
|
|
{
|
|
|
|
|
Dbxy pt = ProductVec[k].GetProductBasePt();
|
|
|
|
|
file<<pt.x<<"\n";
|
|
|
|
|
file<<pt.y<<"\n";
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
file<<gCLaserDeviceMgr->GetPower()<<"\n";//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
file<<gCLaserDeviceMgr->GetLaserFre()<<"\n";//<2F><><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>
|
|
|
|
|
CMarkPar& MarkPar = gMarkParMgr->GetCurPen();
|
|
|
|
|
file<<MarkPar.ms<<"\n";//<2F>и<EFBFBD><D0B8>ٶ<EFBFBD>
|
|
|
|
|
file<<gCommonFlowMgr->GetOneObjMarkCnt()<<"\n";//<2F>и<EFBFBD><D0B8><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
file<<gCommonFlowMgr->GetAreaCycleCnt()<<"\n";//ѭ<><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><EFBFBD>dxf <20>ļ<EFBFBD><C4BC><EFBFBD>Ӧ<EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>
|
|
|
|
|
void CProgramCutMgr::ReadWorkParFile()
|
|
|
|
|
{
|
|
|
|
|
CString OpenFileName = GetCurOpenFileName();
|
|
|
|
|
if(OpenFileName != "")
|
|
|
|
|
{
|
|
|
|
|
CString FileName = "\\WorkPar\\"+OpenFileName+".txt";
|
|
|
|
|
CFileMgr FileMgr;
|
|
|
|
|
CString filepath;
|
|
|
|
|
FileMgr.GetFullFilePath(filepath,FileName);
|
|
|
|
|
|
|
|
|
|
if(FileMgr.IsFileExist(filepath))
|
|
|
|
|
{
|
|
|
|
|
vector<CString> vec;
|
|
|
|
|
FileMgr.ReadFileToStringVec(filepath,vec);
|
|
|
|
|
int size = vec.size();
|
|
|
|
|
int k = 0;
|
|
|
|
|
int ParIdx = 1;
|
|
|
|
|
while(k<size)
|
|
|
|
|
{
|
|
|
|
|
if(k==0)
|
|
|
|
|
{
|
|
|
|
|
int ProductCnt = CStringToInt(vec[k++]);
|
|
|
|
|
vector<CProduct> &ProductVec = gProductMgr->GetProductVec();
|
|
|
|
|
int ProductCnt2 = ProductVec.size();
|
|
|
|
|
if(ProductCnt != ProductCnt2)
|
|
|
|
|
{
|
|
|
|
|
gLogMgr->WriteDebugLog("ReadWorkParFile <20><><EFBFBD><EFBFBD>product <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
for(int i=0;i<ProductCnt;i++)
|
|
|
|
|
{
|
|
|
|
|
Dbxy pt;
|
|
|
|
|
pt.x = CStringToDouble(vec[k++]);
|
|
|
|
|
pt.y = CStringToDouble(vec[k++]);
|
|
|
|
|
ProductVec[i].SetBasePt(pt);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if(ParIdx == 1)
|
|
|
|
|
gCLaserDeviceMgr->SetPower(CStringToDouble(vec[k++]));
|
|
|
|
|
else if(ParIdx == 2)
|
|
|
|
|
gCLaserDeviceMgr->SetFre(CStringToInt(vec[k++]));
|
|
|
|
|
else if(ParIdx == 3)
|
|
|
|
|
{
|
|
|
|
|
CMarkPar& MarkPar = gMarkParMgr->GetCurPen();
|
|
|
|
|
MarkPar.ms = CStringToDouble(vec[k++]);//<2F>и<EFBFBD><D0B8>ٶ<EFBFBD>
|
|
|
|
|
gMarkParMgr->SaveCurPen(MarkPar);
|
|
|
|
|
}
|
|
|
|
|
else if(ParIdx == 4)
|
|
|
|
|
gCommonFlowMgr->SetOneObjMarkCnt(CStringToInt(vec[k++]));
|
|
|
|
|
else if(ParIdx == 5)
|
|
|
|
|
gCommonFlowMgr->SetAreaCycleCnt(CStringToInt(vec[k++]));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ParIdx++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
#if 1
|
|
|
|
|
//<2F>Ѽ<EFBFBD><D1BC><EFBFBD><EFBFBD><EFBFBD>Դ
|
|
|
|
|
void CProgramCutMgr::CollectSrcWorkData()
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֮ǰ<D6AE><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
gMarkAreaMgr->ClearSrcWorkData();
|
|
|
|
|
int ProductCnt = PRODUCT_CNT;
|
|
|
|
|
for(int k=ProductCnt-1;k>=0;k--)
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ݶ<EFBFBD><DDB6><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD>product k <20>Ļ<EFBFBD><EFBFBD><D7BC><EFBFBD><EFBFBD>
|
|
|
|
|
CProduct &Product = gProductMgr->GetProduct(k);
|
|
|
|
|
MoveObjData(Product.GetProductBasePt());
|
|
|
|
|
//<2F>Ѽ<EFBFBD><D1BC><EFBFBD><EFBFBD><EFBFBD>Դ
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD><EFBFBD>Ѽ<EFBFBD>״̬
|
|
|
|
|
gObjComponentMgr->ResetObjCollectState(false);
|
|
|
|
|
gMarkAreaMgr->CollectSrcWorkData();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|