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

-- 生成时间:2018-04-25 00:28:23 by ebs-core  
CREATE  procedure order_1_newbiz_after(
     @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),
     @extparam1 nvarchar(1000),
     @extparam2 nvarchar(1000),
     @extparam3 nvarchar(1000) 
  ) 
as  
begin  
set nocount on  

if ((@extparam1 is null) or (@extparam1='_none_'))  set @extparam1 = '' 
  if ((@extparam2 is null) or (@extparam2='_none_'))  set @extparam2 = '' 
  if ((@extparam3 is null) or (@extparam3='_none_'))  set @extparam3 = '' 
  
declare @nonedate datetime 
set @nonedate = CONVERT(datetime,'1910-1-1')
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  
 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 
  
 --- 以下是预处理事件中的临时表
 
 ---- 以下是开发人员写的 after new order 事件 --------------
 --after create 
declare @t1 int 
set @t1 = 100 
 ---- 以上是开发人员写的 after new order 事件 --------------
 
 
--- 清除临时表 

set nocount off 
end