def checkOutLot(self,barcode,userId,pbarId=None): retVal = {} try: lot = DBSession().query(ReagentLot).filter(ReagentLot.lot_barcode==barcode.strip()).one() #@UndefinedVariable : lot_barcode comes from SQLAlchemy reflection lot.lot_current_user_id = int(userId) retVal = {'success': "Successfully checked out " + lot.lot_barcode} except Exception,e: log.debug(e) retVal = {'error': 'barcode ' + barcode + ' not found in inventory'}
def disposeLot(self,barcode,userId,pbarId=None): retVal = {} try: lot = DBSession().query(ReagentLot).filter(ReagentLot.lot_barcode==barcode.strip()).one() #@UndefinedVariable : lot_barcode comes from SQLAlchemy reflection lot.lot_is_disposed = 'Y' lot.lot_current_user_id = None retVal = {'success': 'Marked as disposed ' + lot.lot_barcode} except Exception,e: log.debug(e) retVal = {'error': 'barcode ' + barcode + ' not found in inventory'}
def link(self,parentId,childBarcode): retVal={'success': 'Successfully linked reagent'} try: child = DBSession().query(ReagentLot).filter(ReagentLot.lot_barcode==childBarcode).one() child.loc = DBSession().query(ReagentLotLocation).get(parentId) child.aud_modified_date = datetime.datetime.now() child.lot_current_user_id = None except Exception,e: log.exception(e) retVal={'error':"Could not find barcode " + childBarcode}
def checkInLot(self,barcode,userId,pbarId=None): retVal = {} msg = '' try: lot = DBSession().query(ReagentLot).filter(ReagentLot.lot_barcode==barcode.strip()).one() #@UndefinedVariable : lot_barcode comes from SQLAlchemy reflection msg += ', place in <b>bin</b> ' + str(lot.loc.loc_name) msg += ', <b>shelf</b> ' + str(lot.loc.loc_shelf) msg += ', <b>cabinet</b> ' + str(lot.loc.loc_cabinet) msg += ', <b>room</b> ' + str(lot.loc.loc_room) if lot.lot_current_user_id == None: retVal = {'error': lot.lot_barcode + ' already checked in ' + msg} else: lot.lot_current_user_id = None retVal = {'success': lot.lot_barcode + ' has been checked in ' + msg} except Exception,e: log.debug(e) retVal = {'error': 'barcode ' + barcode + ' not found in inventory'}