def updateContainerType(self, contID, contType): db = self.db cursor = self.cursor # for easy access ltHandler = LocationTypeHandler(db, cursor) contTypeID = ltHandler.containerTypeToID(contType) # container number needs to be updated too, since the container was moved into a new group contNum = self.findNextContainerNumberInGroup(contTypeID) cursor.execute("UPDATE Container_tbl SET contGroupCount=" + `contNum` + " WHERE containerID=" + `contID` + " AND status='ACTIVE'") # AND container-type specific properties need to be changed too self.updateContainerProperties(contID, contType) # Finally change container type cursor.execute("UPDATE Container_tbl SET contGroupID=" + `contTypeID` + " WHERE containerID=" + `contID` + " AND status='ACTIVE'")
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)