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.

127 lines
4.5 KiB
C

#pragma once
#include "Module.h"
#include "WorkTime.h"
#include "Subject.h"
#include "PenParMgr.h"
//ɨ<><C9A8>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
enum EScanStateType
{
_ScanStateType_Null = 0,//δ֪״̬
_ScanStateType_NotScanned,//û<><C3BB>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD>
_ScanStateType_PartiallyScanned,//ɨ<><C9A8><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>
_ScanStateType_AllScanned,//ȫ<><C8AB>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD>
};
//ɨ<><C9A8>״̬<D7B4><CCAC><EFBFBD><EFBFBD>
class CScanState
{
public:
CScanState()
{
m_EndScanLineIdx = 0;//<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>
m_StartScanLineIdx = 0;//<2F><>ʼɨ<CABC><C9A8>ʱɨ<CAB1><C9A8><EFBFBD>ߵ<EFBFBD><DFB5><EFBFBD><EFBFBD><EFBFBD>ֵ
m_ScanedLineCnt = 0;//<2F><>ǰɨ<C7B0><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߶<EFBFBD><DFB6><EFBFBD><EFBFBD><EFBFBD>
};
public:
int m_StartScanLineIdx;//<2F><>ʼɨ<CABC><C9A8>ʱɨ<CAB1><C9A8><EFBFBD>ߵ<EFBFBD><DFB5><EFBFBD><EFBFBD><EFBFBD>ֵ
int m_EndScanLineIdx;//<2F><><EFBFBD><EFBFBD>ɨ<EFBFBD><C9A8>ʱɨ<CAB1><C9A8><EFBFBD>ߵ<EFBFBD><DFB5><EFBFBD><EFBFBD><EFBFBD>ֵ
int m_TotalScanLineCnt;//ɨ<><C9A8><EFBFBD>ߵ<EFBFBD><DFB5><EFBFBD><EFBFBD><EFBFBD>
int m_ScanedLineCnt;//<2F><>ǰɨ<C7B0><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߶<EFBFBD><DFB6><EFBFBD><EFBFBD><EFBFBD>
};
//record <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
enum ERecordParType
{
_RecordParType_Null = 0,
_RecordParType_BaseInfo,//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
_RecordParType_ScanData,//ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
_RecordParType_Recipe,//recipe <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
_RecordParType_DetectionInfo,//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
};
//<2F>ӹ<EFBFBD><D3B9><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>
class CRecordPar
{
public:
CRecordPar()
{
m_RecordParType = _RecordParType_Null;
m_ListItemWidht = 100;//<2F>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD>
};
public:
CString m_ParName;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CString m_ParVal;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
int m_ListItemWidht;//<2F>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD>
ERecordParType m_RecordParType;//record <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
};
//һ<><D2BB><EFBFBD>ӹ<EFBFBD><D3B9><EFBFBD>¼
class CWorkRecord
{
public:
CWorkRecord(){};
void Reset(){m_RecordParVec.clear();};
void AddRecordPar(CRecordPar par){m_RecordParVec.push_back(par);};
public:
vector<CRecordPar> m_RecordParVec;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
};
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼
class CWorkRecordMgr :public CModule,public CSubject
{
public:
CWorkRecordMgr(void);
~CWorkRecordMgr(void);
virtual MODULE GetModuleType(){return _WORK_RECORD_PROP;};
virtual void OnAppInitialize();
void StartRecord();
void EndRecord();
void EndRecordTime();
CString GetCurRecordTime(){return m_CurProcessingTime;};
CString GetTotalWorkTime(){return m_CurTotalWorkTime;};
void UpdateCurRecordTime();
void InsertRecordList(CListCtrl &List,CString StartDate,CString EndDate);
void SaveCurWorkRecord();
void ReadWorkRecord(CString RecordFilePath);
void GetAllRecordNameVec(vector<CString> &DateVec,CString StartDate,CString EndDate);
void InitWorkRecordList(CListCtrl &List);
void ResetScanState();
CScanState &GetCurScanState(){return m_CurScanState;};
EScanStateType GetCurScanStateType();
void InitWorkRecordInfoList(CListCtrl &List);
void InsertRecordInfoList(CListCtrl &List,int Idx);
void IncScanedLineCnt(){m_CurScanState.m_ScanedLineCnt++;};//<2F><><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD>ߵ<EFBFBD><DFB5><EFBFBD><EFBFBD><EFBFBD>
void RecoverRecipeByRecord();
void SetbSelWorkInfoRecord(bool b){m_bSelWorkInfoRecord = b;};
void SelWrokRecordToFile();
private:
CString GetCurRecordFileName();
CString GetRecordFilePath(CString FileName);
void InsertRecordListExt(CListCtrl &List,vector<CWorkRecord> &WorkRecordVec);
void CreatCurWorkRecord(CWorkRecord &WorkRecord);
void WriteWorkRecordToFile(CWorkRecord &WorkRecord);
void CreatBaseInfoRecord(CWorkRecord &WorkRecord);
void CreatScanDataRecord(CWorkRecord &WorkRecord);
void CreatRecipeRecord(CWorkRecord &WorkRecord);
void CreatListShowWorkRecord(CWorkRecord &WorkRecord);
void CreatListWorkInfoRecord(CWorkRecord &WorkRecord);
void SynchWorkRecord(CWorkRecord &WorkRecord,CWorkRecord &ReadWorkRecord);
void SetRecipeRecordReport(CString ParName,CString ParVal);
private:
CWorkTime m_WorkTime;//<2F>ӹ<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>¼
CString m_WorkStartTime;//<2F>ӹ<EFBFBD><D3B9><EFBFBD>ʼʱ<CABC><CAB1>
CString m_CurProcessingTime;//<2F><>ǰ<EFBFBD><C7B0>Բ<EFBFBD>Ĺ<EFBFBD><C4B9><EFBFBD>ʱ<EFBFBD><CAB1>
CString m_CurTotalWorkTime;//<2F><>ǰ<EFBFBD>ܵļӹ<C4BC>ʱ<EFBFBD><CAB1>
CString m_CurRecordTimeSecond;//<2F><>ǰ<EFBFBD>ӹ<EFBFBD>ʱ<EFBFBD><CAB1>(<28><>)
CScanState m_CurScanState;//<2F><>ǰ<EFBFBD><C7B0>ɨ<EFBFBD><C9A8>״̬
vector<CWorkRecord> m_ShowRecordVec;//<2F><>ǰ<EFBFBD><C7B0>ʾ<EFBFBD>ļ<EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>
vector<CWorkRecord> m_WorkRecordVec;//<2F><>ǰ<EFBFBD><C7B0>ʾ<EFBFBD>ļ<EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>
bool m_bSelWorkInfoRecord;//<2F>Ƿ<EFBFBD><C7B7><EFBFBD>ѡ<EFBFBD>еļ<D0B5>¼
CWorkRecord m_WorkInfoRecord;//<2F><>ϸ<EFBFBD><CFB8>Ϣrecord
};
extern CWorkRecordMgr *gWorkRecordMgr;