数仓外部

泰国数仓KPI功能接口说明文档

KPI首页相关接口 chen 2021.11.24 初稿
KPI首页相关接口v1.0.1 chen 2021.11.24 每个接口较大更新
chen 2021.11.30 二级页面,三级页面初稿

email:fuchang.chen@westwell-lab.com

一,KPI首页相关接口

1,请求时间段内KPI值

http GET http://serveraddr/kpi/tend

request

{
    "kpi_name":"CycleTime",
    "time": {
        "start_time":0,
        "end_time":0
    }
}
kpi_name str 可取值:
CycleTime:作业时长
StoppingTime:suspend时长
Mileage:里程
MoveBox:移动箱子数量
start_time int 开始时间(时间戳)
end_time int 结束时间(时间戳)

response

{    
       "result": {
        "kpi_name":"CycleTime",
        "value":1232, 
        "tend_persent": 12.1,
        "tend":1,
        "tend_value": 33
    },
    "err_code": 0,
    "err_info": ""
}
kpi_name str 取值:CycleTime、StoppingTime、Mileage、MoveBox
value int 结果值, 时间戳(CycleTime)int时间戳(StoppingTime),int(Mileage), int(MoveBox)
tend_persent float 增长百分比
tend int 增长趋势,取值 1, 0, -1
tend_value int 增长趋势变化值
err_code int 错误码,正常0,其他错误非0
err_info str 错误信息描述,正常为空

2,饼图Stopping Reason (Time Distribution)

http GET http://serveraddr/kpi/stopreason

request

{
    "kpi_name": "StoppingReason",
    "time": {
        "start_time": 0,
        "end_time": 0
    }
}
kpi_name str 可取值:StoppingReason, TimeDIstribute
start_time int 开始时间(时间戳)
end_time int 结束时间(时间戳)

response

{
    "kpi_name": "StoppingReason",
    "result":[
        {"name":"No path found", "":121 },
        {"name":"Obstacle", "value":212 },
        {"name":"Out of path", "value":311 }
    ],
    "err_code": 0,
    "err_info": ""
}
kpi_name str 饼图kpi类型StoppingReason,TimeDistribution
name str 类型
value int
err_code int 错误码,正常0,其他错误非0
err_info str 错误信息描述,正常为空

3,Mileage

http GET http://serveraddr/kpi/at

根据AT请求时间段内的KPI数据

move_box,speed

request

{
    "AT": [
        "AT01",
        "AT02"
    ],
    "time": {
        "start_time": 0,
        "end_time": 0
    }
}
start_time int 开始时间(时间戳)
end_time int 结束时间(时间戳)

response

{
    "result": [ 
         {"keyname": 'AT01', "move": 32, "speed": 7.0}, 
         {"keyname": 'AT02', "move": 40, "speed": 8.0}, 
         {"keyname": 'AT03', "move": 25, "speed": 5.2}, 
         {"keyname": 'AT04', "move": 20, "speed": 3.2}, 
         {"keyname": 'AT05', "move": 32, "speed": 7.0}
    ],
    "unit": {"move":"move", "speed":"km/h"}
    "err_code": 0,
    "err_info": ""
}
keyname str 车编号
move int 箱子数
speed float 车速度
unit str 单位
result 列表 结果
err_code int 错误码,正常0,其他错误非0
err_info str 错误信息描述,正常为空

二,二级页面

1,请求fliter

request

{
    "prj": ""
}
字段 是否必填 类型 描述
prj str 项目名

response

{
    "filter": {
        "Cycle Type":[],
        "Twin/Single":[],
        "Dual Move": [],
        "Optional Checkpoint": [],
        "QC": [],
        "RTGC":[]
    },
    "err_code": 0,
    "err_info": ""
}
字段 类型 描述
keyname str 车编号
move int 箱子数
speed float 车速度
unit str 单位
result 列表 结果
err_code int 错误码,正常0,其他错误非0
err_info str 错误信息描述,正常为空

