package com.zy.core.enums;
|
|
import com.core.exception.CoolException;
|
import com.zy.asrs.utils.Utils;
|
import com.zy.core.model.protocol.SteProtocol;
|
|
public enum SteTaskModeType {
|
|
INIT(0, "初始"), // 初始
|
OUT_RIGHT(1, "右出库"), // 右出库
|
OUT_LEFT(2, "左出库"), // 左出库
|
IN_RIGHT(3, "右入库"), // 右入库
|
IN_LEFT(4, "左入库"), // 左入库
|
MOVE_LEFT(5, "左移库"), // 左移库
|
MOVE_RIGHT(6, "右移库"), // 右移库
|
GO_ORIGIN(7, "去右端"), // 回原点
|
BACK_ORIGIN(8, "去左端"), // 回反原点
|
WAITING_RIGHT(9, "右待机"), // A点
|
WAITING_LEFT(10, "左待机"), // B点
|
// FIT_LEFT(11, "左搬移"), // 左搬移
|
// FIT_RIGHT(12, "右搬移"), // 右搬移
|
CHARGE_LEFT(13, "左充电"), // 左充电
|
CHARGE_RIGHT(14, "右充电"), // 左充电
|
// CHECK_LEFT(14, "左盘点"), // 左盘点
|
// CHECK_RIGHT(15, "右盘点"), // 右盘点
|
CLOSE_CHARGE(17, "断开充电"), // 断开充电
|
;
|
|
public Integer id;
|
public String desc;
|
SteTaskModeType(Integer id, String desc) {
|
this.id = id;
|
this.desc = desc;
|
}
|
|
public static SteTaskModeType get(Short id) {
|
if (null == id) {
|
return null;
|
}
|
for (SteTaskModeType type : SteTaskModeType.values()) {
|
if (type.id.equals(id.intValue())) {
|
return type;
|
}
|
}
|
return null;
|
}
|
|
public static SteTaskModeType get(SteTaskModeType type) {
|
if (null == type) {
|
return null;
|
}
|
for (SteTaskModeType crnTaskModeType : SteTaskModeType.values()) {
|
if (crnTaskModeType == type) {
|
return crnTaskModeType;
|
}
|
}
|
return null;
|
}
|
|
public static SteTaskModeType findInByLoc(String locNo) {
|
switch (Utils.getGroupRow(locNo, true)) {
|
case 4:
|
return SteTaskModeType.IN_LEFT; // 左
|
case 5:
|
return SteTaskModeType.IN_RIGHT; // 右
|
default:
|
throw new CoolException("解析穿梭车原点定位失败");
|
}
|
}
|
|
public static SteTaskModeType findOutByLoc(String locNo) {
|
switch (Utils.getGroupRow(locNo, false)) {
|
case 4:
|
return SteTaskModeType.OUT_LEFT; // 右
|
case 5:
|
return SteTaskModeType.OUT_RIGHT; // 左
|
default:
|
throw new CoolException("解析穿梭车原点定位失败");
|
}
|
}
|
|
|
// -----------------------------------------------
|
|
// 去待搬点
|
public static SteTaskModeType findOriginByLoc(SteProtocol steProtocol) {
|
int row = steProtocol.getRow().intValue();
|
if (Utils.FIRST_GROUP_ROW_LIST.contains(row)) {
|
return SteTaskModeType.GO_ORIGIN;
|
} else if (Utils.SECOND_GROUP_ROW_LIST.contains(row)) {
|
return SteTaskModeType.BACK_ORIGIN;
|
} else {
|
throw new CoolException("解析穿梭车原点定位失败");
|
}
|
}
|
|
public static SteTaskModeType findOriginByLoc(Integer row) {
|
if (Utils.FIRST_GROUP_ROW_LIST.contains(row)) {
|
return SteTaskModeType.GO_ORIGIN;
|
} else if (Utils.SECOND_GROUP_ROW_LIST.contains(row)) {
|
return SteTaskModeType.BACK_ORIGIN;
|
} else {
|
throw new CoolException("解析穿梭车原点定位失败");
|
}
|
}
|
|
|
public static SteTaskModeType findWaiting(Integer row) {
|
if (Utils.FIRST_GROUP_ROW_LIST.contains(row)) {
|
return SteTaskModeType.WAITING_RIGHT;
|
} else if (Utils.SECOND_GROUP_ROW_LIST.contains(row)) {
|
return SteTaskModeType.WAITING_LEFT;
|
} else {
|
throw new CoolException("解析穿梭车原点定位失败");
|
}
|
}
|
|
public static SteTaskModeType findChargeByLoc(Integer row) {
|
if (Utils.FIRST_GROUP_ROW_LIST.contains(row)) {
|
return SteTaskModeType.CHARGE_RIGHT;
|
} else if (Utils.SECOND_GROUP_ROW_LIST.contains(row)) {
|
return SteTaskModeType.CHARGE_LEFT;
|
} else {
|
throw new CoolException("解析穿梭车原点定位失败");
|
}
|
}
|
|
}
|