@cpzxrobot/sdk 1.3.21 → 1.3.22
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.
|
@@ -13,8 +13,10 @@ class ProductionGateway extends Object {
|
|
|
13
13
|
*/
|
|
14
14
|
async addType(productName) {
|
|
15
15
|
const axios = await this.context.ready;
|
|
16
|
+
const factory = await this.context.user.getSelectedFarm();
|
|
16
17
|
return axios.post('/api/v3/production/add', {
|
|
17
|
-
product_name: productName
|
|
18
|
+
product_name: productName,
|
|
19
|
+
factory_id: factory.id
|
|
18
20
|
});
|
|
19
21
|
}
|
|
20
22
|
/**
|
|
@@ -22,7 +24,8 @@ class ProductionGateway extends Object {
|
|
|
22
24
|
*/
|
|
23
25
|
async listTypes() {
|
|
24
26
|
const axios = await this.context.ready;
|
|
25
|
-
|
|
27
|
+
const factory = await this.context.user.getSelectedFarm();
|
|
28
|
+
return axios.get(`/api/v3/production/list/${factory.id}`);
|
|
26
29
|
}
|
|
27
30
|
/**
|
|
28
31
|
* 录入产量统计数据
|
package/package.json
CHANGED
package/production_gateway.ts
CHANGED
|
@@ -15,8 +15,10 @@ export class ProductionGateway extends Object {
|
|
|
15
15
|
*/
|
|
16
16
|
async addType(productName: string): Promise<{ code: number; message: string }> {
|
|
17
17
|
const axios = await this.context.ready;
|
|
18
|
+
const factory = await this.context.user.getSelectedFarm();
|
|
18
19
|
return axios.post('/api/v3/production/add', {
|
|
19
|
-
product_name: productName
|
|
20
|
+
product_name: productName,
|
|
21
|
+
factory_id: factory.id
|
|
20
22
|
});
|
|
21
23
|
}
|
|
22
24
|
|
|
@@ -25,7 +27,8 @@ export class ProductionGateway extends Object {
|
|
|
25
27
|
*/
|
|
26
28
|
async listTypes(): Promise<{ types: Production[] }> {
|
|
27
29
|
const axios = await this.context.ready;
|
|
28
|
-
|
|
30
|
+
const factory = await this.context.user.getSelectedFarm();
|
|
31
|
+
return axios.get(`/api/v3/production/list/${factory.id}`);
|
|
29
32
|
}
|
|
30
33
|
|
|
31
34
|
/**
|