历程

获取列表

获取已有历程项目列表

api:

http://127.0.0.1:6061/retainer/api

body:

{
    "action":"get_retainer_list"
}

curl:

curl -X POST --data '{"action":"get_retainer_list"}' http://127.0.0.1:6061/retainer/api

response:

{
    "resp": "get_retainer_list",
    "code": 200,
    "msg": "成功",
    "result": {
        "page_index": 1,
        "page_size": 10,
        "total_pages": 1,
        "total_records": 2,
        "data": [
            {
                "id": 1017,
                "uid": "RETAINER1515245014412",
                "name": "adasdad",
                "description": "adad",
                "objectlist": ["OBJ1572697700024","OBJ1632060900003"],
                "is_active": 0,
                "script": [],
                "created": "2021-05-31T17:27:52+08:00",
                "last_modified": "2021-06-21T18:28:31+08:00",
                "last_modified_by": 0,
                "is_available": 1,
                "category": "OTHER"
            },
            {
                "id": 1014,
                "uid": "RETAINER1484592500004",
                "name": "test",
                "description": "",
                "objectlist": [],
                "is_active": 0,
                "script": [
                    [
                        "RV1",
                        "running_stop1",
                        "设备启停1",
                        "1711",
                        "1710"
                    ]
                ],
                "created": "2021-04-08T17:18:45+08:00",
                "last_modified": "2021-04-09T12:08:36+08:00",
                "last_modified_by": 0,
                "is_available": 1,
                "category": "OTHER"
            }
        ]
    }
}

获取项目

获取已有历程项目基本信息

{
    "action":"get_retainer_item",
    "uid":"RETAINER1323077500001"
}

curl:

curl -X POST --data '{"action":"get_retainer_item","uid":"RETAINER1323077500001"}' http://127.0.0.1:6061/retainer/api

response:

{
    "resp": "get_retainer_item",
    "code": 200,
    "msg": "成功",
    "result": {
        "id": 1008,
        "uid": "RETAINER1323077500001",
        "name": "test111",
        "description": "666666",
        "is_active": 1,
        "script": [
            [
                "a2b",
                "a2b_en",
                "a2b_cn",
                "1001",
                "1002"
            ],
            [
                "b2c",
                "b2c_en",
                "b2c_cn",
                "1002",
                "1003"
            ]
        ],
        "created": "2021-03-12T15:54:30+08:00",
        "last_modified": "2021-03-12T15:55:42+08:00",
        "last_modified_by": 0,
        "is_available": 1,
        "category": "OTHER"
    }
}

创建项目

创建历程项目

api:

http://127.0.0.1:6061/retainer/api

body:

{
    "action":"create_retainer",
    "is_active":0,
    "description":"12164461",
    "name":"test",
    "script":[["a2b", "a2b_en", "a2b_cn", "1001", "1002"], ["b2c", "b2c_en", "b2c_cn", "1002", "1003"]],
    "object_list":["1001","1002"],
    "category":"FAULT"
}

curl:

curl -X POST --data '{"action":"create_retainer","is_active":0,"description":"12164461","name":"test","script":[["a2b","a2b_en","a2b_cn","1001","1002"],["b2c","b2c_en","b2c_cn","1002","1003"]],"object_list":["1001","1002"],"category":"FAULT"}' http://127.0.0.1:6061/retainer/api

response:

{
    "resp": "create_retainer",
    "code": 200,
    "msg": "成功",
    "result": {
        "uid": "RETAINER1622294400001"
    }
}

更新项目

更新已有历程项目

api:

http://127.0.0.1:6061/retainer/api

body:

{
    "action":"update_retainer",
    "uid":"RETAINER1622294400001",
    "description":"666666",
    "name":"test111",
    "script":[["a2b", "a2b_en", "a2b_cn", "1001", "1002"], ["b2c", "b2c_en", "b2c_cn", "1002", "1003"]],
    "object_list":["OBJ_TEST1001"],
    "category":"EVENT"
}

curl:

