销售订单
销售订单列表
- HTTP请求
GET /api/sale_orders.json
- 请求参数
参数名 | 是否必须 | 默认值 | 说明 |
---|---|---|---|
date | 否 | 单据日期 | |
keyword | 否 | 关键词 | |
keyword_type | 否 | 关键词类型(order_items.name : 产品名称;order_items.spec: 规格;order_items.attr_names: 属性;purchase_orders.number: 单据单号/备注) | |
customer_id | 否 | 供应商 | |
delivered_at | 否 | 交货日期 | |
warehouse_id | 否 | 仓库 | |
product_category_id | 否 | 产品分类 | |
seller_id | 否 | 销售员 | |
creator_id | 否 | 创建人 | |
tax_added | 否 | 是否含税 | |
order_status | 否 | 订单状态 | |
created_at | 否 | 创建时间(created_at=’2024-01-01/2024-03-15’ 或者Unix时间戳毫秒级格式 created_at=’1710401628293/1710401628299’; 注意日期之间用/隔开 ) | |
updated_at | 否 | 更新时间(updated_at=’2024-01-01/2024-03-15’ 或者Unix时间戳毫秒级格式 updated_at=’1710401628293/1710401628299’; 注意日期之间用/隔开 ) | |
sort | 否 | 排序字段(仅支持created_at, updated_at) | |
order | 否 | 排序方式(仅支持desc, asc) |
- 返回字段说明
字段 | 类型 | 说明 |
---|---|---|
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 | out(销售订单的值是固定的) |
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 | 交货时间 |
seller_name | string | 销售人姓名 |
customer_name | string | 客户姓名 |
note | string | 备注 |
created_at | string | 创建时间 |
updated_at | string | 更新时间 |
- 返回 JSON 数据
{
"status": {
"code": 200,
"message": "OK"
},
"sale_orders": [
{
"id": 208,
"number": "CG201808220002",
"contact_name": "张三",
"contact_id": 75,
"contact_phone": "4561321654",
"contact_mobile": "13612345678",
"contact_address": "asf2wer",
"approved_level": 0,
"category": "out",
"type": "sale_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",
"seller_name": "XXX",
"created_at": "2023-07-20 16:13:11",
"updated_at": "2023-07-20 16:13:11",
"customer_name": "XXX"
},
{ ... }
]
}
销售订单新增
HTTP请求
POST /api/sale_orders.json
请求参数
参数名 | 是否必须 | 说明 |
---|---|---|
category | 是 | out |
status | 是 | 审批状态(draft[草稿] approving[待审批] submitted[已提交] rejected[已驳回] passed[审批通过] deprecated[已作废]) |
approved_level | 否 | 审批级别(开启审批必须) |
number | 是 | 单据编号(自定义字段已包含) |
documented_at | 是 | 单据日期(自定义字段已包含) |
delivered_at | 是 | 交货日期(自定义字段已包含) |
customer_id | 是 | 客户ID(自定义字段已包含) |
seller_id | 是 | 销售人ID(自定义字段已包含) |
total_quantity | 是 | 数量合计 |
total_base_quantity | 是 | 基本数量合计(开启多单位时候对应的基本单位的数量,未开启时候跟数量一致) |
total_deduction | 是 | 优惠额合计(优惠金额) |
total_amount | 是 | 金额合计(不含税和优惠金额) |
total_tax_amount | 否 | 税额合计(开启税率必须) |
total_amount_with_tax | 否 | 优惠后税价合计(开启税率必须) |
discount | 是 | 优惠率(自定义字段已包含) |
deduction | 是 | 优惠额(自定义字段已包含) |
amount | 是 | 优惠后金额(自定义字段已包含,税价合计-优惠金额) |
note | 否 | 备注 |
表头/表尾自定义字段 | 根据设置 | 包含类型 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].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].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].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].quantity | 是 | 数量 |
order_items_attributes[0].note | 否 | 备注 |
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].position | 否 | 数字排序按照asc |
order_items_attributes[0].表体自定义字段 | 根据设置 | 包含类型 default/custom |
- 返回字段说明
字段 | 类型 | 说明 |
---|---|---|
id | integer | 单据ID |
- 返回 JSON 数据
{
"status": {
"code": 200,
"message": "OK"
},
"sale_order": {
"id" :61868
}
}
销售订单详情
HTTP请求
GET /api/sale_orders/:id.json
请求参数
参数名 | 是否必须 | 说明 |
---|---|---|
无 | 无 | 无 |
- 返回字段说明
字段 | 类型 | 说明 |
---|---|---|
id | integer | ID |
category | string | out(销售订单的值是固定的) |
approved_level | integer | 审批状态(draft[草稿] approving[待审批] submitted[已提交] rejected[已驳回] passed[审批通过] deprecated[已作废]) |
status | string | 审批状态 |
status_i18n | string | 审批状态(中文) |
order_status | string | 订单状态 |
type_name | string | 类型名称 |
creator_name | string | 创建人姓名 |
seller_name | string | 销售人姓名 |
customer_name | string | 客户姓名 |
customer_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 | 交货日期 |
customer_id | integer | 客户ID |
seller_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"
},
"sale_order": {
"id": 589,
"category": "out",
"approved_level": 0,
"status": "submitted",
"order_status": "executing",
"type_name": "销售订单",
"creator_name": "xxx",
"seller_name": "xxx",
"customer_name": "xxx",
"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",
"customer_address": "儿童问题",
"text_field_6b1357596f": null,
"select_field_8ac6899f0d": null,
"has_approve_permission": true,
"has_revoke_permission": false,
"sensitive_access": true,
"contact_sensitive_access": true,
"customer_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": [],
"sales": [],
"fund_collectings": [],
"collected_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/sale_orders/:id.json
请求参数
参数名 | 是否必须 | 说明 |
---|---|---|
id | 是 | ID |
category | 是 | in |
status | 是 | 审批状态(draft[草稿] approving[待审批] submitted[已提交] rejected[已驳回] passed[审批通过] deprecated[已作废]) |
approved_level | 否 | 审批级别(开启审批必须) |
number | 是 | 单据编号(自定义字段已包含) |
documented_at | 是 | 单据日期(自定义字段已包含) |
delivered_at | 是 | 交货日期(自定义字段已包含) |
customer_id | 是 | 客户ID(自定义字段已包含) |
seller_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].product_number | 是 | 产品编号 |
order_items_attributes[0].quantity | 是 | 数量 |
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].spec | 否 | 规格 |
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"
},
"sale_order": {
"id" :61868
}
}
文档更新时间: 2025-03-17 14:52 作者:姜河