Tuesday, May 6, 2025

Supply Chain and Inventory Management – Real-Time Inventory Tracker

 

Notes:

  • Problem Solved: Provides real-time tracking of inventory levels across multiple warehouses, ensuring accurate stock information.

  • Benefits: Businesses can monitor stock levels in real-time, reducing the risk of stockouts and overstocking.

  • Adoption: Integrate this script with existing inventory systems or use it as a standalone tool for smaller operations.

Python Code:


import pandas as pd


class InventoryTracker:

    def __init__(self, warehouse_data):

        self.warehouse_data = pd.DataFrame(warehouse_data)


    def update_inventory(self, warehouse_id, product_id, quantity):

        self.warehouse_data.loc[

            (self.warehouse_data['WarehouseID'] == warehouse_id) & 

            (self.warehouse_data['ProductID'] == product_id), 'Quantity'] += quantity


    def get_inventory(self):

        return self.warehouse_data


# Sample warehouse data

warehouse_data = [

    {'WarehouseID': 1, 'ProductID': 'A101', 'Quantity': 100},

    {'WarehouseID': 1, 'ProductID': 'B202', 'Quantity': 150},

    {'WarehouseID': 2, 'ProductID': 'A101', 'Quantity': 200},

    {'WarehouseID': 2, 'ProductID': 'C303', 'Quantity': 50},

]


# Initialize tracker

tracker = InventoryTracker(warehouse_data)


# Update inventory

tracker.update_inventory(1, 'A101', 50)


# Display updated inventory

print(tracker.get_inventory())




No comments:

Post a Comment

IoT (Internet of Things) Automation - Smart Energy Usage Tracker

  Notes: Problem Solved: Logs and analyzes power usage from smart meters. Customization Benefits: Track per-device energy and set ale...