自动化立体仓库 - WMS系统
#1
dubin
2 天以前 020eb6dc7ebe1f5f4518c76af19520f9d1d4e9f6
src/main/java/com/zy/asrs/utils/MatExcelListener.java
@@ -7,9 +7,11 @@
import com.core.exception.CoolException;
import com.zy.asrs.entity.InOut;
import com.zy.asrs.entity.Mat;
import com.zy.asrs.entity.MatBarcode;
import com.zy.asrs.entity.Tag;
import com.zy.asrs.mapper.TagMapper;
import com.zy.asrs.service.InOutService;
import com.zy.asrs.service.MatBarcodeService;
import com.zy.asrs.service.MatService;
import com.zy.asrs.service.TagService;
import com.zy.common.entity.MatExcel;
@@ -60,6 +62,7 @@
        TagMapper tagMapper = SpringUtils.getBean(TagMapper.class);
        MatService matService = SpringUtils.getBean(MatService.class);
        InOutService inOutService = SpringUtils.getBean(InOutService.class);
        MatBarcodeService matBarcodeService = SpringUtils.getBean(MatBarcodeService.class);
        Date now = new Date();
        Long tagId;
        // 分类
@@ -130,7 +133,7 @@
            tagId = tagService.getTop().getId();
        }
        // 商品
        Mat mat = matService.selectByMatnr(excel.getMatnr());
        Mat mat = matService.selectByMatnr(excel.getMatnr() + "__" + excel.getName());
        if (mat == null) {
            InOut inOut=new InOut();
            mat = excel;
@@ -148,6 +151,25 @@
                throw new CoolException("保存商品信息失败,商品编码:" + excel.getMatnr());
            }
            total++;
        } else {
            if (excel.getColor().equals("报废")){
                //模具状态更新为报废 模具与托盘解绑
                List<MatBarcode> list = new ArrayList<>();
                MatBarcode matBarcode = matBarcodeService.selectbyMatnr(excel.getMatnr() + "__" + excel.getName());
                if (matBarcode != null){
                    list.add(matBarcode);
                    matBarcodeService.deleteMatBarcode(list);
                }
            }
            //模具信息更新
            matService.deleteById(mat.getId());
            mat = excel;
            mat.setTagId(tagId);
            mat.setMatnr(excel.getMatnr()+"__"+excel.getName());
            if (!matService.insert(mat)) {
                throw new CoolException("保存商品档案失败,商品编码:" + excel.getMatnr());
            }
        }
    }