Query stock for sale
query_stockWhat is still for sale: boxes on live shipments, on the water or landed, that are not pre-allocated, from the packing lists, grouped by produce and calibre (size) like the Trading View. Use it for "how many size 14 avocados are unallocated in Rotterdam", "what can we still sell arriving next week" or "which mango sizes are left with QC 7 or better". available_boxes is what can be sold; allocated_boxes is already pre-allocated. in_transit_boxes and arrived_boxes split the available boxes by where the shipment is. qc_score is the box-weighted average of the 1-9 inspection scores (9 excellent, 6 acceptable, 1 discard) over the scored available boxes; qc_scored_boxes says how many have one. min_qc_score keeps only pallets whose own score meets it, and excluded then counts the available boxes dropped for having no score or a lower one: say so when they are many, since an uninspected container is not missing stock. Archived shipments are not counted. Each row lists its shipments with container_numbers: name a shipment by its container number and link it to its shipment_url, never a made-up URL. Calibres are compared as packers write them once normalised ("14", "12+", "113"); pass them as strings.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| arrival | No | "in_transit" for on the water, "arrived" for landed (including in warehouse), "in_warehouse" for received at the warehouse only, "any" (default) for all. | any |
| produce | No | Only this produce, such as "avocado". Plural is fine. | |
| variety | No | Only this variety, such as "Hass". | |
| calibres | No | Only these calibres (sizes or counts), such as ["14", "16"]. | |
| group_by | No | How to split the rows. Produce always comes first. Default: ["produce", "calibre"]. | |
| destination | No | Only shipments to this port or country, such as "Rotterdam" or "Netherlands". | |
| min_qc_score | No | Only pallets whose latest QC score is at least this, 1 to 9. |