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

-- 生成时间:2018-11-22 18:21:21 by ebs-core  
CREATE  procedure order_241_modify_2(
@ord2id bigint, 
@cmpid int, 
@branchid bigint, 
@userdpid bigint, 
@userotid bigint, 
@useruid int, 
@jbid bigint, 
@ordid bigint, 
@ord2tag int,@sourcefield varchar(50)=default, 
@ord2_caption nvarchar(100)=default,
@ord2_code varchar(50)=default,
@ord2_fatherord2id bigint=default,
@ord2_fbizid int=default,
@ord2_ford2id bigint=default,
@ord2_ford2tag int=default,
@ord2_fordid bigint=default,
@ord2_ftype varchar(10)=default,
@ord2_hm nvarchar(100)=default,
@ord2_key varchar(30)=default,
@ord2_order int=default,
@ord2_rbizid int=default,
@ord2_rord2id bigint=default,
@ord2_rord2tag int=default,
@ord2_rordid bigint=default,
@ord2_rtype varchar(10)=default,
@ord2_status nvarchar(30)=default,
@ord2_tags varchar(100)=default,
@ord2_xm nvarchar(100)=default,
@ord2_zzftc nvarchar(100)=default,
@ord2_ext01 nvarchar(500)=default,
@ord2_ext02 nvarchar(500)=default,
@ord2_ext03 nvarchar(500)=default,
@ord2_ext04 nvarchar(500)=default,
@ord2_ext05 nvarchar(500)=default,
@ord2_ext06 nvarchar(500)=default,
@ord2_ext07 nvarchar(500)=default,
@ord2_ext08 nvarchar(500)=default,
@ord2_ext09 nvarchar(500)=default,
@ord2_ext10 nvarchar(500)=default,
@ord2_ext11 nvarchar(500)=default,
@ord2_ext12 nvarchar(500)=default,
@ord2_ext13 nvarchar(500)=default,
@ord2_ext14 nvarchar(500)=default,
@ord2_ext15 nvarchar(500)=default,
@ord2_ext16 nvarchar(500)=default,
@ord2_ext17 nvarchar(500)=default,
@ord2_ext18 nvarchar(500)=default,
@ord2_ext19 nvarchar(500)=default,
@ord2_ext20 nvarchar(500)=default,
@ord2_mdbh nvarchar(100)=default,
@ord2_sfbd nvarchar(100)=default,
@ord2_whordid int=default,
@ord2_whstatus nvarchar(100)=default,
@ord2_cuid int=default,
@ord2_creator nvarchar(100)=default ) 
as  
begin  
set nocount on  
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
declare @nonedate datetime 
set @nonedate = CONVERT(datetime,'1910-1-1')
declare @ord2group2 nvarchar(50) 
set @ord2group2 = '' 
declare @sys_recid bigint 
set @sys_recid = 0 
 declare @operation varchar(50)
 declare @errorinfo nvarchar(4000) 
 set @operation = 'continue' 
set @errorinfo = '' 
 --- 以下是预处理事件中的临时表
 declare @needreturn int 
 set @needreturn = 1
 if (@ord2id=0)  -- 如果=0
 begin
 set @ord2id=-1
 set @needreturn = 0
 exec order_241_2_newdetail @cmpid , @branchid , @userdpid, @useruid , @userotid, @jbid , @ordid ,@ord2tag ,@ord2id output , '' 
 if (@ord2id<=0) set @ord2id=0 
 end 
 update order_241_2 with(rowlock) set 
