金蝶云星空与旺店通·旗舰版数据集成案例:标准-金蝶-其他入库单——>旺店通-内部仓入(其他入库)
在企业级应用中,实现不同系统间的数据无缝对接是提高运营效率和准确度的关键一步。本文将以实际项目“标准-金蝶-其他入库单——>旺店通-内部仓入(其他入库)”为例,详解如何通过轻易云数据集成平台实现金蝶云星空的数据高效、可靠地同步至旺店通·旗舰版。
首先,确保集成过程中数据不漏单是关键步骤。我们使用了executeBillQuery接口从金蝶云星空系统定时抓取最新的订单数据。这一过程依赖于API调用,能够保证每次抓取操作都覆盖到新的和修改过的记录。为了应对潜在的大量订单,我们采用了分页处理技术,这样可以避免因为一次性获取过多数据而导致的网络拥堵或性能下降问题。在Pagination机制的支持下,无论业务高峰还是低谷,都能维持稳定的数据流动。
其次,在批量写入大量数据到旺店通·旗舰版时,将其分批处理,通过wms.stockin.Other.createOtherOrder接口进行规范化管理,以便最大限度减少写操作带来的负面影响。同时,加强前后的错误重试机制也是不可忽视的一环,当出现异常情况如网络抖动、接口超时时,冗余推送策略会自动重新尝试提交未成功的信息,从而保障最终一致性和完整性。
在此过程中,还需关注两个系统之间的数据格式差异。例如,金蝶云星空中的字段类型和命名可能与旺店通·旗舰版有所不同,为此,我们进行了定制化的数据映射工作,包括字段名称转换、类型转化等。这不仅提升了匹配精度,同时也提供了灵活扩展能力,应对未来潜在变化需求。
最后,为实时监控此次集成任务,一方面利用日志功能记录每一个操作步骤,对成功及失败次数做详细统计;另一方面,通过报警机制及时反馈异常情况,使维护人员能够第一时间响应并解决问题,大幅提升整体运行效率和安全性。
以上内容仅为此次案例技术方案简要概述,在后续部分,将详细探讨各个环节具体实施细节及最佳实践方法。
调用金蝶云星空接口executeBillQuery获取并加工数据
在数据集成过程中,调用源系统的API接口是关键的一步。本文将详细探讨如何使用轻易云数据集成平台调用金蝶云星空的executeBillQuery
接口来获取并加工数据。
接口配置与调用
首先,我们需要配置元数据以便正确调用executeBillQuery
接口。以下是该接口的元数据配置:
{
"api": "executeBillQuery",
"effect": "QUERY",
"method": "POST",
"number": "FBillNo",
"id": "FEntity_FEntryID",
"name": "FBillNo",
"idCheck": true,
"request": [
{"field":"FEntity_FEntryID","label":"FEntryID","type":"string","describe":"FEntryID","value":"FEntity_FEntryID"},
{"field":"FID","label":"实体主键","type":"string","describe":"实体主键","value":"FID"},
{"field":"FBillNo","label":"单据编号","type":"string","describe":"单据编号","value":"FBillNo"},
{"field":"FDocumentStatus","label":"单据状态","type":"string","describe":"单据状态","value":"FDocumentStatus"},
{"field":"FStockOrgId_FNumber","label":"库存组织","type":"string","describe":"库存组织","value":"FStockOrgId.FNumber"},
{"field":"FDate","label":"日期","type":"string","describe":"日期","value":"FDate"},
{"field":"FBillTypeID","label":"单据类型","type":"string","describe":"单据类型","value":"FBillTypeID.FNumber"},
{"field":"FSUPPLIERID_FNumber","label":"供应商","type":"string","describe":"供应商","value":"FSUPPLIERID.FNumber"},
{"field":"FNOTE","label":"备注","type":""string,"describe":"","备注,"value":"","FNOTE},
{"field":"","FMATERIALID_FNumber,""label":"","物料编码,""type":"","string,""describe":"","物料编码,""value":"","FMATERIALID.FNumber},
{"field":"","FSTOCKID,""label":"","收货仓库,""type":"","string,""describe":"","收货仓库,""value":"","FSTOCKID.FNumber},
{"field":"","FQty,""label":"","实收数量,""type":"","string,""describe":"","实收数量,""value":"","FQty},
{"field":"","FPrice,""label":"","成本价,""type":"","string,""describe":"","成本价,""value":"","FPrice},
{"field":"","FAmount,""label":"","总成本,""type":"","string,""describe":"","总成本,""value":"","FAmount},
{"field":"","FBOMID,""label":"","BOM版本,""type":{"string},"describe":{"BOM版本},"value":{"FBOMID}},
{"field":{"FPRODUCEDATE},"label":{"生产日期},"type":{"string},"describe":{"生产日期},"value":{"FPRODUCEDATE}},
{"field":{"FEXPIRYDATE},"label":{"有效期至},"type":{"string},"describe":{"有效期至},"value":{"FEXPIRYDATE}},
{"field":{"FMTONO},"label":{"计划跟踪号},"type":{"string},"describe":{"计划跟踪号},"value":{"FMTONO}},
{"field":{"FProjectNo},"label":{"项目编号},"type":{"string},"describe":{"项目编号},"value":{"FProjectNo}},
{"field":{"FSTOCKSTATUSID},"label":{"库存状态},"type":{"string},"describe":{"库存状态},"value":{"FSTOCKSTATUSID}},
{"field":{"FOWNERID},"label":{"货主},"type={"string"},描述={"货主"},值={"货主"},值={"货主"},值={"货主"},值={"货主"},值={"货主"},值={"货主"},值={"货主"},
请求参数设置
在请求参数中,我们需要特别注意以下几个关键字段:
FormId
: 必须填写金蝶的表单ID,例如:STK_MISCELLANEOUS
。FieldKeys
: 查询字段集合,以逗号分隔,例如:FID, FBillNo, FDate
。FilterString
: 用于过滤查询结果的条件,例如:FSupplierId.FNumber = 'VEN00010' and FApproveDate>='2024-08-05 17:30:00' and FStockOrgId.FNumber='101' and FSTOCKID.F_TBIK_Assistant_qtr = '内部仓' and FBillTypeID.FNUMBER in ('QTRKD01_SYS') and FDate>='2024-08-05 17:30:00'
。
数据清洗与转换
在获取到原始数据后,需要进行清洗和转换,以便后续处理。以下是一个简单的数据清洗示例:
def clean_data(raw_data):
cleaned_data = []
for entry in raw_data:
cleaned_entry = {
'entry_id': entry['FID'],
'bill_no': entry['FBillNo'],
'date': entry['FDate'],
'supplier': entry['FSUPPLIERID_FNumber'],
'quantity': float(entry['FQty']),
'price': float(entry['FPrice']),
'total_cost': float(entry['FAmount'])
}
cleaned_data.append(cleaned_entry)
return cleaned_data
数据写入
最后,将清洗后的数据写入目标系统。在轻易云平台上,可以通过配置相应的写入操作来实现这一过程。以下是一个示例配置:
{
"targetSystem": "旺店通",
"operation": "内部仓入库",
"fieldsMapping": {
"entry_id": "entry_id",
"bill_no": "bill_no",
"date": "date",
"supplier": "supplier_code",
"quantity": "received_quantity",
"price": "unit_price",
"total_cost": "total_cost"
}
}
通过上述步骤,我们可以高效地从金蝶云星空获取并加工数据,并将其无缝集成到目标系统中。这一过程不仅提升了业务透明度,还极大地提高了数据处理效率。
使用轻易云数据集成平台进行ETL转换并写入旺店通·旗舰版API接口
在数据集成生命周期的第二步中,我们将重点探讨如何使用轻易云数据集成平台将已经集成的源平台数据进行ETL转换,并转为目标平台——旺店通·旗舰版API接口所能够接收的格式,最终写入目标平台。以下是具体的技术实现过程。
元数据配置解析
首先,我们需要理解元数据配置中的各个字段及其含义:
{
"api": "wms.stockin.Other.createOtherOrder",
"effect": "EXECUTE",
"method": "POST",
"idCheck": true,
"request": [
{"field": "outer_no", "label": "外部单号", "type": "string", "value": "{FBillNo}"},
{"field": "warehouse_no", "label": "仓库编号", "type": "string", "value": "{FSTOCKID}"},
{"field": "remark", "label": "表头备注", "type": "string", "value": "{FNOTE}"},
{"field": "is_check", "label": "是否审核", "type": "string", "value": "true"},
{"field": "reason", "label": "入库原因", "type": "string", "value": "{F_TBIK_RKLX}"},
{
"field": "goods_list",
"label": "明细",
"type": "array",
"value":"list",
...
}
],
...
}
api
: 指定了目标API接口wms.stockin.Other.createOtherOrder
。method
: HTTP请求方法,这里是POST
。idCheck
: 是否需要ID检查,设置为true
。request
: 包含了所有需要传递给API的字段信息。
数据映射与转换
在ETL过程中,我们需要将源系统的数据字段映射到目标系统所需的字段格式。以下是关键字段的映射关系:
outer_no
映射到{FBillNo}
,表示外部单号。warehouse_no
映射到{FSTOCKID}
,表示仓库编号。remark
映射到{FNOTE}
,表示表头备注。is_check
固定值为"true"
,表示是否审核。reason
映射到{F_TBIK_RKLX}
,表示入库原因。
对于数组类型字段 goods_list
,其子字段也需要进行相应的映射:
spec_no
映射到{FMATERIALID_FNumber}
,表示SKU。num
映射到{FQty}
,表示出库数量。remark
映射到{FEntryNote}
,表示明细备注。
数据聚合与计算
在元数据配置中,还包含了一个重要部分:数据聚合和计算规则:
"groupCalculate":{
...
,"calculate":{"FQty":"$sum"}
}
这里定义了对出库数量(FQty
)进行求和操作。通过这种方式,可以确保在转换过程中对同一单据中的多个明细项进行正确的数量汇总。
构建请求模型
根据元数据配置,我们可以构建出最终发送给旺店通·旗舰版API接口的请求模型:
{
...
,"buildModel" : true
}
这一步骤确保了我们根据上述映射关系和聚合规则生成正确的数据结构,以便顺利完成ETL转换并写入目标平台。
实际案例应用
假设我们有以下源系统的数据:
{
...
,"FBillNo" : ["ORD12345"]
,"FSTOCKID" : ["WH001"]
,"FNOTE" : ["This is a test order"]
,"F_TBIK_RKLX" : ["Restock"]
,"FMATERIALID_FNumber" : ["SKU12345"]
,"FQty" : [10]
,"FEntryNote" : ["First entry note"]
}
通过轻易云数据集成平台进行ETL转换后,将生成如下符合旺店通·旗舰版API要求的数据结构:
{
...
,"outer_no" : ["ORD12345"]
,"warehouse_no" : ["WH001"]
,"remark" : ["This is a test order"]
,"is_check" : ["true"]
,"reason" : ["Restock"]
,"goods_list" : [
{
...
,"spec_no" : ["SKU12345"]
,"num" : [10]
,"remark" : ["First entry note"]
}
]
}
通过上述步骤,我们成功地将源系统的数据进行了ETL转换,并生成了符合目标系统要求的数据格式。最终,通过HTTP POST请求将这些数据写入到了旺店通·旗舰版API接口,实现了不同系统间的数据无缝对接。