@cpzxrobot/sdk 1.2.55 → 1.2.57
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/energy_gateway.js +32 -0
- package/dist/factory_gateway.js +1 -0
- package/dist/project_gateway.js +12 -0
- package/energy_gateway.ts +40 -0
- package/factory_gateway.ts +1 -0
- package/package.json +1 -1
- package/project_gateway.ts +13 -0
- package/types.d.ts +2 -0
package/dist/energy_gateway.js
CHANGED
|
@@ -15,5 +15,37 @@ class EnergyGateway extends Object {
|
|
|
15
15
|
}
|
|
16
16
|
return new electric_meter_gateway_1.ElectricMeterGateway(this.context);
|
|
17
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* 获取工厂能源统计信息
|
|
20
|
+
* @param type 统计类型
|
|
21
|
+
* @param factoryId 工厂ID
|
|
22
|
+
*/
|
|
23
|
+
async stat(type, factoryId = null) {
|
|
24
|
+
if (!factoryId) {
|
|
25
|
+
var factory = await this.context.user.getSelectedFarm();
|
|
26
|
+
factoryId = factory.id;
|
|
27
|
+
}
|
|
28
|
+
var axios = await this.context.ready;
|
|
29
|
+
return axios.get(`/api/v3/energy/stat/${type}`, { params: { factory_id: factoryId } });
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* 创建能源统计记录
|
|
33
|
+
* @param request 创建统计请求参数
|
|
34
|
+
*/
|
|
35
|
+
async createStat(request) {
|
|
36
|
+
if (!request.factory_id) {
|
|
37
|
+
const factory = await this.context.user.getSelectedFarm();
|
|
38
|
+
request.factory_id = factory.id;
|
|
39
|
+
}
|
|
40
|
+
const axios = await this.context.ready;
|
|
41
|
+
return axios.post('/api/v3/energy/stat', {
|
|
42
|
+
factory_id: request.factory_id,
|
|
43
|
+
time: request.time.toISOString(),
|
|
44
|
+
period: request.period,
|
|
45
|
+
electric: request.electric,
|
|
46
|
+
gas: request.gas,
|
|
47
|
+
cpv: request.cpv
|
|
48
|
+
});
|
|
49
|
+
}
|
|
18
50
|
}
|
|
19
51
|
exports.EnergyGateway = EnergyGateway;
|
package/dist/factory_gateway.js
CHANGED
package/dist/project_gateway.js
CHANGED
|
@@ -230,6 +230,18 @@ class ProjectGateway extends Object {
|
|
|
230
230
|
}
|
|
231
231
|
};
|
|
232
232
|
}
|
|
233
|
+
get stage() {
|
|
234
|
+
return {
|
|
235
|
+
// 获取项目阶段下拉列表
|
|
236
|
+
selectList: (groupId) => {
|
|
237
|
+
return this.context.ready.then((axios) => {
|
|
238
|
+
return axios.get(`/api/v2/coremde-sale/project/stage/select-list`, {
|
|
239
|
+
params: { groupId }
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
}
|
|
233
245
|
get plan() {
|
|
234
246
|
return {
|
|
235
247
|
// 创建计划
|
package/energy_gateway.ts
CHANGED
|
@@ -17,4 +17,44 @@ export class EnergyGateway extends Object {
|
|
|
17
17
|
return new ElectricMeterGateway(this.context);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* 获取工厂能源统计信息
|
|
22
|
+
* @param type 统计类型
|
|
23
|
+
* @param factoryId 工厂ID
|
|
24
|
+
*/
|
|
25
|
+
async stat(type: string, factoryId: number | null = null): Promise<any> {
|
|
26
|
+
if (!factoryId) {
|
|
27
|
+
var factory = await this.context.user.getSelectedFarm();
|
|
28
|
+
factoryId = factory.id;
|
|
29
|
+
}
|
|
30
|
+
var axios = await this.context.ready;
|
|
31
|
+
return axios.get(`/api/v3/energy/stat/${type}`, { params: { factory_id: factoryId } });
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* 创建能源统计记录
|
|
36
|
+
* @param request 创建统计请求参数
|
|
37
|
+
*/
|
|
38
|
+
async createStat(request: {
|
|
39
|
+
factory_id?: number;
|
|
40
|
+
time: Date;
|
|
41
|
+
period: number;
|
|
42
|
+
electric?: number;
|
|
43
|
+
gas?: number;
|
|
44
|
+
cpv?: number;
|
|
45
|
+
}): Promise<void> {
|
|
46
|
+
if (!request.factory_id) {
|
|
47
|
+
const factory = await this.context.user.getSelectedFarm();
|
|
48
|
+
request.factory_id = factory.id;
|
|
49
|
+
}
|
|
50
|
+
const axios = await this.context.ready;
|
|
51
|
+
return axios.post('/api/v3/energy/stat', {
|
|
52
|
+
factory_id: request.factory_id,
|
|
53
|
+
time: request.time.toISOString(),
|
|
54
|
+
period: request.period,
|
|
55
|
+
electric: request.electric,
|
|
56
|
+
gas: request.gas,
|
|
57
|
+
cpv: request.cpv
|
|
58
|
+
});
|
|
59
|
+
}
|
|
20
60
|
}
|
package/factory_gateway.ts
CHANGED
package/package.json
CHANGED
package/project_gateway.ts
CHANGED
|
@@ -282,6 +282,19 @@ export class ProjectGateway extends Object {
|
|
|
282
282
|
};
|
|
283
283
|
}
|
|
284
284
|
|
|
285
|
+
get stage() {
|
|
286
|
+
return {
|
|
287
|
+
// 获取项目阶段下拉列表
|
|
288
|
+
selectList: (groupId: number) => {
|
|
289
|
+
return this.context.ready.then((axios) => {
|
|
290
|
+
return axios.get(`/api/v2/coremde-sale/project/stage/select-list`, {
|
|
291
|
+
params: { groupId }
|
|
292
|
+
});
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
|
|
285
298
|
get plan() {
|
|
286
299
|
return {
|
|
287
300
|
// 创建计划
|
package/types.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ import { LogsGateway } from "@cpzxrobot/sdk/logs_gateway";
|
|
|
17
17
|
import { RobotGateway } from "@cpzxrobot/sdk/robot_gateway";
|
|
18
18
|
import { QuotationGateway } from "./quotation_gateway";
|
|
19
19
|
import { AiGateway } from "./ai_gateway";
|
|
20
|
+
import { EnergyGateway } from "./energy_gateway";
|
|
20
21
|
|
|
21
22
|
type Device = {
|
|
22
23
|
id: number;
|
|
@@ -344,6 +345,7 @@ class Cpzxrobot {
|
|
|
344
345
|
robot: RobotGateway;
|
|
345
346
|
quotation: QuotationGateway;
|
|
346
347
|
ai: AiGateway;
|
|
348
|
+
energy: EnergyGateway;
|
|
347
349
|
dict: (key: string) => any;
|
|
348
350
|
_getSelectedFarmFromMiniApp: () => Promise<Factory>;
|
|
349
351
|
_getSelectedUnitFromMiniApp: () => Promise<Unit>;
|