📄 receivesqldate.cpp
字号:
// ReceiveSQLDate.cpp: implementation of the CReceiveSQLDate class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "test.h"
#include "ReceiveSQLDate.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CReceiveSQLDate::CReceiveSQLDate()
{
m_boolIsChange=true;
m_boolIsRecieve=true;
m_longCount=1;
}
CReceiveSQLDate::~CReceiveSQLDate()
{
}
void CReceiveSQLDate::AddTheReaderID(DWORD costwordReaderID,int coststate)//只有两种情况,1,change与receive分别为true,true时ID到last 反之取first
{
if (!m_boolIsChange)
{
return;
}
if (m_dwordReaderID_first==costwordReaderID)
{
CTimeSpan time_spantime;
time_spantime=CTime::GetCurrentTime()- m_time_first_last;
LONG long_temp_sum = time_spantime.GetTotalMinutes();
m_time_first_last =CTime::GetCurrentTime();
if (long_temp_sum>10)//如果两次收到时间相差10分钻,那么就认为不是一种新的数据.
{
m_boolIsChange=true;
m_dwordReaderID_last=costwordReaderID;
m_time_last=CTime::GetCurrentTime();
m_time_first=m_time_first_last;
}
else
{
m_boolIsChange=false;
m_time_last=CTime::GetCurrentTime();
}
m_bool_state=coststate;
m_boolIsRecieve=true;
return;
}
if (!m_boolIsRecieve)
{
m_dwordReaderID_last=costwordReaderID;
m_boolIsRecieve=true;
m_time_last=CTime::GetCurrentTime();
m_bool_state=coststate;
}
}
void CReceiveSQLDate::InitializationDate()
{
m_boolIsChange=true;
m_boolIsRecieve=false;
}
void CReceiveSQLDate::SureTheDate()//计算周期内数据改变.
{
if (m_boolIsRecieve)
{
if (m_boolIsChange)
{
if (m_boolfistadd)
{
m_boolfistadd=false;
return;
}
CTimeSpan time_spantime;
time_spantime=CTime::GetCurrentTime()-m_time_first_last;
if (time_spantime.GetTotalMinutes()<2&&m_dwordReaderID_last!=m_dwordReaderID_first)
{
m_boolIsRecieve=false;
return;
}
m_dwordReaderID_first=m_dwordReaderID_last;
m_time_first=m_time_last;
m_time_first_last=m_time_last;
m_longCount=1;
}
else
{
m_longCount++;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -