| | |
| | | } |
| | | } |
| | | |
| | | private String moveOldestInventoryInner(Integer crnNo, Long userId) { |
| | | public String moveOldestInventoryInner(Integer crnNo, Long userId) { |
| | | LocDetl oldest = locDetlMapper.selectOldestLocDetl(crnNo); |
| | | if (Cools.isEmpty(oldest) || Cools.isEmpty(oldest.getLocNo())) { |
| | | return moveInventoryFromLocDetl(oldest, userId); |
| | | } |
| | | |
| | | public String moveMostMatnrInventoryInner(Integer crnNo, Long userId) { |
| | | String matnr = locDetlMapper.selectMostMatnrByCrnNo(crnNo); |
| | | if (Cools.isEmpty(matnr)) { |
| | | return null; |
| | | } |
| | | LocDetl detl = locDetlMapper.selectOldestLocDetlByCrnNoAndMatnr(crnNo, matnr); |
| | | return moveInventoryFromLocDetl(detl, userId); |
| | | } |
| | | |
| | | private String moveInventoryFromLocDetl(LocDetl sourceDetl, Long userId) { |
| | | if (Cools.isEmpty(sourceDetl) || Cools.isEmpty(sourceDetl.getLocNo())) { |
| | | return null; |
| | | } |
| | | |
| | | LocMast sourceLoc = locMastService.selectById(oldest.getLocNo()); |
| | | LocMast sourceLoc = locMastService.selectById(sourceDetl.getLocNo()); |
| | | if (Cools.isEmpty(sourceLoc) || Cools.isEmpty(sourceLoc.getBarcode())) { |
| | | return null; |
| | | } |
| | |
| | | if (candidate == sourceCrnNo) { |
| | | continue; |
| | | } |
| | | Integer runingCount = wrkMastService.selectCount(new EntityWrapper<WrkMast>() |
| | | .eq("io_type", 101).eq("crn_no",candidate) |
| | | .in("wrk_sts", Arrays.asList(2L, 3L, 4L, 11L, 12L))); |
| | | if(runingCount != null && runingCount > 5) {continue;} |
| | | Integer candidateEmpty = locMastService.selectCount(new EntityWrapper<LocMast>() |
| | | .eq("crn_no", candidate) |
| | | .eq("loc_sts", "O") |
| | |
| | | wrkMast.setStaNo(String.valueOf(targetStaNo)); |
| | | wrkMast.setFullPlt("Y"); |
| | | wrkMast.setExitMk("N"); |
| | | wrkMast.setLogMk("Y"); |
| | | wrkMast.setPacked(null); |
| | | wrkMast.setOveMk("N"); |
| | | wrkMast.setAppeUser(userId); |
| | |
| | | throw new RuntimeException("自动跨巷道移库生成任务失败,workNo=" + workNo + ", sourceLocNo=" + sourceLoc.getLocNo()); |
| | | } |
| | | |
| | | for (LocDetl sourceDetl : sourceDetls) { |
| | | for (LocDetl sourceDetl1 : sourceDetls) { |
| | | WrkDetl wrkDetl = new WrkDetl(); |
| | | wrkDetl.sync(sourceDetl); |
| | | wrkDetl.sync(sourceDetl1); |
| | | wrkDetl.setWrkNo(workNo); |
| | | wrkDetl.setIoTime(now); |
| | | wrkDetl.setAnfme(sourceDetl.getAnfme()); |
| | | wrkDetl.setAnfme(sourceDetl1.getAnfme()); |
| | | wrkDetl.setAppeTime(now); |
| | | wrkDetl.setAppeUser(userId); |
| | | wrkDetl.setModiTime(now); |