Packing and tender readiness

Complete contents and a measured weight before verification, and verification before labels and tender.

Request with "decision": "pack" and one of these operations: verify, tender, label.

Clauses applied

  • pack.label: The configured CarrierRequests operation is stable for that verified revision.
  • pack.verify: Complete PackVerify or PalletVerify records Picked −q / Packed +q on the verified output with no quantity movement; an incomplete carton remains Picked and cannot be tendered.
  • pack.weight: Allowed absolute weight deviation is max(policy pounds, planned positive gross weight × policy percent / 100); missing scale/weight/geometry never yields a pass.
  • pack.external: Document an independently checked external-scale measurement when the station scale is unavailable.
  • handover.manifest: Manifest close freezes a batch; actual tender alone authorises the warehouse issue, and delivery confirmation does not issue again.

Evidence questions

weight_measured@1

This note explains the actual weight recorded for one packed carton. Does it show the weight was measured on a scale for this carton?

AnswerMeaning
trueThe weight was read from a scale for this carton: the station scale, or another scale whose reading a second person checked.
falseThe weight was planned, estimated, copied from another carton, or typed in without a scale reading.

Examples

Tendering a shipment with a partly packed carton

{
  "decision": "pack",
  "proposal": {
    "operation": "tender",
    "shipment": "SH-30512"
  },
  "cartons": [
    {
      "id": "CTN-30512-1",
      "stage": "Verified",
      "planned": [
        {
          "line": "OL-1",
          "qty": "6"
        }
      ],
      "packed": [
        {
          "line": "OL-1",
          "qty": "6"
        }
      ]
    },
    {
      "id": "CTN-30512-2",
      "stage": "Unverified",
      "planned": [
        {
          "line": "OL-2",
          "qty": "6"
        }
      ],
      "packed": [
        {
          "line": "OL-2",
          "qty": "2"
        }
      ]
    }
  ]
}

Response from the rules with no model loaded, so every question abstains.

{
  "verdict": "reject",
  "next": {
    "action": "verify_first",
    "text": "1 carton(s) are not verified (CTN-30512-2 first). Only verified cartons can be tendered."
  },
  "questions": []
}

Run this example in the consoleDownload the request

Verifying a carton with an estimated weight

{
  "decision": "pack",
  "proposal": {
    "operation": "verify",
    "carton": "CTN-40917"
  },
  "policy": {
    "weight_tolerance_lb": "0.5",
    "weight_tolerance_pct": "3"
  },
  "cartons": [
    {
      "id": "CTN-40917",
      "stage": "Unverified",
      "planned": [
        {
          "line": "OL-1",
          "qty": "3"
        }
      ],
      "packed": [
        {
          "line": "OL-1",
          "qty": "3"
        }
      ],
      "planned_weight_lb": "8.2",
      "actual_weight_lb": "8.2",
      "weight_note": "Station 4 scale down since 2pm, used the planned weight so the carton could go."
    }
  ]
}

Response from the rules with no model loaded, so every question abstains.

{
  "verdict": "review",
  "next": {
    "action": "confirm_weight",
    "text": "It is not certain the weight recorded for carton CTN-40917 was measured. Hold the carton until a measured weight is confirmed.",
    "role": "Warehouse Manager"
  },
  "questions": [
    {
      "ask": "cartons/0",
      "question": "weight_measured@1",
      "status": "model_unavailable",
      "evidence": [
        "/cartons/0/weight_note"
      ]
    }
  ]
}

Run this example in the consoleDownload the request

Call it from your code

Each snippet sends the first example above to the hosted API with the key in RACKSORT_API_KEY and prints the verdict and the next step. Create an account, then create a key. The quickstart walks through the first request.

curl

export RACKSORT_API_KEY="paste-your-key-here"
curl https://racksort.com/api/v1/decide \
  -H "Authorization: Bearer $RACKSORT_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'EOF'
{
  "decision": "pack",
  "proposal": {
    "operation": "tender",
    "shipment": "SH-30512"
  },
  "cartons": [
    {
      "id": "CTN-30512-1",
      "stage": "Verified",
      "planned": [
        {
          "line": "OL-1",
          "qty": "6"
        }
      ],
      "packed": [
        {
          "line": "OL-1",
          "qty": "6"
        }
      ]
    },
    {
      "id": "CTN-30512-2",
      "stage": "Unverified",
      "planned": [
        {
          "line": "OL-2",
          "qty": "6"
        }
      ],
      "packed": [
        {
          "line": "OL-2",
          "qty": "2"
        }
      ]
    }
  ]
}
EOF

Python

