# 采购发票

本文档将详细列举当前系统支持采购发票相关的 webhook

# 创建采购发票

curl 示例请求:

curl --request POST \
  --url 'http(s)://${yourhost}/${yourpath}?businessType=CREATE_PURCHASE_ORDER_INVOICE' \
  --header 'content-type: application/json' \
  --data '{"requestId":"24852d91-5c43-4f67-99c5-e6e441337749","businessType":4000,"data":{"code":"","invoiceTypeCode":"EM001","invoiceTitle":"1605504720000","taxCode":"12311231","enterpriseCode":"VIP-1001","enterpriseName":"上海纽酷","staffCode":"EM-001","staffName":"测试","comments":"发票备注","currency":"CNY","status":1,"records":[{"relatedOrderCode":"SO-201116-002","itemCode":"015","itemName":"MES测试物料二20201116","quantity":2,"price":10,"comments":""}]}}'

请求报文说明

{
  "requestId": "24852d91-5c43-4f67-99c5-e6e441337749",//请求ID,供日后 DEBUG 用,暂无业务意义
  "businessType": 4010,//业务类型,参考[webhook](/webhook/)定义
  "data": {
    "code": "",//单据编码
    "invoiceType":"VALUE_ADDED_TAX"//发票类型
    "invoiceTypeCode": "XT-123",//发票类别代码
    "invoiceTitle": "1605504720000",//发票抬头
    "invoiceCode": "XT-123"//发票号
    "taxCode":"12311231",//纳税人识别号
    "customerCode": "VIP-1001",//客户编码
    "customerName": "上海纽酷",//客户名称
    "staffCode":"EM-001",//开票人工号
    "staffName":"测试",//开票人名称
    "applicationCode":"EM-13"//申请人工号
    "applicationName":"黎明"//申请人名称
    "comments":"发票备注",
    "currency":"CNY",//币种
    "createType":"SALE_ORDER"//开票单据类型SALE_ORDER(0),SALE_OUT(1),SALE_RETURN(2),PURCHASE_ORDER(3),PURCHASE_RECEIPT(4),PURCHASE_RETURN(5);
    "status":"PASS", //审核状态 PASS("通过"),REFUSAL("驳回");
    "createTime":1636271847899,//创建时间
    "items": [{
      "relatedOrderCode":"SO-201116-002",// 关联单号
      "itemCode": "015",//物料编码
      "itemName": "MES测试物料二20201116",//物料名称
      "quantity": 2,//订单明细数量
      "price":10,//价格
      "tax":13,//税额
      "itemAttributes":{"颜色":"蓝色","材质":"304"}//物料规格
      "comments": ""//行备注
    }]
  }
}

# 审核采购发票

curl 示例请求:

curl --request POST \
  --url 'http(s)://${yourhost}/${yourpath}?businessType=AUDIT_PURCHASE_ORDER_INVOICE' \
  --header 'content-type: application/json' \
  --data '{"requestId":"24852d91-5c43-4f67-99c5-e6e441337749","businessType":4000,"data":{"code":"","invoiceTypeCode":"EM001","invoiceTitle":"1605504720000","taxCode":"12311231","enterpriseCode":"VIP-1001","enterpriseName":"上海纽酷","staffCode":"EM-001","staffName":"测试","comments":"发票备注","currency":"CNY","status":1,"records":[{"relatedOrderCode":"SO-201116-002","itemCode":"015","itemName":"MES测试物料二20201116","quantity":2,"price":10,"comments":""}]}}'

请求报文说明

{
  "requestId": "24852d91-5c43-4f67-99c5-e6e441337749",//请求ID,供日后 DEBUG 用,暂无业务意义
  "businessType": 4011,//业务类型,参考[webhook](/webhook/)定义
  "data": {
    "code": "",//单据编码
    "invoiceType":"VALUE_ADDED_TAX"//发票类型
    "invoiceTypeCode": "XT-123",//发票类别代码
    "invoiceTitle": "1605504720000",//发票抬头
    "invoiceCode": "XT-123"//发票号
    "taxCode":"12311231",//纳税人识别号
    "customerCode": "VIP-1001",//客户编码
    "customerName": "上海纽酷",//客户名称
    "staffCode":"EM-001",//开票人工号
    "staffName":"测试",//开票人名称
    "applicationCode":"EM-13"//申请人工号
    "applicationName":"黎明"//申请人名称
    "comments":"发票备注",
    "currency":"CNY",//币种
    "createType":"SALE_ORDER"//开票单据类型SALE_ORDER(0),SALE_OUT(1),SALE_RETURN(2),PURCHASE_ORDER(3),PURCHASE_RECEIPT(4),PURCHASE_RETURN(5);
    "status":"PASS", //审核状态 PASS("通过"),REFUSAL("驳回");
    "createTime":1636271847899,//创建时间
    "items": [{
      "relatedOrderCode":"SO-201116-002",// 关联单号
      "itemCode": "015",//物料编码
      "itemName": "MES测试物料二20201116",//物料名称
      "quantity": 2,//订单明细数量
      "price":10,//价格
      "tax":13,//税额
      "itemAttributes":{"颜色":"蓝色","材质":"304"}//物料规格
      "comments": ""//行备注
    }]
  }
}