经过修改代码,改程序已调试成功,实现根据日期自动生成流水号的功能,现将代码贴出,供大家交流、学习!
select 纱库数据
calculate max(编号) to maxbh
y=dtos(date())
rqbf=val(left(maxbh,8))
szbf=val(right(maxbh,8))
if alltrim(str(rqbf))==alltrim(y)
if szbf=0 then
zdbh=y+"00000001"
else
zdbh=y+padl(alltrim(str(szbf+1)),8,'0') &&生成自动编号
endif
else
zdbh=y+"00000001" &&生成自动编号
endif
select 纱库数据
calculate max(编号) to maxbh
y=dtos(date())
rqbf=val(left(maxbh,8))
szbf=val(right(maxbh,8))
if alltrim(str(rqbf))==alltrim(y)
if szbf=0 then
zdbh=y+"00000001"
else
zdbh=y+padl(alltrim(str(szbf+1)),8,'0') &&生成自动编号
endif
else
zdbh=y+"00000001" &&生成自动编号
endif