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.

503 lines
16 KiB
C++

#include "StdAfx.h"
#include "LaserPowCheckMgr.h"
#include "LogMgr.h"
#include "FileMgr.h"
#include "WorkTime.h"
#include "CStringFuc.h"
#include "MsgBox.h"
#include "ExceptionMsg.h"
#include "MsgBox.h"
#include "WorkCmdInvoker.h"
#include "Propertie.h"
#include "PropertieMgr.h"
#include "AuthorityMgr.h"
#include "CommonFlowMgr.h"
#include "GlobalFunction.h"
#include "RecipeMgr.h"
#include "Laser.h"
#define POW_CHECK_FILE_PATH _T("\\LaserPowerCheckData\\")
#define POW_CHECK_PAR_FILE _T("\\Parameter\\LaserMeasureData\\LaserPowCheckPar.par")
#define FIX_POW_PARA_FILE _T("\\CommPar\\LaserFixCurrentPower.bin")
#define TAB_STR " "
#define SPECIAL_CHAR '#'
void CPowCheckPar::Serialize( CArchive& ar)
{
if(ar.IsStoring())
{
ar<<m_PulseFre;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>Hz
ar<<m_StartCurr;//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>ֵA
ar<<m_EndCurr;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵA
ar<<m_GapCurr;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵA
ar<<m_CheckDelay;//ÿ<><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱms
ar<<m_FirstCheckDelay;//<2F><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱms
}
else
{
ar>>m_PulseFre;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>Hz
ar>>m_StartCurr;//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>ֵA
ar>>m_EndCurr;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵA
ar>>m_GapCurr;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵA
ar>>m_CheckDelay;//ÿ<><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱms
ar>>m_FirstCheckDelay;//<2F><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱms
}
}
CLaserPowCheckMgr *gLaserPowCheckMgr = new CLaserPowCheckMgr;
CLaserPowCheckMgr::CLaserPowCheckMgr(void)
{
m_CurPowCheckType = _LaserDeviceType_MainLaser1;//<2F><>ǰ<EFBFBD><C7B0><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
m_ParList = NULL;
m_CurSelCheckRecordIdx = -1;
m_CurExtLaserType = 0;
}
CLaserPowCheckMgr::~CLaserPowCheckMgr(void)
{
}
void CLaserPowCheckMgr::OnAppInitialize()
{
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ¼
CString DirPath = GetPowCheckFilePath();
CFileMgr FileMgr;
if(!FileMgr.IsDirectoryExists(DirPath))
FileMgr.CreatDir(DirPath);
}
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>·<EFBFBD><C2B7>
CString CLaserPowCheckMgr::GetPowCheckFilePath()
{
CString DirPath = gProgramLaserTuiHuo->GetLaipuLaserDataDir(POW_CHECK_FILE_PATH);
return DirPath;
}
#if 1
void CLaserPowCheckMgr::InitSelYearComb(CComboBox &ComboBox)
{
CString FilePath = GetPowCheckFilePath();
InitYearComb(FilePath,ComboBox);
}
void CLaserPowCheckMgr::InitSelMonthComb(CComboBox &ComboBox)
{
InitMonthComb(ComboBox);
}
void CLaserPowCheckMgr::InitSelLaserComb(CComboBox &ComboBox)
{
int idx = 0;
ComboBox.InsertString(idx++,"<EFBFBD>̹<EFBFBD>1");
ComboBox.InsertString(idx++,"<EFBFBD>̹<EFBFBD>2");
ComboBox.InsertString(idx++,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
//<2F><><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>
ComboBox.SetCurSel(0);
}
void CLaserPowCheckMgr::IniParList(CListCtrl &list,int AddW)
{
//<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,35,-1);
idx++;
list.InsertColumn(idx,"Current(A)",LVCFMT_LEFT,70+AddW,-1);
idx++;
list.InsertColumn(idx,"Laser Po(W)",LVCFMT_LEFT,90+AddW,-1);
idx++;
list.InsertColumn(idx,"Valid Po(W)",LVCFMT_LEFT,90+AddW,-1);
idx++;
}
void CLaserPowCheckMgr::IniRecordList(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,35,-1);
idx++;
list.InsertColumn(idx,"Time",LVCFMT_LEFT,120,-1);
idx++;
list.InsertColumn(idx,"Fre",LVCFMT_LEFT,70,-1);
idx++;
list.InsertColumn(idx,"K ",LVCFMT_LEFT,100,-1);
idx++;
list.InsertColumn(idx,"Po ",LVCFMT_LEFT,100,-1);
idx++;
}
#endif
#if 1//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//<2F><><EFBFBD>õ<EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void CLaserPowCheckMgr::SetCurPowCheckType(int idx)
{
eLaserDeviceType Type = (eLaserDeviceType)idx;
m_CurPowCheckType = Type;
}
//<2F><><EFBFBD>õ<EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>(CreatCurPowCheckData֮ǰʹ<C7B0><CAB9>)
void CLaserPowCheckMgr::SetCurPowCheckFre(double Fre)
{
CPowCheckPar &CurPowCheckPar = (*GetCurPowCheckPar());
if(Fre>0)//ʹ<><CAB9>ָ<EFBFBD><D6B8><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>Ƶ<EFBFBD><C6B5>
{
CurPowCheckPar.m_PulseFre = Fre;
}
}
//<2F><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CPowCheckPar *CLaserPowCheckMgr::GetCurPowCheckPar()
{
CPowCheckPar *p;
p = &m_MainPowCheckPar;
return p;
}
void CLaserPowCheckMgr::SetPowCheckPar(CPowCheckPar CheckPar)
{
CPowCheckPar &CurPowCheckPar = (*GetCurPowCheckPar());
CurPowCheckPar = CheckPar;
}
#endif
#if 1
//<2F><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD>Ĺ<EFBFBD><C4B9><EFBFBD><EFBFBD>ܶȲ<DCB6><C8B2><EFBFBD>(<28><>ʾ<EFBFBD><CABE>)
void CLaserPowCheckMgr::GetEnergyDensityPar(double &K,double &Po)
{
K = m_CurPowCheckData.m_EnergyDensityK;
Po = m_CurPowCheckData.m_EnergyDensityPo;
}
//<2F><><EFBFBD><EFBFBD><E3B9A6><EFBFBD>ܶȲ<DCB6><C8B2><EFBFBD>(K<><4B>Po)(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ)
bool CLaserPowCheckMgr::CalEnergyDensityPar()
{
gLogMgr->WriteDebugLog("Func---->CalEnergyDensityPar");
vector<CPowCheckPt>&PowCheckPtVec = m_CurPowCheckData.m_PowCheckPtVec;
int size = PowCheckPtVec.size();
if(size<2)
return false;
double SumK = 0;
double SumP = 0;//<2F><><EFBFBD>ʺ<EFBFBD>
double SumI = 0;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
bool bSaveToPar = true;//<2F>Ƿ񱣴浽<F1B1A3B4><E6B5BD><EFBFBD><EFBFBD>
for(int k=0;k<size;k++)
{
if(k!=size-1)
{
double K = CalTwoPtK(PowCheckPtVec[k],PowCheckPtVec[k+1]);
SumK += K;
}
SumP += PowCheckPtVec[k].m_SurfacePow;
SumI += PowCheckPtVec[k].m_SetCurr;
if(k==1 && PowCheckPtVec[k].m_SetCurr == PowCheckPtVec[0].m_SetCurr)
{
bSaveToPar = false;
}
}
//ƽ<><C6BD>ֵ
double AvgK= SumK/(double)(size-1);//<2F><>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ؾ<EFBFBD>Ҫ<EFBFBD>ȵ<EFBFBD><C8B5><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
double AvgP = SumP/(double)(size);
double AvgI = SumI/(double)(size);
//б<><D0B1>ȡƽ<C8A1><C6BD>ֵ
m_CurPowCheckData.m_EnergyDensityK = AvgK;
//<2F>ؾ<EFBFBD>
m_CurPowCheckData.m_EnergyDensityPo = AvgP - AvgK*AvgI;
CString LogStr;
LogStr.Format(_T("[AvgK] = [%0.3f] ,[AvgP] = [%0.3f],[AvgI] = [%0.3f],[Po] = [%0.3f]"),AvgK,AvgP,AvgI,m_CurPowCheckData.m_EnergyDensityPo);
gLogMgr->WriteDebugLog(LogStr);
//<2F><><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĺ<EFBFBD><C4B9><EFBFBD><EFBFBD>ܶȲ<DCB6><C8B2><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>ֵ
bool Ret = false;
if(bSaveToPar)
{
//<2F><>ȡ<EFBFBD>̹<EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CPowCheckPar &CheckPar = (*GetCurPowCheckPar());
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E8B6A8><EFBFBD><EFBFBD>
//Ret = gLaser->CheckEnergyDensityPar(m_CurPowCheckType,CheckPar.m_PulseFre,m_CurPowCheckData.m_EnergyDensityK,m_CurPowCheckData.m_EnergyDensityPo);
}
return Ret;
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĺ<EFBFBD><C4B9><EFBFBD><EFBFBD>ܶ<EFBFBD>б<EFBFBD><D0B1>
double CLaserPowCheckMgr::CalTwoPtK(CPowCheckPt CheckPt1,CPowCheckPt CheckPt2)
{
double K = (CheckPt2.m_SurfacePow - CheckPt1.m_SurfacePow)/(CheckPt2.m_SetCurr - CheckPt1.m_SetCurr);
return K;
}
//<2F>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>εĵ<CEB5><C4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void CLaserPowCheckMgr::RecoverLastPowCheckData(eLaserDeviceType LaserDeviceType)
{
if(LaserDeviceType==_LaserDeviceType_MainLaser1)
m_CurPowCheckData = m_LastPow1CheckData;
if(LaserDeviceType==_LaserDeviceType_MainLaser2)
m_CurPowCheckData = m_LastPow2CheckData;
if(LaserDeviceType==_LaserDeviceType_RedLaser)
m_CurPowCheckData = m_LastRedPowCheckData;
}
void CLaserPowCheckMgr::GetLastPowCheckPar(eLaserDeviceType LaserDeviceType,double &K,double &Po)
{
if(LaserDeviceType==_LaserDeviceType_MainLaser1)
{
K = m_LastPow1CheckData.m_EnergyDensityK;
Po = m_LastPow1CheckData.m_EnergyDensityPo;
}
if(LaserDeviceType==_LaserDeviceType_MainLaser2)
{
K = m_LastPow2CheckData.m_EnergyDensityK;
Po = m_LastPow2CheckData.m_EnergyDensityPo;
}
if(LaserDeviceType==_LaserDeviceType_RedLaser)
{
K = m_LastRedPowCheckData.m_EnergyDensityK;
Po = m_LastRedPowCheckData.m_EnergyDensityPo;
}
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void CLaserPowCheckMgr::CreatCurPowCheckData()
{
vector<CPowCheckPt>&PowCheckPtVec = m_CurPowCheckData.m_PowCheckPtVec;
m_CurPowCheckData.m_CheckType = m_CurPowCheckType;
m_CurPowCheckData.m_EnergyDensityK = 0;
m_CurPowCheckData.m_EnergyDensityPo = 0;
PowCheckPtVec.clear();
//<2F><>ȡ<EFBFBD>̹<EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CPowCheckPar &CheckPar = (*GetCurPowCheckPar());
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
if(CheckPar.m_StartCurr == CheckPar.m_EndCurr)
{
int Cnt = CheckPar.m_GapCurr;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǵ<EFBFBD><C7B5>ĸ<EFBFBD><C4B8><EFBFBD>
for(int k=0;k<Cnt;k++)
{
CPowCheckPt PowCheckPt;
PowCheckPt.m_SetCurr = CheckPar.m_StartCurr;
PowCheckPtVec.push_back(PowCheckPt);
}
}
else
{
double CurCurrent = CheckPar.m_StartCurr;//<2F><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
while(CurCurrent <= CheckPar.m_EndCurr)
{
CPowCheckPt PowCheckPt;
PowCheckPt.m_SetCurr = CurCurrent;
PowCheckPtVec.push_back(PowCheckPt);
CurCurrent += CheckPar.m_GapCurr;
}
}
}
//<2F><>¼<EFBFBD><C2BC><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>(һ<><D2BB><EFBFBD><EFBFBD>)
void CLaserPowCheckMgr::LaserPowSavePt(CPowCheckPt *pCheckPt)
{
}
void CLaserPowCheckMgr::UpdatePowCheckDataList(CListCtrl &List,bool bInsert,int SelIdx)
{
if(SelIdx<0)
{
UpdatePowCheckDataListExt(List,bInsert,m_CurPowCheckData);
}
else
{
int size = m_CurPowCheckRecordVec.size();
if(SelIdx>=0 && SelIdx<size)
{
UpdatePowCheckDataListExt(List,bInsert,m_CurPowCheckRecordVec[SelIdx]);
}
}
//<2F><>¼<EFBFBD><C2BC>ǰѡ<C7B0><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
m_CurSelCheckRecordIdx = SelIdx;
}
void CLaserPowCheckMgr::UpdatePowCheckDataListExt(CListCtrl &List,bool bInsert,CPowCheckData &PowCheckData)
{
List.DeleteAllItems();
vector<CPowCheckPt>&PowCheckPtVec = PowCheckData.m_PowCheckPtVec;
int size = PowCheckPtVec.size();
for(int i=0;i<size;i++)
{
CPowCheckPt &CheckPt = PowCheckPtVec[i];
int idx = 0;
List.InsertItem(i," ");//<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
List.SetItemText(i,idx++,Int2CString(i+1));//<2F><><EFBFBD><EFBFBD>
List.SetItemText(i,idx++,Db2CString(CheckPt.m_SetCurr));
List.SetItemText(i,idx++,Db2CString(CheckPt.m_LaserPathPow,2));
List.SetItemText(i,idx++,Db2CString(CheckPt.m_SurfacePow,2));
}
}
#endif
#if 1
//<2F><><EFBFBD>浱ǰ<E6B5B1><C7B0><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
bool CLaserPowCheckMgr::SaveCurPowCheckData()
{
return true;
}
//<2F><><EFBFBD><EFBFBD>ǰ<EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>recipe <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void CLaserPowCheckMgr::SaveCurPowCheckDataForRecipe()
{
CMsgBox MsgBox;
if(!m_CurPowCheckData.m_bCheckDataValid)
{
MsgBox.Show("<EFBFBD><EFBFBD>Ҫ<EFBFBD>Ƚ<EFBFBD><EFBFBD>е<EFBFBD><EFBFBD><EFBFBD>");
return;
}
//<2F>ȶ<EFBFBD>ȡԭ<C8A1><D4AD><EFBFBD><EFBFBD>
vector<CPowCheckPt> PowCheckPtPowCheckPVec;
ReadLaserFixedCurrentPowFile(PowCheckPtPowCheckPVec);
vector<CPowCheckPt> &PowCheckPtVec = m_CurPowCheckData.m_PowCheckPtVec;
int PtCnt = PowCheckPtVec.size();
for(int k=0;k<PtCnt;k++)
{
CPowCheckPt &CheckPt = PowCheckPtVec[k];
bool bUpate = false;
int size = PowCheckPtPowCheckPVec.size();
for(int i=0;i<size;i++)
{
CPowCheckPt &ReadPowCheckPt = PowCheckPtPowCheckPVec[k];
}
}
}
//<2F><>ȡ<EFBFBD>̶<EFBFBD><CCB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ<EFBFBD>Ӧ<EFBFBD><D3A6>
void CLaserPowCheckMgr::ReadLaserFixedCurrentPowFile(vector<CPowCheckPt> &PowCheckPtPowCheckPVec)
{
CFileMgr FileMgr;
CString FilePath;
FileMgr.GetFullFilePath(FilePath,FIX_POW_PARA_FILE);
vector<vector<CString>> StrVec;
FileMgr.ReadFileToStrVec(FilePath,StrVec);
int size = StrVec.size();
for(int k=0;k<size;k++)
{
if(StrVec[k].size() == 4)
{
CPowCheckPt PowCheckPt;
CString LaserTypeStr = (StrVec[k][0]);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if(LaserTypeStr == STR_LASER_1)
PowCheckPt.m_LaserType = _LaserDeviceType_MainLaser1;
if(LaserTypeStr == STR_LASER_2)
PowCheckPt.m_LaserType = _LaserDeviceType_MainLaser2;
PowCheckPt.m_LaserFre= CStringToDouble(StrVec[k][1]);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>
PowCheckPt.m_SetCurr= CStringToDouble(StrVec[k][2]);//<2F><><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD>
PowCheckPt.m_SurfacePow= CStringToDouble(StrVec[k][3]);//<2F><><EFBFBD><EFBFBD><EFBFBD>Ĺ<EFBFBD><C4B9><EFBFBD>
PowCheckPtPowCheckPVec.push_back(PowCheckPt);
}
}
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD>
void CLaserPowCheckMgr::SerializePowCheckData(CArchive& ar,CPowCheckData &PowCheckData)
{
}
//<2F><>ȡ<EFBFBD><C8A1>¼
void CLaserPowCheckMgr::ReadPowCheckData(int LaserType,CString Year,CString Month)
{
CWorkTime WorkTime;
if(Year=="")
Year = WorkTime.GetCurYear();
eLaserDeviceType PowCheckType = (eLaserDeviceType)LaserType;
m_CurExtLaserType = LaserType;
CString FilePath = GetPowCheckFilePath();
FilePath += Year;
FilePath += "\\";
//<2F><>ȡĿ¼<C4BF><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>pow <20>ļ<EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD>DataFilePathVec
vector<CString> DataFilePathVec;
CFileMgr FileMgr;
FileMgr.GetChildFileOrDirName(false,FilePath,DataFilePathVec,".pow");
m_CurPowCheckRecordVec.clear();
int size = DataFilePathVec.size();
for(int k=0;k<size;k++)
{
CString DataFilePath = DataFilePathVec[k];
//ֻѡ<D6BB><D1A1>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD>
if(Month != SEL_ALL_STR)
{
//<2F><>ȡ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
CString FileName = FileMgr.GetFileNameFromPath(DataFilePath,true);
CString FileNameMonth = FileName.Left(2);//<2F><>ȡ<EFBFBD>·<EFBFBD>
if(Month != FileNameMonth)
continue;
}
CFile file;
if(file.Open(DataFilePath,CFile::modeRead))
{
CArchive ar(&file,CArchive::load);
CPowCheckData CheckData;
SerializePowCheckData(ar,CheckData);
//ֻ<><D6BB>ȡ<EFBFBD><C8A1>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>
if(CheckData.m_CheckType == PowCheckType)
{
m_CurPowCheckRecordVec.push_back(CheckData);
}
}
}
}
void CLaserPowCheckMgr::UpdatePowCheckRecordList(CListCtrl &List)
{
List.DeleteAllItems();
int size = m_CurPowCheckRecordVec.size();
for(int k=0;k<size;k++)
{
CPowCheckData &CheckData = m_CurPowCheckRecordVec[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++,CheckData.m_DateTime);
CString LaserFre("----");
if(!IsDbEqualZero(CheckData.m_LaserFre))
LaserFre = Db2CString(CheckData.m_LaserFre,1);
List.SetItemText(k,idx++,LaserFre);
List.SetItemText(k,idx++,Db2CString(CheckData.m_EnergyDensityK,4));//<2F>ؾ<EFBFBD>
List.SetItemText(k,idx++,Db2CString(CheckData.m_EnergyDensityPo,4));//б<><D0B1>
}
}
//<2F><><EFBFBD>浱ǰѡ<C7B0><D1A1><EFBFBD>ļ<EFBFBD>¼<EFBFBD><C2BC><EFBFBD>ļ<EFBFBD>
void CLaserPowCheckMgr::SaveSelCheckRecordToFile()
{
int size = m_CurPowCheckRecordVec.size();
if(m_CurSelCheckRecordIdx<0 || m_CurSelCheckRecordIdx>=size)
{
return;
}
CPowCheckData &PowCheckData = m_CurPowCheckRecordVec[m_CurSelCheckRecordIdx];
double Po = PowCheckData.m_EnergyDensityPo;
double K = PowCheckData.m_EnergyDensityK;
TCHAR szFilters[]=("TXT <20>ļ<EFBFBD>(*.txt)|*.txt");
CString FileName;
FileName = PowCheckData.m_DateTime;
CString s;
s.Format("Laser%ld_",m_CurExtLaserType);
FileName = s+ FileName;
CFileDialog dlg(FALSE,("txt"),FileName,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,szFilters);
if(dlg.DoModal()==IDOK)
{
ofstream ar(dlg.GetPathName());
ar<<"б<EFBFBD><EFBFBD>K : "<<K<<" <20>ؾ<EFBFBD>Po : "<<Po<<'\n'<<'\n';
ar<<"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
ar<<TAB_STR;
ar<<"<EFBFBD><EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
ar<<TAB_STR;
ar<<"<EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
if(gLaser->IsbPowRecordWriteCalPow())
{
ar<<TAB_STR;
ar<<"<EFBFBD><EFBFBD><EFBFBD>Ϲ<EFBFBD><EFBFBD><EFBFBD>";
ar<<TAB_STR;
ar<<"<EFBFBD><EFBFBD>ֵ";
}
ar<<'\n';
vector<CPowCheckPt>&PowCheckPtVec = PowCheckData.m_PowCheckPtVec;
int size = PowCheckPtVec.size();
for(int i=0;i<size;i++)
{
CPowCheckPt &CheckPt = PowCheckPtVec[i];
//<2F><><EFBFBD>Ƽ<EFBFBD><C6BC><EFBFBD><E3B9A6>ֵ
double CalPower = gLaser->CalPowerByDensityPar(Po,K,CheckPt.m_SetCurr);
ar<<Db2CString(CheckPt.m_SetCurr);
ar<<TAB_STR;
ar<<Db2CString(CheckPt.m_LaserPathPow,2);
ar<<TAB_STR;
ar<<Db2CString(CheckPt.m_SurfacePow,2);
if(gLaser->IsbPowRecordWriteCalPow())
{
ar<<TAB_STR;
ar<<Db2CString(CalPower,2);
ar<<TAB_STR;
ar<<Db2CString(CalPower-CheckPt.m_SurfacePow,2);
}
ar<<'\n';
}
}
}
#endif