package com.zy.asrs.wcs.core.model.enums;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.zy.asrs.framework.common.SpringUtils;
|
import com.zy.asrs.wcs.core.entity.Loc;
|
import com.zy.asrs.wcs.core.service.LocService;
|
import com.zy.asrs.wcs.core.utils.Utils;
|
|
public enum LiftCodeType {
|
|
NONE(-1, -1, "未知", "0402001"),
|
LIFT_2(2, 198, "2号提升机二维码", "0402001"),
|
LIFT_1(1, 0, "1号提升机无二维码", "0800701"),
|
;
|
|
public Integer liftNo;
|
public Integer code;
|
public String desc;
|
public String standbyLocNo;//待机库位
|
|
LiftCodeType(Integer liftNo, Integer code, String desc, String standbyLocNo) {
|
this.liftNo = liftNo;
|
this.code = code;
|
this.desc = desc;
|
this.standbyLocNo = standbyLocNo;
|
}
|
|
public static LiftCodeType query(Integer code) {
|
for (LiftCodeType value : LiftCodeType.values()) {
|
if (value.code.equals(code)) {
|
return value;
|
}
|
}
|
return NONE;
|
}
|
|
public static String getLocNo(Integer liftNo, Integer lev, Long hostId) {
|
LiftCodeType type = null;
|
for (LiftCodeType value : LiftCodeType.values()) {
|
if (value.liftNo.equals(liftNo)) {
|
type = value;
|
break;
|
}
|
}
|
|
if (type == null) {
|
return null;
|
}
|
|
LocService locService = SpringUtils.getBean(LocService.class);
|
Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>()
|
.eq(Loc::getHostId, hostId)
|
.eq(Loc::getCode, type.code)
|
.eq(Loc::getLev, lev));
|
if (loc == null) {
|
return null;
|
}
|
|
return loc.getLocNo();
|
}
|
|
|
public static String getStandbyLocNo(Integer liftNo, Integer lev) {
|
LiftCodeType type = null;
|
for (LiftCodeType value : LiftCodeType.values()) {
|
if (value.liftNo.equals(liftNo)) {
|
type = value;
|
break;
|
}
|
}
|
|
if (type == null) {
|
return null;
|
}
|
|
return Utils.getLocNo(Utils.getRow(type.standbyLocNo), Utils.getBay(type.standbyLocNo), lev);
|
}
|
|
}
|