curl -X POST --data '{"action":"update_retainer","uid":"RETAINER1622294400001","description":"666666","name":"test111","script":[["a2b","a2b_en","a2b_cn","1001","1002"],["b2c","b2c_en","b2c_cn","1002","1003"]],"object_list":["OBJ_TEST1001"],"category":"EVENT"}' http://127.0.0.1:6061/retainer/api

response:

{
    "resp": "update_retainer",
    "code": 200,
    "msg": "成功"
}

删除项目

删除已有历程项目

api:

http://127.0.0.1:6061/retainer/api

body:

{
    "action":"delete_retainer",
    "uid":"RETAINER1622294400001"
}

curl:

curl -X POST --data '{"action":"delete_retainer","uid":"RETAINER1622294400001"}' http://127.0.0.1:6061/retainer/api

response:

{
    "resp": "delete_retainer",
    "code": 200,
    "msg": "成功"
}

启动项目

启动某已有历程项目

api:

http://127.0.0.1:6061/retainer/api

body:

{
    "action":"start_retainer",
    "uid":"RETAINER1323077500001"
}

curl:

curl -X POST --data '{"action":"create_retainer","uid":"RETAINER1323077500001"}' http://127.0.0.1:6061/retainer/api

response:

{
    "resp": "start_retainer",
    "code": 200,
    "msg": "成功"
}

停止项目

停止某以启动的历程项目

api:

http://127.0.0.1:6061/retainer/api

body:

{
    "action":"stop_retainer",
    "uid":"RETAINER1323077500001"
}

curl:

curl -X POST --data '{"action":"create_retainer","uid":"RETAINER1323077500001"}' http://127.0.0.1:6061/retainer/api

response:

{
    "resp": "stop_retainer",
    "code": 200,
    "msg": "成功"
}

数据接收

用于接收代理服务的订阅数据。可以直接调用,相当于发送一个需要处理的事件。

api:

http://127.0.0.1:6061/retainer/api

body:

{
    "action": "deal",
    "object_id": "OBJ_TEST1001",
    "code": "1001"
}

curl:

curl -X POST --data '{"action":"deal","object_id":"OBJ_TEST1001","code":"1001"}' http://127.0.0.1:6061/retainer/api

response:

{
    "resp": "deal",
    "code": 200,
    "msg": "成功",
    "result": {}
}

手动关闭

手动关闭一个历程。需要一个历程的对应属性,包括对象的 uid(object_id),历程统一编码(code),历程项目(template_id),以这三个属性查找出唯一的一个历程,然后进行关闭。

api:

http://127.0.0.1:6061/retainer/api

body:

{
    "action":"close",
    "object_id": "OBJ_TEST1001",
    "code": "a2b",
    "template_id":"RETAINER1323077500001"
}

curl:

curl -X POST --data '{"action":"close","object_id":"OBJ_TEST1001","code":"a2b","template_id":"RETAINER1323077500001"}' http://127.0.0.1:6061/retainer/api

response:

{
    "resp": "close",
    "code": 200,
    "msg": "成功",
    "result": {}
}

查看历程中的列表

查看正在进行中的历程列表。

api:

http://127.0.0.1:6061/retainer/api

body:

{
    "action": "get_open_retainer_list"
}

curl:

curl -X POST --data '{"action":"get_open_retainer_list"}' http://127.0.0.1:6061/retainer/api

response:

{
    "resp": "get_open_retainer_list",
    "code": 200,
    "msg": "成功",
    "result": [
        {
            "object_id": "OBJ_TEST1001",
            "template_id": "RETAINER1301582000028",
            "code": "RV1",
            "uid": "RETAINER1394463500002",
            "state": 1,
            "label_cn": "设备启停",
            "label_en": "start_stop",
            "opened_at": "2021-03-29T19:45:45+08:00",
            "elapsed": "2035h29m42.3032791s",
            "category":"EVENT"
        },
        {
            "object_id": "OBJ1471658000003",
            "template_id": "RETAINER1323077500001",
            "code": "a2b",
            "uid": "RETAINER1404579800003",
            "state": 1,
            "label_cn": "a2b_cn",
            "label_en": "a2b_en",
            "opened_at": "2021-04-20T11:44:46+08:00",
            "elapsed": "1515h30m41.3032791s",
            "category":"OTHER"
        }
    ]
}

