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

-- 生成时间:2018-06-26 17:32:25 by ebs-core  
create  procedure order_93_alarm_task(
     @cmpid int, 
     @bizid int, 
     @ordid bigint
  ) 
as  
begin  

 if (not exists (select 1 from mps_job_task where wt_cmpid=@cmpid and wt_bizid=@bizid and wt_ordid=@ordid and wt_wrkid=0 and wt_mbid=4 and wt_jbid=0 and wt_type='bizalarm')) 
insert into mps_job_task(wt_begin,wt_wrkid,wt_cmpid,wt_bizid,wt_ordid,wt_useruid,wt_task,wt_jbid,wt_interval,wt_mbid,wt_type) 
values(getdate(),0,1,93,@ordid,0,'exec order_93_alarm_4 1,93,'+convert(varchar(10),@ordid)+',4,@taskid',0,60,4,'bizalarm') 

 if (not exists (select 1 from mps_job_task where wt_cmpid=@cmpid and wt_bizid=@bizid and wt_ordid=@ordid and wt_wrkid=0 and wt_mbid=31 and wt_jbid=0 and wt_type='bizalarm')) 
insert into mps_job_task(wt_begin,wt_wrkid,wt_cmpid,wt_bizid,wt_ordid,wt_useruid,wt_task,wt_jbid,wt_interval,wt_mbid,wt_type) 
values(getdate(),0,1,93,@ordid,0,'exec order_93_alarm_31 1,93,'+convert(varchar(10),@ordid)+',31,@taskid',0,60,31,'bizalarm') 

end