AlmondTill/G3N API

On this page

postReceipt

mutation · in the family Inventory operations

What it does

Post a goods receipt — the received quantities book into stock.

POST a draft Receipt (draft -> posted, -e — 🧱 /: THE WHOLE-DOCUMENT JUDGEMENT first (every gate over every line and every junction BEFORE any write), then the lines land in stock through the chokepoint a chunk at a time under the 100-action transaction budget: a small receipt lands posted in ONE TransactWriteItems; a large one WALKS — draft -> posting -> posted under the document-walk machine — the status reads posting until every line has landed, the header carries the walk (kind post · cursor = the next lineNo to land · chunks · lineCount), a healthy in-flight walk refuses a second post CONFLICT/IN_PROGRESS and re-running post RESUMES a stalled one; a second receipt posting against the SAME PO while one is in flight refuses CONFLICT/IN_PROGRESS naming it (the PO's receivingReceiptId); an EMPTY line set refuses VALIDATION/INVALID): per line a receive movement into on_hand at the LANDED unit cost (the estimate components allocate exactly via allocateProportionally in line order — -h; the value-form re-weight; the currency law gates every touched book) + a disposition reclass companion (hold -> held reason-coded / damage -> damaged — receive lands on_hand ONLY, the law) + missing (variant × LF) junction BIRTHS via the catalogued create-on-receive hatch + StockRecord bin stamps for binned lines + the per-line merchandise/landed split STAMPED on the posted doc + the parent-PO rollup and its system:receipt_posted / system:all_received chain riding the SAME transaction. The LF is ACTIVE-re-checked (SL-b use-time). Over-receipt (cumulative > ordered per PO line) refuses CONFLICT/THREE_WAY_MATCH — the PO's declared receive.match_flag form. Partial receipts are first-class — the next arrival is a NEW Receipt. Requires the doc CURRENT revision (OCC) + the unrestricted capability.

What happens

A large receipt walks — the status reads posting until every line has landed in stock; re-run post to resume a stalled walk.

Careful

This changes your on-hand. Receive what actually arrived, not what the paperwork says.

Who may call it

Capability area: Inventory operations — Receiving, counting, transferring and moving stock.

Arguments

NameTypeRequiredNotes
idID ID!yesThe id of the record.
revisionID ID!yesThe revision id you read on the record; the change is refused if an edit landed in the meantime.
reasonStringnoNo further notes.

Returns

Receipt Receipt! — Over-receipt refuses CONFLICT/THREE_WAY_MATCH (the PO declared receive.match_flag form; tolerance ZERO until); under-receipt is partial, first-class — the next receipt is a NEW doc. posted is the immutable NON-doomed fact (corrections are compensating movements, never edits); cancelled is the doomed terminal (lists filter it). Re-running post RESUMES a stalled walk; on a healthy in-flight receipt it refuses CONFLICT/IN_PROGRESS naming the progress; one receipt posts against a purchase order at a time (its receivingReceiptId).

Example request

mutation ExamplePostReceipt($id: ID!, $revision: ID!, $reason: String) {
  postReceipt(id: $id, revision: $revision, reason: $reason) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    logicalFacilityId
    organizationId
    lineCount
    nextLineNo
  }
}

Variables:

{
  "id": "01900000-0000-7000-8000-37386ae00000",
  "revision": "01900000-0000-7000-8000-b7960e180000",
  "reason": "Correcting a miscount."
}

Send it with the envelope naming the version: "extensions": {"at": {"version": {"name":"genesis","number":0}}}.

Example response

{
  "data": {
    "postReceipt": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "RC-EXMP-0000-000F",
      "type": "Receipt",
      "caption": "Blue jeans",
      "status": "draft",
      "parentId": "01900000-0000-7000-8000-065235280000",
      "rootId": "01900000-0000-7000-8000-a093dd800000",
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revisionNum": 1,
      "revision": "01900000-0000-7000-8000-b7960e180000",
      "logicalFacilityId": "01900000-0000-7000-8000-8026f71c0000",
      "organizationId": "01900000-0000-7000-8000-44b781470000",
      "lineCount": 1,
      "nextLineNo": 1
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

Errors this call can answer

Used in