自动化立体仓库 - WMS系统
#1
dubin
2 天以前 db9a7f9c1b61af84be764a399b3f1f85e0ff03ee
src/main/java/com/zy/asrs/service/impl/MatBarcodeServiceImpl.java
@@ -1,17 +1,17 @@
package com.zy.asrs.service.impl;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.core.common.Cools;
import com.core.exception.CoolException;
import com.zy.asrs.entity.HalfBarcode;
import com.zy.asrs.entity.Mat;
import com.zy.asrs.entity.MatBarcode;
import com.zy.asrs.entity.WaitPakin;
import com.zy.asrs.mapper.MatBarcodeMapper;
import com.zy.asrs.service.HalfBarcodeService;
import com.zy.asrs.service.MatBarcodeService;
import com.zy.asrs.service.MatService;
import com.zy.asrs.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
@@ -26,17 +26,31 @@
    private MatService matService;
    @Autowired
    private HalfBarcodeService halfBarcodeService;
    @Autowired
    private WaitPakinService waitPakinService;
    @Autowired
    private WrkDetlService wrkDetlService;
    @Autowired
    private LocDetlService locDetlService;
    @Override
    public MatBarcode selectbyMatnr(String matnr) {
        return this.baseMapper.selectByMatnr(matnr);
    }
    @Transactional
    @Override
    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 || wrkCount > 0){
                throw new CoolException("组托档/库存/工作档存在该模具,不能解绑,商品模具名称:" + matBarcode.getMatnr() + "托盘码:" + matBarcode.getZpallet());
            }
            //对模具的规格做处理得到厚度
            Integer thickness = 0;
            if (matBarcode.getSpecs() != null){
            if (!Cools.isEmpty(matBarcode.getSpecs())){
                String[] split = matBarcode.getSpecs().split("\\*");
                thickness = Integer.parseInt(split[1]);
            }
@@ -66,7 +80,7 @@
        HalfBarcode halfBarcode = halfBarcodeService.selectByZpallet(waitPakin.getBarcode());
        //对模具的规格做处理得到厚度
        Integer thickness = 0;
        if (mat.getSpecs() != null){
        if (!Cools.isEmpty(mat.getSpecs())){
            String[] split = mat.getSpecs().split("\\*");
            thickness = Integer.parseInt(split[1]);
        }
@@ -127,7 +141,7 @@
        HalfBarcode halfBarcode = halfBarcodeService.selectByZpallet(mat.getUnit());
        //对模具的规格做处理得到厚度
        Integer thickness = 0;
        if (mat.getSpecs() != null){
        if (!Cools.isEmpty(mat.getSpecs())){
            String[] split = mat.getSpecs().split("\\*");
            thickness = Integer.parseInt(split[1]);
        }
@@ -166,7 +180,7 @@
        mb.setMatnr(mat.getMatnr());
        mb.setMaktx(mat.getMaktx());
        mb.setSpecs(mat.getSpecs());
        mb.setModel(mat.getModel());
        mb.setModel(mat.getName());
        if (!matBarcodeService.insert(mb)){
            throw new CoolException("物料托盘绑定失败");
        }