| | |
| | | |
| | | |
| | | private void simulateWalking(Agv agv, AgvDetail agvDetail, Action action) throws InterruptedException { |
| | | Code code = codeService.selectByData(action.getCode()); |
| | | Code code = codeService.getCacheByData(action.getCode()); |
| | | agvDetail.setPos(1); |
| | | agvDetail.setCode(code.getId()); |
| | | // 模拟电量消耗 |
| | |
| | | return null; |
| | | } |
| | | Date now = new Date(); |
| | | Code code = codeService.selectByData(currCodeData); |
| | | Code code = codeService.getCacheByData(currCodeData); |
| | | List<Jam> jams = this.list(new LambdaQueryWrapper<Jam>() |
| | | .eq(Jam::getAvoAgv, avoAgv) |
| | | .eq(Jam::getAvoCode, code.getId()) |
| | |
| | | avoidWaveCalculator.calcDynamicNodeWhenBoot(); |
| | | |
| | | // AgvDetail agvDetail11 = agvDetailService.selectByAgvNo("11"); |
| | | // agvDetail11.setCode(codeService.selectByData("00000251").getId()); |
| | | // agvDetail11.setCode(codeService.getCacheByData("00000251").getId()); |
| | | // agvDetailService.updateById(agvDetail11); |
| | | // |
| | | // AgvDetail agvDetail12 = agvDetailService.selectByAgvNo("12"); |
| | | // agvDetail12.setCode(codeService.selectByData("00000204").getId()); |
| | | // agvDetail12.setCode(codeService.getCacheByData("00000204").getId()); |
| | | // agvDetailService.updateById(agvDetail12); |
| | | // |
| | | // AgvDetail agvDetail14 = agvDetailService.selectByAgvNo("14"); |
| | | // agvDetail14.setCode(codeService.selectByData("00000101").getId()); |
| | | // agvDetail14.setCode(codeService.getCacheByData("00000101").getId()); |
| | | // agvDetailService.updateById(agvDetail14); |
| | | // |
| | | // avoidWaveCalculator.calcDynamicNodeWhenBoot(); |
| | | // |
| | | // mainLockWrapService.buildMinorTask(agvService.getById(agvDetail14.getAgvId()), TaskTypeType.MOVE, |
| | | // codeService.selectByData("00000303").getData(), null); |
| | | // codeService.getCacheByData("00000303").getData(), null); |
| | | // mainLockWrapService.buildMinorTask(agvService.getById(agvDetail11.getAgvId()), TaskTypeType.MOVE, |
| | | // codeService.selectByData("00000411").getData(), null); |
| | | // codeService.getCacheByData("00000411").getData(), null); |
| | | // mainLockWrapService.buildMinorTask(agvService.getById(agvDetail12.getAgvId()), TaskTypeType.MOVE, |
| | | // codeService.selectByData("00000403").getData(), null); |
| | | // codeService.getCacheByData("00000403").getData(), null); |
| | | |
| | | return R.ok(); |
| | | } |
| | |
| | | public R astarDemo() { |
| | | long startTime = System.currentTimeMillis(); |
| | | List<String> path = mapService.checkoutPath("18" |
| | | , codeService.selectByData("00001318") |
| | | , codeService.selectByData("00003447") |
| | | , codeService.getCacheByData("00001318") |
| | | , codeService.getCacheByData("00003447") |
| | | , true |
| | | , new ArrayList<>() |
| | | , segmentService.getById(1390)); |
| | |
| | | endCode = codeService.getById(param.getEndCode()); |
| | | } |
| | | if (!Cools.isEmpty(param.getEndCodeStr())) { |
| | | endCode = codeService.selectByData(param.getEndCodeStr()); |
| | | endCode = codeService.getCacheByData(param.getEndCodeStr()); |
| | | } |
| | | if (null == endCode) { |
| | | return R.error(); |
| | |
| | | continue; |
| | | } |
| | | String codeData = codeMatrix[i][j]; |
| | | Code code = codeService.selectByData(codeData); |
| | | Code code = codeService.getCacheByData(codeData); |
| | | if (null == code) { |
| | | continue; |
| | | } |
| | |
| | | private void sync(AGV_12_UP mesBody, AgvDetail detail) { |
| | | detail.setStatus(mesBody.getStatus()); |
| | | |
| | | Code code = codeService.selectByData(mesBody.getQrCode()); |
| | | Code code = codeService.getCacheByData(mesBody.getQrCode()); |
| | | if (null != code) { |
| | | detail.setCode(code.getId()); |
| | | detail.setLastCode(null); |
| | |
| | | private void sync(AGV_13_UP mesBody, AgvDetail detail) { |
| | | detail.setStatus(mesBody.getStatus()); |
| | | |
| | | Code code = codeService.selectByData(mesBody.getQrCode()); |
| | | Code code = codeService.getCacheByData(mesBody.getQrCode()); |
| | | if (null != code) { |
| | | |
| | | if (!detail.getAgvStatus().equals(AgvStatusType.CHARGE)) { |
| | |
| | | return true; |
| | | } |
| | | |
| | | Code parentCode = codeService.selectByData(parent); |
| | | Code currentCode = codeService.selectByData(current); |
| | | Code neighborCode = codeService.selectByData(neighbor); |
| | | Code parentCode = codeService.getCacheByData(parent); |
| | | Code currentCode = codeService.getCacheByData(current); |
| | | Code neighborCode = codeService.getCacheByData(neighbor); |
| | | |
| | | double direction1 = this.calculateDirection(parentCode, currentCode); |
| | | double direction2 = this.calculateDirection(currentCode, neighborCode); |
| | |
| | | } |
| | | break; |
| | | case MOVE: |
| | | endCode = codeService.selectByData(destination); |
| | | endCode = codeService.getCacheByData(destination); |
| | | break; |
| | | default: |
| | | return false; |
| | |
| | | |
| | | String next = pathListPart.get(i); |
| | | |
| | | Code nextCode = codeService.selectByData(next); |
| | | Code nextCode = codeService.getCacheByData(next); |
| | | Double nextDirection = mapService.calculateDirection(lastCode, nextCode, angleOffsetVal); |
| | | |
| | | boolean reverse = false; |
| | |
| | | |
| | | } |
| | | |
| | | Code code = codeService.selectByData(node.getCodeData()); |
| | | Code code = codeService.getCacheByData(node.getCodeData()); |
| | | |
| | | // judge whether the node has already been marked as a retreat node? |
| | | // This is a very troublesome matter, if the node be repeatedly mark as a retreat node |
| | |
| | | String lastCodeData = pathList.get(pathList.size() - 1); |
| | | if (!endCode.getData().equals(lastCodeData)) { |
| | | // slice |
| | | Code lastCode = codeService.selectByData(lastCodeData); |
| | | Code lastCode = codeService.getCacheByData(lastCodeData); |
| | | |
| | | // if (pathList.size() <= MIN_SLICE_PATH_LENGTH) { |
| | | // return; |
| | |
| | | List<Segment> waitingSegList = segmentService.getJustWaitingSeg(blockAgvId); |
| | | if (null != waitingSegList |
| | | && waitingSegList.stream().anyMatch( |
| | | waitingSeg -> waitingSeg.getEndNode().equals(codeService.selectByData(blockAgvCode).getId()) |
| | | waitingSeg -> waitingSeg.getEndNode().equals(codeService.getCacheByData(blockAgvCode).getId()) |
| | | )) { |
| | | maxJamTimeoutFactor = 1; |
| | | break; |
| | |
| | | } |
| | | |
| | | String endCodeData = finalNode.getCodeData(); |
| | | Code endCode = codeService.selectByData(endCodeData); |
| | | Code endCode = codeService.getCacheByData(endCodeData); |
| | | |
| | | List<Segment> waitingSegList = segmentService.getByAgvAndState(agv.getId(), SegmentStateType.WAITING.toString()); |
| | | if (!Cools.isEmpty(waitingSegList)) { |
| | |
| | | cdaArr.add(yIdxList.get(i)); |
| | | cdaMatrix[i][j] = JSON.toJSONString(cdaArr); |
| | | } else { |
| | | Code currCode = codeService.selectByData(codeMatrix[i][j]); |
| | | Code currCode = codeService.getCacheByData(codeMatrix[i][j]); |
| | | if (null != currCode) { |
| | | List<Double> cdaArr = new ArrayList<>(); |
| | | cdaArr.add(currCode.getX()); |
| | |
| | | if (CodeNodeType.NONE.val.equals(codeMatrix[i][j])) { |
| | | turnMatrix[i][j] = TurnNodeType.NONE.val; |
| | | } else { |
| | | Code currCode = codeService.selectByData(codeMatrix[i][j]); |
| | | Code currCode = codeService.getCacheByData(codeMatrix[i][j]); |
| | | List<String> neighborCodeList = routeService.findCodeDataOfSingle(currCode.getId()); |
| | | |
| | | switch (neighborCodeList.size()) { |
| | |
| | | if (currentCodeData == null || CodeNodeType.NONE.val.equals(currentCodeData)) { |
| | | continue; |
| | | } |
| | | Code currCode = codeService.selectByData(currentCodeData); |
| | | Code currCode = codeService.getCacheByData(currentCodeData); |
| | | |
| | | // 检查右边相邻条码 |
| | | if (j + 1 < cols) { |
| | | String rightCodeData = codeMatrix[i][j + 1]; |
| | | if (!Cools.isEmpty(rightCodeData) && !CodeNodeType.NONE.val.equals(rightCodeData)) { |
| | | Code rightCode = codeService.selectByData(rightCodeData); |
| | | Code rightCode = codeService.getCacheByData(rightCodeData); |
| | | list.add(currCode.getData() + "-" + rightCode.getData()); |
| | | routeService.createRouteByCode(currCode, rightCode, 0, null); |
| | | codeGapService.createCodeGapByCode(currCode, rightCode, null); |
| | |
| | | if (i + 1 < rows) { |
| | | String bottomCodeData = codeMatrix[i + 1][j]; |
| | | if (!Cools.isEmpty(bottomCodeData) && !CodeNodeType.NONE.val.equals(bottomCodeData)) { |
| | | Code bottomCode = codeService.selectByData(bottomCodeData); |
| | | Code bottomCode = codeService.getCacheByData(bottomCodeData); |
| | | list.add(currCode.getData() + "-" + bottomCode.getData()); |
| | | routeService.createRouteByCode(currCode, bottomCode, 0, null); |
| | | codeGapService.createCodeGapByCode(currCode, bottomCode, null); |
| | |
| | | |
| | | |
| | | private void simulateWalking(Agv agv, Action action) throws InterruptedException { |
| | | Code code = codeService.selectByData(action.getCode()); |
| | | Code code = codeService.getCacheByData(action.getCode()); |
| | | // agvDetail.setPos(1); |
| | | // agvDetail.setCode(code.getId()); |
| | | // 模拟电量消耗 |
| | |
| | | Date now = new Date(); Long userId = getLoginUserId(); |
| | | for (Map<String, Object> map : list) { |
| | | Code code = Cools.conver(map, Code.class); |
| | | if (null != codeService.selectByData(code.getData())) { |
| | | if (null != codeService.getCacheByData(code.getData())) { |
| | | continue; |
| | | } |
| | | code.setData(Utils.zeroFill(code.getData(), CommonConstant.QR_CODE_LEN)); |
| | |
| | | if (Cools.isEmpty(codeData)) { |
| | | return R.error(); |
| | | } |
| | | Code code = codeService.selectByData(codeData); |
| | | Code code = codeService.getCacheByData(codeData); |
| | | MapPointVo vo = new MapPointVo(); |
| | | vo.setCodeId(code.getId()); |
| | | vo.setCodeData(code.getData()); |
| | |
| | | List<Code> codes = codeService.list(); |
| | | List<Code> codeArr = param.getCodeArr(); |
| | | for (Code code : codeArr) { |
| | | Code one = codeService.selectByData(code.getData()); |
| | | Code one = codeService.getCacheByData(code.getData()); |
| | | if (one == null) { |
| | | if (!codeService.save(code)) { |
| | | throw new BusinessException(code.getData()+" save fail![Code]"); |
| | |
| | | |
| | | List<MapParam.Route> routeArr = param.getRouteArr(); |
| | | for (MapParam.Route paramRoute : routeArr) { |
| | | Code startCode = codeService.selectByData(paramRoute.getStartCode()); |
| | | Code endCode = codeService.selectByData(paramRoute.getEndCode()); |
| | | Code startCode = codeService.getCacheByData(paramRoute.getStartCode()); |
| | | Code endCode = codeService.getCacheByData(paramRoute.getEndCode()); |
| | | |
| | | Route route = routeService.findByCodeOfBoth(startCode.getId(), endCode.getId()); |
| | | if (route == null) { |
| | |
| | | if (Cools.isEmpty(agvParam.getPos())) { |
| | | throw new BusinessException(agvParam.getAgvNo() + " agv not in position!"); |
| | | } |
| | | Code code = codeService.selectByData(agvParam.getPos()); |
| | | Code code = codeService.getCacheByData(agvParam.getPos()); |
| | | Agv agv = agvService.selectByUuid(agvParam.getAgvNo()); |
| | | if (agv == null) { |
| | | agv = new Agv(); |
| | |
| | | } |
| | | RouteExcel excelDto = Cools.conver(one, RouteExcel.class); |
| | | |
| | | Code code0 = codeService.selectByData(Utils.zeroFill(excelDto.getStartCode(), CommonConstant.QR_CODE_LEN)); |
| | | Code code1 = codeService.selectByData(Utils.zeroFill(excelDto.getEndCode(), CommonConstant.QR_CODE_LEN)); |
| | | Code code0 = codeService.getCacheByData(Utils.zeroFill(excelDto.getStartCode(), CommonConstant.QR_CODE_LEN)); |
| | | Code code1 = codeService.getCacheByData(Utils.zeroFill(excelDto.getEndCode(), CommonConstant.QR_CODE_LEN)); |
| | | |
| | | if (null == code0 || null == code1) { continue; } |
| | | |
| | |
| | | import com.zy.acs.manager.manager.service.CodeGapService; |
| | | import com.zy.acs.manager.manager.service.CodeService; |
| | | import com.zy.acs.manager.manager.service.RouteService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Slf4j |
| | | @Service("codeService") |
| | | public class CodeServiceImpl extends ServiceImpl<CodeMapper, Code> implements CodeService { |
| | | |
| | |
| | | CODE_ID_CACHE.put(code.getId(), code); |
| | | CODE_DATA_CACHE.put(code.getData(), code); |
| | | } |
| | | log.info("The code cache was initialized..."); |
| | | } |
| | | |
| | | @Override |
| | |
| | | return null; |
| | | } |
| | | Date now = new Date(); |
| | | Code code = codeService.selectByData(currCodeData); |
| | | Code code = codeService.getCacheByData(currCodeData); |
| | | List<Jam> jams = this.list(new LambdaQueryWrapper<Jam>() |
| | | .eq(Jam::getAvoAgv, avoAgv) |
| | | .eq(Jam::getAvoCode, code.getId()) |
| | |
| | | @Override |
| | | public void agvInfoBroadcastOnPos(WebsocketDto<AGV_12_UP> dto) { |
| | | AGV_12_UP protocol = dto.getObj(); |
| | | Code currCode = codeService.selectByData(protocol.getQrCode()); |
| | | Code currCode = codeService.getCacheByData(protocol.getQrCode()); |
| | | |
| | | DigitalAgvVo vo = new DigitalAgvVo(); |
| | | vo.setAgvNo(dto.getNo()); |
| | |
| | | @Override |
| | | public void agvInfoBroadcastWithOutPos(WebsocketDto<AGV_13_UP> dto) { |
| | | AGV_13_UP protocol = dto.getObj(); |
| | | Code currCode = codeService.selectByData(protocol.getQrCode()); |
| | | Code currCode = codeService.getCacheByData(protocol.getQrCode()); |
| | | |
| | | DigitalAgvVo vo = new DigitalAgvVo(); |
| | | vo.setAgvNo(dto.getNo()); |