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

-- 生成时间:2018-06-22 10:46:06 by ebs-core  
CREATE  procedure order_99_2212_wrknew_start(
     @cmpid int, 
     @useruid int, 
     @bizid int, 
     @ordid bigint, 
     @wrkid int, 
     @jbid bigint, 
     @operation varchar(50) output, 
     @errorinfo nvarchar(4000) output
  ) 
as  
begin  
set nocount on  
declare @nonedate datetime 
set @nonedate = CONVERT(datetime,'1910-1-1')
declare @ord2group2 nvarchar(50) 
set @ord2group2 = '' 
declare @sys_recid bigint 
set @sys_recid = 0 
 set @operation = 'continue'
 set @errorinfo = '' 
 --- 以下是预处理事件中的临时表
 
exec drop_temp_table '#detail2' 
select *,null recid into #detail2 from order_99_2 where ord2_ordid=@ordid  

 ---- 以下是开发人员写的 before start job 事件 --------------
 /* 确认装修进度规划中的验收阶段是否完成*/
declare @stus nvarchar(10)
select @stus=ord2_zt from #detail2 where ord2_jdx='验收' 
if  @stus='已完成' 
begin
set @operation='continue'
end 
else 
if  (@stus!='已完成' or @stus='') 
begin
set @operation='abort'
end 
 ---- 以上是开发人员写的 before start job 事件 --------------
 
 if (@operation='continue') 
 begin
 set @nonedate= @nonedate  -- here useless 
 
end 
--- 清除临时表 
exec drop_temp_table '#detail2'

set nocount off 
end