2,卡片数据

fms或vehicle页卡片数据

POST http://serveraddr/total

request

{
    "filters": {
        "Cycle Type":[],
        "Twin/Single":[],
        "Dual Move": [],
        "Optional Checkpoint": [],
        "QC": [],
        "RTGC":[]
    },
    "time":{
            "start_time": 0,
            "end_time": 0
        },
    "Vessel": ["Vessel01","Vessel02"],
    "AT": "",
    "KPI_detial": "FMS"
}
字段 是否必填 类型 描述 可取值
filters - 过滤器 -
start_time int 开始时间 时间戳
end_time int 结束时间 时间戳
Vessel str 选择船舶 -
AT str 车辆选择 -
KPI_detial str 请求卡片数据类型 FMS,Vehicle

response

{
  "err_code": 0,
  "err_info": "",
  "result": [
    {
      "description": "Number of boxes completed per hour",
      "kpi_name": "Productivity",
      "tend": 1,
      "tend_persent": 13,
      "tend_value": 2,
      "value": 18
    },
    {
      "description": "",
      "kpi_name": "CycleTime",
      "tend": 1,
      "tend_persent": 12,
      "tend_value": 127,
      "value": 1200
    },
    {
      "description": "Time to complete moving a box",
      "kpi_name": "TurnaroundTime",
      "tend": -1,
      "tend_persent": 15,
      "tend_value": 109,
      "value": 1180
    },
    {
      "description": "Distance travelled, including forward and backward",
      "kpi_name": "Mileage",
      "tend": 1,
      "tend_persent": 7,
      "tend_value": 195,
      "value": 2854
    },
    {
      "description": "Number of boxes completed",
      "kpi_name": "MoveBox",
      "tend": 1,
      "tend_persent": 11,
      "tend_value": 25,
      "value": 138
    },
    {
      "description": "Ratio between the number of times waiting at TSL and total numbers of vessel discharging cycles ",
      "kpi_name": "TslUsage",
      "tend": -1,
      "tend_persent": 13,
      "tend_value": 1,
      "value": 5
    },
    {
      "description": "Ratio between the number of times waitg at TSD and total numbers of vessel loading cycles ",
      "kpi_name": "TsdUsage",
      "tend": -1,
      "tend_persent": 10,
      "tend_value": 2,
      "value": 30
    },
    {
      "description": "Ratio between the number of times waiting at EWA and total numbers of vessel discharging to FL cycles ",
      "kpi_name": "EwaUsage",
      "tend": -1,
      "tend_persent": 8,
      "tend_value": 3,
      "value": 25
    },
    {
      "description": "Ratio between the number of times waiting at LWA and total numbers of vessel loading cycles",
      "kpi_name": "LwaUsage",
      "tend": 1,
      "tend_persent": 13,
      "tend_value": 351,
      "value": 2561
    },
    {
      "description": "",
      "kpi_name": "Junction",
      "tend": -1,
      "tend_persent": 3,
      "tend_value": 3,
      "value": 20
    }
  ]
}
参数 参数名 类型 说明
err_code 错误码 Int 正常0,其他错误非0
err_info 错误信息 str 正常为空
description 描述含义 str -
kpi_name 卡片类型 str -
tend 增长趋势 Int 取值 1, 0, -1
tend_persent 增长百分比 Float -
tend_value 增长趋势变化值 Int -
value 当前值 Int 时间戳(CycleTime)int时间戳(StoppingTime),int(Mileage),int(MoveBox)

3,FMS类

http POST http://serveraddr/kpi/detial/fms

(1)Cycle Time

request

{
    "filters": {
        "Cycle Type":[],
        "Twin/Single":[],
        "Dual Move": [],
        "Optional Checkpoint": [],
        "QC": [],
        "RTGC":[]
    },
    "time":{
            "start_time": 0,
            "end_time": 0
        },
    "Vessel": ["Vessel01","Vessel02"],
    "AT": "",
    "KPI_detial": "Cycle Time"
}
字段 是否必填 类型 描述 可取值
filters - 过滤器 -
start_time int 开始时间 时间戳
end_time int 结束时间 时间戳
Vessel str 选择船舶 -
AT str 车辆选择 -
KPI_detial str 请求卡片数据类型 Cycle Time

