首页 > 数据库

进销存系统单号算号器

时间:2009-06-10 10:47:14  作者:chinanetboy  我要投稿
Linux初探欢迎您的投稿,投放方法请点击这里查看,我们会定期赠送精美小礼品给优秀的投稿作者。海纳百川 取则行远!LinuxGoo欢迎您的到来。
进销存系统单号算号器1.单号存储表 DLL 的 SQLCODE2.存储过程的 sybase/mssql2005 代码实现3.调用存储过程代码// 单号表create table dbo.t_get_billno(number_t......

进销存系统单号算号器
1. 单号存储表 DLL 的 SQLCODE
2. 存储过程的 sybase/mssql2005 代码实现
3. 调用存储过程代码
// 单号表
create table dbo.t_get_billno
(
number_type char(1) not null,
billno char(10) not null,
owner_name char(10) not null,
create_date datetime not null,
flag char(1) not null
)
alter table dbo.t_get_billno
add constraint t_get_billno_px primary key nonclustered (number_type,billno)

//billno creater
drop PROCEDURE dbo.get_mu_billno;
CREATE PROCEDURE dbo.get_mu_billno(
@number_type char(1),
@owner_name char(10),
@first_number char(9) output
)
AS
declare @i int
declare @ctempno char(9)
declare @ctemp1 char(6)
declare @ctemp2 char(1)
declare @itemp3 int

begin

select @ctemp1=substring(CONVERT(varchar(30),getdate(),101),9,2) substring(CONVERT(varchar(30),getdate(),101),1,2) substring(CONVERT(varchar(30),getdate(),101),4,2)
select @ctempno=max(billno)
from t_get_billno
tablockx
where (number_type=@number_type) and (substring(billno,2,6) =@ctemp1)

if (@ctempno=NULL)
begin
select @itemp3=0
end
else
begin
select @itemp3=convert(int,substring(@ctempno,8,2))
end
if (@itemp3=99)
begin
return 3
end
else
begin
select @itemp3=@itemp3 1
end
select @ctempno=@number_type @ctemp1 replicate('0',(2-datalength(ltrim(str(@itemp3,2,0))))) ltrim(str(@itemp3,2,0))
insert into t_get_billno values(@number_type,@ctempno,@owner_name,getdate(),'0')
select @first_number=@ctempno

return 0
end


//call procedure with pb
string number_type,owner_name,getno
DECLARE p_get_billno PROCEDURE FOR dbo.get_mu_billno
@number_type =:number_type,
@owner_name=:owner_name,
@first_number = :getno output;
number_type=sle_ctype.text

如果您需转载 进销存系统单号算号器,请注明来自LinuxGoo.com,其版权归原作者所有。请广大网友留言时遵纪守法,使用文明用语。如果您在应用中有什么问题,请在下面留言,我们会尽快解答。
来顶一下
近回首页
返回首页
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表
相关文章
栏目热门