| | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.core.common.Cools; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.AgvBasDevp; |
| | | import com.zy.asrs.entity.AgvLocMast; |
| | | import com.zy.asrs.entity.AgvWrkMast; |
| | | import com.zy.asrs.entity.param.AgvTaskCreateParam; |
| | | import com.zy.asrs.entity.param.AgvTaskParam; |
| | | import com.zy.asrs.mapper.AgvWrkMastMapper; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.common.service.AgvCommonService; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | ApiLogService apiLogService; |
| | | @Autowired |
| | | AgvBasDevpService agvBasDevpService; |
| | | @Autowired |
| | | private AgvCommonService agvCommonService; |
| | | @Autowired |
| | | private AgvWrkMastService agvWrkMastService; |
| | | |
| | | |
| | | public void updateWrkStsByWrkNo(int wrkNo, long wrkSts) { |
| | | AgvWrkMast agvWrkMast = this.selectById(wrkNo); |
| | | //判断要修改的工作档状态是否合理,如果不合理则抛出异常 |
| | | checkWrkSts(agvWrkMast,wrkSts); |
| | | agvWrkMast.setWrkSts(wrkSts); |
| | | this.updateById(agvWrkMast); |
| | | } |
| | | |
| | | public void updateWrkStsByWrkNo(int wrkNo, long wrkSts,String manuType,long userId) { |
| | | Date now = new Date(); |
| | | AgvWrkMast agvWrkMast = this.selectById(wrkNo); |
| | | //判断要修改的工作档状态是否合理,如果不合理则抛出异常 |
| | | checkWrkSts(agvWrkMast,wrkSts); |
| | | agvWrkMast.setWrkSts(wrkSts); |
| | | agvWrkMast.setManuType(manuType); |
| | | agvWrkMast.setModiTime(now); |
| | | agvWrkMast.setModiUser(userId); |
| | | this.updateById(agvWrkMast); |
| | | } |
| | | |
| | |
| | | //return containerMoveParam; |
| | | } |
| | | |
| | | //容器入场 |
| | | public int startAllcationIn(AgvWrkMast agvWrkMast) throws IOException { |
| | | AgvBasDevp basDevp = agvBasDevpService.selectByDevNo(agvWrkMast.getSourceLocNo()); |
| | | //检索库位,选择合适的库位 |
| | | AgvLocMast locMast = agvCommonService.getLocNo(basDevp.getLocType1(),basDevp.getFloor()); |
| | | agvWrkMast.setLocNo(locMast.getLocNo()); |
| | | agvWrkMast.setWrkSts(201L); |
| | | agvWrkMastService.updateById(agvWrkMast); |
| | | // 更目标库位 |
| | | locMast.setLocSts("S"); |
| | | agvLocMastService.updateById(locMast); |
| | | return 0; |
| | | |
| | | } |
| | | |
| | | //货架入场 |
| | | 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); |
| | |
| | | if(Cools.isEmpty(positionCodeMapList)){ |
| | | return 0; |
| | | } |
| | | return doHttpRequest(containerMoveParam,"容器入场任务下发",url, containerMoveInPath,null,"127.0.0.1"); |
| | | return doHttpRequest(containerMoveParam,"货架入场任务下发",url, containerMoveInPath,null,"127.0.0.1"); |
| | | |
| | | } |
| | | |
| | | //容器离场 |
| | | //货架离场 |
| | | public int containerMoveOut(List<AgvWrkMast> agvWrkMastList){ |
| | | Map<String,List<Map<String,String>>> containerMoveParam = new HashMap<>(); |
| | | List<Map<String,String>> positionCodeMapList = new ArrayList<>(); |
| | |
| | | positionCodeMap.put("positionCode",agvWrkMast.getLocNo()); |
| | | positionCodeMapList.add(positionCodeMap); |
| | | } |
| | | return doHttpRequest(containerMoveParam,"容器离场任务下发",url, containerMoveOutPath,null,"127.0.0.1"); |
| | | return doHttpRequest(containerMoveParam,"货架离场任务下发",url, containerMoveOutPath,null,"127.0.0.1"); |
| | | } |
| | | |
| | | public boolean insertByIncrease(AgvWrkMast agvWrkMast) { |
| | |
| | | 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"); |
| | | return doHttpRequest(containerArrivedParam,"货架达到通知",url, containerArrivedPath,null,"127.0.0.1"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | |
| | | private void getContainerMoveParam(List<AgvWrkMast> agvWrkMastList,List<Map<String,String>> positionCodeMapList){ |
| | | //往容器入场参数中放入源站点位置 |
| | | //往货架入场参数中放入源站点位置 |
| | | for(AgvWrkMast agvWrkMast : agvWrkMastList){ |
| | | //判断是否为输送线入库,是则不需要容器进场请求 |
| | | //判断是否为输送线入库,是则不需要货架进场请求 |
| | | if("Y".equals(agvWrkMast.getMk())){ |
| | | continue; |
| | | } |
| | |
| | | agvWrkMast.setWrkNo(-agvWrkMast.getWrkNo()); |
| | | } |
| | | agvTaskCreateParam.setTaskCode(agvWrkMast.getWrkNo().toString()); |
| | | if (agvWrkMast.getIoType() == 108 || agvWrkMast.getIoType() == 109 || agvWrkMast.getIoType() == 12) { |
| | | if (agvWrkMast.getIoType() == 108 || (agvWrkMast.getIoType() == 109 && agvWrkMast.getWrkSts() == 201) || agvWrkMast.getIoType() == 12) { |
| | | agvTaskCreateParam.setTaskTyp("F06"); |
| | | } else { |
| | | agvTaskCreateParam.setTaskTyp("F01"); |