|  |  |  | 
|---|
|  |  |  | import com.zy.asrs.wcs.core.service.TaskService; | 
|---|
|  |  |  | import com.zy.asrs.wcs.rcs.cache.SlaveConnection; | 
|---|
|  |  |  | import com.zy.asrs.wcs.rcs.entity.Device; | 
|---|
|  |  |  | import com.zy.asrs.wcs.rcs.model.enums.ShuttleProtocolStatusType; | 
|---|
|  |  |  | import com.zy.asrs.wcs.rcs.model.enums.SlaveType; | 
|---|
|  |  |  | import com.zy.asrs.wcs.rcs.model.protocol.ShuttleProtocol; | 
|---|
|  |  |  | import com.zy.asrs.wcs.rcs.service.DeviceService; | 
|---|
|  |  |  | import com.zy.asrs.wcs.rcs.thread.ShuttleThread; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.ArrayList; | 
|---|
|  |  |  | import java.util.HashMap; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public class Utils { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public static final String _LINK = "-"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public static Integer getStaByLev(Integer lev) { | 
|---|
|  |  |  | HashMap<Integer, Integer> map = new HashMap<>(); | 
|---|
|  |  |  | map.put(1, 31006); | 
|---|
|  |  |  | map.put(2, 31007); | 
|---|
|  |  |  | map.put(3, 31008); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return map.get(lev); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 通过库位号获取 排 | 
|---|
|  |  |  | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (shuttleProtocol.getProtocolStatusType().equals(ShuttleProtocolStatusType.OFFLINE)) { | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (shuttleProtocol.getCurrentLocNo() == null) { | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (shuttleProtocol.getCurrentLocNo().equals(locNo)) { | 
|---|
|  |  |  | return true; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 检测穿梭车是否有任务绑定 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public static boolean checkShuttleHasBinding(Device device) { | 
|---|
|  |  |  | public static boolean checkShuttleHasBinding(Device device, String taskNo) { | 
|---|
|  |  |  | TaskService taskService = SpringUtils.getBean(TaskService.class); | 
|---|
|  |  |  | List<Task> tasks = taskService.selectWorkingByShuttle(Integer.parseInt(device.getDeviceNo())); | 
|---|
|  |  |  | List<Task> tasks = taskService.selectWorkingByShuttle(Integer.parseInt(device.getDeviceNo()), taskNo); | 
|---|
|  |  |  | if (tasks.isEmpty()) { | 
|---|
|  |  |  | return false;//无任务绑定 | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | * 检测提升机是否有任务绑定 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public static boolean checkLiftHasBinding(Integer liftNo) { | 
|---|
|  |  |  | return checkLiftHasBinding(liftNo, null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 检测提升机是否有任务绑定 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public static boolean checkLiftHasBinding(Integer liftNo, String taskNo) { | 
|---|
|  |  |  | TaskService taskService = SpringUtils.getBean(TaskService.class); | 
|---|
|  |  |  | List<Task> tasks = taskService.selectWorkingByLift(liftNo); | 
|---|
|  |  |  | List<Task> tasks = taskService.selectWorkingByLift(liftNo, taskNo); | 
|---|
|  |  |  | if (tasks.isEmpty()) { | 
|---|
|  |  |  | return false;//无任务绑定 | 
|---|
|  |  |  | } | 
|---|