/// 单据编号,产生自增编号,如:入参为"DJ000002",将返回"DJ000003"
///
/// 原值
/// 下一值
public string NextNumber(string BaseNumber)
{
string NewNumber = "";//新值
int InNumber = 1;//进位
int PlaceValue;//位值
char[] No = BaseNumber.ToCharArray();
for (int i = BaseNumber.Length - 1; i >= 0; i--)
{
if (No[i] == '9' && InNumber == 1)
{
InNumber = 1;
NewNumber = "0" + NewNumber;
}
else
if (InNumber == 1 && No[i] >= '0' && No[i] < '9')
{
PlaceValue = Int32.Parse(No[i].ToString());
PlaceValue = (InNumber + PlaceValue);
InNumber = 0;
NewNumber = PlaceValue.ToString() + NewNumber;
}
else
{
InNumber = 0;
NewNumber = No[i] + NewNumber;
}
}
if (BaseNumber == NewNumber)
NewNumber = "0000000001";
return NewNumber;
}