**版本：202201**

# 更新采购单

**PUT** `/openapi/2022-01/procurements/:id`

通过采购单 ID 更新现有采购单的详细信息。

## 请求

**Path参数**

- `id` string (required)

  Procurement's ID

**application/json**

**请求体 | 示例**

**请求体**

- `procurement` object

  - `supplier_id` string

    Supplier's ID
  - `note` string

```json
{
  "procurement": {
    "supplier_id": "string",
    "note": "string"
  }
}
```

## 响应

**200 | 400 | 404 | 422**

200

**application/json**

**数据结构 | 示例 | Result**

**数据结构**

- `procurement` object

  - `id` string

    **示例：** `382451985837728044`
  - `procurement_sn` string

    **示例：** `00000002`
  - `supplier_id` string

    **示例：** `382411381263052204`
  - `location_id` string

    **示例：** `190035786870033452`
  - `note` string

    **示例：** `testaaa`
  - `state` integer

    **默认值：** `0`

    **示例：** `1`
  - `pending_quantity` integer

    **默认值：** `0`

    **示例：** `0`
  - `received_quantity` integer

    **默认值：** `0`

    **示例：** `0`
  - `rejected_quantity` integer

    **默认值：** `0`

    **示例：** `0`
  - `transfer_quantity` integer

    **默认值：** `0`

    **示例：** `0`
  - `created_by` string

    **示例：**
  - `created_at` string

    **示例：** `2024-05-21T08:47:39Z`
  - `updated_at` string

    **示例：** `2024-05-21T08:50:36Z`

```json
{
  "procurement": {
    "id": "382451985837728044",
    "procurement_sn": "00000002",
    "supplier_id": "382411381263052204",
    "location_id": "190035786870033452",
    "note": "testaaa",
    "state": 1,
    "pending_quantity": 0,
    "received_quantity": 0,
    "rejected_quantity": 0,
    "transfer_quantity": 0,
    "created_by": "",
    "created_at": "2024-05-21T08:47:39Z",
    "updated_at": "2024-05-21T08:50:36Z"
  }
}
```

```json
{
    "procurement": {
        "id": "382451985837728044",
        "procurement_sn": "00000002",
        "supplier_id": "382411381263052204",
        "location_id": "190035786870033452",
        "note": "testaaa",
        "state": 1,
        "pending_quantity": 0,
        "received_quantity": 0,
        "rejected_quantity": 0,
        "transfer_quantity": 0,
        "created_by": "",
        "created_at": "2024-05-21T08:47:39Z",
        "updated_at": "2024-05-21T08:50:36Z"
    }
}
```

400

**application/json**

**数据结构 | 示例 | Result**

**数据结构**

- `errors` string[]

```json
{
  "errors": [
    "invalid procurement_id"
  ]
}
```

```json
{
  "errors": [
    "invalid procurement_id"
  ]
}
```

404

**application/json**

**数据结构 | 示例 | Result**

**数据结构**

- `errors` string[]

```json
{
  "errors": [
    "Procurement not found"
  ]
}
```

```json
{
  "errors": [
    "Procurement not found"
  ]
}
```

422

**application/json**

**数据结构 | 示例 | Result**

**数据结构**

- `errors` string[]

```json
{
  "errors": [
    "Supplier not found"
  ]
}
```

```json
{
  "errors": [
    "Supplier not found"
  ]
}
```