response

{
    "KPI_detial": "Cycle Time",
    "result":[
        [{"Task": "Task 1", "Duration":"5:00"},{"Task": "Task 2", "Duration":"7:00"},{"Task": "Task 3", "Duration":"18:00"}],
        [{"Task": "Task 1", "Duration":"5:00"},{"Task": "Task 2", "Duration":"7:00"},{"Task": "Task 3", "Duration":"18:00"}]
    ],
    "err_code": 0,
    "err_info": ""
}
字段 类型 描述 可取值
KPI_detial str 对应的类型 Cycle Time
result - 对应的kpi结果 -
err_code int 错误码 -
err_info str 错误描述 -
(2)Productivity

request

{
    "filters": {
        "Cycle Type":[],
        "Twin/Single":[],
        "Dual Move": [],
        "Optional Checkpoint": [],
        "QC": [],
        "RTGC":[]
    },
    "time":{
            "start_time": 0,
            "end_time": 0
        },
    "Vessel": ["Vessel01","Vessel02"],
    "AT": "",
    "KPI_detial": "Productivity"
}
字段 是否必填 类型 描述 可取值
filters - 过滤器 -
start_time int 开始时间 时间戳
end_time int 结束时间 时间戳
Vessel str 选择船舶 -
AT str 车辆选择 -
KPI_detial str 请求卡片数据类型 Cycle Time

response

{    
    "KPI_detial": "Productivity",
    "result":[
        {
            "AT":"AT01",
            "data":[{"date": "Jun.01", "value":22},{"date": "Jun.02", "value":22},{"date": "Jun.03", "value":22}],
        },
        {
            "AT":"AT02",
            "data":[{"date": "Jun.01", "value":22},{"date": "Jun.02", "value":22},{"date": "Jun.03", "value":22}],
        },
        {
            "AT":"AT03",
            "data":[{"date": "Jun.01", "value":22},{"date": "Jun.02", "value":22},{"date": "Jun.03", "value":22}],
        }
    ],
    "err_code": 0,
    "err_info": ""
}
字段 类型 描述 可取值
KPI_detial str 对应的类型 Cycle Time
result - 对应的kpi结果 -
err_code int 错误码 -
err_info str 错误描述 -
(3)Turnaround Time

request

{
    "filters": {
        "Cycle Type":[],
        "Twin/Single":[],
        "Dual Move": [],
        "Optional Checkpoint": [],
        "QC": [],
        "RTGC":[]
    },
    "time":{
            "start_time": 0,
            "end_time": 0
        },
    "Vessel": ["Vessel01","Vessel02"],
    "AT": "",
    "KPI_detial": "Turnaround Time"
}
字段 是否必填 类型 描述 可取值
filters - 过滤器 -
start_time int 开始时间 时间戳
end_time int 结束时间 时间戳
Vessel str 选择船舶 -
AT str 车辆选择 -
KPI_detial str 请求卡片数据类型 Cycle Time

response

{    
    "KPI_detial": "Turnaround Time",
    "result":[
        {
            "AT":"AT01",
            "data":[{"date": "Jun.01", "value":22},{"date": "Jun.02", "value":22},{"date": "Jun.03", "value":22}],
        },
        {
            "AT":"AT02",
            "data":[{"date": "Jun.01", "value":22},{"date": "Jun.02", "value":22},{"date": "Jun.03", "value":22}],
        },
        {
            "AT":"AT03",
            "data":[{"date": "Jun.01", "value":22},{"date": "Jun.02", "value":22},{"date": "Jun.03", "value":22}],
        }
    ],
    "err_code": 0,
    "err_info": ""
}
字段 类型 描述 可取值
KPI_detial str 对应的类型 Cycle Time
result - 对应的kpi结果 -
err_code int 错误码 -
err_info str 错误描述 -
(4)Mileage

