二开案例.WebApi.单据查询.待办任务列表查询
【应用场景】
WebApi,查询待办任务列表。
【案例演示】
查询用户demo的所有待办任务。
【准备工作】
登录BOSIDE,打开待办任务对应的业务对象,如下图。
业务对象标识:WF_AssignmentBill
业务对象名称:信息中心_待办任务
主表名称:V_WF_ASSIGN
待办任务内码字段:FASSIGNID
demo用户内码:100008(SQL:SELECT FUSERID FROM T_SEC_USER WHERE FNAME=N'demo')
【实现步骤】
<1>登录业务站点,打开WebApi测试页,因为待办任务未开放测试,此处选择任意单据即可,例如采购订单,进行在线测试,定义好请求数据包,验证接口,如下图所示。
请求数据包:
{ "FormId": "WF_AssignmentBill", "FieldKeys": "FASSIGNID,FSENDERID.FName,FTitle,FContent,FPreResultName,FPreDisposition,FProcDefId.FDisplayName,FCreateTime", "FilterString": "FReceiverId=100008 AND FStatus=0", "OrderString": "FCreateTime DESC", "TopRowCount": 0, "StartRow": 0, "Limit": 2000, "SubSystemId": "" }
返回数据包:
[["630c57231424b8", "demo", "您有待办任务需要处理", "您有待办任务需要处理", null, null, "采购订单工作流", "2022-08-29T14:05:23.17"], ["607685c90b9187", "demo", "CGDD000483待处理", "您有待办任务需要处理", null, null, "采购订单工作流", "2021-04-14T14:03:50.433"], ["5e687b154ced96", "chy1", "(chy1)加签:您有待办任务需要处理", "您有待办任务需要处理", null, null, "出差申请单工作流", "2020-03-11T15:07:18.143"], ["5d96988a32e934", "yh2", "CGDD000429待处理", "您有待办任务需要处理", null, null, "采购订单工作流", "2019-10-04T10:11:03.12"], ["5d96988a32e924", "yh2", "CGDD000428待处理", "您有待办任务需要处理", null, null, "采购订单工作流", "2019-10-04T10:11:02.9"], ["5d96988832e914", "yh2", "CGDD000427待处理", "您有待办任务需要处理", null, null, "采购订单工作流", "2019-10-04T10:10:56.423"], ["5d8afca390efb7", "yh2", "客户 审批节点2 加签3", "客户 审批节点2 加签3", "审批同意", "审批同意(自动审批)", "客户 审批流 109.09", "2019-09-25T13:43:23.7"], ["5d762b94bf2bee", "yh2", "部门 三级审批 BM-109A", "部门 三级审批 BM-109A", "审批同意", " ", "部门 审批流109.09", "2019-09-09T19:52:41.07"], ["5d1aa3fba32fb7", "yh", "WHP20190702CGDD待处理", "您有待办任务需要处理", null, null, "采购订单工作流", "2019-07-02T09:34:52.283"], ["5a4b361a6b35fa", "bm", "预算调整单 终审节点 YSTZ000009", "预算调整单 终审节点 YSTZ000009", null, null, "预算调整单 审批流", "2018-01-02T16:26:24.63"]]
<2>在线验证通过后,即可参考请求数据包实现WebApi接口调用。
using Kingdee.BOS.WebApi.Client; using Microsoft.VisualStudio.TestTools.UnitTesting; using Newtonsoft.Json; using Newtonsoft.Json.Linq; namespace Jac.XkDemo.BOS.WebApiTests { /// <summary> /// WebApi.单据查询.待办任务列表查询 /// </summary> [TestClass] public class WFAssignmentBillExecuteBillQueryTest { [TestMethod] public void Test() { // 使用webapi引用组件Kingdee.BOS.WebApi.Client.dll var client = new K3CloudApiClient("http://localhost:1600/k3cloud/"); var loginResult = client.ValidateLogin("602f2c09aee85f", "demo", "888888", 2052); var resultType = JObject.Parse(loginResult)["LoginResultType"].Value<int>(); //登录结果类型等于1,代表登录成功 if (resultType == 1) { /* { "FormId": "WF_AssignmentBill", "FieldKeys": "FASSIGNID,FSENDERID.FName,FTitle,FContent,FPreResultName,FPreDisposition,FProcDefId.FDisplayName,FCreateTime", "FilterString": "FReceiverId=100008 AND FStatus=0", "OrderString": "FCreateTime DESC", "TopRowCount": 0, "StartRow": 0, "Limit": 2000, "SubSystemId": "" } */ var dataObj = new { FormId = "WF_AssignmentBill", FieldKeys = "FASSIGNID,FSENDERID.FName,FTitle,FContent,FPreResultName,FPreDisposition,FProcDefId.FDisplayName,FCreateTime", FilterString = "FReceiverId=100008 AND FStatus=0", OrderString = "FCreateTime DESC", TopRowCount = 0, StartRow = 0, Limit = 2000, SubSystemId = "" }; var data = JsonConvert.SerializeObject(dataObj); var queryDataList = client.ExecuteBillQuery(data); Assert.IsTrue(queryDataList != null); return; } Assert.IsFalse(true); } } }
---------------------------------------------------------------------------------------------------------
【更多示例】
也可以通过用户名查询,请求数据包格式如下图。
{ "FormId": "WF_AssignmentBill", "FieldKeys": "FASSIGNID,FSENDERID.FName,FTitle,FContent,FPreResultName,FPreDisposition,FProcDefId.FDisplayName,FCreateTime", "FilterString": "FReceiverId.FName=N'demo' AND FStatus=0", "OrderString": "FCreateTime DESC", "TopRowCount": 0, "StartRow": 0, "Limit": 2000, "SubSystemId": "" }
---------------------------------------------------------------------------------------------------------
【金蝶云星空BOS二次开发案例演示】https://vip.kingdee.com/article/94751030918525696
二开案例.WebApi.单据查询.待办任务列表查询
【应用场景】WebApi,查询待办任务列表。【案例演示】查询用户demo的所有待办任务。【准备工作】登录BOSIDE,打开待办任务对应的业务对象,...
点击下载文档
本文2024-09-23 04:00:58发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-162564.html
您需要登录后才可以发表评论, 登录登录 或者 注册
最新文档
热门文章