|  |  | 
 |  |  | import org.springframework.transaction.annotation.Transactional; | 
 |  |  | import org.springframework.web.bind.annotation.*; | 
 |  |  |  | 
 |  |  | import java.io.IOException; | 
 |  |  | import java.util.ArrayList; | 
 |  |  | import java.util.Date; | 
 |  |  | import java.util.HashMap; | 
 |  |  | import java.util.List; | 
 |  |  | import java.util.stream.Collectors; | 
 |  |  |  | 
 |  |  | 
 |  |  | @RestController | 
 |  |  | @RequestMapping("/rpc") | 
 |  |  | public class WcsController { | 
 |  |  |  | 
 |  |  |     private static HashMap<String,String> currentContainerMap; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private WrkMastService wrkMastService; | 
 |  |  | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @PostMapping("/current/containerCode") | 
 |  |  |     @ResponseBody | 
 |  |  |     public R move(@RequestBody ReplenishmentParam param){ | 
 |  |  |  | 
 |  |  |         if(Cools.isEmpty(currentContainerMap)){ | 
 |  |  |             currentContainerMap = new HashMap<>(); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         String devNo = param.getDevNo(); | 
 |  |  |         String containerCode = param.getContainerCode(); | 
 |  |  |         String currentContainerCode = currentContainerMap.get(devNo); | 
 |  |  |  | 
 |  |  |         //判断容器是否发生变化 | 
 |  |  |         if(!Cools.eq(containerCode,currentContainerCode)){ | 
 |  |  |             //查询旧容器的工作档 | 
 |  |  |             AgvWrkMast agvWrkMast = agvWrkMastService.selectByContainerCode(currentContainerCode); | 
 |  |  |             if(agvWrkMast.getIoType() == 101){ | 
 |  |  |                 //发送容器立场请求,完成工作档 | 
 |  |  |                 List<AgvWrkMast> agvWrkMastList = new ArrayList<>(); | 
 |  |  |                 agvWrkMastList.add(agvWrkMast); | 
 |  |  |                 try { | 
 |  |  |                     int code = agvWrkMastService.containerMoveOut(agvWrkMastList); | 
 |  |  |                     if(code == 0){ | 
 |  |  |                         //将工作党状态改为容器离场 | 
 |  |  |                         agvWrkMast.setWrkSts(206L); | 
 |  |  |                         agvWrkMastService.updateById(agvWrkMast); | 
 |  |  |                     } | 
 |  |  |                 } catch (IOException e) { | 
 |  |  |                     log.error(e.getMessage()); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         currentContainerMap.put(devNo,containerCode); | 
 |  |  |  | 
 |  |  |         return R.ok(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /* | 
 |  |  |     显示AGV输送线拣料、盘点、入库信息 | 
 |  |  |      */ | 
 |  |  |     @PostMapping("/info") | 
 |  |  |     @ResponseBody | 
 |  |  |     public R showAgvBasDevInfo(@RequestBody ReplenishmentParam param){ | 
 |  |  |     public R containerMove(@RequestBody ReplenishmentParam param){ | 
 |  |  |  | 
 |  |  |         String devNo = param.getDevNo(); | 
 |  |  |         String containerCode = currentContainerMap.get(devNo); | 
 |  |  |  | 
 |  |  |         return R.ok(); | 
 |  |  |         //查找该容器的工作档 | 
 |  |  |         AgvWrkMast agvWrkMast = agvWrkMastService.selectByContainerCode(containerCode); | 
 |  |  |         if(!Cools.isEmpty(agvWrkMast)){ | 
 |  |  |             return R.ok(agvWrkMast); | 
 |  |  |         } | 
 |  |  |         //查找该容器的入库通知档 | 
 |  |  |         AgvWaitPakin agvWaitPakin = agvWaitPakinService.selectByContainerCode(containerCode); | 
 |  |  |         if(!Cools.isEmpty(agvWaitPakin)){ | 
 |  |  |             return R.ok(agvWaitPakin); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         return R.error("没有该容器的出库、拣料、入库信息等"); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  |