IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[mps_customer_newcst_after]') AND type = 'P')
DROP PROCEDURE [dbo].[mps_customer_newcst_after]
GO
-- 生成时间:2018-06-13 15:26:44 by ebs-core  
CREATE  procedure [dbo].[mps_customer_newcst_after](
     @cmpid int,
     @branchid int,
     @userdpid int,
     @useruid int,
     @userotid int,
     @ccid bigint,
     @stype varchar(20),
     @sbizid int,
     @sord2tag int,
     @sord2id bigint,
     @sccidstr varchar(max),
     @extparam1 nvarchar(1000),
     @extparam2 nvarchar(1000),
     @extparam3 nvarchar(1000) 
  ) 
as  
begin  
set nocount on  
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED

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 @newccid bigint  
declare @sccids table(ccid bigint)  
 set @newccid = @ccid  
 declare @i int , @curInd int , @strlen int , @ccid_s varchar ( 20 )  
 declare @sccid bigint  
 set @sccid = 0  
 if ( charindex ( ',' ,@sccidstr ) = 0 and @sccidstr > '' )  
 begin  
 set @sccid = convert ( bigint ,@sccidstr )  
 insert into @sccids ( ccid ) values ( @sccid )  
 end   
 else 
 begin  
 select @curInd = 1 , @strlen = LEN ( @sccidstr )  
 while ( @curInd <= @strlen )  
 begin  
 select @i = charindex ( ',' ,@sccidstr , @curInd )  
 if ( @i > 0 )  
 begin  
 select @ccid_s = SUBSTRING ( @sccidstr , @curInd , @i  - @curInd )  
 insert into @sccids ( ccid ) values ( convert ( bigint , @ccid_s ) )  
 set @curInd = @i  + 1  
 end  
 else if ( @curInd <= @strlen )  
 begin  
 select @ccid_s = SUBSTRING ( @sccidstr , @curInd , @strlen  - @curInd  + 1 )  
 insert into @sccids ( ccid ) values ( convert ( bigint , @ccid_s ) )  
 break  
 end  
 end  
 end 
  
 --- 以下是预处理事件中的临时表
 
 ---- 以下是开发人员写的 after new order 事件 --------------
 --#master--#master--#master--#master--#master
 ---- 以上是开发人员写的 after new order 事件 --------------
 
 
--- 清除临时表 

set nocount off 
end