# Sản phẩm xuất nhập kho nháp

* Tính năng này dùng để lấy danh sách [sản phẩm xuất nhập kho nháp](https://nhanh.vn/inventory/requirement/index).

## Request

* Xem các [common request params](/v3/readme.md#request-params)

```curl
curl --location 'http://pos.open.nhanh.vn/v3.0/bill/draftproducts?appId={{appId}}&businessId={{businessId}}' \
--header 'Authorization: {{accessToken}}' \
--header 'Content-Type: application/json'
--data '{
    "filters": {
        "modes": [2],
        "lastUpdatedAtFrom": 1753981239,
        "lastUpdatedAtTo": 1756659639,
        "depotIds": [31010]
    },
    "paginator": {
        "size": 50
    }
}'
```

### Filters

| Key               | Type  | Description                                               |
| ----------------- | ----- | --------------------------------------------------------- |
| billIds           | array | List ID phiếu xuất nhập kho nháp                          |
| types             | array | [Loại xuất nhập kho](/v3/modelconstant.md#inventory-type) |
| modes             | array | [Kiểu xuất nhập kho](/v3/modelconstant.md#inventory-mode) |
| depotIds          | array | Mảng ID kho hàng                                          |
| statuses          | array | List trạng thái phiếu nháp                                |
| lastUpdatedAtFrom | int   | Thời gian cập nhật cuối từ (timestamp)                    |
| lastUpdatedAtTo   | int   | Thời gian cập nhật cuối đến (timestamp)                   |

## Response

* Xem cấu trúc chung [tại đây](/v3/readme.md#response).

### Failed response

* Xem các mã lỗi chung [tại đây](/v3/readme.md#failed-response).

### Successful response

```json
{
  "code": 1,
  "paginator": {
    "next": "Dùng để lấy dữ liệu trang tiếp theo"
  },
  "data": [
    {
      "id": "(int) ID bản ghi sản phẩm xuất nhập kho nháp",
      "billId": "(int) ID hóa đơn xuất nhập kho nháp",
      "type": "(int) Loại xuất nhập kho",
      "mode": "(int) Kiểu xuất nhập kho",
      "status": "(int) Trạng thái",
      "damagedQuantity": "(double) Số lượng lỗi",
      "discount": "(int) Chiết khấu",
      "fromDepot": {
        "id": "(int) ID kho hàng",
        "name": "(string) Tên kho hàng"
      },
      "toDepot": {
        "id": "(int) Id kho hàng",
        "name": "(string) Tên kho hàng"
      },
      "supplier": {
        "id": "(int) ID nhà cung cấp",
        "name": "(string) Tên nhà cung cấp",
        "mobile": "(string) Số điện thoại nhà cung cấp"
      },
      "product": {
        "id": "(int) ID sản phẩm",
        "code": "(string) Mã sản phẩm",
        "barcode": "(string) Mã vạch sản phẩm",
        "name": "(string) Tên sản phẩm",
        "prices": {
          "retail": "(double) Giá bán",
          "import": "(double) Giá nhập",
          "avgCost": "(double) Giá vốn"
        },
        "batchId": "(int) ID lô sản phẩm",
        "imeiId": "(int) ID IMEI",
        "imei": "(string) Số IMEI"
      },
      "required": {
        "quantity": "(int) Số lượng yêu cầu",
        "price": "(int) Giá yêu cầu",
        "description": "(string) Ghi chú",
        "userId": "(int) ID người yêu cầu",
        "userName": "(string) Tên người yêu cầu",
        "datetime": "(string) Thời gian yêu cầu"
      },
      "approved": {
        "quantity": "(int) Số lượng duyệt",
        "price": "(int) Giá duyệt",
        "description": "(string) Ghi chú",
        "userId": "(int) ID người duyệt",
        "userName": "(string) Tên người duyệt",
        "approvedAt": "(int) Thời gian duyệt (định dạng timestamp)"
      },
      "confirmed": {
        "quantity": "(int) Số lượng xác nhận",
        "confirmedAt": "(int) Thời gian xác nhận (định dạng timestamp)"
      }
    }
  ]
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://apidocs.nhanh.vn/v3/bill/draftproducts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
