def processRetrievedInventory(self, inventoryInfoRowId, virtualCartRowId): dbConnect = DbConnect(InventoryDAO.getDbDir()) connector = dbConnect.getConnection() # TODO: after debugging this code is done, there should be a check ensuring that there exists # such ids inventoryDAO = InventoryDAO(connector) yIdxColHeader = "Y_index" retrievedItemYIndex = inventoryDAO.selectAColumn(yIdxColHeader, inventoryInfoRowId) # if the retrieved box is at the top, no need to do updates on y_encoders and y_index if retrievedItemYIndex != inventoryDAO.selectMax(yIdxColHeader): idBoxAbove = inventoryDAO.getPriKeys(yIdxColHeader, retrievedItemYIndex+1)[0] yEncoderColHeader = "Y_encoder" encoderOffset = (inventoryDAO.selectAColumn(yEncoderColHeader, idBoxAbove) - inventoryDAO.selectAColumn(yEncoderColHeader, inventoryInfoRowId)) # update the y_encoder and y_index values for the boxes above the retrieved box xIdxColHeader = "X_index" retrievedItemXIdx = inventoryDAO.selectAColumn(xIdxColHeader, inventoryInfoRowId) sameStackItemIds = inventoryDAO.getPriKeys(xIdxColHeader, retrievedItemXIdx) for sameStackItemId in sameStackItemIds: curYIdx = inventoryDAO.selectAColumn(yIdxColHeader, sameStackItemId) if curYIdx > retrievedItemYIndex: inventoryDAO.update(sameStackItemId, yIdxColHeader, curYIdx-1) curYEncoder = inventoryDAO.selectAColumn(yEncoderColHeader, sameStackItemId) inventoryDAO.update(sameStackItemId, yEncoderColHeader, curYEncoder-encoderOffset) inventoryDAO.delete(inventoryInfoRowId) print("inventory deleted!!!") virtualCartDAO = VirtualCartDAO(connector) numItemsForPickup = virtualCartDAO.selectAColumn("NumItemAvailableForPickup", virtualCartRowId) virtualCartDAO.update(virtualCartRowId, "NumItemAvailableForPickup", numItemsForPickup+1)
def __numItemsAvailable(self, connector, barcode): barcodeDAO = BarcodeDAO(connector) barcodeColHeader = "Barcode" barcodePriKey = barcodeDAO.getPriKeys(barcodeColHeader, barcode)[0] inventoryDAO = InventoryDAO(connector) numItems = 0 barcodesInInventory = inventoryDAO.getPriKeys("BarcodeDetailsFk", barcodePriKey) for barcodeInInventory in barcodesInInventory: if inventoryDAO.selectAColumn("CheckoutFlag", barcodeInInventory) == 0: numItems += 1 return numItems
def getSecondPageInfo(self, selection): dbConnect = DbConnect(FootwearSelectionDAO.getDbDir()) connector = dbConnect.getConnection() footwearSelectionDAO = FootwearSelectionDAO(connector) footwearSelectionPriKeys = footwearSelectionDAO.getPriKeys("Selection", selection) retVal = list() barcodeDAO = BarcodeDAO(connector) for footwearSelectionPriKey in footwearSelectionPriKeys: entries = barcodeDAO.selectEntries("FootwearSelectionDetailsFk", footwearSelectionPriKey) barcodePriKey = entries[0] inventoryDAO = InventoryDAO(connector) inventories = inventoryDAO.getPriKeys("BarcodeDetailsFk", barcodePriKey) for entry in entries: retVal.append((entry[1], entry[3], entry[4], entry[5], entry[6], len(inventories) ) ) return retVal