@cpzxrobot/sdk 1.2.30 → 1.2.32
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/company_gateway.ts +21 -0
- package/device_type_gateway.ts +1 -0
- package/dist/company_gateway.js +17 -0
- package/dist/device_type_gateway.js +1 -0
- package/dist/factory_gateway.js +6 -0
- package/dist/transport_gateway.js +73 -0
- package/factory_gateway.ts +6 -0
- package/package.json +1 -1
- package/readme.md +6 -1
- package/transport_gateway.ts +78 -0
package/company_gateway.ts
CHANGED
|
@@ -13,6 +13,27 @@ export class CompanyGateway extends Object {
|
|
|
13
13
|
.get(`/api/v2/company/list?current=${pageNo}&size=${pageSize}`);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
async detail(id: number) {
|
|
17
|
+
var axios = await this.context.ready;
|
|
18
|
+
return axios.get(`/api/v2/company/get?id=${id}`);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async create(data: any) {
|
|
22
|
+
var axios = await this.context.ready;
|
|
23
|
+
return axios.post(`/api/v2/company/add`, data);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async update(id: number, data: any) {
|
|
27
|
+
var axios = await this.context.ready;
|
|
28
|
+
data.id = id;
|
|
29
|
+
return axios.post(`/api/v2/company/update`, data);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async delete(id: number) {
|
|
33
|
+
var axios = await this.context.ready;
|
|
34
|
+
return axios.get(`/api/v2/company/delete/id=${id}`);
|
|
35
|
+
}
|
|
36
|
+
|
|
16
37
|
get rank() {
|
|
17
38
|
return {
|
|
18
39
|
byRevenue: async () => {
|
package/device_type_gateway.ts
CHANGED
package/dist/company_gateway.js
CHANGED
|
@@ -11,6 +11,23 @@ class CompanyGateway extends Object {
|
|
|
11
11
|
return axios
|
|
12
12
|
.get(`/api/v2/company/list?current=${pageNo}&size=${pageSize}`);
|
|
13
13
|
}
|
|
14
|
+
async detail(id) {
|
|
15
|
+
var axios = await this.context.ready;
|
|
16
|
+
return axios.get(`/api/v2/company/get?id=${id}`);
|
|
17
|
+
}
|
|
18
|
+
async create(data) {
|
|
19
|
+
var axios = await this.context.ready;
|
|
20
|
+
return axios.post(`/api/v2/company/add`, data);
|
|
21
|
+
}
|
|
22
|
+
async update(id, data) {
|
|
23
|
+
var axios = await this.context.ready;
|
|
24
|
+
data.id = id;
|
|
25
|
+
return axios.post(`/api/v2/company/update`, data);
|
|
26
|
+
}
|
|
27
|
+
async delete(id) {
|
|
28
|
+
var axios = await this.context.ready;
|
|
29
|
+
return axios.get(`/api/v2/company/delete/id=${id}`);
|
|
30
|
+
}
|
|
14
31
|
get rank() {
|
|
15
32
|
return {
|
|
16
33
|
byRevenue: async () => {
|
package/dist/factory_gateway.js
CHANGED
|
@@ -101,6 +101,12 @@ class FactoryGateway extends Object {
|
|
|
101
101
|
return response.data;
|
|
102
102
|
}
|
|
103
103
|
//获得工厂的所有单元信息,以车间为单位树状结构
|
|
104
|
+
/**
|
|
105
|
+
* 异步获取指定工厂的单元信息
|
|
106
|
+
*
|
|
107
|
+
* @param id 工厂ID,可选参数。如果不提供,则默认获取当前用户选择的工厂ID
|
|
108
|
+
* @returns 返回包含单元信息的对象
|
|
109
|
+
*/
|
|
104
110
|
async units(id = undefined) {
|
|
105
111
|
var axios = await this.context.ready;
|
|
106
112
|
if (!id) {
|
|
@@ -7,6 +7,79 @@ class TransportGateway extends Object {
|
|
|
7
7
|
this._selectedFarm = "";
|
|
8
8
|
this.context = context;
|
|
9
9
|
}
|
|
10
|
+
get pig() {
|
|
11
|
+
return {
|
|
12
|
+
// 根据栋舍获取车牌号列表信息
|
|
13
|
+
getCars: (factoryId) => {
|
|
14
|
+
return this.context.ready.then(() => {
|
|
15
|
+
return this.context.axios
|
|
16
|
+
.get("/api/v2/pigfarm/transport/cars", {
|
|
17
|
+
params: { factoryId }
|
|
18
|
+
})
|
|
19
|
+
.then((res) => {
|
|
20
|
+
if (res.data.code != 200) {
|
|
21
|
+
throw res.data.message;
|
|
22
|
+
}
|
|
23
|
+
return res.data.data;
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
// 获取运输批次信息(根据workshopId和truckCode)
|
|
28
|
+
getBatchByTruck: (workshopId, truckCode) => {
|
|
29
|
+
return this.context.ready.then(() => {
|
|
30
|
+
return this.context.axios
|
|
31
|
+
.get(`/api/v2/pigfarm/transport/bactch/${workshopId}/${truckCode}`)
|
|
32
|
+
.then((res) => {
|
|
33
|
+
if (res.data.code != 200) {
|
|
34
|
+
throw res.data.message;
|
|
35
|
+
}
|
|
36
|
+
return res.data.data;
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
// 获取运输批次信息(根据workshopId和时间范围)
|
|
41
|
+
getBatchByDateRange: (workshopId, startDate, endDate) => {
|
|
42
|
+
return this.context.ready.then(() => {
|
|
43
|
+
return this.context.axios
|
|
44
|
+
.get(`/api/v2/pigfarm/transport/bactch/${workshopId}`, {
|
|
45
|
+
params: { startDate, endDate }
|
|
46
|
+
})
|
|
47
|
+
.then((res) => {
|
|
48
|
+
if (res.data.code != 200) {
|
|
49
|
+
throw res.data.message;
|
|
50
|
+
}
|
|
51
|
+
return res.data.data;
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
// 创建猪运输单
|
|
56
|
+
createBatch: (data) => {
|
|
57
|
+
return this.context.ready.then(() => {
|
|
58
|
+
return this.context.axios
|
|
59
|
+
.post("/api/v2/pigfarm/transport/bactch", data)
|
|
60
|
+
.then((res) => {
|
|
61
|
+
if (res.data.code != 200) {
|
|
62
|
+
throw res.data.message;
|
|
63
|
+
}
|
|
64
|
+
return res.data.data;
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
},
|
|
68
|
+
// 获取运输单详情
|
|
69
|
+
getBatchDetail: (id) => {
|
|
70
|
+
return this.context.ready.then(() => {
|
|
71
|
+
return this.context.axios
|
|
72
|
+
.get(`/api/v2/pigfarm/transport/bactch/detail/${id}`)
|
|
73
|
+
.then((res) => {
|
|
74
|
+
if (res.data.code != 200) {
|
|
75
|
+
throw res.data.message;
|
|
76
|
+
}
|
|
77
|
+
return res.data.data;
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
}
|
|
10
83
|
get fodder() {
|
|
11
84
|
return {
|
|
12
85
|
//获得打料列表
|
package/factory_gateway.ts
CHANGED
|
@@ -116,6 +116,12 @@ export class FactoryGateway extends Object {
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
//获得工厂的所有单元信息,以车间为单位树状结构
|
|
119
|
+
/**
|
|
120
|
+
* 异步获取指定工厂的单元信息
|
|
121
|
+
*
|
|
122
|
+
* @param id 工厂ID,可选参数。如果不提供,则默认获取当前用户选择的工厂ID
|
|
123
|
+
* @returns 返回包含单元信息的对象
|
|
124
|
+
*/
|
|
119
125
|
async units(id: number|undefined = undefined): Promise<any> {
|
|
120
126
|
var axios = await this.context.ready;
|
|
121
127
|
if (!id) {
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -953,10 +953,15 @@ baseURL: "/"
|
|
|
953
953
|
| cpzxrobot().factory.workshop.post | 添加车间信息 |
|
|
954
954
|
| cpzxrobot().factory.workshop.types | 获得车间的类型列表 |
|
|
955
955
|
| cpzxrobot().factory.workshop.delete | 删除车间信息,需要传入id参数 |
|
|
956
|
-
| cpzxrobot().factory.batch.list | 获得批次列表,传入factoryId参数 |
|
|
956
|
+
| cpzxrobot().factory.batch.list | 获得批次列表,传入factoryId参数 |
|
|
957
957
|
| cpzxrobot().transport.fodder.getDeviceByFodderld | 获得料单对应的设备 |
|
|
958
958
|
| cpzxrobot().transport.fodder.getRecentLoad | 获取料塔最近打料记录,传入towerId参数 |
|
|
959
959
|
| cpzxrobot().transport.fodder.delete | 删除饲料信息,需要传入id参数 |
|
|
960
|
+
| cpzxrobot().transport.pig.getCars | 根据栋舍获取车牌号列表信息,传入factoryId参数 |
|
|
961
|
+
| cpzxrobot().transport.pig.getBatchByTruck | 获取运输批次信息,传入workshopId和truckCode参数 |
|
|
962
|
+
| cpzxrobot().transport.pig.getBatchByDateRange | 获取运输批次信息,传入workshopId、startDate和endDate参数 |
|
|
963
|
+
| cpzxrobot().transport.pig.createBatch | 创建猪运输单,传入运输单数据 |
|
|
964
|
+
| cpzxrobot().transport.pig.getBatchDetail | 获取运输单详情,传入运输单id |
|
|
960
965
|
| cpzxrobot().pigfarm.heatlamp.xxx | 操作保温灯 |
|
|
961
966
|
| cpzxrobot().pigfarm.weightMeter.config.list | 获取称重计的配置信息 |
|
|
962
967
|
| cpzxrobot().pigfarm.weightMeter.config.bind | 添加称重计的配置信息,绑定到料塔 |
|
package/transport_gateway.ts
CHANGED
|
@@ -9,6 +9,84 @@ export class TransportGateway extends Object {
|
|
|
9
9
|
this.context = context;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
get pig() {
|
|
13
|
+
return {
|
|
14
|
+
// 根据栋舍获取车牌号列表信息
|
|
15
|
+
getCars: (factoryId: string): Promise<any> => {
|
|
16
|
+
return this.context.ready.then(() => {
|
|
17
|
+
return this.context.axios
|
|
18
|
+
.get("/api/v2/pigfarm/transport/cars", {
|
|
19
|
+
params: { factoryId }
|
|
20
|
+
})
|
|
21
|
+
.then((res) => {
|
|
22
|
+
if (res.data.code != 200) {
|
|
23
|
+
throw res.data.message;
|
|
24
|
+
}
|
|
25
|
+
return res.data.data;
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
// 获取运输批次信息(根据workshopId和truckCode)
|
|
31
|
+
getBatchByTruck: (workshopId: string, truckCode: string): Promise<any> => {
|
|
32
|
+
return this.context.ready.then(() => {
|
|
33
|
+
return this.context.axios
|
|
34
|
+
.get(`/api/v2/pigfarm/transport/bactch/${workshopId}/${truckCode}`)
|
|
35
|
+
.then((res) => {
|
|
36
|
+
if (res.data.code != 200) {
|
|
37
|
+
throw res.data.message;
|
|
38
|
+
}
|
|
39
|
+
return res.data.data;
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
// 获取运输批次信息(根据workshopId和时间范围)
|
|
45
|
+
getBatchByDateRange: (workshopId: string, startDate: string, endDate: string): Promise<any> => {
|
|
46
|
+
return this.context.ready.then(() => {
|
|
47
|
+
return this.context.axios
|
|
48
|
+
.get(`/api/v2/pigfarm/transport/bactch/${workshopId}`, {
|
|
49
|
+
params: { startDate, endDate }
|
|
50
|
+
})
|
|
51
|
+
.then((res) => {
|
|
52
|
+
if (res.data.code != 200) {
|
|
53
|
+
throw res.data.message;
|
|
54
|
+
}
|
|
55
|
+
return res.data.data;
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
// 创建猪运输单
|
|
61
|
+
createBatch: (data: any): Promise<any> => {
|
|
62
|
+
return this.context.ready.then(() => {
|
|
63
|
+
return this.context.axios
|
|
64
|
+
.post("/api/v2/pigfarm/transport/bactch", data)
|
|
65
|
+
.then((res) => {
|
|
66
|
+
if (res.data.code != 200) {
|
|
67
|
+
throw res.data.message;
|
|
68
|
+
}
|
|
69
|
+
return res.data.data;
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
// 获取运输单详情
|
|
75
|
+
getBatchDetail: (id: string): Promise<any> => {
|
|
76
|
+
return this.context.ready.then(() => {
|
|
77
|
+
return this.context.axios
|
|
78
|
+
.get(`/api/v2/pigfarm/transport/bactch/detail/${id}`)
|
|
79
|
+
.then((res) => {
|
|
80
|
+
if (res.data.code != 200) {
|
|
81
|
+
throw res.data.message;
|
|
82
|
+
}
|
|
83
|
+
return res.data.data;
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
12
90
|
get fodder() {
|
|
13
91
|
return {
|
|
14
92
|
//获得打料列表
|