在应对以下场景时,我们需要在旺店通的采购入库传入金蝶时与之前的采购订单关联。

在配置入库单关联关系时必须要原始订单的 FID分录ID ,但是旺店通内的采购入库单我们只能够获取到外部订单号(outerno) 与 物料编码。此时我们可以从 采购订单同步方案_ 中去定位金蝶系统的原始 ID。

  1. _findCollection find FPOOrderEntry_FEntryId from 8e620793-bebb-3167-95a4-9030368e5262 where FBillNo={{outer_no}} FMaterialId_FNumber={{details_list.goods_no}}

语法释义

  1. _findCollection 必须作为开头的声明,并且使用一个空格作为后面语句的开始分隔
  2. find 作为第一个关键字声明需要查询定位的字段,后面使用一个空格作为分隔
  3. FPOOrderEntry_FEntryId 代表需要定位查询的字段,表头一般是 FID
  4. from 作为第二个关键字,声明需要从那个同步集线器查询。这里使用集线器的 ID
  5. where 关键字后面紧跟定位条件,可以有多个定位条件
  6. FBillNo={{outer_no}} 每个定位条件使用如下写法,中间不要有空格
  7. FMaterialIdFNumber={{details_list.goods_no}} 可以书写多个查询条件,他们都是 _and 关系,不需要另外增加 and 关键字但需要使用空格与上一个条件分隔开

⚠️ 务必留意语法中每一段的分割都必须是一个英文空格 ⚠️

自定义函数与联查嵌套

_function _findCollection 两个语句可以组合起来使用。
例如需求: 当查询到物料没启用保质期管理,则生产日期为空。

  1. _function
  2. case
  3. _findCollection find FIsKFPeriod
  4. from 66da8241-98f4-39f9-8fee-cac02e30e532
  5. where FNumber={{details.details_item_code}}
  6. _endFind
  7. when true then '{{details.details_detail_batch_validTime}}'
  8. else '' end

在case语句后面嵌套使用到了 _findCollection 语句,此时需要额外的 _endFind 对联查语句声明结束。

!!注意!! 以上示例代码为了方便演示,使用了换行符、TAB缩进。正常使用时不能出现这些符号。

_function case _findCollection find FIsKFPeriod from 66da8241-98f4-39f9-8fee-cac02e30e532 where FNumber={{details.details_item_code}} _endFind when true then '{{details.details_detail_batch_validTime}}' else '' end