-
编写自定义方法, 必须实现 必须实现接口weaver.interfaces.workflow.action方法public String execute(RequestInfo request);
1.1 编译为class 文件; -
将文件上传到服务器 D:\WEAVER\classbean\test\service\impl 目录;
-
在后台 集成中心-流程流转集成, 注册自定义接口;
3.1 接口动作类文件填写 classbean 下文件路径;
-
在后台 流程引擎-路径管理-路径设置, 找到对应流程,选中流程;
4.1. 在右侧 流转设置-节点信息, 点击对应节点的 节点前后附加操作按钮;
4.2 弹出窗口中, 选择 外部接口tab, 接口来源 选择 自定义创建的接口;
4.3 点击确定 保存;
- 更新步骤
5.1 更改原文件名称, 更新文件内容;
5.2 重新编译文件;
5.3 将编译后的class 后上传至服务器;
注意事项:
- 自定义Action必须实现接口weaver.interfaces.workflow.action方法public String execute(RequestInfo request)
- 自定义class 存放路径 D:\WEAVER\classbean\test\service\impl;
- 每次更新内容后需要重名java 后再编译;
自定义 Action Demo
package test.service.impl;
import kingdee.bos.webapi.client.K3CloudApiClient;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.*;
/**
* 在线自定义action接口
*/
public class TestAction_20200118_1 extends BaseBean implements Action {
public TestAction_20200118_1() {
}
@Override
public String execute(RequestInfo request) {
// 日志
Log log = LogFactory.getLog(this.getClass());
// 获取主表信息
Property[] properties = request.getMainTableInfo().getProperty();
for (int i = 0; i < properties.length; i++) {
String name = properties[i].getName();// 主字段名称
String value = Util.null2String(properties[i].getValue());// 主字段对应的值
System.out.println(name + " " + value);
log.info("获取单据体的信息:"+name + " " + value);
}
// 获取所有明细表
DetailTable[] detailtable = request.getDetailTableInfo().getDetailTable();
if (detailtable.length > 0) {
for (int i = 0; i < detailtable.length; i++) {
DetailTable dt = detailtable[i];// 指定明细表
Row[] s = dt.getRow();// 当前明细表的所有数据,按行存储
for (int j = 0; j < s.length; j++) {
Row r = s[j];// 指定行
Cell c[] = r.getCell();// 每行数据再按列存储
for (int k = 0; k < c.length; k++) {
Cell c1 = c[k];// 指定列
String name = c1.getName();// 明细字段名称
String value = c1.getValue();// 明细字段的值
System.out.println(name + " " + value);
}
}
}
}
// 调用ERP
String res = "";
Boolean loginResult = false;
K3CloudApiClient client = new K3CloudApiClient("http://119.23.43.165/k3cloud/");
try {
loginResult = client.login("612112883069f0","13450890349","密码",2052);
// 判断登录成功就调用ERP相应方法
if(loginResult) {
// 具体参数和调用方法参见 https://openapi.open.kingdee.com/ApiCenterDoc
res = client.view("BD_Currency","{\"CreateOrgId\":0,\"Number\":\"PRE001\"}");
}
} catch (Exception e) {
log.info("错误信息:" + e);
e.printStackTrace();
}
log.info("接口响应结果:" + res);
return SUCCESS;
}
// 调用ERP接口 单元测试代码
// public static void main(String[] args) {
// String res = "";
// Boolean loginResult = false;
// K3CloudApiClient client = new K3CloudApiClient("http://119.23.xx.xx/k3cloud/");
// try {
// loginResult = client.login("612112883069f0","134xxxx0349","JG20211110",2052);
// res = client.view("BD_Currency","{\"CreateOrgId\":0,\"Number\":\"PRE001\"}");
// } catch (Exception e) {
// e.printStackTrace();
// }
//
// System.out.println("test202201174_1" + client);
// System.out.println("test202201174_2" + loginResult);
// System.out.println(res.getClass().getSimpleName());
// System.out.println("test202201174_3" + res);
//
// }
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
ERP对接
云星空文档 https://openapi.open.kingdee.com/ApiCenterDoc
- 引入 K3CloudApiClient 包;
- 实例化 client;
- 执行登录动作;
- 判断登录经过为 true , 执行余下动作;
- 执行操作;
Demo
// 查看
client.View("BD_Account","{"CreateOrgId":0,"Number":"","Id":""}");
// 保存
client.Save("BD_Account","{"NeedUpDateFields":[],"NeedReturnFields")
// 审核
client.ExcuteOperation("BD_Account","Forbid","{"CreateOrgId":0,"Numbers":[],"Ids":"","PkEntryIds":[],"NetworkCtrl":""}");
// 反审
client.UnAudit("BD_Account","{"CreateOrgId":0,"Numbers":[],"Ids":"","InterationFlags":"","NetworkCtrl":"","IsVerifyProcInst":""}");
...
更多执行参见 金蝶云星空官方文档 https://openapi.open.kingdee.com/ApiCenterDoc
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
ERP webApi 测试