#sql("backupInvLot")

    INSERT INTO inv_lot_backup
    (invtime,lotnum,customerid,sku,qty,cubic,
    grossweight,netweight,price,qtypreallocated,
    qtyallocated,qtyonhold,addtime,addwho,edittime,editwho)
    SELECT NOW(),lotnum,customerid,sku,qty,cubic,
            grossweight,netweight,price,qtypreallocated,
            qtyallocated,qtyonhold,addtime,addwho,edittime,editwho
    FROM inv_lot;

#end

#sql("backupInvLotLocId")

    INSERT INTO inv_lot_loc_id_backup
    (invtime,lotnum,locationid,traceid,customerid,sku,
    qty,qtyallocated,qtyrpin,qtyrpout,qtymvin,qtymvout,
    qtyonhold,addtime,addwho,edittime,editwho,netweight,
    grossweight,cubic,price,onholdlocker,lpn,qtypa)
    SELECT NOW(),lotnum,locationid,traceid,customerid,sku,
            qty,qtyallocated,qtyrpin,qtyrpout,qtymvin,qtymvout,
            qtyonhold,addtime,addwho,edittime,editwho,netweight,
            grossweight,cubic,price,onholdlocker,lpn,qtypa
    FROM inv_lot_loc_id;

#end

#sql("inventoryDetection")

    select a.* from inv_lot_loc_id a
    left join inv_lot on a.lotnum = b.lotnum
    where b.lotnum is null

#end