BlyxDocumentation
Browse chapters
Documentation / Workflow recipes

Avocet · Reorder stock after reservations

Plan replenishment after existing reservations and supplier lot sizes.

Reorder stock after reservations

Reservations can exhaust a shelf before a reorder calculation runs. Lot-size rounding must include existing backorders. Seven units are on hold. Three units remain free, so buying two lots of four brings free stock to eleven.

Run the framework with your own input

Install Blyx 0.2.1 and a Rust toolchain with a host linker, then run the versioned project. Each positional argument is a number or a comma-separated numerical vector. The CLI accepts up to 16 entries per vector. The imported module accepts longer inputs.

git clone --depth 1 --branch v0.1.0 https://github.com/Rahulchaube1/blyx-avocet.git
cd blyx-avocet
blyxc native-run project.blyx -- 10 "3,4" 8 4

API and return values

Returns [available, existing shortage, purchase units, projected free units]. Target is the desired free stock after all holds. Invalid input returns an empty vector.

ArgumentAccepted input
onhandnonnegative exact integer
holdsVector of: nonnegative exact integer
targetnonnegative exact integer
lotpositive exact integer

Use the libraries independently

The framework vendors the same library source published in these two repositories. Each module has its own package page, input contract and regression suite.

Try the program

Output Ready
Expected output
3
0
8
11
Open in the full playground →

Practice

Change onhand = 2.0, holds = [5], target = 4.0, lot = 3.0. Predict the result, then run the program.

Hint

Returns [available, existing shortage, purchase units, projected free units]. Target is the desired free stock after all holds.

Worked solution

The result vector is [0, 3, 9, 6]. Compare its fields with the return layout in the API section.

Find

    let onhand = 10.0;

Replace with

    let onhand = 2.0;

Find

    let holds = [3, 4];

Replace with

    let holds = [5];

Find

    let target = 8.0;

Replace with

    let target = 4.0;

Find

    let lot = 4.0;

Replace with

    let lot = 3.0;

Output after the change

0
3
9
6