| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.core.common.Cools; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.AgvWrkMast; |
| | | import com.zy.asrs.entity.param.AgvTaskCreateParam; |
| | | import com.zy.asrs.entity.param.AgvTaskParam; |
| | | import com.zy.asrs.entity.param.AgvTaskkDescribeParam; |
| | | import com.zy.asrs.mapper.AgvWrkMastMapper; |
| | | import com.zy.asrs.service.AgvLocMastService; |
| | | import com.zy.asrs.service.AgvWrkDetlService; |
| | | import com.zy.asrs.service.AgvWrkMastService; |
| | | import com.zy.asrs.service.ApiLogService; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | @Value("${agv.containerMoveInPath}") |
| | | private String containerMoveInPath; |
| | | |
| | | @Value("${agv.containerMoveOutPath}") |
| | | private String containerMoveOutPath; |
| | | |
| | | @Value("${agv.containerArrivedPath}") |
| | | private String containerArrivedPath; |
| | | |
| | | @Autowired |
| | | AgvWrkMastMapper agvWrkMastMapper; |
| | | @Autowired |
| | |
| | | AgvLocMastService agvLocMastService; |
| | | @Autowired |
| | | ApiLogService apiLogService; |
| | | @Autowired |
| | | AgvBasDevpService agvBasDevpService; |
| | | |
| | | public void updateWrkStsByWrkNo(int wrkNo, long wrkSts) { |
| | | AgvWrkMast agvWrkMast = this.selectById(wrkNo); |
| | |
| | | AgvTaskCreateParam agvTaskCreateParam = new AgvTaskCreateParam(); |
| | | agvTaskCreateParam.setTaskType(taskType); |
| | | |
| | | // //调用容器入场时所需要参数 |
| | | // Map<String,List<Map<String,String>>> containerMoveParam = new HashMap<>(); |
| | | // List<Map<String,String>> positionCodeMapList = new ArrayList<>(); |
| | | // containerMoveParam.put("containerMoveIns",positionCodeMapList); |
| | | |
| | | getRequestParam(agvTaskCreateParam,agvWrkMastList); |
| | | |
| | | return doHttpRequest(agvTaskCreateParam,"上架任务下发",url, taskCreatePath,null,"127.0.0.1"); |
| | | return doHttpRequest(agvTaskCreateParam,"搬运任务下发",url, taskCreatePath,null,"127.0.0.1"); |
| | | |
| | | //return containerMoveParam; |
| | | } |
| | | |
| | | //容器入场 |
| | | public int containerMove(List<AgvWrkMast> agvWrkMastList) throws IOException { |
| | | public int containerMoveIn(List<AgvWrkMast> agvWrkMastList) throws IOException { |
| | | //调用容器入场时所需要参数 |
| | | Map<String,List<Map<String,String>>> containerMoveParam = new HashMap<>(); |
| | | List<Map<String,String>> positionCodeMapList = new ArrayList<>(); |
| | | containerMoveParam.put("containerMoveIns",positionCodeMapList); |
| | | |
| | | getContainerMoveParam(agvWrkMastList,positionCodeMapList); |
| | | |
| | | if(Cools.isEmpty(positionCodeMapList)){ |
| | | return 0; |
| | | } |
| | | return doHttpRequest(containerMoveParam,"容器入场任务下发",url, containerMoveInPath,null,"127.0.0.1"); |
| | | |
| | | } |
| | |
| | | positionCodeMap.put("positionCode",agvWrkMast.getLocNo()); |
| | | positionCodeMapList.add(positionCodeMap); |
| | | } |
| | | return doHttpRequest(containerMoveParam,"容器入场任务下发",url, containerMoveInPath,null,"127.0.0.1"); |
| | | return doHttpRequest(containerMoveParam,"容器离场任务下发",url, containerMoveOutPath,null,"127.0.0.1"); |
| | | } |
| | | |
| | | public boolean insertByIncrease(AgvWrkMast agvWrkMast) { |
| | | int index = this.baseMapper.insertByIncrease(agvWrkMast); |
| | | |
| | | return index > 0; |
| | | } |
| | | |
| | | @Override |
| | | public boolean deleteByWrkNo(int wrkNo) { |
| | | return this.delete(new EntityWrapper<AgvWrkMast>().eq("wrk_no", wrkNo)); |
| | | } |
| | | |
| | | //容器到达通知 |
| | | public int containerArrived(AgvWrkMast agvWrkMast) { |
| | | |
| | | Map<String,String> containerArrivedParam = new HashMap<>(); |
| | | containerArrivedParam.put("slotCode",agvWrkMast.getSourceLocNo()); |
| | | containerArrivedParam.put("containerCode",agvWrkMast.getBarcode()); |
| | | |
| | | return doHttpRequest(containerArrivedParam,"容器达到通知",url, containerArrivedPath,null,"127.0.0.1"); |
| | | } |
| | | |
| | | @Override |
| | | public List<AgvWrkMast> selectReadyAgvWrkMast() { |
| | | List<String> stationCodes = agvBasDevpService.selectAllStationCode(); |
| | | Wrapper<AgvWrkMast> wrapper = new EntityWrapper<AgvWrkMast>().eq("wrk_sts", 21L).like(false, "loc_no", "@"); |
| | | wrapper.in("loc_no",stationCodes); |
| | | return this.selectList(wrapper); |
| | | //return this.baseMapper.selectReadyAgvWrkMast(); |
| | | } |
| | | |
| | | @Override |
| | | public AgvWrkMast selectByContainerCode(String containerCode) { |
| | | return this.selectOne(new EntityWrapper<AgvWrkMast>().eq("barcode",containerCode)); |
| | | } |
| | | |
| | | private void getContainerMoveParam(List<AgvWrkMast> agvWrkMastList,List<Map<String,String>> positionCodeMapList){ |
| | | //往容器入场参数中放入源站点位置 |
| | | for(AgvWrkMast agvWrkMast : agvWrkMastList){ |
| | | //判断是否为输送线入库,是则不需要容器进场请求 |
| | | if("Y".equals(agvWrkMast.getMk())){ |
| | | continue; |
| | | } |
| | | Map<String,String> positionCodeMap = new HashMap<>(); |
| | | positionCodeMap.put("positionCode",agvWrkMast.getSourceLocNo()); |
| | | positionCodeMapList.add(positionCodeMap); |
| | |
| | | AgvTaskkDescribeParam agvTaskkDescribeParam = new AgvTaskkDescribeParam(); |
| | | agvTaskParam.setTaskDescribe(agvTaskkDescribeParam); |
| | | //AgvTaskParam |
| | | agvTaskParam.setTaskCode(agvWrkMast.getWrkNo().toString()); |
| | | if(agvWrkMast.getIoType() == 53 || agvWrkMast.getIoType() == 57){ |
| | | agvTaskParam.setTaskCode(-agvWrkMast.getWrkNo() + ""); |
| | | }else{ |
| | | agvTaskParam.setTaskCode(agvWrkMast.getWrkNo() + ""); |
| | | } |
| | | |
| | | agvTaskParam.setTaskPriority(agvWrkMast.getIoPri().intValue()); |
| | | |
| | | //AgvTaskkDescribeParam |
| | | agvTaskkDescribeParam.setFromLocationCode(agvWrkMast.getSourceLocNo()); |
| | | agvTaskkDescribeParam.setToLocationCode(agvWrkMast.getLocNo()); |
| | | if(agvWrkMast.getSourceLocNo().contains("CS") || agvWrkMast.getSourceLocNo().contains("SK")){ |
| | | agvTaskkDescribeParam.setFromLocationCode(agvWrkMast.getSourceLocNo()); |
| | | } |
| | | |
| | | if(agvWrkMast.getLocNo().contains("SK")){ |
| | | agvTaskkDescribeParam.setToLocationCode(agvWrkMast.getLocNo()); |
| | | }else { |
| | | agvTaskkDescribeParam.setToStationCode(agvWrkMast.getLocNo()); |
| | | } |
| | | agvTaskkDescribeParam.setContainerCode(agvWrkMast.getBarcode()); |
| | | return agvTaskParam; |
| | | }).collect(Collectors.toList()); |