Python 3.8 or newer, standard library only. Keep the User-Agent header: requests with Python's default one are refused. With requests or httpx it is not needed.

import json
import os
import urllib.error
import urllib.request

request = {
    "decision": "pack",
    "proposal": {
        "operation": "tender",
        "shipment": "SH-30512",
    },
    "cartons": [
        {
            "id": "CTN-30512-1",
            "stage": "Verified",
            "planned": [
                {
                    "line": "OL-1",
                    "qty": "6",
                },
            ],
            "packed": [
                {
                    "line": "OL-1",
                    "qty": "6",
                },
            ],
        },
        {
            "id": "CTN-30512-2",
            "stage": "Unverified",
            "planned": [
                {
                    "line": "OL-2",
                    "qty": "6",
                },
            ],
            "packed": [
                {
                    "line": "OL-2",
                    "qty": "2",
                },
            ],
        },
    ],
}

call = urllib.request.Request(
    "https://racksort.com/api/v1/decide",
    data=json.dumps(request).encode(),
    headers={
        "Authorization": f"Bearer {os.environ['RACKSORT_API_KEY']}",
        "Content-Type": "application/json",
        # Cloudflare refuses Python's default User-Agent, so name the client.
        "User-Agent": "racksort-example/1.0",
    },
)
try:
    with urllib.request.urlopen(call, timeout=30) as response:
        result = json.load(response)
except urllib.error.HTTPError as error:
    raise SystemExit(json.load(error)["error"]["message"])
print(result["verdict"], "-", result["next"]["text"])

TypeScript

Node.js 18 or newer. Save it as decide.mts and run npx tsx decide.mts.

type Verdict = "allow" | "replay" | "reject" | "review" | "reconcile";
interface Decision {
  verdict: Verdict;
  state?: string;
  next: { action: string; text: string; role?: string };
}

const request = {
  "decision": "pack",
  "proposal": {
    "operation": "tender",
    "shipment": "SH-30512"
  },
  "cartons": [
    {
      "id": "CTN-30512-1",
      "stage": "Verified",
      "planned": [
        {
          "line": "OL-1",
          "qty": "6"
        }
      ],
      "packed": [
        {
          "line": "OL-1",
          "qty": "6"
        }
      ]
    },
    {
      "id": "CTN-30512-2",
      "stage": "Unverified",
      "planned": [
        {
          "line": "OL-2",
          "qty": "6"
        }
      ],
      "packed": [
        {
          "line": "OL-2",
          "qty": "2"
        }
      ]
    }
  ]
};

const response = await fetch("https://racksort.com/api/v1/decide", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.RACKSORT_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify(request),
});
const body = await response.json();
if (!response.ok) throw new Error(body.error.message);
const result = body as Decision;
console.log(result.verdict, "-", result.next.text);

Request schema

{
  "type": "object",
  "required": [
    "decision",
    "proposal",
    "cartons"
  ],
  "additionalProperties": false,
  "properties": {
    "decision": {
      "const": "pack"
    },
    "proposal": {
      "type": "object",
      "required": [
        "operation"
      ],
      "additionalProperties": false,
      "properties": {
        "operation": {
          "type": "string",
          "enum": [
            "verify",
            "tender",
            "label"
          ]
        },
        "carton": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "shipment": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        }
      }
    },
    "cartons": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "stage",
          "planned",
          "packed"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "stage": {
            "type": "string",
            "enum": [
              "Open",
              "Unverified",
              "Verified",
              "Hold"
            ]
          },
          "planned": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "line",
                "qty"
              ],
              "additionalProperties": false,
              "properties": {
                "line": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "qty": {
                  "type": "string",
                  "format": "decimal"
                }
              }
            },
            "maxItems": 500
          },
          "packed": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "line",
                "qty"
              ],
              "additionalProperties": false,
              "properties": {
                "line": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "qty": {
                  "type": "string",
                  "format": "decimal"
                }
              }
            },
            "maxItems": 500
          },
          "planned_weight_lb": {
            "type": "string",
            "format": "decimal"
          },
          "actual_weight_lb": {
            "type": "string",
            "format": "decimal"
          },
          "weight_note": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4000
          }
        }
      },
      "minItems": 1,
      "maxItems": 500
    },
    "policy": {
      "type": "object",
      "required": [
        "weight_tolerance_lb",
        "weight_tolerance_pct"
      ],
      "additionalProperties": false,
      "properties": {
        "weight_tolerance_lb": {
          "type": "string",
          "format": "decimal"
        },
        "weight_tolerance_pct": {
          "type": "string",
          "format": "decimal"
        }
      }
    }
  }
}