常用查询接口说明
接口使用application/json数据方式进行传输
地址为ip:port/aciton/test?
一、查询设备接口
1、根据设备编号查询设备信息
- 参数列表:
1)cmd=query_eqpt
2)file文件名
3)type类型
4)eqpt_id 设备编码
{
"cmd": "query_eqpt",
"file": "tn_serv_busi_base_query",
"type":"eqpt_id",
"eqpt_id":"118"
}
- 返回值:
{
"code": "1",
"error": "",
"help": [
{
"eqpt_id": "118",
"eqpt_name": "004-06(加工中心)",
"eqpt_code": "004-06",
"eqpt_long_name": "加工中心",
"location_id": "37",
"location_name": "压铸车间",
"process_id": "",
"process_name": "",
"sub_company": "CM0502",
"company_shop_id": "37"
}
]
}
2、根据设备编码查询设备信息
- 参数列表:
1)cmd=query_eqpt
2)file文件名
3)type类型
4)eqpt_code 设备编码
{
"cmd": "query_eqpt",
"file": "tn_serv_busi_base_query",
"type":"eqpt_code",
"eqpt_code":"004-06"
}
- 返回值:
{
"code": "1",
"error": "",
"help": [
{
"eqpt_id": "118",
"eqpt_name": "004-06(加工中心)",
"eqpt_code": "004-06",
"eqpt_long_name": "加工中心",
"location_id": "37",
"location_name": "压铸车间",
"process_id": "",
"process_name": "",
"sub_company": "CM0502",
"company_shop_id": "37"
}
]
}
3、查询全部设备
方法一:
- 参数列表:
1)cmd=query_eqpt
2)file文件名
3)type类型
{
"cmd": "query_eqpt",
"file": "tn_serv_busi_base_query",
"type":"all"
}
- 返回值:
{
"code": "1",
"error": "",
"help": [
{
"eqpt_id": "118",
"eqpt_name": "004-06(加工中心)",
"eqpt_code": "004-06",
"eqpt_long_name": "加工中心",
"location_id": "37",
"location_name": "压铸车间",
"process_id": "",
"process_name": "",
"sub_company": "CM0502",
"company_shop_id": "37"
}
]
}
方法二:
- 参数列表:
1)cmd=query_eqpt_all
2)file文件名
{
"file": "tsdb_query_tech",
"cmd": "query_eqpt_all"
}
- 返回值:
{
"code": "1",
"error": "",
"help": [
{
"eqpt_id": "1061",
"eqpt_code": "PSJ-004",
"eqpt_name": "4#(抛丸机)"
},
{
"eqpt_id": "1062",
"eqpt_code": "PSJ-001",
"eqpt_name": "1#(抛丸机)"
},
{
"eqpt_id": "1063",
"eqpt_code": "PSJ-003",
"eqpt_name": "3#(抛丸机)"
}
]
}
4、查询当前设备的所有上级设备
- 参数列表:
1)cmd=query_eqpt_parent
2)file 文件名称
3)eqpt_id设备编号
{
"cmd": "query_eqpt_parent",
"file": "tn_serv_busi_base_query",
"eqpt_id":"1657"
}
- 返回值:
{
"code": "1",
"error": "",
"help": [
{
"location_id": "14",
"eqpt_id": "1657",
"eqpt_name": "IKD-1/PW-05(喷涂机器人)",
"eqpt_code": "IKD-1/PW-05",
"eqpt_long_name": "喷涂机器人",
"eqpt_type_code": "",
"parent_eqpt_id": "",
"process_id": "",
"process_name": ""
}
]
}
5、仅查询该设备的上一级设备
- 参数列表:
1)cmd=query_eqpt_parent_only_one
2)file文件名
3)eqpt_id设备编号
{
"cmd": "query_eqpt_parent_only_one",
"file": "tn_serv_busi_base_query",
"eqpt_id":"1657"
}
- 返回值:
{
"code": "1",
"error": "",
"help": [
{
"location_id": "14",
"eqpt_id": "1657",
"eqpt_name": "IKD-1/PW-05(喷涂机器人)",
"eqpt_code": "IKD-1/PW-05",
"eqpt_long_name": "喷涂机器人",
"eqpt_type_code": "",
"parent_eqpt_id": ""
}
]
}
6、查询该设备的所有下级设备
- 参数列表:
1)cmd=query_eqpt_sub
2)file文件名
3)eqpt_id设备编号
{
"cmd": "query_eqpt_sub",
"file": "tn_serv_busi_base_query",
"eqpt_id":"1657"
}
- 返回值:
{
"code": "1",
"error": "",
"help": [
{
"eqpt_name": "IKD-1/PW-05(喷涂机器人)",
"eqpt_id": "1657",
"parent_eqpt_id": "",
"is_forder": "0",
"pic_path": "/picture/common/tree/com_tree_folder.png",
"process_id": "",
"is_need_sub_wo_code": "0",
"location_id": "14",
"eqpt_code": "IKD-1/PW-05",
"eqpt_long_name": "喷涂机器人",
"eqpt_type_code": ""
}
]
}
二、查询地点接口
1、查询用户的地点权限
- 参数列表:
1)cmd=query_location_right
2)file文件名
3)user_id用户编号
{
"cmd": "query_location_right",
"file": "tn_serv_busi_base_query",
"user_id":"TN4332"
}
- 返回值:
{
"code": "1",
"error": "",
"help": []
}
注:未查询到为没有权限
2、查询用户工厂权限
- 参数列表:
1)cmd=query_sub_company_right
2)file文件名
3)user_id用户编号
{
"cmd": "query_sub_company_right",
"file": "tn_serv_busi_base_query",
"user_id":"TN4332"
}
- 返回值:
{
"code": "1",
"error": "",
"help": [
{
"location_code": "ikd00001",
"location_id": "0087"
},
{
"location_code": "ikd00002",
"location_id": "3"
},
{
"location_code": "ikd00004",
"location_id": "4"
},
{
"location_code": "ikd00006",
"location_id": "42"
},
{
"location_code": "ikd00005",
"location_id": "5"
},
{
"location_code": "ikd00003",
"location_id": "86"
}
]
}
3、查询该地点下的所有设备
- 参数列表:
1)cmd=query_loc_eqpt
2)file文件名
3)location_id 地点编号
{
"cmd": "query_loc_eqpt",
"file": "tn_serv_busi_base_query",
"location_id":"1132"
}
- 返回值:
{
"code": "1",
"error": "",
"help": [
{
"eqpt_id": "1189",
"eqpt_code": "111222",
"eqpt_name": "机加工设备1#",
"location_id": "1132",
"company_shop_id": "1001",
"sub_company": "",
"wh_id": "1047",
"eqpt_class_id": "1026",
"eqpt_type_id": "LX006",
"eqpt_short_name": "",
"eqpt_long_name": "",
"asset_id": "",
"made_by": "",
"power": "",
"manufacture_date": "2019-11-01 00:00:00",
"install_date": "2019-11-01 00:00:00",
"start_time": "2019-11-01 00:00:00",
"end_time": "2019-11-01 00:00:00",
"hardware_type": "",
"hardware_version": "",
"device_series_id": "",
"device_company_id": "",
"pic_path": "",
"check_stop_time": "",
"mt_work_time": "0",
"is_disable": "0",
"org_value": "",
"salvage_value": "",
"depred_value": "",
"dur_year": "",
"depr_type": "",
"use_type": "1",
"p_rate": "",
"alarm_time": "30",
"lng": "",
"lat": "",
"beat": "",
"eqpt_spec": "",
"tested_time": "1900-01-01 00:00:00",
"asset_lvl": "",
"asset_name": "",
"asset_code": "",
"use_sub_company": "",
"physical_state": "0",
"is_show_board": "0",
"max_mould_num": "1",
"max_person_num": "",
"remove_gather_id": "",
"is_real": "1",
"is_need_sub_wo_code": "0",
"remove_is_online": "0",
"remove_is_change_user": "0",
"process_id": "9184",
"dev_mn": "",
"model_id": "",
"cur_material_id": "",
"res1": "",
"res2": "",
"res3": "2019-11-01 00:00:00",
"res4": "",
"res5": "",
"res6": "",
"res7": "",
"res8": "",
"res9": "",
"res0": "",
"is_delete": "0",
"create_time": "2019-11-01 10:09:02",
"create_by": "1037",
"create_by_name": "sysadmin",
"modified_time": "2020-11-18 11:02:36",
"modified_by": "1037",
"modified_by_name": "sysadmin",
"container_code": "",
"oee_type": ""
}
]
}
注:未查询到为没有权限
4、查询用户有权限的设备列表,注意这个是根据归属地点找到设备
- 参数列表:
1)cmd=query_user_location_eqpt
2)file文件名
3)user_id用户编号
{
"cmd": "query_user_location_eqpt",
"file": "tn_serv_busi_base_query",
"user_id":"TN4332"
}
- 返回值:
{
"code": "1",
"error": "",
"help": [],
"location_id_all": "'-1'",
"location_id_right": "'-1'"
}
注:-1表示未查询到结果
5、查询全部工厂
- 参数列表:
1)cmd=query_sub_company
2)file文件名
{
"cmd": "query_sub_company",
"file": "tn_serv_busi_base_query"
}
- 返回值:
{
"code": "1",
"error": "",
"help": [
{
"location_code": "ikd99997",
"location_id": "0011",
"location_name": "测试"
},
{
"location_code": "ikd00001",
"location_id": "0087",
"location_name": "IKD-1#工厂"
},
{
"location_code": "rl-1",
"location_id": "10",
"location_name": "IKD-熔炼"
}
]
}
12、按照工厂查询车间
- 参数列表:
1)cmd=query_shop
2)file文件名
3)type类型
4)location_code地点编码
{
"cmd": "query_shop",
"file": "tn_serv_busi_base_query",
"type":"com",
"location_code":"0002"
}
- 返回值:
{
"code": "1",
"error": "",
"help": [
{
"location_code": "HL_LOC_JJ",
"location_id": "1132",
"location_name": "测试机加车间"
}
]
}
二、查询事件接口
1、查询选择的事件大类
- 参数列表:
1)cmd=select_fault_type
2)file文件名
{
"cmd": "select_fault_type",
"file": "pda_event_mgr",
}
- 返回值:
{
"code": "1",
"error": "",
"help": [
{
"fault_type_id": "EFT1",
"fault_type_code": "1",
"fault_type_name": "系统",
"parent_fault_type_id": ""
},
{
"fault_type_id": "EFT1004212",
"fault_type_code": "1004212",
"fault_type_name": "铝水供应异常",
"parent_fault_type_id": "EFT2"
},
{
"fault_type_id": "EFT11",
"fault_type_code": "11",
"fault_type_name": "自动生成",
"parent_fault_type_id": "EFT1"
}
]
}
2、根据类型查询事件
- 参数列表:
1)cmd=select_fault
2)file文件名
3)fault_type_id事件类型编号
{
"cmd": "select_fault",
"file": "pda_event_mgr",
"fault_type_id":"EFT307"
}
- 返回值:
{
"code": "1",
"error": "",
"help": [
{
"fault_id": "1004232",
"fault_code": "1004232",
"fault_name": "喷涂机器人",
"fault_type_id": "EFT307",
"process_id": "1000792",
"fault_level_id": ""
},
{
"fault_id": "1004233",
"fault_code": "1004233",
"fault_name": "真空泵",
"fault_type_id": "EFT307",
"process_id": "90000",
"fault_level_id": ""
}
]
}
三、系统参数查询
1、查询网关状态
- 参数列表:
1)cmd=query_status
2)dc_loc_ids 网关编号 WG001,WG002 多个设备中间使用,分隔。
{
"cmd": "query_status",
"file":"dc_query_loc_status",
"dc_loc_ids":"WG002"
}
- 返回值:
{
"code": "1",
"error": "",
"help": [
{
"dc_loc_id": "",
"ip": "",
"time": "",
"status": "在线",
"create_time": ""
}
],
"help_dev": []
}
2、历史数据查询
- 参数列表:
1)cmd=query_his_data
2)file 文件名
3)date_from 开始时间(必须),注意本接口只允许查询一天内的实时数据
时间格式形如 2020-07-21 12:01:02
4)var_id 变量id
5)limit 最大数据
6)offset 数据的起始位置,例如查询结果10000行,offset 1000代表从1000开始返回
7)desc 如果为1代表是倒序,最大的时间在最前面
{
"cmd": "query_his_data",
"file":"tsdb_query_tech",
"date_from": "2021-03-21 12:01:02",
"var_id": "1000",
"limit": "",
"offset": "1000",
"desc":"1"
}
- 返回值:
{
"code": "1",
"error": "",
"help": ""
}
3、查询最后的日志信息
- 参数列表:
1)cmd=last_log
2)lines需要查询的行数
{
"cmd": "get_last_log",
"file":"web_server_log",
"lines":"100"
}
- 返回值:
{
"code": "1",
"error": "",
"help": [
{
"line": "统计D:/tech_data/202103\\dc_db_20210331_9845.db 采集数120514 空间21999616 用时0.041s\r"
},
{
"line": "[2021-03-31 13:46:57] Sync eqpt statue to center DB,process update 2 rows,insert 0 rows \r"
},
{
"line": "统计D:/tech_data/202103\\dc_db_20210331_9845.db 采集数120342 空间21999616 用时0.076s\r"
},
{
"line": "[2021-03-31 13:45:57] Sync eqpt statue to center DB,process update 2 rows,insert 0 rows \r"
},
{
"line": "统计D:/tech_data/202103\\dc_db_20210331_9845.db 采集数120168 空间21921792 用时0.100s\r"
},
{
"line": "[2021-03-31 13:43:57] Sync eqpt statue to center DB,process update 2 rows,insert 0 rows \r"
},
{
"line": "统计D:/tech_data/202103\\dc_db_20210331_9845.db 采集数119994 空间21921792 用时0.065s\r"
},
{
"line": "统计D:/tech_data/202103\\dc_db_20210331_9845.db 采集数119823 空间21856256 用时0.043s\r"
},
{
"line": "[2021-03-31 13:41:57] Sync eqpt statue to center DB,process update 2 rows,insert 0 rows \r"
}
]
}