| | |
| | | import com.zy.common.service.CommonService; |
| | | import com.zy.common.web.param.ReplenishmentParam; |
| | | import com.zy.common.web.param.SearchLocParam; |
| | | import lombok.Synchronized; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | |
| | | return R.parse(CodeRes.NO_COMB_700); |
| | | } |
| | | |
| | | boolean checkTimeout = false; |
| | | for (WaitPakin waitPakin : waitPakins) { |
| | | Mat mat = matService.selectByMatnr(waitPakin.getMatnr()); |
| | | mat.setWeight(waitPakin.getAnfme()); |
| | | mats.add(mat); |
| | | |
| | | Date appeTime = waitPakin.getAppeTime(); |
| | | Date now = new Date(); |
| | | long diffTime = now.getTime() - appeTime.getTime(); |
| | | if (diffTime >= 1000 * 60 * 60 * 4) { |
| | | checkTimeout = true; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (checkTimeout) { |
| | | return R.error("托盘组托超时,删除后重新组托"); |
| | | } |
| | | |
| | | int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet",param.getBarcode())); |
| | |
| | | throw new CoolException(dto.getLocNo() + "目标库位已被占用"); |
| | | } |
| | | |
| | | Date now = new Date(); |
| | | for (LocDetl locDetl : locDetls) { |
| | | locDetl.setLocNo(dto.getLocNo());//修改目标库位 |
| | | locDetl.setAppeTime(now); |
| | | locDetl.setModiTime(now); |
| | | if (!locDetlService.insert(locDetl)) { |
| | | throw new CoolException("库存明细更新失败"); |
| | | } |
| | | } |
| | | // Date now = new Date(); |
| | | // for (LocDetl locDetl : locDetls) { |
| | | // locDetl.setLocNo(dto.getLocNo());//修改目标库位 |
| | | // locDetl.setAppeTime(now); |
| | | // locDetl.setModiTime(now); |
| | | // if (!locDetlService.insert(locDetl)) { |
| | | // throw new CoolException("库存明细更新失败"); |
| | | // } |
| | | // } |
| | | |
| | | //检查目标库位,库存明细是否添加成功 |
| | | List<LocDetl> checkLocDetls = locDetlService.selectByLocNo(dto.getLocNo()); |
| | | if (checkLocDetls.isEmpty()) { |
| | | throw new CoolException("库存明细迁移失败"); |
| | | } |
| | | // //检查目标库位,库存明细是否添加成功 |
| | | // List<LocDetl> checkLocDetls = locDetlService.selectByLocNo(dto.getLocNo()); |
| | | // if (checkLocDetls.isEmpty()) { |
| | | // throw new CoolException("库存明细迁移失败"); |
| | | // } |
| | | |
| | | // //清空源库位数据 |
| | | LocMast locMast1 = locMastService.selectByLoc(wrkMast.getSourceLocNo()); |
| | |
| | | } |
| | | |
| | | //获取回库提升机目标站 |
| | | Integer staNo = liftNo * 100 + locMast1.getLev1(); |
| | | Integer staNo = liftNo * 100 + locMast.getLev1(); |
| | | |
| | | // 更新工作档数据状态 |
| | | wrkMast.setIoType(wrkMast.getIoType() - 50); // 入出库类型: 103->53,104->54 |
| | |
| | | */ |
| | | @PostMapping("/start") |
| | | @ResponseBody |
| | | public R start(@RequestBody ReplenishmentParam param){ |
| | | |
| | | @Transactional |
| | | public synchronized R start(@RequestBody ReplenishmentParam param){ |
| | | log.info("agv start param: " + param.toString()); |
| | | String containerCode = param.getContainerCode(); |
| | | if(Cools.isEmpty(containerCode)){ |
| | | throw new CoolException("料箱码为空"); |
| | |
| | | } |
| | | |
| | | //入库任务 |
| | | if (!Cools.isEmpty(agvWaitPakinService.selectByContainerCode(containerCode))){ |
| | | if (!Cools.isEmpty(agvWaitPakinService.selectByContainerCode(containerCode)) && Cools.isEmpty(agvWrkMast)){ |
| | | //绑定站点 |
| | | agvBasDevpService.updateLocStsAndBarcodeByDevNo(param.getDevNo(),"F",containerCode); |
| | | //生成工作档 |
| | |
| | | @ResponseBody |
| | | public R move(@RequestBody ReplenishmentParam param){ |
| | | |
| | | log.info("current containerCode: " + param.toString()); |
| | | |
| | | if(Cools.isEmpty(currentContainerMap)){ |
| | | currentContainerMap = new HashMap<>(); |
| | | } |
| | | |
| | | String containerCode = param.getContainerCode(); |
| | | String containerCode = param.getContainerCode().split(";")[0]; |
| | | |
| | | if(Cools.isEmpty(containerCode)){ |
| | | throw new CoolException("料箱码为空"); |
| | | } |
| | |
| | | //查询旧容器的工作档 |
| | | AgvWrkMast agvWrkMast = agvWrkMastService.selectByContainerCode(currentContainerCode); |
| | | if(!Cools.isEmpty(agvWrkMast) && agvWrkMast.getIoType() == 101){ |
| | | //发送容器立场请求,完成工作档 |
| | | List<AgvWrkMast> agvWrkMastList = new ArrayList<>(); |
| | | agvWrkMastList.add(agvWrkMast); |
| | | try { |
| | | int code = agvWrkMastService.containerMoveOut(agvWrkMastList); |
| | | if(code == 0){ |
| | | //将工作党状态改为容器离场 |
| | | agvWrkMast.setWrkSts(206L); |
| | | agvWrkMastService.updateById(agvWrkMast); |
| | | } |
| | | } catch (IOException e) { |
| | | log.error(e.getMessage()); |
| | | } |
| | | //将工作党状态改为容器离场 |
| | | agvWrkMast.setWrkSts(206L); |
| | | agvWrkMastService.updateById(agvWrkMast); |
| | | // //发送容器立场请求,完成工作档 |
| | | // List<AgvWrkMast> agvWrkMastList = new ArrayList<>(); |
| | | // agvWrkMastList.add(agvWrkMast); |
| | | // try { |
| | | // int code = agvWrkMastService.containerMoveOut(agvWrkMastList); |
| | | // if(code == 0){ |
| | | // //将工作党状态改为容器离场 |
| | | // agvWrkMast.setWrkSts(206L); |
| | | // agvWrkMastService.updateById(agvWrkMast); |
| | | // } |
| | | // } catch (IOException e) { |
| | | // log.error(e.getMessage()); |
| | | // } |
| | | } |
| | | } |
| | | |
| | |
| | | @ResponseBody |
| | | public R containerMove(@RequestBody ReplenishmentParam param){ |
| | | |
| | | String devNo = param.getDevNo(); |
| | | String containerCode = currentContainerMap.get(devNo); |
| | | String devNo = Cools.eq("CS-310",param.getDevNo()) ? "310-1" : Cools.eq("CS-311",param.getDevNo()) ? "312-2" : Cools.eq("CS-312",param.getDevNo()) ? "314-1" : Cools.eq("CS-313",param.getDevNo()) ? "316-1" : null; |
| | | |
| | | if(Cools.isEmpty(devNo)){ |
| | | return R.error("站点有误"); |
| | | } |
| | | |
| | | AgvBasDevp agvBasDevp = agvBasDevpService.selectById(devNo); |
| | | String containerCode = agvBasDevp.getBarcode(); |
| | | |
| | | // String devNo = param.getDevNo(); |
| | | // if(Cools.isEmpty(currentContainerMap)){ |
| | | // currentContainerMap = new HashMap<>(); |
| | | // } |
| | | // String containerCode = currentContainerMap.get(devNo); |
| | | |
| | | AgvBasDevpDto agvBasDevpDto = new AgvBasDevpDto(); |
| | | |
| | |
| | | if(!Cools.isEmpty(agvWrkMast)){ |
| | | List<AgvWrkDetl> agvWrkDetlList = agvWrkDetlService.selectList(new EntityWrapper<AgvWrkDetl>().eq("wrk_no", agvWrkMast.getWrkNo())); |
| | | |
| | | for (AgvWrkDetl agvWrkDetl : AgvWrkDetlList){ |
| | | for (AgvWrkDetl agvWrkDetl : agvWrkDetlList){ |
| | | agvWrkDetl.setVolume(agvWrkDetl.getAnfme()); |
| | | if(agvWrkMast.getIoType() == 103){ |
| | | //寻找是否有相同物料的工作档明细,并返回数量之和 |
| | |
| | | } |
| | | } |
| | | }; |
| | | if (agvWrkMast.getIoType() == 103){ |
| | | List<AgvLocDetl> suppCodes = agvLocDetlService.selectList(new EntityWrapper<AgvLocDetl>().eq("supp_code", agvWrkMast.getBarcode())); |
| | | if (!Cools.isEmpty(suppCodes)){ |
| | | for (AgvLocDetl agvLocDetl : suppCodes){ |
| | | AgvWrkDetl agvWrkDetl = new AgvWrkDetl(agvLocDetl.getSuppCode(), agvLocDetl.getMatnr(), agvLocDetl.getMaktx(), agvLocDetl.getSpecs(), agvLocDetl.getAnfme()); |
| | | agvWrkDetlList.add(agvWrkDetl); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | return R.ok(agvWrkDetlList).add(agvWrkMast); |
| | | agvBasDevpDto.setAgvWrkDetls(agvWrkDetlList); |
| | | agvBasDevpDto.setAgvWrkMast(agvWrkMast); |
| | | } |
| | | //查找该容器的入库通知档 |
| | | List<AgvWaitPakin> agvWaitPakinList = agvWaitPakinService.selectList(new EntityWrapper<AgvWaitPakin>().eq("supp_code", containerCode)); |
| | | if(!Cools.isEmpty(agvWaitPakinList)){ |
| | | return R.ok(agvWaitPakinList); |
| | | agvBasDevpDto.setAgvWaitPakins(agvWaitPakinList); |
| | | } |
| | | |
| | | return R.error("没有该容器的出库、拣料、入库信息等"); |
| | | //System.out.println("currentContainerMap: " + currentContainerMap); |
| | | |
| | | |
| | | //System.out.println("agvBasDevpDto: " + agvBasDevpDto); |
| | | |
| | | return R.ok(agvBasDevpDto); |
| | | } |
| | | |
| | | private double getAllAnfmeInAgvWrkDetlList(List<AgvWrkDetl> agvWrkDetlList, AgvWrkDetl wd0) { |