AL-2020/assigning.py
2020-06-09 21:23:10 +02:00

26 lines
563 B
Python

import os
from codes_recognizer.rocognizer import recognizer
from board import get_shelfs
def assigning(product_code_path, board, shelfs):
code = recognizer(product_code_path)
for shelf in shelfs:
if shelf.is_empty:
shelf.add_product(code)
c = shelf.get_coordinates()
break
else:
if shelf.get_product() == code:
shelf.add_product(code)
c = shelf.get_coordinates()
break
print("Product", product_code_path, "is on", c)
return c