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

-- 生成时间:2018-05-02 17:22:20 by ebs-core  
CREATE  procedure order_75_modify_2(
@ord2id bigint, 
@cmpid int, 
@branchid bigint, 
@userdpid bigint, 
@userotid bigint, 
@useruid int, 
@jbid bigint, 
@ordid bigint, 
@ord2tag int, 
@ord2_fbizid int,@ord2_ford2tag int,@ord2_order int,@ord2_rbizid int,@ord2_rord2tag int,@ord2_wxsl int,@ord2_fcsl int,@ord2_jssl int,@ord2_fcsj datetime,@ord2_fhsj datetime,@ord2_wcsj datetime,@ord2_lqsj datetime,@ord2_fatherord2id bigint,@ord2_ford2id bigint,@ord2_fordid bigint,@ord2_rord2id bigint,@ord2_rordid bigint,@ord2_code varchar(50),@ord2_ftype varchar(10),@ord2_key varchar(30),@ord2_rtype varchar(10),@ord2_tags varchar(100),@ord2_caption nvarchar(100),@ord2_gkxm nvarchar(100),@ord2_kdgs nvarchar(100),@ord2_lxfs nvarchar(100),@ord2_mpbm nvarchar(100),@ord2_pm nvarchar(100),@ord2_bgh nvarchar(100),@ord2_kdsh nvarchar(100),@ord2_clfs nvarchar(100),@ord2_spjs nvarchar(100),@ord2_wfwxyy nvarchar(100),@ord2_wxfs nvarchar(100),@ord2_lqr nvarchar(100),@ord2_wxr nvarchar(100),@ord2_spqkms nvarchar(100),@ord2_status nvarchar(30),@ord2_sxsl nvarchar(100),@ord2_xpbh nvarchar(100),@ord2_ys nvarchar(100),@ord2_cjdm nvarchar(100) ) 
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 
 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_75_2_newdetail @cmpid , @branchid , @userdpid, @useruid , @userotid, @jbid , @ordid ,@ord2tag ,@ord2id output , '' 
 if (@ord2id<=0) set @ord2id=0 
 end 
 update order_75_2 set 
