自动化立体仓库 - WMS系统
#1
czkh
1 天以前 4715b1787c85a2186b9c0c43222b64b63c58459b
src/main/java/com/zy/asrs/service/impl/MatBarcodeServiceImpl.java
@@ -41,22 +41,30 @@
    public void deleteMatBarcode(List<MatBarcode> list) {
        for (MatBarcode matBarcode : list) {
            //对于已经有库存 组托档 工作档的数据 不允许解绑
//            Integer locCount = locDetlService.selectCountByMatNr(matBarcode.getMatnr());
//            Integer waitCount = waitPakinService.selectCountByMatNr(matBarcode.getMatnr());
//            Integer wrkCount = wrkDetlService.selectCountByMatNr(matBarcode.getMatnr());
//            if (locCount > 0 || waitCount > 0){
//                throw new CoolException("库存/组托档存在该模具,不能解绑,商品模具名称:" + matBarcode.getMatnr() + "托盘码:" + matBarcode.getZpallet());
//            }
            Integer wrkNo = wrkDetlService.selectWrkNoByMatnr(matBarcode.getMatnr());
            if (wrkNo != null){
                WrkMast wrkMast = wrkMastService.selectById(wrkNo);
                if (wrkMast == null){
                    throw new CoolException("工作档异常,有工作明细档无工作档");
                }
                if (wrkMast.getIoType() != 103 && wrkMast.getIoType() != 101){
                    throw new CoolException("工作档不是全板出库/拣料出库");
                }
                if (wrkMast.getWrkSts() != 14 && wrkMast.getWrkSts() != 15){
                    throw new CoolException("工作档未完成");
                }
            }
            //对于已经有库存 组托档 工作档的数据 不允许解绑
            Integer locCount = locDetlService.selectCountByMatNr(matBarcode.getMatnr());
            Integer waitCount = waitPakinService.selectCountByMatNr(matBarcode.getMatnr());
            //Integer wrkCount = wrkDetlService.selectCountByMatNr(matBarcode.getMatnr());
            if (locCount > 0 || waitCount > 0){
                throw new CoolException("库存/组托档存在该模具,不能解绑,商品模具名称:" + matBarcode.getMatnr() + "托盘码:" + matBarcode.getZpallet());
            }
            Integer wrkNo = wrkDetlService.selectWrkNoByMatnr(matBarcode.getMatnr());
            WrkMast wrkMast = wrkMastService.selectById(wrkNo);
            if (wrkMast == null){
                throw new CoolException("工作档异常,有工作明细档无工作档");
            }
            if (wrkMast.getIoType() != 103 && wrkMast.getIoType() != 101){
                throw new CoolException("工作档不是全板出库/拣料出库");
            }
            if (wrkMast.getWrkSts() != 14 && wrkMast.getWrkSts() != 15){
                throw new CoolException("工作档未完成");
            }
            //对模具的规格做处理得到厚度
            Integer thickness = 0;
@@ -65,10 +73,12 @@
                thickness = Integer.parseInt(split[1]);
            }
            HalfBarcode halfBarcode = halfBarcodeService.selectByZpallet(matBarcode.getZpallet());
            halfBarcode.setAnfme(halfBarcode.getAnfme() - 1);
            halfBarcode.setPrice(halfBarcode.getPrice() + thickness);
            if (!halfBarcodeService.half(halfBarcode)){
                throw new CoolException("更新半托信息失败");
            if (halfBarcode != null){
                halfBarcode.setAnfme(halfBarcode.getAnfme() - 1);
                halfBarcode.setPrice(halfBarcode.getPrice() + thickness);
                if (!halfBarcodeService.half(halfBarcode)){
                    throw new CoolException("更新半托信息失败");
                }
            }
            matBarcodeMapper.deleteByMatnr(matBarcode.getMatnr());
        }