69、WebApi,单据查询,接口原创
金蝶云社区-林荫大道cc身份
林荫大道cc
9人赞赏了该文章 9137次浏览 未经作者许可,禁止转载编辑于2021年06月22日 13:47:15
封面


 1、操作步骤 和 66.1 类似


2、拖一个按钮


3、修改按钮名字 查询


image.png


4、双击按钮进去,自动生成代码


5、复制代码到按钮


6、把Save 改成对应的操作 ExecuteBillQuery



  6.1、返回List类型,需要转换成List类型


image.png



6.2、


        //查询
        private void button11_Click(object sender, EventArgs e)
        {
            if (LogIn() == 1)
            {
                List<List<object>> test = new List<List<object>>();
                test = client.ExecuteBillQuery(this.textBox1.Text);
            }
            else
            {
                this.textBox2.Text = "登录失败";
            }
        }


image.png




6.3、断点调试


image.png


6.3.1、点启动,输入Json,点查询按钮


{
    "FormId": "PUR_PurchaseOrder",
    "FieldKeys": "FID,FBILLNO, FPOOrderEntry_FEntryId,FMaterialId,FMaterialName",
    "OrderString": "",
    "TopRowCount": 0,
    "StartRow": 0,
    "Limit": 0
}


6.3.2、test返回18行记录,每行里面包含5条记录,分别对应 


FID,FBILLNO, FPOOrderEntry_FEntryId,FMaterialId,FMaterialName


单据头内码,单据编号,单据体内码,物料内码,物料名称


image.png



6.4、List类型,返回类似报表界面,每一样也是List,需要使用for循环


        //查询
        private void button11_Click(object sender, EventArgs e)
        {
            if (LogIn() == 1)
            {
                List<List<object>> test = new List<List<object>>();
                test = client.ExecuteBillQuery(this.textBox1.Text);
                
                //定义一个字符串,空值
                string str = "";
                
                //取每行信息
                foreach(List<object> List in test)
                {
                    //取每个字段值
                    for(int i = 0; i < List.Count; i++)
                    {
                        //转换成字符串
                        str += Convert.ToString(List[i]) + "_";
                    }
                }
                this.textBox2.Text = str;
            }
            else
            {
                this.textBox2.Text = "登录失败";
            }


image.png


----------------------------------------------------

WebApi单据查询接口

1.     调用方法 client.ExecuteBillQuery

2.     Json格式

{
    "FormId": "",
    "FieldKeys": "",
    "FilterString": "",
    "OrderString": "",
    "TopRowCount": 0,
    "StartRow": 0,
    "Limit": 0
}

 

请求参数说明:


  1. data:JSON格式数据(详情参考JSON格式数据)(必录)


     1.1.FormId:业务对象表单Id(必录)


     1.2.FieldKeys:需查询的字段key集合,字符串类型,格式:"key1,key2,..." (必录) 

                             注(查询单据体内码,需加单据体Key和下划线,如:FEntryKey_FEntryId)


     1.3.FilterString:过滤条件,字符串类型(非必录)

     1.4.OrderString:排序字段,字符串类型(非必录)

     1.5.TopRowCount:返回总行数,整型(非必录)

     1.6.StartRow:开始行索引,整型(非必录)

     1.7.Limit:最大行数,整型,不能超过2000(非必录)



返回类型:


List<List<object>> test= new List<List<object>>();


--------------------------------------------------------------------------


7、下面操作步骤 和 66.2 类似


8、输入Json,点查询按钮

{
    "FormId": "PUR_PurchaseOrder",
    "FieldKeys": "FID,FBILLNO, FPOOrderEntry_FEntryId,FMaterialId,FMaterialName",
    "OrderString": "",
    "TopRowCount": 0,
    "StartRow": 0,
    "Limit": 0
}


image.png



9、在线测试WebApi


image.png


image.png


image.png


10、添加过滤条件


{
    "FormId": "PUR_PurchaseOrder",
    "FieldKeys": "FID,FBILLNO, FPOOrderEntry_FEntryId,FMaterialId,FMaterialName",
    "FilterString": "FBILLNO='CGDD000003' AND FMaterialName='001'",
    "OrderString": "",
    "TopRowCount": 0,
    "StartRow": 0,
    "Limit": 0
}



image.png


image.png


image.png

视频下载链接:

链接:https://pan.baidu.com/s/12eVCR7Z3RGVWCD-luvvrBw

提取码:KISS 


总目录链接

https://vip.kingdee.com/article/649938720145912

69.zip(286.13KB)

赞 9