| | |
| | | package com.zy.asrs.wcs.core.action; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zy.asrs.wcs.core.entity.Task; |
| | | import com.zy.asrs.wcs.core.model.command.*; |
| | | import com.zy.asrs.wcs.core.model.enums.LiftCommandModeType; |
| | | import com.zy.asrs.wcs.core.service.TaskService; |
| | | import com.zy.asrs.wcs.core.utils.RedisUtil; |
| | | import com.zy.asrs.wcs.rcs.News; |
| | | import com.zy.asrs.wcs.rcs.cache.SlaveConnection; |
| | |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | @Autowired |
| | | private TaskService taskService; |
| | | |
| | | public synchronized boolean assignWork(Device device, LiftAssignCommand assignCommand) { |
| | | LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, device.getId().intValue()); |
| | |
| | | public synchronized boolean executeWork(Device device, Integer taskNo) { |
| | | Object obj = redisUtil.get(DeviceRedisConstant.LIFT_WORK_FLAG + taskNo); |
| | | if (obj == null) { |
| | | return false; |
| | | } |
| | | |
| | | Task task = taskService.getOne(new LambdaQueryWrapper<Task>().eq(Task::getTaskNo, taskNo)); |
| | | if (task == null) { |
| | | return false; |
| | | } |
| | | |
| | |
| | | if (liftProtocol.getLev() == command.getTargetLev()) { |
| | | command.setComplete(true); |
| | | } |
| | | |
| | | if (task.getTaskSts() < 100) {//入库判断托盘是否进入提升机 |
| | | if (!liftProtocol.getHasTray()) { |
| | | return false; |
| | | } |
| | | } else if (task.getTaskSts() >= 100 && task.getTaskSts() < 200) {//出库判断托盘是否离开提升机 |
| | | if (liftProtocol.getHasTray()) { |
| | | return false; |
| | | } |
| | | } |
| | | } else if (command.getMode() == LiftCommandModeType.RESET.id) { |
| | | //复位 |
| | | command.setComplete(true); |