访问金蝶云星空(WebApi集成方式):读取BOM展开结果数据接口

返回根目录
SRM系统访问金蝶云星空(ERP)的接口定义及示例
MES系统访问金蝶云星空(ERP)的接口定义及示例

需求描述

根据产品编码的最新的BOM版本展开,获取展开结果

自定义接口定义:

//其中BLN.CY.ApiClient.K3Cloud.Stub是命名空间,BomExpandService是类名
BLN.CY.ApiClient.K3Cloud.Stub.BomExpandService.GetBomExpandResult(string data)

请求参数:

{
   "FItemNumber":"hy01";//产品编码
}

返回结果:

{
    "IsSuccess": true,
    "Message": "Bom展开成功",
    "ExpandResult": [{
        "FItemNumber": "hy01", //父项物料编码
        "FItemName": "hy01", //父项物料名称
        "FItemModel": " ", //父项规格型号
        "FLevel": 0, //父项物料所在层次,第0层为根节点
        "Numerator": 0.0,
        "Denominator": 0.0,
        "ParentEntryId": " ", //父项层次的EntryId,第0层为空字符串
        "EntryId": "f82819e5-1b6a-a225-11ea-5ffb5c2b8d00", //当前层次的EntryId
        "BomEntry": [{
            "FNumber": "hy02", //子项物料编码
            "FName": "hy02", //子项物料名称
            "FModel": " ", //子项规格型号
            "FLevel": 1, //子项物料所在层次
            "FQty": 1.0, //用量
            "numerator": 1.0000000000, //分子
            "denominator": 1.0000000000 //分母
            "ParentEntryId": "f82819e5-1b6a-a225-11ea-5ffb5c2b8d00", //父项层次的EntryId
            "EntryId": "f82819e5-1b6a-a225-11ea-5ffb678a503d" //当前层次的EntryId
        }]
    }, {
        "FItemNumber": "hy02",
        "FItemName": "hy02",
        "FItemModel": " ",
        "FLevel": 1,
        "Numerator": 1.0000000000,
        "Denominator": 1.0000000000,
        "ParentEntryId": "f82819e5-1b6a-a225-11ea-6003f0b176c3",
        "EntryId": "f82819e5-1b6a-a225-11ea-6003f0b176c4",
        "BomEntry": [{
            "FNumber": "hy03",
            "FName": "hy03",
            "FModel": " ",
            "FLevel": 2,
            "FQty": 1.0,
            "numerator": 1.0000000000,
            "denominator": 1.0000000000,
            "ParentEntryId": "f82819e5-1b6a-a225-11ea-6003f0b176c4",
            "EntryId": "f82819e5-1b6a-a225-11ea-6003f0b176c5"
        }]
    }]
}
返回结果调整为以下这种结构(按bom的层次呈现):
![bom展开结果](https://upload-images.jianshu.io/upload_images/16502971-8e7cb5af51f63356.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

代码示例:

1)SDK辅助类示例(引用Kingdee.BOS.WebAPI.Client.dll)
引用组件Kingdee.BOS.WebApi.Client.dll
下载链接: https://pan.baidu.com/s/1RthbrrtUgeqWGi-eLM-yjg
提取码: eqin

 if (LoginByAppSecret())
            {
               var param = new { FItemNumber= "hy01" };

                var result = apiClient.Execute("BLN.CY.ApiClient.K3Cloud.Stub.BomExpandService.GetBomExpandResult,BLN.CY.ApiClient.K3Cloud.Stub", new object[] { param });
                 return result;
            }
            else
            {
                return "登录失败!";
            }

2)无引用组件示例(不引用金蝶的组件):
http://ServerIp/K3Cloud/接口命名空间.接口实现类名.方法,组件名.common.kdsvc


  if (LoginByAppSecret())
            {
                HttpClient httpClient = new HttpClient();
                httpClient.Url = "http://localhost/k3cloud/BLN.CY.ApiClient.K3Cloud.Stub.BomExpandService.GetBomExpandResult,BLN.CY.ApiClient.K3Cloud.Stub.common.kdsvc";
                 var param = new { FItemNumber= "hy01" };

               List parameters = new List();
                parameters.Add(param );
                httpClient.Content = JsonConvert.SerializeObject(parameters);

                var result = httpClient.AsyncRequest();
                return result;
            }
            else
            {
                return "登录失败!";
            }
 
 

返回根目录
SRM系统访问金蝶云星空(ERP)的接口定义及示例
MES系统访问金蝶云星空(ERP)的接口定义及示例

你可能感兴趣的:(访问金蝶云星空(WebApi集成方式):读取BOM展开结果数据接口)