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.

43 lines
832 B
C++

#include "StdAfx.h"
#include "ValStrSN.h"
#include "GlobalFunction.h"
CValStrSN::CValStrSN(void)
{
m_ValStrType = _STR_SN;
m_SnMin = 0;//最小序号
m_SnMax = 9999;//最大序号
m_SnCur = 1;//当前序号
m_SnInc = 1;//序号增量
m_EachMarkTimes = 1;//每个标刻次数
m_CurMarkTimes = 0;//当前标刻次数
}
CValStrSN::~CValStrSN(void)
{
}
CString CValStrSN::GetTypeStr()
{
return "SN";
}
//计算当前的序列号
void CValStrSN::UpdateValStr()
{
//当前值加上增量
m_SnCur += m_SnInc;
}
CString CValStrSN::GetStr()
{
CString str;
//根据最大序号来确定前面要几个0
int Cnt1 = GetNumDigit(m_SnMax);
int Cnt2 = GetNumDigit(m_SnCur);
for(int i=0;i<(Cnt1-Cnt2);i++)
{
str += "0";
}
CString SnCurStr;
SnCurStr.Format("%ld",m_SnCur);
str += SnCurStr;
return str;
}