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

-- 生成时间:2018-06-27 14:12:36 by ebs-core  
create  procedure order_153_endmessage_1450(
     @cmpid int, 
     @ordid bigint,
     @jbid bigint
  ) 
  as  
  begin  
set nocount on  

------ 给执行人发消息  ----------  

------ 给监督人发消息  ----------  

------ 给协作人发消息  ----------  

------ 给知会人发消息  ----------  

------ 给日志参与人发消息  ----------  

------ 给员工1发消息  ----------  

insert into ebs_kernel.dbo.pub_message(msg_cmpid,msg_mpid,msg_text,msg_senddate,msg_type,msg_target,msg_cuid)  
select @cmpid,22,'亲，快快快，新启动会开始报名啦！
会议编号：【'+ord_no+'】
会议主题：【'+ord_zt+'】
会议时间：【'+convert(nvarchar(50),ord_ksdate,23)+'~'+convert(nvarchar(50),ord_jssj,23)+'】
报名截止：【'+convert(nvarchar(50),ord_bmjssj,23)+'】
点击查看详情'
+'{title}启动会报名'
+'{url}/order/biztop.mobile.htm?crmid='+CONVERT(varchar,ord_bizid)+'&ordid='+CONVERT(varchar,ord_id)+'&jbid='+CONVERT(varchar,jb_id)+'&expired='+convert(nvarchar(50),ord_bmjssj,120),getdate(),'QYH',substring(cu_qyh , 20,50)    , cu_id 
from order_153,order_153_102,mps_job,mps_login 
where  ord_id=@ordid and  ord2_ordid=@ordid and  jb_id=@jbid and ord2_tsrcuid=cu_id and  
cu_type=0 and cu_qyh>'' 

------ 给员工2发消息  ----------  

insert into ebs_kernel.dbo.pub_message(msg_cmpid,msg_mpid,msg_text,msg_senddate,msg_type,msg_target,msg_cuid)  
select @cmpid,32,'启动会【'+ord_zt+'】工作安排中有你的任务，请及时处理！
会议编号：【'+ord_no+'】
会议主题：【'+ord_zt+'】
工作内容：【'+substring(isnull(ord2_gznr,''),1,10)+'】
工作时间：【'+convert(nvarchar(100),isnull(ord2_kssj,''),120)+'~'+convert(nvarchar(100),isnull(ord2_kssj,''),120)+'】
会议时间：【'+convert(nvarchar(50),ord_ksdate,23)+'~'+convert(nvarchar(50),ord_jssj,23)+'】
报名截止：【'+convert(nvarchar(50),ord_bmjssj,23)+'】
如有疑问，请联系'+ord_empname+'
点击查看详情'
+'{title}启动会工作安排'
+'{url}/order/biztop.mobile.htm?crmid='+CONVERT(varchar,ord_bizid)+'&ordid='+CONVERT(varchar,ord_id)+'&jbid='+CONVERT(varchar,jb_id)+'&expired='+convert(nvarchar(50),ord2_wcsj,120),getdate(),'QYH',substring(cu_qyh , 20,50)    , cu_id 
from order_153,order_153_103,mps_job,mps_login 
where  ord_id=@ordid and  ord2_ordid=@ordid and  jb_id=@jbid and ord2_empcuid=cu_id and  
cu_type=0 and cu_qyh>'' 

------ 给员工3发消息  ----------  


set nocount off  
end