| | |
| | | @Autowired |
| | | AgvBasDevpService agvBasDevpService; |
| | | |
| | | public ReturnT<String> start(AgvLocMast agvLocMast) { |
| | | // locType 1. 自动, 2. 手动 |
| | | if (agvLocMast.getLocType().equals("1")) { |
| | | return doAutoMove(agvLocMast); |
| | | } else if (agvLocMast.getLocType().equals("2")) { |
| | | return doHandMove(agvLocMast); |
| | | } |
| | | return SUCCESS; |
| | | } |
| | | // public ReturnT<String> start(AgvLocMast agvLocMast) { |
| | | // // locType 1. 自动, 2. 手动 |
| | | // if (agvLocMast.getLocType().equals("1")) { |
| | | // return doAutoMove(agvLocMast); |
| | | // } else if (agvLocMast.getLocType().equals("2")) { |
| | | // return doHandMove(agvLocMast); |
| | | // } |
| | | // return SUCCESS; |
| | | // } |
| | | |
| | | public ReturnT<String> start2(AgvWrkMast agvWrkMast) { |
| | | // locType 1. 自动, 2. 手动 |
| | |
| | | return SUCCESS; |
| | | } |
| | | //根据库位的loctype值发送任务--弃用 |
| | | private ReturnT<String> doAutoMove(AgvLocMast agvLocMast) { |
| | | Date now = new Date(); |
| | | //查询工作档 |
| | | AgvWrkMast agvWrkMast = agvWrkMastService.selectByContainerCode(agvLocMast.getBarcode()); |
| | | if(!Cools.isEmpty(agvWrkMast)){ |
| | | throw new CoolException("当前"+agvLocMast.getBarcode()+"货架码已在工作档中"); |
| | | } |
| | | //检索库位,选择合适的库位 |
| | | AgvLocMast LocMast = agvCommonService.getLocNo(3,agvLocMast.getLocType3(),false,true); |
| | | //生成工作档 |
| | | AgvWrkMast mast = new AgvWrkMast(); |
| | | //工作状态 |
| | | mast.setWrkSts(201L); |
| | | //入出库类型 |
| | | mast.setIoType(108); |
| | | mast.setIoTime(now); |
| | | //优先级 |
| | | mast.setIoPri(300.0); |
| | | //源站点 |
| | | mast.setSourceLocNo(agvLocMast.getLocNo()); |
| | | //目标站点 |
| | | mast.setLocNo(LocMast.getLocNo()); |
| | | //货架编码 |
| | | mast.setBarcode(agvLocMast.getBarcode()); |
| | | //货架类型 |
| | | mast.setWhsType(30); |
| | | |
| | | mast.setAppeUser(9527L); |
| | | mast.setAppeTime(now); |
| | | mast.setModiUser(9527L); |
| | | mast.setModiTime(now); |
| | | mast.setLogErrMemo("doAutoMove"); |
| | | if (!agvWrkMastService.insertByIncrease(mast)) { |
| | | throw new CoolException("保存工作档失败"); |
| | | } |
| | | |
| | | AgvWrkMast mast1 = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("loc_no", LocMast.getLocNo()).eq("source_loc_no",agvLocMast.getLocNo())); |
| | | //生成工作档明细 |
| | | List<AgvLocDetl> agvLocDetls = agvLocDetlService.selectList(new EntityWrapper<AgvLocDetl>().eq("loc_no", agvLocMast.getLocNo())); |
| | | agvLocDetls.forEach(agvLocDetl -> { |
| | | AgvWrkDetl wrkDetl = new AgvWrkDetl(); |
| | | wrkDetl.setWrkNo(mast1.getWrkNo()); |
| | | wrkDetl.sync(agvLocDetl); |
| | | wrkDetl.setSpecs("1-" + agvLocMast.getLocType3()); |
| | | wrkDetl.setSuppCode(agvLocDetl.getSuppCode()); |
| | | wrkDetl.setIoTime(now); |
| | | wrkDetl.setAppeUser(9527L); |
| | | wrkDetl.setAppeTime(now); |
| | | wrkDetl.setModiUser(9527L); |
| | | wrkDetl.setModiTime(now); |
| | | if (!agvWrkDetlService.insert(wrkDetl)) { |
| | | throw new CoolException("保存工作明细失败"); |
| | | } |
| | | }); |
| | | //更新目标库位状态 |
| | | updateAgvLocMast(agvLocMast,"R"); |
| | | updateAgvLocMast(LocMast,"S"); |
| | | |
| | | return SUCCESS; |
| | | } |
| | | // private ReturnT<String> doAutoMove(AgvLocMast agvLocMast) { |
| | | // Date now = new Date(); |
| | | // //查询工作档 |
| | | // AgvWrkMast agvWrkMast = agvWrkMastService.selectByContainerCode(agvLocMast.getBarcode()); |
| | | // if(!Cools.isEmpty(agvWrkMast)){ |
| | | // throw new CoolException("当前"+agvLocMast.getBarcode()+"货架码已在工作档中"); |
| | | // } |
| | | // //检索库位,选择合适的库位 |
| | | // AgvLocMast LocMast = agvCommonService.getLocNo(3,agvLocMast.getLocType3(),false,true); |
| | | // //生成工作档 |
| | | // AgvWrkMast mast = new AgvWrkMast(); |
| | | // //工作状态 |
| | | // mast.setWrkSts(201L); |
| | | // //入出库类型 |
| | | // mast.setIoType(108); |
| | | // mast.setIoTime(now); |
| | | // //优先级 |
| | | // mast.setIoPri(300.0); |
| | | // //源站点 |
| | | // mast.setSourceLocNo(agvLocMast.getLocNo()); |
| | | // //目标站点 |
| | | // mast.setLocNo(LocMast.getLocNo()); |
| | | // //货架编码 |
| | | // mast.setBarcode(agvLocMast.getBarcode()); |
| | | // //货架类型 |
| | | // mast.setWhsType(30); |
| | | // |
| | | // mast.setAppeUser(9527L); |
| | | // mast.setAppeTime(now); |
| | | // mast.setModiUser(9527L); |
| | | // mast.setModiTime(now); |
| | | // mast.setLogErrMemo("doAutoMove"); |
| | | // if (!agvWrkMastService.insertByIncrease(mast)) { |
| | | // throw new CoolException("保存工作档失败"); |
| | | // } |
| | | // |
| | | // AgvWrkMast mast1 = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("loc_no", LocMast.getLocNo()).eq("source_loc_no",agvLocMast.getLocNo())); |
| | | // //生成工作档明细 |
| | | // List<AgvLocDetl> agvLocDetls = agvLocDetlService.selectList(new EntityWrapper<AgvLocDetl>().eq("loc_no", agvLocMast.getLocNo())); |
| | | // agvLocDetls.forEach(agvLocDetl -> { |
| | | // AgvWrkDetl wrkDetl = new AgvWrkDetl(); |
| | | // wrkDetl.setWrkNo(mast1.getWrkNo()); |
| | | // wrkDetl.sync(agvLocDetl); |
| | | // wrkDetl.setSpecs("1-" + agvLocMast.getLocType3()); |
| | | // wrkDetl.setSuppCode(agvLocDetl.getSuppCode()); |
| | | // wrkDetl.setIoTime(now); |
| | | // wrkDetl.setAppeUser(9527L); |
| | | // wrkDetl.setAppeTime(now); |
| | | // wrkDetl.setModiUser(9527L); |
| | | // wrkDetl.setModiTime(now); |
| | | // if (!agvWrkDetlService.insert(wrkDetl)) { |
| | | // throw new CoolException("保存工作明细失败"); |
| | | // } |
| | | // }); |
| | | // //更新目标库位状态 |
| | | // updateAgvLocMast(agvLocMast,"R"); |
| | | // updateAgvLocMast(LocMast,"S"); |
| | | // |
| | | // return SUCCESS; |
| | | // } |
| | | |
| | | private ReturnT<String> doHandMove(AgvLocMast agvLocMast) { |
| | | Date now = new Date(); |
| | |
| | | private ReturnT<String> doAutoMove2(AgvWrkMast agvWrkMast) { |
| | | Date now = new Date(); |
| | | //检索库位,选择合适的库位 |
| | | AgvLocMast locMast = agvCommonService.getLocNo(3,agvWrkMast.getCrnNo(),false,true); |
| | | AgvLocMast locMast = agvCommonService.getLocNo(3,agvWrkMast.getCrnNo(),false,true,null); |
| | | if (Cools.isEmpty(locMast)) { |
| | | throw new CoolException("暂无库位"); |
| | | } |
| | |
| | | private ReturnT<String> doAutoMove3(AgvWrkMast agvWrkMast) { |
| | | Date now = new Date(); |
| | | //检索库位,选择合适的库位 |
| | | AgvLocMast locMast = agvCommonService.getLocNo(3,agvWrkMast.getCrnNo(),false,false); |
| | | AgvLocMast locMast = agvCommonService.getLocNo(3,agvWrkMast.getCrnNo(),false,false,null); |
| | | if (Cools.isEmpty(locMast)) { |
| | | throw new CoolException("暂无库位"); |
| | | } |
| | |
| | | Date now = new Date(); |
| | | AgvBasDevp agvBasDevp = agvBasDevpService.selectByDevNo(agvWrkMast.getSourceLocNo()); |
| | | //检索空闲接驳位,选择合适的接驳位 |
| | | AgvLocMast locMast = agvCommonService.getLocNo(3, 1,true,true); |
| | | AgvLocMast locMast = agvCommonService.getLocNo(3, 1,true,true,null); |
| | | if (Cools.isEmpty(locMast)) { |
| | | throw new CoolException("1楼暂无空库位"); |
| | | } |
| | |
| | | return SUCCESS; |
| | | } |
| | | |
| | | public ReturnT<String> autoEmptyBack2(AgvLocMast agvLocMast) { |
| | | Date now = new Date(); |
| | | //查询工作档 |
| | | AgvWrkMast agvWrkMast = agvWrkMastService.selectByContainerCode(agvLocMast.getBarcode()); |
| | | if(!Cools.isEmpty(agvWrkMast)){ |
| | | throw new CoolException("当前"+agvLocMast.getBarcode()+"货架码已在工作档中"); |
| | | } |
| | | //检索库位,选择合适的库位 |
| | | AgvLocMast LocMast = agvCommonService.getLocNo(3,1,true,true); |
| | | //生成工作档 |
| | | AgvWrkMast mast = new AgvWrkMast(); |
| | | //工作状态 |
| | | mast.setWrkSts(201L); |
| | | //入出库类型 |
| | | mast.setIoType(109); |
| | | mast.setIoTime(now); |
| | | //优先级 |
| | | mast.setIoPri(300.0); |
| | | //源站点 |
| | | mast.setSourceLocNo(agvLocMast.getLocNo()); |
| | | //目标站点 |
| | | mast.setLocNo(LocMast.getLocNo()); |
| | | //货架编码 |
| | | mast.setBarcode(agvLocMast.getBarcode()); |
| | | //货架类型 |
| | | mast.setWhsType(30); |
| | | |
| | | mast.setAppeUser(9527L); |
| | | mast.setAppeTime(now); |
| | | mast.setModiUser(9527L); |
| | | mast.setModiTime(now); |
| | | mast.setLogErrMemo("autoEmptyBack2"); |
| | | if (!agvWrkMastService.insertByIncrease(mast)) { |
| | | throw new CoolException("保存工作档失败"); |
| | | } |
| | | |
| | | //更新目标库位状态 |
| | | updateAgvLocMast(agvLocMast,"R"); |
| | | updateAgvLocMast(LocMast,"S"); |
| | | return SUCCESS; |
| | | } |
| | | // public ReturnT<String> autoEmptyBack2(AgvLocMast agvLocMast) { |
| | | // Date now = new Date(); |
| | | // //查询工作档 |
| | | // AgvWrkMast agvWrkMast = agvWrkMastService.selectByContainerCode(agvLocMast.getBarcode()); |
| | | // if(!Cools.isEmpty(agvWrkMast)){ |
| | | // throw new CoolException("当前"+agvLocMast.getBarcode()+"货架码已在工作档中"); |
| | | // } |
| | | // //检索库位,选择合适的库位 |
| | | // AgvLocMast LocMast = agvCommonService.getLocNo(3,1,true,true); |
| | | // //生成工作档 |
| | | // AgvWrkMast mast = new AgvWrkMast(); |
| | | // //工作状态 |
| | | // mast.setWrkSts(201L); |
| | | // //入出库类型 |
| | | // mast.setIoType(109); |
| | | // mast.setIoTime(now); |
| | | // //优先级 |
| | | // mast.setIoPri(300.0); |
| | | // //源站点 |
| | | // mast.setSourceLocNo(agvLocMast.getLocNo()); |
| | | // //目标站点 |
| | | // mast.setLocNo(LocMast.getLocNo()); |
| | | // //货架编码 |
| | | // mast.setBarcode(agvLocMast.getBarcode()); |
| | | // //货架类型 |
| | | // mast.setWhsType(30); |
| | | // |
| | | // mast.setAppeUser(9527L); |
| | | // mast.setAppeTime(now); |
| | | // mast.setModiUser(9527L); |
| | | // mast.setModiTime(now); |
| | | // mast.setLogErrMemo("autoEmptyBack2"); |
| | | // if (!agvWrkMastService.insertByIncrease(mast)) { |
| | | // throw new CoolException("保存工作档失败"); |
| | | // } |
| | | // |
| | | // //更新目标库位状态 |
| | | // updateAgvLocMast(agvLocMast,"R"); |
| | | // updateAgvLocMast(LocMast,"S"); |
| | | // return SUCCESS; |
| | | // } |
| | | |
| | | public ReturnT<String> autoEmptyBack4(AgvLocMast agvLocMast) { |
| | | Date now = new Date(); |
| | |
| | | ioType = 109; |
| | | } else { |
| | | //检索库位,选择合适的库位 |
| | | locMast = agvCommonService.getLocNo(3,1,true,true); |
| | | locMast = agvCommonService.getLocNo(3,1,true,true,null); |
| | | locNo = locMast.getLocNo(); |
| | | wrkSts = 201L; |
| | | ioType = 109; |
| | |
| | | //入出库类型 |
| | | mast.setIoType(109); |
| | | //检索库位,选择合适的库位 |
| | | AgvLocMast locMast = agvCommonService.getLocNo(3,1,true,true); |
| | | AgvLocMast locMast = agvCommonService.getLocNo(3,1,true,true,null); |
| | | mast.setLocNo(locMast.getLocNo()); |
| | | updateAgvLocMast(locMast,"S"); |
| | | } else { |
| | |
| | | throw new CoolException("当前"+agvLocMast.getBarcode()+"货架码已在工作档中"); |
| | | } |
| | | //检索库位,选择合适的库位 |
| | | AgvLocMast LocMast = agvCommonService.getLocNo(3,1,false,false); |
| | | AgvLocMast LocMast = agvCommonService.getLocNo(3,1,false,false,null); |
| | | if (LocMast.getLev1() != 2) { |
| | | throw new CoolException("目标楼层不是吸塑二楼"); |
| | | } |