07 SRM系统访问金蝶云星空(WebApi集成方式):读取物料数据接口

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

接口定义

/// 查询
        /// 
        /// 
        public List ExecuteBillQuery(string data)
 
 

请求参数

{
    "FormId": "BD_MATERIAL",
    "FieldKeys": "FMaterialId,FNumber,FName,Fspecification,FErpClsID,FStockId.FNumber,FStockId.FName,FCreatorId.FName,FApproverId.FName,FModifyDate,FApproveDate,FDocumentStatus,FForbidStatus",
    "FilterString": "",
    "OrderString": "",
    "TopRowCount": 0,
    "StartRow": 0,
    "Limit": 0
}

返回结果

[["FValue1","FValue2",...],["FValue1","FValue2",...],...]

代码示例

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

 if (LoginByAppSecret())
            {
                var dataObj = new
                {
                    FormId = "BD_MATERIAL",//物料唯一标识
                    FieldKeys = GetFieldKeys(),//需查询的字段key集合,字符串类型,格式:"key1,key2,..."(必录) 注(查询单据体内码,需加单据体Key和下划线,如:FEntryKey_FEntryId)
                    FilterString = "FDocumentStatus='C'",//获取已经审核物料
                    OrderString = "",//排序
                    TopRowCount = 0,
                    StartRow = 0,
                    Limit = 0
                };
                var data = JsonConvert.SerializeObject(dataObj);
                var result = apiClient.ExecuteBillQuery(data);

                return JsonConvert.SerializeObject(result);
            }
            else
            {
                return "登录失败!";
            }
 /// 
        /// 需查询的字段key集合,字符串类型,格式:"key1,key2,..."(必录) 注(查询单据体内码,需加单据体Key和下划线,如:FEntryKey_FEntryId)
        /// 
        ///  
private string GetFieldKeys()
        {
           List fieldKeys = new List();
            fieldKeys.Add("FMaterialId");//物料内码
            fieldKeys.Add("FNumber");//物料编码
            fieldKeys.Add("FName");//物料名称
            fieldKeys.Add("Fspecification");//规格型号
            fieldKeys.Add("FErpClsID");//物料属性 1-外购 2-自制 3-委外加工  5-虚拟件
            fieldKeys.Add("FStockId.FNumber");//仓库编码
            fieldKeys.Add("FStockId.FName");//仓库名称
            fieldKeys.Add("FCreatorId.FName");//制单人
            fieldKeys.Add("FApproverId.FName");//审核人
            fieldKeys.Add("FModifyDate");//最后修改日期
            fieldKeys.Add("FApproveDate")//审核日期
            fieldKeys.Add("FDocumentStatus");//单据状态 A 创建, B 审核中,C  已审核 ,D 重新审核
            fieldKeys.Add("FForbidStatus");//禁用状态 A 否, B 否
            return string.Join(",", fieldKeys.ToArray());
        }

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

if (LoginByAppSecret())
            {
                HttpClient httpClient = new HttpClient();
                httpClient.Url = "http://localhost/k3cloud/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.ExecuteBillQuery.common.kdsvc";

                var dataObj = new
                {
                    FormId = "BD_MATERIAL",//物料唯一标识
                    FieldKeys = GetFieldKeys(),//需查询的字段key集合,字符串类型,格式:"key1,key2,..."(必录) 注(查询单据体内码,需加单据体Key和下划线,如:FEntryKey_FEntryId)
                    FilterString = "FDocumentStatus='C'",//获取已经审核物料
                    OrderString = "",//排序
                    TopRowCount = 0,
                    StartRow = 0,
                    Limit = 0
                };
              List parameters = new List();
                parameters.Add(dataObj);
                var data = JsonConvert.SerializeObject(parameters);
                httpClient.Content = data;

                var result = httpClient.AsyncRequest();

                return result;
            }
            else
            {
                return "登录失败!";
            }
 
 

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

你可能感兴趣的:(07 SRM系统访问金蝶云星空(WebApi集成方式):读取物料数据接口)