自动化立体仓库 - WMS系统
#
yxFwq
2024-07-29 33cb8b070c31a96bc514d07e3d1d9f6514a057d9
src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
@@ -90,6 +90,8 @@
    private BareBoardHandler bareBoardHandler;
    @Autowired
    private BasJarMastService basJarMastService;
    @Autowired
    private BasCrnpService basCrnpService;
    @Override
    @Transactional
@@ -1076,9 +1078,10 @@
                smallContainersJar(param);
            } else if (param.getType()==3){//直供产线
                smallContainersSta(param);
            } else if (param.getType()==99){//库内供产线  //出库  测试
                smallContainersBig99(param);
            }
//            else if (param.getType()==99){//库内供产线  //出库  测试
//                smallContainersBig99(param);
//            }
        } catch (Exception e){
            throw new CoolException("失败!!!原因:"+e.getMessage());
        }
@@ -1199,6 +1202,34 @@
            throw new CoolException("品号 matnr,重量范围偏移值为空!!!,请先下发基础档案!!!");
        }
        ArrayList<Integer> crns =new ArrayList<>();
        ArrayList<Integer> crnList =new ArrayList<>();
        crns.add(1);crns.add(2);crns.add(3);crns.add(4);crns.add(5);crns.add(6);crns.add(7);
        for (Integer crnNo : crns){
            // 检测路径
            Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>()
                    .eq("type_no", 101)
                    .eq("stn_no", param.getDevNo())
                    .eq("crn_no", crnNo);
            StaDesc staDesc = staDescService.selectOne(wrapper);
            if (Cools.isEmpty(staDesc)){
                continue;
            }
            BasCrnp basCrnp = basCrnpService.selectById(crnNo);
            if (basCrnp.getCrnSts()!=3 || !basCrnp.getOutEnable().equals("Y")){
                continue;
            }
            if (!basCrnpService.checkSiteError(crnNo, false)){
                continue;
            }
            crnList.add(crnNo);
        }
        if (crnList.isEmpty()){
            throw new CoolException("无可用堆垛机");
        }
        ArrayList<LocDetl> locDetlArrayList = new ArrayList<>();
        Wrapper<LocDetl> wrapper = new EntityWrapper<LocDetl>().eq("matnr", param.getMatnr()).eq("weight", param.getWeight());
@@ -1214,14 +1245,12 @@
        for (LocDetl locDetl:locDetls){
            LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetl.getLocNo()));
            if (locMast.getLocSts().equals("F")){
                if (locDetlArrayList.size()<param.getBatchNum()) {//下
                    locDetlArrayList.add(locDetl);
                if (crnList.contains(locMast.getCrnNo())){
                    if (locDetlArrayList.size()<param.getBatchNum()) {//下
                        locDetlArrayList.add(locDetl);
                    }
                }
            }
        }
        if (locDetlArrayList.isEmpty()){
            throw new CoolException("未找到符合条件的物料明细:品号==》matnr:"+param.getMatnr()+";重量==》wright:"+param.getWeight());
        }
        Integer batchNum = param.getBatchNum();
@@ -1242,8 +1271,10 @@
            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 (crnList.contains(locMast.getCrnNo())){
                        if (locDetlArrayList.size()<batchNum) {//下
                            locDetlArrayList.add(locDetl);
                        }
                    }
                }
            }
@@ -1266,24 +1297,37 @@
            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 (crnList.contains(locMast.getCrnNo())){
                        if (locDetlArrayList.size()<batchNum) {//下
                            locDetlArrayList.add(locDetl);
                        }
                    }
                }
            }
        }
        if (locDetlArrayList.isEmpty()){
            throw new CoolException("未找到符合条件的物料明细:品号==》matnr:"+param.getMatnr()+";重量==》wright:"+param.getWeight());
        }
        if (locDetlArrayList.size()<batchNum){
            throw new CoolException("库存数量:"+locDetlArrayList.size()+";小于需求数量:"+param.getBatchNum());
        }
        ArrayList<LocDetl> locDetlArraySou = new ArrayList<>();
        for (LocDetl locDetl : locDetlArrayList){
            if (batchNum <= 0){
                return;
            }
            StockOutParam stockOutParam = new StockOutParam(param,locDetl);
            workService.startupFullTakeStore(stockOutParam, userId);
            locDetlArraySou.add(locDetl);
            batchNum --;
        }
        try{
            StockOutParam stockOutParam = new StockOutParam(param,locDetlArraySou);
            workService.startupFullTakeStore(stockOutParam, userId);
        } catch (Exception e){
            throw new CoolException("生成出库任务失败:出库数量:"+locDetlArraySou.size());
        }
    }
    public void smallContainersJar(SmallCompleteParam param) {