轻易云助力金蝶云星空数据集成:从请求到处理

  • 轻易云集成顾问-胡秀丛

金蝶云星空数据集成到轻易云集成平台案例分享:查询采购入库单

在现代企业的业务操作过程中,确保各系统之间的数据流通顺畅无阻,是实现高效运营的关键。本文将详细探讨如何通过轻易云数据集成平台,将金蝶云星空中的采购入库单数据集成到新的业务流程中。

首先,我们面临的是如何有效获取并稳定抓取金蝶云星空系统中的采购入库单信息。我们使用了金蝶提供的API接口executeBillQuery来查询和提取所需数据。为了避免漏单及处理大量数据带来的挑战,我们设计了一套定时可靠的数据抓取机制。这不仅保证了实时性,还能应对分页和限流问题。

另一方面,在将这些海量数据快速写入到轻易云集成平台时,批量处理显得尤为重要。通过调用轻易云的平台API: batchSave,我们能够高效地进行批量写入,并针对不同字段间存在的数据格式差异进行动态映射。同时,为确保每条记录完整无误地传输,我们在接收端实现了严格的异常处理与错误重试机制,以便在遇到网络波动或外界干扰时自动修复问题。

此外,通过全程透明化、可视化监控工具,我们可以实时观察整个数据处理过程,包括从金蝶出发至最终存储于新平台上的各个环节,这极大提高了我们的调试效率和运维能力。

接下来部分将详细描述具体配置步骤及代码示例,以期对有相似需求的技术人员有所帮助。

金蝶云星空API接口配置

调用金蝶云星空接口executeBillQuery获取并加工数据

在数据集成的生命周期中,调用源系统接口获取数据是至关重要的一步。本文将深入探讨如何通过轻易云数据集成平台调用金蝶云星空的executeBillQuery接口来查询采购入库单,并对数据进行初步加工。

接口配置与调用

首先,我们需要配置元数据以便正确调用金蝶云星空的executeBillQuery接口。以下是关键的元数据配置:

{
  "api": "executeBillQuery",
  "method": "POST",
  "number": "FBillNo",
  "id": "FInStockEntry_FEntryId",
  "pagination": {
    "pageSize": 500
  },
  "idCheck": true,
  "request": [
    {"field":"FInStockEntry_FEntryId","label":"id","type":"string","value":"FInStockEntry_FEntryId"},
    {"field":"FID","label":"实体主键","type":"string","value":"FID"},
    {"field":"FBillNo","label":"单据编号","type":"string","value":"FBillNo"},
    {"field":"FDocumentStatus","label":"单据状态","type":"string","value":"FDocumentStatus"},
    {"field":"FStockOrgId_FNumber","label":"收料组织","type":"string","value":"FStockOrgId.FNumber"},
    {"field":"FDate","label":"入库日期","type":"string","value":"FDate"},
    {"field":"FBillTypeID_FNumber","label":"单据类型","type":"string","value":"FBillTypeID.FNumber"},
    {"field":"FOwnerTypeIdHead","label":"货主类型","type":"string","value":"FOwnerTypeIdHead"},
    {"field":"FOwnerIdHead_FNumber","label":"货主","type":"string","value":"FOwnerIdHead.FNumber"},
    {"field":"FDemandOrgId_FNumber","label":"需求组织","type":"string","value":"FDemandOrgId.FNumber"},
    {"field":"FPurchaseOrgId_FNumber","label":"采购组织","type":"string","value":"FPurchaseOrgId.FNumber"},
    {"field": "FSupplierId_FNumber", "label": "供应商", "type": "string", "value": "FSupplierId.FNumber"}
  ],
  "otherRequest": [
    {"field": "Limit", "label": "最大行数", "type": "string", "describe": "金蝶的查询分页参数", "value": "{PAGINATION_PAGE_SIZE}"},
    {"field": "StartRow", "label": "开始行索引", "type": "string", "describe": "金蝶的查询分页参数", "value": "{PAGINATION_START_ROW}"},
    {"field": "TopRowCount", "label": "返回总行数", "type": int, describe: 金蝶的查询分页参数},
    {"field": FilterString, label: 过滤条件, type: string, describe: 示例写法 FSupplierId.FNumber = 'VEN00010' and FApproveDate>= , value: FApproveDate>='{{LAST_SYNC_TIME|dateTime}}'},
    {"field": FieldKeys, label: 需查询的字段key集合, type: array, describe: 金蝶分录主键ID格式:FPOOrderEntry_FEntryId,其它格式 FPurchaseOrgId.FNumber, parser: {name: ArrayToString, params:,}},
    {"field" FormId, label: 业务对象表单Id, type: string, describe: 必须填写金蝶的表单ID如:PUR_PurchaseOrder, value: STK_InStock}
  ]
}

