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...
点击下载文档
本文2024-09-16 17:38:28发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-17003.html
您需要登录后才可以发表评论, 登录登录 或者 注册
最新文档
热门文章