IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[order_186_newbiz_before]') AND type = 'P')
DROP PROCEDURE [dbo].[order_186_newbiz_before]
GO

-- 生成时间:2017-11-22 17:45:28 by ebs-core  
CREATE  procedure order_186_newbiz_before(
     @cmpid int,
     @branchid int,
     @userdpid int,
     @useruid int,
     @userotid int,
     @jbid bigint,
     @ordid bigint,
     @stype varchar(20),
     @sbizid int,
     @sord2tag int,
     @sord2id bigint,
     @sordidstr varchar(max),
     @operation varchar(50) output,
     @errorinfo nvarchar(4000) output
  ) 
as  
begin  
set nocount on  
declare @ord2group2 nvarchar(50) 
set @ord2group2 = '' 
declare @sys_recid bigint 
set @sys_recid = 0 
declare @newordid bigint  
declare @sordids table(ordid bigint)  
 set @newordid = @ordid  
 declare @i int , @curInd int , @strlen int , @ordid_s varchar ( 20 )  
 declare @sordid bigint  
 set @sordid = 0  
 declare @nonedate datetime 
set @nonedate = CONVERT(datetime,'1910-1-1')
 if ( charindex ( ',' ,@sordidstr ) = 0 and @sordidstr > '' )  
 begin  
 set @sordid = convert ( bigint ,@sordidstr )  
 insert into @sordids ( ordid ) values ( @sordid )  
 end   
 else 
 begin  
 select @curInd = 1 , @strlen = LEN ( @sordidstr )  
 while ( @curInd <= @strlen )  
 begin  
 select @i = charindex ( ',' ,@sordidstr , @curInd )  
 if ( @i > 0 )  
 begin  
 select @ordid_s = SUBSTRING ( @sordidstr , @curInd , @i  - @curInd )  
 insert into @sordids ( ordid ) values ( convert ( bigint , @ordid_s ) )  
 set @curInd = @i  + 1  
 end  
 else if ( @curInd <= @strlen )  
 begin  
 select @ordid_s = SUBSTRING ( @sordidstr , @curInd , @strlen  - @curInd  + 1 )  
 insert into @sordids ( ordid ) values ( convert ( bigint , @ordid_s ) )  
 break  
 end  
 end  
 end 
 set @operation = 'continue'
 set @errorinfo = '' 
 --- 以下是预处理事件中的临时表
 
 ---- 以下是开发人员写的 before new order 事件 --------------
 
 ---- 以上是开发人员写的 before new order 事件 --------------
 
 if (@operation='continue') 
 begin
 set @nonedate = @nonedate 
 
end 
--- 清除临时表 

set nocount off 
end