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

-- 生成时间:2018-06-27 14:12:36 by ebs-core  
CREATE  procedure order_153_modify_103_after(
     @cmpid int,
     @branchid int,
     @userdpid int,
     @useruid int,
     @userotid int,
     @jbid bigint,
     @ordid bigint,
     @ord2tag int,
     @ord2id bigint
  ) 
as  
begin  
set nocount on  
declare @sys_recid bigint 
set @sys_recid = 0 
 declare @nonedate datetime 
set @nonedate = CONVERT(datetime,'1910-1-1')
declare @ord2group2 nvarchar(50) 
set @ord2group2 = '' 
 --- 以下是预处理事件中的临时表
 --- #old 与 #new 在主体中已经生成
 
exec drop_temp_table '#master' 
select * into #master from order_153 where ord_id=@ordid 
exec drop_temp_table '#rodetail102' 
select *  into #rodetail102 from order_153_102 where ord2_ordid=@ordid  

exec drop_temp_table '#rodetail103' 
select *  into #rodetail103 from order_153_103 where ord2_ordid=@ordid  

 ---- 以下是开发人员写的 after modify details order 事件 --------------
 /*判断住宿，报名信息不为空，在不为空的情况下删除当前培训参与人的任务*/
delete mps_task 
from #rodetail102 with(nolock),#master with(nolock) 
where   tsk_cuid = ord2_tsrcuid  
and isnull(ord2_sfbm,'')!=''
and ord2_ordid = @ordid 
and ord2_tsrcuid = @useruid
and tsk_objid = @ordid
and tsk_objtype='biz'

/*删除工作安排的任务*/
delete mps_task 
from #rodetail103 with(nolock),#master with(nolock) 
where   tsk_cuid = ord2_empcuid  
and ord2_ordid = @ordid 
and tsk_objid = @ordid
and tsk_objtype='biz'
 ---- 以上是开发人员写的 after modify details order 事件 --------------
 
 
--- 清除临时表 
exec drop_temp_table '#master' 
exec drop_temp_table '#rodetail102' 
exec drop_temp_table '#rodetail103' 

set nocount off 
end