Junjie
2024-07-04 99543f7e820927a8826a7308461a8ab94c361859
zy-asrs-common/src/main/java/com/zy/asrs/common/wms/service/CommonService.java
@@ -46,6 +46,8 @@
    @Autowired
    private LocDirectionService locDirectionService;
    private Long WHS_TYPE = 0L;//默认立库
    /**
     * 生成工作号
     *
@@ -91,6 +93,11 @@
     */
    @Transactional
    public StartupDto getLocNo(Integer staDescId, Integer sourceStaNo, List<String> matnrs, String batch, Long hostId, LocTypeDto locTypeDto, int times) {
        if (sourceStaNo==999){//平库内置判断站点(临时解决方案)
            WHS_TYPE = 1L;//平库
        } else {
            WHS_TYPE = 0L;//立库
        }
        // 目标库位
        LocMast locMast = null;
@@ -150,7 +157,7 @@
                continue;
            }
            List<LocMast> locMasts = locMastService.queryFreeLocMast2(locTypeDto.getLocType1(), locRule.getRowBeg(), locRule.getRowEnd(), locRule.getBayBeg(), locRule.getBayEnd(), locRule.getLevBeg(), locRule.getLevEnd(), hostId);
            List<LocMast> locMasts = locMastService.queryFreeLocMast2(locTypeDto.getLocType1(), locRule.getRowBeg(), locRule.getRowEnd(), locRule.getBayBeg(), locRule.getBayEnd(), locRule.getLevBeg(), locRule.getLevEnd(), hostId,WHS_TYPE);
            for (LocMast locMast0 : locMasts) {
                //预留空库位
                if (locMastService.checkEmptyCount(locMast0, 10, hostId)) {
@@ -237,12 +244,14 @@
                    .eq(LocMast::getLocSts, "D")
                    .eq(LocMast::getLocType1, locTypeDto.getLocType1())
                    .eq(LocMast::getCrnNo, staDesc.getDeviceNo())
                    .eq(LocMast::getWhsType, WHS_TYPE)
                    .eq(LocMast::getHostId, hostId);
            LambdaQueryWrapper<LocMast> wrapper1 = new LambdaQueryWrapper<LocMast>()
                    .eq(LocMast::getLocSts, "O")
                    .eq(LocMast::getLocType1, locTypeDto.getLocType1())
                    .eq(LocMast::getCrnNo, staDesc.getDeviceNo())
                    .eq(LocMast::getWhsType, WHS_TYPE)
                    .eq(LocMast::getHostId, hostId);
            //库位搜索范围
@@ -312,6 +321,7 @@
        LambdaQueryWrapper<LocMast> wrapper1 = new LambdaQueryWrapper<LocMast>()
                .eq(LocMast::getLocSts, "O")
                .eq(LocMast::getHostId, hostId)
                .eq(LocMast::getWhsType, WHS_TYPE)
                .in(LocMast::getRow1, curRow)
                .orderByAsc(LocMast::getBay1)
                .orderByAsc(LocMast::getLev1);
@@ -331,7 +341,7 @@
        for (LocMast mast : locMasts) {
            LocMast innerLoc = null;
            for (String loc : Utils.getGroupLoc(mast.getLocNo(), hostId)) {
                LocMast one = locMastService.getOne(new LambdaQueryWrapper<LocMast>().eq(LocMast::getLocNo, loc).eq(LocMast::getHostId, hostId));
                LocMast one = locMastService.getOne(new LambdaQueryWrapper<LocMast>().eq(LocMast::getLocNo, loc).eq(LocMast::getHostId, hostId).eq(LocMast::getWhsType, WHS_TYPE));
                if (!one.getLocSts().equals("O")) {
                    innerLoc = null;
                    continue;