26 lines
951 B
Dart
26 lines
951 B
Dart
/// routeIds 的顺序就是机器人执行顺序,不排序、不转换为设备数据库主键。
|
|
class ConsecutiveTaskRequest {
|
|
ConsecutiveTaskRequest({
|
|
required this.deviceId,
|
|
required List<int> routeIds,
|
|
required this.orgId,
|
|
required this.siteId,
|
|
}) : routeIds = List.unmodifiable(routeIds);
|
|
|
|
final String deviceId;
|
|
final List<int> routeIds;
|
|
final int orgId;
|
|
final int siteId;
|
|
|
|
String? get validationError {
|
|
if (deviceId.trim().isEmpty || int.tryParse(deviceId.trim()) != null) {
|
|
return '请选择有效的机器人设备编码';
|
|
}
|
|
if (siteId <= 0 || orgId <= 0) return '场站或组织信息无效,请重新选择场站';
|
|
if (routeIds.isEmpty) return '请至少选择一条区域内的路线';
|
|
if (routeIds.any((id) => id <= 0)) return '路线信息无效,请重新选择';
|
|
if (routeIds.toSet().length != routeIds.length) return '执行路线不能重复';
|
|
return null;
|
|
}
|
|
}
|