| | |
| | | 入库 |
| | | */ |
| | | @Transactional |
| | | public String emptyPlateIn(String station,String containerCode,Short containerType, Long userId) { |
| | | public String emptyPlateIn(String station,String containerCode,Short containerType, Long userId, boolean emptyAutoIn) { |
| | | |
| | | Date now = new Date(); |
| | | // 源站点状态检测 |
| | | //AgvBasDevp agvBasDevp = agvBasDevpService.selectByDevNo(station); |
| | | |
| | | AgvBasDevp agvBasDevp = agvBasDevpService.selectById(station); |
| | | |
| | | //初始定义为空板入库类型 |
| | | int ioType = 10; |
| | | |
| | | // if(Cools.isEmpty(agvBasDevp.getBarcode())){ |
| | | // agvBasDevp.setBarcode(containerCode); |
| | | // } |
| | | |
| | | if(!Cools.eq(agvBasDevp.getBarcode(),containerCode) && !agvBasDevp.getLocSts().equals("O")){ |
| | | if(!Cools.eq(agvBasDevp.getBarcode(),containerCode) && !agvBasDevp.getLocSts().equals("O") && !emptyAutoIn){ |
| | | throw new CoolException("当前工作位状态为" + agvBasDevp.getLocSts()+",无法进行空板入库"); |
| | | } |
| | | |
| | | //查询工作档 |
| | | AgvWrkMast agvWrkMast = agvWrkMastService.selectByContainerCode(containerCode); |
| | | if(!Cools.isEmpty(agvWrkMast)){ |
| | | if(!Cools.isEmpty(agvWrkMast) && !emptyAutoIn){ |
| | | throw new CoolException("当前容器已有入库任务,无法进行入库"); |
| | | } |
| | | |
| | |
| | | //修改入库通知档状态 |
| | | agvWaitPakinService.updateIoStatus(containerCode,"Y"); |
| | | //更新源站点状态 |
| | | updateAgvBasDevp(agvBasDevp,"R"); |
| | | updateAgvBasDevp(agvBasDevp,"R",containerType); |
| | | }else { |
| | | // 生成工作档 10.空板入库 |
| | | createWrkMast(10,201L,agvBasDevp.getDevNo(),agvLocMast.getLocNo(),containerCode,now,userId,containerType); |
| | | //更新源站点状态 |
| | | updateAgvBasDevp(agvBasDevp,"R",containerType); |
| | | updateAgvBasDevp(agvBasDevp,"R",containerType,containerCode); |
| | | } |
| | | |
| | | //更新目标库位状态和信息 |
| | |
| | | |
| | | //寻找相应类型的空托盘 |
| | | AgvLocMast agvLocMast = agvLocMastService.selectEmptyZpallet(containerType); |
| | | if(containerType == 0){ |
| | | //空板自动出库,根据站点类型选择 |
| | | agvLocMastService.selectEmptyZpalletByLocType1(agvBasDevp.getLocType1()); |
| | | |
| | | } |
| | | |
| | | if (Cools.isEmpty(agvLocMast)) { |
| | | throw new CoolException("暂无当前出库站点类型的空托盘!"); |
| | | } |
| | |
| | | updateAgvLocMast(agvLocMast,"R"); |
| | | |
| | | //修改站点状态 |
| | | updateAgvBasDevp(agvBasDevp,"S"); |
| | | updateAgvBasDevp(agvBasDevp,"S",(short)containerType,agvLocMast.getBarcode()); |
| | | |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | //保存工作档以及明细 |
| | | agvWrkMastLogService.save(wrkMast); |
| | | agvWrkDetlLogService.save(wrkMast.getWrkNo()); |
| | | |
| | | //删除工作档以及明细 |
| | | if(!agvWrkMastService.deleteByWrkNo(wrkMast.getWrkNo()) || !agvWrkDetlService.deleteByWrkNo(wrkMast.getWrkNo())){ |
| | | throw new CoolException("删除失败,请联系管理员"); |
| | | } |
| | | |
| | | if(wrkMast.getIoType() == 1 || wrkMast.getIoType() == 10){ |
| | | return; |
| | | } |
| | | |
| | | //订单回滚 |
| | | //List<AgvWrkDetl> agvWrkDetlList = agvWrkDetlService.selectByWrkNo(wrkMast.getWrkNo()); |
| | |
| | | } |
| | | } |
| | | }); |
| | | |
| | | |
| | | //保存工作档以及明细 |
| | | agvWrkMastLogService.save(wrkMast); |
| | | agvWrkDetlLogService.save(wrkMast.getWrkNo()); |
| | | |
| | | //删除工作档以及明细 |
| | | if(!agvWrkMastService.deleteByWrkNo(wrkMast.getWrkNo()) || !agvWrkDetlService.deleteByWrkNo(wrkMast.getWrkNo())){ |
| | | throw new CoolException("删除失败,请联系管理员"); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | private void updateAgvBasDevp(AgvBasDevp agvBasDevp, String locSts, Short continerType, String containerCode){ |
| | | if(!Cools.isEmpty(agvBasDevp)){ |
| | | agvBasDevp.setLocSts(locSts); |
| | | agvBasDevp.setLocType2(continerType); |
| | | agvBasDevp.setBarcode(containerCode); |
| | | agvBasDevpService.updateById(agvBasDevp); |
| | | } |
| | | } |
| | | |
| | | /* |
| | | 生成工作档明细 |
| | | */ |