数据请求与清洗

在实际操作中,我们会通过HTTP POST请求来调用该接口,并根据元数据配置中的字段获取所需的数据。以下是一个示例请求体:

{
  FormId: 'STK_InStock',
  FieldKeys: 'FID,FInStockEntry_FEntryId,FBillNo,FDocumentStatus,FStockOrgId.FNumber,FDate',
  FilterString: 'FApproveDate>='2023-01-01'',
  Limit: '500',
  StartRow: '0'
}

请求发送后,系统将返回包含采购入库单信息的数据集。此时,我们需要对返回的数据进行初步清洗和加工,以确保其符合后续处理和分析的要求。

数据转换与写入

在获取并清洗完数据后,下一步就是将其转换为目标系统所需的格式,并写入到相应的数据存储中。这一步通常涉及到字段映射、数据类型转换以及必要的数据校验。

例如,对于采购入库单中的日期字段,我们可能需要将其从字符串格式转换为标准的日期格式,以便于后续的时间序列分析。

import datetime

def convert_date(date_str):
    return datetime.datetime.strptime(date_str, '%Y-%m-%d').date()

# 示例转换
data['FDate'] = data['FDate'].apply(convert_date)

通过上述步骤,我们可以确保从金蝶云星空获取的数据经过清洗和转换后,能够无缝地集成到目标系统中,从而实现高效的数据流动和处理。

总结

本文详细介绍了如何通过轻易云数据集成平台调用金蝶云星空接口executeBillQuery来获取采购入库单数据,并对其进行初步清洗和加工。通过合理配置元数据和精细化处理,我们能够确保数据集成过程高效、可靠,为后续的数据分析和业务决策提供坚实基础。 金蝶与WMS系统接口开发配置

数据请求与清洗

在数据集成生命周期的第二步,我们需要将源平台的数据进行ETL转换,以便能够写入目标平台。在这个过程中,首先需要对数据进行请求和清洗。以下是一个典型的元数据配置示例,用于查询采购入库单并准备将其转换为目标平台所需的格式。


{
  "api": "batchSave",
  "method": "POST",
  "idCheck": true,
  "request": [
    {"field":"FBillTypeID","label":"单据类型","type":"string","describe":"单据类型","parser":{"name":"ConvertObjectParser","params":"FNumber"},"value":"RKD01_SYS"},
    {"field":"FBusinessType","label":"业务类型","type":"string","describe":"下拉列表","value":"CG"},
    {"field":"FBillNo","label":"单据编号","type":"string","describe":"单据编号"},
    {"field":"FSupplierId","label":"供应商","type":"string","describe":"基础资料","parser":{"name":"ConvertObjectParser","params":"FNumber"}},
    {"field":"FDate","label":"入库日期","type":"string","describe":"日期"},
    {"field":"FStockOrgId","label":"收料组织","type":"string","describe":"组织","parser":{"name":"ConvertObjectParser","params":"FNumber"}},
    {"field":"FStockDeptId","label":"收料部门","type":"string","describe":"基础资料","parser":{"name":"ConvertObjectParser","params":"FNumber"}},
    {"field": "FPurchaseOrgId", "label": "采购组织", "type": "string", "describe": "组织", "parser": {"name": "ConvertObjectParser", "params": "FNumber"}},
    {"field": "FDeliveryBill", "label": "送货单号", "type": "string", "describe": "文本"},
    {"field": "FTakeDeliveryBill", "label": "提货单号", "type": "string", "describe": "文本"},
    {"field": "FSupplyId", "label": "供货方", "type": "string", "describe": 
![用友BIP接口开发配置](https://pic.qeasy.cloud/T12.png~tplv-syqr462i7n-qeasy.image)
更多系统对接方案