FlexDock
供应商对接接口 · 参考
Supplier Integration API · Reference

供应商对接接口

Supplier Integration API

WMS 与劳务商系统之间的人员、叉车证、考勤数据通道。本文为提议版接口契约,字段与规则可按你们实际调整。

The data channel between WMS and supplier systems for workers, forklift certification, and attendance. This is a proposed contract — fields and rules are adjustable to your operation.

1 · 总览

1 · Overview

基础地址 https://api.flexdock.example/v1 · 全程 HTTPS · 请求/响应均为 JSON · 版本通过路径前缀(/v1)管理。

Base URL https://api.flexdock.example/v1 · HTTPS only · JSON request/response · versioned by path prefix (/v1).

两种对接模式

Two integration modes

①需求 WMS ──────────────▶ 供应商 ②拉取人员 WMS ◀────────────── 供应商系统 (人员 + 叉车证) ③试工结果 WMS ──────────────▶ 供应商 (留用 / 退回) ④考勤回传 WMS ──────────────▶ 供应商 (到岗 / no-show / 改动留痕) ▲ └── 同一通道,按 vendor_id 隔离
1. Request WMS ──────────────▶ Vendor 2. Pull WMS ◀────────────── Vendor system (workers + forklift cert) 3. Tryout WMS ──────────────▶ Vendor (retained / released) 4. Attendance WMS ──────────────▶ Vendor (present / no-show / audit) ▲ └── one channel, isolated by vendor_id

2 · 认证与数据隔离

2 · Authentication & Data Isolation

每个供应商分配一把 API Key,绑定唯一 vendor_id。请求头携带:

Each vendor gets an API key bound to a unique vendor_id. Send it in the header:

Authorization: Bearer vk_live_3a9f...e21
Content-Type: application/json
Idempotency-Key: 8f14e45f   # POST 去重,可选
🔒
核心保证:隔离在接口层强制,不靠前端。 Core guarantee: isolation is enforced at the API layer, not the frontend. 服务端从 API Key 解析出 vendor_id,并在每一次查询中强制注入该过滤条件。任何访问到非本供应商资源的请求一律返回 403。供应商看不到别家的人员、rate 或考勤。 The server resolves vendor_id from the key and injects it as a filter into every query. Any attempt to touch another vendor's resource returns 403. Vendors never see other vendors' workers, rates, or attendance.
💲
薪资/成本字段不出现在供应商可见的响应里。 供应商只提交自己的报价,读不到任何跨供应商的成本对比;薪资真值留在 RMS 宽表,经服务层裁剪后才出接口。 Payroll/cost fields are excluded from vendor-visible responses. A vendor submits only its own bill rate and can never read cross-vendor cost; true payroll stays in the RMS table and is trimmed by the service layer before it reaches the API.

3 · 端点

3 · Endpoints

3.1 获取派给本公司的需求

3.1 List requests assigned to you

GET/dispatch-requests

查询参数:statusopen / filling / tryout / closed)、shiftdate。仅返回本 vendor_id 的需求。

Query params: status (open / filling / tryout / closed), shift, date. Returns only your vendor_id's requests.

{
  "data": [{
    "request_id": "REQ-2402",
    "role": "forklift",
    "shift": "night",
    "headcount_needed": 4,
    "tryout_buffer": 6,          # 多要人来试工:需 4 报 6
    "forklift_required": true,
    "report_time": "2026-06-22T19:00:00-04:00",
    "location": "Ontario DC-3",
    "urgent": false,
    "status": "open"
  }]
}

3.2 提交回填人员(含叉车证)

3.2 Submit candidates (with forklift cert)

POST/dispatch-requests/{id}/candidates

模式 B 下,等价于 WMS 调用供应商的 GET /candidates?request_id= 拉取同样结构。

In Mode B this maps to WMS calling the vendor's GET /candidates?request_id= returning the same shape.

