自动化立体仓库 - WMS系统
#
lsh
2024-01-14 8b8854ce1a52bb74604271b29fa9e1ea7cbcde10
src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
@@ -61,6 +61,16 @@
    private WaitPakinService waitPakinService;
    @Autowired
    private CommonService commonService;
    @Autowired
    private LocDetlRullUpDetailService locDetlRullUpDetailService;
    @Autowired
    private WrkDetlSingleService wrkDetlSingleService;
    @Autowired
    private WrkMastStaService wrkMastStaService;
    @Autowired
    private WrkMastStaLogService wrkMastStaLogService;
    @Autowired
    private StaDescService staDescService;
    @Override
    @Transactional
@@ -741,6 +751,7 @@
        Date now = new Date();
        for (PalletizingCompleteParam.MatList matList:param.getMatLists()){
            long rollUp = new Date().getTime();
            Mat mat = matService.selectByMatnr(matList.getMatnr());
            if (Cools.isEmpty(mat)) {
                throw new CoolException(matList.getMatnr() + "商品档案不存在");
@@ -760,6 +771,16 @@
            waitPakin.setAppeTime(now);
            waitPakin.setModiUser(userId);
            waitPakin.setModiTime(now);
            waitPakin.setRollUp(rollUp);
            if (!Cools.isEmpty(matList.getMatDetlList())){
                for (PalletizingCompleteParam.MatDetlList matDetlList:matList.getMatDetlList()){
                    LocDetlRullUpDetail locDetlRullUpDetail = new LocDetlRullUpDetail();
                    locDetlRullUpDetail.setUuid(rollUp);
                    locDetlRullUpDetail.setRollNo(matDetlList.getBoxNoDetl());
                    locDetlRullUpDetail.setRollWeight(matDetlList.getWeightDetl().toString());
                    locDetlRullUpDetailService.insert(locDetlRullUpDetail);
                }
            }
            if (!waitPakinService.insert(waitPakin)) {
                throw new CoolException("保存入库通知档失败");
            }
@@ -793,33 +814,29 @@
    public void singleUnstackingComplete(SingleUnstackingCompleteParam param) {
        Long userId = 8888L;//桁架上位软件
        //判断param参数
        if (Cools.isEmpty(param.getBarcode())){
            throw new CoolException("参数:托盘码 barcode为空");
        }else if (Cools.isEmpty(param.getPalletizingNo())){
        if (Cools.isEmpty(param.getPalletizingNo())){
            throw new CoolException("参数:码垛位编号 palletizingNo为空");
        }else if (Cools.isEmpty(param.getMatLists()) || param.getMatLists().size()==0){
        }else if (Cools.isEmpty(param.getMatList()) || param.getMatList().size()==0){
            throw new CoolException("参数:物料明细 matLists为空");
        }
        WrkMast wrkMastMatrix = wrkMastService.selectByBarcode(param.getBarcode());
        if (Cools.isEmpty(wrkMastMatrix)){
            throw new CoolException("参数:托盘码查询工作档失败:"+param.getBarcode());
        }
        List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNoUnstacking(wrkMastMatrix.getWrkNo());
        ArrayList<WrkDetl> wrkDetlsNew = new ArrayList<>();
        ArrayList<WrkDetlSingle> wrkDetlsOld = new ArrayList<>();
        //判断matLists参数
        for (SingleUnstackingCompleteParam.MatList matList:param.getMatLists()){
        for (SingleUnstackingCompleteParam.MatList matList:param.getMatList()){
            if (Cools.isEmpty(matList.getPosition())){
                throw new CoolException("参数:码垛位置 position为空");
            }else if (Cools.isEmpty(matList.getBoxNo())){
                throw new CoolException("参数:木箱编号 boxNo为空");
            }
            List<WrkDetlSingle> wrkDetlSingles = wrkDetlSingleService.selectList(new EntityWrapper<WrkDetlSingle>().eq("batch", matList.getBoxNo()));
            boolean sign=true;
            for (WrkDetl wrkDetl:wrkDetls){
                if (wrkDetl.getBatch().equals(matList.getBoxNo())){//木箱编码
                    wrkDetl.setInspect(1);
                    wrkDetlService.update(wrkDetl,new EntityWrapper<WrkDetl>().eq("batch",wrkDetl.getBatch()));
            for (WrkDetlSingle wrkDetlSingle:wrkDetlSingles){
                if (wrkDetlSingle.getBatch().equals(matList.getBoxNo())){//木箱编码
                    WrkDetl wrkDetl = new WrkDetl();
                    wrkDetl.sync(wrkDetlSingle);
                    wrkDetlsNew.add(wrkDetl);
                    wrkDetlsOld.add(wrkDetlSingle);
                    sign=false;
                    break;
                }
@@ -841,7 +858,7 @@
        wrkMast.setIoType(202); // 入出库状态:202.拆垛后出库
        wrkMast.setIoPri(99D); // 优先级
        wrkMast.setSourceStaNo(param.getDevNo$());
        wrkMast.setStaNo(140); //贴标站点
        wrkMast.setStaNo(144); //贴标站点  直接到尾端
        // 操作人员数据
        wrkMast.setAppeUser(userId);
        wrkMast.setAppeTime(now);
@@ -861,6 +878,13 @@
            }
        }
        for (WrkDetlSingle wrkDetlSingle : wrkDetlsOld) {
            wrkDetlSingleService.delete(new EntityWrapper<WrkDetlSingle>()
                    .eq("batch",wrkDetlSingle.getBatch())
                    .eq("wrk_no",wrkDetlSingle.getWrkNo())
                    .eq("io_time",wrkDetlSingle.getIoTime()));
        }
    }
    /*
@@ -873,49 +897,50 @@
        //判断param参数
        if (Cools.isEmpty(param.getBarcode())){
            throw new CoolException("参数:托盘码 barcode为空");
        }else if (Cools.isEmpty(param.getPalletizingNo())){
            throw new CoolException("参数:码垛位编号 palletizingNo为空");
        }
//        else if (Cools.isEmpty(param.getPalletizingNo())){
//            throw new CoolException("参数:码垛位编号 palletizingNo为空");
//        }
        WrkMast wrkMastMatrix = wrkMastService.selectByBarcode(param.getBarcode());
        if (Cools.isEmpty(wrkMastMatrix)){
            throw new CoolException("参数:托盘码查询工作档失败:"+param.getBarcode());
        }else {
            if (!wrkMastMatrix.getIoType().equals(101)){
                List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNoUnstacking(wrkMastMatrix.getWrkNo());
                if (Cools.isEmpty(param.getMatLists()) || param.getMatLists().size()==0 || param.getMatLists().size()!=wrkDetls.size()){
                    throw new CoolException("返回物料明细数为"+param.getMatLists().size()+",托盘码:"+param.getBarcode()+"应剩余物料数:"+wrkDetls.size());
                }
                ArrayList<String> orgin = new ArrayList<>();
                //判断matLists参数
                for (SingleMountUnstackingCompleteParam.MatList matList : param.getMatLists()){
                    if (Cools.isEmpty(matList.getPosition())){
                        throw new CoolException("参数:码垛位置 position为空");
                    }else if (Cools.isEmpty(matList.getBoxNo())){
                        throw new CoolException("参数:木箱编号 boxNo为空");
                    }
                    if (!orgin.contains(matList.getPosition())){
                        orgin.add(matList.getPosition());
                    }else {
                        throw new CoolException("参数:木箱编号 boxNo:"+matList.getBoxNo()+",木箱位置存在重复");
                    }
                    boolean sign=true;
                    for (WrkDetl wrkDetl:wrkDetls){
                        if (wrkDetl.getBatch().equals(matList.getBoxNo())){//木箱编码
                            wrkDetl.setOrigin(matList.getPosition());
                            wrkDetlService.update(wrkDetl,new EntityWrapper<WrkDetl>().eq("batch",wrkDetl.getBatch()));
                            sign=false;
                            break;
                        }
                    }
                    if (sign){
                        throw new CoolException("参数:木箱编号 boxNo:"+matList.getBoxNo()+"未查询到对应的工作明细!");
                    }
                }
            }
//            if (wrkMastMatrix.getIoType().equals(103)){
//                List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNoUnstacking(wrkMastMatrix.getWrkNo());
//                if (Cools.isEmpty(param.getMatLists()) || param.getMatLists().size()==0 || param.getMatLists().size()!=wrkDetls.size()){
//                    throw new CoolException("返回物料明细数为"+param.getMatLists().size()+",托盘码:"+param.getBarcode()+"应剩余物料数:"+wrkDetls.size());
//                }
//
//                ArrayList<String> orgin = new ArrayList<>();
//                //判断matLists参数
//                for (SingleMountUnstackingCompleteParam.MatList matList : param.getMatLists()){
//                    if (Cools.isEmpty(matList.getPosition())){
//                        throw new CoolException("参数:码垛位置 position为空");
//                    }else if (Cools.isEmpty(matList.getBoxNo())){
//                        throw new CoolException("参数:木箱编号 boxNo为空");
//                    }
//                    if (!orgin.contains(matList.getPosition())){
//                        orgin.add(matList.getPosition());
//                    }else {
//                        throw new CoolException("参数:木箱编号 boxNo:"+matList.getBoxNo()+",木箱位置存在重复");
//                    }
//                    boolean sign=true;
//                    for (WrkDetl wrkDetl:wrkDetls){
//                        if (wrkDetl.getBatch().equals(matList.getBoxNo())){//木箱编码
//                            wrkDetl.setOrigin(matList.getPosition());
//                            wrkDetlService.update(wrkDetl,new EntityWrapper<WrkDetl>().eq("batch",wrkDetl.getBatch()));
//                            sign=false;
//                            break;
//                        }
//                    }
//                    if (sign){
//                        throw new CoolException("参数:木箱编号 boxNo:"+matList.getBoxNo()+"未查询到对应的工作明细!");
//                    }
//                }
//            }
        }
        wrkMastMatrix.setSheetNo("1");
        wrkMastMatrix.setSheetNo("2");
        if (!wrkMastService.updateById(wrkMastMatrix)){
            throw new CoolException("更新工作档失败==》桁架上位软件:单托拆垛完成通知");
        }
@@ -939,19 +964,94 @@
    @Override
    @Transactional
    public void cs2() {
        BasDevp basDevp = basDevpService.selectById(216);
        basDevp.setWrkNo(0);
        basDevp.setBarcode("");
        basDevpService.updateById(basDevp);
//        int[] staNos =new int[]{122};
//        for (Integer staNo:staNos){
//            int[] crnNos =new int[]{6};
//            for (Integer crnNo:crnNos){
//                descSta(staNo,crnNo);
//            }
//        }
    }
    /*
    private void descSta(Integer staNo,Integer crnNo){
//        int[] typeNos =new int[]{1,10,53,101,103,110};
        int[] typeNos =new int[]{10,110};
        for (Integer typeNo:typeNos){
            descSta3(staNo,crnNo,typeNo);
        }
    }
    private void descSta3(Integer staNo,Integer crnNo,Integer typeNo){
        StaDesc staDesc = new StaDesc();
        staDesc.setTypeNo(typeNo);
        staDesc.setStnNo(staNo);
        staDesc.setCrnNo(crnNo);
        staDesc.setCrnStn(CrnNoRC(crnNo,staDesc.getTypeNo()>100));
        descSta2(staDesc);
    }
    private void descSta2(StaDesc staDesc){
        Date now = new Date();
        //入库
        int sameRes = staDescService.selectCount(new EntityWrapper<StaDesc>()
                .eq("type_no", staDesc.getTypeNo())
                .eq("stn_no", staDesc.getStnNo())
                .eq("crn_no", staDesc.getCrnNo())
                .eq("crn_stn", staDesc.getCrnStn()));
        if (sameRes == 0) {
            staDesc.setModiUser(9527L);
            staDesc.setModiTime(now);
            staDesc.setAppeUser(9527L);
            staDesc.setAppeTime(now);
            staDescService.insert(staDesc);
        }
    }
    private Integer CrnNoRC(Integer crnNo,boolean sign){
        Integer crnStn = 0;
        switch (crnNo){
            case 1:
                crnStn = 102;
                break;
            case 2:
                crnStn = 105;
                break;
            case 3:
                crnStn = 108;
                break;
            case 4:
                crnStn = 111;
                break;
            case 5:
                crnStn = 114;
                break;
            case 6:
                crnStn = 117;
                break;
        }
        if (sign){
            return crnStn-2;
        }
        return crnStn;
    }
        /*
     *
     * */
    @Override
    @Transactional
    public void cs3() {
        //拆盘
        WrkMastSta wrkMastSta1 = new WrkMastSta(new Date(),119);
        wrkMastSta1.setType(2);
        wrkMastSta1.setWrkType(2);
        wrkMastStaService.insert(wrkMastSta1);
        WrkMastSta wrkMastSta2 = new WrkMastSta(new Date(),121);
        wrkMastSta2.setType(2);
        wrkMastSta2.setWrkType(2);
        wrkMastStaService.insert(wrkMastSta2);
    }
    /*...........................上饶江铜..............以上.............徐工汉云...........................*/