@cpzxrobot/sdk 1.2.11 → 1.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,55 +6,96 @@ class RobotGateway extends Object {
6
6
  super();
7
7
  this.context = context;
8
8
  }
9
- async cage(unitId) {
10
- ///api/v2/robot/getCageList/{unitId}
11
- var axios = await this.context.ready;
12
- return axios.get(`/api/v2/robot/getCageList/${unitId}`);
9
+ get alarm() {
10
+ return {
11
+ list: (unitId) => {
12
+ return this.context.ready.then(axios => axios.get(`/api/v2/robot/alarm/list/${unitId}`));
13
+ }
14
+ };
13
15
  }
14
- async alarm(unitId) {
15
- ///api/v2/robot/getAlarmList/{unitId}
16
- var axios = await this.context.ready;
17
- return axios.get(`/api/v2/robot/getAlarmList/${unitId}`);
16
+ get task() {
17
+ return {
18
+ list: (unitId) => {
19
+ return this.context.ready.then(axios => axios.get(`/api/v2/robot/inspectTask/list/${unitId}`));
20
+ },
21
+ add: (data) => {
22
+ return this.context.ready.then(axios => axios.post('/api/v2/robot/inspectTask/add', data));
23
+ },
24
+ update: (data) => {
25
+ return this.context.ready.then(axios => axios.post('/api/v2/robot/inspectTask/update', data));
26
+ },
27
+ delete: (id) => {
28
+ return this.context.ready.then(axios => axios.post(`/api/v2/robot/inspectTask/delete/${id}`));
29
+ },
30
+ dispatch: (taskId) => {
31
+ return this.context.ready.then(axios => axios.post(`/api/v2/robot/inspectTask/dispatch/${taskId}`));
32
+ }
33
+ };
18
34
  }
19
- // 获取任务列表
20
- async getInspectTaskList(unitId) {
21
- var axios = await this.context.ready;
22
- return axios.get(`/api/v2/robot/inspectTask/list/${unitId}`);
35
+ get record() {
36
+ return {
37
+ list: (taskId) => {
38
+ return this.context.ready.then(axios => axios.get(`/api/v2/robot/inspectRecord/list/${taskId}`));
39
+ }
40
+ };
23
41
  }
24
- // 获取任务详情
25
- async getInspectTaskDetail(id) {
26
- var axios = await this.context.ready;
27
- return axios.get(`/api/v2/robot/inspectTask/${id}`);
42
+ get cage() {
43
+ return {
44
+ list: (unitId) => {
45
+ return this.context.ready.then(axios => axios.get(`/api/v2/robot/cage/list/${unitId}`));
46
+ },
47
+ addList: (data) => {
48
+ return this.context.ready.then(axios => axios.post('/api/v2/robot/cage/addList', data));
49
+ },
50
+ updateList: (data) => {
51
+ return this.context.ready.then(axios => axios.post('/api/v2/robot/cage/updateList', data));
52
+ },
53
+ update: (data) => {
54
+ return this.context.ready.then(axios => axios.post('/api/v2/robot/cage/update', data));
55
+ },
56
+ delete: (id) => {
57
+ return this.context.ready.then(axios => axios.post(`/api/v2/robot/cage/delete/${id}`));
58
+ },
59
+ deleteList: (unitId) => {
60
+ return this.context.ready.then(axios => axios.post(`/api/v2/robot/cage/deleteList/${unitId}`));
61
+ }
62
+ };
28
63
  }
29
- // 新增任务
30
- async addInspectTask(data) {
31
- var axios = await this.context.ready;
32
- return axios.post('/api/v2/robot/inspectTask/add', data);
33
- }
34
- // 修改任务
35
- async updateInspectTask(data) {
36
- var axios = await this.context.ready;
37
- return axios.post('/api/v2/robot/inspectTask/update', data);
38
- }
39
- // 删除任务
40
- async deleteInspectTask(id) {
41
- var axios = await this.context.ready;
42
- return axios.get(`/api/v2/robot/inspectTask/delete/${id}`);
43
- }
44
- // 获取未下发任务列表
45
- async getNotAssignedInspectTaskList() {
46
- var axios = await this.context.ready;
47
- return axios.get('/api/v2/robot/inspectTask/notAssignedList');
48
- }
49
- // 下发任务
50
- async assignInspectTask(taskId) {
51
- var axios = await this.context.ready;
52
- return axios.get(`/api/v2/robot/inspectTask/assign/${taskId}`);
53
- }
54
- // 获取巡检结果
55
- async getInspectRecordList(taskId) {
56
- var axios = await this.context.ready;
57
- return axios.get(`/api/v2/robot/inspectRecord/list/${taskId}`);
64
+ get path() {
65
+ return {
66
+ list: (unitId) => {
67
+ return this.context.ready.then(axios => axios.get(`/api/v2/robot/inspectPath/list/${unitId}`));
68
+ },
69
+ add: (data) => {
70
+ return this.context.ready.then(axios => axios.post('/api/v2/robot/inspectPath/add', data));
71
+ },
72
+ update: (data) => {
73
+ return this.context.ready.then(axios => axios.post('/api/v2/robot/inspectPath/update', data));
74
+ },
75
+ delete: (data) => {
76
+ return this.context.ready.then(axios => axios.post('/api/v2/robot/inspectPath/delete', data));
77
+ },
78
+ point: {
79
+ list: (pathId) => {
80
+ return this.context.ready.then(axios => axios.get(`/api/v2/robot/inspectPathPoint/list/${pathId}`));
81
+ },
82
+ addList: (data) => {
83
+ return this.context.ready.then(axios => axios.post('/api/v2/robot/inspectPathPoint/addList', data));
84
+ },
85
+ updateList: (data) => {
86
+ return this.context.ready.then(axios => axios.post('/api/v2/robot/inspectPathPoint/updateList', data));
87
+ },
88
+ update: (data) => {
89
+ return this.context.ready.then(axios => axios.post('/api/v2/robot/inspectPathPoint/update', data));
90
+ },
91
+ delete: (id) => {
92
+ return this.context.ready.then(axios => axios.post(`/api/v2/robot/inspectPathPoint/delete/${id}`));
93
+ },
94
+ deleteList: (pathId) => {
95
+ return this.context.ready.then(axios => axios.post(`/api/v2/robot/inspectPathPoint/deleteList/${pathId}`));
96
+ }
97
+ }
98
+ };
58
99
  }
59
100
  }
60
101
  exports.RobotGateway = RobotGateway;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.2.11",
3
+ "version": "1.2.12",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/readme.md CHANGED
@@ -320,73 +320,60 @@ heatlamp 属性提供了一组方法,用于管理猪场的热灯配置。它
320
320
 
321
321
  ### 巡检任务相关接口
322
322
 
323
- 以下是新增的巡检任务相关接口,这些接口都在 `cpzxrobot().robot` 命名空间下:
323
+ 以下是更新后的巡检任务相关接口,分组在 `cpzxrobot().task` 和 `cpzxrobot().record` 命名空间下:
324
+
325
+ #### 任务管理 (cpzxrobot().task)
324
326
 
325
327
  1. **获取任务列表**
326
328
  ```typescript
327
- cpzxrobot().robot.getInspectTaskList(unitId: number)
329
+ cpzxrobot().task.list(unitId: number)
328
330
  ```
329
331
  - 描述:获取指定单元的巡检任务列表
330
332
  - 参数:`unitId` - 单元ID
331
333
  - HTTP方法:GET
332
334
  - 接口路径:`/api/v2/robot/inspectTask/list/{unitId}`
333
335
 
334
- 2. **获取任务详情**
335
- ```typescript
336
- cpzxrobot().robot.getInspectTaskDetail(id: number)
337
- ```
338
- - 描述:获取指定巡检任务的详细信息
339
- - 参数:`id` - 任务ID
340
- - HTTP方法:GET
341
- - 接口路径:`/api/v2/robot/inspectTask/{id}`
342
-
343
- 3. **新增任务**
336
+ 2. **新增任务**
344
337
  ```typescript
345
- cpzxrobot().robot.addInspectTask(data: any)
338
+ cpzxrobot().task.add(data: any)
346
339
  ```
347
340
  - 描述:添加新的巡检任务
348
341
  - 参数:`data` - 包含任务信息的对象
349
342
  - HTTP方法:POST
350
343
  - 接口路径:`/api/v2/robot/inspectTask/add`
351
344
 
352
- 4. **修改任务**
345
+ 3. **修改任务**
353
346
  ```typescript
354
- cpzxrobot().robot.updateInspectTask(data: any)
347
+ cpzxrobot().task.update(data: any)
355
348
  ```
356
349
  - 描述:更新现有的巡检任务
357
350
  - 参数:`data` - 包含更新信息的对象
358
351
  - HTTP方法:POST
359
352
  - 接口路径:`/api/v2/robot/inspectTask/update`
360
353
 
361
- 5. **删除任务**
354
+ 4. **删除任务**
362
355
  ```typescript
363
- cpzxrobot().robot.deleteInspectTask(id: number)
356
+ cpzxrobot().task.delete(id: number)
364
357
  ```
365
358
  - 描述:删除指定的巡检任务
366
359
  - 参数:`id` - 任务ID
367
- - HTTP方法:GET
360
+ - HTTP方法:POST
368
361
  - 接口路径:`/api/v2/robot/inspectTask/delete/{id}`
369
362
 
370
- 6. **获取未下发任务列表**
363
+ 5. **下发任务**
371
364
  ```typescript
372
- cpzxrobot().robot.getNotAssignedInspectTaskList()
373
- ```
374
- - 描述:获取所有未下发的巡检任务列表
375
- - HTTP方法:GET
376
- - 接口路径:`/api/v2/robot/inspectTask/notAssignedList`
377
-
378
- 7. **下发任务**
379
- ```typescript
380
- cpzxrobot().robot.assignInspectTask(taskId: number)
365
+ cpzxrobot().task.dispatch(taskId: number)
381
366
  ```
382
367
  - 描述:下发指定的巡检任务
383
368
  - 参数:`taskId` - 任务ID
384
- - HTTP方法:GET
385
- - 接口路径:`/api/v2/robot/inspectTask/assign/{taskId}`
369
+ - HTTP方法:POST
370
+ - 接口路径:`/api/v2/robot/inspectTask/dispatch/{taskId}`
371
+
372
+ #### 巡检记录 (cpzxrobot().record)
386
373
 
387
- 8. **获取巡检结果**
374
+ 1. **获取巡检结果**
388
375
  ```typescript
389
- cpzxrobot().robot.getInspectRecordList(taskId: number)
376
+ cpzxrobot().record.list(taskId: number)
390
377
  ```
391
378
  - 描述:获取指定巡检任务的结果列表
392
379
  - 参数:`taskId` - 任务ID
package/robot_gateway.ts CHANGED
@@ -8,63 +8,145 @@ export class RobotGateway extends Object {
8
8
  this.context = context;
9
9
  }
10
10
 
11
- async cage(unitId: number) {
12
- ///api/v2/robot/getCageList/{unitId}
13
- var axios = await this.context.ready;
14
- return axios.get(`/api/v2/robot/getCageList/${unitId}`);
11
+ get alarm() {
12
+ return {
13
+ list: (unitId: number) => {
14
+ return this.context.ready.then(axios =>
15
+ axios.get(`/api/v2/robot/alarm/list/${unitId}`)
16
+ );
17
+ }
18
+ };
15
19
  }
16
20
 
17
- async alarm(unitId: number) {
18
- ///api/v2/robot/getAlarmList/{unitId}
19
- var axios = await this.context.ready;
20
- return axios.get(`/api/v2/robot/getAlarmList/${unitId}`);
21
+ get task() {
22
+ return {
23
+ list: (unitId: number) => {
24
+ return this.context.ready.then(axios =>
25
+ axios.get(`/api/v2/robot/inspectTask/list/${unitId}`)
26
+ );
27
+ },
28
+ add: (data: any) => {
29
+ return this.context.ready.then(axios =>
30
+ axios.post('/api/v2/robot/inspectTask/add', data)
31
+ );
32
+ },
33
+ update: (data: any) => {
34
+ return this.context.ready.then(axios =>
35
+ axios.post('/api/v2/robot/inspectTask/update', data)
36
+ );
37
+ },
38
+ delete: (id: number) => {
39
+ return this.context.ready.then(axios =>
40
+ axios.post(`/api/v2/robot/inspectTask/delete/${id}`)
41
+ );
42
+ },
43
+ dispatch: (taskId: number) => {
44
+ return this.context.ready.then(axios =>
45
+ axios.post(`/api/v2/robot/inspectTask/dispatch/${taskId}`)
46
+ );
47
+ }
48
+ };
21
49
  }
22
50
 
23
- // 获取任务列表
24
- async getInspectTaskList(unitId: number) {
25
- var axios = await this.context.ready;
26
- return axios.get(`/api/v2/robot/inspectTask/list/${unitId}`);
51
+ get record() {
52
+ return {
53
+ list: (taskId: number) => {
54
+ return this.context.ready.then(axios =>
55
+ axios.get(`/api/v2/robot/inspectRecord/list/${taskId}`)
56
+ );
57
+ }
58
+ };
27
59
  }
28
60
 
29
- // 获取任务详情
30
- async getInspectTaskDetail(id: number) {
31
- var axios = await this.context.ready;
32
- return axios.get(`/api/v2/robot/inspectTask/${id}`);
61
+ get cage() {
62
+ return {
63
+ list: (unitId: number) => {
64
+ return this.context.ready.then(axios =>
65
+ axios.get(`/api/v2/robot/cage/list/${unitId}`)
66
+ );
67
+ },
68
+ addList: (data: any) => {
69
+ return this.context.ready.then(axios =>
70
+ axios.post('/api/v2/robot/cage/addList', data)
71
+ );
72
+ },
73
+ updateList: (data: any) => {
74
+ return this.context.ready.then(axios =>
75
+ axios.post('/api/v2/robot/cage/updateList', data)
76
+ );
77
+ },
78
+ update: (data: any) => {
79
+ return this.context.ready.then(axios =>
80
+ axios.post('/api/v2/robot/cage/update', data)
81
+ );
82
+ },
83
+ delete: (id: number) => {
84
+ return this.context.ready.then(axios =>
85
+ axios.post(`/api/v2/robot/cage/delete/${id}`)
86
+ );
87
+ },
88
+ deleteList: (unitId: number) => {
89
+ return this.context.ready.then(axios =>
90
+ axios.post(`/api/v2/robot/cage/deleteList/${unitId}`)
91
+ );
92
+ }
93
+ };
33
94
  }
34
95
 
35
- // 新增任务
36
- async addInspectTask(data: any) {
37
- var axios = await this.context.ready;
38
- return axios.post('/api/v2/robot/inspectTask/add', data);
39
- }
40
-
41
- // 修改任务
42
- async updateInspectTask(data: any) {
43
- var axios = await this.context.ready;
44
- return axios.post('/api/v2/robot/inspectTask/update', data);
45
- }
46
-
47
- // 删除任务
48
- async deleteInspectTask(id: number) {
49
- var axios = await this.context.ready;
50
- return axios.get(`/api/v2/robot/inspectTask/delete/${id}`);
51
- }
52
-
53
- // 获取未下发任务列表
54
- async getNotAssignedInspectTaskList() {
55
- var axios = await this.context.ready;
56
- return axios.get('/api/v2/robot/inspectTask/notAssignedList');
57
- }
58
-
59
- // 下发任务
60
- async assignInspectTask(taskId: number) {
61
- var axios = await this.context.ready;
62
- return axios.get(`/api/v2/robot/inspectTask/assign/${taskId}`);
63
- }
64
-
65
- // 获取巡检结果
66
- async getInspectRecordList(taskId: number) {
67
- var axios = await this.context.ready;
68
- return axios.get(`/api/v2/robot/inspectRecord/list/${taskId}`);
96
+ get path() {
97
+ return {
98
+ list: (unitId: number) => {
99
+ return this.context.ready.then(axios =>
100
+ axios.get(`/api/v2/robot/inspectPath/list/${unitId}`)
101
+ );
102
+ },
103
+ add: (data: any) => {
104
+ return this.context.ready.then(axios =>
105
+ axios.post('/api/v2/robot/inspectPath/add', data)
106
+ );
107
+ },
108
+ update: (data: any) => {
109
+ return this.context.ready.then(axios =>
110
+ axios.post('/api/v2/robot/inspectPath/update', data)
111
+ );
112
+ },
113
+ delete: (data: any) => {
114
+ return this.context.ready.then(axios =>
115
+ axios.post('/api/v2/robot/inspectPath/delete', data)
116
+ );
117
+ },
118
+ point: {
119
+ list: (pathId: number) => {
120
+ return this.context.ready.then(axios =>
121
+ axios.get(`/api/v2/robot/inspectPathPoint/list/${pathId}`)
122
+ );
123
+ },
124
+ addList: (data: any) => {
125
+ return this.context.ready.then(axios =>
126
+ axios.post('/api/v2/robot/inspectPathPoint/addList', data)
127
+ );
128
+ },
129
+ updateList: (data: any) => {
130
+ return this.context.ready.then(axios =>
131
+ axios.post('/api/v2/robot/inspectPathPoint/updateList', data)
132
+ );
133
+ },
134
+ update: (data: any) => {
135
+ return this.context.ready.then(axios =>
136
+ axios.post('/api/v2/robot/inspectPathPoint/update', data)
137
+ );
138
+ },
139
+ delete: (id: number) => {
140
+ return this.context.ready.then(axios =>
141
+ axios.post(`/api/v2/robot/inspectPathPoint/delete/${id}`)
142
+ );
143
+ },
144
+ deleteList: (pathId: number) => {
145
+ return this.context.ready.then(axios =>
146
+ axios.post(`/api/v2/robot/inspectPathPoint/deleteList/${pathId}`)
147
+ );
148
+ }
149
+ }
150
+ };
69
151
  }
70
152
  }