pda_template/lib/app/enum/stand.dart

26 lines
739 B
Dart
Raw Normal View History

enum Stand {
stand1(point: "P1", message: "1号拣选站台"),
stand2(point: "P2", message: "2号拣选站台"),
stand3(point: "P3", message: "3号拣选站台"),
stand4(point: "R1", message: "1号入库站台");
final String point;
final String message;
const Stand({required this.point, required this.message});
static Stand? getStandByCode(String point) {
return Stand.values.firstWhere(
(stand) => stand.point == point,
orElse: () => throw Exception('未找到对应的站台'),
);
}
static Stand? getStandByMessage(String message) {
return Stand.values.firstWhere(
(stand) => stand.message == message,
orElse: () => throw Exception('未找到对应的站台'),
);
}
}