| | |
| | | @ManagerAuth(memo = "小车行走") |
| | | public R rgvRunWalk(@RequestParam(defaultValue = "0") Integer rgvNo, |
| | | @RequestParam(defaultValue = "0") Integer taskNo, |
| | | @RequestParam(defaultValue = "0") Integer rgvStaNo, |
| | | @RequestParam(defaultValue = "0") Integer rgvStaNoPut, |
| | | @RequestParam(defaultValue = "0") Long rgvPosDestination |
| | | ) { |
| | | if (rgvNo==null || rgvNo==0){ |
| | |
| | | if (taskNo==null || taskNo==0){ |
| | | return R.error("作业号请填写"); |
| | | } |
| | | if ((rgvStaNo == null || rgvStaNo == 0) && (rgvPosDestination==null || rgvPosDestination==0L)){ |
| | | if ((rgvStaNoPut == null || rgvStaNoPut == 0) && (rgvPosDestination==null || rgvPosDestination==0L)){ |
| | | return R.error("目标站点请填写"); |
| | | } |
| | | if (rgvPosDestination == null || rgvPosDestination == 0){ |
| | | BasDevpPosition basDevpPosition = basDevpPositionService.selectOne(new EntityWrapper<BasDevpPosition>().eq("DEV_NO", rgvStaNo)); |
| | | BasDevpPosition basDevpPosition = basDevpPositionService.selectOne(new EntityWrapper<BasDevpPosition>().eq("DEV_NO", rgvStaNoPut)); |
| | | rgvPosDestination = basDevpPosition.getPlcPosition(); |
| | | } |
| | | RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgvNo); |
| | |
| | | @ManagerAuth(memo = "小车放货") |
| | | public R rgvPutWalk(@RequestParam(defaultValue = "0") Integer rgvNo, |
| | | @RequestParam(defaultValue = "0") Integer taskNo, |
| | | @RequestParam(defaultValue = "0") Integer rgvStaNo, |
| | | @RequestParam(defaultValue = "0") Integer rgvStaNoPut, |
| | | @RequestParam(defaultValue = "0") Long rgvPosDestination |
| | | ) { |
| | | if (rgvNo==null || rgvNo==0){ |
| | |
| | | if (taskNo==null || taskNo==0){ |
| | | return R.error("作业号请填写"); |
| | | } |
| | | if (rgvStaNo == null || rgvStaNo == 0){ |
| | | if (rgvStaNoPut == null || rgvStaNoPut == 0){ |
| | | return R.error("目标站点请填写"); |
| | | } |
| | | RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgvNo); |
| | |
| | | return R.error("存在执行中任务,请先处理!!!"); |
| | | } |
| | | |
| | | BasDevpPosition basDevpPosition = basDevpPositionService.selectOne(new EntityWrapper<BasDevpPosition>().eq("DEV_NO", rgvStaNo)); |
| | | BasDevpPosition basDevpPosition = basDevpPositionService.selectOne(new EntityWrapper<BasDevpPosition>().eq("DEV_NO", rgvStaNoPut)); |
| | | //执行 |
| | | issuedPut.setTaskNo(Long.valueOf(taskNo)); |
| | | issuedPut.setTaskStatus(3); |
| | |
| | | @ManagerAuth(memo = "小车取货") |
| | | public R rgvTakeWalk(@RequestParam(defaultValue = "0") Integer rgvNo, |
| | | @RequestParam(defaultValue = "0") Integer taskNo, |
| | | @RequestParam(defaultValue = "0") Integer rgvStaNo, |
| | | @RequestParam(defaultValue = "0") Integer rgvStaNoTake, |
| | | @RequestParam(defaultValue = "0") Long rgvPosDestination |
| | | ) { |
| | | if (rgvNo==null || rgvNo==0){ |
| | |
| | | if (taskNo==null || taskNo==0){ |
| | | return R.error("作业号请填写"); |
| | | } |
| | | if (rgvStaNo == null || rgvStaNo == 0){ |
| | | return R.error("目标站点请填写"); |
| | | if (rgvStaNoTake == null || rgvStaNoTake == 0){ |
| | | return R.error("取货站点请填写"); |
| | | } |
| | | RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgvNo); |
| | | TaskProtocolCache taskProtocolCache = rgvThread.getTaskProtocolCache(); |
| | |
| | | return R.error("存在执行中任务,请先处理!!!"); |
| | | } |
| | | |
| | | BasDevpPosition basDevpPosition = basDevpPositionService.selectOne(new EntityWrapper<BasDevpPosition>().eq("DEV_NO", rgvStaNo)); |
| | | BasDevpPosition basDevpPosition = basDevpPositionService.selectOne(new EntityWrapper<BasDevpPosition>().eq("DEV_NO", rgvStaNoTake)); |
| | | //执行 |
| | | issuedTake.setTaskNo(Long.valueOf(taskNo)); |
| | | issuedTake.setTaskStatus(2); |
| | |
| | | |
| | | return R.ok("任务生成成功"); |
| | | } |
| | | |
| | | @PostMapping("/run/TakeAndPut")//Take Put Walk |
| | | @ManagerAuth(memo = "小车取货") |
| | | public R rgvTakeAndPut(@RequestParam(defaultValue = "0") Integer rgvNo, |
| | | @RequestParam(defaultValue = "0") Integer taskNo, |
| | | @RequestParam(defaultValue = "0") Integer rgvStaNoTake, |
| | | @RequestParam(defaultValue = "0") Integer rgvStaNoPut, |
| | | @RequestParam(defaultValue = "0") Long rgvPosDestination |
| | | ) { |
| | | if (rgvNo==null || rgvNo==0){ |
| | | return R.error("请选择小车"); |
| | | } |
| | | if (taskNo==null || taskNo==0){ |
| | | return R.error("作业号请填写"); |
| | | } |
| | | if (rgvStaNoTake == null || rgvStaNoTake == 0){ |
| | | return R.error("取货站点请填写"); |
| | | } |
| | | if (rgvStaNoPut == null || rgvStaNoPut == 0){ |
| | | return R.error("放货站点请填写"); |
| | | } |
| | | RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgvNo); |
| | | TaskProtocolCache taskProtocolCache = rgvThread.getTaskProtocolCache(); |
| | | |
| | | TaskProtocol issuedTake = new TaskProtocol(); |
| | | TaskProtocol issuedPut = new TaskProtocol(); |
| | | try { |
| | | ConcurrentHashMap<String, TaskProtocol> allTaskProtocol = taskProtocolCache.getAllTaskProtocol(); |
| | | if (allTaskProtocol.size() > 0) { |
| | | return R.error("存在执行中任务,请先处理!!!"); |
| | | } |
| | | |
| | | BasDevpPosition basDevpPositionTake = basDevpPositionService.selectOne(new EntityWrapper<BasDevpPosition>().eq("DEV_NO", rgvStaNoTake)); |
| | | //执行 |
| | | issuedTake.setTaskNo(Long.valueOf(taskNo)); |
| | | issuedTake.setTaskStatus(2); |
| | | issuedTake.setTaskNoDirection(issuedTake.gettaskNoDirection$(issuedTake.getTaskNo(), issuedTake.getTaskStatus())); |
| | | issuedTake.setTargetPosition(basDevpPositionTake.getPlcPosition()); |
| | | issuedTake.setIsRunning(1); |
| | | issuedTake.setDirection(basDevpPositionTake.getRgvSign()==1); |
| | | |
| | | BasDevpPosition basDevpPositionPut = basDevpPositionService.selectOne(new EntityWrapper<BasDevpPosition>().eq("DEV_NO", rgvStaNoPut)); |
| | | //执行 |
| | | issuedPut.setTaskNo(Long.valueOf(taskNo)); |
| | | issuedPut.setTaskStatus(3); |
| | | issuedPut.setTaskNoDirection(issuedPut.gettaskNoDirection$(issuedPut.getTaskNo(), issuedPut.getTaskStatus())); |
| | | issuedPut.setTargetPosition(basDevpPositionPut.getPlcPosition()); |
| | | issuedPut.setIsRunning(1); |
| | | issuedPut.setDirection(basDevpPositionPut.getRgvSign()==1); |
| | | |
| | | taskProtocolCache.updateTaskProtocol(issuedTake); |
| | | taskProtocolCache.updateTaskProtocol(issuedPut); |
| | | |
| | | } catch (Exception e) { |
| | | return R.error("任务生成失败"+e.getMessage()); |
| | | } |
| | | |
| | | return R.ok("任务生成成功"); |
| | | } |
| | | } |