IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[userfunc_747_czwxj_for_sql]') AND type = 'P')
DROP PROCEDURE [dbo].[userfunc_747_czwxj_for_sql]
GO
CREATE PROCEDURE userfunc_747_czwxj_for_sql(@cmpid int,   @branchid int,  @userdpid int,  @useruid int,   @userotid int,  @usersecurity int,@ctgid int,@ctgid2 int,@objid bigint,@param1 varchar(100),@param2 varchar(100),@param3 int)
as
begin


set nocount on 
declare @objtype varchar(20)='biz' 
declare @ordid bigint 
set @ordid=@objid 
declare @bizid int 
set @bizid = @ctgid 
declare @nonedate datetime 
set @nonedate = CONVERT(datetime,'1910-1-1')
declare @ord2group2 nvarchar(50) 
set @ord2group2 = '' 
declare @sys_recid bigint 
set @sys_recid = 0 


    delete from order_269_2 where ord2_ordid=@param3
insert into order_269_2(
    ord2_ordid,
    ord2_fordid,
    ord2_fbizid,
    ord2_tag,
    ord2_rq,
    ord2_pp,
    ord2_xh,
    ord2_zdimei,
    ord2_jjlx,
    ord2_wxz,
    ord2_wxwd,
    ord2_jjmd,
    ord2_sly,
    ord2_clff,
    ord2_gzms,
    ord2_fcbz,
    ord2_bz
    )select  
    @param3,
    ord_id,
    260,
    2,
    ord_date,
    ord_zdpp,
    ord_zdxh,
    ord_imei,
    ord_zdlx,
    ord_branch,
    ord_wxmd,
    ord_createdepart,
    ord_creator,
    ord_cjclff,
    ord_gzms,
    ord_fcbz,
    ord_wxbz 
    from order_260 
    where CHARINDEX('临',ord_no) = 0 
    and ord_branch = @param1
    and ord_wxmd = @param2
    and ord_dqzt = '维修后总部收货'



end