采购入库/退货单
采购入库/退货单列表
curl -H "Authorization: Token token=<token>, uid=<uid>" \
http://example.com/api/purchases.json
{
"status": {
"code": 200,
"message": "OK"
},
"purchases": [
{
"id": 735,
"number": "CGRKD201903290001",
"type": "purchase",
"type_name": "采购入库单",
"category": "in",
"amount": "11.600000",
"warehouse_id": 25,
"warehouse_name": "名字很长很长很长的仓库",
"supplier_name": "代理商1",
"purchaser_name": "XXX",
"status": "approving",
"status_i18n": "待1级审批",
"creator": "XXX",
"operator": "XXX",
"operated_at": "2019-03-29 13:45",
"created_at": "2019-03-29 13:45",
"entry_or_io_at": "2019-03-29"
}
]
}
HTTP请求
GET /api/purchases.json
请求参数
参数名 | 是否必填 | 默认值 | 字段说明 |
---|---|---|---|
参数名 | 是否必须 | 默认值 | 说明 |
— | — | — | — |
category | 否 | in | in: 采购入库;in: 采购退货 |
date | 否 | 本月 | 出库日期 |
status | 否 | 无 | 审批状态(draft[草稿] approving[待审批] submitted[已提交] rejected[已驳回] passed[审批通过] deprecated[已作废]) |
tax_added | 否 | 无 | 是否含税 |
supplier_id | 否 | 无 | 供应商 |
warehouse_id | 否 | 无 | 仓库 |
product_category_id | 否 | all | 产品分类 |
product_id | 否 | all | 产品 |
department_id | 否 | all | 采购人员部门 |
purchaser_id | 否 | all | 采购人员 |
creator_department_id | 否 | all | 创建人部门 |
creator_id | 否 | all | 创建人 |
keyword | 否 | 无 | 关键词 |
keyword_type | 否 | 无 | 关键词类型(product_items.name: 产品名称, product_items.spec: 规格; product_items.attr_names: 属性; purchases.number: 单据编号/备注;) |
page | 否 | 1 | 第几页 |
per | 否 | 15 | 每页返回数 |
- 返回字段说明
返回值字段 | 字段类型 | 字段说明 |
---|---|---|
id | integer | ID |
number | string | 编号 |
type | string | 单据类型 |
type_name | string | 单据类型名称 |
category | string | 单据类别 |
amount | string | 金额 |
warehouse_id | string | 仓库ID |
warehouse_name | string | 仓库名称 |
supplier_name | string | 供应商名称 |
purchaser_name | string | 采购人名称 |
status | string | 审批状态(draft[草稿] approving[待审批] submitted[已提交] rejected[已驳回] passed[审批通过] deprecated[已作废]) |
status_i18n | string | 审批状态中文 |
creator | string | 创建人 |
operator | string | 操作人 |
operated_at | string | 操作时间 |
created_at | string | 创建时期 |
entry_or_io_at | string | 入库/退货时间 |
新增采购单
curl -i -X POST --header "Authorization: Token token=<user_token>, uid=<uid>" \
http://example.com/api/purchases.json
{
"status": {
"code": "200",
"message": "OK"
},
"purchase": {
"id": 57,
"category": "in"
}
}
HTTP请求
POST /api/purchases.json
请求参数
参数名 | 是否必填 | 默认值 | 字段说明 |
---|---|---|---|
status 是 无 审批状态(draft[草稿] approving[待审批] submitted[已提交] rejected[已驳回] passed[审批通过] deprecated[已作废]) | |||
parent_id | 否 | 无 | 退货单需要,关联的入库单ID |
number | 是 | 无 | 编号 |
category | 是 | in | in: 入库单, out: 退货单 |
io_at | 是 | 无 | 入库/退货日期 |
supplier_id | 是 | 无 | 供应商ID |
purchaser_id | 是 | 无 | 采购人ID |
discount | 是 | 无 | 优惠率 |
deduction | 是 | 无 | 优惠金额 |
amount | 是 | 无 | 优惠后金额 |
note | 否 | 无 | 备注 |
contact_id | 否 | 无 | v联系人ID |
contact_name | 否 | 无 | 联系人ID |
contact_mobile | 否 | 无 | 联系人ID |
contact_phone | 否 | 无 | 联系人ID |
contact_address | 否 | 无 | 联系人ID |
supplier_address | 否 | 无 | 联系人ID |
total_quantity | 否 | 无 | 联系人ID |
total_base_quantity | 否 | 无 | 联系人ID |
total_deduction | 否 | 无 | 联系人ID |
total_amount | 否 | 无 | 联系人ID |
total_tax_amount | 否 | 无 | 联系人ID |
total_amount_with_tax | 否 | 无 | 联系人ID |
document_addition_attributes[0][copy_to][] | 否 | 无 | 条件审批抄送人ID |
document_approvers_params[0][level] | 否 | 无 | 审批层级 |
document_approvers_params[0][member_ids][] | 否 | 无 | 审批人ID |
attachments_attributes[0][dn_key] | 否 | 无 | 七牛存储的key |
attachments_attributes[0][key] | 否 | 无 | 同上 |
attachments_attributes[0][filename] | 否 | 无 | 文件名 |
attachments_attributes[0][url] | 否 | 无 | 文件URL |
attachments_attributes[0][size] | 否 | 无 | 文件大小 |
product_items_attributes[0][product_attr_group_id] | 是 | 无 | 产品属性组ID |
product_items_attributes[0][product_unit_id] | 是 | 无 | 产品单位ID |
product_items_attributes[0][parent_id] | 否 | 无 | 关联了入库单的退货单的产品项需要 |
product_items_attributes[0][product_item_id] | 否 | 无 | 从采购订单生成的采购入库单需要 |
product_items_attributes[0][product_id] | 是 | 无 | 产品ID |
product_items_attributes[0][warehouse_id] | 是 | 无 | 仓库ID |
product_items_attributes[0][name] | 是 | 无 | 产品项名称 |
product_items_attributes[0][product_number] | 是 | 无 | 产品项编号 |
product_items_attributes[0][attr_names] | 否 | 无 | 产品项属性名称 |
product_items_attributes[0][spec] | 否 | 无 | 产品项规格 |
product_items_attributes[0][unit] | 是 | 无 | 产品项单位 |
product_items_attributes[0][quantity] | 是 | 无 | 产品项数量 |
product_items_attributes[0][base_unit] | 否 | 无 | 基本单位 |
product_items_attributes[0][base_quantity] | 否 | 无 | 基本数量(开启多单位时候基本数量等于基本单位与当前单位的换算率 * 当前数量;未开启多单位时候和当前数量一致) |
product_items_attributes[0][deputy_unit_quantity] | 否 | 无 | 副单位数(需要开启多单位) |
product_items_attributes[0][price] | 是 | 无 | 产品项价格 |
product_items_attributes[0][price_with_tax] | 否 | 无 | 含税价 |
product_items_attributes[0][discount] | 是 | 无 | 产品项折扣率 |
product_items_attributes[0][deduction] | 是 | 无 | 产品项折扣额 |
product_items_attributes[0][amount] | 是 | 无 | 产品项金额 |
product_items_attributes[0][tax_rate] | 否 | 无 | 税率 |
product_items_attributes[0][tax_amount] | 否 | 无 | 税额 |
product_items_attributes[0][amount_with_tax] | 否 | 无 | 税价合计 |
product_items_attributes[0][batch_id] | 否 | 无 | 批次号ID |
product_items_attributes[0][batch_number] | 否 | 无 | 批次号编号 |
product_items_attributes[0][produced_at] | 否 | 无 | 生产日期 |
product_items_attributes[0][expired_at] | 否 | 无 | 有效日期 |
product_items_attributes[0][note] | 是 | 无 | 产品项备注 |
product_items_attributes[0][position] | 是 | 无 | 产品位置参数(入库单产品显示顺序) |
product_items_attributes[0][modified] | 是 | 无 | 最后修改字段 |
product_items_attributes[0][_destroy] | 否 | false | 产品项是否删除 |
返回字段说明
返回值字段 | 字段类型 | 字段说明
——– | ——— | ———–
id | string | ID
category | string | 类型
采购入库/退货单详情
curl -H "Authorization: Token token=<token>, uid=<uid>" \
http://example.com/api/purchases/:id.json
{
"status": {
"code": 200,
"message": "OK"
},
"purchase": {
"id": 735,
"category": "in",
"approved_level": 0,
"status": "approving",
"creator_name": "XXX",
"purchase_order_id": null,
"type_name": "采购入库单",
"copy_to_member_names": [],
"copy_to": [],
"parent_id": null,
"parent_number": null,
"print_count": 0,
"discount": "0.0",
"deduction": "0.0",
"amount": "11.6",
"total_quantity": "1.0",
"total_base_quantity": null,
"total_fee_amount": "0.0",
"number": "CGRKD201903290001",
"io_at": "2019-03-29",
"supplier_id": 2,
"supplier_name": "代理商1",
"purchaser_id": 1,
"purchaser_name": "XXX",
"note": null,
"contact_id": 75,
"contact_name": "张三",
"contact_mobile": "13612345678",
"contact_phone": "4561321654",
"contact_address": "asf2wer",
"supplier_address": "儿童问题",
"has_approve_permission": true,
"has_revoke_permission": true,
"sensitive_access": true,
"contact_sensitive_access": true,
"supplier_sensitive_access": true,
"note_editable": true,
"attachment_editable": true,
"allow_negative_inventory": true,
"gt_order_quantity": true,
"total_deduction": "0.0",
"total_amount": "10.0",
"total_tax_amount": "1.6",
"total_amount_with_tax": "11.6",
"status_i18n": "待1级审批",
"created_at": "2019-03-29",
"purchase_order_number": null,
"children": [],
"has_serial_code": false,
"document_addition_id": 378,
"product_items": [
{
"id": 1392,
"product_id": 1,
"product_attr_group_id": 1,
"product_unit_id": 131,
"product_item_id": null,
"parent_id": null,
"name": "测试商品1",
"product_number": "DG001",
"attr_names": "",
"spec": "XS",
"unit": "个",
"quantity": "1.0",
"price": "10.0",
"price_with_tax": "11.6",
"discount": "0.0",
"deduction": "0.0",
"amount": "10.0",
"tax_rate": "16.0",
"tax_amount": "1.6",
"amount_with_tax": "11.6",
"batch_id": null,
"batch_number": null,
"expired_at": null,
"produced_at": null,
"modified": "quantity",
"product_images": [],
"warehouse_id": 25,
"warehouse_name": "名字很长很长很长的仓库",
"base_unit": "",
"base_quantity": null,
"deputy_unit_quantity": "",
"note": "aa",
"serial_code_status": "serial_closed",
"order_number": null,
"product_image": "",
"serial_codes_attributes": []
}
],
"fees": [],
"attachments": [],
"allow_add_other": false,
"custom_number_setting": "auto",
"approval_information": {},
"document_approvers": [
{
"level": 1,
"status": "approving",
"mode": "single",
"name": "XXX"
}
]
}
}
HTTP请求
GET /api/purchases/:id.json
请求参数
无
返回字段说明
返回值字段 | 字段类型 | 字段说明 |
---|---|---|
id | integer | ID |
purchase_order_id | integer | 关联采购订单ID |
purchase_order_number | string | 关联采购订单编号 |
category | string | 类别 |
approved_level | integer | 审批层级 |
status | string | 审批状态(draft[草稿] approving[待审批] submitted[已提交] rejected[已驳回] passed[审批通过] deprecated[已作废]) |
type_name | string | 单据类型名称 |
creator_name | string | 创建人姓名 |
purchaser_name | string | 采购人姓名 |
supplier_name | string | 供应商名称 |
contact_name | string | 联系人姓名 |
copy_to_member_names | array | 抄送人姓名 |
copy_to | array | 抄送人 |
discount | string | 优惠率 |
deduction | string | 优惠额 |
amount | string | 优惠后金额 |
total_quantity | string | 数量合计 |
total_base_quantity | string | 基本数量合计(开启多单位时候对应的基本单位的数量,未开启时候跟数量一致) |
total_fee_amount | string | 其他费用金额合计 |
number | string | 编号 |
io_at | string | 入库/退货日期 |
supplier_id | string | 供应商ID |
purchaser_id | string | 采购人ID |
note | string | 备注 |
contact_id | string | 联系人ID |
contact_mobile | string | 联系人手机 |
contact_phone | string | 联系人电话 |
contact_address | string | 联系人地址 |
supplier_address | string | 供应商地址 |
has_approve_permission | string | 是否有审批权限 |
has_revoke_permission | string | 是否有撤回权限 |
sensitive_access | string | 单据字段权限 |
contact_sensitive_access | string | 联系人字段权限 |
supplier_sensitive_access | string | 供应商字段权限 |
note_editable | string | 备注是否可编辑 |
attachment_editable | string | 附件是否可编辑 |
total_deduction | string | 折扣额合计 |
total_amount | string | 金额合计 |
total_tax_amount | string | 税额合计 |
total_amount_with_tax | string | 税价合计的合计 |
document_addition_id | integer | 条件审批人的ID |
created_at | string | 创建时间 |
status_i18n | string | 审批状态中文 |
print_count | integer | 打印次数 |
parent_id | integer | 关联入库单ID |
parent_number | string | 关联入库单编号 |
allow_negative_inventory | boolean | 是否允许负库存 |
gt_order_quantity | boolean | 是否允许大于关联订单数量 |
has_serial_code | boolean | 是否有序列号 |
children | array | 关联的退货单 |
allow_add_other | boolean | 是否添加订单之外的产品 |
custom_number_setting | string | 自动编号设置 |
approval_information | hash | 审批信息 |
document_approvers[0][level] | integer | 审批层级 |
document_approvers[0][status] | string | 审批状态 |
document_approvers[0][mode] | string | 审批模式 |
document_approvers[0][name] | string | 审批人姓名 |
product_items[0][id] | integer | 产品项ID |
product_items[0][product_id] | string | 产品ID |
product_items[0][product_attr_group_id] | string | 产品属性组ID |
product_items[0][product_unit_id] | string | 产品单位ID |
product_items[0][order_item_id] | string | 关联采购订单的ID |
product_items[0][parent_id] | string | 关联入库单的产品项的ID |
product_items[0][quantity] | string | 数量 |
product_items[0][price] | string | 价格 |
product_items[0][price_with_tax] | string | 含税价 |
product_items[0][discount] | string | 折扣率 |
product_items[0][deduction] | string | 折扣额 |
product_items[0][amount] | string | 金额(不含税; 单价 * 数量 - 折扣金额) |
product_items[0][tax_rate] | string | 税率 |
product_items[0][tax_amount] | string | 税额 |
product_items[0][amount_with_tax] | string | 税价合计 |
product_items[0][modified] | string | 最后修改字段 |
product_items[0][product_images] | array | 产品图片 |
product_items[0][name] | string | 产品名称 |
product_items[0][product_number] | string | 产品编号 |
product_items[0][attr_names] | string | 产品属性名称 |
product_items[0][spec] | string | 产品规格 |
product_items[0][warehouse_id] | string | 仓库ID |
product_items[0][warehouse_name] | string | 仓库名称 |
product_items[0][unit] | string | 单位名称 |
product_items[0][base_unit] | string | 基本单位名称 |
product_items[0][base_quantity] | string | 基本数量(开启多单位时候基本数量等于基本单位与当前单位的换算率 * 当前数量;未开启多单位时候和当前数量一致) |
product_items[0][deputy_unit_quantity] | string | 副单位数(需要开启多单位) |
product_items[0][note] | string | 备注 |
product_items[0][sale_order_id] | string | 关联的销售订单ID |
product_items[0][sale_order_number] | string | 关联的销售订单编号 |
product_items[0][product_image] | string | 产品图片 |
product_items[0][batch_id] | string | 批次号ID |
product_items[0][batch_number] | string | 批次号编号 |
product_items[0][expired_at] | string | 有效日期 |
product_items[0][produced_at] | string | 生产日期 |
product_items[0][serial_code_status] | string | 启用序列号状态 |
product_items[0][order_number] | string | 关联采购订单编号 |
product_items[0][serial_codes_attributes] | string | 序列号属性 |
fees | array | 其他费用 |
attachments[0][id] | integer | 附件ID |
attachments[0][filename] | string | 附件文件名 |
attachments[0][url] | string | 附件URL |
编辑采购单
curl -i -X PUT --header "Authorization: Token token=<user_token>, uid=<uid>" \
http://example.com/api/purchases/:id.json
{
"status": {
"code": "200",
"message": "OK"
},
"purchase": {
"id": 57,
"category": "in"
}
}
HTTP请求
PUT /api/purchases/:id.json
请求参数
参数名 | 是否必填 | 默认值 | 字段说明 |
---|---|---|---|
status | 是 | 无 | 审批状态(draft[草稿] approving[待审批] submitted[已提交] rejected[已驳回] passed[审批通过] deprecated[已作废]) |
parent_id | 否 | 无 | 退货单需要,关联的入库单ID |
number | 是 | 无 | 编号 |
category | 是 | in | in: 入库单, out: 退货单 |
io_at | 是 | 无 | 入库/退货日期 |
supplier_id | 是 | 无 | 供应商ID |
purchaser_id | 是 | 无 | 采购人ID |
discount | 是 | 无 | 优惠率 |
deduction | 是 | 无 | 优惠金额 |
amount | 是 | 无 | 优惠后金额 |
note | 否 | 无 | 备注 |
contact_id | 否 | 无 | 联系人ID |
contact_name | 否 | 无 | 联系人ID |
contact_mobile | 否 | 无 | 联系人ID |
contact_phone | 否 | 无 | 联系人ID |
contact_address | 否 | 无 | 联系人ID |
supplier_address | 否 | 无 | 联系人ID |
total_quantity | 否 | 无 | 联系人ID |
total_base_quantity | 否 | 无 | 联系人ID |
total_deduction | 否 | 无 | 联系人ID |
total_amount | 否 | 无 | 联系人ID |
total_tax_amount | 否 | 无 | 联系人ID |
total_amount_with_tax | 否 | 无 | 联系人ID |
document_addition_attributes[0][copy_to][] | 否 | 无 | 条件审批抄送人ID |
document_approvers_params[0][level] | 否 | 无 | 审批层级 |
document_approvers_params[0][member_ids][] | 否 | 无 | 审批人ID |
attachments_attributes[0][id] | 否 | 无 | 附件ID |
attachments_attributes[0][dn_key] | 否 | 无 | 七牛存储的key |
attachments_attributes[0][key] | 否 | 无 | 同上 |
attachments_attributes[0][filename] | 否 | 无 | 文件名 |
attachments_attributes[0][url] | 否 | 无 | 文件URL |
attachments_attributes[0][size] | 否 | 无 | 文件大小 |
product_items_attributes[0][id] | 是 | 无 | 产品项ID |
product_items_attributes[0][product_attr_group_id] | 是 | 无 | 产品属性组ID |
product_items_attributes[0][product_unit_id] | 是 | 无 | 产品单位ID |
product_items_attributes[0][parent_id] | 否 | 无 | 关联了入库单的退货单的产品项需要 |
product_items_attributes[0][product_item_id] | 否 | 无 | 从采购订单生成的采购入库单需要 |
product_items_attributes[0][product_id] | 是 | 无 | 产品ID |
product_items_attributes[0][warehouse_id] | 是 | 无 | 仓库ID |
product_items_attributes[0][name] | 是 | 无 | 产品项名称 |
product_items_attributes[0][product_number] | 是 | 无 | 产品项编号 |
product_items_attributes[0][attr_names] | 否 | 无 | 产品项属性名称 |
product_items_attributes[0][spec] | 否 | 无 | 产品项规格 |
product_items_attributes[0][unit] | 是 | 无 | 产品项单位 |
product_items_attributes[0][quantity] | 是 | 无 | 产品项数量 |
product_items_attributes[0][base_unit] | 否 | 无 | 基本单位 |
product_items_attributes[0][base_quantity] | 否 | 无 | 基本数量(开启多单位时候基本数量等于基本单位与当前单位的换算率 * 当前数量;未开启多单位时候和当前数量一致) |
product_items_attributes[0][deputy_unit_quantity] | 否 | 无 | 副单位数(需要开启多单位) |
product_items_attributes[0][price] | 是 | 无 | 产品项价格 |
product_items_attributes[0][price_with_tax] | 否 | 无 | 含税价 |
product_items_attributes[0][discount] | 是 | 无 | 产品项折扣率 |
product_items_attributes[0][deduction] | 是 | 无 | 产品项折扣额 |
product_items_attributes[0][amount] | 是 | 无 | 产品项金额 |
product_items_attributes[0][tax_rate] | 否 | 无 | 税率 |
product_items_attributes[0][tax_amount] | 否 | 无 | 税额 |
product_items_attributes[0][amount_with_tax] | 否 | 无 | 税价合计 |
product_items_attributes[0][batch_id] | 否 | 无 | 批次号ID |
product_items_attributes[0][batch_number] | 否 | 无 | 批次号编号 |
product_items_attributes[0][produced_at] | 否 | 无 | 生产日期 |
product_items_attributes[0][expired_at] | 否 | 无 | 有效日期 |
product_items_attributes[0][note] | 是 | 无 | 产品项备注 |
product_items_attributes[0][modified] | 是 | 无 | 最后修改字段 |
product_items_attributes[0][_destroy] | 否 | false | 产品项是否删除 |
返回字段说明
返回值字段 | 字段类型 | 字段说明
——– | ——— | ———–
id | string | ID
category | string | 类型
文档更新时间: 2025-03-17 14:52 作者:姜河