| | |
| | | private WaitPakinService waitPakinService; |
| | | @Autowired |
| | | private LocDetlService locDetlService; |
| | | @Autowired |
| | | private TestMastService testMastService; |
| | | @Autowired |
| | | private MatService matService; |
| | | |
| | | @Value("mes.url") |
| | | @Value("${mes.url}") |
| | | private String mesUrl; |
| | | |
| | | @Value("mes.inPath") |
| | | @Value("${mes.inPath}") |
| | | private String inpath; |
| | | |
| | | @PostMapping("/pakin/loc/v1") |
| | |
| | | if (Cools.isEmpty(param.getSourceStaNo())) { |
| | | return R.error("源站编号不能为空"); |
| | | } |
| | | |
| | | Date now = new Date(); |
| | | List<WaitPakin> waitPakins = null; |
| | | if (param.getIoType() == 1) { |
| | | if (Cools.isEmpty(param.getBarcode())) { |
| | | return R.error("条码不能为空"); |
| | | } |
| | | waitPakins = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", param.getBarcode())); |
| | | List<WaitPakin> beBatch = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("be_batch", 1)); |
| | | if(beBatch.size() > 1){ |
| | | return R.error("组托档中有多条搬运任务"); |
| | | }else if(Cools.isEmpty(beBatch)){ |
| | | return R.error("组托档中没有搬运任务"); |
| | | } |
| | | if (Cools.isEmpty(waitPakins)) { |
| | | WrkMast wrkMast = wrkMastService.selectByBarcode(param.getBarcode()); |
| | | if (wrkMast != null && wrkMast.getIoType() == 103) { |
| | | return R.parse(CodeRes.PICK_600); |
| | | if (wrkMast != null) { |
| | | return R.parse("600-重复组托"); |
| | | } |
| | | return R.parse(CodeRes.NO_COMB_700); |
| | | } |
| | | int countWait = waitPakinService.selectCount(new EntityWrapper<WaitPakin>().eq("zpallet",param.getBarcode()) |
| | | .eq("io_status", "Y")); |
| | | int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet",param.getBarcode())); |
| | | int countWrk = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("zpallet",param.getBarcode())); |
| | | if (countLoc > 0 || countWrk > 0 || countWait > 0) { |
| | | if (!Cools.isEmpty(waitPakins.get(0).getDeadWarn()) && waitPakins.get(0).getDeadWarn()!=0){ |
| | | return R.error(CodeRes.EXIST_500); |
| | | for (WaitPakin waitPakin : beBatch) { |
| | | waitPakin.setZpallet(param.getBarcode()); |
| | | waitPakinService.update(waitPakin,new EntityWrapper<WaitPakin>().eq("be_batch",1)); |
| | | } |
| | | }else { |
| | | int countWait = waitPakinService.selectCount(new EntityWrapper<WaitPakin>().eq("zpallet",param.getBarcode()) |
| | | .eq("io_status", "Y")); |
| | | int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet",param.getBarcode())); |
| | | int countWrk = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("zpallet",param.getBarcode())); |
| | | if (countLoc > 0 || countWrk > 0 || countWait > 0) { |
| | | if (!Cools.isEmpty(waitPakins.get(0).getDeadWarn()) && waitPakins.get(0).getDeadWarn()!=0){ |
| | | return R.error(CodeRes.EXIST_500); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | if (Cools.isEmpty(param.getLocType1())){ |
| | | return R.error("高低检测信号不能为空"); |
| | | param.setLocType1((short)1); |
| | | } |
| | | |
| | | // 源站点状态检测 |
| | | BasDevp sourceStaNo = basDevpService.checkSiteStatus(param.getSourceStaNo(), true); |
| | | // sourceStaNo.setLocType1(param.getLocType1()); |
| | | sourceStaNo.setLocType1((short)1); |
| | | BasDevp sourceStaNo = basDevpService.checkSiteStatus(param.getSourceStaNo(), false); |
| | | sourceStaNo.setLocType1(param.getLocType1()); |
| | | LocTypeDto locTypeDto = new LocTypeDto(sourceStaNo); |
| | | |
| | | StartupDto dto = null; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 全板入库 |
| | | * 全板入库 |
| | | */ |
| | | @Transactional |
| | | public StartupDto startupFullPutStore(Integer devpNo, String barcode, LocTypeDto locTypeDto, List<WaitPakin> waitPakins) { |
| | |
| | | if (!res) { |
| | | throw new CoolException("保存工作档失败"); |
| | | } |
| | | // 目标库位 |
| | | LocMast locMast = locMastService.selectById(dto.getLocNo()); |
| | | |
| | | // 生成工作档明细 |
| | | waitPakins.forEach(waitPakin -> { |
| | | for (WaitPakin waitPakin: waitPakins) { |
| | | WrkDetl wrkDetl = new WrkDetl(); |
| | | wrkDetl.sync(waitPakin); |
| | | wrkDetl.setWrkNo(wrkMast.getWrkNo()); |
| | |
| | | if (!wrkDetlService.insert(wrkDetl)) { |
| | | throw new CoolException("保存工作明细失败"); |
| | | } |
| | | }); |
| | | |
| | | TestMast testMast = testMastService.selectOne(new EntityWrapper<TestMast>() |
| | | .eq("barcode", wrkDetl.getMatnr()) |
| | | .eq("user_id",wrkDetl.getZpallet()));//pack码 |
| | | if (Cools.isEmpty(testMast)){ |
| | | //生成测试档 |
| | | testMast=new TestMast(); |
| | | //入待测库位通道设为0 |
| | | if(locMast.getChannel()==null) { |
| | | testMast.setChannel(0);//通道设为0 |
| | | }else{ |
| | | testMast.setChannel(locMast.getChannel()); |
| | | } |
| | | testMast.setUserId(wrkMast.getBarcode());//托盘码 |
| | | testMast.setStatus(1); |
| | | testMast.setBarcode(wrkDetl.getMatnr()); |
| | | testMast.setLocNo(locMast.getLocNo()); |
| | | testMast.setModiTime(now); |
| | | testMast.setAppeTime(now); |
| | | if (!testMastService.insert(testMast)){ |
| | | throw new CoolException(wrkDetl.getMatnr()+"生成测试档失败"); |
| | | } |
| | | }else { |
| | | testMast.setBarcode(wrkDetl.getMatnr()); |
| | | testMast.setChannel(locMast.getChannel()); |
| | | testMast.setLocNo(locMast.getLocNo()); |
| | | testMast.setStatus(1); |
| | | testMast.setUserId(wrkMast.getBarcode());//托盘码 |
| | | testMast.setAppeTime(now); |
| | | if(!testMastService.update(testMast,new EntityWrapper<TestMast>().eq("barcode", wrkDetl.getMatnr()))){ |
| | | throw new CoolException(wrkDetl.getMatnr()+"更新测试档失败"); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | // 更新入库通知档 ioStatus ===>> Y |
| | | Wrapper<WaitPakin> wrapper = new EntityWrapper<WaitPakin>() |
| | | .eq("zpallet", barcode); |
| | |
| | | throw new CoolException("更新源站失败"); |
| | | } |
| | | // 更新目标库位状态 |
| | | LocMast locMast = locMastService.selectById(dto.getLocNo()); |
| | | if (locMast.getLocSts().equals("O")){ |
| | | locMast.setLocSts("S"); // S.入库预约 |
| | | locMast.setModiTime(now); |
| | | if (!locMastService.updateById(locMast)){ |
| | | throw new CoolException("改变库位状态失败"); |
| | | }else{ |
| | | //1.扫码上报 |
| | | CombParam combParam = new CombParam(); |
| | | combParam.setPackNo(locMast.getBarcode()); |
| | | combParam.setLocNo(locMast.getLocNo()); |
| | | combParam.setPackSts(1); |
| | | combParam.setRequestTime(DateUtils.convert(new Date())); |
| | | new PostMesDataUtils().postMesData("MES系统",mesUrl,inpath,combParam); |
| | | } |
| | | } else { |
| | | throw new CoolException(dto.getLocNo()+"目标库位已被占用"); |
| | | } |
| | | |
| | | return dto; |
| | | } |
| | | |