自动化立体仓库 - WMS系统
skyouc
昨天 8ae2f2dcfe7e263d42c21ed7644641c780445b95
src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
@@ -453,42 +453,45 @@
            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("loc_type", LocStsType.LOC_STS_TYPE_O.type)
                .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);
@@ -562,7 +565,12 @@
            wrkDetl.setUnit(locDel.getUnit());
            wrkDetl.setSpecs(locDel.getSpecs());
            wrkDetl.setBatch(locDel.getBatch());
            wrkDetl.setAnfme(locDel.getAnfme());
            //库存数量
            wrkDetl.setStockQty(locDel.getAnfme());
            //单据数量
            wrkDetl.setRealQty(locDto.getAnfme());
            //单据数量
            wrkDetl.setAnfme(locDto.getAnfme());
            wrkDetl.setAppeTime(now);
            wrkDetl.setAppeUser(userId);
            wrkDetl.setModiTime(now);
@@ -1518,6 +1526,7 @@
            wrkDetls.forEach(wrkDetl -> {
                WrkDetl wrkDetl1 = new WrkDetl();
                BeanUtils.copyProperties(wrkDetl, wrkDetl1);
                wrkDetl1.setAnfme(wrkDetl.getStockQty() - wrkDetl.getAnfme());
                wrkDetl1.setWrkNo(wokNo);
                if (!wrkDetlService.insert(wrkDetl1)) {
                    throw new CoolException("任务档明细保存失败!!");
@@ -1533,6 +1542,7 @@
        if (!locMastService.updateById(locMast)) {
            throw new CoolException("修改库位状态失败");
        }
//        wrkMast.setWrkCode(null);
//
//        if (!wrkMastService.updateById(wrkMast)) {