自动化立体仓库 - WMS系统
skyouc
2 天以前 029ffbf20db7196d4f460bc741fd5f36a80689ae
src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
@@ -453,42 +453,44 @@
            throw new CoolException("机台信息不存在或已禁用!!");
        }
        List<LocAroundBind> binds = locAroundBindService.selectList(new EntityWrapper<LocAroundBind>()
                .eq("dev_no", basDevice.getDevNo())
                .eq("is_default", 1));
        LocAroundBind binds = locAroundBindService.selectOne(new EntityWrapper<LocAroundBind>()
                .eq("dev_no", basDevice.getDevNo()).orderBy("is_default", false));
        if (Objects.isNull(binds) || binds.isEmpty()) {
        if (Objects.isNull(binds)) {
            throw new CoolException("机台未设置默认工作位!!");
        }
//
//        Set<String> locs = binds.stream().map(LocAroundBind::getBlocNo).collect(Collectors.toSet());
        Set<String> locs = binds.stream().map(LocAroundBind::getBlocNo).collect(Collectors.toSet());
//        LocMast locMasts = locMastService.selectOne(new EntityWrapper<LocMast>()
//                .in("loc_no", locs)
//                .eq("loc_sts", LocStsType.LOC_STS_TYPE_O.type)
//                .orderAsc(Arrays.asList("loc_no")));
        LocMast locMasts = locMastService.selectOne(new EntityWrapper<LocMast>()
                .in("loc_no", locs)
                .eq("loc_sts", LocStsType.LOC_STS_TYPE_O.type)
                .orderAsc(Arrays.asList("loc_no")));
//        if (Objects.isNull(locMasts)) {
//            binds = locAroundBindService.selectList(new EntityWrapper<LocAroundBind>()
//                    .eq("dev_no", basDevice.getDevNo()));
//
//            Set<String> nlocs = binds.stream().map(LocAroundBind::getBlocNo).collect(Collectors.toSet());
//
//            locMasts = locMastService.selectOne(new EntityWrapper<LocMast>()
//                    .in("loc_no", nlocs)
//                    .eq("loc_sts", LocStsType.LOC_STS_TYPE_O.type)
//                    .orderAsc(Arrays.asList("loc_no")));
//            if (Objects.isNull(locMasts)) {
//                throw new CoolException("暂无可用工作位!!");
//            }
//        }
        if (Objects.isNull(locMasts)) {
            binds = locAroundBindService.selectList(new EntityWrapper<LocAroundBind>()
                    .eq("dev_no", basDevice.getDevNo()));
            Set<String> nlocs = binds.stream().map(LocAroundBind::getBlocNo).collect(Collectors.toSet());
            locMasts = locMastService.selectOne(new EntityWrapper<LocMast>()
                    .in("loc_no", nlocs)
                    .eq("loc_sts", LocStsType.LOC_STS_TYPE_O.type)
                    .orderAsc(Arrays.asList("loc_no")));
            if (Objects.isNull(locMasts)) {
                throw new CoolException("暂无可用工作位!!");
            }
        }
        LocAroundBind bLocNo = locAroundBindService.selectOne(new EntityWrapper<LocAroundBind>().eq("b_loc_no", locMasts.getLocNo()));
        LocAroundBind bLocNo = locAroundBindService.selectOne(new EntityWrapper<LocAroundBind>().eq("b_loc_no", binds.getBlocNo()));
        bLocNo.setLocType(LocStsType.LOC_STS_TYPE_S.type);
        if (!locAroundBindService.updateById(bLocNo)) {
            throw new CoolException("工位预约失败!!");
        }
        LocMast locMasts = locMastService.selectOne(new EntityWrapper<LocMast>()
                .eq("loc_no", bLocNo.getBlocNo()));
        locMasts.setLocSts(LocStsType.LOC_STS_TYPE_S.type);
        locMasts.setModiUser(userId);
@@ -1533,11 +1535,12 @@
        if (!locMastService.updateById(locMast)) {
            throw new CoolException("修改库位状态失败");
        }
//        wrkMast.setWrkCode(null);
//
//        if (!wrkMastService.updateById(wrkMast)) {
//            throw new CoolException("任务档更新失败!!");
//        }
        wrkMast.setWrkCode(null);
        if (!wrkMastService.updateById(wrkMast)) {
            throw new CoolException("任务档更新失败!!");
        }
    }