Chameleoon MAX · Stock planning
stockSources query
stockSources is a GraphQL query of the Chameleoon MAX API. Send it as POST https://max-api.chameleoon.sk/api/v1/graphql with your API key, see Chameleoon MAX.
Works out where needed goods could be taken from: each need is split over the free stock in the
bins input.from reaches, in the order to take it. Use it with stockDemand to plan a
transfer advice. Nothing is moved or reserved.
- Requires the
stockCard.readandposition.readpermissions. - A line's
lotalso requires thelot.readpermission. - A warehouse in
from.warehouseIdsoutside your API key's warehouse, legal-entity or country scope is left out, as instockCards.forWarehouseIdoutside it, or unknown, returnsNOT_FOUND.
How the split is worked out
- Only bins of kind
STOCKorRECEIVINGthat are in use are taken from, narrowed byfrom. - Free stock: for each row of
stockQuantswhose lot is released, and not expired where the row's warehouse blocks expired stock, its quantity less what is reserved on that bin and lot. WithforWarehouseId, the lot must also not be expired where that warehouse blocks expired stock. - With
forWarehouseId, every other warehouse first keeps what its own confirmed orders still miss: of a variant's free stock thatfromreaches there, thestockDemandmissingof that variant and warehouse (waitinglessincoming, never below 0) is not offered, kept from the rows that come last in the order. So a move between warehouses never takes what the source warehouse's own orders wait for. The warehouseforWarehouseIditself keeps nothing back. - The order: first expiry first (an expired lot last where the row's warehouse, or
forWarehouseId, only warns), then the larger free quantity first, then bin code, bin id and lot. Needs name distinct variants, so no row is promised twice. - At most 20 lines per need. What they do not cover is in
uncovered, withLINE_CAPwhen more free stock was left andNO_STOCKwhen none was.
input.exceptAdviceIds names OPEN transfer advices that nobody has started, at most 20. What
they hold is free again. The rules are those of binRefills.
Each need is priced as 20 lines at 3 points each, whatever you select.
Costs 2 points plus 60 per need.
Arguments
input:StockSourcesInput!· required
Returns
Example
Query
Code
Variables
Code
Response
Code
Values are illustrative: replace IDs and codes with your own before you send the call.