Ejemplo n.º 1
0
	def updateContainerSize(self, contID, contSize):
		
		db = self.db
		cursor = self.cursor	# for easy access
		
		ltHandler = LocationTypeHandler(db, cursor)
		
		contSizeID = ltHandler.containerSizeToID(contSize)
		
		cursor.execute("UPDATE Container_tbl SET contTypeID=" + `contSizeID` + " WHERE containerID=" + `contID` + " AND status='ACTIVE'")
Ejemplo n.º 2
0
	def insertContainer(self, contTypeID, cSize, cName, cDesc, cLab, storage_type, storage_name, storage_address, cont_shelf, cont_rack, cont_row, cont_col):
		
		db = self.db
		cursor = self.cursor	# for easy access
		
		ltHandler = LocationTypeHandler(db, cursor)
		
		# find 'container type' and 'container size' foreign keys
		#contTypeID = ltHandler.containerTypeToID(cType)
		cType = ltHandler.findContainerTypeName(contTypeID)
		contSizeID = ltHandler.containerSizeToID(cSize)
		
		# find the next available number in this container group to assign to the new container
		contNum = self.findNextContainerNumberInGroup(contTypeID)
		
		# check if this is an isolate active container
		isoActive = ltHandler.isIsoActive(contTypeID)

		# generate barcode
		bcNum = self.findNextContainerBarcodeNumber(contTypeID, contSizeID, cLab)
		barcode = self.generateBarcode(contTypeID, contSizeID, bcNum, cLab)
		
		cursor.execute("INSERT INTO Container_tbl(contGroupID, contTypeID, contGroupCount, name, container_desc, labID, barcode, location, locationName, address, shelf, rack, row_number, col_number) VALUES(" + `contTypeID` + ", " + `contSizeID` + ", " + `contNum` + ", " + `cName` + ", " + `cDesc` + ", " + `cLab` + ", " + `barcode` + ", " + `storage_type` + ", " + `storage_name` + ", " + `storage_address` + ", " + `cont_shelf` + ", " + `cont_rack` + ", " + `cont_row` + ", " + `cont_col` + ")")
		
		newContID = int(db.insert_id())
		
		# Store container-specific properties
		nRows = ltHandler.findNumRows(contSizeID)
		nCols = ltHandler.findNumCols(contSizeID)
		
		container = Container(cType, cSize, nRows, nCols, cName, cLab, cDesc)
		
		#props = container.getContainerProperties()
		props = ltHandler.findContainerTypeProperties(contTypeID)
		
		#print "Content-type:text/html"
		#print
		#print storage_type
		
		#print `props`
		self.insertContainerProperties(newContID, props)
		
		return newContID
Ejemplo n.º 3
0
	def updateContainerInfo(self, contID, contType, contSize, contName, contDesc, contLab, storage_type, storage_name, storage_address, cont_shelf, cont_rack, cont_row, cont_col):
		
		db = self.db
		cursor = self.cursor	# for easy access
		
		ltHandler = LocationTypeHandler(db, cursor)
		
		contTypeID = ltHandler.containerTypeToID(contType)
		contSizeID = ltHandler.containerSizeToID(contSize)
		
		# Compare old container properties to new values and only update those that have actually changed
		oldContType = self.findContainerType(contID)
		oldContSize = self.findContainerSize(contID)
		oldContName = self.findContainerName(contID)
		oldContDesc = self.findContainerDescription(contID)
		oldLabID = self.findContainerLabID(contID)
		oldBarcode = self.findContainerBarcode(contID)
		

		# Update barcode IFF container type, lab or size were changed!!!!
		if oldBarcode == '' or oldContType != contType or oldContSize != contSize or oldLabID != contLab:

			# only in this case recompute barcode
			contNum = self.findNextContainerBarcodeNumber(contTypeID, contSizeID, contLab)
			
			newBarcode = self.generateBarcode(contTypeID, contSizeID, contNum, contLab)
			self.updateContainerBarcode(contID, newBarcode)
		
		# Update the rest of the container properties if old and new values differ:
		if contType != oldContType:
			self.updateContainerType(contID, contType)
		
		if contSize != oldContSize:
			self.updateContainerSize(contID, contSize)
		
		if contName != oldContName:
			self.updateContainerName(contID, contName)
	
		if contDesc != oldContDesc:
			self.updateContainerDescription(contID, contDesc)
		
		if contLab != oldLabID:
			self.updateContainerLab(contID, contLab)