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