@cpzxrobot/sdk 1.2.31 → 1.2.33
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 +23 -2
- package/dist/company_gateway.js +19 -2
- package/dist/project_gateway.js +37 -0
- package/dist/transport_gateway.js +4 -4
- package/package.json +1 -1
- package/project_gateway.ts +44 -0
- package/readme.md +55 -1
- package/transport_gateway.ts +4 -4
package/company_gateway.ts
CHANGED
|
@@ -7,10 +7,31 @@ export class CompanyGateway extends Object {
|
|
|
7
7
|
this.context = context;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
async list(pageNo: number, pageSize: number) {
|
|
10
|
+
async list(pageNo: number, pageSize: number,pid:number, companyName:string) {
|
|
11
11
|
var axios = await this.context.ready;
|
|
12
12
|
return axios
|
|
13
|
-
.get(`/api/v2/company/list?current=${pageNo}&size=${pageSize}`)
|
|
13
|
+
.get(`/api/v2/company/list?current=${pageNo}&size=${pageSize}&pid=${pid}&companyName=${companyName}`)
|
|
14
|
+
}
|
|
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}`);
|
|
14
35
|
}
|
|
15
36
|
|
|
16
37
|
get rank() {
|
package/dist/company_gateway.js
CHANGED
|
@@ -6,10 +6,27 @@ class CompanyGateway extends Object {
|
|
|
6
6
|
super();
|
|
7
7
|
this.context = context;
|
|
8
8
|
}
|
|
9
|
-
async list(pageNo, pageSize) {
|
|
9
|
+
async list(pageNo, pageSize, pid, companyName) {
|
|
10
10
|
var axios = await this.context.ready;
|
|
11
11
|
return axios
|
|
12
|
-
.get(`/api/v2/company/list?current=${pageNo}&size=${pageSize}`);
|
|
12
|
+
.get(`/api/v2/company/list?current=${pageNo}&size=${pageSize}&pid=${pid}&companyName=${companyName}`);
|
|
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}`);
|
|
13
30
|
}
|
|
14
31
|
get rank() {
|
|
15
32
|
return {
|
package/dist/project_gateway.js
CHANGED
|
@@ -134,8 +134,11 @@ class ProjectGateway extends Object {
|
|
|
134
134
|
}
|
|
135
135
|
// 更新项目
|
|
136
136
|
update(projectData) {
|
|
137
|
+
// 等待context的ready状态完成
|
|
137
138
|
return this.context.ready.then((axios) => {
|
|
138
139
|
return axios.post(`/api/v2/coremde-sale/project/update`, projectData);
|
|
140
|
+
// 使用axios发送POST请求到/api/v2/coremde-sale/project/update接口,并传递projectData作为参数
|
|
141
|
+
return axios.post(`/api/v2/coremde-sale/project/update`, projectData);
|
|
139
142
|
});
|
|
140
143
|
}
|
|
141
144
|
// 删除项目
|
|
@@ -193,5 +196,39 @@ class ProjectGateway extends Object {
|
|
|
193
196
|
}
|
|
194
197
|
};
|
|
195
198
|
}
|
|
199
|
+
get codePrefix() {
|
|
200
|
+
return {
|
|
201
|
+
// 添加code前缀
|
|
202
|
+
add: (args) => {
|
|
203
|
+
return this.context.ready.then((axios) => {
|
|
204
|
+
return axios.post(`/api/v2/coremde-sale/project/code-prefix/add`, args);
|
|
205
|
+
});
|
|
206
|
+
},
|
|
207
|
+
// 获取code前缀列表
|
|
208
|
+
list: (args) => {
|
|
209
|
+
return this.context.ready.then((axios) => {
|
|
210
|
+
return axios.post(`/api/v2/coremde-sale/project/code-prefix/list`, args);
|
|
211
|
+
});
|
|
212
|
+
},
|
|
213
|
+
// 获取单个code前缀详情
|
|
214
|
+
get: (id) => {
|
|
215
|
+
return this.context.ready.then((axios) => {
|
|
216
|
+
return axios.get(`/api/v2/coremde-sale/project/code-prefix/get?id=${id}`);
|
|
217
|
+
});
|
|
218
|
+
},
|
|
219
|
+
// 更新code前缀
|
|
220
|
+
update: (args) => {
|
|
221
|
+
return this.context.ready.then((axios) => {
|
|
222
|
+
return axios.post(`/api/v2/coremde-sale/project/code-prefix/update`, args);
|
|
223
|
+
});
|
|
224
|
+
},
|
|
225
|
+
// 删除code前缀
|
|
226
|
+
delete: (id) => {
|
|
227
|
+
return this.context.ready.then((axios) => {
|
|
228
|
+
return axios.get(`/api/v2/coremde-sale/project/code-prefix/delete?id=${id}`);
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
}
|
|
196
233
|
}
|
|
197
234
|
exports.ProjectGateway = ProjectGateway;
|
|
@@ -28,7 +28,7 @@ class TransportGateway extends Object {
|
|
|
28
28
|
getBatchByTruck: (workshopId, truckCode) => {
|
|
29
29
|
return this.context.ready.then(() => {
|
|
30
30
|
return this.context.axios
|
|
31
|
-
.get(`/api/v2/pigfarm/transport/
|
|
31
|
+
.get(`/api/v2/pigfarm/transport/batch/${workshopId}/${truckCode}`)
|
|
32
32
|
.then((res) => {
|
|
33
33
|
if (res.data.code != 200) {
|
|
34
34
|
throw res.data.message;
|
|
@@ -41,7 +41,7 @@ class TransportGateway extends Object {
|
|
|
41
41
|
getBatchByDateRange: (workshopId, startDate, endDate) => {
|
|
42
42
|
return this.context.ready.then(() => {
|
|
43
43
|
return this.context.axios
|
|
44
|
-
.get(`/api/v2/pigfarm/transport/
|
|
44
|
+
.get(`/api/v2/pigfarm/transport/batch/${workshopId}`, {
|
|
45
45
|
params: { startDate, endDate }
|
|
46
46
|
})
|
|
47
47
|
.then((res) => {
|
|
@@ -56,7 +56,7 @@ class TransportGateway extends Object {
|
|
|
56
56
|
createBatch: (data) => {
|
|
57
57
|
return this.context.ready.then(() => {
|
|
58
58
|
return this.context.axios
|
|
59
|
-
.post("/api/v2/pigfarm/transport/
|
|
59
|
+
.post("/api/v2/pigfarm/transport/batch", data)
|
|
60
60
|
.then((res) => {
|
|
61
61
|
if (res.data.code != 200) {
|
|
62
62
|
throw res.data.message;
|
|
@@ -69,7 +69,7 @@ class TransportGateway extends Object {
|
|
|
69
69
|
getBatchDetail: (id) => {
|
|
70
70
|
return this.context.ready.then(() => {
|
|
71
71
|
return this.context.axios
|
|
72
|
-
.get(`/api/v2/pigfarm/transport/
|
|
72
|
+
.get(`/api/v2/pigfarm/transport/batch/detail/${id}`)
|
|
73
73
|
.then((res) => {
|
|
74
74
|
if (res.data.code != 200) {
|
|
75
75
|
throw res.data.message;
|
package/package.json
CHANGED
package/project_gateway.ts
CHANGED
|
@@ -171,8 +171,11 @@ export class ProjectGateway extends Object {
|
|
|
171
171
|
|
|
172
172
|
// 更新项目
|
|
173
173
|
update(projectData: any) {
|
|
174
|
+
// 等待context的ready状态完成
|
|
174
175
|
return this.context.ready.then((axios) => {
|
|
175
176
|
return axios.post(`/api/v2/coremde-sale/project/update`, projectData);
|
|
177
|
+
// 使用axios发送POST请求到/api/v2/coremde-sale/project/update接口,并传递projectData作为参数
|
|
178
|
+
return axios.post(`/api/v2/coremde-sale/project/update`, projectData);
|
|
176
179
|
});
|
|
177
180
|
}
|
|
178
181
|
|
|
@@ -238,4 +241,45 @@ export class ProjectGateway extends Object {
|
|
|
238
241
|
};
|
|
239
242
|
}
|
|
240
243
|
|
|
244
|
+
get codePrefix() {
|
|
245
|
+
return {
|
|
246
|
+
// 添加code前缀
|
|
247
|
+
add: (args: { codePrefix: string; description: string,companyId: number }) => {
|
|
248
|
+
return this.context.ready.then((axios) => {
|
|
249
|
+
return axios.post(`/api/v2/coremde-sale/project/code-prefix/add`, args);
|
|
250
|
+
});
|
|
251
|
+
},
|
|
252
|
+
// 获取code前缀列表
|
|
253
|
+
list: (args: {
|
|
254
|
+
pageNo: number;
|
|
255
|
+
pageSize: number;
|
|
256
|
+
projectCode?: string;
|
|
257
|
+
description?: string;
|
|
258
|
+
companyId?: number;
|
|
259
|
+
}) => {
|
|
260
|
+
return this.context.ready.then((axios) => {
|
|
261
|
+
return axios.post(`/api/v2/coremde-sale/project/code-prefix/list`, args);
|
|
262
|
+
});
|
|
263
|
+
},
|
|
264
|
+
// 获取单个code前缀详情
|
|
265
|
+
get: (id: number) => {
|
|
266
|
+
return this.context.ready.then((axios) => {
|
|
267
|
+
return axios.get(`/api/v2/coremde-sale/project/code-prefix/get?id=${id}`);
|
|
268
|
+
});
|
|
269
|
+
},
|
|
270
|
+
// 更新code前缀
|
|
271
|
+
update: (args: { codePrefix: string; description: string; id: number }) => {
|
|
272
|
+
return this.context.ready.then((axios) => {
|
|
273
|
+
return axios.post(`/api/v2/coremde-sale/project/code-prefix/update`, args);
|
|
274
|
+
});
|
|
275
|
+
},
|
|
276
|
+
// 删除code前缀
|
|
277
|
+
delete: (id: number) => {
|
|
278
|
+
return this.context.ready.then((axios) => {
|
|
279
|
+
return axios.get(`/api/v2/coremde-sale/project/code-prefix/delete?id=${id}`);
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
|
|
241
285
|
}
|
package/readme.md
CHANGED
|
@@ -483,6 +483,60 @@ cpzxrobot().project.list({
|
|
|
483
483
|
size?: number
|
|
484
484
|
})
|
|
485
485
|
|
|
486
|
+
// Code前缀管理
|
|
487
|
+
cpzxrobot().project.codePrefix = {
|
|
488
|
+
// 添加code前缀
|
|
489
|
+
add: (args: { codePrefix: string; description: string }) => Promise<any>
|
|
490
|
+
|
|
491
|
+
// 获取code前缀列表
|
|
492
|
+
list: (args: {
|
|
493
|
+
pageNo: number;
|
|
494
|
+
pageSize: number;
|
|
495
|
+
projectCode?: string;
|
|
496
|
+
description?: string;
|
|
497
|
+
}) => Promise<any>
|
|
498
|
+
|
|
499
|
+
// 获取单个code前缀详情
|
|
500
|
+
get: (id: number) => Promise<any>
|
|
501
|
+
|
|
502
|
+
// 更新code前缀
|
|
503
|
+
update: (args: {
|
|
504
|
+
codePrefix: string;
|
|
505
|
+
description: string;
|
|
506
|
+
id: number
|
|
507
|
+
}) => Promise<any>
|
|
508
|
+
|
|
509
|
+
// 删除code前缀
|
|
510
|
+
delete: (id: number) => Promise<any>
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
// 使用示例
|
|
514
|
+
// 添加code前缀
|
|
515
|
+
await cpzxrobot().project.codePrefix.add({
|
|
516
|
+
codePrefix: "PRJ",
|
|
517
|
+
description: "项目编号前缀"
|
|
518
|
+
});
|
|
519
|
+
|
|
520
|
+
// 获取code前缀列表
|
|
521
|
+
const prefixes = await cpzxrobot().project.codePrefix.list({
|
|
522
|
+
pageNo: 1,
|
|
523
|
+
pageSize: 10
|
|
524
|
+
});
|
|
525
|
+
|
|
526
|
+
// 获取单个code前缀
|
|
527
|
+
const prefix = await cpzxrobot().project.codePrefix.get(123);
|
|
528
|
+
|
|
529
|
+
// 更新code前缀
|
|
530
|
+
await cpzxrobot().project.codePrefix.update({
|
|
531
|
+
codePrefix: "PROJ",
|
|
532
|
+
description: "项目编号前缀",
|
|
533
|
+
id: 123
|
|
534
|
+
});
|
|
535
|
+
|
|
536
|
+
// 删除code前缀
|
|
537
|
+
await cpzxrobot().project.codePrefix.delete(123);
|
|
538
|
+
```
|
|
539
|
+
|
|
486
540
|
// 获取项目详情
|
|
487
541
|
cpzxrobot().project.get(projectId)
|
|
488
542
|
|
|
@@ -953,7 +1007,7 @@ baseURL: "/"
|
|
|
953
1007
|
| cpzxrobot().factory.workshop.post | 添加车间信息 |
|
|
954
1008
|
| cpzxrobot().factory.workshop.types | 获得车间的类型列表 |
|
|
955
1009
|
| cpzxrobot().factory.workshop.delete | 删除车间信息,需要传入id参数 |
|
|
956
|
-
| cpzxrobot().factory.batch.list | 获得批次列表,传入factoryId参数 |
|
|
1010
|
+
| cpzxrobot().factory.batch.list | 获得批次列表,传入factoryId参数 |
|
|
957
1011
|
| cpzxrobot().transport.fodder.getDeviceByFodderld | 获得料单对应的设备 |
|
|
958
1012
|
| cpzxrobot().transport.fodder.getRecentLoad | 获取料塔最近打料记录,传入towerId参数 |
|
|
959
1013
|
| cpzxrobot().transport.fodder.delete | 删除饲料信息,需要传入id参数 |
|
package/transport_gateway.ts
CHANGED
|
@@ -31,7 +31,7 @@ export class TransportGateway extends Object {
|
|
|
31
31
|
getBatchByTruck: (workshopId: string, truckCode: string): Promise<any> => {
|
|
32
32
|
return this.context.ready.then(() => {
|
|
33
33
|
return this.context.axios
|
|
34
|
-
.get(`/api/v2/pigfarm/transport/
|
|
34
|
+
.get(`/api/v2/pigfarm/transport/batch/${workshopId}/${truckCode}`)
|
|
35
35
|
.then((res) => {
|
|
36
36
|
if (res.data.code != 200) {
|
|
37
37
|
throw res.data.message;
|
|
@@ -45,7 +45,7 @@ export class TransportGateway extends Object {
|
|
|
45
45
|
getBatchByDateRange: (workshopId: string, startDate: string, endDate: string): Promise<any> => {
|
|
46
46
|
return this.context.ready.then(() => {
|
|
47
47
|
return this.context.axios
|
|
48
|
-
.get(`/api/v2/pigfarm/transport/
|
|
48
|
+
.get(`/api/v2/pigfarm/transport/batch/${workshopId}`, {
|
|
49
49
|
params: { startDate, endDate }
|
|
50
50
|
})
|
|
51
51
|
.then((res) => {
|
|
@@ -61,7 +61,7 @@ export class TransportGateway extends Object {
|
|
|
61
61
|
createBatch: (data: any): Promise<any> => {
|
|
62
62
|
return this.context.ready.then(() => {
|
|
63
63
|
return this.context.axios
|
|
64
|
-
.post("/api/v2/pigfarm/transport/
|
|
64
|
+
.post("/api/v2/pigfarm/transport/batch", data)
|
|
65
65
|
.then((res) => {
|
|
66
66
|
if (res.data.code != 200) {
|
|
67
67
|
throw res.data.message;
|
|
@@ -75,7 +75,7 @@ export class TransportGateway extends Object {
|
|
|
75
75
|
getBatchDetail: (id: string): Promise<any> => {
|
|
76
76
|
return this.context.ready.then(() => {
|
|
77
77
|
return this.context.axios
|
|
78
|
-
.get(`/api/v2/pigfarm/transport/
|
|
78
|
+
.get(`/api/v2/pigfarm/transport/batch/detail/${id}`)
|
|
79
79
|
.then((res) => {
|
|
80
80
|
if (res.data.code != 200) {
|
|
81
81
|
throw res.data.message;
|