@cpzxrobot/sdk 1.1.86 → 1.1.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/car_gateway.ts +9 -0
- package/dist/car_gateway.js +8 -0
- package/dist/index.js +24 -20
- package/dist/transport_gateway.js +14 -2
- package/index.ts +5 -1
- package/package.json +1 -1
- package/readme.md +3 -0
- package/transport_gateway.ts +20 -8
package/car_gateway.ts
CHANGED
|
@@ -21,12 +21,21 @@ export class CarGateway extends Object {
|
|
|
21
21
|
.then((res) => res.data);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
//根据工厂pid获取订单列表,注意,该接口和
|
|
24
25
|
async orders(factory: Factory, date: Date) {
|
|
25
26
|
var axios = await this.context.ready;
|
|
26
27
|
return axios
|
|
27
28
|
.get(`/api/v2/car/${factory.pid}/orders?date=` + date.toISOString())
|
|
28
29
|
}
|
|
29
30
|
|
|
31
|
+
async ordersByFactory(factory: Factory, date: Date) {
|
|
32
|
+
var axios = await this.context.ready;
|
|
33
|
+
//filter=未分配的
|
|
34
|
+
return axios
|
|
35
|
+
.get(`/api/v2/car/${factory.id}/order?date=` + date.toISOString()+"&filter=unallocated")
|
|
36
|
+
.then((res) => res.data);
|
|
37
|
+
}
|
|
38
|
+
|
|
30
39
|
listByProvince(area_code: string) {
|
|
31
40
|
return this.context.ready.then((axios) => {
|
|
32
41
|
return axios.get(`/api/v2/coremde-sale/car/province/get?area_code=${area_code}`);
|
package/dist/car_gateway.js
CHANGED
|
@@ -18,11 +18,19 @@ class CarGateway extends Object {
|
|
|
18
18
|
.get(`/api/v2/car/${factory.pid}/detections?date=` + date.toISOString())
|
|
19
19
|
.then((res) => res.data);
|
|
20
20
|
}
|
|
21
|
+
//根据工厂pid获取订单列表,注意,该接口和
|
|
21
22
|
async orders(factory, date) {
|
|
22
23
|
var axios = await this.context.ready;
|
|
23
24
|
return axios
|
|
24
25
|
.get(`/api/v2/car/${factory.pid}/orders?date=` + date.toISOString());
|
|
25
26
|
}
|
|
27
|
+
async ordersByFactory(factory, date) {
|
|
28
|
+
var axios = await this.context.ready;
|
|
29
|
+
//filter=未分配的
|
|
30
|
+
return axios
|
|
31
|
+
.get(`/api/v2/car/${factory.id}/order?date=` + date.toISOString() + "&filter=unallocated")
|
|
32
|
+
.then((res) => res.data);
|
|
33
|
+
}
|
|
26
34
|
listByProvince(area_code) {
|
|
27
35
|
return this.context.ready.then((axios) => {
|
|
28
36
|
return axios.get(`/api/v2/coremde-sale/car/province/get?area_code=${area_code}`);
|
package/dist/index.js
CHANGED
|
@@ -91,28 +91,32 @@ class Cpzxrobot {
|
|
|
91
91
|
instance.getAndPreview = instance.getAndSave;
|
|
92
92
|
// @ts-ignore
|
|
93
93
|
instance.upload = (url, option) => {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
94
|
+
return new Promise((resolve, reject) => {
|
|
95
|
+
//add a file button to the body
|
|
96
|
+
var button = document.createElement("input");
|
|
97
|
+
button.type = "file";
|
|
98
|
+
button.style.display = "none";
|
|
99
|
+
document.body.appendChild(button);
|
|
100
|
+
button.onclick = (e) => {
|
|
101
|
+
var _a;
|
|
102
|
+
var file = (_a = e.target.files) === null || _a === void 0 ? void 0 : _a[0];
|
|
103
|
+
if (file) {
|
|
104
|
+
const formData = new FormData();
|
|
105
|
+
formData.append((option === null || option === void 0 ? void 0 : option["fileField"]) || "file", file);
|
|
106
|
+
for (let key in option === null || option === void 0 ? void 0 : option["data"]) {
|
|
107
|
+
formData.append(key, option["data"][key]);
|
|
108
|
+
}
|
|
109
|
+
instance.post(url, formData).then((res) => {
|
|
110
|
+
button.remove();
|
|
111
|
+
resolve(res);
|
|
112
|
+
});
|
|
107
113
|
}
|
|
108
|
-
|
|
114
|
+
else {
|
|
109
115
|
button.remove();
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
+
resolve({ data: { Error: "没有选择文件" } });
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
});
|
|
116
120
|
};
|
|
117
121
|
// @ts-ignore
|
|
118
122
|
this.axios = instance;
|
|
@@ -67,12 +67,24 @@ class TransportGateway extends Object {
|
|
|
67
67
|
create: (data) => {
|
|
68
68
|
return this.context.ready.then(() => {
|
|
69
69
|
return this.context.axios
|
|
70
|
-
.post("/api/
|
|
70
|
+
.post("/api/v2/pigfarm/feedTower/fodder/save", data)
|
|
71
71
|
.then((res) => {
|
|
72
72
|
if (res.data.code != 200) {
|
|
73
73
|
throw res.data.message;
|
|
74
74
|
}
|
|
75
|
-
return res.data
|
|
75
|
+
return res.data;
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
},
|
|
79
|
+
addImage: () => {
|
|
80
|
+
return this.context.ready.then(() => {
|
|
81
|
+
return this.context.axios
|
|
82
|
+
.upload("/api/v2/pigfarm/feedTower/fodder/photo/add")
|
|
83
|
+
.then((res) => {
|
|
84
|
+
if (res.data.code != 200) {
|
|
85
|
+
throw res.data.message;
|
|
86
|
+
}
|
|
87
|
+
return res.data;
|
|
76
88
|
});
|
|
77
89
|
});
|
|
78
90
|
},
|
package/index.ts
CHANGED
|
@@ -127,7 +127,8 @@ export class Cpzxrobot {
|
|
|
127
127
|
instance.upload = (url: string, option?: {
|
|
128
128
|
[key: string]: any;
|
|
129
129
|
}) => {
|
|
130
|
-
|
|
130
|
+
return new Promise<any>((resolve, reject)=>{
|
|
131
|
+
//add a file button to the body
|
|
131
132
|
var button = document.createElement("input");
|
|
132
133
|
button.type = "file";
|
|
133
134
|
button.style.display = "none";
|
|
@@ -142,11 +143,14 @@ export class Cpzxrobot {
|
|
|
142
143
|
}
|
|
143
144
|
instance.post(url, formData).then((res) => {
|
|
144
145
|
button.remove();
|
|
146
|
+
resolve(res);
|
|
145
147
|
});
|
|
146
148
|
} else {
|
|
147
149
|
button.remove();
|
|
150
|
+
resolve({data:{Error:"没有选择文件"}})
|
|
148
151
|
}
|
|
149
152
|
};
|
|
153
|
+
})
|
|
150
154
|
}
|
|
151
155
|
// @ts-ignore
|
|
152
156
|
this.axios = instance;
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -232,6 +232,9 @@ baseURL: "/"
|
|
|
232
232
|
| cpzxrobot().car.stat.china | 获得车辆在全国的统计信息 |
|
|
233
233
|
| cpzxrobot().car.listByProvince | 获得车辆在某个省的统计信息,传入province参数 |
|
|
234
234
|
| cpzxrobot().car.listByCity | 获得车辆在某个市的统计信息,传入city参数 |
|
|
235
|
+
| cpzxrobot().car.listByDistrict | 获得车辆在某个区域的统计信息,传入district参数 |
|
|
236
|
+
| cpzxrobot().car.orders | 获得车辆运单列表,传入工厂(按工厂上级返回) |
|
|
237
|
+
| cpzxrobot().car.ordersByFactory | 获得车辆运单列表,传入工厂,按工厂id返回 ,只返回未分配的运单 |
|
|
235
238
|
| cpzxrobot().news.add | 添加新闻 |
|
|
236
239
|
| cpzxrobot().news.list | 获得新闻列表,传入必要的分页参数 |
|
|
237
240
|
| cpzxrobot().news.alarm.add | 添加报警信息 |
|
package/transport_gateway.ts
CHANGED
|
@@ -21,12 +21,12 @@ export class TransportGateway extends Object {
|
|
|
21
21
|
unitId: number | undefined;
|
|
22
22
|
factoryId: number | undefined;
|
|
23
23
|
} = {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
current: 1,
|
|
25
|
+
pageSize: 10,
|
|
26
|
+
deviceId: id,
|
|
27
|
+
unitId: undefined,
|
|
28
|
+
factoryId: undefined,
|
|
29
|
+
}
|
|
30
30
|
): Promise<FodderOrder[]> => {
|
|
31
31
|
return this.context.ready.then(() => {
|
|
32
32
|
return this.context.axios
|
|
@@ -78,12 +78,24 @@ export class TransportGateway extends Object {
|
|
|
78
78
|
create: (data: FodderOrder) => {
|
|
79
79
|
return this.context.ready.then(() => {
|
|
80
80
|
return this.context.axios
|
|
81
|
-
.post("/api/
|
|
81
|
+
.post("/api/v2/pigfarm/feedTower/fodder/save", data)
|
|
82
82
|
.then((res) => {
|
|
83
83
|
if (res.data.code != 200) {
|
|
84
84
|
throw res.data.message;
|
|
85
85
|
}
|
|
86
|
-
return res.data
|
|
86
|
+
return res.data;
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
},
|
|
90
|
+
addImage: () => {
|
|
91
|
+
return this.context.ready.then(() => {
|
|
92
|
+
return this.context.axios
|
|
93
|
+
.upload("/api/v2/pigfarm/feedTower/fodder/photo/add")
|
|
94
|
+
.then((res) => {
|
|
95
|
+
if (res.data.code != 200) {
|
|
96
|
+
throw res.data.message;
|
|
97
|
+
}
|
|
98
|
+
return res.data;
|
|
87
99
|
});
|
|
88
100
|
});
|
|
89
101
|
},
|