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

-- 生成时间:2018-06-20 16:15:30 by ebs-core  
CREATE  procedure order_154_modify_2_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_154 where ord_id=@ordid 
exec drop_temp_table '#rodetail102' 
select *  into #rodetail102 from order_154_102 where ord2_ordid=@ordid  

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

set nocount off 
end