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


-- 生成时间:2017-12-12 18:09:44 by ebs-core  
CREATE  procedure [dbo].[ebs_1_alarm_5](
     @cmpid int, 
     @almid int
  ) 
as  
begin  
set nocount on  
declare @identkey nvarchar(100) 
declare @identkeyold nvarchar(100) 
 select @identkey =alm_identkey from mps_alarm where alm_id=@almid 
 set @identkeyold=@identkey
 set @identkey = isnull(@identkey,'none') 
 declare @almtitle nvarchar(100) 
 set @almtitle = ''  
 declare @almcategory nvarchar(100) 
 set @almcategory = ''  
 declare @sourceobjids varchar(MAX) 
 set @sourceobjids = '' 
 
 declare @newordid bigint 
 declare @branchid int 
 declare @userdpid int 
 declare @userotid int 
 declare @useruid int 
 declare @stype varchar(20) 
 declare @sordids varchar(max) 
 
 --- 以下是预处理事件中的临时表
 
-- 生成人员信息 
create table #myuser(pptype varchar(30),cuid int, grp int) 
exec mps_gen_powerusers @cmpid,0,0,0,0,0,0,0,0,'biz',0,0,0,@almid,'alarm' 
select cu_id as cuid,* into #user from #myuser , mps_login where cu_id=cuid 
drop table #myuser

 ---- 以下预警事件代码 --------------
 


 ---- 以上预警事件代码 --------------
 
 -- 调整identkey 
 if (@identkey<>@identkeyold and @identkey<>'abort' and @identkey<>'remove') 
 begin
 update mps_alarm set alm_identkey=@identkey where alm_id=@almid 
 end 
 if (@identkey='remove') 
 begin
 update mps_alarm set alm_identkey=''  where alm_id=@almid  
 end 
 
 
 -- 生成新业务


 ---------------------
--- 清除临时表 
exec drop_temp_table '#user' 


set nocount off 
end