使用轻易云平台进行企业系统数据集成及错误处理

  • 轻易云集成顾问-张妍琪

20230821物料同步:金蝶云星空到小满OKKICRM数据集成案例

在实现企业系统之间的无缝对接过程中,解决系统间的数据交互难题始终是一个重中之重。本文将分享如何通过轻易云数据集成平台,实现金蝶云星空与小满OKKICRM两大系统之间的数据高效同步。本次案例以“20230821物料同步”为名,详细探讨了从获取金蝶云星空数据到写入小满OKKICRM的整个技术流程。

为了保证此次集成过程中的数据完整性和实时性,我们采用了定时可靠的抓取机制,通过调用金蝶云星空API executeBillQuery 定期获取最新物料信息。面对大量数据传输需求,为避免接口限流问题,我们设计了一系列分页处理方案,并着重介绍了如何确保每次请求不漏单。

考虑到两大系统的数据格式差异,以及需要快速且批量地将这些物料信息推送至小满OKKICRM,我们利用其提供的API /v1/product/push 实现了高效的数据写入。在数据对接过程中,还特别提到了异常处理与错误重试机制,以最大程度减少因网络波动或接口响应延迟导致的数据丢失。

本次配置实例不仅展示了如何有效处理金蝶云星空查询结果,同时也涵盖了转换映射规则及日志记录等重要环节,有助于保障业务全流程透明可控。下文将详细解析整个实施步骤及关键技术要点。 电商OMS与WMS系统接口开发配置

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

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

接口配置与调用

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

{
  "api": "executeBillQuery",
  "effect": "QUERY",
  "method": "POST",
  "number": "FNumber",
  "id": "FMasterId",
  "name": "FNumber",
  "request": [
    {"field":"FMasterId","label":"id","type":"string","describe":"id","value":"FMasterId"},
    {"field":"FNumber","label":"编码","type":"string","describe":"编码","value":"FNumber"},
    {"field":"FName","label":"名称","type":"string","describe":"名称","value":"FName"},
    {"field":"FSpecification","label":"规格型号","type":"string","describe":"规格型号","value":"FSpecification"},
    {"field":"FOldNumber","label":"旧物料编码","type":"string","describe":"旧物料编码","value":"FOldNumber"},
    {"field":"FDescription","label":"描述","type":"string","describe":"描述","value":"FDescription"},
    {"field":"FMaterialGroup_FNumber","label":"物料分组","type":"string","describe":"物料分组","value":"FMaterialGroup.FNumber"},
    {"field":"FErpClsID","label":"物料属性","type":"string","describe":"物料属性","value":"FErpClsID"},
    {"field":"FForbidStatus","label":"禁用状态","type":"string","describe":"禁用状态","value":"FForbidStatus"},
    {"field": "FilterString", "label": "过滤条件", "type": "string", "describe": "示例写法 FSupplierId.FNumber = 'VEN00010' and FApproveDate>=", "value": "FUseOrgId.fnumber='100' and FModifyDate>='{{LAST_SYNC_TIME|dateTime}}'"}
  ],
  "otherRequest":[
    {"field": "Limit", "label": "最大行数", "type": "string", "describe": "金蝶的查询分页参数", "value": "2000"},
    {"field": "StartRow", "label": "开始行索引", "type": "string", "describe": "", value: "{PAGINATION_START_ROW}"},
    {"field": “FormId”, “label”: “业务对象表单Id”, “type”: “string”, “describe”: “必须填写金蝶的表单ID如:PUR_PurchaseOrder”, “value”: “BD_MATERIAL”}
  ],
  “autoFillResponse”: true
}

数据请求与清洗

在配置好元数据后,我们可以通过POST方法向金蝶云星空发送请求。请求体包含了我们需要查询的字段和过滤条件,例如:

