采购订单

采购订单列表

  • HTTP请求

GET /api/purchase_orders.json

  • 请求参数
参数名 是否必须 说明
date 单据日期
keyword 关键词
keyword_type 关键词类型(order_items.name : 产品名称;order_items.spec: 规格;order_items.attr_names: 属性;purchase_orders.number: 单据单号/备注)
supplier_id 供应商
delivered_at 交货日期
warehouse_id 仓库
product_category_id 产品分类
purchaser_id 采购员
creator_id 创建人
tax_added 是否含税
order_status 订单状态
  • 返回字段说明
字段 类型 说明
id integer ID
number string 编号
contact_name string 联系人姓名
contact_id integer 联系人ID
contact_phone string 联系人电话
contact_mobile string 联系人手机
contact_address string 联系人地址
approved_level integer 审批级别
category string in(采购订单的值是固定的)
type string 单据类型
type_name string 单据类型名称
amount string 金额
state string 入库状态
status string 审批状态(draft[草稿] approving[待审批] submitted[已提交] rejected[已驳回] passed[审批通过] deprecated[已作废])
order_status string 订单状态
status_i18n string 审批状态(中文)
creator_name string 创建人名称
documented_at string 单据时间
delivered_at string 交货时间
purchaser_name string 采购员姓名
supplier_name string 供应商姓名
  • 返回 JSON 数据
    {
        "status": {
            "code": 200,
            "message": "OK"
        },
        "purchase_orders": [
            {
                "id": 208,
                "number": "CG201808220002",
                "contact_name": "张三",
                "contact_id": 75,
                "contact_phone": "4561321654",
                "contact_mobile": "13612345678",
                "contact_address": "asf2wer",
                "approved_level": 0,
                "category": "in",
                "type": "purchase_order",
                "type_name": "采购订单",
                "amount": "15.250",
                "state": "未入库",
                "status": "submitted",
                "order_status": "executing",
                "status_i18n": "已提交",
                "creator_name": "XXX",
                "documented_at": "2018-08-22",
                "delivered_at": "2018-08-22",
                "purchaser_name": "XXX",
                "supplier_name": "XXX"
            },
            { ... }
        ]
    }

采购订单新增

  • HTTP请求

    POST /api/purchase_orders.json

  • 请求参数

参数名 是否必须 说明
category in
status 审批状态(draft[草稿] approving[待审批] submitted[已提交] rejected[已驳回] passed[审批通过] deprecated[已作废])
approved_level 审批级别(开启审批必须)
number 单据编号(自定义字段已包含)
documented_at 单据日期(自定义字段已包含)
delivered_at 交货日期(自定义字段已包含)
supplier_id 供应商ID(自定义字段已包含)
contact_address 联系人地址
contact_id 联系人ID
contact_mobile 联系人手机
contact_name 联系人名称
contact_phone 联系人电话
note 备注
supplier_type_id 供应商类型
purchaser_id 采购人员ID(自定义字段已包含)
total_quantity 数量合计
total_base_quantity 基本数量合计(开启多单位时候对应的基本单位的数量,未开启时候跟数量一致)
total_deduction 优惠额合计(优惠金额)
total_amount 金额合计(不含税和优惠金额)
total_tax_amount 税额合计(开启税率必须)
total_amount_with_tax 优惠后税价合计(开启税率必须)
discount 优惠率(自定义字段已包含)
deduction 优惠额(自定义字段已包含)
amount 优惠后金额(自定义字段已包含,税价合计-优惠金额)
表头/表尾自定义字段 根据设置 包含类型 default/custom
document_addition_attributes 抄送
document_addition_attributes.copy_to[] 抄送人ID
document_approvers_params 开启审批必须
document_approvers_params.level 审批级别
document_approvers_params.member_ids[] 审批人ID
attachments_attributes[] 附件
attachments_attributes[0].filename 文件名
attachments_attributes[0].url 文件URL
order_items_attributes[] 订单项
order_items_attributes[0].product_attr_group_id 产品属性组ID
order_items_attributes[0].product_unit_id 产品单位ID
order_items_attributes[0].product_id 产品ID
order_items_attributes[0].batch_number 批次编号
order_items_attributes[0].batch_id 批次ID
order_items_attributes[0].produced_at 生产日期
order_items_attributes[0].expired_at 有效期
order_items_attributes[0].parent_id 关联入库单产品项ID
order_items_attributes[0].amount 采购金额
order_items_attributes[0].deduction 优惠金额
order_items_attributes[0].discount 优惠率
order_items_attributes[0].name 产品名称
order_items_attributes[0].note 备注
order_items_attributes[0].amount_with_tax 税价合计
order_items_attributes[0].attr_names 属性
order_items_attributes[0].price 采购单价
order_items_attributes[0].price_with_tax 含税价
order_items_attributes[0].product_category_name 产品分类
order_items_attributes[0].product_number 产品编号
order_items_attributes[0].quantity 数量
order_items_attributes[0].spec 规格
order_items_attributes[0].tax_amount 税额
order_items_attributes[0].tax_rate 税率
order_items_attributes[0].unit 单位
order_items_attributes[0].warehouse_id 仓库ID
order_items_attributes[0].warehouse_name 仓库名称
order_items_attributes[0].modified 最后一次修改字段名称
order_items_attributes[0].表体自定义字段 根据设置 包含类型 default/custom
  • 返回字段说明
