| | |
| | | public R combBinding(@RequestBody Map<String,Object> map){ |
| | | String barcode = map.get("barcode").toString(); |
| | | String stationCode = map.get("stationCode").toString(); |
| | | agvMobileService.combBinding(barcode,stationCode); |
| | | Short containerType = Short.valueOf(map.get("containerType").toString()); |
| | | agvMobileService.combBinding(barcode,stationCode,containerType); |
| | | return R.ok("托盘绑定站点成功"); |
| | | } |
| | | |
| | |
| | | @Synchronized |
| | | public R pakinEmpty(@RequestBody AgvMobileStartParam params){ |
| | | |
| | | for (AgvMobileStartParam.Pad pad : params.getPad()) { |
| | | workService.emptyPlateIn(pad.getDevNo(),pad.getContainerCode(),pad.getContainerType(), getUserId()); |
| | | for (AgvMobileStartParam.Pda pda : params.getPad()) { |
| | | workService.emptyPlateIn(pda.getDevNo(),pda.getContainerCode(),pda.getContainerType(), getUserId()); |
| | | } |
| | | |
| | | return R.ok(); |
| | |
| | | @Synchronized |
| | | public R pakoutEmpty(@RequestBody AgvMobileStartParam params){ |
| | | |
| | | for (AgvMobileStartParam.Pad pad : params.getPad()) { |
| | | workService.emptyPlateOut(pad.getDevNo(),pad.getContainerType(), getUserId()); |
| | | for (AgvMobileStartParam.Pda pda : params.getPad()) { |
| | | workService.emptyPlateOut(pda.getDevNo(),pda.getContainerType(), getUserId()); |
| | | } |
| | | |
| | | return R.ok(); |
| | |
| | | if (issued <= 0.0D) { continue; } |
| | | |
| | | //从平库寻找 |
| | | issued = manLocDetlService.queryStockAndSetLocDto(orderDetl.getMatnr(),orderDetl.getBatch(),orderDetl.getOrderNo(),locDtoList,issued,orderDetl.getThreeCode(),orderDetl.getDeadTime()); |
| | | //issued = manLocDetlService.queryStockAndSetLocDto(orderDetl.getMatnr(),orderDetl.getBatch(),orderDetl.getOrderNo(),locDtoList,issued,orderDetl.getThreeCode(),orderDetl.getDeadTime()); |
| | | |
| | | //先找AGV的库存,如果返回的issued大于0,则去四项库找 |
| | | issued = agvLocDetlService.queryStockAndSetLocDto(orderDetl.getMatnr(),orderDetl.getBatch(),orderDetl.getOrderNo(),locDtoList,issued,orderDetl.getThreeCode(),orderDetl.getDeadTime()); |
| | | |
| | | //从四项库的库存里面找, |
| | | issued = locDetlService.queryStockAndSetLocDto(orderDetl.getMatnr(),orderDetl.getBatch(),orderDetl.getOrderNo(),locDtoList,issued,orderDetl.getThreeCode(),orderDetl.getDeadTime()); |
| | | //issued = locDetlService.queryStockAndSetLocDto(orderDetl.getMatnr(),orderDetl.getBatch(),orderDetl.getOrderNo(),locDtoList,issued,orderDetl.getThreeCode(),orderDetl.getDeadTime()); |
| | | |
| | | if (issued > 0) { |
| | | LocDto locDto = new LocDto(null, orderDetl.getMatnr(), orderDetl.getMaktx(), orderDetl.getBatch(), orderDetl.getOrderNo(), issued); |
| | |
| | | |
| | | @Data |
| | | public class AgvMobileStartParam { |
| | | private List<Pad> pad; |
| | | private List<Pda> pad; |
| | | |
| | | @Data |
| | | public static class Pad { |
| | | public static class Pda { |
| | | //站点 |
| | | private String devNo; |
| | | //任务类型 |
| | |
| | | //容器码 |
| | | private String containerCode; |
| | | //容器类型 |
| | | private int containerType; |
| | | private Short containerType; |
| | | } |
| | | |
| | | } |
| | |
| | | // 托盘条码 |
| | | private String barcode; |
| | | |
| | | // 托盘条码 |
| | | private Short containerType; |
| | | |
| | | // 库位编号 |
| | | private String locno; |
| | | |
| | |
| | | @Select("select dev_no from agv_bas_devp where loc_sts = 'O'") |
| | | List<String> getAvailableEmptyInSite(); |
| | | |
| | | @Select("select station_code from agv_bas_devp where floor = #{floor} and cache_shelves = 'N' and in_enable = 'Y' group by station_code") |
| | | @Select("select station_code from agv_bas_devp where cache_shelves = 'N' and in_enable = 'Y' group by station_code") |
| | | List<String> selectCacheShelvesStationCodeByFloor(@Param("floor") int floor); |
| | | |
| | | @Select("SELECT\n" + |
| | |
| | | |
| | | void updateLocType2ByRBL(Integer locType2, AgvLocRule locRule); |
| | | |
| | | public void updateLocStsByLocNo(String locNo, String locSts, String barcode); |
| | | public void updateLocStsByLocNo(String locNo, String locSts, String barcode,Short containerType); |
| | | |
| | | public List<String> queryGroupEmptyStock(int floor); |
| | | |
| | |
| | | |
| | | void packComb(CombParam param, Long userId); |
| | | |
| | | void combBinding(String barcode, String stationCode); |
| | | void combBinding(String barcode, String stationCode, Short containerType); |
| | | |
| | | List<AgvBasDevp> getAgvBasDevpByFloor(int floor); |
| | | |
| | |
| | | /* |
| | | 空板入库 |
| | | */ |
| | | String emptyPlateIn(String station,String containerCode,int containerType, Long userId); |
| | | String emptyPlateIn(String station,String containerCode,Short containerType, Long userId); |
| | | |
| | | void emptyPlateOut(String station, int containerType, Long userId); |
| | | |
| | |
| | | this.baseMapper.updateLocType2(locType2,locRule.getRowBeg(),locRule.getRowEnd(),locRule.getBayBeg(),locRule.getBayEnd(),locRule.getLevBeg(),locRule.getLevEnd(),locRule.getFloor()); |
| | | } |
| | | |
| | | public void updateLocStsByLocNo(String locNo, String locSts, String barcode) { |
| | | public void updateLocStsByLocNo(String locNo, String locSts, String barcode,Short containerType) { |
| | | AgvLocMast agvLocMast = this.selectById(locNo); |
| | | agvLocMast.setLocSts(locSts); |
| | | agvLocMast.setBarcode(barcode); |
| | | agvLocMast.setLocType2(containerType); |
| | | this.updateById(agvLocMast); |
| | | } |
| | | |
| | |
| | | if(StringUtils.isEmpty(param.getLocno())){ |
| | | return "组托成功"; |
| | | }else { |
| | | combBinding(param.getBarcode(),param.getLocno()); |
| | | combBinding(param.getBarcode(),param.getLocno(),param.getContainerType()); |
| | | return "组托成功,绑定站点成功"; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void combBinding(String barcode, String stationCode) { |
| | | public void combBinding(String barcode, String stationCode, Short containerType) { |
| | | |
| | | if(Cools.isEmpty(agvWaitPakinService.selectByContainerCode(barcode))){ |
| | | throw new CoolException("该料箱未组托,无法绑定站点"); |
| | |
| | | |
| | | agvBasDevp.setBarcode(barcode); |
| | | agvBasDevp.setLocSts("F"); |
| | | agvBasDevp.setLocType2(containerType); |
| | | agvBasDevpService.update(agvBasDevp,(new EntityWrapper<AgvBasDevp>().eq("dev_no",stationCode))); |
| | | } |
| | | |
| | |
| | | //检索库位,选择合适的库位 |
| | | AgvLocMast agvLocMast = agvCommonService.getLocNo(agvBasDevp.getLocType1()); |
| | | //生成工作档 |
| | | AgvWrkMast wrkMast = createWrkMast(1,201L,agvBasDevp.getDevNo(),agvLocMast.getLocNo(),agvBasDevp.getBarcode(),now,userId, isConveyor); |
| | | AgvWrkMast wrkMast = createWrkMast(1,201L,agvBasDevp.getDevNo(),agvLocMast.getLocNo(),agvBasDevp.getBarcode(),now,userId, agvBasDevp.getLocType2()); |
| | | //标记是否为输送线入库 |
| | | wrkMast.setMk(isConveyor ? "Y" : "N"); |
| | | //生成工作档明细 |
| | |
| | | //判断是否全板出库 |
| | | int ioType = isPakOut(sourceLocNo,taskDto) ? 101 : 103; |
| | | //生成工作档 |
| | | AgvWrkMast wrkMast = createWrkMast(ioType,wrkSts,sourceLocNo,targetLocNo,containerCode,now,userId,false); |
| | | AgvWrkMast wrkMast = createWrkMast(ioType,wrkSts,sourceLocNo,targetLocNo,containerCode,now,userId,0); |
| | | //生成工作档明细 |
| | | taskDto.getLocDtos().forEach(locDto -> { |
| | | if (!BaseController.isJSON(locDto.getOrderNo())) { |
| | |
| | | return; |
| | | } |
| | | |
| | | int containerType = getContainerTypeByloc(taskDto.getLocNo()); |
| | | |
| | | //生成工作档 |
| | | AgvWrkMast wrkMast = createWrkMast(107, 21L,taskDto.getLocNo(),taskDto.getAgvStaNo(),taskDto.getLocDtos().get(0).getContainerCode(),now,userId,false); |
| | | AgvWrkMast wrkMast = createWrkMast(107, 21L,taskDto.getLocNo(),taskDto.getAgvStaNo(),taskDto.getLocDtos().get(0).getContainerCode(),now,userId,containerType); |
| | | //生成工作档明细 |
| | | taskDto.getLocDtos().forEach(locDto -> { |
| | | //明细档所需参数 |
| | |
| | | } |
| | | |
| | | Date now = new Date(); |
| | | |
| | | //生成移库工作档 |
| | | AgvWrkMast wrkMast = createWrkMast(11, 21L, sourceLocNo, targetLocNo, sourceLocDetl.getSuppCode(), now, userId,false); |
| | | AgvWrkMast wrkMast = createWrkMast(11, 21L, sourceLocNo, targetLocNo, sourceLocDetl.getSuppCode(), now, userId,getContainerTypeByloc(sourceLocNo)); |
| | | //生成工作党明细 |
| | | createWrkDetlReWrite(sourceLocDetl.getMatnr(),wrkMast.getWrkNo(),null,sourceLocDetl.getBatch(),sourceLocDetl.getAnfme(),sourceLocDetl.getZpallet(),now,userId,sourceLocDetl.getThreeCode(),sourceLocDetl.getDeadTime()); |
| | | //修改目标库位状态 |
| | |
| | | 入库 |
| | | */ |
| | | @Transactional |
| | | public String emptyPlateIn(String station,String containerCode,int containerType, Long userId) { |
| | | public String emptyPlateIn(String station,String containerCode,Short containerType, Long userId) { |
| | | |
| | | Date now = new Date(); |
| | | // 源站点状态检测 |
| | |
| | | List<AgvWaitPakin> agvWaitPakinList = agvWaitPakinService.selectByContainerCode(containerCode); |
| | | if(!Cools.isEmpty(agvWaitPakinList)){ |
| | | //生成工作档 |
| | | AgvWrkMast wrkMast = createWrkMast(1,201L,agvBasDevp.getDevNo(),agvLocMast.getLocNo(),containerCode,now,userId, false); |
| | | AgvWrkMast wrkMast = createWrkMast(1,201L,agvBasDevp.getDevNo(),agvLocMast.getLocNo(),containerCode,now,userId, agvBasDevp.getLocType2()); |
| | | //生成工作档明细 |
| | | agvWaitPakinList.forEach(wp -> { |
| | | createWrkDetlReWrite(wp.getMatnr(),wrkMast.getWrkNo(),wp.getOrderNo(),wp.getBatch(),wp.getAnfme(),wp.getSuppCode(),now,userId,wp.getThreeCode(),wp.getDeadTime()); |
| | | }); |
| | | //修改入库通知档状态 |
| | | agvWaitPakinService.updateIoStatus(containerCode,"Y"); |
| | | //更新源站点状态 |
| | | updateAgvBasDevp(agvBasDevp,"R"); |
| | | }else { |
| | | // 生成工作档 10.空板入库 |
| | | createWrkMast(10,201L,agvBasDevp.getDevNo(),agvLocMast.getLocNo(),containerCode,now,userId,false); |
| | | createWrkMast(10,201L,agvBasDevp.getDevNo(),agvLocMast.getLocNo(),containerCode,now,userId,containerType); |
| | | //更新源站点状态 |
| | | updateAgvBasDevp(agvBasDevp,"R",containerType); |
| | | } |
| | | |
| | | //更新源站点状态 |
| | | updateAgvBasDevp(agvBasDevp,"R"); |
| | | //更新目标库位状态和信息 |
| | | updateAgvLocMast(agvLocMast,"S", (short) containerType); |
| | | updateAgvLocMast(agvLocMast,"S"); |
| | | return agvLocMast.getLocNo(); |
| | | } |
| | | |
| | |
| | | throw new CoolException("暂无当前出库站点类型的空托盘!"); |
| | | } |
| | | //生成工作档 |
| | | createWrkMast(110,21L,agvLocMast.getLocNo(),agvBasDevp.getDevNo(),agvLocMast.getBarcode(),now,userId,false); |
| | | createWrkMast(110,21L,agvLocMast.getLocNo(),agvBasDevp.getDevNo(),agvLocMast.getBarcode(),now,userId,containerType); |
| | | |
| | | //修改源库位状态 |
| | | updateAgvLocMast(agvLocMast,"R"); |
| | |
| | | String devNo = wrkMast.getSourceLocNo(); |
| | | //目标库位 |
| | | String locNo = wrkMast.getLocNo(); |
| | | agvLocMastService.updateLocStsByLocNo(locNo,"O",""); |
| | | agvLocMastService.updateLocStsByLocNo(locNo,"O","",null); |
| | | agvBasDevpService.updateLocStsAndBarcodeByDevNo(devNo,"F",wrkMast.getBarcode()); |
| | | |
| | | //出库取消 |
| | |
| | | String locNo = wrkMast.getSourceLocNo(); |
| | | //目标站点 |
| | | String devNo = wrkMast.getLocNo(); |
| | | agvLocMastService.updateLocStsByLocNo(locNo,"F",wrkMast.getBarcode()); |
| | | agvLocMastService.updateLocStsByLocNo(locNo,"F",wrkMast.getBarcode(),(short)getContainerTypeByloc(locNo)); |
| | | if(devNo.contains("@")){ |
| | | agvBasDevpService.updateLocStsAndBarcodeByDevNo(devNo,"O",""); |
| | | } |
| | |
| | | } |
| | | |
| | | /* |
| | | 更新源站点信息和库位托盘类型 |
| | | */ |
| | | private void updateAgvBasDevp(AgvBasDevp agvBasDevp, String locSts, Short continerType){ |
| | | if(!Cools.isEmpty(agvBasDevp)){ |
| | | agvBasDevp.setLocSts(locSts); |
| | | agvBasDevp.setLocType2(continerType); |
| | | agvBasDevpService.updateById(agvBasDevp); |
| | | } |
| | | } |
| | | |
| | | /* |
| | | 生成工作档明细 |
| | | */ |
| | | private void createWrkDetlReWrite(String matnr, int wrkNo, String orderNo,String batch, double anfme, String zpallet, Date now, Long userId, String csocode, String isoseq){ |
| | |
| | | /* |
| | | 生成工作档 |
| | | */ |
| | | private AgvWrkMast createWrkMast(int ioType, long wrkSts, String sourceLocNo, String locNo, String barcode, Date now, Long userId, boolean isConveyor){ |
| | | private AgvWrkMast createWrkMast(int ioType, long wrkSts, String sourceLocNo, String locNo, String barcode, Date now, Long userId, int containerType){ |
| | | AgvWrkMast wrkMast = new AgvWrkMast(); |
| | | //工作状态 |
| | | wrkMast.setWrkSts(wrkSts); |
| | |
| | | wrkMast.setLocNo(locNo); |
| | | //容器编码 |
| | | wrkMast.setBarcode(barcode); |
| | | //标记是否为输送线入库 |
| | | wrkMast.setMk(isConveyor ? "Y" : "N"); |
| | | //容器类型 |
| | | wrkMast.setWhsType(containerType); |
| | | |
| | | wrkMast.setAppeUser(userId); |
| | | wrkMast.setAppeTime(now); |
| | | wrkMast.setModiUser(userId); |
| | |
| | | } |
| | | } |
| | | |
| | | private int getContainerTypeByloc(String locNo){ |
| | | |
| | | return agvLocMastService.selectOne(new EntityWrapper<AgvLocMast>().eq("loc_no",locNo)).getLocType2(); |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | //修改工作档状态为207.库存更新完成 |
| | | agvWrkMast.setWrkSts(207L); |
| | | agvWrkMastService.updateById(agvWrkMast); |
| | | if(agvWrkMast.getIoType() == 10){ |
| | | // 空板入库 设置库位状态为D.空桶/空栈板 |
| | | agvLocMastService.updateLocStsByLocNo(agvWrkMast.getLocNo(),"D",agvWrkMast.getBarcode()); |
| | | }else{ |
| | | //修改目标库位状态为F.在库 |
| | | agvLocMastService.updateLocStsByLocNo(agvWrkMast.getLocNo(),"F",agvWrkMast.getBarcode()); |
| | | } |
| | | // 空板入库 设置库位状态为D.空桶/空栈板 |
| | | String locSts = agvWrkMast.getIoType() == 10 ? "D" : "F"; |
| | | agvLocMastService.updateLocStsByLocNo(agvWrkMast.getLocNo(),locSts,agvWrkMast.getBarcode(),agvWrkMast.getWhsType().shortValue()); |
| | | //生成AGV工作历史档 |
| | | agvWrkMastLogService.save(agvWrkMast); |
| | | //生成AGV工作明细历史档 |
| | |
| | | //更新库存明细 |
| | | agvLocDetlService.updateStock(agvWrkMast.getSourceLocNo(),agvWrkMast.getLocNo()); |
| | | //修改源库位状态为O |
| | | agvLocMastService.updateLocStsByLocNo(agvWrkMast.getSourceLocNo(),"O",""); |
| | | agvLocMastService.updateLocStsByLocNo(agvWrkMast.getSourceLocNo(),"O","",null); |
| | | } |
| | | |
| | | //删除AGV工作档 |
| | |
| | | agvWrkMast.setWrkSts(207L); |
| | | agvWrkMastService.updateById(agvWrkMast); |
| | | //修改源库位状态为O |
| | | agvLocMastService.updateLocStsByLocNo(agvWrkMast.getSourceLocNo(),"O",""); |
| | | agvLocMastService.updateLocStsByLocNo(agvWrkMast.getSourceLocNo(),"O","",null); |
| | | if(agvWrkMast.getIoType() == 101){ |
| | | //更新目标库位明细 101.出库 删除源库位库存明细 |
| | | agvLocDetlService.delete(new EntityWrapper<AgvLocDetl>().eq("loc_no",agvWrkMast.getSourceLocNo())); |