@cpzxrobot/sdk 1.2.2 → 1.2.3

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.
@@ -16,5 +16,45 @@ class RobotGateway extends Object {
16
16
  var axios = await this.context.ready;
17
17
  return axios.get(`/api/v2/robot/getAlarmList/${unitId}`);
18
18
  }
19
+ // 获取任务列表
20
+ async getInspectTaskList(unitId) {
21
+ var axios = await this.context.ready;
22
+ return axios.get(`/api/v2/robot/inspectTask/list/${unitId}`);
23
+ }
24
+ // 获取任务详情
25
+ async getInspectTaskDetail(id) {
26
+ var axios = await this.context.ready;
27
+ return axios.get(`/api/v2/robot/inspectTask/${id}`);
28
+ }
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}`);
58
+ }
19
59
  }
20
60
  exports.RobotGateway = RobotGateway;
@@ -137,6 +137,14 @@ class UnitGateway extends Object {
137
137
  });
138
138
  });
139
139
  },
140
+ // operations:(batchNo:string) => {
141
+ // return this.context.ready.then((axios) => {
142
+ // return axios.post(
143
+ // `/api/v2/batch/operationRecord`,{
144
+ // unitIds
145
+ // });
146
+ // });
147
+ // }
140
148
  };
141
149
  }
142
150
  v2() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/readme.md CHANGED
@@ -306,3 +306,80 @@ heatlamp 属性提供了一组方法,用于管理猪场的热灯配置。它
306
306
  **cpzxrobot().pigfarm.heatlamp.get(id)**:获取指定 ID 的热灯配置。
307
307
  **cpzxrobot().pigfarm.heatlamp.update(lamp)**:更新热灯配置。
308
308
 
309
+ ### 巡检任务相关接口
310
+
311
+ 以下是新增的巡检任务相关接口,这些接口都在 `cpzxrobot().robot` 命名空间下:
312
+
313
+ 1. **获取任务列表**
314
+ ```typescript
315
+ cpzxrobot().robot.getInspectTaskList(unitId: number)
316
+ ```
317
+ - 描述:获取指定单元的巡检任务列表
318
+ - 参数:`unitId` - 单元ID
319
+ - HTTP方法:GET
320
+ - 接口路径:`/api/v2/robot/inspectTask/list/{unitId}`
321
+
322
+ 2. **获取任务详情**
323
+ ```typescript
324
+ cpzxrobot().robot.getInspectTaskDetail(id: number)
325
+ ```
326
+ - 描述:获取指定巡检任务的详细信息
327
+ - 参数:`id` - 任务ID
328
+ - HTTP方法:GET
329
+ - 接口路径:`/api/v2/robot/inspectTask/{id}`
330
+
331
+ 3. **新增任务**
332
+ ```typescript
333
+ cpzxrobot().robot.addInspectTask(data: any)
334
+ ```
335
+ - 描述:添加新的巡检任务
336
+ - 参数:`data` - 包含任务信息的对象
337
+ - HTTP方法:POST
338
+ - 接口路径:`/api/v2/robot/inspectTask/add`
339
+
340
+ 4. **修改任务**
341
+ ```typescript
342
+ cpzxrobot().robot.updateInspectTask(data: any)
343
+ ```
344
+ - 描述:更新现有的巡检任务
345
+ - 参数:`data` - 包含更新信息的对象
346
+ - HTTP方法:POST
347
+ - 接口路径:`/api/v2/robot/inspectTask/update`
348
+
349
+ 5. **删除任务**
350
+ ```typescript
351
+ cpzxrobot().robot.deleteInspectTask(id: number)
352
+ ```
353
+ - 描述:删除指定的巡检任务
354
+ - 参数:`id` - 任务ID
355
+ - HTTP方法:GET
356
+ - 接口路径:`/api/v2/robot/inspectTask/delete/{id}`
357
+
358
+ 6. **获取未下发任务列表**
359
+ ```typescript
360
+ cpzxrobot().robot.getNotAssignedInspectTaskList()
361
+ ```
362
+ - 描述:获取所有未下发的巡检任务列表
363
+ - HTTP方法:GET
364
+ - 接口路径:`/api/v2/robot/inspectTask/notAssignedList`
365
+
366
+ 7. **下发任务**
367
+ ```typescript
368
+ cpzxrobot().robot.assignInspectTask(taskId: number)
369
+ ```
370
+ - 描述:下发指定的巡检任务
371
+ - 参数:`taskId` - 任务ID
372
+ - HTTP方法:GET
373
+ - 接口路径:`/api/v2/robot/inspectTask/assign/{taskId}`
374
+
375
+ 8. **获取巡检结果**
376
+ ```typescript
377
+ cpzxrobot().robot.getInspectRecordList(taskId: number)
378
+ ```
379
+ - 描述:获取指定巡检任务的结果列表
380
+ - 参数:`taskId` - 任务ID
381
+ - HTTP方法:GET
382
+ - 接口路径:`/api/v2/robot/inspectRecord/list/{taskId}`
383
+
384
+ 注意:对于POST请求的接口,body参数统一使用 `any` 类型,具体参数结构需要根据实际API要求进行定义。
385
+
package/robot_gateway.ts CHANGED
@@ -20,4 +20,51 @@ export class RobotGateway extends Object {
20
20
  return axios.get(`/api/v2/robot/getAlarmList/${unitId}`);
21
21
  }
22
22
 
23
+ // 获取任务列表
24
+ async getInspectTaskList(unitId: number) {
25
+ var axios = await this.context.ready;
26
+ return axios.get(`/api/v2/robot/inspectTask/list/${unitId}`);
27
+ }
28
+
29
+ // 获取任务详情
30
+ async getInspectTaskDetail(id: number) {
31
+ var axios = await this.context.ready;
32
+ return axios.get(`/api/v2/robot/inspectTask/${id}`);
33
+ }
34
+
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}`);
69
+ }
23
70
  }
package/unit_gateway.ts CHANGED
@@ -135,13 +135,13 @@ export class UnitGateway extends Object {
135
135
  },
136
136
  //获取某个批次的所有单元信息
137
137
  // deperacated
138
- get: (batchNo: Number) => {
138
+ get: (batchNo: string) => {
139
139
  return this.context.ready.then((axios) => {
140
140
  return axios.get(`/api/v2/batch/unit/${batchNo}?`);
141
141
  });
142
142
  },
143
143
  //获取某个批次的所有单元信息
144
- getUnits: (batchNo: Number) => {
144
+ getUnits: (batchNo: string) => {
145
145
  return this.context.ready.then((axios) => {
146
146
  return axios.get(`/api/v2/batch/unit/${batchNo}?`);
147
147
  });
@@ -160,6 +160,14 @@ export class UnitGateway extends Object {
160
160
  });
161
161
  });
162
162
  },
163
+ // operations:(batchNo:string) => {
164
+ // return this.context.ready.then((axios) => {
165
+ // return axios.post(
166
+ // `/api/v2/batch/operationRecord`,{
167
+ // unitIds
168
+ // });
169
+ // });
170
+ // }
163
171
  }
164
172
  }
165
173