Dim client As DingTalk.Api.IDingTalkClient = New DingTalk.Api.DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/processinstance/create")
Dim request As DingTalk.Api.Request.OapiProcessinstanceCreateRequest = new DingTalk.Api.Request.OapiProcessinstanceCreateRequest()
request.AgentId = xxxxxxxx
request.ProcessCode = "PROC-5D736E2B-xxxx-xxx-B604-8247099BFA3D"
''' 审批流表单参数,设置各表单项值
Dim lst As List(Of DingTalk.Api.Request.OapiProcessinstanceCreateRequest.FormComponentValueVoDomain) = New List (Of DingTalk.Api.Request.OapiProcessinstanceCreateRequest.FormComponentValueVoDomain)()
Dim r As Row = Tables("销售主表").Current
If r IsNot Nothing Then
If r.IsNull("流程ID") Then
' 单行输入框|多行输入框
Dim vo1 As DingTalk.Api.Request.OapiProcessinstanceCreateRequest.FormComponentValueVoDomain = New DingTalk.Api.Request.OapiProcessinstanceCreateRequest.FormComponentValueVoDomain()
vo1.Name = "单据日期"
vo1.Value = r(vo1.Name)
Dim vo2 As DingTalk.Api.Request.OapiProcessinstanceCreateRequest.FormComponentValueVoDomain = New DingTalk.Api.Request.OapiProcessinstanceCreateRequest.FormComponentValueVoDomain()
vo2.Name = "单据号"
vo2.Value = r(vo2.Name)
Dim vo3 As DingTalk.Api.Request.OapiProcessinstanceCreateRequest.FormComponentValueVoDomain = New DingTalk.Api.Request.OapiProcessinstanceCreateRequest.FormComponentValueVoDomain()
vo3.Name = "客户名称"
vo3.Value = r(vo3.Name)
Dim vo4 As DingTalk.Api.Request.OapiProcessinstanceCreateRequest.FormComponentValueVoDomain = New DingTalk.Api.Request.OapiProcessinstanceCreateRequest.FormComponentValueVoDomain()
vo4.Name = "部门名称"
vo4.Value = r(vo4.Name)
Dim vo5 As DingTalk.Api.Request.OapiProcessinstanceCreateRequest.FormComponentValueVoDomain = New DingTalk.Api.Request.OapiProcessinstanceCreateRequest.FormComponentValueVoDomain()
vo5.Name = "用户名称"
vo5.Value = r(vo5.Name)
Dim drs As List(Of DataRow)
drs = r.DataRow.GetChildRows("销售子表")
For Each sr As DataRow In drs
Output.Show(sr("单据号"))
'明细包含控件
'明细-单行输入框|明细-多行输入框
Dim its1 As DingTalk.Api.Request.OapiProcessinstanceCreateRequest.FormComponentValueVoDomain = New DingTalk.Api.Request.OapiProcessinstanceCreateRequest.FormComponentValueVoDomain()
its1.Name = "明细-单据号"
its1.Value = sr("单据号")
'明细-单行输入框|明细-多行输入框
Dim its2 As DingTalk.Api.Request.OapiProcessinstanceCreateRequest.FormComponentValueVoDomain = New DingTalk.Api.Request.OapiProcessinstanceCreateRequest.FormComponentValueVoDomain()
its2.Name = "明细-品名"
its2.Value = sr("品名")
'明细-单行输入框|明细-多行输入框
Dim its3 As DingTalk.Api.Request.OapiProcessinstanceCreateRequest.FormComponentValueVoDomain = New DingTalk.Api.Request.OapiProcessinstanceCreateRequest.FormComponentValueVoDomain()
its3.Name = "明细-数量"
its3.Value = sr("数量")
'明细-单行输入框|明细-多行输入框
Dim its4 As DingTalk.Api.Request.OapiProcessinstanceCreateRequest.FormComponentValueVoDomain = New DingTalk.Api.Request.OapiProcessinstanceCreateRequest.FormComponentValueVoDomain()
its4.Name = "明细-单价"
its4.Value = sr("单价")
'明细-单行输入框|明细-多行输入框
Dim its5 As DingTalk.Api.Request.OapiProcessinstanceCreateRequest.FormComponentValueVoDomain = New DingTalk.Api.Request.OapiProcessinstanceCreateRequest.FormComponentValueVoDomain()
its5.Name = "明细-金额"
its5.Value = sr("金额")
Next
'// 明细
'OapiProcessinstanceCreateRequest.FormComponentValueVo vo4 = new OapiProcessinstanceCreateRequest.FormComponentValueVo();
'vo4.setName("明细示例");
'vo4.setValue(JSON.toJSONString(Arrays.asList(Arrays.asList(ItemName1, ItemName2, ItemName3))));
'' 明细
Dim vo10 As DingTalk.Api.Request.OapiProcessinstanceCreateRequest.FormComponentValueVoDomain = New DingTalk.Api.Request.OapiProcessinstanceCreateRequest.FormComponentValueVoDomain()
vo10.Name = "明细"
vo10.Value =
lst.add(vo1)
lst.add(vo2)
lst.add(vo3)
lst.add(vo4)
lst.add(vo5)
lst.Add(vo6)
'''
request.FormComponentValues_ = lst
request.OriginatorUserId = "0500181526219737" '必填
request.DeptId = 87654365 '必填
request.Approvers("userid1,userid2"); '选填
request.CcList ="userid1,userid2" '选填
request.CcPosition = "START_FINISH" '选填
Dim response As DingTalk.Api.Response.OapiProcessinstanceCreateResponse = client.execute(request,Functions.Execute("GetQYAccessToken"))
Output.Show(response.Body)
End If
End If
红色位置搞不定,求老师帮忙!
[此贴子已经被作者于2019/10/16 10:48:51编辑过]