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

-- 生成时间:2017-12-26 22:32:26 by ebs-core  
CREATE  procedure order_183_1_newdetail(
@cmpid int, 
@branchid int, 
@userdpid int, 
@useruid int, 
@userotid int, 
@jbid bigint, 
@ordid bigint, 
@ord2tag int, 
@ord2id bigint output, 
@ord2group nvarchar(50)
) 
as  
begin  
set nocount on 
declare @neword2id bigint
insert into order_183_1(ord2_ordid, ord2_tag, ord2_group, ord2_updated) values(@ordid, @ord2tag, @ord2group,GETDATE()) 
declare @nonedate datetime 
set @nonedate = CONVERT(datetime,'1910-1-1')
set @neword2id = @@Identity 
declare @ord2group2 nvarchar(50) 
set @ord2group2 = '' 
declare @sys_recid bigint 
set @sys_recid = 0 
declare @errorinfo nvarchar(4000) 
declare @operation varchar(50) 
set @operation = 'continue' 
set @errorinfo = '' 

declare @noreturn int 
set @noreturn = 1 
if (@ord2id=-1) 
begin
set @ord2id = 0 
set @noreturn = 0 
end
-- 考虑到批量添加或导入功能，事件处理程序不在此完成 

if (@operation <> 'continue') 
begin 
-- 将新增的那条记录删除 
set @nonedate = @nonedate   -- here useless 
delete order_183_1 where ord2_id = @neword2id 
if (@errorinfo = '') set @errorinfo = 'error' 
set @neword2id = 0 
if (@noreturn>0) select 0 none where 0 = 1 
if (@noreturn=0) set @ord2id=@neword2id 
end else 
begin 
  set @nonedate=@nonedate  -- here useless 
if (@noreturn>0)  select * from order_183_1 where ord2_id = @neword2id 
else set @ord2id=@neword2id 
end

set nocount off
end