27 lines
576 B
Python
27 lines
576 B
Python
|
import os
|
||
|
|
||
|
from codes_recognizer.rocognizer import recognizer
|
||
|
from board import get_shelfs
|
||
|
|
||
|
def assigning(product_code_path):
|
||
|
|
||
|
code = recognizer(product_code_path)
|
||
|
shelfs = get_shelfs()
|
||
|
|
||
|
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
|
||
|
|
||
|
|
||
|
|