Calculate the Reorder_stock, based on current inventory stock
Requirement
Introduction: To calculate the Reorder stock, based on current inventory levels with average stock consumption rates, and the supplier's lead time for delivery in order maintain the safety stock available.
Requirement :
* Extract critical_stock_level based on average_consumption_rate_per_day with supplier_lead_time.
* Join inventory details with product details.
* Calculate Reorder_stock based on average_consumption_rate_per_day, supplier_lead_time, and critical_stock_level to estimate how much stock is required and add critical_stock_level then subtracts the current_stock from this total to find the reorder quantity.Display the Reorder_stock should be greater than 0.
Final expected output: Display the result with product_id, product_name, current_stock, consumption_rate, critical_stock_level, read 'supplier_lead_time' as safety_stock_duration, Reorder_stock.
Unity Catalog details:
‘purgo_playground.inventory_data’, ‘purgo_playground.products_data’.
Expected Output: Write Databricks Pyspark code without syntax error