字段 类型 说明
id integer 单据ID
  • 返回 JSON 数据
    {
        "status": {
            "code": 200,
             "message": "OK"
        },
        "purchase_order": {
            "id" :61868,
        }
    }

采购单详情

  • HTTP请求

    GET /api/purchase_orders/:id.json

  • 请求参数

参数名 是否必须 说明
  • 返回字段说明
字段 类型 说明
id integer ID
category string in(采购订单的值是固定的)
approved_level integer 审批级别
status string 审批状态(draft[草稿] approving[待审批] submitted[已提交] rejected[已驳回] passed[审批通过] deprecated[已作废])
status_i18n string 审批状态(中文)
order_status string 订单状态
type_name string 类型名称
creator_name string 创建人姓名
purchaser_name string 采购人姓名
supplier_name string 供应商姓名
supplier_address string 供应商地址
contact_name string 联系人姓名
contact_id integer 联系人ID
contact_mobile string 联系人手机
contact_phone string 联系人电话
contact_address string 联系人地址
copy_to_member_names array 抄送人姓名
copy_to string 抄送
total_quantity string 总数量
total_base_quantity string 总基本数量
total_deduction string 总折扣金额
total_amount string 总金额
total_tax_amount string 总税额
total_amount_with_tax string 总税价合计
number string 编号
documented_at string 单据日期
delivered_at string 交货日期
supplier_id integer 供应商ID
purchaser_id integer 采购人员ID
note string 备注
discount string 折扣率
deduction string 折扣金额
amount string 金额
has_approve_permission boolean 审批权限
has_revoke_permission boolean 驳回权限
sensitive_access boolean 字段权限
contact_sensitive_access boolean 联系人权限
supplier_sensitive_access boolean 供应商权限
note_editable boolean 备注可编辑
attachment_editable boolean 附件可编辑
document_addition_id string
created_at string 创建日期
state string 入库状态
text_field_xxx string 文本类型自定义字段
select_field_xxx string 下拉类型自定义字段
  • 返回 JSON 数据
    {
        "status": {
            "code": 200,
            "message": "OK"
        },
        "purchase_order": {
            "id": 589,
            "category": "in",
            "approved_level": 0,
            "status": "submitted",
            "order_status": "executing",
            "type_name": "采购订单",
            "creator_name": "xxx",
            "purchaser_name": "xxx",
            "supplier_name": "代理商1",
            "contact_name": "张三",
            "copy_to_member_names": [],
            "copy_to": null,
            "total_quantity": "1.0",
            "total_base_quantity": "20.0",
            "number": "CG201808220002",
            "documented_at": "2018-08-22",
            "delivered_at": "2018-08-22",
            "supplier_id": 2,
            "purchaser_id": 1,
            "text_field_434d4053ff": "1",
            "select_field_204eefc1b9": "25",
            "text_field_16993f2c50": "3",
            "note": null,
            "discount": "0.0",
            "deduction": "0.0",
            "amount": "15.25",
            "contact_id": 75,
            "contact_mobile": "13612345678",
            "contact_phone": "4561321654",
            "contact_address": "asf2wer",
            "supplier_address": "儿童问题",
            "text_field_6b1357596f": null,
            "select_field_8ac6899f0d": null,
            "has_approve_permission": true,
            "has_revoke_permission": false,
            "sensitive_access": true,
            "contact_sensitive_access": true,
            "supplier_sensitive_access": true,
            "note_editable": false,
            "attachment_editable": false,
            "total_deduction": "0.0",
            "total_amount": "13.0",
            "total_tax_amount": "2.25",
            "total_amount_with_tax": "15.25",
            "document_addition_id": null,
            "created_at": "2018-08-22 17:45",
            "state": "未入库",
            "status_i18n": "已提交",
            "order_items": [
                {
                    "id": 504,
                    "product_id": 361,
                    "product_attr_group_id": 664,
                    "product_unit_id": 628,
                    "parent_id": null,
                    "batch_id": null,
                    "expired_at": null,
                    "produced_at": null,
                    "name": "CP0127",
                    "product_number": "CP0127",
                    "attr_names": "",
                    "spec": "",
                    "unit": "箱",
                    "quantity": "1.0",
                    "modified": "price",
                    "select_field_96d6437eed": "",
                    "warehouse_id": 23,
                    "warehouse_name": "测试仓库10",
                    "base_unit": "台",
                    "base_quantity": "20.0",
                    "deputy_unit_quantity": "1箱",
                    "price": "13.0",
                    "price_with_tax": "15.25",
                    "discount": "0.0",
                    "deduction": "0.0",
                    "amount": "13.0",
                    "tax_rate": "17.33",
                    "tax_amount": "2.25",
                    "amount_with_tax": "15.25",
                    "note": "",
                    "text_field_e4c478bc07": "a",
                    "select_field_49aa270c2d": "4",
                    "select_field_f069d831c1": null,
                    "sale_order_id": "",
                    "sale_order_number": "",
                    "product_image": "",
                    "product_images": [],
                    "custom_fields": [
                        {
                            "label": "产品名称",
                            "name": "name",
                            "value": "CP0118"
                        },
                        { ... }
                    ],
                    "serial_code_status": "serial_closed",
                    "order_number": null,
                    "product_image": "",
                    "product_images": [],
                    "serial_codes_attributes": []
                }
            ],
            "attachments": [],
            "purchases": [],
            "fund_payments": [],
            "payed_amount": "0.000",
            "thead_fields": [
                {
                    "label": "编号",
                    "name": "number",
                    "value": "CGD201804240001"
                },
                { ... }
            ],
            "tbody_fields": [
                {
                    "label": "产品名称",
                    "name": "name"
                },
                { ... }
            ],
            "tfoot_fields": [
                {
                    "label": "单据备注",
                    "name": "note",
                    "value": null
                },
                { ... }
            ]
        }
    }

