WebAPI采购订单下推其中的一条分录或多条分录

栏目:云星空知识作者:金蝶来源:金蝶云社区发布:2024-09-16浏览:1

WebAPI采购订单下推其中的一条分录或多条分录

一,下推两笔为例。

1,查出EntryIds

{

    "FormId": "PUR_PurchaseOrder",

    "FieldKeys": "FPOOrderEntry_FEntryID",

    "FilterString": "FBillNo='PO24060412124'  and FMaterialId.Fnumber in ('S2022080089','S2022080092')",

    "OrderString": "",

    "TopRowCount": 0,

    "StartRow": 0,

    "Limit": 2000,

    "SubSystemId": ""

}

2,把查询到EntryIds传给下推"EntryIds"(注: "Ids"和 "Numbers"要为空

{

    "Ids": "",

    "Numbers": [],

    "EntryIds": "165152,167872",

    "RuleId": "PUR_PurchaseOrder-PUR_ReceiveBill",

    "TargetBillTypeId": "",

    "TargetOrgId":0,

    "TargetFormId": "PUR_ReceiveBill",

    "IsEnableDefaultRule": "false",

    "IsDraftWhenSaveFail": "false",

    "CustomParams": { }

}

二,springboot下推参考:

String keyn01 = "";
if (cxKeyn.getKeyn01() != null) {
   //料号
   keyn01 = cxKeyn.getKeyn01();
}

// Read configuration, initialize SDK
K3CloudApi client = new K3CloudApi();
//接口传值要求:订单编号,料号
//下推逻辑:1,整张下推直接传订单编号 ,2,单个下推直接做内码,不要传订单编号,如果传订单编号则整张下推。
//下推步骤:获取根据订单编号获取订单内码,根据内码下推
//1,查询内码
String jsonFEntryIDs = "{\n" +
       "    \"FormId\": \"PUR_PurchaseOrder\",\n" +
       "    \"FieldKeys\": \"FPOOrderEntry_FEntryID\",\n" +
       "    \"FilterString\": \"FBillNo='PO24060412124' and FMaterialId.Fnumber in ( 'S2022080089' ,'SC20231035' ) \",\n" +
       "    \"OrderString\": \"\",\n" +
       "    \"TopRowCount\": 0,\n" +
       "    \"StartRow\": 0,\n" +
       "    \"Limit\": 0,\n" +
       "    \"SubSystemId\": \"\"\n" +
       "}";
List<List<Object>> FEntryIDs = null;
try {
   FEntryIDs = client.executeBillQuery(jsonFEntryIDs);
} catch (Exception e) {
   e.printStackTrace(); // 记录详细的错误信息
   Map<String, Object> result = new HashMap<>();
   result.put("msg", "查询内码失败:" + e.getMessage());
   return result;
}
// 处理返回的内码
List<Object> entryIds = new ArrayList<>();
for (List<Object> item : FEntryIDs) {
   entryIds.addAll(item);
}


String  EntryIds = String.join(",", entryIds.stream().map(Object::toString).collect(Collectors.toList()));
System.out.println(EntryIds);

//2,下推参数
String formID = "PUR_PurchaseOrder";
String jsonData = "{\n" +
       "    \"Ids\": \"\",\n" +
       "    \"Numbers\": [],\n" +
       "    \"EntryIds\": \""+EntryIds+"\",\n" +
       "    \"RuleId\": \"PUR_PurchaseOrder-PUR_ReceiveBill\",\n" +
       "    \"TargetBillTypeId\": \"\",\n" +
       "    \"TargetOrgId\":0,\n" +
       "    \"TargetFormId\": \"PUR_ReceiveBill\",\n" +
       "    \"IsEnableDefaultRule\": \"false\",\n" +
       "    \"IsDraftWhenSaveFail\": \"false\",\n" +
       "    \"CustomParams\": { }\n" +
       "}";
Map<String, Object> result = new HashMap<>();
try {
   String ll = client.push(formID, jsonData);
   result.put("msg", ll);
} catch (Exception e) {
   result.put("msg", "操作失败:" + e.getMessage());
   e.printStackTrace(); // 记录详细的错误信息
}
System.out.println(result);
return result;


WebAPI采购订单下推其中的一条分录或多条分录

一,下推两笔为例。1,查出EntryIds{ "FormId": "PUR_PurchaseOrder", "FieldKeys": "FPOOrderEntry_FEntryID", "FilterSt...
点击下载文档
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息