{
  "candidates": [{
    "external_worker_id": "V-B-10293",   # 供应商侧唯一ID,用于去重
    "full_name": "Diego R.",
    "role": "forklift",
    "source": "indeed",
    "report_time": "2026-06-22T19:00:00-04:00",
    "location": "Ontario",
    "bill_rate": 27.0,                    # 仅本供应商可见
    "forklift_cert": {
      "status": "valid",                  # valid | pending | none
      "cert_no": "ON-FLT-88421",
      "expires_on": "2027-03-01"
    }
  }]
}
🦺
叉车证由服务端二次校验。 即使供应商填 valid,若 expires_on 已过期或缺 cert_no,WMS 自动将该人置为 pending,不进试工名单。 Cert is re-validated server-side. Even if the vendor sends valid, an expired expires_on or missing cert_no flips the worker to pending and keeps them out of the tryout roster.

3.3 填不满时提交卡点原因

3.3 Report a shortfall reason

POST/dispatch-requests/{id}/shortfall
{
  "filled_count": 2,
  "reason": "Local pool thin this week; contacted 3 channels, still short."
}

reason 服务端强制 ≥ 40 字符,过短返回 422。原因留档,供供应商内部反思与我方评估。

reason must be ≥ 40 chars (server-enforced); shorter returns 422. Stored for the vendor's review and our evaluation.

3.4 读取试工结果

3.4 Read tryout outcomes

GET/dispatch-requests/{id}/tryout-results
{
  "results": [
    { "external_worker_id": "V-B-10293", "outcome": "retained" },
    { "external_worker_id": "V-B-10311", "outcome": "released" }   # 试工不计费
  ]
}

3.5 考勤同步(只读 + 改动留痕)

3.5 Attendance sync (read-only + audit)

GET/attendance?date=2026-06-22

考勤以现场签到为准,供应商只读。任何修改都带留痕,用于 HRBP 的考勤修改率监控。

Site check-in is the source of truth; vendors read only. Every change carries an audit trail feeding HRBP's attendance-modification-rate monitoring.

{
  "records": [{
    "external_worker_id": "V-C-77210",
    "request_id": "REQ-2403",
    "status": "no_show",            # present | no_show | scheduled
    "check_in": null,
    "modification": {               # 有改动时出现
      "modified_by": "hrbp.ontario",
      "modified_at": "2026-06-22T16:40:00-04:00",
      "from": "present", "to": "no_show",
      "reason": "Left after 1h, corrected by floor lead"
    }
  }]
}
👁
改动对供应商透明。 供应商能看到自己的人被改了什么、为什么改——减少扯皮,也呼应 HRBP 对考勤修改率担责这条线。 Modifications are transparent to vendors. A vendor sees what changed on its workers and why — reducing disputes and reinforcing HRBP's accountability for the modification rate.

4 · 错误码

4 · Error Codes

HTTP含义Meaning
401API Key 无效或缺失Invalid or missing API key
403访问了非本供应商的资源(隔离拦截)Accessing another vendor's resource (isolation block)
404需求 / 人员不存在Request or worker not found
409重复提交(同 external_worker_id / Idempotency-Key)Duplicate submission (same external_worker_id / Idempotency-Key)
422校验失败(卡点原因过短、叉车证过期等)Validation failed (reason too short, cert expired, etc.)
429超出频率限制Rate limit exceeded

5 · 关键字段

5 · Key Fields

字段Field说明Description
external_worker_id必填req供应商侧人员唯一ID,去重与跨班次追踪的主键Vendor-side unique worker ID; the key for dedup and cross-shift tracking
tryout_buffersys超额试工人数(需 N 报 M)Over-supply headcount for tryout (need N, send M)
forklift_cert.status必填reqvalid / pending / none,服务端按有效期复核valid / pending / none; re-checked against expiry server-side
bill_rate仅自见own-only本供应商报价,跨供应商不可见Vendor's own rate; never visible cross-vendor
modificationaudit考勤改动留痕,喂 HRBP 修改率Attendance change audit; feeds HRBP modification rate
📝
这是提议版,不是定稿。 频率限制、卡点原因字符数、叉车证以外的证照(如 reach truck)、是否加 webhook 推送,都可以按你们实际再定。需要我把它做成可导入的 OpenAPI(Swagger) 规范文件给开发,告诉我。 This is a proposal, not final. Rate limits, the shortfall character minimum, certs beyond forklift (e.g. reach truck), and whether to add webhook pushes are all adjustable. I can turn this into an importable OpenAPI (Swagger) spec for your developers — just ask.
FlexDock 供应商对接接口 · 提议版 v1 · 演示文档
FlexDock Supplier Integration API · Proposal v1 · Reference doc