request

{
    "filters": {
        "Cycle Type":[],
        "Twin/Single":[],
        "Dual Move": [],
        "Optional Checkpoint": [],
        "QC": [],
        "RTGC":[]
    },
    "time":{
            "start_time": 0,
            "end_time": 0
        },
    "Vessel": ["Vessel01","Vessel02"],
    "AT": "",
    "KPI_detial": "Mileage"
}
字段 是否必填 类型 描述 可取值
filters - 过滤器 -
start_time int 开始时间 时间戳
end_time int 结束时间 时间戳
Vessel str 选择船舶 -
AT str 车辆选择 -
KPI_detial str 请求卡片数据类型 Cycle Time

response

{    
    "KPI_detial": "Mileage",
    "result":[
        [{"cycle_num":1,"empty_load":0.2, "heavy_load":0.8, "mileage":2444}],
        [{"cycle_num":2,"empty_load":0.2, "heavy_load":0.8, "mileage":2444}]
    ],
    "err_code": 0,
    "err_info": ""
}
字段 类型 描述 可取值
KPI_detial str 对应的类型 Cycle Time
result - 对应的kpi结果 -
err_code int 错误码 -
err_info str 错误描述 -
(5)Move Box

request

{
    "filters": {
        "Cycle Type":[],
        "Twin/Single":[],
        "Dual Move": [],
        "Optional Checkpoint": [],
        "QC": [],
        "RTGC":[]
    },
    "time":{
            "start_time": 0,
            "end_time": 0
        },
    "Vessel": ["Vessel01","Vessel02"],
    "AT": "",
    "KPI_detial": "move box"
}
字段 是否必填 类型 描述 可取值
filters - 过滤器 -
start_time int 开始时间 时间戳
end_time int 结束时间 时间戳
Vessel str 选择船舶 -
AT str 车辆选择 -
KPI_detial str 请求卡片数据类型 Cycle Time

response

{    
    "KPI_detial": "move box",
    "result":[
        {
            "AT":"AT01",
            "data":[{"date": "Jun.01", "value":22},{"date": "Jun.02", "value":22},{"date": "Jun.03", "value":22}],
        },
        {
            "AT":"AT02",
            "data":[{"date": "Jun.01", "value":22},{"date": "Jun.02", "value":22},{"date": "Jun.03", "value":22}],
        },
        {
            "AT":"AT03",
            "data":[{"date": "Jun.01", "value":22},{"date": "Jun.02", "value":22},{"date": "Jun.03", "value":22}],
        }
    ],
    "err_code": 0,
    "err_info": ""
}
字段 类型 描述 可取值
KPI_detial str 对应的类型 Cycle Time
result - 对应的kpi结果 -
err_code int 错误码 -
err_info str 错误描述 -
(6)TSL Usage,TSD Usage,EWA Usage,LWA Usage

request

{
    "filters": {
        "Cycle Type":[],
        "Twin/Single":[],
        "Dual Move": [],
        "Optional Checkpoint": [],
        "QC": [],
        "RTGC":[]
    },
    "time":{
            "start_time": 0,
            "end_time": 0
        },
    "Vessel": ["Vessel01","Vessel02"],
    "AT": "",
    "KPI_detial": "TSL Usage"
}
字段 是否必填 类型 描述 可取值
filters - 过滤器 -
start_time int 开始时间 时间戳
end_time int 结束时间 时间戳
Vessel str 选择船舶 -
AT str 车辆选择 -
KPI_detial str 请求卡片数据类型 Cycle Time

response

{    
    "KPI_detial": "TSL Usage",
    "result":{

    },
    "err_code": 0,
    "err_info": ""
}
字段 类型 描述 可取值
KPI_detial str 对应的类型 Cycle Time
result - 对应的kpi结果 -
err_code int 错误码 -
err_info str 错误描述 -
(7)Junction

