5062

Where Does the Pallet Go?

Algorithm
Medium
Pro
put-away
warehouse
bin-ranking
directed-put-away

Where Does the Pallet Go?

A pallet lands in the receiving zone and somebody has to decide where it goes. In a directed put-away warehouse, Business Central decides: the put-away template lists prioritized rules, each rule admits a set of candidate bins, and among the bins a rule admits, the bin ranking picks the winner. When the best bin cannot hold everything, the quantity splits. You are going to build that selection core, stripped of the warehouse machinery around it.

Requirements

The starter contains two tables — keep both exactly as shipped, the grading tests seed and read them:

"Putaway Bin" — one row per bin:

  • "Bin Code" — Code[20], the primary key
  • "Bin Ranking" — Integer, higher is better
  • "Item No." — Code[20], the item currently stored in the bin; blank when the bin is empty
  • Quantity — Decimal, how much is physically stored right now; never changes
  • "Maximum Quantity" — Decimal, the most the bin can hold in total
  • "Qty. to Put Away" — Decimal, your output: how much of the pallet this bin receives

"Putaway Template Line" — the prioritized rules, one row per rule:

  • "Line No." — Integer, the primary key; the lowest line no. is the highest priority
  • "Find Same Item" — Boolean
  • "Find Empty Bin" — Boolean

Create a codeunit named "Putaway Suggestion" with one public procedure:

procedure SuggestPutaway(var PutawayBin: Record "Putaway Bin"; var PutawayTemplateLine: Record "Putaway Template Line"; ItemNo: Code[20]; QtyToPutAway: Decimal): Decimal

Rules:

  1. Work through the template lines in ascending "Line No.". Line order is priority and it outranks everything else — a bin admitted by an earlier line wins over any higher-ranked bin that only a later line admits. A later line is consulted only for quantity the earlier lines could not place.
The rest of the statement and 3 hints Unlock with Pro
ALBusiness Central 28.5
Pro
Pro problem

Solve it with Pro

You’re reading the opening of the statement. Pro unlocks the whole problem:

  • The full statement
  • Starter code in the browser editor
  • 13 grading tests, run on Business Central 28.5
  • 3 hints
  • The reference solution

Pro also opens all 92 Pro problems and lifts the daily limits on compile checks and submissions.

$10 / month
or $100 / year
Upgrade
This problem is part of Pro
Pro unlocks the full statement, tests, hints and solution. The code editor works on a computer.
Upgrade