自动化立体仓库 - WMS系统
#1
czkh
6 小时以前 307a04b33d1054c89e1acae24ed2913e394635b8
src/main/java/com/zy/asrs/service/impl/MatBarcodeServiceImpl.java
@@ -3,16 +3,12 @@
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.entity.*;
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;
@@ -27,14 +23,41 @@
    private MatService matService;
    @Autowired
    private HalfBarcodeService halfBarcodeService;
    @Autowired
    private WaitPakinService waitPakinService;
    @Autowired
    private WrkDetlService wrkDetlService;
    @Autowired
    private LocDetlService locDetlService;
    @Autowired
    private WrkMastService wrkMastService;
    @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){
                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;
            if (!Cools.isEmpty(matBarcode.getSpecs())){