| | |
| | | import io.netty.util.internal.StringUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | * 播种墙拍灯,ESS调用 |
| | | */ |
| | | @PostMapping("/light/off") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R lightOff(@RequestBody Map<String, Object> request) { |
| | | if (Objects.isNull(request)) { |
| | | throw new CoolException("参数不能为空!!"); |
| | |
| | | throw new CoolException("当前站点不存在!!"); |
| | | } |
| | | |
| | | List<WaveSeed> waveSeed = waveSeedService.list(new LambdaQueryWrapper<WaveSeed>().eq(WaveSeed::getSiteNo, request.get("tagCode").toString())); |
| | | WaveSeed waveSeed = waveSeedService.getOne(new LambdaQueryWrapper<WaveSeed>() |
| | | .eq(WaveSeed::getExceStatus, 1) |
| | | .eq(WaveSeed::getSiteNo, request.get("tagCode").toString()), false); |
| | | if (Objects.isNull(waveSeed)) { |
| | | throw new CoolException("播种墙地标未绑定!!"); |
| | | } |
| | | |
| | | List<Long> taskIds = waveSeed.stream().map(WaveSeed::getTaskId).collect(Collectors.toList()); |
| | | |
| | | // 根据播种站点信息条码,查任务 |
| | | List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>().in(Task::getId, taskIds)); |
| | | if (tasks.isEmpty()) { |
| | | Task task = taskService.getOne(new LambdaQueryWrapper<Task>().eq(Task::getId, waveSeed.getTaskId())); |
| | | if (Objects.isNull(task)) { |
| | | throw new CoolException("当前站点任务不存在!!"); |
| | | } |
| | | |
| | | List<String> taskNos = tasks.stream().map(Task::getTaskNo).collect(Collectors.toList()); |
| | | |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("taskNo", taskNos); |
| | | param.put("taskNo", task.getTaskNo()); |
| | | param.put("siteNo", cacheSite.getSiteNo()); |
| | | param.put("weedId", waveSeed.getId()); |
| | | param.put("orderNo",cacheSite.getOrderNo()); |
| | | |
| | | waveSeed.setExceStatus(0); |
| | | if (!waveSeedService.updateById(waveSeed)) { |
| | | throw new CoolException("播种状态修改失败!!"); |
| | | } |
| | | |
| | | return wcsApiService.slapLightLogic(param); |
| | | } |
| | | |