查看历程中的子项

查看历程中的事件。

api:

http://127.0.0.1:6061/retainer/api

body:

{
    "action":"get_events_by_retainer",
    "retainer_id":"RETAINER1545897800001"
}

curl:

curl -X POST --data '{"action":"get_events_by_retainer","retainer_id":"RETAINER1545897800001"}' http://127.0.0.1:6061/retainer/api

response:

{
    "resp": "get_events_by_retainer",
    "code": 200,
    "msg": "成功",
    "result": [
        {
            "retainer_id": "RETAINER1545897800001",
            "uniqueid": "EVT1545844940597",
            "block": "mosaic",
            "code": "1003",
            "datetime": "2021-05-14 13:52:58.446213934",
            "event": "trigger_event",
            "label_en": "",
            "label_local": "开始加载",
            "object_id": "OBJ1393169400001",
            "terminal_id": "AX20200623002551",
            "value": "1",
            "status": 1
        },
        {
            "retainer_id": "RETAINER1545897800001",
            "uniqueid": "EVT1542874640677",
            "block": "mosaic",
            "code": "1001",
            "datetime": "2021-05-14 13:53:28.743695887",
            "event": "trigger_event",
            "label_en": "",
            "label_local": "设备启动",
            "object_id": "OBJ1393169400001",
            "terminal_id": "AX20200623002551",
            "value": "1",
            "status": 0
        }
    ]
}

查看附带子项的历程

查看历程中的事件。

api:

http://127.0.0.1:6061/retainer/api

body:

{
    "action":"get_retainer_with_events",
    "retainer_id":"RETAINERRESULT1815898900011"
}

curl:

curl -X POST --data '{"action":"get_retainer_with_events","retainer_id":"RETAINERRESULT1815898900011"}' http://127.0.0.1:6061/retainer/api

response:

{
    "resp": "get_retainer_with_events",
    "code": 200,
    "msg": "成功",
    "result": {
        "uid": "RETAINERRESULT1815898900011",
        "object_id": "OBJ1684490200006",
        "template_id": "RETAINER1641792400002",
        "code": "a2b",
        "label_en": "a2b_en",
        "label_cn": "a2b_cn",
        "retained": "1",
        "opened_at": "2021-08-11 19:18:59",
        "close_at": "",
        "elapsed": "",
        "category": "OTHER",
        "events": [
            {
                "retainer_id": "RETAINERRESULT1815898900011",
                "uniqueid": "PUB1815862727608",
                "block": "mosaic",
                "code": "1001",
                "datetime": "2021-08-11 19:18:58.625313328",
                "event": "trigger_event",
                "label_en": "start event",
                "label_local": "开始事件",
                "object_id": "OBJ1684490200006",
                "terminal_id": "DX202103300001",
                "value": {
                    "collect_volt": 22.31
                },
                "status": 1
            }
        ]
    }
}

获取服务信息列表

获取历程服务列表

api:

http://127.0.0.1:6061/retainer/api

body:

{
    "action":"get_service_list",
    "retainer_id":"111"
}

curl:

curl -X POST --data '{"action":"get_service_list","retainer_id":"111"}' http://127.0.0.1:6061/retainer/api

response:

