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



    set nocount on
    declare @dz varchar(50)
    declare @dh varchar(20)
    select @dz = dp_location from mps_depart where dp_id = @userdpid
    select @dh = cu_mobile from mps_employee where cu_id = @useruid
    
    update order_239 set ord_location = @dz , ord_phone = @dh where ord_id = @qry_ordid
    
    select  '【智乐方】您好，我是刚才打电话的小' + left(ord_creator,1) + '，电话是' + @dh  + '，门店地址在' + @dz as mobile_msg,
            @dh emp_phone,@dz store_addr
    from order_239 where ord_id = @qry_ordid
    
    set nocount off 


end