Skip to content

POST /wms/inventory/physical-report/finalize

WMS > wms.inventory

What it does

/wms/inventory/physical-report/finalize accepts POST and is declared in app/systems/WMS/inventory/api_routes.php:1002 as a path.

The route handler delegates to physical_inventory_save_draft(). That function is the owner of this behaviour; the route entry is only dispatch.

Call chain:

  1. → physical_inventory_save_draft() — app/addons/reports/query_helper.php:2405
  2. ↳ physical_inventory_require_schema() — app/addons/reports/query_helper.php:2072
  3. ↳ physical_inventory_schema_ready() — app/addons/reports/query_helper.php:2064

Who calls it

Called from:

  • frontend/pages/system/WMS/inventory/inventory-report.php

A caller is the strongest available evidence of the intended use.

Input

Where Key
body COMMODITIES
body COMPANYID
body COMPANY_ID
body FROM
body LINES
body PERIODFROM
body PERIODTO
body TO
body commodities
body companyId
body lines
body periodFrom
body periodTo

Request bodies must not use TYPE, ACTION or USERNAME as contract fields.

Output

Key
AVG_WEIGHT_LB
BALE_QTY
CLIENT_ID
COMMODITY
COMPANY_UUID
FINALIZED_AT
PERIOD_FROM
PERIOD_TO
SNAPSHOT_UUID
SORT_ORDER
ST
STATUS

Success is { "data": …, "requestId": "…" }. Failure is { "error": { "code", "message" }, "requestId": "…" }.

SQL executed

UPDATE T_INVENTORY_LOT_SNAPSHOT

Data

Tables reached from the owner function:

  • T_INVENTORY_LOT_SNAPSHOT

Access

  • module-gated on wms.inventory, so tenant module access applies

Validation and failure messages

  • Company is required.
  • At least one Physical Inventory commodity row is required.
  • Finalized Physical Inventory cannot be edited.
  • Physical Inventory draft changed or was finalized by another session. Reload before saving.
  • Inventory Lot Snapshot schema is not installed. Run the inventory lot snapshot migration first.

These strings come from the owner function and are the messages a client can receive. They are also the cheapest way to tell a rejected request from a broken one.