生成不重复单据编号 收藏
Last4Str:string; //全局变量
function NotRepertStr:string;
var n,w,i:integer;
s:string;
begin
s:='';
if Last4Str='' then Last4Str:='0000';
n:=strtoint(Last4Str)+1;
if n>9999 then n:=0;
w:=Length(inttostr(n));
for i:=1 to 4-w do s:=s+'0';
Last4Str:=s+inttostr(n);
result:=FormatDateTime('yymmddhhmmsszzz', Now)+Last4Str;
end;
//该方法可以在1/1000秒内可以产生10000条不重复的字符