It does get a bit involved, there is some recursion needed for a reasonable implementation, eg a magazine in a file placed on a shelf or an archive that has boxes on shelves. I implemented it for my books and manuals, example :- http://www.collection.archivist.info/shelfview.php?src=artitle&locid=197
All items and locations have a barcode, the database has a location id(one per shelf+ a special for containers), and a status(lost,confirmed,etc) on each item plus another field if the locid is in/on an item/shelf. A stock check routine, scan shelf, (mark items located), scan items(mark confirmed on shelf/add to shelf), finish(mark unscanned as lost) The shelf locations have a room and xy location and orientation. There is a linking table to tie together and a live map drawing and and arrow image tool. Dave Caroline