ord2_fbizid=case when @ord2_fbizid is null or @ord2_fbizid = -999999999  then ord2_fbizid else @ord2_fbizid end,ord2_ford2tag=case when @ord2_ford2tag is null or @ord2_ford2tag = -999999999  then ord2_ford2tag else @ord2_ford2tag 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_rord2tag=case when @ord2_rord2tag is null or @ord2_rord2tag = -999999999  then ord2_rord2tag else @ord2_rord2tag end,ord2_wxsl=case when @ord2_wxsl is null or @ord2_wxsl = -999999999  then ord2_wxsl else @ord2_wxsl end,ord2_fcsl=case when @ord2_fcsl is null or @ord2_fcsl = -999999999  then ord2_fcsl else @ord2_fcsl end,ord2_jssl=case when @ord2_jssl is null or @ord2_jssl = -999999999  then ord2_jssl else @ord2_jssl end,ord2_fcsj=case when @ord2_fcsj is null or @ord2_fcsj = @nonedate then ord2_fcsj else @ord2_fcsj end,ord2_fhsj=case when @ord2_fhsj is null or @ord2_fhsj = @nonedate then ord2_fhsj else @ord2_fhsj end,ord2_wcsj=case when @ord2_wcsj is null or @ord2_wcsj = @nonedate then ord2_wcsj else @ord2_wcsj end,ord2_lqsj=case when @ord2_lqsj is null or @ord2_lqsj = @nonedate then ord2_lqsj else @ord2_lqsj end,ord2_fatherord2id=case when @ord2_fatherord2id is null or @ord2_fatherord2id = -999999999  then ord2_fatherord2id else @ord2_fatherord2id end,ord2_ford2id=case when @ord2_ford2id is null or @ord2_ford2id = -999999999  then ord2_ford2id else @ord2_ford2id end,ord2_fordid=case when @ord2_fordid is null or @ord2_fordid = -999999999  then ord2_fordid else @ord2_fordid end,ord2_rord2id=case when @ord2_rord2id is null or @ord2_rord2id = -999999999  then ord2_rord2id else @ord2_rord2id end,ord2_rordid=case when @ord2_rordid is null or @ord2_rordid = -999999999  then ord2_rordid else @ord2_rordid end,ord2_code=case when @ord2_code is null or @ord2_code = '_none_'  then ord2_code else @ord2_code end,ord2_ftype=case when @ord2_ftype is null or @ord2_ftype = '_none_'  then ord2_ftype else @ord2_ftype end,ord2_key=case when @ord2_key is null or @ord2_key = '_none_'  then ord2_key else @ord2_key end,ord2_rtype=case when @ord2_rtype is null or @ord2_rtype = '_none_'  then ord2_rtype else @ord2_rtype end,ord2_tags=case when @ord2_tags is null or @ord2_tags = '_none_'  then ord2_tags else @ord2_tags end,ord2_caption=case when @ord2_caption is null or @ord2_caption = '_none_'  then ord2_caption else @ord2_caption end,ord2_gkxm=case when @ord2_gkxm is null or @ord2_gkxm = '_none_'  then ord2_gkxm else @ord2_gkxm end,ord2_kdgs=case when @ord2_kdgs is null or @ord2_kdgs = '_none_'  then ord2_kdgs else @ord2_kdgs end,ord2_lxfs=case when @ord2_lxfs is null or @ord2_lxfs = '_none_'  then ord2_lxfs else @ord2_lxfs end,ord2_mpbm=case when @ord2_mpbm is null or @ord2_mpbm = '_none_'  then ord2_mpbm else @ord2_mpbm end,ord2_pm=case when @ord2_pm is null or @ord2_pm = '_none_'  then ord2_pm else @ord2_pm end,ord2_bgh=case when @ord2_bgh is null or @ord2_bgh = '_none_'  then ord2_bgh else @ord2_bgh end,ord2_kdsh=case when @ord2_kdsh is null or @ord2_kdsh = '_none_'  then ord2_kdsh else @ord2_kdsh end,ord2_clfs=case when @ord2_clfs is null or @ord2_clfs = '_none_'  then ord2_clfs else @ord2_clfs end,ord2_spjs=case when @ord2_spjs is null or @ord2_spjs = '_none_'  then ord2_spjs else @ord2_spjs end,ord2_wfwxyy=case when @ord2_wfwxyy is null or @ord2_wfwxyy = '_none_'  then ord2_wfwxyy else @ord2_wfwxyy end,ord2_wxfs=case when @ord2_wxfs is null or @ord2_wxfs = '_none_'  then ord2_wxfs else @ord2_wxfs end,ord2_lqr=case when @ord2_lqr is null or @ord2_lqr = '_none_'  then ord2_lqr else @ord2_lqr end,ord2_wxr=case when @ord2_wxr is null or @ord2_wxr = '_none_'  then ord2_wxr else @ord2_wxr end,ord2_spqkms=case when @ord2_spqkms is null or @ord2_spqkms = '_none_'  then ord2_spqkms else @ord2_spqkms end,ord2_status=case when @ord2_status is null or @ord2_status = '_none_'  then ord2_status else @ord2_status end,ord2_sxsl=case when @ord2_sxsl is null or @ord2_sxsl = '_none_'  then ord2_sxsl else @ord2_sxsl end,ord2_xpbh=case when @ord2_xpbh is null or @ord2_xpbh = '_none_'  then ord2_xpbh else @ord2_xpbh end,ord2_ys=case when @ord2_ys is null or @ord2_ys = '_none_'  then ord2_ys else @ord2_ys end,ord2_cjdm=case when @ord2_cjdm is null or @ord2_cjdm = '_none_'  then ord2_cjdm else @ord2_cjdm 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_75_2 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