自动化立体仓库 - WMS系统
#
lsh
2024-07-15 b9bf1e17c9626aa618ee6c28a7764132a57b915f
src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
@@ -1178,27 +1178,102 @@
            throw new CoolException("参数:品号 matnr为空");
        }else if (Cools.isEmpty(param.getWeight())){
            throw new CoolException("参数:物料重量 wright为空");
        }else if (Cools.isEmpty(param.getBatchNum())){
            throw new CoolException("参数:出库数量 batchNum为空");
        }
        Mat mat = matService.selectByMatnr(param.getMatnr());
        if (Cools.isEmpty(mat)){
            throw new CoolException("品号 matnr,请先下发基础档案!!!");
        }
        if (Cools.isEmpty(mat.getUnits())){
            throw new CoolException("品号 matnr,重量范围偏移值为空!!!,请先下发基础档案!!!");
        }
        ArrayList<LocDetl> locDetlArrayList = new ArrayList<>();
        List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("matnr", param.getMatnr()).eq("weight", param.getWeight()));
        Wrapper<LocDetl> wrapper = new EntityWrapper<LocDetl>().eq("matnr", param.getMatnr()).eq("weight", param.getWeight());
        if (param.getDevNo() == 536) {
            wrapper.eq("model", param.getModel())
                    .eq("specs", param.getOrderNo());
        }
        List<LocDetl> locDetls = locDetlService.selectList(wrapper);
        if (locDetls.isEmpty()){
            locDetls = new ArrayList<LocDetl>();
        }
        for (LocDetl locDetl:locDetls){
            LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetl.getLocNo()));
            if (locMast.getLocSts().equals("F")){
                locDetlArrayList.add(locDetl);
                break;
                if (locDetlArrayList.size()<param.getBatchNum()) {//下
                    locDetlArrayList.add(locDetl);
                }
            }
        }
        if (locDetlArrayList.isEmpty()){
            throw new CoolException("未找到符合条件的物料明细:品号==》matnr:"+param.getMatnr()+";重量==》wright:"+param.getWeight()+";颜色==》color:"+param.getColor());
            throw new CoolException("未找到符合条件的物料明细:品号==》matnr:"+param.getMatnr()+";重量==》wright:"+param.getWeight());
        }
        Integer batchNum = param.getBatchNum();
        if (locDetlArrayList.size()<batchNum){//上
            Wrapper<LocDetl> locDetlWrapper = new EntityWrapper<LocDetl>().eq("matnr", param.getMatnr())
                    .lt("weight", param.getWeight() + mat.getUnits())
                    .and()
                    .gt("weight", param.getWeight())
                    .orderBy("weight", true);
            if (param.getDevNo() == 536){
                locDetlWrapper.eq("model", param.getModel())
                        .eq("specs", param.getOrderNo());
            }
            locDetls = locDetlService.selectList(locDetlWrapper);
            if (locDetls.isEmpty()){
                locDetls = new ArrayList<LocDetl>();
            }
            for (LocDetl locDetl:locDetls){
                LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetl.getLocNo()));
                if (locMast.getLocSts().equals("F")){
                    if (locDetlArrayList.size()<batchNum) {//下
                        locDetlArrayList.add(locDetl);
                    }
                }
            }
        }
        if (locDetlArrayList.size()<batchNum){//下
            Wrapper<LocDetl> locDetlWrapper = new EntityWrapper<LocDetl>().eq("matnr", param.getMatnr())
                    .gt("weight", param.getWeight() - mat.getUnits())
                    .and()
                    .lt("weight", param.getWeight())
                    .orderBy("weight", false);
            if (param.getDevNo() == 536){
                locDetlWrapper.eq("model", param.getModel())
                        .eq("specs", param.getOrderNo());
            }
            locDetls = locDetlService.selectList(locDetlWrapper);
            if (locDetls.isEmpty()){
                locDetls = new ArrayList<LocDetl>();
            }
            for (LocDetl locDetl:locDetls){
                LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetl.getLocNo()));
                if (locMast.getLocSts().equals("F")){
                    if (locDetlArrayList.size()<batchNum) {//下
                        locDetlArrayList.add(locDetl);
                    }
                }
            }
        }
        if (locDetlArrayList.size()<batchNum){
            throw new CoolException("库存数量:"+locDetlArrayList.size()+";小于需求数量:"+param.getBatchNum());
        }
        for (LocDetl locDetl : locDetlArrayList){
            if (batchNum <= 0){
                return;
            }
            StockOutParam stockOutParam = new StockOutParam(param,locDetl);
            workService.startupFullTakeStore(stockOutParam, userId);
            return;
            batchNum --;
        }
    }
@@ -1370,7 +1445,6 @@
        if (!wrkDetlService.insert(wrkDetl)) {
            throw new CoolException("保存工作明细失败==》小料箱直供产线任务明细生成");
        }
    }
    public Integer getStaEnd(Integer staNo){