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

-- 生成时间:2018-05-02 17:23:21 by ebs-core  
CREATE  procedure order_27_4_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 = '' 

if (@operation <> 'continue') 
begin 
-- 放弃删除
if (@errorinfo = '') set @errorinfo = 'error' 
select @operation operation, @errorinfo errorinfo 
end else 
begin 
if (4>100) 
begin
delete mps_task where tsk_cmpid=@cmpid and tsk_objtype='biz' and tsk_ctgid=27 and tsk_objid=@ordid and tsk_objid2=@ord2id 
end
delete order_27_4 where ord2_id = @ord2id 

select 'ok' operation, '' errorinfo 
end

set nocount off
end