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

-- 生成时间:2018-06-19 09:31:32 by ebs-core  
CREATE  procedure order_200_check(
     @cmpid int,
     @branchid int,
     @userdpid int,
     @useruid int,
     @userotid int,
     @jbid bigint,
     @ordid bigint,
     @operation varchar(50) output,
     @errorinfo nvarchar(4000) output
  ) 
as  
begin  
set nocount on  
declare @ord2group2 nvarchar(50) 
set @ord2group2 = '' 
declare @sys_recid bigint 
set @sys_recid = 0 
 declare @nonedate datetime 
set @nonedate = CONVERT(datetime,'1910-1-1')
 set @operation = 'continue'
 set @errorinfo = '' 
 --- 以下是预处理事件中的临时表
 
exec drop_temp_table '#master' 
select * into #master from order_200 where ord_id=@ordid  

 ---- 以下是开发人员写的 check order 事件 --------------
 /*判断是否上传拍照*/
declare @photos nvarchar(50)
select @photos = ord_photos from #master


if(isnull(@photos,'')='')
begin
    set @operation='abort'
set @errorinfo = '请上传拍照！'
end

if exists(select 1 from #master where  ord_zkkssj>ord_zkjssj   )
begin
set @operation ='abort'
    set @errorinfo ='周会开始时间必须小于等于结束时间！'
end

 ---- 以上是开发人员写的 check order 事件 --------------
 
 if (@operation='continue') 
 begin
 set @sys_recid=@sys_recid  -- here useless 
 
end 
--- 清除临时表 

exec drop_temp_table '#master' 

set nocount off 
end