|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册账号
×
在查询分析器里找到那个数据库打上一下的补丁
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
ALTER PROCEDURE [P_GetBillSN]
@i_MacMark varchar(30),
@i_BillType int,
@i_BillDate varchar(10),
@i_OperID int,
@i_DftOper int = -1,
@i_BillSN varchar(100) = '',
@o_BillSN varchar(100) output
AS
Declare @Result int,
@Rule1 int,
@Rule2 int,
@Rule3 int,
@Rule4 int,
@DispMac bit,
@Sign1 varchar(30),
@Sign2 varchar(30),
@Sign3 varchar(30),
@Sign4 varchar(30),
@Sign5 varchar(30),
@Sign6 varchar(30),
@Sign7 varchar(30),
@Sign8 varchar(30),
@Sign9 varchar(30),
@Sign10 varchar(30),
@OperCode varchar(50),
@tmpSN varchar(100)
Declare @tmpSign varchar(30),
@j int,
@TranSyb smallint
set nocount on
-- 'P_GetBillSN'
set @i_BillSN = isNull(@i_BillSN, '')
if @i_DftOper = -2
begin
set @TranSyb = 0
set @i_DftOper = -1
end else
set @TranSyb = 1
if (@i_BillSN = '') and (@TranSyb = 1)
begin
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
begin tran GetBillSNPrc
end
Select @OperCode=u_Code from Employee where s_ID=@i_OperID
Select @Rule1=Rule1, @Rule2=Rule2, @Rule3=Rule3, @Rule4=Rule4, @DispMac=MacMark from BillSNRule where s_ID=1
Select @Sign1=IsNull(Sign1,''), @Sign2=IsNull(Sign2,''), @Sign3=IsNull(Sign3,''), @Sign4=IsNull(Sign4,''), @Sign5=IsNull(Sign5,''), @Sign6=IsNull(Sign6,''),
@Sign7=IsNull(Sign7,''), @Sign8=IsNull(Sign8,''), @Sign9=IsNull(Sign9,''), @Sign10=IsNull(Sign10,'')
from BillType where BillType=@i_BillType
set @o_BillSN=''
if @DispMac=1
set @o_BillSN = @i_MacMark + '-'
set @j=1
while @j<=10
begin
select @tmpSign = case @j when 1 then @Sign1 when 2 then @Sign2
when 3 then @Sign3 when 4 then @Sign4
when 5 then @Sign5 when 6 then @Sign6
when 7 then @Sign7 when 8 then @Sign8
when 9 then @Sign9 when 10 then @Sign10
end
if @tmpSign<>''
begin
exec P_SetBillSN @i_MacMark, @i_BillType, @i_BillDate, @i_OperID, @OperCode, @Rule1, @Rule2, @Rule3, @Rule4, @tmpSign, @i_DftOper, @tmpSN output
set @o_BillSN=@o_BillSN+@tmpSN
end
set @j=@j+1
end
if ((@i_BillSN='') and (@Rule3=0)) or (@i_BillType in (66, 67)) --
begin
exec @Result = P_SetBillCount @i_MacMark, @i_BillDate, @i_BillType, @i_OperID, @Rule1, @Rule2, @Rule3, @Rule4, @i_BillSN
if @@Error<>0 or @Result<0 return -1003
end
---------------------------------------------------------------------------------
Success:
if (@i_BillSN = '') and (@TranSyb = 1)
begin
Commit tran GetBillSNPrc
SET TRANSACTION ISOLATION LEVEL READ COMMITTED
end
return 0
Error:
if (@i_BillSN = '') and (@TranSyb = 1)
begin
rollback tran GetBillSNPrc
SET TRANSACTION ISOLATION LEVEL READ COMMITTED
end
return -1
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO |
|