自动化立体仓库 - WMS系统
#
Administrator
3 天以前 e955eb6077fc28f0ad379af45c5adec1962eeff6
src/main/java/com/zy/asrs/task/handler/AutoEmptyOutHandler.java
@@ -118,14 +118,31 @@
        }
    }
    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;
        }
        Integer sourceCrnNo = sourceLoc.getCrnNo();
        if (sourceCrnNo == null) {
            return null;
        }
@@ -139,9 +156,13 @@
        Integer targetCrnNo = null;
        Integer targetEmptyCount = null;
        for (int candidate = 1; candidate < 5; candidate++) {
            if (candidate == crnNo) {
            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")
@@ -170,6 +191,9 @@
        if (Cools.isEmpty(targetLoc)) {
            return null;
        }
        if (sourceCrnNo.equals(targetLoc.getCrnNo())) {
            return null;
        }
        List<Integer> sourceStaNos = staDescService.queryOutStaNosByLocNo(sourceLoc.getLocNo(), 101);
        if (Cools.isEmpty(sourceStaNos)) {
@@ -195,7 +219,7 @@
        wrkMast.setIoTime(now);
        wrkMast.setWrkSts(11L);
        wrkMast.setIoType(101);
        wrkMast.setIoPri(10D);
        wrkMast.setIoPri(13D);
        wrkMast.setCrnNo(sourceLoc.getCrnNo());
        wrkMast.setSourceLocNo(sourceLoc.getLocNo());
        wrkMast.setLocNo(targetLoc.getLocNo());
@@ -204,6 +228,7 @@
        wrkMast.setStaNo(String.valueOf(targetStaNo));
        wrkMast.setFullPlt("Y");
        wrkMast.setExitMk("N");
        wrkMast.setLogMk("Y");
        wrkMast.setPacked(null);
        wrkMast.setOveMk("N");
        wrkMast.setAppeUser(userId);
@@ -214,12 +239,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);