单据创建
- 接口:common/document
- Method:POST
- 数据格式:JSON
- 接口说明:
- 支持单据头、费用行、事项明细行、预算分摊行的创建
- 支持会计/预算科目计算、校验规则、工作流启动、预算更新
参数
请求参数
是否必填:TRUE
表示必填,FALSE
表示非必填,ONE-OF
index
表示同一上标index
的字段必填其一
单据头参数
以下字段需在 data.header 路径下传参
字段名称 |
字段类型 |
字段描述 |
是否必填 |
长度限制 |
external_id |
String |
外部系统单据号 |
TRUE |
64 |
header_type_code |
String |
单据类型编码 |
TRUE |
64 |
status |
String |
单据状态 |
TRUE |
64 |
created_by_code |
String |
创建人员工号 |
ONE-OF 1 |
64 |
created_by_user_name |
String |
创建人用户名 |
ONE-OF 1 |
64 |
submit_user_code |
String |
提交人员工号(创建人有值时可不传,下同) |
FALSE |
64 |
submit_user_name |
String |
提交人用户名 |
FALSE |
64 |
charge_user_code |
String |
报销人员工号 |
FALSE |
64 |
charge_user_name |
String |
报销人用户名 |
FALSE |
64 |
pay_user_code |
String |
收款人员工号 |
FALSE |
64 |
pay_user_name |
String |
收款人用户名 |
FALSE |
64 |
branch_code |
String |
所属公司编码 |
ONE-OF 2 |
64 |
charge_department_code |
String |
费用承担部门编码 |
ONE-OF 2 |
64 |
submit_department_code |
String |
提交部门编码 |
ONE-OF 2 |
64 |
customer_code |
String |
客户编码 |
FALSE |
64 |
project_code |
String |
项目编码 |
FALSE |
64 |
supplier_code |
String |
供应商编码 |
FALSE |
64 |
period_name |
String |
财年期间 |
FALSE |
64 |
absence_code |
String |
请假类型编码 |
FALSE |
64 |
branch_account_code |
String |
所属公司银行账号 |
FALSE |
64 |
customer_account_code |
String |
客户银行账号 |
FALSE |
64 |
supplier_account_code |
String |
供应商银行账号 |
FALSE |
64 |
user_account_code |
String |
用户银行账号 |
FALSE |
64 |
external_person_code |
String |
外部人员账号 |
FALSE |
64 |
external_person_account_code |
String |
外部人员银行账号 |
FALSE |
64 |
asset_code |
String |
资金编码 |
FALSE |
64 |
asset_type_code |
String |
资金类型编码 |
FALSE |
64 |
asset_location_code |
String |
资金地址编码 |
FALSE |
64 |
submit_date |
Long |
提交时间 |
FALSE |
13 |
start_datetime |
Long |
开始时间 |
FALSE |
13 |
end_datetime |
Long |
结束时间 |
FALSE |
13 |
due_date |
Long |
借款到期时间 |
FALSE |
13 |
destination_city_name |
String |
出发城市(中文名称,城市映射关系) |
FALSE |
64 |
destination_city_to_name |
String |
到达城市(中文名称) |
FALSE |
64 |
destination_cities |
String |
多到达城市(中文名称,使用英文, 分隔) |
FALSE |
/ |
ignore_warning |
String |
忽略警告 |
FALSE |
64 |
pay_object |
String |
支付对象(后续需要生成支付单时该字段必填) |
FALSE |
1 |
pay_status |
String |
支付状态(支付单必传,待支付pending ,支付中paying ,已支付paid ,支付错误error ) |
FALSE |
16 |
sub_type |
String |
单据子类型 |
FALSE |
64 |
currency_code |
String |
branch_id 对应的本位币缩写,不传值默认为CNY |
FALSE |
64 |
total_amount |
Decimal |
总金额(本位币) |
TRUE |
/ |
total_claim_amount |
Decimal |
总发生金额(本位币) |
TRUE |
/ |
total_pay_amount |
Decimal |
总付款金额(本位币) |
TRUE |
/ |
total_net_amount |
Decimal |
总不含税金额(本位币) |
TRUE |
/ |
total_tax_amount |
Decimal |
总税额(本位币) |
TRUE |
/ |
total_pay_currency_amount |
Decimal |
总支付金额(支付币种) |
TRUE |
/ |
advance_amount |
Decimal |
总借款金额(本位币) |
FALSE |
/ |
description |
String |
描述 |
FALSE |
255 |
long_description |
String |
长描述 |
FALSE |
/ |
column1-150 |
String |
自定义字段 |
FALSE |
255 |
attachments |
Array |
默认附件区域 |
FALSE |
/ |
attachments.file_name |
String |
默认附件区域-文件名 |
FALSE |
255 |
attachments.attachment_url |
String |
默认附件区域-文件地址(远程文件上传) |
FALSE |
/ |
attachments.attachment_type_code |
String |
附件类型编码 |
FALSE |
无 |
attachments1 |
Array |
附件一区域 |
FALSE |
/ |
attachments1.file_name |
String |
附件一区域-文件名 |
FALSE |
255 |
attachments1.attachment_url |
String |
附件一区域-文件地址 |
FALSE |
/ |
attachments1.attachment_type_code |
String |
附件类型编码 |
FALSE |
无 |
attachments2-49... |
|
|
|
|
attachments50 |
Array |
附件五十区域 |
FALSE |
/ |
attachments50.file_name |
String |
附件五十区域-文件名 |
FALSE |
255 |
attachments50.attachment_url |
String |
附件五十区域-文件地址 |
FALSE |
/ |
attachments50.attachment_type_code |
String |
附件类型编码 |
FALSE |
无 |
link_header_vos |
Array |
支持单头、多头及头行(头行关联需同时传入claim_line.link_vo )关联关系,接口会根据系统前后序关联配置校验报文 |
FALSE |
/ |
link_header_vos.external_id |
String |
前序单据外部系统单据号 |
ONE-OF |
64 |
link_header_vos.document_num |
String |
前序单据单据号 |
ONE-OF |
64 |
link_header_vos.header_type_code |
String |
前序单据单据类型编码 |
TRUE |
64 |
费用行参数
以下字段需在 data.header.claim_line 路径下传参
字段名称 |
字段类型 |
字段描述 |
是否必填 |
长度限制 |
line_type_code |
String |
费用类型 |
TRUE |
64 |
charge_user_code |
String |
费用行-报销人员工号 |
FALSE |
64 |
charge_user_name |
String |
费用行-报销人用户名 |
FALSE |
64 |
pay_user_code |
String |
费用行-收款人员工号 |
FALSE |
64 |
pay_user_name |
String |
费用行-收款人用户名 |
FALSE |
64 |
cost_center_code |
String |
费用行-成本中心编码 |
FALSE |
64 |
customer_code |
String |
费用行-客户编码 |
FALSE |
64 |
material_code |
String |
费用行-物料编码 |
FALSE |
64 |
product_code |
String |
费用行-商品编码 |
FALSE |
64 |
project_code |
String |
费用行-项目编码 |
FALSE |
64 |
supplier_code |
String |
费用行-供应商账号 |
FALSE |
64 |
unit_code |
String |
费用行-单位编码 |
FALSE |
64 |
period_name |
String |
费用行-财年期间 |
FALSE |
64 |
customer_account_code |
String |
费用行-客户银行账号 |
FALSE |
64 |
supplier_account_code |
String |
费用行-供应商银行账号 |
FALSE |
64 |
user_account_code |
String |
费用行-用户银行账号 |
FALSE |
64 |
external_person_code |
String |
外部人员账号 |
FALSE |
64 |
external_person_account_code |
String |
外部人员银行账号 |
FALSE |
64 |
asset_code |
String |
资金编码 |
FALSE |
64 |
asset_type_code |
String |
资金类型编码 |
FALSE |
64 |
asset_location_code |
String |
资金地址编码 |
FALSE |
64 |
passenger_codes |
Array |
费用行-同行人员工号 |
FALSE |
/ |
passenger_names |
Array |
费用行-同行人用户名 |
FALSE |
/ |
destination_city_name |
String |
费用行-出发城市(中文名称,城市映射关系) |
FALSE |
64 |
destination_city_to_name |
String |
费用行-到达城市(中文名称) |
FALSE |
64 |
from_cities_name |
Array |
费用行-来自城市列表(中文名称) |
FALSE |
255 |
to_cities_name |
Array |
费用行-目的城市列表(中文名称) |
FALSE |
255 |
receipt_amount |
Decimal |
费用行-发票金额 |
TRUE |
/ |
original_amount |
Decimal |
费用行-原始发票金额 |
FALSE |
/ |
receipt_currency |
String |
费用行-发票币种 |
FALSE |
64 |
claim_currency |
String |
费用行-本位币种 |
FALSE |
64 |
exchange_rate |
Decimal |
费用行-发票汇率(发票币种对本位币) |
FALSE |
/ |
claim_amount |
Decimal |
费用行-发生金额(本位币)
receipt_amount * exchange_rate |
TRUE |
/ |
accumulation_type_id |
Integer |
费用行-费用计算方式 |
FALSE |
11 |
accumulation_claim_amount |
Decimal |
费用行-费用计算方式调整金额(本位币)
claim_amount * accumulation_type.factor |
TRUE |
/ |
tax_code |
String |
费用行-税率编码 |
FALSE |
64 |
tax_amount |
Decimal |
费用行-税额
original_amount * exchange_rate * (tax_code.rate) / (1 + tax_code.rate) |
TRUE |
/ |
net_amount |
Decimal |
费用行-不含税金额
claim_amount - tax_amount |
TRUE |
/ |
pay_currency |
String |
费用行-支付币种 |
FALSE |
64 |
pay_exchange_rate |
Decimal |
费用行-支付汇率(发票币种对支付币种) |
FALSE |
/ |
pay_method_id |
Integer |
费用行-支付方式 |
FALSE |
11 |
pay_amount |
Decimal |
费用行-付款金额(发票币种)
receipt_amount * pay_method.factor |
TRUE |
/ |
pay_claim_amount |
Decimal |
费用行-付款金额(本位币)
claim_amount * pay_method.factor |
TRUE |
/ |
pay_currency_amount |
Decimal |
费用行-付款金额(支付币种)
receipt_amount * pay_exchange_rate |
TRUE |
/ |
quantity |
Decimal |
费用行-数量 |
FALSE |
/ |
price |
Decimal |
费用行-单价 |
FALSE |
/ |
net_price |
Decimal |
费用行-不含税单价 |
FALSE |
/ |
offset_detail |
Array |
费用行-偏移细节 |
FALSE |
/ |
expense_id |
Integer |
费用行-消费记录ID(被其他单据占用时无法创建,单据状态为cancelled时解除占用) |
FALSE |
11 |
line_num |
String |
费用行-行号(需要被行行关联 时必填,同一张单据所有费用行之间行号不能相同) |
FALSE |
64 |
pay_object |
String |
费用行-支付对象(后续需要生成支付单时该字段必填) |
FALSE |
1 |
attachment_count |
Integer |
费用行-发票张数 |
FALSE |
10 |
order_complete |
String |
费用行-下单完成(Y /N ) |
FALSE |
1 |
claim_complete |
String |
费用行-核销完成(Y /N ) |
FALSE |
1 |
receive_complete |
String |
费用行-验收完成(Y /N ) |
FALSE |
1 |
invoice_complete |
String |
费用行-收票完成(Y /N ) |
FALSE |
1 |
address |
Object |
费用行-地址 |
FALSE |
/ |
comments |
String |
费用行-描述 |
FALSE |
255 |
long_comments |
String |
费用行-长描述 |
FALSE |
/ |
column1-150 |
String |
费用行-自定义字段 |
FALSE |
255 |
attachments |
Array |
费用行-默认附件区域 |
FALSE |
/ |
attachments.file_name |
String |
费用行-默认附件区域-文件名 |
FALSE |
255 |
attachments.attachment_url |
String |
费用行-默认附件区域-文件地址(远程文件上传) |
FALSE |
/ |
attachments1 |
Array |
费用行-附件一区域 |
FALSE |
/ |
attachments1.file_name |
String |
费用行-附件一区域-文件名 |
FALSE |
255 |
attachments1.attachment_url |
String |
费用行-附件一区域-文件地址 |
FALSE |
/ |
attachments1.attachment_type_code |
String |
附件类型编码 |
FALSE |
无 |
attachments2-9... |
|
|
|
|
attachments10 |
Array |
费用行-附件十区域 |
FALSE |
/ |
attachments10.file_name |
String |
费用行-附件十区域-文件名 |
FALSE |
255 |
attachments10.attachment_url |
String |
费用行-附件十区域-文件地址 |
FALSE |
/ |
attachments10.attachment_type_code |
String |
附件类型编码 |
FALSE |
无 |
link_vo |
Object |
费用行-头行/行行关联关系(头行需同时传入header.link_header_vos ) |
FALSE |
/ |
link_vo.external_id |
String |
费用行-前序单据外部系统单据号 |
ONE-OF |
64 |
link_vo.document_num |
String |
费用行-前序单据单据号 |
ONE-OF |
64 |
link_vo.header_type_code |
String |
费用行-前序单据类型 |
TRUE |
64 |
link_vo.line_num |
String |
费用行-前序单据行行号,传值行号时关联关系为行行关联 ,未传值时为头行关联 |
FALSE |
64 |
事项明细行参数
以下字段需在 data.header.custom_line 路径下传参
字段名称 |
字段类型 |
字段描述 |
是否必填 |
长度限制 |
custom_line_type_code |
String |
事项明细行-类型 |
TRUE |
64 |
cost_center_code |
String |
事项明细行-成本中心编码 |
FALSE |
64 |
customer_code |
String |
事项明细行-客户编码 |
FALSE |
64 |
supplier_code |
String |
事项明细行-供应商编码 |
FALSE |
64 |
charge_user_code |
String |
事项明细行-人员员工号 |
FALSE |
64 |
charge_user_name |
String |
事项明细行-人员用户名 |
FALSE |
64 |
passenger_codes |
Array |
事项明细行-人员员工号列表 |
FALSE |
/ |
passenger_names |
Array |
事项明细行-人员用户名列表 |
FALSE |
/ |
project_code |
String |
事项明细行-项目编码 |
FALSE |
64 |
destination_city_name |
String |
事项明细行-出发城市(中文名称,城市映射关系) |
FALSE |
64 |
destination_city_to_name |
String |
事项明细行-到达城市(中文名称) |
FALSE |
64 |
destination_cities |
String |
事项明细行-多到达城市(中文名称,英文, 分隔) |
FALSE |
/ |
start_datetime |
Long |
事项明细行-开始时间 |
FALSE |
13 |
end_datetime |
Long |
事项明细行-结束时间 |
FALSE |
13 |
attendee_number |
Integer |
事项明细行-人数 |
FALSE |
/ |
duration_day |
Decimal |
事项明细行-时长(天) |
FALSE |
/ |
duration_hour |
Decimal |
事项明细行-时长(小时) |
FALSE |
/ |
duration_minute |
Decimal |
事项明细行-时长(分钟) |
FALSE |
/ |
comments |
String |
事项明细行-描述 |
FALSE |
255 |
long_comments |
String |
事项明细行-长描述 |
FALSE |
/ |
column1-100 |
String |
事项明细行-自定义字段 |
FALSE |
255 |
attachments1 |
Array |
事项明细行-附件一区域 |
FALSE |
/ |
attachments1.file_name |
String |
事项明细行-附件一区域-文件名 |
FALSE |
255 |
attachments1.attachment_url |
String |
事项明细行-附件一区域-文件地址(远程文件上传) |
FALSE |
/ |
attachments1.attachment_type_code |
String |
附件类型编码 |
FALSE |
无 |
attachments2-9... |
|
|
|
|
attachments10 |
Array |
事项明细行-附件十区域 |
FALSE |
/ |
attachments10.file_name |
String |
事项明细行-附件十区域-文件名 |
FALSE |
255 |
attachments10.attachment_url |
String |
事项明细行-附件十区域-文件地址 |
FALSE |
/ |
attachments10.attachment_type_code |
String |
附件类型编码 |
FALSE |
无 |
预算分摊行参数
以下字段需在 data.header.budget_line 路径下传参
字段名称 |
字段类型 |
字段描述 |
是否必填 |
长度限制 |
period_name |
String |
预算分摊行-财年期间编码 |
FALSE |
64 |
cost_center_code |
String |
预算分摊行-成本中心编码 |
FALSE |
64 |
supplier_code |
String |
预算分摊行-供应商编码 |
FALSE |
64 |
charge_department_code |
String |
预算分摊行-部门编码 |
FALSE |
64 |
charge_user_code |
String |
预算分摊行-人员员工号 |
FALSE |
64 |
charge_user_name |
String |
预算分摊行-人员用户名 |
FALSE |
64 |
budget_amount |
Decimal |
预算分摊行-分摊金额 |
FALSE |
/ |
budget_currency |
String |
预算分摊行-分摊币种 |
FALSE |
16 |
ratio |
Decimal |
预算分摊行-分摊比例(小数) |
FALSE |
/ |
column1-100 |
String |
预算分摊行-自定义字段 |
FALSE |
255 |
预算调整行参数
以下字段需在 data.budget_adjustment_line 路径下传参
字段名称 |
字段类型 |
字段描述 |
是否必填 |
长度限制 |
period_name |
String |
预算调整行-财年期间编码 |
FALSE |
64 |
budget_code |
String |
预算调整行-预算科目编码 |
FALSE |
64 |
supplier_code |
String |
预算调整行-供应商编码 |
FALSE |
64 |
department_code |
String |
预算调整行-部门编码 |
FALSE |
64 |
charge_user_code |
String |
预算调整行-人员员工号 |
FALSE |
64 |
charge_user_name |
String |
预算调整行-人员用户名 |
FALSE |
64 |
project_code |
String |
预算调整行-项目编码 |
FALSE |
64 |
adjustment_amount |
Decimal |
预算调整行-分摊币种 |
FALSE |
/ |
comments |
String |
预算调整行-描述 |
FALSE |
255 |
column1-10 |
String |
预算调整行-自定义字段 |
FALSE |
255 |
预算调拨行参数
以下字段需在 data.budget_transfer_line 路径下传参
字段名称 |
字段类型 |
字段描述 |
是否必填 |
长度限制 |
period_name_in |
String |
预算调拨行(转入)- 财年期间编码 |
FALSE |
64 |
budget_code_in |
String |
预算调拨行(转入)- 预算科目编码 |
FALSE |
64 |
supplier_code_in |
String |
预算调拨行(转入)- 供应商编码 |
FALSE |
64 |
department_code_in |
String |
预算调拨行(转入)- 部门编码 |
FALSE |
64 |
charge_user_code_in |
String |
预算调拨行(转入)- 人员员工号 |
FALSE |
64 |
charge_user_name_in |
String |
预算调拨行(转入)- 人员用户名 |
FALSE |
64 |
project_code_in |
String |
预算调拨行(转入)- 项目编码 |
FALSE |
64 |
period_name_out |
String |
预算调拨行(转出)- 财年期间编码 |
FALSE |
64 |
budget_code_out |
String |
预算调拨行(转出)- 预算科目编码 |
FALSE |
64 |
supplier_code_out |
String |
预算调拨行(转出)- 供应商编码 |
FALSE |
64 |
department_code_out |
String |
预算调拨行(转出)- 部门编码 |
FALSE |
64 |
charge_user_code_out |
String |
预算调拨行(转出)- 人员员工号 |
FALSE |
64 |
charge_user_name_out |
String |
预算调拨行(转出)- 人员用户名 |
FALSE |
64 |
project_code_out |
String |
预算调拨行(转出)- 项目编码 |
FALSE |
64 |
adjustment_amount |
Decimal |
预算调拨行 - 金额 |
FALSE |
/ |
column1-10 |
String |
预算调拨行 - 自定义字段 |
FALSE |
255 |
返回参数
字段名称 |
字段类型 |
字段描述 |
resCode |
Integer |
响应状态码 |
resMsg |
String |
返回信息描述 |
data |
Object |
返回数据 |
data.error |
String |
失败信息 |
示例
请求示例
{
"bizId": "4aba2901-8b53-40f5-91fc-e8f375cddc84",
"timestamp": 1614053054469,
"data": {
"header": {
"external_id": "RVhQMDAwMDAwMDAwMQ==",
"header_type_code": "T014",
"status": "incomplete",
"created_by_code": "0101106",
"branch_code": "105",
"submit_department_code": "32006",
"charge_department_code": "32006",
"customer_account_number": "6217788314500000315",
"supplier_code": "100662",
"currency_code": "CNY",
"total_amount": 340.00,
"total_claim_amount": 340.00,
"total_net_amount": 300.88,
"total_tax_amount": 39.12,
"column1": "300.88",
"column10": "0.00",
"column13": "CT02",
"column14": "光谷大道6号门",
"column15": "CON0223000021",
"column47": "PO0223000016",
"column48": "340.00",
"link_header_vos": [
{
"external_id": "UkVRMDAwMDAwMDAwMg==",
"header_type_code": "T014"
}
],
"attachments": [
{
"file_name": "file_name.png",
"attachment_url": "通过文件上传接口获取到的文件key.png",
"attachment_type_code": "test"
}
],
"attachments1": [
{
"file_name": "file_name1.png",
"attachment_url": "通过文件上传接口获取到的文件key.png",
"attachment_type_code": "test"
}
],
"attachments10": [
{
"file_name": "file_name10.png",
"attachment_url": "通过文件上传接口获取到的文件key.png",
"attachment_type_code": "test"
}
],
"claim_line": [
{
"line_type_code": "T50",
"cost_center_code": "32006",
"project_code": "FD004.2",
"tax_code": "TAX_IN_13",
"receipt_currency": "CNY",
"receipt_amount": 340.00,
"claim_amount": 340.00,
"net_amount": 300.88,
"tax_amount": 39.12,
"column1": "column1",
"column4": "1",
"column24": "119",
"column27": "0",
"column51": "column51",
"link_vo": {
"external_id": "8fb352f01a97",
"header_type_code": "RT014",
"line_num": "1"
}
}
],
"custom_line": [
{
"custom_line_type_code": "T02",
"cost_center_code": "D1",
"customer_code": "MKS",
"supplier_code": "AK001",
"charge_user_name": "aaa@cloudpense.com",
"passenger_names": [
"aaa@cloudpense.com",
"bbb@cloudpense.com"
],
"project_code": "DRHG1",
"destination_city_name": "上海",
"destination_city_to_name": "北京",
"destination_cities": "上海,北京",
"start_datetime": 1681660800000,
"end_datetime": 1681747200000,
"attendee_number": 2,
"duration_day": 1.0,
"duration_hour": 24.0,
"duration_minute": 1440.0,
"comments": "comments",
"long_comments": "long_comments",
"column1": "100",
"column14": "1400"
}
],
"budget_line": [
{
"period_name": "2023年5月",
"cost_center_code": "C004300249",
"supplier_code": "0070002396",
"charge_department_code": "D1",
"charge_user_name": "test@cloudpense.com",
"project_code": "apipro003",
"budget_amount": 340.00,
"budget_currency": "CNY",
"ratio": 1.0,
"column1": "100",
"column51": "5100"
}
],
"budget_adjustment_line": [
{
"adjustment_amount": 501.00,
"period_name": "2024年11月份",
"budget_code": "002",
"department_code": "B0001",
"supplier_code": "191",
"project_code": "300201",
"column10": "B2"
}
],
"budget_transfer_line": [
{
"adjustment_amount": 501.00,
"period_name_in": "2024年11月份",
"budget_code_in": "002",
"department_code_in": "B0001",
"supplier_code_in": "191",
"project_code_in": "300201",
"period_name_out": "2024年12月份",
"budget_code_out": "003",
"supplier_code_out": "190",
"project_code_out": "300211",
"column10": "B2"
}
]
}
}
}
返回示例
{
"resCode": 200000,
"resMsg": "创建成功",
"data": {
"header": {
"header_id": 12204,
"company_id": 20387,
"document_id": 12204,
"document_num": "REQ0000001577",
"status": "approved",
"header_type_id": 155693,
"external_id": "e8f375cddc84",
"total_amount": 340.00,
"currency_code": "CNY",
"column1": "300.88",
"column10": "0.00",
"column13": "CT02",
"column14": "光谷大道6号门",
"column15": "CON0223000021",
"column47": "PO0223000016",
"column48": "340.00"
}
}
}
{
"resCode": 500060,
"resMsg": "校验失败",
"data": {
"error": "header中单据类型header_type_code值ZD20错误"
}
}