| | |
| | | }).start(); |
| | | } |
| | | |
| | | export const showLockPath = (nodes, curFloor, setCurSPrite) => { |
| | | const pathLineName = 'lockPath-' + curFloor; |
| | | export const showLockPath = (lockPath, curFloor, setCurSPrite) => { |
| | | const pathLineName = 'lockPath'; |
| | | let pathLine = mapContainer.getChildByName(pathLineName); |
| | | if (pathLine) { |
| | | mapContainer.removeChild(pathLine); |
| | | } |
| | | |
| | | pathLine = new PIXI.Graphics(); |
| | | pathLine.name = pathLineName; |
| | | pathLine.lineStyle(3 * (1 / mapContainer.scale.x), 0xff0000, 0.8); |
| | | pathLine.zIndex = SENSOR_ZINDEX.TRAVEL_PATH; |
| | | let firstNode = true; |
| | | for (let i = 0; i < lockPath.length; i++) { |
| | | const item = lockPath[i] |
| | | if(item.lev != curFloor) {continue} |
| | | const nodes = item.path; |
| | | |
| | | for (let i = 0; i < nodes.length; i++) { |
| | | const node = nodes[i]; |
| | | if (node.z !== curFloor) { continue } |
| | | const shelf = querySprite(SENSOR_TYPE.SHELF, node.x + '-' + node.y); |
| | | if (!shelf) { continue } |
| | | |
| | | let position = shelf.position; |
| | | let x = position.x; |
| | | let y = position.y; |
| | | if (firstNode) { |
| | | pathLine.moveTo(x, y); |
| | | firstNode = false; |
| | | } else { |
| | | pathLine.lineTo(x, y); |
| | | pathLine = new PIXI.Graphics(); |
| | | pathLine.name = pathLineName; |
| | | pathLine.lineStyle(3 * (1 / mapContainer.scale.x), 0xff0000, 0.8); |
| | | pathLine.zIndex = SENSOR_ZINDEX.TRAVEL_PATH; |
| | | let firstNode = true; |
| | | |
| | | for (let i = 0; i < nodes.length; i++) { |
| | | const node = nodes[i]; |
| | | const shelf = querySprite(SENSOR_TYPE.SHELF, node.x + '-' + node.y); |
| | | if (!shelf) { continue } |
| | | |
| | | let position = shelf.position; |
| | | let x = position.x; |
| | | let y = position.y; |
| | | if (firstNode) { |
| | | pathLine.moveTo(x, y); |
| | | firstNode = false; |
| | | } else { |
| | | pathLine.lineTo(x, y); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | mapContainer.addChild(pathLine); |
| | | } |
| | | |
| | | mapContainer.addChild(pathLine); |
| | | } |
| | | |
| | | export const showConveyorSta = (conveyorSta, curFloor, setCurSPrite) => { |
New file |
| | |
| | | package com.zy.asrs.wcs.core.domain.dto; |
| | | |
| | | import com.zy.asrs.wcs.core.model.NavigateNode; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class MapLockPathDto { |
| | | |
| | | //层 |
| | | private Integer lev; |
| | | |
| | | //nodes |
| | | private List<NavigateNode> path; |
| | | |
| | | } |
| | |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoTo); |
| | | dto.setLocNo(standbyLocNoFrom); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | // 提升机空载移动到穿梭车层 |
| | | // 提升机空载移动到目标层 |
| | | motionList.addAll(kernelService.liftMove( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(Utils.getLev(shuttleLocNo)); |
| | | dto.setLev(Utils.getLev(originLoc)); |
| | | })) |
| | | )); |
| | | |
| | |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoTo); |
| | | dto.setLocNo(standbyLocNoFrom); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(liftLocNoTo); |
| | | dto.setLocNo(liftLocNoFrom); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE_TO_LIFT |
| | | )); |
| | |
| | | import com.zy.asrs.wcs.core.entity.BasShuttle; |
| | | import com.zy.asrs.wcs.core.entity.Loc; |
| | | import com.zy.asrs.wcs.core.model.NavigateNode; |
| | | import com.zy.asrs.wcs.core.model.command.LiftAssignCommand; |
| | | import com.zy.asrs.wcs.core.model.command.LiftCommand; |
| | | import com.zy.asrs.wcs.core.model.command.ShuttleAssignCommand; |
| | | import com.zy.asrs.wcs.core.model.command.ShuttleCommand; |
| | | import com.zy.asrs.wcs.core.model.command.*; |
| | | import com.zy.asrs.wcs.core.model.enums.*; |
| | | import com.zy.asrs.wcs.core.service.BasShuttleService; |
| | | import com.zy.asrs.wcs.core.service.LocService; |
| | |
| | | import com.zy.asrs.wcs.rcs.News; |
| | | import com.zy.asrs.wcs.rcs.cache.SlaveConnection; |
| | | import com.zy.asrs.wcs.core.entity.Motion; |
| | | import com.zy.asrs.wcs.rcs.constant.DeviceRedisConstant; |
| | | 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.LiftProtocol; |
| | |
| | | |
| | | if (motion.getOrigin() != null && motion.getTarget() != null) { |
| | | //所使用的路径进行锁定禁用 |
| | | boolean lockResult = navigateMapUtils.writeNavigateNodeToRedisMap(Utils.getLev(motion.getTarget()), shuttleProtocol.getShuttleNo(), assignCommand.getNodes(), true);//所使用的路径进行锁定禁用 |
| | | boolean lockResult = navigateMapUtils.writeNavigateNodeToRedisMap(Utils.getLev(motion.getTarget()), shuttleProtocol.getShuttleNo(), assignCommand.getNodesDeepCopy(), true);//所使用的路径进行锁定禁用 |
| | | if (!lockResult) { |
| | | return false;//锁定失败 |
| | | } |
| | |
| | | package com.zy.asrs.wcs.core.map.entity; |
| | | |
| | | import com.zy.asrs.wcs.core.domain.dto.MapLockPathDto; |
| | | import com.zy.asrs.wcs.core.entity.BasConveyorSta; |
| | | import com.zy.asrs.wcs.core.model.NavigateNode; |
| | | import lombok.Data; |
| | |
| | | |
| | | private List<MapWsShuttleVo> shuttleVos = new ArrayList<>(); |
| | | |
| | | private List<NavigateNode> lockPath = new ArrayList<>(); |
| | | private List<MapLockPathDto> lockPath = new ArrayList<>(); |
| | | |
| | | private List<BasConveyorSta> conveyorSta = new ArrayList<>(); |
| | | |
| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.wcs.core.domain.dto.MapLockPathDto; |
| | | import com.zy.asrs.wcs.core.entity.BasConveyorSta; |
| | | import com.zy.asrs.wcs.core.entity.BasShuttle; |
| | | import com.zy.asrs.wcs.core.map.entity.MapWsShuttleVo; |
| | |
| | | return shuttleVos; |
| | | } |
| | | |
| | | private List<NavigateNode> getMapLocPath() { |
| | | List<NavigateNode> navigateNodes = new ArrayList<>(); |
| | | private List<MapLockPathDto> getMapLocPath() { |
| | | List<MapLockPathDto> list = new ArrayList<>(); |
| | | Dict dict = dictService.getOne(new LambdaQueryWrapper<Dict>() |
| | | .eq(Dict::getFlag, "floor-list") |
| | | .eq(Dict::getStatus, 1)); |
| | |
| | | JSONObject jsonObject = JSON.parseObject(o.toString()); |
| | | Integer lev = jsonObject.getInteger("value"); |
| | | List<NavigateNode> path = navigateMapUtils.getLockPath(lev); |
| | | navigateNodes.addAll(path); |
| | | |
| | | MapLockPathDto lockPathDto = new MapLockPathDto(); |
| | | lockPathDto.setPath(path); |
| | | lockPathDto.setLev(lev); |
| | | list.add(lockPathDto); |
| | | } |
| | | } |
| | | return navigateNodes; |
| | | return list; |
| | | } |
| | | |
| | | private List<BasConveyorSta> getMapConveyorSta() { |
| | |
| | | package com.zy.asrs.wcs.core.model.command; |
| | | |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.core.type.TypeReference; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.zy.asrs.wcs.core.model.NavigateNode; |
| | | import lombok.Data; |
| | | |
| | |
| | | */ |
| | | private List<NavigateNode> nodes; |
| | | |
| | | public List<NavigateNode> getNodesDeepCopy() { |
| | | List<NavigateNode> navigateNodes = new ArrayList<>(); |
| | | for (NavigateNode node : nodes) { |
| | | navigateNodes.add(node.clone()); |
| | | } |
| | | return navigateNodes; |
| | | } |
| | | |
| | | } |
| | |
| | | Object o = redisUtil.get(DeviceRedisConstant.LOCK_PATH + lev); |
| | | List<NavigateNode> navigateNodes = new ArrayList<>(); |
| | | if (o != null) { |
| | | navigateNodes = JSON.parseArray(o.toString(), NavigateNode.class); |
| | | try { |
| | | navigateNodes = objectMapper.readValue(o.toString(), new TypeReference<List<NavigateNode>>() {}); |
| | | } catch (JsonProcessingException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | String nodeStr = null; |
| | | if (lock) { |
| | | navigateNodes.addAll(nodes); |
| | | redisUtil.set(DeviceRedisConstant.LOCK_PATH + lev, JSON.toJSONString(navigateNodes, SerializerFeature.DisableCircularReferenceDetect)); |
| | | try { |
| | | nodeStr = objectMapper.writeValueAsString(navigateNodes); |
| | | } catch (JsonProcessingException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | redisUtil.set(DeviceRedisConstant.LOCK_PATH + lev, nodeStr); |
| | | }else { |
| | | List<NavigateNode> tmp = new ArrayList<>(); |
| | | for (NavigateNode navigateNode : navigateNodes) { |
| | |
| | | } |
| | | } |
| | | |
| | | redisUtil.set(DeviceRedisConstant.LOCK_PATH + lev, JSON.toJSONString(tmp, SerializerFeature.DisableCircularReferenceDetect)); |
| | | try { |
| | | nodeStr = objectMapper.writeValueAsString(tmp); |
| | | } catch (JsonProcessingException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | redisUtil.set(DeviceRedisConstant.LOCK_PATH + lev, nodeStr); |
| | | } |
| | | } |
| | | |
| | |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | return navigateNodes; |
| | | } |
| | | |