| | |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.domain.param.RingThroughParam; |
| | | import com.zy.asrs.entity.BasDevpPosition; |
| | | import com.zy.asrs.service.BasDevpPositionService; |
| | | import com.zy.core.cache.RgvErrCache; |
| | | import com.zy.core.cache.RgvStatusCache; |
| | | import com.zy.core.cache.SlaveConnection; |
| | | import com.zy.core.cache.TaskProtocolCache; |
| | |
| | | map2.put("rgvPos", rgvProtocol.getRgvPos()); |
| | | map2.put("rgvPosDestination", rgvProtocol.getRgvPosDestination()); |
| | | map2.put("loaded", rgvProtocol.getLoaded().equals((short)-1)? "未知":rgvProtocol.getLoaded()==1? "有物":"无物"); |
| | | map2.put("errorRgv", RgvErrCache.getErrorDev(rgvProtocol.getRgvNo())); |
| | | res.add(map2); |
| | | } |
| | | return R.ok().add(res); |
| | |
| | | return R.ok("任务清空成功"); |
| | | } |
| | | |
| | | @PostMapping("/run/del2")//Take Put Walk |
| | | @ManagerAuth(memo = "清除作业启动中") |
| | | public R rgvRunDel2(@RequestParam(defaultValue = "0") Integer rgvNo |
| | | ) { |
| | | if (rgvNo==null || rgvNo==0){ |
| | | return R.error("请选择小车"); |
| | | } |
| | | RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgvNo); |
| | | try { |
| | | rgvThread.setWrkSign(); |
| | | } catch (Exception e) { |
| | | return R.error("清除作业启动中失败"+e.getMessage()); |
| | | } |
| | | |
| | | return R.ok("任务清空成功"); |
| | | } |
| | | |
| | | @PostMapping("/run/walk")//Take Put Walk |
| | | @ManagerAuth(memo = "小车行走") |
| | | public R rgvRunWalk(@RequestParam(defaultValue = "0") Integer rgvNo, |
| | |
| | | } |
| | | if (rgvPosDestination == null || rgvPosDestination == 0){ |
| | | BasDevpPosition basDevpPosition = basDevpPositionService.selectOne(new EntityWrapper<BasDevpPosition>().eq("DEV_NO", rgvStaNoPut)); |
| | | if (Cools.isEmpty(basDevpPosition)){ |
| | | return R.error("目标站点不存在"); |
| | | } |
| | | rgvPosDestination = basDevpPosition.getPlcPosition(); |
| | | } |
| | | RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgvNo); |
| | |
| | | } |
| | | |
| | | BasDevpPosition basDevpPosition = basDevpPositionService.selectOne(new EntityWrapper<BasDevpPosition>().eq("DEV_NO", rgvStaNoPut)); |
| | | if (Cools.isEmpty(basDevpPosition)){ |
| | | return R.error("目标站点不存在"); |
| | | } |
| | | //执行 |
| | | issuedPut.setTaskNo(Long.valueOf(taskNo)); |
| | | issuedPut.setTaskStatus(3); |
| | |
| | | } |
| | | |
| | | BasDevpPosition basDevpPosition = basDevpPositionService.selectOne(new EntityWrapper<BasDevpPosition>().eq("DEV_NO", rgvStaNoTake)); |
| | | if (Cools.isEmpty(basDevpPosition)){ |
| | | return R.error("取货站点不存在"); |
| | | } |
| | | //执行 |
| | | issuedTake.setTaskNo(Long.valueOf(taskNo)); |
| | | issuedTake.setTaskStatus(2); |
| | | issuedTake.setTargetPositionStaNo(basDevpPosition.getDevNo()); |
| | | issuedTake.setTargetPositionStaNoPlcId(basDevpPosition.getPlcId()); |
| | | issuedTake.setTaskNoDirection(issuedTake.gettaskNoDirection$(issuedTake.getTaskNo(), issuedTake.getTaskStatus())); |
| | | issuedTake.setTargetPosition(basDevpPosition.getPlcPosition()); |
| | | issuedTake.setIsRunning(1); |
| | |
| | | } |
| | | |
| | | BasDevpPosition basDevpPositionTake = basDevpPositionService.selectOne(new EntityWrapper<BasDevpPosition>().eq("DEV_NO", rgvStaNoTake)); |
| | | if (Cools.isEmpty(basDevpPositionTake)){ |
| | | return R.error("取货站点不存在"); |
| | | } |
| | | //执行 |
| | | issuedTake.setTaskNo(Long.valueOf(taskNo)); |
| | | issuedTake.setTaskStatus(2); |
| | |
| | | issuedTake.setDirection(basDevpPositionTake.getRgvSign()==1); |
| | | |
| | | BasDevpPosition basDevpPositionPut = basDevpPositionService.selectOne(new EntityWrapper<BasDevpPosition>().eq("DEV_NO", rgvStaNoPut)); |
| | | if (Cools.isEmpty(basDevpPositionPut)){ |
| | | return R.error("目标站点不存在"); |
| | | } |
| | | //执行 |
| | | issuedPut.setTaskNo(Long.valueOf(taskNo)); |
| | | issuedPut.setTaskStatus(3); |
| | |
| | | |
| | | return R.ok("任务生成成功"); |
| | | } |
| | | |
| | | @PostMapping("/run/delRgvTask")//Take Put Walk |
| | | @ManagerAuth(memo = "小车取货") |
| | | public R rgvDelRgvTask(@RequestParam(defaultValue = "0") Integer rgvNo |
| | | ) { |
| | | if (rgvNo==null || rgvNo==0){ |
| | | return R.error("请选择小车"); |
| | | } |
| | | |
| | | try { |
| | | RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgvNo); |
| | | rgvThread.setDelRgvTask(); |
| | | } catch (Exception e) { |
| | | return R.error("任务生成失败"+e.getMessage()); |
| | | } |
| | | |
| | | return R.ok("任务生成成功"); |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping("/ring/through/rgv/position/data") |
| | | // @ManagerAuth(memo = "小车位置信息") |
| | | public R ringThroughRgv(){ |
| | | List<RingThroughParam> result = new ArrayList<>(); |
| | | |
| | | ConcurrentHashMap<Integer, RgvProtocol> allRgvStatus = RgvStatusCache.getAllRgvStatus(); |
| | | for (RgvProtocol rgvProtocol : allRgvStatus.values()){ |
| | | RingThroughParam ringThroughParam = new RingThroughParam(); |
| | | |
| | | ringThroughParam.setIndex(rgvProtocol.getRgvNo()); |
| | | // ringThroughParam.setIndex(i); |
| | | // double[] doubles = Utils.RingThroughXY2(perimeter, NumUtils.GetRandomIntInRange(183)); |
| | | // double[] doubles = Utils.RingThroughXYRgv(perimeter, perimeter-rgvProtocol.RgvPos.doubleValue()); |
| | | // double[] doubles = Utils.getRgvPosNew(perimeter, rgvProtocol.RgvPos.doubleValue()); |
| | | // double[] doubles = Utils.RingThroughXY2(183.0, 100*i ); |
| | | |
| | | ringThroughParam.setValueX(rgvProtocol.getRgvNo()*100*1D); |
| | | ringThroughParam.setValueY(rgvProtocol.getRgvNo()*100*2D); |
| | | ringThroughParam.setModeColor(rgvProtocol.modeType.color); |
| | | ringThroughParam.setStatusColor(rgvProtocol.statusType.color); |
| | | result.add(ringThroughParam); |
| | | } |
| | | return R.ok().add(result); |
| | | } |
| | | |
| | | @PostMapping("/ring/through/dev/position/data") |
| | | // @ManagerAuth(memo = "站点信息") |
| | | // 站点位置信息 |
| | | public R ringThroughDev(){ |
| | | List<RingThroughParam> result = new ArrayList<>(); |
| | | ArrayList<Integer> arrayList = new ArrayList<Integer>() {{ |
| | | add(1001); |
| | | add(1002); |
| | | add(1003); |
| | | add(1004); |
| | | add(1005); |
| | | add(1006); |
| | | add(1007); |
| | | add(1008); |
| | | add(1009); |
| | | add(1010); |
| | | add(1011); |
| | | add(1012); |
| | | add(1013); |
| | | add(1014); |
| | | add(1015); |
| | | add(1016); |
| | | add(1017); |
| | | add(1018); |
| | | add(1019); |
| | | add(1020); |
| | | add(1021); |
| | | add(1022); |
| | | add(1023); |
| | | }}; |
| | | for (Integer staNo : arrayList){ |
| | | RingThroughParam ringThroughParam = new RingThroughParam(); |
| | | ringThroughParam.setIndex(staNo); |
| | | // double[] doubles = Utils.RingThroughXYSta(perimeter, perimeter-basDevpPosition.getPlcPosition()); |
| | | // ringThroughParam.setValueX(doubles[0]>50? doubles[0]+6:doubles[0]-1); |
| | | // ringThroughParam.setValueY(doubles[1]>50? doubles[1]+6:doubles[1]-1); |
| | | // double[] doubles = Utils.getRgvPosNew(basDevpPosition.getDevNo(),perimeter, basDevpPosition.getPlcPosition()); |
| | | ringThroughParam.setValueX(staNo*100*1D); |
| | | ringThroughParam.setValueY(staNo*100*2D); |
| | | result.add(ringThroughParam); |
| | | } |
| | | return R.ok().add(result); |
| | | } |
| | | |
| | | @PostMapping("/ring/through/track/position/data") |
| | | // @ManagerAuth(memo = "轨道PLC状态信息") |
| | | public R wnergyGatheringRingParamTrack(){ |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("/ring/through/task/wrk/mast/position/data") |
| | | // @ManagerAuth(memo = "作业信息") |
| | | public R ringThroughTaskWrkMast(){ |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("/ring/through/task/wrk/mast/position/data/v1") |
| | | // @ManagerAuth(memo = "作业信息") |
| | | public R ringThroughTaskWrkMastV1(){ |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("/task/rgv/circular/shuttle/mast/position/data") |
| | | // @ManagerAuth(memo = "作业信息") |
| | | public R rgvCircularShuttle(){ |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("/task/rgv/circular/shuttle/mast/position/data/v1") |
| | | // @ManagerAuth(memo = "作业信息") |
| | | public R rgvCircularShuttleV1(){ |
| | | return R.ok(); |
| | | } |
| | | } |