Display user name\
This commit is contained in:
+45
-3
@@ -95,13 +95,14 @@ def remove_puck_datamatrix(barcode):
|
||||
|
||||
barcode_clean_re = re.compile("[^a-zA-Z0-9]")
|
||||
|
||||
def is_same_datamatrix(table, reading):
|
||||
def is_same_datamatrix(table, reading, do_log=True):
|
||||
if table == reading:
|
||||
return True
|
||||
table2 = barcode_clean_re.sub("", table.upper())
|
||||
reading2 = barcode_clean_re.sub("", reading.upper())
|
||||
if table2 == reading2:
|
||||
log("Assigning aproximative datamatrix " + reading )
|
||||
if do_log:
|
||||
log("Assigning aproximative datamatrix " + reading )
|
||||
return True
|
||||
return False
|
||||
|
||||
@@ -138,8 +139,20 @@ def get_puck_datamatrix():
|
||||
return ret
|
||||
|
||||
|
||||
def get_puck_datamatrix_info():
|
||||
def get_puck_from_datamatrix(datamatrix):
|
||||
try:
|
||||
for dm,puck in get_puck_datamatrix().items():
|
||||
if is_same_datamatrix(dm,datamatrix):
|
||||
return puck
|
||||
except:
|
||||
pass
|
||||
return None
|
||||
|
||||
|
||||
def get_puck_datamatrix_info(use_puck_detection=True):
|
||||
ret = {}
|
||||
#get_puck_obj_by_id("A-10").getName()
|
||||
|
||||
for si in samples_info:
|
||||
if si["puckBarcode"] is not None and si["puckBarcode"]!="":
|
||||
info = {}
|
||||
@@ -149,6 +162,35 @@ def get_puck_datamatrix_info():
|
||||
info["user"] = si ["userName"]
|
||||
info["type"] = si ["puckType"]
|
||||
ret[si["puckBarcode"]] = info
|
||||
|
||||
if use_puck_detection:
|
||||
detected_pucks = get_puck_info("Present") #
|
||||
for p in detected_pucks:
|
||||
address = str(p['address'])
|
||||
barcode = str(p['barcode'])
|
||||
if barcode and barcode != str(None):
|
||||
insert = True
|
||||
for id,info in ret.items():
|
||||
add = info["address"]
|
||||
if is_same_datamatrix(barcode, id, False):
|
||||
insert = False
|
||||
if str(add).strip() != address:
|
||||
log("Apdating address from DM info: " + add )
|
||||
for entry in ret.values():
|
||||
if str(entry['address']).strip() == address:
|
||||
entry['address']=""
|
||||
info["address"] = address
|
||||
break
|
||||
#Different address:
|
||||
if insert:
|
||||
info = {}
|
||||
info["address"] = address
|
||||
info["dewar"] = ""
|
||||
info["name"] = ""
|
||||
info["user"] = ""
|
||||
info["type"] = ""
|
||||
ret[barcode] = info
|
||||
|
||||
return ret
|
||||
|
||||
def get_puck_address(barcode):
|
||||
|
||||
Reference in New Issue
Block a user