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

-- 生成时间:2017-11-23 17:46:20 by ebs-core  
CREATE  procedure order_191_2_deletedetail(
@cmpid int, 
@branchid int, 
@userdpid int, 
@useruid int, 
@userotid int, 
@jbid bigint, 
@ordid bigint, 
@ord2tag int,
@ord2id bigint
) 
as  
begin  
set nocount on 
declare @errorinfo nvarchar(4000) 
declare @operation varchar(50) 
set @operation = 'continue' 
set @errorinfo = '' 
exec drop_temp_table '#old' select * into #old from order_191_2 where ord2_id=@ord2id exec drop_temp_table '#new' select * into #new from order_191_2 where ord2_id=@ord2id exec order_191_2_deletedetail_before @cmpid ,@branchid ,@userdpid,@useruid,@userotid,@jbid,@ordid,@ord2tag,@ord2id,@operation output,@errorinfo output 
if (@operation <> 'continue') 
begin 
-- 放弃删除
if (@errorinfo = '') set @errorinfo = 'error' 
select @operation operation, @errorinfo errorinfo 
end else 
begin 
delete order_191_2 where ord2_id = @ord2id 
exec order_191_2_deletedetail_after  @cmpid ,@branchid ,@userdpid,@useruid,@userotid,@jbid,@ordid,@ord2tag,@ord2id 
select 'ok' operation, '' errorinfo 
end
exec drop_temp_table '#old' exec drop_temp_table '#new' 
set nocount off
end