Scenario A vs Scenario B
Classification rule
For each SKU across eligible warehouses:
| Metric | Calculation |
|---|---|
| Required | floor(sales velocity × DID ÷ pack size) per warehouse |
| Deficit | max(0, required − current stock packs) |
| Surplus | max(0, current stock packs − required) |
Then:
- Scenario A — total surplus ≥ total deficit → every deficit can be fully covered.
- Scenario B — total surplus < total deficit → proportional rationing (default mode).
The run summary shows counts: A, B, and skip (balanced — no action).
Scenario A — full coverage
Supply order:
- Central warehouse (if set) — always first.
- Other warehouses — by configured priority, then surplus descending.
Matching allocates to highest deficit first until each deficit warehouse is filled.
Example: Deficit = 227 packs, Surplus = 2,239 packs → one transfer from Central Warehouse to IPD Block B covers the short branch completely.
Scenario B — proportional rationing
When the system cannot cover all deficits:
adjusted_deficit = floor(original_deficit × total_surplus ÷ total_deficit)Each deficit warehouse gets a proportional slice of available surplus. Supply still follows priority order, but total moved may be far below total need.
Example: Deficit = 618 packs, Surplus = 45 packs → ~7% coverage. IPD Block B might receive 28 units instead of 390.
The run summary still creates transfers for what can move — pharmacists see the gap clearly at validation.
Pack rounding
| Step | Rounding | Rationale |
|---|---|---|
| Required packs | Floor | Conservative — sub-pack demand accumulates |
| Stock packs | Ceil | Partial packs still count as available |
| Transfer units | Exact multiply | Output in units for STR creation |