|
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
|
|
#include "LaiPuLaser.h"
|
|
|
|
|
#include "DlgCutDeviceCtrl.h"
|
|
|
|
|
#include "afxdialogex.h"
|
|
|
|
|
#include "MsgBox.h"
|
|
|
|
|
#include "AuthorityMgr.h"
|
|
|
|
|
#include "DlgAuthorityMgr.h"
|
|
|
|
|
#include "ProgramCutMgr.h"
|
|
|
|
|
#include "CommonFlowMgr.h"
|
|
|
|
|
#include "ProgramCutMgr.h"
|
|
|
|
|
#include "PlatformXY.h"
|
|
|
|
|
#include "ProductMgr.h"
|
|
|
|
|
#include "LaserDeviceMgr.h"
|
|
|
|
|
#include "MarkParMgr.h"
|
|
|
|
|
#include "PropertieMgr.h"
|
|
|
|
|
#include "Propertie.h"
|
|
|
|
|
#include "WorkTime.h"
|
|
|
|
|
#include "MsgBox.h"
|
|
|
|
|
#include "EncryptionMgr.h"
|
|
|
|
|
#include "PciCh365Mgr.h"
|
|
|
|
|
#include "CStringFuc.h"
|
|
|
|
|
#include "WorkCmdContainer.h"
|
|
|
|
|
#include "MarkAreaMgr.h"
|
|
|
|
|
//#include "SuperDogMgr.h"
|
|
|
|
|
#include "ObjComponentMgr.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_DYNAMIC(DlgCutDeviceCtrl, CDialogEx)
|
|
|
|
|
BEGIN_MESSAGE_MAP(DlgCutDeviceCtrl, CDialogEx)
|
|
|
|
|
ON_WM_TIMER()
|
|
|
|
|
ON_BN_CLICKED(IDC_INI_DEVICE_BTN, &DlgCutDeviceCtrl::OnBnClickedIniDeviceBtn)
|
|
|
|
|
ON_BN_CLICKED(IDC_OPEN_DXF, &DlgCutDeviceCtrl::OnBnClickedOpenDxfWorkFile)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ON_BN_CLICKED(IDC_START_WORK, &DlgCutDeviceCtrl::OnBnClickedStartWork)
|
|
|
|
|
ON_BN_CLICKED(IDC_BOOL_SEL_MARK, &DlgCutDeviceCtrl::OnBnClickedSelectedMark)
|
|
|
|
|
ON_BN_CLICKED(IDC_SAVE_PAR, &DlgCutDeviceCtrl::OnBnClickedSavePar)
|
|
|
|
|
ON_BN_CLICKED(IDC_OPEN_MAK, &DlgCutDeviceCtrl::OnBnClickedOpenMarkFile)
|
|
|
|
|
ON_BN_CLICKED(IDC_PRODUCT_1, &DlgCutDeviceCtrl::OnBnClickedProduct1)
|
|
|
|
|
ON_BN_CLICKED(IDC_PRODUCT_2, &DlgCutDeviceCtrl::OnBnClickedProduct2)
|
|
|
|
|
ON_BN_CLICKED(IDC_PRODUCT_3, &DlgCutDeviceCtrl::OnBnClickedProduct3)
|
|
|
|
|
ON_BN_CLICKED(IDC_PRODUCT_4, &DlgCutDeviceCtrl::OnBnClickedProduct4)
|
|
|
|
|
|
|
|
|
|
ON_BN_CLICKED(IDC_ADJUST_PRODUCT_POS, &DlgCutDeviceCtrl::OnBnClickedAdjustProductPos)
|
|
|
|
|
END_MESSAGE_MAP()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define WORK_TIMER1 1
|
|
|
|
|
#define WORK_TIME_DELAY1 200
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define WORK_TIMER2 2
|
|
|
|
|
#define WORK_TIME_DELAY2 200
|
|
|
|
|
|
|
|
|
|
#define WORK_TIMER3 3
|
|
|
|
|
#define WORK_TIME_DELAY3 200
|
|
|
|
|
|
|
|
|
|
#define WORK_TIMER5 5
|
|
|
|
|
#define WORK_TIME_DELAY5 200
|
|
|
|
|
|
|
|
|
|
#define LASER_INFO_TIMER 6
|
|
|
|
|
#define LASER_INFO_TIMER_DELAY5 500
|
|
|
|
|
|
|
|
|
|
bool gbSelMark = false;
|
|
|
|
|
|
|
|
|
|
DlgCutDeviceCtrl::DlgCutDeviceCtrl(CWnd* pParent /*=NULL*/)
|
|
|
|
|
{
|
|
|
|
|
m_LaserPower = 7.5;//<2F><><EFBFBD><EFBFBD>ֵ
|
|
|
|
|
m_LaserFre = 50000;
|
|
|
|
|
m_LaserSpeed =300;
|
|
|
|
|
m_CutCount = 1;//<2F>и<EFBFBD><D0B8><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
m_MarkAreaCutCount = 1;
|
|
|
|
|
m_RotatoAdjust = 0;//<2F><>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>mm
|
|
|
|
|
m_CurWorkStep = 0;
|
|
|
|
|
m_CurProductIdx = -1;//<2F><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
DlgCutDeviceCtrl::~DlgCutDeviceCtrl()
|
|
|
|
|
{
|
|
|
|
|
m_CurWorkStep = 0;
|
|
|
|
|
}
|
|
|
|
|
void DlgCutDeviceCtrl::DoDataExchange(CDataExchange* pDX)
|
|
|
|
|
{
|
|
|
|
|
CDialogEx::DoDataExchange(pDX);
|
|
|
|
|
|
|
|
|
|
DDX_Control(pDX, IDC_OPEN_DXF, m_ReadDxfBtn);
|
|
|
|
|
DDX_Control(pDX, IDC_INI_DEVICE_BTN, m_IniDeviceBtn);
|
|
|
|
|
DDX_Control(pDX, IDC_START_WORK, m_StartWorkBtn);
|
|
|
|
|
DDX_Control(pDX, IDC_BOOL_SEL_MARK, m_SelMarkBtn);
|
|
|
|
|
DDX_Control(pDX, IDC_SAVE_PAR, m_SaveParBtn);
|
|
|
|
|
DDX_Control(pDX, IDC_OPEN_MAK, m_ReadMarkBtn);
|
|
|
|
|
DDX_Control(pDX, IDC_SAVE_MAK, m_SaveMarkBtn);
|
|
|
|
|
|
|
|
|
|
DDX_Control(pDX, IDC_PRODUCT_1, m_ProductBtn1);
|
|
|
|
|
DDX_Control(pDX, IDC_PRODUCT_2, m_ProductBtn2);
|
|
|
|
|
DDX_Control(pDX, IDC_PRODUCT_3, m_ProductBtn3);
|
|
|
|
|
DDX_Control(pDX, IDC_PRODUCT_4, m_ProductBtn4);
|
|
|
|
|
DDX_Control(pDX, IDC_ADJUST_PRODUCT_POS, m_AdjustProductPosBtn);
|
|
|
|
|
|
|
|
|
|
DDX_Text(pDX, IDC_LAESR_DIODE, m_LaserPower);
|
|
|
|
|
DDX_Text(pDX, IDC_LASER_FRE, m_LaserFre);
|
|
|
|
|
DDX_Text(pDX, IDC_CUT_SPEED, m_LaserSpeed);
|
|
|
|
|
DDX_Text(pDX, IDC_CUT_CNT, m_CutCount);
|
|
|
|
|
DDX_Text(pDX, IDC_SIZE_ADJUST, m_SizeAdjust.x);
|
|
|
|
|
DDX_Text(pDX, IDC_SIZE_ADJUSTY, m_SizeAdjust.y);
|
|
|
|
|
DDX_Text(pDX, IDC_CUR_WORK_TIME, m_CurWorkTimes);
|
|
|
|
|
DDX_Text(pDX, IDC_TOTAL_WORK_TIME, m_TotalWorkTimes);
|
|
|
|
|
DDX_Text(pDX, IDC_WORK_TIME, m_WorkTime);
|
|
|
|
|
DDX_Text(pDX, IDC_POS_ADJUSTX, m_OffsetAdjust.x);
|
|
|
|
|
DDX_Text(pDX, IDC_POS_ADJUSTY, m_OffsetAdjust.y);
|
|
|
|
|
DDX_Text(pDX, IDC_AREA_CUT_CNT, m_MarkAreaCutCount);
|
|
|
|
|
|
|
|
|
|
DDX_Text(pDX, IDC_ROTATO_ADJUST, m_RotatoAdjust);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BOOL DlgCutDeviceCtrl::OnInitDialog()
|
|
|
|
|
{
|
|
|
|
|
CDialogEx::OnInitDialog();
|
|
|
|
|
|
|
|
|
|
m_IniDeviceBtn.SetUpColor(RGB_RED);
|
|
|
|
|
m_EndInspectionBtn.SetUpColor(RGB_BLUE1);
|
|
|
|
|
m_SelMarkBtn.SetUpColor(RGB_GRAY1);
|
|
|
|
|
m_StartWorkBtn.SetUpColor(RGB_GREEN);
|
|
|
|
|
m_AdjustProductPosBtn.SetUpColor(RGB_PINK);
|
|
|
|
|
|
|
|
|
|
UpdateInfo();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//SetTimer(WORK_TIMER3,WORK_TIME_DELAY3,NULL);
|
|
|
|
|
|
|
|
|
|
//SetTimer(LASER_INFO_TIMER,LASER_INFO_TIMER_DELAY5,NULL);
|
|
|
|
|
UpdateData(FALSE);
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
#if 1
|
|
|
|
|
//<2F>۲<EFBFBD>ƽ̨<C6BD><CCA8><EFBFBD><EFBFBD><EFBFBD>ı仯
|
|
|
|
|
void DlgCutDeviceCtrl::UpdateInfo()
|
|
|
|
|
{
|
|
|
|
|
m_CurWorkTimes = gProductMgr->GetCurWorkTimes();
|
|
|
|
|
m_TotalWorkTimes = gProductMgr->GetTotalWorkTimes();
|
|
|
|
|
m_WorkTime = gWorkTime.GetTimeSpanStr();
|
|
|
|
|
m_OffsetAdjust = gCommonFlowMgr->GetAdjustOffset();
|
|
|
|
|
m_SizeAdjust = gCommonFlowMgr->GetAdjustSize();
|
|
|
|
|
m_RotatoAdjust = gCommonFlowMgr->GetRotatoAdjust();//<2F><>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>
|
|
|
|
|
m_MarkAreaCutCount = gCommonFlowMgr->GetAreaCycleCnt();
|
|
|
|
|
UpdateData(FALSE);
|
|
|
|
|
}
|
|
|
|
|
void DlgCutDeviceCtrl::Update()
|
|
|
|
|
{
|
|
|
|
|
SetTimer(WORK_TIMER1,WORK_TIME_DELAY1,NULL);//<2F><>timer<65><72><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD><C2A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ᱨ<EFBFBD><E1B1A8>
|
|
|
|
|
}
|
|
|
|
|
void DlgCutDeviceCtrl::OnTimer(UINT nIDEvent)
|
|
|
|
|
{
|
|
|
|
|
if(nIDEvent == WORK_TIMER1)
|
|
|
|
|
{
|
|
|
|
|
UpdateInfo();
|
|
|
|
|
KillTimer(WORK_TIMER1);
|
|
|
|
|
}
|
|
|
|
|
if(nIDEvent == WORK_TIMER2)//<2F><><EFBFBD><EFBFBD><EFBFBD>ӹ<EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
KillTimer(WORK_TIMER2);
|
|
|
|
|
AutoWork();
|
|
|
|
|
}
|
|
|
|
|
if(nIDEvent == WORK_TIMER3)//<2F><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>Ҫ<EFBFBD>ӹ<EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
SetProductBtnState();
|
|
|
|
|
CheckStartState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(nIDEvent == WORK_TIMER5)//<2F>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӹ<EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
KillTimer(WORK_TIMER5);
|
|
|
|
|
OnBnClickedStartWork();
|
|
|
|
|
}
|
|
|
|
|
if(nIDEvent == LASER_INFO_TIMER)//<2F><><EFBFBD>⼤<EFBFBD><E2BCA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
#ifdef __READ_LASER_DEVICE_INFO__
|
|
|
|
|
//<2F><><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UpdateLaserParInfo();
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
CDialog::OnTimer(nIDEvent);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
#if 1
|
|
|
|
|
void DlgCutDeviceCtrl::OnBnClickedIniDeviceBtn()
|
|
|
|
|
{
|
|
|
|
|
if(gAuthorityMgr->CheckAuthority(_USER,true)==false)
|
|
|
|
|
return;
|
|
|
|
|
if(gProgramCutMgr->InitDevice())
|
|
|
|
|
{
|
|
|
|
|
m_IniDeviceBtn.SetUpColor(RGB_GREEN);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_IniDeviceBtn.SetUpColor(RGB_RED);
|
|
|
|
|
}
|
|
|
|
|
m_IniDeviceBtn.Refreash();
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
#if 1
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>dxf <20>ļ<EFBFBD>--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӹ<EFBFBD>ԭ<EFBFBD><D4AD>
|
|
|
|
|
void DlgCutDeviceCtrl::OnBnClickedOpenDxfWorkFile()
|
|
|
|
|
{
|
|
|
|
|
if(gAuthorityMgr->CheckAuthority(_USER,true)==false)
|
|
|
|
|
return;
|
|
|
|
|
OpenWorkFile(true);
|
|
|
|
|
}
|
|
|
|
|
void DlgCutDeviceCtrl::OnBnClickedOpenMarkFile()
|
|
|
|
|
{
|
|
|
|
|
if(gAuthorityMgr->CheckAuthority(_USER,true)==false)
|
|
|
|
|
return;
|
|
|
|
|
OpenWorkFile(false);
|
|
|
|
|
}
|
|
|
|
|
void DlgCutDeviceCtrl::OpenWorkFile(bool bDxf)
|
|
|
|
|
{
|
|
|
|
|
if(gAuthorityMgr->CheckAuthority(_USER,true)==false)
|
|
|
|
|
return;
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
gProgramCutMgr->OpenWorkFile(bDxf);
|
|
|
|
|
//<2F><>ȡ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>ļӹ<C4BC><D3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
|
|
|
|
gProgramCutMgr->ReadWorkParFile();
|
|
|
|
|
gDevicePropertieMgr.SaveAllPropertie();
|
|
|
|
|
//<2F><><EFBFBD>ò<EFBFBD><C3B2><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
SetPar();
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>Ѽ<EFBFBD><D1BC><EFBFBD><EFBFBD><EFBFBD>Դ
|
|
|
|
|
//gProgramCutMgr->CollectSrcWorkData();
|
|
|
|
|
|
|
|
|
|
UpdateInfo();
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
#if 1
|
|
|
|
|
void DlgCutDeviceCtrl::SetProductBtnState()
|
|
|
|
|
{
|
|
|
|
|
vector<CProduct> &ProductVec = gProductMgr->GetProductVec();
|
|
|
|
|
int size = ProductVec.size();
|
|
|
|
|
for(int k=0;k<size;k++)
|
|
|
|
|
{
|
|
|
|
|
if(k==0)
|
|
|
|
|
SetProductBtnStateExt(m_ProductBtn1,ProductVec[k].IsUsed());
|
|
|
|
|
else if(k==1)
|
|
|
|
|
SetProductBtnStateExt(m_ProductBtn2,ProductVec[k].IsUsed());
|
|
|
|
|
else if(k==2)
|
|
|
|
|
SetProductBtnStateExt(m_ProductBtn3,ProductVec[k].IsUsed());
|
|
|
|
|
else if(k==3)
|
|
|
|
|
SetProductBtnStateExt(m_ProductBtn4,ProductVec[k].IsUsed());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void DlgCutDeviceCtrl::SetProductBtnStateExt(CMyBttom &btn,bool b)
|
|
|
|
|
{
|
|
|
|
|
if(b)
|
|
|
|
|
btn.SetUpColor(RGB_YELLOW);
|
|
|
|
|
else
|
|
|
|
|
btn.SetUpColor(RGB_GRAY1);
|
|
|
|
|
btn.Refreash();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DlgCutDeviceCtrl::OnBnClickedProduct1()
|
|
|
|
|
{
|
|
|
|
|
OnBnClickedProduct(0);
|
|
|
|
|
}
|
|
|
|
|
void DlgCutDeviceCtrl::OnBnClickedProduct2()
|
|
|
|
|
{
|
|
|
|
|
OnBnClickedProduct(1);
|
|
|
|
|
}
|
|
|
|
|
void DlgCutDeviceCtrl::OnBnClickedProduct3()
|
|
|
|
|
{
|
|
|
|
|
OnBnClickedProduct(2);
|
|
|
|
|
}
|
|
|
|
|
void DlgCutDeviceCtrl::OnBnClickedProduct4()
|
|
|
|
|
{
|
|
|
|
|
OnBnClickedProduct(3);
|
|
|
|
|
}
|
|
|
|
|
void DlgCutDeviceCtrl::OnBnClickedProduct(int idx)
|
|
|
|
|
{
|
|
|
|
|
vector<CProduct> &ProductVec = gProductMgr->GetProductVec();
|
|
|
|
|
int size = ProductVec.size();
|
|
|
|
|
if(size>idx)
|
|
|
|
|
{
|
|
|
|
|
bool b = ProductVec[idx].IsUsed();
|
|
|
|
|
ProductVec[idx].SetUsed(!b);
|
|
|
|
|
SetProductBtnState();
|
|
|
|
|
gDevicePropertieMgr.SaveAllPropertie();
|
|
|
|
|
|
|
|
|
|
int ProductCnt = gProductMgr->GetUsedProductCnt();
|
|
|
|
|
if(ProductCnt == 1)
|
|
|
|
|
{
|
|
|
|
|
int size = ProductVec.size();
|
|
|
|
|
for(int i=0;i<size;i++)
|
|
|
|
|
{
|
|
|
|
|
if(ProductVec[i].IsUsed())
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD>ǰproduct <20>Ļ<EFBFBD><EFBFBD><D7BC><EFBFBD><EFBFBD>
|
|
|
|
|
Dbxy CurBasePt = ProductVec[i].GetProductBasePt();
|
|
|
|
|
gProgramCutMgr->MoveObjData(CurBasePt);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GetCurViewPtr()->RefreshView();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7>ץȡƫ<C8A1><C6AB>λ<EFBFBD><CEBB>
|
|
|
|
|
void DlgCutDeviceCtrl::OnBnClickedAdjustProductPos()
|
|
|
|
|
{
|
|
|
|
|
CMsgBox MsgBox;
|
|
|
|
|
if(MsgBox.ConfirmOkCancel("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ץȡƫ<EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD>?")==false)
|
|
|
|
|
return;
|
|
|
|
|
gProductMgr->SetProductCenterPt();
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
gProgramCutMgr->SaveWorkParFile();
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
#if 1
|
|
|
|
|
//ѡ<><D1A1><EFBFBD>ӹ<EFBFBD>
|
|
|
|
|
void DlgCutDeviceCtrl::OnBnClickedSelectedMark()
|
|
|
|
|
{
|
|
|
|
|
if(gAuthorityMgr->CheckAuthority(_USER,true)==false)
|
|
|
|
|
return;
|
|
|
|
|
gbSelMark = !gbSelMark;
|
|
|
|
|
if(gbSelMark)
|
|
|
|
|
m_SelMarkBtn.SetUpColor(RGB_YELLOW);
|
|
|
|
|
else
|
|
|
|
|
m_SelMarkBtn.SetUpColor(RGB_GRAY1);
|
|
|
|
|
}
|
|
|
|
|
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
|
|
|
|
|
void DlgCutDeviceCtrl::OnBnClickedStartWork()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if(gEncryptionMgr->CheckLockState()==false)
|
|
|
|
|
{
|
|
|
|
|
CMsgBox MsgBox;
|
|
|
|
|
MsgBox.Show("<EFBFBD>豸ʹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>Ӧ<EFBFBD><D3A6>!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(gAuthorityMgr->CheckAuthority(_USER,true)==false)
|
|
|
|
|
return;
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if(m_CurWorkStep != 0)
|
|
|
|
|
return;
|
|
|
|
|
//<2F>ӹ<EFBFBD>ǰ<EFBFBD><C7B0>ʾ
|
|
|
|
|
if(gCommonFlowMgr->StartWorkConfirm(gbSelMark)==false)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
m_CurProductIdx = -1;
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>product <20><>״̬(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>product)
|
|
|
|
|
gProductMgr->UpdateProductState();
|
|
|
|
|
//ȡ<><C8A1>ֹͣ״̬
|
|
|
|
|
gCommonFlowMgr->SetbWorkStop(false);
|
|
|
|
|
//<2F><><EFBFBD>õ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ӹ<EFBFBD><D3B9><EFBFBD>product <20><><EFBFBD><EFBFBD>
|
|
|
|
|
gProductMgr->SetCurProductIdx(0);
|
|
|
|
|
}
|
|
|
|
|
//<2F>Զ<EFBFBD><D4B6>ӹ<EFBFBD>(ÿ<>μӹ<CEBC>һ<EFBFBD><D2BB>product )
|
|
|
|
|
void DlgCutDeviceCtrl::AutoWork()
|
|
|
|
|
{
|
|
|
|
|
if(gCommonFlowMgr->IsbWorkStop())
|
|
|
|
|
{
|
|
|
|
|
m_CurWorkStep = 0;
|
|
|
|
|
}
|
|
|
|
|
int Idx = gProductMgr->GetCurProductIdx();
|
|
|
|
|
if(Idx<0)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
CProduct &Product = gProductMgr->GetProduct(Idx);
|
|
|
|
|
if(Product.IsUsed()==false)//<2F><><EFBFBD>˵<EFBFBD><CBB5><EFBFBD>ʹ<EFBFBD>õ<EFBFBD>product
|
|
|
|
|
{
|
|
|
|
|
m_CurWorkStep = 0;
|
|
|
|
|
}
|
|
|
|
|
if(m_CurWorkStep == 1)//ץȡ<D7A5><C8A1>λ1
|
|
|
|
|
{
|
|
|
|
|
//<2F><>ץһ֡,<2C><>CCD ͣ<><CDA3>
|
|
|
|
|
if(Idx ==0)//<2F><>һ<EFBFBD><D2BB>product
|
|
|
|
|
{
|
|
|
|
|
gWorkTime.StartRecordTime();//<2F><>ʱ<EFBFBD><CAB1>ʼ
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD>ǰproduct <20>Ļ<EFBFBD><EFBFBD><D7BC><EFBFBD><EFBFBD>
|
|
|
|
|
gProgramCutMgr->MoveObjData(Product.GetProductBasePt());
|
|
|
|
|
gCommonFlowMgr->CameraCatchTwoMark(Product);//ֻץȡһ<C8A1><D2BB><EFBFBD><EFBFBD>
|
|
|
|
|
if(Product.IsSetRealMarkPt1())
|
|
|
|
|
{
|
|
|
|
|
m_CurWorkStep = 2;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_CurWorkStep = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if(m_CurWorkStep == 2)//ץȡ<D7A5><C8A1>λ2
|
|
|
|
|
{
|
|
|
|
|
gCommonFlowMgr->CameraCatchTwoMark(Product);
|
|
|
|
|
if(Product.IsMarkReady())
|
|
|
|
|
{
|
|
|
|
|
m_CurWorkStep = 3;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_CurWorkStep = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if(m_CurWorkStep == 3)//<2F><>ʼ<EFBFBD>и<EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
if(Product.IsMarkReady())
|
|
|
|
|
{
|
|
|
|
|
if(!gbSelMark)//ȫ<><C8AB><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>ֱ<EFBFBD><D6B1>ȫ<EFBFBD><C8AB>ѡ<EFBFBD><D1A1>2018-04-20
|
|
|
|
|
{
|
|
|
|
|
gObjComponentMgr->SelAllObj();
|
|
|
|
|
}
|
|
|
|
|
gProgramCutMgr->StartWork(Product,true);
|
|
|
|
|
CLayer &layer = GetLayerInstance();
|
|
|
|
|
CObjContainer ObjContainer = layer.GetObjContainer();
|
|
|
|
|
ObjContainer.NotSelAllObj();
|
|
|
|
|
}
|
|
|
|
|
m_CurWorkStep = 0;//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
if(m_CurWorkStep == 0)//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
gProductMgr->CurProductIdxInc();//product <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ++
|
|
|
|
|
if(gProductMgr->GetCurProductIdx()<0)//<2F><><EFBFBD><EFBFBD>product <20>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
//<2F>ƶ<EFBFBD><C6B6><EFBFBD>Ĭ<EFBFBD>ϵ<EFBFBD>λ<EFBFBD><CEBB>
|
|
|
|
|
gProgramCutMgr->MoveObjData(Dbxy(0,0));
|
|
|
|
|
gCommonFlowMgr->SetLightStateCmd(false);
|
|
|
|
|
gWorkTime.StopRecordTime();//ֹͣ<CDA3><D6B9>ʱ
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD>product 0 <20>Ļ<EFBFBD><EFBFBD><D7BC><EFBFBD><EFBFBD>
|
|
|
|
|
CProduct &Product0 = gProductMgr->GetProduct(0);
|
|
|
|
|
gProgramCutMgr->MoveObjData(Product0.GetProductBasePt());
|
|
|
|
|
|
|
|
|
|
if(gCommonFlowMgr->IsNeedExecAgain())//<2F><><EFBFBD><EFBFBD><EFBFBD>ٴ<EFBFBD><D9B4><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
SetTimer(WORK_TIMER5,WORK_TIME_DELAY5,NULL);
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ָ<EFBFBD>
|
|
|
|
|
CWorkCmdContainer &CmdContainer = CWorkCmdContainer::GetInstance();//ָ<>
|
|
|
|
|
CmdContainer.Clear();
|
|
|
|
|
gLogMgr->WriteDebugLog("All Work End");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//û<><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>AutoWork()
|
|
|
|
|
if(m_CurWorkStep>=1 && m_CurWorkStep<=3)
|
|
|
|
|
{
|
|
|
|
|
SetTimer(WORK_TIMER2,WORK_TIME_DELAY2,NULL);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬(<28><><EFBFBD>︺<EFBFBD><EFB8BA><EFBFBD>и<EFBFBD>product <20><><EFBFBD>мӹ<D0BC>)
|
|
|
|
|
void DlgCutDeviceCtrl::CheckStartState()
|
|
|
|
|
{
|
|
|
|
|
int Idx = gProductMgr->GetCurProductIdx();
|
|
|
|
|
if(Idx>=0 && Idx != m_CurProductIdx)//<2F><>Ҫ<EFBFBD>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
m_CurProductIdx = Idx;//<2F><>ǰ<EFBFBD>ӹ<EFBFBD><D3B9><EFBFBD>product
|
|
|
|
|
m_CurWorkStep = 1;//<2F><><EFBFBD>Ƽӹ<C6BC><D3B9><EFBFBD>ǰproduct<63>IJ<EFBFBD><C4B2><EFBFBD>
|
|
|
|
|
if(Idx == 0)
|
|
|
|
|
{
|
|
|
|
|
gCommonFlowMgr->SetLightStateCmd(true);
|
|
|
|
|
}
|
|
|
|
|
AutoWork();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//ͨ<><CDA8><EFBFBD><EFBFBD>ť<EFBFBD><C5A5><EFBFBD><EFBFBD><EFBFBD>ӹ<EFBFBD>
|
|
|
|
|
void DlgCutDeviceCtrl::StartWrokByBottom()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
#if 1
|
|
|
|
|
void DlgCutDeviceCtrl::SetPar()
|
|
|
|
|
{
|
|
|
|
|
m_LaserPower = gCLaserDeviceMgr->GetPower();
|
|
|
|
|
m_LaserFre = gCLaserDeviceMgr->GetLaserFre();
|
|
|
|
|
CMarkPar& MarkPar = gMarkParMgr->GetCurPen();
|
|
|
|
|
m_LaserSpeed = MarkPar.ms;//<2F>и<EFBFBD><D0B8>ٶ<EFBFBD>
|
|
|
|
|
m_CutCount = gCommonFlowMgr->m_OneObjMarkCnt;//<2F>и<EFBFBD><D0B8><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
m_OffsetAdjust = gCommonFlowMgr->GetAdjustOffset();
|
|
|
|
|
m_RotatoAdjust = gCommonFlowMgr->GetRotatoAdjust();//<2F><>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>
|
|
|
|
|
m_SizeAdjust = gCommonFlowMgr->GetAdjustSize();
|
|
|
|
|
m_MarkAreaCutCount = gCommonFlowMgr->GetAreaCycleCnt();//ѭ<><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
//UpdateData(FALSE);
|
|
|
|
|
}
|
|
|
|
|
//Ӧ<>ò<EFBFBD><C3B2><EFBFBD>
|
|
|
|
|
void DlgCutDeviceCtrl::OnBnClickedSavePar()
|
|
|
|
|
{
|
|
|
|
|
if(gAuthorityMgr->CheckAuthority(_USER,true)==false)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
UpdateData(TRUE);
|
|
|
|
|
|
|
|
|
|
gCLaserDeviceMgr->SetPower(m_LaserPower);
|
|
|
|
|
gCLaserDeviceMgr->SetFre(m_LaserFre);
|
|
|
|
|
CMarkPar& MarkPar = gMarkParMgr->GetCurPen();
|
|
|
|
|
MarkPar.ms = m_LaserSpeed;//<2F>и<EFBFBD><D0B8>ٶ<EFBFBD>
|
|
|
|
|
gMarkParMgr->SaveCurPen(MarkPar);
|
|
|
|
|
gCommonFlowMgr->m_OneObjMarkCnt = m_CutCount;//<2F>и<EFBFBD><D0B8><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
gCommonFlowMgr->SetAdjustOffset(m_OffsetAdjust);
|
|
|
|
|
gCommonFlowMgr->SetRotatoAdjust(m_RotatoAdjust);
|
|
|
|
|
gCommonFlowMgr->SetAdjustSize(m_SizeAdjust);
|
|
|
|
|
gCommonFlowMgr->SetAreaCycleCnt(m_MarkAreaCutCount);
|
|
|
|
|
|
|
|
|
|
gDevicePropertieMgr.SaveAllPropertie();
|
|
|
|
|
//<2F><><EFBFBD>ü<EFBFBD><C3BC><EFBFBD><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>
|
|
|
|
|
gCLaserDeviceMgr->SetParToLaserDevice(false);
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>Ѽ<EFBFBD><D1BC><EFBFBD><EFBFBD><EFBFBD>Դ
|
|
|
|
|
gProgramCutMgr->CollectSrcWorkData();
|
|
|
|
|
|
|
|
|
|
CMsgBox MsgBox;
|
|
|
|
|
MsgBox.Show("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>óɹ<EFBFBD>");
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
gProgramCutMgr->SaveWorkParFile();
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
//<2F><><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void DlgCutDeviceCtrl::UpdateLaserParInfo()
|
|
|
|
|
{
|
|
|
|
|
double LaserCurr = gCLaserDeviceMgr->GetCurLaserCurr();
|
|
|
|
|
double LaserFre = gCLaserDeviceMgr->GetCurLaserFre();
|
|
|
|
|
if(LaserCurr<0 ||LaserCurr>100)
|
|
|
|
|
LaserCurr = 0;
|
|
|
|
|
if(LaserFre<0 ||LaserFre>100)
|
|
|
|
|
LaserFre = 0;
|
|
|
|
|
|
|
|
|
|
GetDlgItem(IDC_SLEEP_TIME)->SetWindowText(gCLaserDeviceMgr->GetCurLeftTimes());
|
|
|
|
|
GetDlgItem(IDC_CUR_LASER_CURR)->SetWindowText(Db2CString(LaserCurr));
|
|
|
|
|
GetDlgItem(IDC_CUR_LASER_FRE)->SetWindowText(Db2CString(LaserFre));
|
|
|
|
|
}
|