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

-- 生成时间:2018-11-22 18:21:54 by ebs-core  
CREATE  procedure order_266_3_deletedetail(
@cmpid int, 
@branchid int, 
@userdpid int, 
@useruid int, 
@userotid int, 
@jbid bigint, 
@ordid bigint, 
@ord2tag int,
@ord2id bigint
) 
as  
begin  
set nocount on 
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
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 (3>100) 
begin
delete mps_task with(rowlock) where tsk_cmpid=@cmpid and tsk_objtype='biz' and tsk_ctgid=266 and tsk_objid=@ordid and tsk_objid2=@ord2id 
end
delete order_266_3 with(rowlock) where ord2_id = @ord2id 

select 'ok' operation, '' errorinfo 
end

set nocount off
end