API ドキュメント

OMS 注文 API

最終更新 2026-10-13

販売注文ドラフトの作成、照会、注文ステートマシン、WMS へのプッシュ。

注文ドラフトの作成#

POST /api/oms/orders
POST /api/oms/orders
{
  "customer_id": "<uuid>",
  "channel_id": "<uuid>",
  "channel_order_no": "AMZ-123",
  "merchant_id": "<uuid>",
  "warehouse_id": "<uuid>",
  "retailer_id": "<uuid>",
  "carrier_code": "UPS",
  "service_code": "GROUND",
  "currency": "USD",
  "ship_to": { "name": "…", "address": "…", "city": "…", "state": "…", "postal": "…", "country": "US", "phone": "…" },
  "discount": 0,
  "shipping_fee": 8.5,
  "tax": 0,
  "required_ship_date": "2026-10-20",
  "note": "…",
  "lines": [
    { "product_id": "<uuid>", "qty": 10, "price": 12.9 }
  ]
}
// -> data.order_no = "SO-YYYYMMDD-####", status = "draft"

注文の照会#

GET — 一覧と詳細
GET /api/oms/orders?statuses=confirmed,allocated&channel_id=<uuid>&q=AMZ-123&created_from=2026-10-01&page=1&page_size=20
// filters: status (single) | statuses (comma-separated) | channel_id | created_from/to (ISO) | q (order_no / channel_order_no / customer fuzzy)

GET /api/oms/orders/<id>
// detail incl. lines, customer, channel; wms_shipments = all linked WMS shipments (no/status/warehouse/carrier/tracking/split flag)

注文ステートマシン#

PATCH /api/oms/orders/[id] — action モード
PATCH /api/oms/orders/<id>
{ "action": "submit" }          // draft -> pending_review
{ "action": "approve" }         // pending_review -> confirmed (ATP check)
{ "action": "allocate", "warehouse_id": "<uuid>" }   // confirmed -> allocated
{ "action": "release", "ship_mode": "parcel" }       // allocated -> released
{ "action": "fulfill" }         // released -> fulfilled
{ "action": "partial_fulfill" }
{ "action": "deliver" }
{ "action": "cancel" }          // only before released
// illegal transition -> 400; draft edit mode: { "fields": {…}, "lines": […] } (draft only)
  • approve は ATP チェックを実行します(wms_sync は WMS 在庫残高を参照、standalone は OMS 在庫を参照)。
  • release には ship_mode が必要で、引当行を作成します(イベント sales_order.released)。

WMS へのプッシュ#

POST /api/oms/orders/[id]/push-to-wms
POST /api/oms/orders/<id>/push-to-wms
{ "warehouse_id": "<uuid>", "ship_mode": "parcel" }   // both optional
// order status must be confirmed | allocated; result: released + WMS shipment created at commit (inventory locked)
push-to-wms は wms_sync 在庫モードでのみ動作します。standalone(oms_standalone)注文は 400 NOT_WMS_SYNC で拒否されます。プッシュ後は WMS が出荷を駆動します:commit → picking → picked → packed → shipped(トラッキング付き)→ delivered。各遷移はリアルタイムで OMS イベントにミラーされます。