@cpzxrobot/sdk 1.1.99 → 1.2.1

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.
package/dist/index.js CHANGED
@@ -24,6 +24,7 @@ const customer_gateway_1 = require("./customer_gateway");
24
24
  const company_gateway_1 = require("./company_gateway");
25
25
  const news_gateway_1 = require("./news_gateway");
26
26
  const logs_gateway_1 = require("./logs_gateway");
27
+ const robot_gateway_1 = require("./robot_gateway");
27
28
  class Cpzxrobot {
28
29
  constructor(appCode) {
29
30
  this.pigfarm = new pigfarm_gateway_1.PigfarmGateway(this);
@@ -40,6 +41,7 @@ class Cpzxrobot {
40
41
  this.company = new company_gateway_1.CompanyGateway(this);
41
42
  this.news = new news_gateway_1.NewsGateway(this);
42
43
  this.logs = new logs_gateway_1.LogsGateway(this);
44
+ this.robot = new robot_gateway_1.RobotGateway(this);
43
45
  //获取当前浏览器的域名
44
46
  this.ready = new Promise((resolve, reject) => {
45
47
  this.resolveReady = resolve;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RobotGateway = void 0;
4
+ class RobotGateway extends Object {
5
+ constructor(context) {
6
+ super();
7
+ this.context = context;
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}`);
13
+ }
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}`);
18
+ }
19
+ }
20
+ exports.RobotGateway = RobotGateway;
@@ -99,10 +99,23 @@ class UnitGateway extends Object {
99
99
  return axios.post(`/api/v2/batch/unit/empty`, args);
100
100
  });
101
101
  },
102
- //获取某个单元的批次信息
103
- get: (unitNo) => {
102
+ //获取某个批次的所有单元信息
103
+ // deperacated
104
+ get: (batchNo) => {
104
105
  return this.context.ready.then((axios) => {
105
- return axios.get(`/api/v2/batch/unit/${unitNo}`);
106
+ return axios.get(`/api/v2/batch/unit/${batchNo}?`);
107
+ });
108
+ },
109
+ //获取某个批次的所有单元信息
110
+ getUnits: (batchNo) => {
111
+ return this.context.ready.then((axios) => {
112
+ return axios.get(`/api/v2/batch/unit/${batchNo}?`);
113
+ });
114
+ },
115
+ //查询某个单元的所有批次信息
116
+ searchInUnit: (unitId, args) => {
117
+ return this.context.ready.then((axios) => {
118
+ return axios.post(`/api/v2/batch/${unitId}?`, args);
106
119
  });
107
120
  },
108
121
  list: (unitIds) => {
package/index.ts CHANGED
@@ -19,6 +19,7 @@ import { CustomerGateway } from "./customer_gateway";
19
19
  import { CompanyGateway } from "./company_gateway";
20
20
  import { NewsGateway } from "./news_gateway";
21
21
  import { LogsGateway } from "./logs_gateway";
22
+ import { RobotGateway } from "./robot_gateway";
22
23
 
23
24
  export class Cpzxrobot {
24
25
  device: DeviceGateway;
@@ -64,6 +65,7 @@ export class Cpzxrobot {
64
65
  company: CompanyGateway = new CompanyGateway(this);
65
66
  news: NewsGateway = new NewsGateway(this);
66
67
  logs: LogsGateway = new LogsGateway(this);
68
+ robot: RobotGateway = new RobotGateway(this);
67
69
 
68
70
 
69
71
  constructor(appCode: string) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.1.99",
3
+ "version": "1.2.1",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/readme.md CHANGED
@@ -146,7 +146,8 @@ baseURL: "/"
146
146
  | cpzxrobot().unit.thresholdConfig.delete | 删除单元的阈值配置信息,传入get获取的条目的具体id或对象本身 |
147
147
  | cpzxrobot().unit.batch.bind | 绑定单元和生产批次关系 |
148
148
  | cpzxrobot().unit.batch.clear | 清除单元绑定的生产批次 |
149
- | cpzxrobot().unit.batch.get | 获取单元绑定的生产批次 |
149
+ | cpzxrobot().unit.batch.getUnits | 获取批次的绑定单元信息 |
150
+ | cpzxrobot().unit.batch.searchInUnit | 搜索单元的生产批次信息 |
150
151
  | cpzxrobot().unit.batch.list | 获取多个单元的生产批次信息 |
151
152
  | cpzxrobot().user.add | 添加用户 |
152
153
  | cpzxrobot().user.update | 更新用户 |
@@ -244,6 +245,8 @@ baseURL: "/"
244
245
  | cpzxrobot().news.alarm.list | 获得报警列表,传入必要的分页参数 |
245
246
  | cpzxrobot().getGeo | 获得地理位置信息 |
246
247
  | cpzxrobot().logs.operations | 获得操作日志列表,传入必要的参数 |
248
+ | cpzxrobot().robot.cage | 获得栏位信息 |
249
+ | cpzxrobot().robot.alarm | 获得报警信息,传入必要的参数 |
247
250
 
248
251
  ### 工厂信息接口
249
252
 
@@ -0,0 +1,23 @@
1
+ import { Cpzxrobot, Factory, Unit } from "./types";
2
+
3
+ export class RobotGateway extends Object {
4
+ context: Cpzxrobot;
5
+
6
+ constructor(context: Cpzxrobot) {
7
+ super();
8
+ this.context = context;
9
+ }
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}`);
15
+ }
16
+
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
+ }
22
+
23
+ }
package/types.d.ts CHANGED
@@ -14,6 +14,7 @@ import { ContractGateway } from "@cpzxrobot/sdk/contract_gateway";
14
14
  import { CustomerGateway } from "@cpzxrobot/sdk/customer_gateway";
15
15
  import { CompanyGateway } from "@cpzxrobot/sdk/company_gateway";
16
16
  import { LogsGateway } from "@cpzxrobot/sdk/logs_gateway";
17
+ import { RobotGateway } from "@cpzxrobot/sdk/robot_gateway";
17
18
 
18
19
  type Device = {
19
20
  id: number;
@@ -331,6 +332,7 @@ class Cpzxrobot {
331
332
  customer: CustomerGateway;
332
333
  company: CompanyGateway;
333
334
  logs: LogsGateway;
335
+ robot: RobotGateway;
334
336
  dict: (key: string) => any;
335
337
  _getSelectedFarmFromMiniApp: () => Promise<Factory>;
336
338
  _getSelectedUnitFromMiniApp: () => Promise<Unit>;
package/unit_gateway.ts CHANGED
@@ -121,10 +121,23 @@ export class UnitGateway extends Object {
121
121
  `/api/v2/batch/unit/empty`,args);
122
122
  });
123
123
  },
124
- //获取某个单元的批次信息
125
- get: (unitNo: Number) => {
124
+ //获取某个批次的所有单元信息
125
+ // deperacated
126
+ get: (batchNo: Number) => {
126
127
  return this.context.ready.then((axios) => {
127
- return axios.get(`/api/v2/batch/unit/${unitNo}`);
128
+ return axios.get(`/api/v2/batch/unit/${batchNo}?`);
129
+ });
130
+ },
131
+ //获取某个批次的所有单元信息
132
+ getUnits: (batchNo: Number) => {
133
+ return this.context.ready.then((axios) => {
134
+ return axios.get(`/api/v2/batch/unit/${batchNo}?`);
135
+ });
136
+ },
137
+ //查询某个单元的所有批次信息
138
+ searchInUnit: (unitId: Number,args :any) => {
139
+ return this.context.ready.then((axios) => {
140
+ return axios.post(`/api/v2/batch/${unitId}?`,args);
128
141
  });
129
142
  },
130
143
  list: (unitIds: Number[]) => {