cp
2024-10-24 50acd5996ba9f88bbfd4341855c38b625598a190
zy-asrs-common/src/main/java/com/zy/asrs/common/utils/LocInPrintMatExcelListener.java
@@ -6,8 +6,11 @@
import com.baomidou.mybatisplus.generator.config.IFileCreate;
import com.zy.asrs.common.domain.entity.LocInPrintMatExcel;
import com.zy.asrs.common.wms.entity.LocInPrintMat;
import com.zy.asrs.common.wms.entity.Mat;
import com.zy.asrs.common.wms.service.LocInPrintMatService;
import com.zy.asrs.common.wms.service.MatService;
import com.zy.asrs.framework.common.Cools;
import com.zy.asrs.framework.common.R;
import com.zy.asrs.framework.common.SpringUtils;
import com.zy.asrs.framework.exception.CoolException;
import lombok.Data;
@@ -29,7 +32,7 @@
    private int totalAnfme = 0;
    private Long userId;
    private Long hostId;
    List<String[]> OutLocBoxCs = new ArrayList<>();
    List<String[]> printMatList = new ArrayList<>();
    public LocInPrintMatExcelListener() {
    }
@@ -67,11 +70,22 @@
        } catch (Exception e){
            throw new CoolException("品号参数为空");
        }
        MatService matService = SpringUtils.getBean(MatService.class);
        Mat mat = matService.getOne(new LambdaQueryWrapper<Mat>().eq(Mat::getMatnr, matnr));
        if (Cools.isEmpty(mat)){
            throw new CoolException("品号:"+matnr+"不存在,请先新增商品档案!!!");
        }
        String matax = "";
        try{
            matax =  excel.getMatax();
            matax =  mat.getMaktx();
        } catch (Exception e){
            matax = "";
        }
        String decrees = "";
        try{
            decrees =  excel.getDecrees();
        } catch (Exception e){
            decrees = "";
        }
        String anfme = "1";
        try{
@@ -89,11 +103,12 @@
        } catch (Exception e){
            anfme = "1";
        }
        String[] s=new String[3];
        String[] s=new String[4];
        s[0] = matnr;
        s[1] = matax;
        s[2] = anfme;
        OutLocBoxCs.add(s);
        s[3] = decrees;
        printMatList.add(s);
        total++;
        totalAnfme = totalAnfme+Integer.parseInt(anfme);
    }
@@ -104,13 +119,14 @@
     */
    @Override
    public void doAfterAllAnalysed(AnalysisContext ctx) {
        if (!Cools.isEmpty(OutLocBoxCs) && OutLocBoxCs.size() != 0) {
        if (!Cools.isEmpty(printMatList) && printMatList.size() != 0) {
            LocInPrintMatService locInPrintMatService = SpringUtils.getBean(LocInPrintMatService.class);
            Date now = new Date();
            for (String[] outLocBoxC:OutLocBoxCs){
                String matnr = outLocBoxC[0];
                String matax = outLocBoxC[1];
                String anfme = outLocBoxC[2];
            for (String[] printMat:printMatList){
                String matnr = printMat[0];
                String matax = printMat[1];
                String anfme = printMat[2];
                String decrees = printMat[3];
                Integer intAnfme = 1;
                try{
                    Integer intAnfme1 = Integer.parseInt(anfme);
@@ -127,6 +143,7 @@
                    locInPrintMat.setUpdateBy(userId);
                    locInPrintMat.setCreateTime(now);
                    locInPrintMat.setUpdateTime(now);
                    locInPrintMat.setDecrees(decrees);
                    locInPrintMatService.save(locInPrintMat);
                }