{
  “FormId”: “BD_MATERIAL”,
  “FieldKeys”: “FMasterId,FNumber,FName,FSpecification,FOldNumber,FDescription,FMaterialGroup.FNumber,FErpClsID,FForbidStatus”,
  “FilterString”: “FUseOrgId.fnumber='100' and FModifyDate>='2023-01-01T00:00:00'”,
  “Limit”: 2000,
  “StartRow”: 0
}

在接收到响应后,我们需要对数据进行清洗和转换。这一步骤包括去除无效数据、标准化字段格式等。例如,将日期格式统一为ISO标准,或者将数值字段转换为浮点数。

数据转换与写入

清洗后的数据需要进一步转换,以便写入目标系统。在这个过程中,我们可能需要进行字段映射、单位转换等操作。例如,将金蝶云中的“基本单位.编码”字段映射到目标系统中的“unit_code”字段。

{
  “source_field”: “基本单位.编码”,
  “target_field”: “unit_code”
}

通过这种方式,我们确保了数据在不同系统之间的一致性和准确性。

实时监控与调试

为了确保整个过程顺利进行,实时监控和调试是必不可少的。轻易云平台提供了全透明可视化的操作界面,可以实时查看数据流动和处理状态。这使得我们能够快速发现并解决问题,提高了整体效率。

总结来说,通过正确配置元数据并调用金蝶云星空的executeBillQuery接口,我们可以高效地获取并加工所需的数据,为后续的数据转换与写入打下坚实基础。 钉钉与CRM系统接口开发配置

利用轻易云数据集成平台进行ETL转换并写入小满OKKICRMAPI接口

在数据集成的生命周期中,第二步是将已经集成的源平台数据进行ETL(提取、转换、加载)转换,并最终写入目标平台。在本案例中,我们将探讨如何利用轻易云数据集成平台,将源数据转换为小满OKKICRMAPI接口所能接收的格式,并成功写入目标平台。

1. API接口配置

根据元数据配置,小满OKKICRMAPI的目标接口为/v1/product/push,请求方法为POST。该接口要求的数据字段包括产品名称、产品编码、产品型号等。以下是具体的字段映射关系:

{
  "api": "/v1/product/push",
  "effect": "EXECUTE",
  "method": "POST",
  "idCheck": true,
  "request": [
    {"field": "name", "label": "产品名称", "type": "string", "describe": "产品名称", "value": "{FName}"},
    {"field": "product_no", "label": "产品编码", "type": "string", "describe": "ATC NO", "value": "{FNumber}"},
    {"field": "model", "label": "产品型号", "type": "string", "describe": "产品型号", "value": "{FSpecification}"},
    {"field": "description", "label": "产品描述", "type": "string", "describe": "产品描述", "value": "{FDescription}"},
    {"field": "package_gross_weight", "label": "产品毛重", "type": "string", "describe": "产品毛重", "value":"{FGROSSWEIGHT}"},
    {"field":"package_unit","label":"包装单位","type":"string","describe":"包装单位","value":"{FBaseUnitId_FNumber}"},
    {"field":"package_volume","label":"包装体积","type":"string","describe":"包装体积","value":"{FVOLUME}"},
    {"field":"unit","label":"计量单位","type":"string","describe":"计量单位","value":"{FBaseUnitId_FNumber}"},
    {"field":"product_type","label":"产品类型","type":"string","describe":"产品类型","value":"1"},
    {"field":"group_id","label":"产品分组","type":"string","describe":"产品分组","value":
      "_findCollection find id from 9f496710-2fe6-340b-a93a-0543b6dd7977 where name={F_hesh_Assistant112}"},
    {"field":"11317573983","label":"EAN编码","type":"string","describe":"EAN编码"},
    {"field":"11317575560","label":"UPC编码","type":"string","describe":"UPC编码"}
  ]
}

2. 数据提取与清洗

首先,从源系统提取原始数据。假设我们从ERP系统中提取了如下示例数据:


{

![如何开发企业微信API接口](https://pic.qeasy.cloud/T6.png~tplv-syqr462i7n-qeasy.image)
更多系统对接方案