单据更新

  • 接口:common/document/update/{externalId}
  • Method:POST
  • 数据格式:JSON
  • 接口说明:单据更新
  • 其他补充信息:
    • 单据头仅可做更新操作, 可更新字段见下文
    • 仅可更新单据状态为 approved, closed 的单据
    • 仅可更新单据头 internal_type 为 request, request_contract, request_travel, purchase_order, goods_receipt, sales_order 的单据
    • 单据行若存在 line_id 为更新, 不存在为新增, 可更新字段见下文。 新增时: 单据行详细报文见单据创建口
    • 事项明细行若存在 id 为更新, 不存在为新增
    • 预算分摊行若存在 id 为更新, 不存在为新增

请求参数

字段名称 字段类型 字段描述 是否必填 长度 1
externalId String 外部系统单据号或本系统单据号 ONE-OF 64

body (单据头和行仅展示可更新字段, 新增时, 对应可传字段见单据创建口报文)

字段名称 字段类型 字段描述 是否必填 长度限制(字节)
bizId String 当前次接口同步的唯一标识 FALSE 36
timestamp Long 当前次接口同步的时间戳 FALSE 13
data. Object 请求数据体 TRUE

单据头参数

以下字段需在 data 路径下传参

字段名称 字段类型 字段描述 是否必填 长度限制(字节)
total_amount Decimal 单据头(总金额) FALSE
advance_amount Decimal 单据头(预付款金额) FALSE
total_pay_amount Decimal 单据头(总支付金额) FALSE
total_claim_amount Decimal 单据头(总发生金额) FALSE
total_pay_currency_amount Decimal 单据头(付款金额) FALSE
start_datetime Long 单据头(开始时间) FALSE
end_datetime Long 单据头(结束时间) FALSE
charge_department Object 单据头(主管部门) FALSE
formula_description String 单据头(公式描述) FALSE
column1 Object 单据头(column自定义字段) FALSE
column2 Object 单据头(column自定义字段) FALSE
column3...150 Object 单据头(column自定义字段) FALSE
claim_line Array 单据行列表 FALSE /
custom_line Array 事项明细行列表 FALSE /
claim_lines Array 预算分摊行列表 FALSE /
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

费用行参数

以下字段需在 data.claim_line 路径下传参

字段名称 字段类型 字段描述 是否必填 长度限制(字节)
line_id Long 更新则传, 新增则不用传 FALSE 36
original_amount Decimal 单据行(原始发票金额) FALSE 36
receipt_amount Decimal 单据行(发票金额) FALSE 13
fin_receipt_amount Decimal 单据行(财务-发票金额) FALSE
claim_amount Decimal 单据行(发生金额) FALSE
fin_claim_amount Decimal 单据行(财务-发生金额) FALSE
accumulation_claim_amount Decimal 单据行(费用计算方式调整金额) FALSE
pay_amount Decimal 单据行(付款金额-发票币种) FALSE
fin_pay_amount Decimal 单据行(财务-付款金额-发票币种) FALSE
pay_claim_amount Decimal 单据行(付款金额-本位币种) FALSE
fin_pay_claim_amount Decimal 单据行(财务-付款金额-本位币种) FALSE
pay_currency_amount Decimal 单据行(付款金额-支付币种) FALSE
fin_pay_currency_amount Decimal 单据行(财务-付款金额-支付币种) FALSE
net_amount Decimal 单据行(不含税金额) FALSE
cost_center_code String 单据行(成本中心编码) FALSE
project_code String 单据行(项目编码) FALSE
period_name String 单据行(财年期间) FALSE
quantity Decimal 单据行(数量) FALSE
column1 Object 单据行(column自定义字段) FALSE
column2 Object 单据行(column自定义字段) FALSE
column3...150 Object 单据行(column自定义字段) FALSE
attachments Array 默认附件区域 FALSE /
attachments.file_name String 默认附件区域-文件名 FALSE 255
attachments.attachment_url String 默认附件区域-文件地址(远程文件上传 FALSE /
attachments50.attachment_type_code String 附件类型编码 FALSE
attachments1 Array 附件一区域 FALSE /
attachments1.file_name String 附件一区域-文件名 FALSE 255
attachments1.attachment_url String 附件一区域-文件地址 FALSE /
attachments50.attachment_type_code String 附件类型编码 FALSE
attachments2-9...
attachments10 Array 附件十区域 FALSE /
attachments10.file_name String 附件十区域-文件名 FALSE 255
attachments10.attachment_url String 附件十区域-文件地址 FALSE /
attachments50.attachment_type_code String 附件类型编码 FALSE

事项明细行参数

以下字段需在 data.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 /
attachments2-9...
attachments10 Array 事项明细行-附件十区域 FALSE /
attachments10.file_name String 事项明细行-附件十区域-文件名 FALSE 255
attachments10.attachment_url String 事项明细行-附件十区域-文件地址 FALSE /

预算分摊行参数

以下字段需在 data.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

请求示例:

请求数据

common/document/update/bd84fd45-038f-4a79-854b-a322031a7c19
{
  "timestamp": 1702521344000,
  "bizId": "xxx",
  "data": {
    "total_amount": 600,
    "total_claim_amount": 600,
    "total_pay_amount": 600,
    "total_pay_currency_amount": 600,
    "total_net_amount": 600,
    "total_receipt_amount": 600,
    "column37": 0.37,
    "column63": "8676",
    "charge_department_code": "2050015",
    "attachments1": [
      {
        "file_name": "file_name1.png",
        "attachment_url": "https://attachment-url.com/file_name1.png",
        "attachment_type_code": "test01"
      }
    ],
    "attachments10": [
      {
        "file_name": "file_name10.png",
        "attachment_url": "https://attachment-url.com/file_name10.png",
        "attachment_type_code": "test01"
      }
    ],
    "claim_lines": [
      {
        "line_id": 434465,
        "quantity": 8,
        "line_type_code": "T012",
        "budget_id": 18519,
        "charge_user_code": "zhaixuwen@tom.com",
        "receipt_amount": 50,
        "receipt_currency": "CNY",
        "claim_amount": 50,
        "claim_currency": "CNY",
        "fin_claim_amount": 50,
        "net_amount": 50,
        "pay_amount": 50,
        "pay_claim_amount": 50,
        "pay_currency_amount": 50,
        "fin_pay_currency_amount": 50,
        "period_name": "2024年财年-11",
        "cost_center_code": "D1",
        "project_code": "13418712",
        "column1": "1",
        "column2": "2",
        "column3": "3",
        "column100": "100",
        "attachments1": [
          {
            "file_name": "file_name1.png",
            "attachment_url": "https://attachment-url.com/file_name1.png",
            "attachment_type_code": "test01"
          }
        ],
        "attachments10": [
          {
            "file_name": "file_name10.png",
            "attachment_url": "https://attachment-url.com/file_name10.png",
            "attachment_type_code": "test01"
          }
        ]
      },
      {
        "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"
      }
    ],
    "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"
      }
    ]
  }
}

返回示例

成功

{
  "resCode": 200000,
  "resMsg": "success",
  "bizId": "384a58fd-1061-4611-9437-5d1674292cd8"
}

失败

{
  "resCode": 0,
  "resMsg": "该单据 status 为 cancelled 不允许更新",
  "bizId": "20d9c2bb-9c05-4b44-af29-fac64c5ad2fb"
}
{
  "resCode": 400000,
  "resMsg": "单据不存在",
  "bizId": "d69c5943-5955-48ea-b2d8-5aa50b2808d2"
}

results matching ""

    No results matching ""