以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  回写钉钉审批流程明细控件  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=140640)

--  作者:linswcfr
--  发布时间:2019/9/10 15:13:00
--  回写钉钉审批流程明细控件
// 明细包含控件 // 明细-单行输入框 OapiProcessinstanceCreateRequest.FormComponentValueVo ItemName1 = new OapiProcessinstanceCreateRequest.FormComponentValueVo(); ItemName1.setName("明细-单行输入框示例"); ItemName1.setValue("明细-单行输入框value"); // 明细-多行输入框 OapiProcessinstanceCreateRequest.FormComponentValueVo ItemName2 = new OapiProcessinstanceCreateRequest.FormComponentValueVo(); ItemName2.setName("明细-多行输入框示例"); ItemName2.setValue("明细-多行输入框value"); // 明细-照片 OapiProcessinstanceCreateRequest.FormComponentValueVo ItemName3 = new OapiProcessinstanceCreateRequest.FormComponentValueVo(); ItemName3.setName("明细-图片示例"); ItemName3.setValue("[\\"http://xxxxx\\"]"); // 明细 OapiProcessinstanceCreateRequest.FormComponentValueVo vo4 = new OapiProcessinstanceCreateRequest.FormComponentValueVo(); vo4.setName("明细示例"); vo4.setValue(JSON.toJSONString(Arrays.asList(Arrays.asList(ItemName1, ItemName2, ItemName3))));
这个.net要怎么写
vo4.value = ?

--  作者:有点蓝
--  发布时间:2019/9/10 15:42:00
--  
没看懂,相关开发文档发上来看看
--  作者:linswcfr
--  发布时间:2019/9/10 15:44:00
--  
https://ding-doc.dingtalk.com/doc#/serverapi2/cmct1a
--  作者:有点蓝
--  发布时间:2019/9/10 15:50:00
--  
参考这里Http接口用法:http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&Id=139788

使用Foxtable的HttpClient即可

--  作者:linswcfr
--  发布时间:2019/9/10 15:59:00
--  
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编辑过]

--  作者:有点蓝
--  发布时间:2019/9/10 16:48:00
--  
Dim lst2 As List(Of DingTalk.Api.Request.OapiProcessinstanceCreateRequest.FormComponentValueVoDomain) = New List (Of DingTalk.Api.Request.OapiProcessinstanceCreateRequest.FormComponentValueVoDomain)()

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("单据号")
lst2.add(its1)
……
next

Dim vo10 As DingTalk.Api.Request.OapiProcessinstanceCreateRequest.FormComponentValueVoDomain = New DingTalk.Api.Request.OapiProcessinstanceCreateRequest.FormComponentValueVoDomain()
        vo10.Name = "明细"
        vo10.Value = FastJSON.JSON.ToJSON(lst2

--  作者:linswcfr
--  发布时间:2019/9/10 17:15:00
--  
{"errcode":820001,"errmsg":"发起审批实例失败,错误原因为【审批表单组件格式错误,组件名:明细】","request_id":"1079tgg0tz1f5"}



--  作者:linswcfr
--  发布时间:2019/9/10 17:19:00
--  
[{"$type":"DingTalk.Api.Request.OapiProcessinstanceCreateRequest+FormComponentValueVoDomain, TopSdk, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null","ExtValue":null,"Name":"明细-单据号","Value":"201909-003"},{"$type":"DingTalk.Api.Request.OapiProcessinstanceCreateRequest+FormComponentValueVoDomain, TopSdk, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null","ExtValue":null,"Name":"明细-单据号","Value":"201909-003"},{"$type":"DingTalk.Api.Request.OapiProcessinstanceCreateRequest+FormComponentValueVoDomain, TopSdk, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null","ExtValue":null,"Name":"明细-单据号","Value":"201909-003"}]
{"errcode":820001,"errmsg":"发起审批实例失败,错误原因为【审批表单组件格式错误,组件名:明细】","request_id":"47fm9hogwvmc"}

--  作者:有点蓝
--  发布时间:2019/9/10 17:26:00
--  
这种错误请自行查我文档错误码。

提示很明显了,没有“明细”这名称的组件

--  作者:linswcfr
--  发布时间:2019/9/10 17:31:00
--  
没有是这样提示        \'{"errcode":820001,"errmsg":"发起审批实例失败,错误原因为【找不到表单组件:找不到表单组件:单据日期A】","request_id":"7meia87xqpj3"}