insert into tb_lot_consume_his select top 5000 a.* from tb_lot_consume a with(nolock)
left join plan_wo b with(nolock) on a.wo_code = b.wo_code
where a.create_by = 'tn_busi_jexe_work_in_out' and isnull(a.out_lot_no,'')<>''
and b.wo_state = 9;
delete from tb_lot_consume from tb_lot_consume a
inner join tb_lot_consume_his b on a.lot_consume_id = b.lot_consume_id;
update bs_eqpt_all set is_real = 0 from bs_eqpt_all a with(nolock)
left join bs_eqpt_type b with(nolock) on a.eqpt_type_id = b.eqpt_type_id
where b.eqpt_type_name = '虚拟' and a.is_real = 1