{
    "resp": "get_service_list",
    "code": 200,
    "msg": "成功",
    "result": [
        {
            "Id": 6,
            "uid": "SERVICE1515721500001",
            "name": "test",
            "description": "aaa",
            "object_id": "111",
            "category": "test",
            "file": "test",
            "staff_id": 1,
            "staff_name": "test",
            "service_at": "2021-05-19T10:00:00+08:00",
            "source": "retainer",
            "source_id": "111",
            "created": "2021-05-21T14:21:56+08:00",
            "is_available": 1
        },
        {
            "Id": 7,
            "uid": "SERVICE1511602800001",
            "name": "test",
            "description": "aaa",
            "object_id": "111",
            "category": "test",
            "file": "test",
            "staff_id": 1,
            "staff_name": "test",
            "service_at": "2021-05-19T10:00:00+08:00",
            "source": "retainer",
            "retainer_id": "111",
            "created": "2021-05-21T14:25:15+08:00",
            "is_available": 1
        }
    ]
}

获取服务信息

获取历程服务信息

api:

http://127.0.0.1:6061/retainer/api

body:

{
    "action":"get_service_item",
    "uid":"SERVICE1511602800001"
}

curl:

curl -X POST --data '{"action":"get_service_item","uid":"SERVICE1511602800001"}' http://127.0.0.1:6061/retainer/api

response:

{
    "resp": "get_service_item",
    "code": 200,
    "msg": "成功",
    "result": {
        "Id": 7,
        "uid": "SERVICE1511602800001",
        "name": "test",
        "description": "aaa",
        "object_id": "111",
        "category": "test",
        "file": "test",
        "staff_id": 1,
        "staff_name": "test",
        "service_at": "2021-05-19T10:00:00+08:00",
        "source": "retainer",
        "source_id": "111",
        "created": "2021-05-21T14:25:15+08:00",
        "is_available": 1
    }
}

创建服务信息

创建新历程服务

api:

http://127.0.0.1:6061/retainer/api

body:

{
    "action":"create_service",
    "description":"aaa",
    "name":"test",
    "source":"retainer",
    "source_id":"111",
    "category":"test",
    "file":"test",
    "staff_id":1,
    "staff_name":"test",
    "service_at":"2021-05-19 10:00:00",
    "object_id":"111",
    "is_available":1
}

curl:

curl -X POST --data '{"action":"create_service","description":"aaa","name":"test","source":"retainer","source_id":"111","category":"test","file":"test","staff_id":1,"staff_name":"test","service_at":"2021-05-19 10:00:00","object_id":"111","is_available":1}' http://127.0.0.1:6061/retainer/api

response:

{
    "resp": "create_service",
    "code": 200,
    "msg": "成功",
    "result": {
        "uid": "SERVICE1624602900002"
    }
}

更新服务信息

更新历程服务

api:

http://127.0.0.1:6061/retainer/api

body:

{
    "action":"update_service",
    "uid":"SERVICE1624602900002",
    "description":"u12164461",
    "name":"utest",
    "object_id":"u111",
    "category":"utest",
    "file":"utest",
    "staff_id":1,
    "staff_name":"utest",
    "service_at":"2021-05-19 10:00:00",
    "source":"retainer",
    "source_id":"u111",
    "is_available":1
}

curl:

curl -X POST --data '{"action":"update_service","uid":"SERVICE1624602900002","description":"u12164461","name":"utest","object_id":"u111","category":"utest","file":"utest","staff_id":1,"staff_name":"utest","service_at":"2021-05-19 10:00:00","source":"retainer","source_id":"u111","is_available":1}' http://127.0.0.1:6061/retainer/api

response:

{
    "resp": "update_service",
    "code": 200,
    "msg": "成功"
}

删除服务信息

删除已有历程服务(需先停止服务)

api:

http://127.0.0.1:6061/retainer/api

body:

{
    "action":"delete_service",
    "uid":"SERVICE1624602900002"
}

curl:

curl -X POST --data '{"action":"delete_service","uid":"SERVICE1624602900002"}' http://127.0.0.1:6061/retainer/api

response:

{
    "resp": "delete_service",
    "code": 200,
    "msg": "成功"
}

外部生成历程记录

相同的object_id,code不会重复生成记录,label改变也不会影响。只有在object_id,code对应的记录关闭后才可以重新生成记录。

api:

http://127.0.0.1:6061/retainer/api

body:

