查询原材料的消耗情况记录
路径 | /industry/qualitytrace/materialconsumption/query |
版本号 | 1.0.0 |
协议 | HTTPS |
请求方法 | POST |
是否需要用户身份鉴权 | 否 |
超时时间 | 10000 |
请求参数
名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
search | String | 否 | 根据唯一码或者物料编码搜索 | |
destConsume | String | 否 | 根据目标唯一码查找 | |
startTime | String | 否 | "startTime":"2019-09-25 00:00:00" | 根据时间查找,startTime和endTime必须组合使用 |
endTime | String | 否 | "endTime":"2019-09-25 00:00:01" | 根据时间段查找物料消耗记录,startTime和endTime组合使用 |
uniqueCode | String | 否 | 根据唯一码查找物料消耗列表 | |
noDap | String | 否 | "noDap":"true" | 带noDap参数后,返回的数据中不会带工艺关键参数,主要是为了减少参数,提高调用效率,如果想要工艺关键参数,此参数不填。 |
appId | String | 否 | 应用id,saas的共享应用需要传这个值 | |
employeeId | String | 否 | 用户id,需要做用户级别鉴权时需要传入此参数 | |
pageid | Int | 否 | {"pageid":1} | 按页获取,指定目标页码 |
pageSize | Int | 否 | {"pageSize":1500} | 指定每页行数 |
corpId | String | 否 | 企业标识,每个企业拥有唯一的CorpID,比如钉钉corpID、LH里面的appId,用参数source来区分参数含义 | |
userId | String | 否 | 员工在当前企业内的唯一标识,比如钉钉userId或者IoT的employeeId | |
source | String | 否 | 参数来源,枚举值,钉钉填写DINGDING,多租户saas应用填SAAS,source、corpId、userId配合使用 |
返回数据
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
code | Int |
响应码, 200: 成功 |
|
message | String |
错误消息 |
|
localizedMsg | String |
本地语言错误消息 |
|
data | JSON |
响应结果 |
|
materials | JSON |
物料消耗列表详情 |
|
id | Long |
物料消耗记录id |
|
materialCode | String |
物料主数据编码 |
|
materialName | String |
物料主数据名称 |
|
uniqueCode | String |
唯一码 |
|
stepCode | String |
工艺步骤编码,租户维度唯一 |
|
stepName | String |
步骤名称 |
|
stepTree | String |
步骤树,根据 "工艺路径/工序/步骤" 的格式返回步骤的层级信息 |
|
assetNum | String |
生产设备 固定资产编号 |
|
assetName | String |
生产设备名称 |
|
startTime | String |
物料消耗开始时间 |
|
endTime | String |
物料消耗结束时间 |
|
outPut | Double |
物料消耗数量 |
|
destConsume | String |
物料消耗目标唯一码 |
|
createTime | String |
物料消耗记录创建时间 |
|
modifyTime | String |
物料消耗记录修改时间 |
|
dataId | Long |
物料消耗记录对应的工艺关键参数的主数据id |
|
dapId | Long |
物料消耗对应的主数据的数据记录id |
|
dapStr | String |
工艺关键参数的json string |
|
page | JSON |
查询结果的分页信息 |
|
pageid | Int |
查询结果所在的页号 |
|
pageSize | Int |
查询结果的页大小 |
|
total | Long |
总的数据量 |
示例
请求示例
// https://github.com/aliyun/iotx-api-gateway-client
IoTApiClientBuilderParams ioTApiClientBuilderParams = new IoTApiClientBuilderParams();
ioTApiClientBuilderParams.setAppKey("你的<AppKey>");
ioTApiClientBuilderParams.setAppSecret("你的<AppSecret>");
SyncApiClient syncApiClient = new SyncApiClient(ioTApiClientBuilderParams);
IoTApiRequest request = new IoTApiRequest();
// 设置请求ID
String uuid = UUID.randomUUID().toString();
String id = uuid.replace("-", "");
request.setId(id);
// 设置API版本号
request.setApiVer("1.0.0");
// 设置参数
request.putParam("search", "value0");
request.putParam("destConsume", value1");
request.putParam("startTime", value2");
request.putParam("endTime", value3");
request.putParam("uniqueCode", value4");
request.putParam("noDap", value5");
request.putParam("appId", value6");
request.putParam("employeeId", value7");
request.putParam("pageid", value8");
request.putParam("pageSize", value9");
request.putParam("corpId", value10");
request.putParam("userId", value11");
request.putParam("source", value12");
// 如果需要,设置headers
Map<String, String> headers = new HashMap<String, String>(8);
// headers.put("你的<header", "你的<value>");
// 设置请求参数域名, path, request, isHttps, headers
ApiResponse response = syncApiClient.postBody("api.link.aliyun.com", "/industry/qualitytrace/materialconsumption/query", request, true, headers);
System.out.println(
"response code = " + response.getCode()
+ " response = " + new String(response.getBody(), "UTF-8")
+ " headers = " + response.getHeaders().toString()
);
正常返回示例
JSON
格式
{
"id": "4de2c367-c1db-417c-aa15-8c585e595d92",
"code": 200,
"message": "success",
"localizedMsg": null,
"data": {
"materials": [
{
"id": 48,
"materialCode": "01-软-一只猫",
"materialName": null,
"uniqueCode": "20190926",
"stepCode": "BBB",
"stepName": "BBB",
"stepTree": "工艺路径001/工序002/BBB",
"assetNum": null,
"assetName": null,
"startTime": "2019-09-18 00:00:00",
"endTime": "2019-09-18 00:00:00",
"outPut": 1,
"dataId": 1405,
"dapId": 1,
"destConsume": null,
"createTime": "2019-09-26 20:42:00",
"modifyTime": "2019-09-26 20:42:00",
"dapStr": "{\"data\":[[\"4\",\"\",\"\",\"\",\"\",1,\"已发布\",0,\"2019/09/19 15:40:22\"]],\"extra\":{\"headers\":{\"A3\":\"字符串\",\"A2\":\"枚举\",\"A4\":\"浮点型\",\"A5\":\"日期1\",\"A6\":\"布尔\",\"dap_id_\":\"\",\"dap_status_\":\"状态\",\"dap_refcnt_\":\"\",\"dap_row_version_\":\"版本号\",\"dap_gmt_created_\":\"\"}},\"nodes\":[\"A3\",\"A2\",\"A4\",\"A5\",\"A6\",\"dap_id_\",\"dap_status_\",\"dap_refcnt_\",\"dap_gmt_created_\"],\"page\":{\"size\":1500,\"to\":1,\"total\":1}}"
}
],
"page": {
"pageid": 1,
"pageSize": 15,
"total": 1
}
},
"success": true
}
异常返回示例
JSON
格式
{
"id": "37f7e5fa-d6a5-4efe-8abf-5bf23dca6284",
"code": 403,
"message": "request forbidden.",
"localizedMsg": "请求被禁止",
"data": null
}
错误码
HttpCode | 错误码 | 错误信息 | 描述 |
---|---|---|---|
500 | 500 | Internal Error | Internal Error |
503 | 503 | Service Unavailable | Service Unavailable |
403 | 403 | Request Limited | Request Limited |
401 | 401 | Empty Signature | Empty Signature |
400 | 400 | Request Format Error | Request Format Error |
200 | 20003 | Find Backend Error | Find Backend Error |
200 | 20004 | Backend Service Error | Backend Service Error |
200 | 20055 | Backend Service Invalid | Request Format Error |
200 | 20056 | Hsf Invoke Timeout | Hsf Invoke Timeout |
200 | 401 | Request Authorized Error | Request Authorized Error |
200 | 403 | Request Forbidden | Request Forbidden |
200 | 500 | Server Error | Server Error |
200 | 403 | request forbidden. | 请求被禁止 |
200 | 460 | request parameter error. | 请求参数错误 |
200 | 500 | server error. | 系统错误 |
200 | 403 | request forbidden. | 请求被禁止 |
200 | 460 | request parameter error. | 请求参数错误 |
200 | 500 | server error. | 系统错误 |
200 | 403 | request forbidden. | 请求被禁止 |
200 | 460 | request parameter error. | 请求参数错误 |
200 | 500 | server error. | 系统错误 |
200 | 403 | request forbidden. | 请求被禁止 |
200 | 460 | request parameter error. | 请求参数错误 |
200 | 500 | server error. | 系统错误 |
200 | 460 | request parameter error. | 请求参数错误 |
200 | 500 | server error. | 系统错误 |
200 | 403 | request forbidden. | 请求被禁止 |
200 | 403 | request forbidden. | 请求被禁止 |
200 | 500 | server error. | 系统错误 |
200 | 460 | request parameter error. | 请求参数错误 |
200 | 403 | request forbidden. | 请求被禁止 |
200 | 460 | request parameter error. | 请求参数错误 |
200 | 500 | server error. | 系统错误 |
200 | 403 | request forbidden. | 请求被禁止 |
200 | 460 | request parameter error. | 请求参数错误 |
200 | 500 | server error. | 系统错误 |
200 | 500 | server error. | 系统错误 |
200 | 460 | request parameter error. | 请求参数错误 |
200 | 460 | request forbidden | 请求被禁止 |
200 | 22000 | Query Result is Empty | 查询结果为空 |
200 | 460 | request parameter error. | 请求参数错误 |
200 | 500 | server error. | 服务错误 |
200 | 403 | request forbidden. | 请求被禁止 |
200 | 500 | server error. | 系统错误 |
200 | 460 | request parameter error. | 请求参数错误 |
200 | 403 | request forbidden. | 请求被禁止 |
200 | 460 | request parameter error. | 请求参数错误 |
200 | 500 | server error. | 系统错误 |
200 | 460 | request parameter error. | 请求参数错误 |
200 | 500 | server error. | 系统错误 |
200 | 460 | request parameter error. | 请求参数错误 |
200 | 500 | server error. | 系统错误 |
200 | 460 | request parameter error. | 请求参数错误 |
200 | 500 | server error. | 系统错误 |
200 | 403 | request forbidden. | 请求被禁止 |