| | |
| | | import com.zy.acs.common.utils.GsonUtils; |
| | | import com.zy.acs.common.utils.Utils; |
| | | import com.zy.acs.framework.common.Cools; |
| | | import com.zy.acs.framework.common.R; |
| | | import com.zy.acs.framework.common.SnowflakeIdWorker; |
| | | import com.zy.acs.framework.exception.CoolException; |
| | | import com.zy.acs.manager.common.domain.TaskDto; |
| | |
| | | import com.zy.acs.manager.core.domain.TaskPosDto; |
| | | import com.zy.acs.manager.core.service.astart.MapDataDispatcher; |
| | | import com.zy.acs.manager.core.utils.HttpHandler; |
| | | import com.zy.acs.manager.manager.controller.param.LocSiteParams; |
| | | import com.zy.acs.manager.manager.controller.param.OpenBusSubmitParam; |
| | | import com.zy.acs.manager.manager.entity.*; |
| | | import com.zy.acs.manager.manager.enums.*; |
| | | import com.zy.acs.manager.manager.service.*; |
| | | import com.zy.acs.manager.manager.service.impl.LocStsServiceImpl; |
| | | import com.zy.acs.manager.manager.service.impl.WebsocketServiceImpl; |
| | | import com.zy.acs.manager.manager.utils.ActionSorter; |
| | | import com.zy.acs.manager.system.service.ConfigService; |
| | |
| | | private TaskReportService taskReportService; |
| | | @Autowired |
| | | private AgvDurationService agvDurationService; |
| | | @Autowired |
| | | private LocStsService locStsService; |
| | | |
| | | @SuppressWarnings("all") |
| | | @Transactional |
| | |
| | | agvId, // AGV |
| | | now // 工作时间 |
| | | )); |
| | | log.info("1TurnCorner posType={}, code={}, corner={}, nextDirection={}, finalAngle={}", |
| | | Objects.requireNonNull(TaskPosDto.queryPosType(segment.getPosType())), |
| | | lastCode.getData(), |
| | | lastCode.getCornerBool(), |
| | | nextDirection, |
| | | 180); |
| | | } else { |
| | | // turn |
| | | actionList.add(new Action( |
| | |
| | | agvId, // AGV |
| | | now // 工作时间 |
| | | )); |
| | | log.info("2TurnCorner posType={}, code={}, corner={}, nextDirection={}, finalAngle={}", |
| | | Objects.requireNonNull(TaskPosDto.queryPosType(segment.getPosType())), |
| | | lastCode.getData(), |
| | | lastCode.getCornerBool(), |
| | | nextDirection, |
| | | nextDirection); |
| | | } |
| | | lastDirection = nextDirection; |
| | | } |
| | |
| | | agvId, // AGV |
| | | now // 工作时间 |
| | | )); |
| | | log.info("3TurnCorner posType={}, code={}, corner={}, nextDirection={}, finalAngle={}", |
| | | Objects.requireNonNull(TaskPosDto.queryPosType(segment.getPosType())), |
| | | lastCode.getData(), |
| | | lastCode.getCornerBool(), |
| | | nextDirection, |
| | | 180); |
| | | } |
| | | } |
| | | } |
| | |
| | | agvId, // AGV |
| | | now // 工作时间 |
| | | )); |
| | | log.info("4TurnCorner posType={}, code={}, corner={}, nextDirection={}, finalAngle={}", |
| | | Objects.requireNonNull(TaskPosDto.queryPosType(segment.getPosType())), |
| | | lastCode.getData(), |
| | | lastCode.getCornerBool(), |
| | | nextDirection, |
| | | nextDirection); |
| | | |
| | | lastDirection = nextDirection; |
| | | } |
| | |
| | | if (first) { |
| | | if (Cools.isEmpty(actionList) || !actionList.get(0).getActionType().equals(ActionTypeType.TurnCorner.val())) { |
| | | Double turnDirection = workDirection; |
| | | List<String> list = Arrays.asList("00000051", "00000052", "00000053", "00000054"); |
| | | List<String> list = Arrays.asList("00000050","00000051", "00000052", "00000053", "00000054"); |
| | | if ((Objects.requireNonNull(TaskPosDto.queryPosType(segment.getPosType())).equals(TaskPosDto.PosType.ORI_STA) |
| | | || Objects.requireNonNull(TaskPosDto.queryPosType(segment.getPosType())) |
| | | .equals(TaskPosDto.PosType.DEST_STA)) && list.contains(lastCode.getData())) { |
| | |
| | | agvId, // AGV |
| | | now // 工作时间 |
| | | )); |
| | | log.info("5TurnCorner posType={}, code={}, corner={}, nextDirection={}, finalAngle={}", |
| | | Objects.requireNonNull(TaskPosDto.queryPosType(segment.getPosType())), |
| | | lastCode.getData(), |
| | | lastCode.getCornerBool(), |
| | | null, |
| | | turnDirection); |
| | | lastDirection = workDirection; |
| | | } |
| | | } |
| | |
| | | assert backpackType != null; |
| | | // 检验方向 |
| | | if (!lastDirection.equals(workDirection)) { |
| | | throw new CoolException(agvNo + "号小车方向错误,请推至转弯点手动调整"); |
| | | lastDirection = workDirection; |
| | | // throw new CoolException(agvNo agvNo+ "号小车方向错误,请推至转弯点手动调整"); |
| | | } |
| | | // 货架取货 |
| | | Loc oriLoc = locService.getById(task.getOriLoc()); |
| | |
| | | assert backpackType != null; |
| | | // 检验方向 |
| | | if (!lastDirection.equals(workDirection)) { |
| | | throw new CoolException(agvNo + "号小车方向错误,请推至转弯点手动调整"); |
| | | lastDirection = workDirection; |
| | | // throw new CoolException(agvNo + "号小车方向错误,请推至转弯点手动调整"); |
| | | } |
| | | // 暂存点取货货 |
| | | actionList.add(new Action( |
| | |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @date 2025/11/10 |
| | | * @description: 修改库位状态 |
| | | * @version 1.0 |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R modifyStatus(LocSiteParams params) { |
| | | if (Objects.isNull(params.getStatus())) { |
| | | return R.error("修改状态不能为空!!"); |
| | | } |
| | | LocSts locSts = locStsService.getOne(new LambdaQueryWrapper<LocSts>().eq(LocSts::getUuid, params.getStatus())); |
| | | if (Objects.isNull(locSts)) { |
| | | return R.error("数据错误,未找到对应工作状态!!"); |
| | | } |
| | | if (params.getType().equals("loc")) { |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, params.getCode())); |
| | | if (Objects.isNull(loc)) { |
| | | return R.error("库位信息不存在!!"); |
| | | } |
| | | loc.setLocSts(locSts.getId()); |
| | | if (!locService.updateById(loc)) { |
| | | return R.ok("库位状态修改失败!!"); |
| | | } |
| | | } else { |
| | | Sta sta = staService.getOne(new LambdaQueryWrapper<Sta>().eq(Sta::getStaNo, params.getCode())); |
| | | if (Objects.isNull(sta)) { |
| | | return R.error("站点信息不存在!!"); |
| | | } |
| | | sta.setStatus(locSts.getStatus()); |
| | | if (!staService.updateById(sta)) { |
| | | return R.error("站点状态修改失败!!"); |
| | | } |
| | | } |
| | | return R.ok(); |
| | | } |
| | | } |