Try this:
declare @beg_date datetime='2015-1-1';
declare @end_date datetime=dateadd(dd,-1,getdate());
select 'TLS' as [asia db]
,esn as tlcs_no
,serialid as esn_no
,recoveredesn
,prodid
,auditdate as Received_Date
,datefinished
from (select tb.esn
,rs.serialid
,rs.recoveredesn
,rs.prodid
,tb.auditdate
,pt.datefinished
,case
when optype=4 then 'Received'
when optype=5 then 'shipping'
end as op_desc
,pt.esnstatus
,row_number() over(partition by tb.esn
,rs.serialid
,rs.recoveredesn
order by pt.datefinished
) as rn
from #Receiving as tb
left outer join #Recovered as rs
on rs.serialid=tb.esn collate Chinese_Taiwan_Stroke_CI_AS
left outer join #Production as pt
on rs.PRODID=pt.prodid
and pt.esnstatus=0
left outer join #inventdim as id
on pt.invintdimid=id.invetdimid
where tb.optype=5
and tb.auditdate>=@beg_date
and tb.auditdate<@end_date
) as a
where rn=1
order by esn
;
Oh yeah, please read this regarding the use of nolock