|  |  |  | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | 
|---|
|  |  |  | private int totalAnfme = 0; | 
|---|
|  |  |  | private Long userId; | 
|---|
|  |  |  | private Long hostId; | 
|---|
|  |  |  | List<String[]> OutLocBoxCs = new ArrayList<>(); | 
|---|
|  |  |  | List<String[]> printMatList = new ArrayList<>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public LocInPrintMatExcelListener() { | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | } 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{ | 
|---|
|  |  |  | 
|---|
|  |  |  | } 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); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @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); | 
|---|
|  |  |  | 
|---|
|  |  |  | locInPrintMat.setUpdateBy(userId); | 
|---|
|  |  |  | locInPrintMat.setCreateTime(now); | 
|---|
|  |  |  | locInPrintMat.setUpdateTime(now); | 
|---|
|  |  |  | locInPrintMat.setDecrees(decrees); | 
|---|
|  |  |  | locInPrintMatService.save(locInPrintMat); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|