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

-- 生成时间:2018-05-09 09:32:29 by ebs-core  
create  procedure order_202_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=5 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,202,@ordid,0,'exec order_202_alarm_5 1,202,'+convert(varchar(10),@ordid)+',5,@taskid',0,60,5,'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=6 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,202,@ordid,0,'exec order_202_alarm_6 1,202,'+convert(varchar(10),@ordid)+',6,@taskid',0,60,6,'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=7 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,202,@ordid,0,'exec order_202_alarm_7 1,202,'+convert(varchar(10),@ordid)+',7,@taskid',0,60,7,'bizalarm') 

end