自动化立体仓库 - WMS系统
dubin
2025-09-24 9c08f3ae419992dda4f4f3ff4650fafd6585ebae
src/main/java/com/zy/common/service/CommonService.java
@@ -126,6 +126,12 @@
        return getLocNo(whsType,staDescId,sourceStaNo,matnr,batch,grade,0,locTypeDto,0);
    }
    @Transactional
    public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, String matnr, String batch, String grade, LocTypeDto locTypeDto,String barcode) {
        whsType = Utils.GetWhsType(sourceStaNo);
        return getLocNo1(whsType,staDescId,sourceStaNo,matnr,batch,grade,0,locTypeDto,0,barcode);
    }
    /**
     * 检索库位号
     *
@@ -365,4 +371,52 @@
        startupDto.setLocNo(locNo);
        return startupDto;
    }
    /*
    * 检索库位号
    * */
    @Transactional
    public StartupDto getLocNo1(Integer whsType, Integer staDescId, Integer sourceStaNo, String matnr, String batch, String grade, Integer moveCrnNo, LocTypeDto locTypeDto, int times,String barcode){
        StartupDto startupDto = new StartupDto();
        Wrapper<StaDesc> wrapper = null;
        StaDesc staDesc = null;
        BasDevp staNo = null;
        int crnNo = 1;      //堆垛机号
        if (Utils.BooleanWhsTypeSta(whsType, staDescId)) {
            // 获取目标站
            wrapper = new EntityWrapper<StaDesc>()
                    .eq("type_no", staDescId)
                    .eq("stn_no", sourceStaNo)
                    .eq("crn_no", crnNo);
            staDesc = staDescService.selectOne(wrapper);
            if (Cools.isEmpty(staDesc)) {
                log.error("type_no={},stn_no={},crn_no={}", staDescId, sourceStaNo, crnNo);
                throw new CoolException("入库路径不存在");
//                crnNo = 0;
            }
            staNo = basDevpService.selectById(staDesc.getCrnStn());
            if (!staNo.getAutoing().equals("Y")) {
                throw new CoolException("目标站"+staDesc.getCrnStn()+"不可用");
//                crnNo = 0;
            }
            startupDto.setStaNo(staNo.getDevNo());
        }
        int workNo = getWorkNo(0);
        startupDto.setWorkNo(workNo);
        startupDto.setSourceStaNo(sourceStaNo);
        startupDto.setCrnNo(1);
        //第一次入库
        //后续入库(托盘和库位已经绑定)
        LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("barcode", barcode));
        if (locMast != null){
            if (!locMast.getLocSts().equals("O")){
                log.error("与该托盘绑定的库位已被占用,托盘码:{},库位号:{}",barcode,locMast.getLocNo());
            } else {
                startupDto.setLocNo(locMast.getLocNo());
            }
        } else {
            //托盘与库位未绑定 走第一次入库逻辑
        }
        return startupDto;
    }
}