add locations in bulk

This commit is contained in:
2026-06-04 11:34:32 -05:00
parent ed2f2cb448
commit b3be0ed29b
+13 -2
View File
@@ -103,8 +103,19 @@ def init():
print("Creating cache index") print("Creating cache index")
search = ivs() search = ivs()
add = item.select().dicts() add = item.select().dicts()
#print(add)
#print(type(add))
# for rack in range(1,4):
# for shelf in range(1,6):
# for bay in range(1,6):
# if get_location(f"Rack{rack}-Shelf{shelf}-Bay{bay}") is False:
# print(create_location(name=f"Rack{rack}-Shelf{shelf}-Bay{bay}",barcode=f"Rack{rack}-Shelf{shelf}-Bay{bay}",parent=get_location_id('vlab-asset-10000719'), description=""))
# test = location.select().dicts()
# print("Locations:")
# for idx,itm in enumerate(test):
# print(itm)
for idx,itm in enumerate(add): for idx,itm in enumerate(add):
try: try:
itm["location"] = fancy_location(item.select().where(item.barcode==itm["barcode"])[0].loc) itm["location"] = fancy_location(item.select().where(item.barcode==itm["barcode"])[0].loc)