ord2_caption=case when @ord2_caption is null or @ord2_caption = '_none_'  then ord2_caption else @ord2_caption end,ord2_code=case when @ord2_code is null or @ord2_code = '_none_'  then ord2_code else @ord2_code end,ord2_fatherord2id=case when @ord2_fatherord2id is null or @ord2_fatherord2id = -999999999  then ord2_fatherord2id else @ord2_fatherord2id end,ord2_fbizid=case when @ord2_fbizid is null or @ord2_fbizid = -999999999  then ord2_fbizid else @ord2_fbizid end,ord2_ford2id=case when @ord2_ford2id is null or @ord2_ford2id = -999999999  then ord2_ford2id else @ord2_ford2id end,ord2_ford2tag=case when @ord2_ford2tag is null or @ord2_ford2tag = -999999999  then ord2_ford2tag else @ord2_ford2tag end,ord2_fordid=case when @ord2_fordid is null or @ord2_fordid = -999999999  then ord2_fordid else @ord2_fordid end,ord2_ftype=case when @ord2_ftype is null or @ord2_ftype = '_none_'  then ord2_ftype else @ord2_ftype end,ord2_hm=case when @ord2_hm is null or @ord2_hm = '_none_'  then ord2_hm else @ord2_hm end,ord2_key=case when @ord2_key is null or @ord2_key = '_none_'  then ord2_key else @ord2_key end,ord2_order=case when @ord2_order is null or @ord2_order = -999999999  then ord2_order else @ord2_order end,ord2_rbizid=case when @ord2_rbizid is null or @ord2_rbizid = -999999999  then ord2_rbizid else @ord2_rbizid end,ord2_rord2id=case when @ord2_rord2id is null or @ord2_rord2id = -999999999  then ord2_rord2id else @ord2_rord2id end,ord2_rord2tag=case when @ord2_rord2tag is null or @ord2_rord2tag = -999999999  then ord2_rord2tag else @ord2_rord2tag end,ord2_rordid=case when @ord2_rordid is null or @ord2_rordid = -999999999  then ord2_rordid else @ord2_rordid end,ord2_rtype=case when @ord2_rtype is null or @ord2_rtype = '_none_'  then ord2_rtype else @ord2_rtype end,ord2_status=case when @ord2_status is null or @ord2_status = '_none_'  then ord2_status else @ord2_status end,ord2_tags=case when @ord2_tags is null or @ord2_tags = '_none_'  then ord2_tags else @ord2_tags end,ord2_xm=case when @ord2_xm is null or @ord2_xm = '_none_'  then ord2_xm else @ord2_xm end,ord2_zzftc=case when @ord2_zzftc is null or @ord2_zzftc = '_none_'  then ord2_zzftc else @ord2_zzftc end,ord2_ext01=case when @ord2_ext01 is null or @ord2_ext01 = '_none_'  then ord2_ext01 else @ord2_ext01 end,ord2_ext02=case when @ord2_ext02 is null or @ord2_ext02 = '_none_'  then ord2_ext02 else @ord2_ext02 end,ord2_ext03=case when @ord2_ext03 is null or @ord2_ext03 = '_none_'  then ord2_ext03 else @ord2_ext03 end,ord2_ext04=case when @ord2_ext04 is null or @ord2_ext04 = '_none_'  then ord2_ext04 else @ord2_ext04 end,ord2_ext05=case when @ord2_ext05 is null or @ord2_ext05 = '_none_'  then ord2_ext05 else @ord2_ext05 end,ord2_ext06=case when @ord2_ext06 is null or @ord2_ext06 = '_none_'  then ord2_ext06 else @ord2_ext06 end,ord2_ext07=case when @ord2_ext07 is null or @ord2_ext07 = '_none_'  then ord2_ext07 else @ord2_ext07 end,ord2_ext08=case when @ord2_ext08 is null or @ord2_ext08 = '_none_'  then ord2_ext08 else @ord2_ext08 end,ord2_ext09=case when @ord2_ext09 is null or @ord2_ext09 = '_none_'  then ord2_ext09 else @ord2_ext09 end,ord2_ext10=case when @ord2_ext10 is null or @ord2_ext10 = '_none_'  then ord2_ext10 else @ord2_ext10 end,ord2_ext11=case when @ord2_ext11 is null or @ord2_ext11 = '_none_'  then ord2_ext11 else @ord2_ext11 end,ord2_ext12=case when @ord2_ext12 is null or @ord2_ext12 = '_none_'  then ord2_ext12 else @ord2_ext12 end,ord2_ext13=case when @ord2_ext13 is null or @ord2_ext13 = '_none_'  then ord2_ext13 else @ord2_ext13 end,ord2_ext14=case when @ord2_ext14 is null or @ord2_ext14 = '_none_'  then ord2_ext14 else @ord2_ext14 end,ord2_ext15=case when @ord2_ext15 is null or @ord2_ext15 = '_none_'  then ord2_ext15 else @ord2_ext15 end,ord2_ext16=case when @ord2_ext16 is null or @ord2_ext16 = '_none_'  then ord2_ext16 else @ord2_ext16 end,ord2_ext17=case when @ord2_ext17 is null or @ord2_ext17 = '_none_'  then ord2_ext17 else @ord2_ext17 end,ord2_ext18=case when @ord2_ext18 is null or @ord2_ext18 = '_none_'  then ord2_ext18 else @ord2_ext18 end,ord2_ext19=case when @ord2_ext19 is null or @ord2_ext19 = '_none_'  then ord2_ext19 else @ord2_ext19 end,ord2_ext20=case when @ord2_ext20 is null or @ord2_ext20 = '_none_'  then ord2_ext20 else @ord2_ext20 end,ord2_mdbh=case when @ord2_mdbh is null or @ord2_mdbh = '_none_'  then ord2_mdbh else @ord2_mdbh end,ord2_sfbd=case when @ord2_sfbd is null or @ord2_sfbd = '_none_'  then ord2_sfbd else @ord2_sfbd end,ord2_whordid=case when @ord2_whordid is null or @ord2_whordid = -999999999  then ord2_whordid else @ord2_whordid end,ord2_whstatus=case when @ord2_whstatus is null or @ord2_whstatus = '_none_'  then ord2_whstatus else @ord2_whstatus end,ord2_cuid=case when @ord2_cuid is null or @ord2_cuid = -999999999  then ord2_cuid else @ord2_cuid end,ord2_creator=case when @ord2_creator is null or @ord2_creator = '_none_'  then ord2_creator else @ord2_creator end,
ord2_updated=getdate() 
where ord2_id=@ord2id 
 if (@operation='continue') 
 begin
 set @nonedate=@nonedate   -- here useless 
 
 if (@needreturn=1) select 'ok' operation, '' errorinfo 
 else select * from order_241_2 with(nolock) where ord2_id=@ord2id
end  else 
begin
if (@needreturn=1) select @operation operation, @errorinfo errorinfo  
else select 0 none , 1 none1 where 1=0 
end
set nocount off 
end