自动化立体仓库 - WMS系统
#
lty
1 天以前 a0131e8ae6dedaac1f48e6dd40aee5955e205a9c
src/main/java/com/zy/asrs/task/handler/AutoEmptyOutHandler.java
@@ -118,13 +118,26 @@
        }
    }
    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;
        }
@@ -144,6 +157,19 @@
        Integer targetEmptyCount = null;
        for (int candidate = 1; candidate < 5; candidate++) {
            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 > 3) {continue;}
            Integer existCount = wrkMastService.selectCount(new EntityWrapper<WrkMast>()
                    .eq("io_type", 101)
                    .eq("log_mk", "Y")
                    .eq("ove_mk", "N"));
            int allow = 3 - (existCount == null ? 0 : existCount);
            if (allow <= 0) {
                log.info("自动移库已达上限{}", existCount);
                continue;
            }
            Integer candidateEmpty = locMastService.selectCount(new EntityWrapper<LocMast>()
@@ -202,7 +228,7 @@
        wrkMast.setIoTime(now);
        wrkMast.setWrkSts(11L);
        wrkMast.setIoType(101);
        wrkMast.setIoPri(13D);
        wrkMast.setIoPri(12D);
        wrkMast.setCrnNo(sourceLoc.getCrnNo());
        wrkMast.setSourceLocNo(sourceLoc.getLocNo());
        wrkMast.setLocNo(targetLoc.getLocNo());
@@ -211,6 +237,8 @@
        wrkMast.setStaNo(String.valueOf(targetStaNo));
        wrkMast.setFullPlt("Y");
        wrkMast.setExitMk("N");
        wrkMast.setLogMk("Y");
        wrkMast.setEmptyMk("N");
        wrkMast.setPacked(null);
        wrkMast.setOveMk("N");
        wrkMast.setAppeUser(userId);
@@ -221,12 +249,12 @@
            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);
@@ -267,6 +295,7 @@
                        .eq("crn_no", crnNo)
                        .eq("io_type", 110)
                );
                if(crnNo !=1){continue;}
                if(!wrkMastList.isEmpty()){continue;}
                Integer emptyLocCount = locMastService.selectCount(new EntityWrapper<LocMast>()
                        .eq("crn_no", crnNo)