采购订单编辑

  • HTTP请求

    PUT /api/purchase_orders/:id.json

  • 请求参数

参数名 是否必须 说明
id ID
category in
status 审批状态(draft[草稿] approving[待审批] submitted[已提交] rejected[已驳回] passed[审批通过] deprecated[已作废])
approved_level 审批级别(开启审批必须)
number 单据编号(自定义字段已包含)
documented_at 单据日期(自定义字段已包含)
delivered_at 交货日期(自定义字段已包含)
supplier_id 供应商ID(自定义字段已包含)
purchaser_id 采购人员ID(自定义字段已包含)
contact_id 联系人ID
contact_address 联系人地址
contact_name 联系人名称
contact_mobile 联系人手机
contact_phone 联系人电话
note 备注
supplier_type_id 供应商类型ID
total_quantity 数量合计
total_base_quantity 基本数量合计(开启多单位时候对应的基本单位的数量,未开启时候跟数量一致)
total_deduction 优惠额合计(优惠金额)
total_amount 金额合计(不含税和优惠金额)
total_tax_amount 税额合计(开启税率必须)
total_amount_with_tax 优惠后税价合计(开启税率必须)
discount 优惠率(自定义字段已包含)
deduction 优惠额(自定义字段已包含)
amount 优惠后金额(自定义字段已包含,税价合计-优惠金额)
表头/表尾自定义字段 根据设置 包含类型 default/custom
document_addition_attributes 抄送
document_addition_attributes.copy_to[] 抄送人ID
document_approvers_params 开启审批必须
document_approvers_params.level 审批级别
document_approvers_params.member_ids[] 审批人ID
attachments_attributes[] 附件
attachments_attributes[0].filename 文件名
attachments_attributes[0].url 文件URL
order_items_attributes[] 订单项
order_items_attributes[0].product_attr_group_id 产品属性组ID
order_items_attributes[0].product_unit_id 产品单位ID
order_items_attributes[0].product_id 产品ID
order_items_attributes[0].amount 采购金额
order_items_attributes[0].amount_with_tax 税价合计
order_items_attributes[0].attr_names 属性
order_items_attributes[0].deduction 优惠金额
order_items_attributes[0].discount 优惠率
order_items_attributes[0].name 产品名称
order_items_attributes[0].note 备注
order_items_attributes[0].price 采购单价
order_items_attributes[0].price_with_tax 含税价
order_items_attributes[0].product_category_name 产品分类
order_items_attributes[0].quantity 数量
order_items_attributes[0].spec 规格
order_items_attributes[0].tax_amount 税额
order_items_attributes[0].tax_rate 税率
order_items_attributes[0].unit 单位
order_items_attributes[0].warehouse_id 仓库ID
order_items_attributes[0].warehouse_name 仓库名称
order_items_attributes[0].batch_number 批次编号
order_items_attributes[0].batch_id 批次ID
order_items_attributes[0].produced_at 生产日期
order_items_attributes[0].expired_at 有效期
order_items_attributes[0].parent_id 关联入库单产品项ID
order_items_attributes[0].modified 最后一次修改字段名称
order_items_attributes[0].表体自定义字段 根据设置 包含类型 default/custom
  • 返回字段说明
字段 类型 说明
id integer 单据ID
  • 返回 JSON 数据
    {
        "status": {
            "code": 200,
             "message": "OK"
        },
        "purchase_order": {
            "id" :61868,
        }
    }
文档更新时间: 2025-03-17 14:52   作者:姜河