@cpzxrobot/sdk 1.3.81 → 1.3.83

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/device_gateway.ts CHANGED
@@ -1112,15 +1112,6 @@ export class DeviceGateway extends Object {
1112
1112
  if (topN !== undefined && topN <= 0) {
1113
1113
  throw new Error('topN参数必须大于0');
1114
1114
  }
1115
- if (fromDate && !this.isValidDateTime(fromDate)) {
1116
- throw new Error('fromDate参数格式错误,应为YYYY-MM-DD HH:mm:ss格式');
1117
- }
1118
- if (toDate && !this.isValidDateTime(toDate)) {
1119
- throw new Error('toDate参数格式错误,应为YYYY-MM-DD HH:mm:ss格式');
1120
- }
1121
- if (fromDate && toDate && fromDate > toDate) {
1122
- throw new Error('fromDate不能晚于toDate');
1123
- }
1124
1115
 
1125
1116
  // 构建请求参数
1126
1117
  const params: any = { factoryId: _factoryId };
@@ -1144,19 +1135,5 @@ export class DeviceGateway extends Object {
1144
1135
  });
1145
1136
  }
1146
1137
 
1147
- /**
1148
- * 验证日期时间格式(YYYY-MM-DD HH:mm:ss)
1149
- * @param dateTime 日期时间字符串
1150
- * @returns 是否有效
1151
- */
1152
- private isValidDateTime(dateTime: string): boolean {
1153
- const regex = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/;
1154
- if (!regex.test(dateTime)) {
1155
- return false;
1156
- }
1157
-
1158
- const date = new Date(dateTime);
1159
- return !isNaN(date.getTime());
1160
- }
1161
1138
 
1162
1139
  }
@@ -892,15 +892,6 @@ class DeviceGateway extends Object {
892
892
  if (topN !== undefined && topN <= 0) {
893
893
  throw new Error('topN参数必须大于0');
894
894
  }
895
- if (fromDate && !this.isValidDateTime(fromDate)) {
896
- throw new Error('fromDate参数格式错误,应为YYYY-MM-DD HH:mm:ss格式');
897
- }
898
- if (toDate && !this.isValidDateTime(toDate)) {
899
- throw new Error('toDate参数格式错误,应为YYYY-MM-DD HH:mm:ss格式');
900
- }
901
- if (fromDate && toDate && fromDate > toDate) {
902
- throw new Error('fromDate不能晚于toDate');
903
- }
904
895
  // 构建请求参数
905
896
  const params = { factoryId: _factoryId };
906
897
  if (topN !== undefined) {
@@ -922,18 +913,5 @@ class DeviceGateway extends Object {
922
913
  });
923
914
  });
924
915
  }
925
- /**
926
- * 验证日期时间格式(YYYY-MM-DD HH:mm:ss)
927
- * @param dateTime 日期时间字符串
928
- * @returns 是否有效
929
- */
930
- isValidDateTime(dateTime) {
931
- const regex = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/;
932
- if (!regex.test(dateTime)) {
933
- return false;
934
- }
935
- const date = new Date(dateTime);
936
- return !isNaN(date.getTime());
937
- }
938
916
  }
939
917
  exports.DeviceGateway = DeviceGateway;
@@ -129,10 +129,10 @@ class FactoryGateway extends Object {
129
129
  };
130
130
  }
131
131
  //获得工厂的所有车间信息
132
- workshops(id) {
132
+ workshops(id, tags) {
133
133
  return __awaiter(this, void 0, void 0, function* () {
134
134
  var axios = yield this.context.ready;
135
- const response = yield axios.get(`/api/v1/factory/${id}/workshops`);
135
+ const response = yield axios.get(`/api/v1/factory/${id}/workshops?tags=${tags === null || tags === void 0 ? void 0 : tags.join(',')}`);
136
136
  return response.data;
137
137
  });
138
138
  }
@@ -115,9 +115,9 @@ export class FactoryGateway extends Object {
115
115
  }
116
116
 
117
117
  //获得工厂的所有车间信息
118
- async workshops(id: number): Promise<any> {
118
+ async workshops(id: number, tags?: string[]): Promise<any> {
119
119
  var axios = await this.context.ready;
120
- const response = await axios.get(`/api/v1/factory/${id}/workshops`);
120
+ const response = await axios.get(`/api/v1/factory/${id}/workshops?tags=${tags?.join(',')}`);
121
121
  return response.data;
122
122
  }
123
123
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.3.81",
3
+ "version": "1.3.83",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/types.d.ts CHANGED
@@ -385,6 +385,8 @@ interface DeviceAlarmStats {
385
385
  averageResolveTime: number;
386
386
  /** 最大解决时间(秒) */
387
387
  maxResolveTime: number;
388
+ /** 最大解决Id */
389
+ maxResolveId: number;
388
390
  }
389
391
 
390
392
  /**