request

{
    "filters": {
        "Cycle Type":[],
        "Twin/Single":[],
        "Dual Move": [],
        "Optional Checkpoint": [],
        "QC": [],
        "RTGC":[]
    },
    "time":{
            "start_time": 0,
            "end_time": 0
        },
    "Vessel": ["Vessel01","Vessel02"],
    "AT": "",
    "KPI_detial": "TSL Usage"
}
字段 是否必填 类型 描述 可取值
filters - 过滤器 -
start_time int 开始时间 时间戳
end_time int 结束时间 时间戳
Vessel str 选择船舶 -
AT str 车辆选择 -
KPI_detial str 请求卡片数据类型 Cycle Time

response

{    
    "KPI_detial": "Junction",
    "result":{
        "avg_time":[
            {"date": "Jun.01", "turning":221, "go_straight":122, "times":3},
            {"date": "Jun.01", "turning":221, "go_straight":122, "times":3}
        ],
        "number": [
            {"Junction_name": "KK11", "times":22},
            {"Junction_name": "KK11", "times":22}
        ],
    "err_code": 0,
    "err_info": ""
}
字段 类型 描述 可取值
KPI_detial str 对应的类型 Cycle Time
result - 对应的kpi结果 -
err_code int 错误码 -
err_info str 错误描述 -
(8)Stopping reason

request

{
    "filters": {
        "Cycle Type":[],
        "Twin/Single":[],
        "Dual Move": [],
        "Optional Checkpoint": [],
        "QC": [],
        "RTGC":[]
    },
    "time":{
            "start_time": 0,
            "end_time": 0
        },
    "Vessel": ["Vessel01","Vessel02"],
    "AT": "",
    "KPI_detial": "Stopping reason"
}
字段 是否必填 类型 描述 可取值
filters - 过滤器 -
start_time int 开始时间 时间戳
end_time int 结束时间 时间戳
Vessel str 选择船舶 -
AT str 车辆选择 -
KPI_detial str 请求卡片数据类型 Cycle Time

response

{    
    "KPI_detial": "Stopping reason",
    "result":[
        {"type":"No path found", "persent": 12.2, "mins_total":112, "turn_mins":2.3}
    ],
    "err_code": 0,
    "err_info": ""
}
字段 类型 描述 可取值
KPI_detial str 对应的类型 Cycle Time
result - 对应的kpi结果 -
err_code int 错误码 -
err_info str 错误描述 -

4,Vehicle类

http POST http://serveraddr/kpi/detial/vehicle

(1)Travelling speed,Battery Power,Fault Rate,MMBF,Recovery Time

request

{
    "filters": {
        "Cycle Type":[],
        "Twin/Single":[],
        "Dual Move": [],
        "Optional Checkpoint": [],
        "QC": [],
        "RTGC":[]
    },
    "time":{
            "start_time": 0,
            "end_time": 0
        },
    "Vessel": ["Vessel01","Vessel02"],
    "AT": "",
    "KPI_detial": "Travelling speed"
}
字段 是否必填 类型 描述 可取值
filters - 过滤器 -
start_time int 开始时间 时间戳
end_time int 结束时间 时间戳
Vessel str 选择船舶 -
AT str 车辆选择 -
KPI_detial str 请求卡片数据类型 Travelling speed,Battery Power,Fault Rate,MMBF,Recovery Time

response

{    
    "KPI_detial": "Travelling speed",
    "result":[
        {
            "AT":"AT01",
            "data":[{"date": "Jun.01", "value":22},{"date": "Jun.02", "value":22},{"date": "Jun.03", "value":22}],
        },
        {
            "AT":"AT02",
            "data":[{"date": "Jun.01", "value":22},{"date": "Jun.02", "value":22},{"date": "Jun.03", "value":22}],
        },
        {
            "AT":"AT03",
            "data":[{"date": "Jun.01", "value":22},{"date": "Jun.02", "value":22},{"date": "Jun.03", "value":22}],
        }
    ],
    "err_code": 0,
    "err_info": ""
}
字段 类型 描述 可取值
KPI_detial str 对应的类型 Cycle Time
result - 对应的kpi结果 -
err_code int 错误码 -
err_info str 错误描述 -
(2)Time Distribution

request

{
    "filters": {
        "Cycle Type":[],
        "Twin/Single":[],
        "Dual Move": [],
        "Optional Checkpoint": [],
        "QC": [],
        "RTGC":[]
    },
    "time":{
            "start_time": 0,
            "end_time": 0
        },
    "Vessel": ["Vessel01","Vessel02"],
    "AT": "",
    "KPI_detial": "Time Distribution"
}
字段 是否必填 类型 描述 可取值
filters - 过滤器 -
start_time int 开始时间 时间戳
end_time int 结束时间 时间戳
Vessel str 选择船舶 -
AT str 车辆选择 -
KPI_detial str 请求卡片数据类型 Cycle Time

response

{    
    "KPI_detial": "Time Distribution",
    "result":[
        {"time_type":"Off-Duty","percent":32},{"time_type":"Idle","percent":22}
    ],
    "err_code": 0,
    "err_info": ""
}
字段 类型 描述 可取值
KPI_detial str 对应的类型 Cycle Time
result - 对应的kpi结果 -
err_code int 错误码 -
err_info str 错误描述 -
(3)Running Hour,Mileage

request

{
    "filters": {
        "Cycle Type":[],
        "Twin/Single":[],
        "Dual Move": [],
        "Optional Checkpoint": [],
        "QC": [],
        "RTGC":[]
    },
    "time":{
            "start_time": 0,
            "end_time": 0
        },
    "Vessel": ["Vessel01","Vessel02"],
    "AT": "",
    "KPI_detial": "Running Hour"
}
字段 是否必填 类型 描述 可取值
filters - 过滤器 -
start_time int 开始时间 时间戳
end_time int 结束时间 时间戳
Vessel str 选择船舶 -
AT str 车辆选择 -
KPI_detial str 请求卡片数据类型 Cycle Time

response

{    
    "KPI_detial": "Running Hour",
    "result":[
        {"AT":"AT01","value":32},{"AT":"AT02","value":22}
    ],
    "err_code": 0,
    "err_info": ""
}
字段 类型 描述 可取值
KPI_detial str 对应的类型 Cycle Time
result - 对应的kpi结果 -
err_code int 错误码 -
err_info str 错误描述 -

三,三级页面

Cycle Time Breakdown

http POST http://serveraddr/cycletime/detial

request

{
    "filters": {
        "Cycle Type":[],
        "Twin/Single":[],
        "Dual Move": [],
        "Optional Checkpoint": [],
        "QC": [],
        "RTGC":[]
    },
    "time":{
            "start_time": 0,
            "end_time": 0
        },
    "Vessel": ["Vessel01","Vessel02"],
    "AT": "",
    "KPI_detial": "Running Hour",
    "page_num": 1,
    "page_size": 20
}
字段 是否必填 类型 描述 可取值
filters - 过滤器 -
start_time int 开始时间 时间戳
end_time int 结束时间 时间戳
Vessel str 选择船舶 -
AT str 车辆选择 -
KPI_detial str 请求卡片数据类型 Cycle Time
page_num int 分页查询第几页 >1
page_size int 分页查询页显示量 >1

response

{    
    "KPI_detial": "Running Hour",
    "result":[
        {"AT":"AT01","value":32},{"AT":"AT02","value":22}
    ],
    "total_page": 100,
    "err_code": 0,
    "err_info": ""
}
字段 类型 描述 可取值
KPI_detial str 对应的类型 Cycle Time
result - 对应的kpi结果 -
err_code int 错误码 -
err_info str 错误描述 -
total_page int 总页数 -

四,登录注册

五,权限管理