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

-- 生成时间:2018-06-26 17:51:29 by ebs-core  
CREATE  procedure order_20_modify_before(
     @cmpid int,
     @branchid int,
     @userdpid int,
     @useruid int,
     @userotid int,
     @jbid bigint,
     @ordid bigint,
     @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 @nonedate datetime 
set @nonedate = CONVERT(datetime,'1910-1-1')
 set @operation = 'continue'
 set @errorinfo = '' 
 --- 以下是预处理事件中的临时表
 --- #old 与 #new 在主体中已经生成
 
exec drop_temp_table '#rodetail2' 
select * into #rodetail2 from order_20_2 where ord2_ordid=@ordid  

 ---- 以下是开发人员写的 before modify order 事件 --------------
 if exists(select * from #rodetail2 e with(nolock) where e.ord2_status= '错误')
set @operation ='abort'
    set @errorinfo ='编制数据中存在错误，请检查后重试！'
 ---- 以上是开发人员写的 before modify order 事件 --------------
 
 if (@operation='continue') 
 begin
 set @sys_recid=@sys_recid  -- here useless 
 
end 
--- 清除临时表 
exec drop_temp_table '#rodetail2'

set nocount off 
end