@cpzxrobot/sdk 1.2.1 → 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;
@@ -85,6 +85,7 @@ class UnitGateway extends Object {
85
85
  //批次管理
86
86
  get batch() {
87
87
  return {
88
+ // @deprecated
88
89
  bind: (unitDayage, batchNo, type) => {
89
90
  return this.context.ready.then((axios) => {
90
91
  return axios.post(`/api/v2/batch/unit/bind`, {
@@ -94,6 +95,17 @@ class UnitGateway extends Object {
94
95
  });
95
96
  });
96
97
  },
98
+ //创建批次,和bind可以复用
99
+ create: (args) => {
100
+ return this.context.ready.then((axios) => {
101
+ return axios.post(`/api/v2/batch/unit/bind`, args);
102
+ });
103
+ },
104
+ update: (args) => {
105
+ return this.context.ready.then((axios) => {
106
+ return axios.post(`/api/v2/batch/unit/update`, args);
107
+ });
108
+ },
97
109
  clear: (args) => {
98
110
  return this.context.ready.then((axios) => {
99
111
  return axios.post(`/api/v2/batch/unit/empty`, args);
@@ -125,6 +137,14 @@ class UnitGateway extends Object {
125
137
  });
126
138
  });
127
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
+ // }
128
148
  };
129
149
  }
130
150
  v2() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/readme.md CHANGED
@@ -145,6 +145,8 @@ baseURL: "/"
145
145
  | cpzxrobot().unit.thresholdConfig.bind | 设置单元的阈值配置信息 |
146
146
  | cpzxrobot().unit.thresholdConfig.delete | 删除单元的阈值配置信息,传入get获取的条目的具体id或对象本身 |
147
147
  | cpzxrobot().unit.batch.bind | 绑定单元和生产批次关系 |
148
+ | cpzxrobot().unit.batch.create | 创建生产批次 |
149
+ | cpzxrobot().unit.batch.update | 更新生产批次信息,传入id参数和更新的内容 |
148
150
  | cpzxrobot().unit.batch.clear | 清除单元绑定的生产批次 |
149
151
  | cpzxrobot().unit.batch.getUnits | 获取批次的绑定单元信息 |
150
152
  | cpzxrobot().unit.batch.searchInUnit | 搜索单元的生产批次信息 |
@@ -304,3 +306,80 @@ heatlamp 属性提供了一组方法,用于管理猪场的热灯配置。它
304
306
  **cpzxrobot().pigfarm.heatlamp.get(id)**:获取指定 ID 的热灯配置。
305
307
  **cpzxrobot().pigfarm.heatlamp.update(lamp)**:更新热灯配置。
306
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
@@ -102,6 +102,7 @@ export class UnitGateway extends Object {
102
102
  //批次管理
103
103
  get batch() {
104
104
  return {
105
+ // @deprecated
105
106
  bind: (unitDayage: {
106
107
  unitId: Number;
107
108
  dayage: Number;
@@ -115,6 +116,17 @@ export class UnitGateway extends Object {
115
116
  });
116
117
  });
117
118
  },
119
+ //创建批次,和bind可以复用
120
+ create: (args:any) => {
121
+ return this.context.ready.then((axios) => {
122
+ return axios.post(`/api/v2/batch/unit/bind`, args);
123
+ });
124
+ },
125
+ update: (args:any) => {
126
+ return this.context.ready.then((axios) => {
127
+ return axios.post(`/api/v2/batch/unit/update`, args);
128
+ });
129
+ },
118
130
  clear: (args:any) => {
119
131
  return this.context.ready.then((axios) => {
120
132
  return axios.post(
@@ -123,13 +135,13 @@ export class UnitGateway extends Object {
123
135
  },
124
136
  //获取某个批次的所有单元信息
125
137
  // deperacated
126
- get: (batchNo: Number) => {
138
+ get: (batchNo: string) => {
127
139
  return this.context.ready.then((axios) => {
128
140
  return axios.get(`/api/v2/batch/unit/${batchNo}?`);
129
141
  });
130
142
  },
131
143
  //获取某个批次的所有单元信息
132
- getUnits: (batchNo: Number) => {
144
+ getUnits: (batchNo: string) => {
133
145
  return this.context.ready.then((axios) => {
134
146
  return axios.get(`/api/v2/batch/unit/${batchNo}?`);
135
147
  });
@@ -148,6 +160,14 @@ export class UnitGateway extends Object {
148
160
  });
149
161
  });
150
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
+ // }
151
171
  }
152
172
  }
153
173