自动化立体仓库 - WMS系统
#
pjb
2024-07-04 4e7fce25f60aaf58603a3d2f3d749d1a83675c44
src/main/java/com/zy/asrs/utils/PlaExcelListener.java
@@ -18,10 +18,7 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
 * Created by vincent on 2019-11-25
@@ -35,6 +32,7 @@
    private int total = 0;
    private int index = 1;
    private String recordLog = "";
    private Long userId;
    public PlaExcelListener() {
@@ -69,11 +67,13 @@
        MatService matService = SpringUtils.getBean(MatService.class);
        Date now = new Date();
        // 商品
        if(Cools.isEmpty(excel.getBatch()) || Cools.isEmpty(excel.getPackageNo())){
            return;
            throw new CoolException("第" +  index++ + "数据错误,包号或者批号为空");
        }
        Pla pla = plaService.selectByBatchAndPackageNo(excel.getBatch(),excel.getPackageNo());
        Pla pla = plaService.selectByBatchAndPackageNo(excel.getBatch(),excel.getPackageNo(),excel.getBrand());
        if (pla == null) {
            pla = plaCreate(pla,excel,matService,nodeService);
            pla.setCreateTime(new Date());
@@ -87,17 +87,21 @@
//                throw new CoolException("保存商品信息失败,商品编码:" + excel.getMatnr());
//            }
            total++;
        }else if(Cools.eq(pla.getStatus(),GlobleParameter.PLA_STATUS_0) || Cools.eq(pla.getStatus(),GlobleParameter.PLA_STATUS_1) || Cools.eq(pla.getStatus(),GlobleParameter.PLA_STATUS_00)){
        }else if(Cools.eq(pla.getStatus(),GlobleParameter.PLA_STATUS_0) || Cools.eq(pla.getStatus(),GlobleParameter.PLA_STATUS_00) || Cools.eq(pla.getStatus(),GlobleParameter.PLA_STATUS_1) ){
            excel.setId(pla.getId());
            excel.setCreateTime(pla.getCreateTime());
            excel.setStatus(pla.getStatus());
            excel.setPakinTime(pla.getPakinTime());
            excel.setStash(pla.getStash());
            excel.setLocNo(pla.getLocNo());
            excel.setStockFreeze(pla.getStockFreeze());
            if(Cools.isEmpty(excel.getLocNo())){
                excel.setLocNo(pla.getLocNo());
            }
            BeanUtils.copyProperties(excel,pla);
            pla = plaCreate(pla,excel,matService,nodeService);
            try {
                plaService.updateById(pla);
                recordLog = recordLog + index + "," + pla.getBatch() + "," + pla.getPackageNo() + ";" ;
            }catch (Exception e){
                log.error("保存商品信息失败,批号:" + excel.getBatch() + ", 包号:" + excel.getPackageNo() + "原因为:" + e.getMessage());
                throw new CoolException("保存商品信息失败,批号:" + excel.getBatch() + ", 包号:" + excel.getPackageNo() + "原因为:" + e.getMessage());
@@ -171,7 +175,7 @@
        pla.setStep(2);
        pla.setModifyTime(new Date());
        pla.setStatus(GlobleParameter.PLA_STATUS_00);
        pla.setStockFreeze(1);
        pla.setStockFreeze(Cools.isEmpty(excel.getStockFreeze()) ? 1 : excel.getStockFreeze());
        pla.setWeightAnfme(pla.getWeight());
        Mat mat = matService.selectByMaktx(pla.getBrand());
        if(Cools.isEmpty(mat)){