| | |
| | | mast.setAppeTime(now); |
| | | mast.setModiUser(9527L); |
| | | mast.setModiTime(now); |
| | | mast.setLogErrMemo("doAutoMove"); |
| | | if (!agvWrkMastService.insertByIncrease(mast)) { |
| | | throw new CoolException("保存工作档失败"); |
| | | } |
| | |
| | | //检索库位,选择合适的库位 |
| | | AgvLocMast locMast = agvCommonService.getLocNo(3,agvWrkMast.getCrnNo(),false,true); |
| | | if (Cools.isEmpty(locMast)) { |
| | | throw new CoolException("暂无库位"); |
| | | log.info("暂无库位"); |
| | | return FAIL; |
| | | //throw new CoolException("暂无库位"); |
| | | } |
| | | AgvWrkMast workingMast = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("loc_no", locMast.getLocNo())); |
| | | if (!Cools.isEmpty(workingMast)) { |
| | | throw new CoolException("当前库位正在进行入库,进行下一次轮询"); |
| | | log.info("当前库位正在进行入库,进行下一次轮询"); |
| | | return FAIL; |
| | | //throw new CoolException("当前库位正在进行入库,进行下一次轮询"); |
| | | } |
| | | agvWrkMast.setWrkSts(201L); |
| | | agvWrkMast.setModiTime(new Date()); |
| | | agvWrkMast.setLocNo(locMast.getLocNo()); |
| | | agvWrkMast.setLogErrMemo("start2-doAutoMove2"); |
| | | agvWrkMastService.updateById(agvWrkMast); |
| | | //更新目标库位状态 |
| | | updateAgvLocMast(locMast,"S"); |
| | |
| | | //检索库位,选择合适的库位 |
| | | AgvLocMast locMast = agvCommonService.getLocNo(3,agvWrkMast.getCrnNo(),false,false); |
| | | if (Cools.isEmpty(locMast)) { |
| | | throw new CoolException("暂无库位"); |
| | | log.info("暂无库位"); |
| | | return FAIL; |
| | | //throw new CoolException("暂无库位"); |
| | | } |
| | | agvWrkMast.setWrkSts(201L); |
| | | agvWrkMast.setLocNo(locMast.getLocNo()); |
| | | agvWrkMast.setLogErrMemo("start2-doAutoMove2"); |
| | | agvWrkMast.setModiTime(new Date()); |
| | | agvWrkMastService.updateById(agvWrkMast); |
| | | //更新目标库位状态 |
| | | updateAgvLocMast(locMast,"S"); |
| | |
| | | } |
| | | |
| | | if (Cools.isEmpty(devpNo)) { |
| | | throw new CoolException("暂无空闲接驳位"); |
| | | log.info("暂无空闲接驳位"); |
| | | return FAIL; |
| | | //throw new CoolException("暂无空闲接驳位"); |
| | | } |
| | | agvWrkMast.setWrkSts(201L); |
| | | agvWrkMast.setLocNo(devpNo.getDevNo()); |
| | | agvWrkMast.setModiTime(new Date()); |
| | | agvWrkMast.setLogErrMemo("start3-doHandMove2"); |
| | | agvWrkMastService.updateById(agvWrkMast); |
| | | agvWrkMast.setModiTime(new Date()); |
| | | updateAgvBasDevp(devpNo,"S",null,agvWrkMast.getBarcode()); |
| | | return SUCCESS; |
| | | } |
| | |
| | | mast.setAppeTime(now); |
| | | mast.setModiUser(9527L); |
| | | mast.setModiTime(now); |
| | | mast.setLogErrMemo("autoEmptyBack"); |
| | | if (!agvWrkMastService.insertByIncrease(mast)) { |
| | | throw new CoolException("保存工作档失败"); |
| | | } |
| | |
| | | updateAgvBasDevp(devpNo,"S",agvLocMast.getLocType2(),agvLocMast.getBarcode()); |
| | | return SUCCESS; |
| | | } |
| | | |
| | | public ReturnT<String> autoEmptyBack3(AgvWrkMast agvWrkMast) { |
| | | Date now = new Date(); |
| | | AgvBasDevp agvBasDevp = agvBasDevpService.selectByDevNo(agvWrkMast.getSourceLocNo()); |
| | |
| | | agvWrkMast.setLocNo(locMast.getLocNo()); |
| | | agvWrkMast.setModiUser(9527L); |
| | | agvWrkMast.setModiTime(now); |
| | | agvWrkMast.setLogErrMemo("autoEmptyBack3"); |
| | | if (!agvWrkMastService.updateById(agvWrkMast)) { |
| | | throw new CoolException("保存工作档失败"); |
| | | } |
| | |
| | | updateAgvBasDevp(agvBasDevp,"R"); |
| | | return SUCCESS; |
| | | } |
| | | |
| | | public ReturnT<String> autoEmptyBack2(AgvLocMast agvLocMast) { |
| | | Date now = new Date(); |
| | | //查询工作档 |
| | |
| | | mast.setAppeTime(now); |
| | | mast.setModiUser(9527L); |
| | | mast.setModiTime(now); |
| | | mast.setLogErrMemo("autoEmptyBack2"); |
| | | if (!agvWrkMastService.insertByIncrease(mast)) { |
| | | throw new CoolException("保存工作档失败"); |
| | | } |
| | |
| | | } |
| | | List<AgvWrkMast> agvWrkMasts = agvWrkMastService.selectList(new EntityWrapper<AgvWrkMast>().eq("io_type", 109).like("source_loc_no", floor).or().eq("io_type", 113)); |
| | | if (agvWrkMasts.size() >= 5) { |
| | | throw new CoolException("暂停回流"); |
| | | log.error("暂停回流"); |
| | | return FAIL; |
| | | //throw new CoolException("暂停回流"); |
| | | } |
| | | //检索空闲可入接驳位 没有空闲可入接驳位 直接找库位 |
| | | AgvBasDevp devpNo = agvCommonService.getDevpNo(3, agvLocMast.getFloor(),"Y","Y"); |
| | |
| | | mast.setAppeTime(now); |
| | | mast.setModiUser(9527L); |
| | | mast.setModiTime(now); |
| | | mast.setLogErrMemo("autoEmptyBack4"); |
| | | if (!agvWrkMastService.insertByIncrease(mast)) { |
| | | throw new CoolException("保存工作档失败"); |
| | | } |
| | |
| | | mast.setAppeTime(now); |
| | | mast.setModiUser(9527L); |
| | | mast.setModiTime(now); |
| | | mast.setLogErrMemo("autoEmptyBack5"); |
| | | // 判断 接驳点是否自动 |
| | | if ("Y".equals(agvBasDevp.getAutoing())) { |
| | | //工作状态 |
| | |
| | | mast.setAppeTime(now); |
| | | mast.setModiUser(9527L); |
| | | mast.setModiTime(now); |
| | | mast.setLogErrMemo("autoEmptyBack6"); |
| | | if (!agvWrkMastService.insertByIncrease(mast)) { |
| | | throw new CoolException("保存工作档失败"); |
| | | } |
| | |
| | | |
| | | return SUCCESS; |
| | | } |
| | | |
| | | public ReturnT<String> autoTransfers(AgvLocMast agvLocMast,Integer maxTansk) { |
| | | Date now = new Date(); |
| | | List<AgvLocDetl> locDetls = agvLocDetlService.selectList(new EntityWrapper<AgvLocDetl>().eq("loc_no", agvLocMast.getLocNo())); |
| | | locDetls.forEach(agvLocDetl -> { |
| | | if (agvLocDetl.getProcessSts().equals(1)) { |
| | | throw new CoolException("当前库位有库存未加工"); |
| | | } |
| | | }); |
| | | //查询工作档 |
| | | AgvWrkMast agvWrkMast = agvWrkMastService.selectByContainerCode(agvLocMast.getBarcode()); |
| | | if(!Cools.isEmpty(agvWrkMast)){ |
| | | throw new CoolException("当前"+agvLocMast.getBarcode()+"货架码已在工作档中"); |
| | | } |
| | | //检索库位,选择合适的库位 |
| | | AgvLocMast LocMast = agvCommonService.getLocNo(3,1,false,false); |
| | | if (LocMast.getLev1() != 2) { |
| | | throw new CoolException("目标楼层不是吸塑二楼"); |
| | | } |
| | | List<AgvWrkMast> agvWrkMasts = agvWrkMastService.selectList(new EntityWrapper<AgvWrkMast>().like("loc_no", "02F1").like("source_loc_no", "F1").eq("io_type", 12)); |
| | | if (agvWrkMasts.size() >= maxTansk) { |
| | | throw new CoolException("自动移库任务已到设定最大值:" + maxTansk); |
| | | } |
| | | //生成工作档 |
| | | AgvWrkMast mast = new AgvWrkMast(); |
| | | //工作状态 |
| | | mast.setWrkSts(201L); |
| | | //入出库类型 |
| | | mast.setIoType(12); |
| | | 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.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; |
| | | } |
| | | } |