自动化立体仓库 - WMS系统
#
lsh
2024-01-11 e44239cb6516389b4dd4a63747df7bc82681660b
src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.Cools;
import com.core.common.DateUtils;
import com.core.common.R;
import com.core.common.SnowflakeIdWorker;
import com.core.exception.CoolException;
import com.zy.asrs.entity.*;
@@ -60,6 +61,10 @@
    private WaitPakinService waitPakinService;
    @Autowired
    private CommonService commonService;
    @Autowired
    private LocDetlRullUpDetailService locDetlRullUpDetailService;
    @Autowired
    private WrkDetlSingleService wrkDetlSingleService;
    @Override
    @Transactional
@@ -592,6 +597,7 @@
        LabellerMatParam labellerMatParam = new LabellerMatParam();
        labellerMatParam.setDevNo(param.getDevNo());
        labellerMatParam.setLabNo(param.getLabNo());
        labellerMatParam.setWrkNo(basDevp.getWrkNo().toString());
//        ArrayList<LabellerMatParam.CombMat> combMats = new ArrayList<>();
        ArrayList<LabellerMatParam.BoxNo> boxNos = new ArrayList<>();
//        String orderNo = "";
@@ -611,7 +617,6 @@
//        labellerMatParam.setCombMats(combMats);
//        labellerMatParam.setLabellingTime(DateUtils.convert(new Date()));
        labellerMatParam.setWrkNo(basDevp.getWrkNo().toString());
//        labellerMatParam.setLabTemplate("1");
//        labellerMatParam.setOrderNo(orderNo);
        wrkMast.setWrkSts(53L);
@@ -654,11 +659,12 @@
        if (param.getLabResult().equals("OK")){
            wrkMast.setWrkSts(54L);
            wrkMast.setStaNo(144);
            if (!wrkMastService.updateById(wrkMast)){
                throw new CoolException("异常,请重新申请");
            }
        }else if (param.getLabResult().equals("NG")){
            wrkMast.setWrkSts(52L);
            wrkMast.setWrkSts(52L);//重新贴标
            if (!wrkMastService.updateById(wrkMast)){
                throw new CoolException("异常,请重新申请");
            }
@@ -739,6 +745,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() + "商品档案不存在");
@@ -758,11 +765,39 @@
            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("保存入库通知档失败");
            }
        }
    }
    /*
     *中控:出库完成月台相关
     * */
    @Override
    @Transactional
    public void balconyComplete(LabellerMatParam param) {
        if (Cools.isEmpty(param.getWrkNo())){
            throw new CoolException("工作号为空!");
        }
        WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no", param.getWrkNo()));
        if (Cools.isEmpty(wrkMast)){
            throw new CoolException("工作号为空!");
        }
        wrkMast.setWrkSts(57L);
        wrkMastService.updateById(wrkMast);
    }
    /*
@@ -773,20 +808,14 @@
    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){
            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()){
            if (Cools.isEmpty(matList.getPosition())){
@@ -794,12 +823,14 @@
            }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;
                }
@@ -819,7 +850,7 @@
        wrkMast.setIoTime(now);
        wrkMast.setWrkSts(51L); // 工作状态:生成入库ID
        wrkMast.setIoType(202); // 入出库状态:202.拆垛后出库
        wrkMast.setIoPri(13D); // 优先级
        wrkMast.setIoPri(99D); // 优先级
        wrkMast.setSourceStaNo(param.getDevNo$());
        wrkMast.setStaNo(140); //贴标站点
        // 操作人员数据
@@ -841,6 +872,13 @@
            }
        }
        for (WrkDetlSingle wrkDetlSingle : wrkDetlsOld) {
            wrkDetlSingleService.delete(new EntityWrapper<WrkDetlSingle>()
                    .eq("batch",wrkDetlSingle.getBatch())
                    .eq("wrk_no",wrkDetlSingle.getWrkNo())
                    .eq("io_time",wrkDetlSingle.getIoTime()));
        }
    }
    /*
@@ -853,49 +891,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("更新工作档失败==》桁架上位软件:单托拆垛完成通知");
        }