盘点

盘点历史查询接口

支持根据盘点的仓库和时间的查询,得到与之匹配的盘点。

curl -i "http://example.com/api/checks.json"
{
  "status": {
    "code": "200",
    "message": "OK"
  },
  "checks": [
    {
      "id": 36,
      "warehouse_id": 1,
      "total_profit": "0.0",
      "total_loss": "-140.0",
      "warehouse_name": "上海仓库",
      "category_name": "sdfdsf",
      "checked_at": "2016-08-22 14:09",
      "status": "临时保存",
      "creator": "test@qq.com",
      "check_items_count": 4,
      "checked_count": 0
    },
    {
      "id": 35,
      "warehouse_id": 4,
      "total_profit": "0.0",
      "total_loss": "-1.0",
      "warehouse_name": "云南仓库",
      "category_name": "全部",
      "checked_at": "2016-08-19 16:04",
      "status": "盘点完成",
      "creator": "test@qq.com",
      "check_items_count": 2,
      "checked_count": 2
    }
  ]
}
  • HTTP 请求

    GET /api/checks.json

  • 请求参数

参数名 是否必填 默认值 说明
date 日期
warehouse_id 仓库
  • 返回字段说明
返回值字段 字段类型 说明
id int 盘点ID
warehouse_id string 仓库id
total_profit decimal 盘盈
total_loss decimal 盘亏
warehouse_name string 仓库名称
category_name string 盘点分类
checked_at time 盘点时间
status string 盘点状态
creator string 盘点人
check_items_count int 共盘点项
checked_count int 已盘点项

盘点详情

根据盘点ID,获取盘点详细信息。

curl -i "http://example.com/api/checks/:id.json"
{
  "status": {
    "code": "200",
    "message": "OK"
  },
  "check": {
    "id": 35,
    "warehouse_id": 4,
    "total_profit": "0.0",
    "total_loss": "-1.0",
    "warehouse_name": "云南仓库",
    "category_name": "全部",
    "checked_at": "2016-08-19 16:04",
    "status": "盘点完成",
    "creator": "test@qq.com",
    "check_items_count": 2,
    "checked_count": 2,
    "note": null,
    "check_items": [
      {
        "id": 79,
        "product_name": "sdfsdfijkljlk",
        "quantity": "20.0",
        "system_quantity": "20.0",
        "profit_and_loss": "0.0",
        "spec": "",
        "product_id": 5,
        "check_id": 35,
        "note": ""
      },
      {
        "id": 80,
        "product_name": "dsfdsfds",
        "quantity": "1.0",
        "system_quantity": "2.0",
        "profit_and_loss": "-1.0",
        "spec": "",
        "product_id": 30,
        "check_id": 35,
        "note": ""
      }
    ],
    "generate_profit_storageio": false,
    "generate_loss_storageio": true
  }
}
  • HTTP 请求

    GET /api/checks/:id.json

  • 请求参数

参数名 是否必须 说明
id 必须 盘点ID
  • 返回字段说明

    返回值字段 | 字段类型 | 说明
    ————————— | ——- | ———–
    id | int | 盘点ID
    warehouse_id | int | 仓库id
    total_profit | decimal | 盘盈
    total_loss | decimal | 盘亏
    warehouse_name | string | 仓库名称
    category_name | string | 盘点分类
    checked_at | date | 盘点时间
    status | int | 盘点状态
    creator | string | 盘点人
    check_items_count | int | 盘点项
    checked_count | int | 已盘点项
    note | string | 备注
    check_items/id | int | 盘点项id
    check_items/product_name | string | 盘点项名称
    check_items/quantity | decimal | 盘点数
    check_items/system_quantity | decimal | 库存数
    check_items/profit_and_loss | decimal | 盘盈亏
    check_items/spec | string | 规格
    check_items/product_id | int | 产品id
    check_items/check_id | int | 盘点id
    check_items/note | string | 备注

获取盘点项

curl -i "http://example.com/api/checks/get_check_items.json"
{
  "status": {
    "code": "200",
    "message": "OK"
  },
  "items_chount": 2,
  "check_items": [
    {
      "id": 79,
      "product_name": "sdfsdfijkljlk",
      "quantity": "20.0",
      "system_quantity": "20.0",
      "profit_and_loss": "0.0",
      "spec": "",
      "product_id": 5,
      "check_id": 35,
      "note": ""
    },
    {
      "id": 80,
      "product_name": "dsfdsfds",
      "quantity": "1.0",
      "system_quantity": "2.0",
      "profit_and_loss": "-1.0",
      "spec": "",
      "product_id": 30,
      "check_id": 35,
      "note": ""
    }
  ]
}
  • HTTP 请求

    GET /api/checks/get_check_items.json

  • 请求参数

返回值字段 是否必填 说明
product_category_id 盘点产品类型
warehouse_id 盘点仓库
  • 返回字段说明
返回值字段 字段类型 说明
product_name string 盘点项名称
quantity decimal 盘点数
system_quantity decimal 库存数
profit_and_loss decimal 盘盈亏
spec string 规格
product_id int 产品id
check_id int 盘点id
note string 备注

创建盘点

curl -i POST "http://example.com/api/checks.json"
{
  "status": {
    "code": "200",
    "message": "OK"
  },
  "check": {
    "id": 36,
    "warehouse_id": 1,
    "total_profit": "0.0",
    "total_loss": "-140.0",
    "warehouse_name": "上海仓库",
    "category_name": "sdfdsf",
    "checked_at": "2016-08-22 14:09",
    "status": "临时保存",
    "creator": "test@qq.com",
    "check_items_count": 4,
    "checked_count": 0
  }
}
  • HTTP 请求

    POST /api/checks.json

  • 请求参数

返回值字段 字段类型 说明
warehouse_id int 仓库id
product_category_id int 分类id
total_profit decimal 盘盈
total_loss decimal 盘亏
checked_at date 盘点时间
status int 盘点状态
creator_id int 盘点人id
note string 备注
check_items/quantity decimal 盘点数
check_items/system_quantity decimal 库存数
check_items/profit_and_loss decimal 盘盈亏
check_items/spec string 规格
check_items/product_id int 产品id
check_items/note string 备注
  • 返回字段说明
返回值字段 字段类型 说明
id int 盘点ID
warehouse_id string 仓库id
total_profit decimal 盘盈
total_loss decimal 盘亏
warehouse_name string 仓库名称
category_name string 盘点分类
checked_at time 盘点时间
status string 盘点状态
creator string 盘点人
check_items_count int 共盘点项
checked_count int 已盘点项
文档更新时间: 2025-03-17 14:52   作者:姜河