{
    "action":"generate_retainer",
    "object_id":"111",
    "code":"222",
    "label_en":"4",
    "label_cn":"5"
}

curl:

curl -X POST --data '{"action":"generate_retainer","object_id":"111","code":"222","label_en":"4","label_cn":"5"}' http://127.0.0.1:6061/retainer/api

response:

{
    "resp": "generate_retainer",
    "code": 200,
    "msg": "成功",
    "result": {
        "uid": "RETAINER1763463600005"
    }
}

关闭历程记录

api:

http://127.0.0.1:6061/retainer/api

body:

{
    "action":"close_retainer",
    "uid":"RETAINER1763000200002"
}

curl:

curl -X POST --data '{"action":"close_retainer","uid":"RETAINER1763000200002"}' http://127.0.0.1:6061/retainer/api

response:

{
    "resp": "close_retainer",
    "code": 200,
    "msg": "成功",
    "result": {}
}

事件

历程开启事件

启动某历程项目

{
    "event": "retainer_open",
    "block": "retainer",
    "uniqueid": "REP4694582200022",
    "datetime": "2024-06-19 10:00:45",
    "uid": "RRS4694580700005",
    "object_id": "cdp_test",
    "object_name": "cdp_test(不删不更新)",
    "template_id": "RETAINER3714009000001",
    "code": "S03_cdp",
    "retained": "1",
    "label_en": "first(S03)",
    "label_local": "3缸缸温大于50",
    "opened_at": "2024-06-19 10:00:43",
    "value": {
        "S03": 60.3
    },
    "category": "ALERT"
}

历程关闭事件

关闭(停止)某历程项目

{
    "event": "retainer_close",
    "block": "retainer",
    "uniqueid": "REP4690810700876",
    "datetime": "2024-06-19 10:02:08",
    "uid": "RRS4690508200842",
    "object_id": "cdp_test",
    "object_name": "cdp_test(不删不更新)",
    "template_id": "RETAINER3714009000001",
    "code": "S06_cdp",
    "retained": "0",
    "label_en": "min(S06)",
    "label_local": "6缸缸温大于50",
    "opened_at": "2024-06-19 10:02:05",
    "value": {
        "S06": 48.74
    },
    "category": "ALERT",
    "elapsed": "3.012516372s",
    "elapsed_second": 3,
    "statis_expr": "min;S06",
    "statis_result": 50.33,
    "close_at": "2024-06-19 10:02:08"
}

历程持续事件

获取某历程项目持续事件

{
    "uid": "RRS4695704900759",
    "template_id": "RETAINER3714009000001",
    "category": "ALERT",
    "retainer_code": "S01_cdp",
    "uniqueid": "PUB4692639307048",
    "block": "retainer",
    "code": "2001",
    "datetime": "2024-06-19 10:03:26",
    "event": "retainer_event",
    "label_en": "",
    "label_local": "1缸缸温大于50",
    "object_id": "cdp_test",
    "object_name": "cdp_test(不删不更新)",
    "terminal_id": "cdp_test",
    "value": {
        "S00": 628422.56,
        "S01": 53.79,
        "S01$1": 53.79
    }
}

历程实时结果事件

获取某历程项目实时结果(事件)

{
    "event": "retainer_realtime_result",
    "block": "retainer",
    "uniqueid": "REP4692810303627",
    "datetime": "2024-06-19 10:06:28",
    "uid": "RRS4692708803614",
    "object_id": "cdp_test",
    "object_name": "cdp_test(不删不更新)",
    "template_id": "RETAINER3714009000001",
    "code": "S03_cdp",
    "retained": "0",
    "label_en": "first(S03)",
    "label_local": "3缸缸温大于50",
    "opened_at": "2024-06-19 10:06:27",
    "value": {
        "S03": 49.21
    },
    "category": "ALERT",
    "elapsed": "1.003961439s",
    "elapsed_second": null,
    "statis_expr": "first;S03",
    "statis_result": null
}
文档更新时间: 2024-08-09 12:20   作者:技术支持