@cpzxrobot/sdk 1.3.87 → 1.3.88
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/factory_gateway.js +13 -2
- package/factory_gateway.ts +12 -2
- package/package.json +1 -1
package/dist/factory_gateway.js
CHANGED
|
@@ -132,8 +132,19 @@ class FactoryGateway extends Object {
|
|
|
132
132
|
workshops(id, tags) {
|
|
133
133
|
return __awaiter(this, void 0, void 0, function* () {
|
|
134
134
|
var axios = yield this.context.ready;
|
|
135
|
-
|
|
136
|
-
|
|
135
|
+
var baseUrl = `/api/v1/factory/${id}/workshops`;
|
|
136
|
+
if (!tags) {
|
|
137
|
+
const response = yield axios.get(baseUrl);
|
|
138
|
+
return response.data;
|
|
139
|
+
}
|
|
140
|
+
const response = yield axios.get(`${baseUrl}?tags=${tags === null || tags === void 0 ? void 0 : tags.join(',')}`);
|
|
141
|
+
const body = response.data;
|
|
142
|
+
if (body.code === 200) {
|
|
143
|
+
return body.data;
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
throw new Error(body.message);
|
|
147
|
+
}
|
|
137
148
|
});
|
|
138
149
|
}
|
|
139
150
|
//获得工厂的所有单元信息,以车间为单位树状结构
|
package/factory_gateway.ts
CHANGED
|
@@ -117,8 +117,18 @@ export class FactoryGateway extends Object {
|
|
|
117
117
|
//获得工厂的所有车间信息
|
|
118
118
|
async workshops(id: number, tags?: string[]): Promise<any> {
|
|
119
119
|
var axios = await this.context.ready;
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
var baseUrl = `/api/v1/factory/${id}/workshops`;
|
|
121
|
+
if (!tags) {
|
|
122
|
+
const response = await axios.get(baseUrl);
|
|
123
|
+
return response.data;
|
|
124
|
+
}
|
|
125
|
+
const response = await axios.get(`${baseUrl}?tags=${tags?.join(',')}`);
|
|
126
|
+
const body = response.data;
|
|
127
|
+
if (body.code === 200) {
|
|
128
|
+
return body.data;
|
|
129
|
+
}else{
|
|
130
|
+
throw new Error(body.message);
|
|
131
|
+
}
|
|
122
132
|
}
|
|
123
133
|
|
|
124
134
|
//获得工厂的所有单元信息,以车间为单位树状结构
|