From 5d9865a1b1d48cb3192ecce036f706ef582c1424 Mon Sep 17 00:00:00 2001 From: lxw <810412026@qq.com> Date: 星期五, 19 八月 2022 09:47:17 +0800 Subject: [PATCH] 去掉所有的报错正常运行 --- src/main/java/com/whyc/service/ProductBomService.java | 44 +++++++++++++++++++++----------------------- 1 files changed, 21 insertions(+), 23 deletions(-) diff --git a/src/main/java/com/whyc/service/ProductBomService.java b/src/main/java/com/whyc/service/ProductBomService.java index 059ee19..bde7c90 100644 --- a/src/main/java/com/whyc/service/ProductBomService.java +++ b/src/main/java/com/whyc/service/ProductBomService.java @@ -9,12 +9,11 @@ import com.whyc.dto.FileDirPath; import com.whyc.dto.Response; import com.whyc.dto.ZipUtils; -import com.whyc.mapper.ComponentMapper; +import com.whyc.mapper.MaterialMapper; import com.whyc.mapper.ProductBomMapper; import com.whyc.pojo.*; import com.whyc.util.ActionUtil; import org.apache.poi.hssf.usermodel.*; -import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.ClientAnchor; import org.apache.poi.ss.usermodel.Row; import org.springframework.beans.factory.annotation.Autowired; @@ -26,8 +25,6 @@ import javax.servlet.http.HttpServletResponse; import java.awt.image.BufferedImage; import java.io.*; -import java.math.BigDecimal; -import java.util.ArrayList; import java.util.Date; import java.util.LinkedList; import java.util.List; @@ -39,7 +36,7 @@ private ProductBomMapper mapper; @Autowired(required = false) - private ComponentMapper cponentMapper; + private MaterialMapper cponentMapper; @Autowired private DocLogService logService; //鍥剧焊鍒嗙被妫�绱� @@ -87,7 +84,8 @@ @Transactional public void updateNewBom(List<ProductBomHistory> newBomHistoryList) { UpdateWrapper<ProductBom> update = Wrappers.update(); - update.eq("parent_model",newBomHistoryList.get(0).getParentModel()); + //lxw娉ㄩ噴 + //update.eq("parent_model",newBomHistoryList.get(0).getParentModel()); mapper.delete(update); List<ProductBom> newBomList = new LinkedList<>(); @@ -99,10 +97,10 @@ newBom.setFileUrl(newBomHis.getFileUrl()); newBom.setMaterial(newBomHis.getMaterial()); newBom.setNotes(newBomHis.getNotes()); - newBom.setParentCode(newBomHis.getParentCode()); - newBom.setParentModel(newBomHis.getParentModel()); - newBom.setParentName(newBomHis.getParentName()); - newBom.setParentVersion(newBomHis.getParentVersion()); + //newBom.setParentCode(newBomHis.getParentCode()); + //newBom.setParentModel(newBomHis.getParentModel()); + //newBom.setParentName(newBomHis.getParentName()); + //newBom.setParentVersion(newBomHis.getParentVersion()); newBom.setPictureUrl(newBomHis.getPictureUrl()); newBom.setProducer(newBomHis.getProducer()); newBom.setQuantity(newBomHis.getQuantity()); @@ -114,7 +112,7 @@ newBom.setType(newBomHis.getType()); newBom.setUnit(newBomHis.getUnit()); newBom.setUpUserId(newBomHis.getUpUserId()); - newBom.setVersion(newBomHis.getEVersion()); + //newBom.setVersion(newBomHis.getEVersion()); newBomList.add(newBom); }); @@ -195,7 +193,7 @@ wrapper.eq("parent_model",parentModel); List<ProductBom> list=mapper.selectList(wrapper); //鏌ヨ鍑哄瓨鍦ㄦ浛鎹㈠叧绯诲緱鏁h浠� - List<ProductBom> replaceBoms=cponentMapper.getReplaceComponent(parentModel); + List<ProductBom> replaceBoms=cponentMapper.getReplaceMaterial(parentModel); //涓や釜闆嗗悎鍚堝苟鎵嶆槸鏈�缁堢殑BOM if(list!=null&&list.size()>0){ if(replaceBoms!=null&&replaceBoms.size()>0){ @@ -256,7 +254,7 @@ ProductBom bom= (ProductBom) list.get(i); String dwgUrl=bom.getDwgUrl(); if(i==0){ - excelName=bom.getParentCode()+"_"+bom.getParentModel(); + //excelName=bom.getParentCode()+"_"+bom.getParentModel(); String timeStr= ActionUtil.sdfwithFTP.format(new Date()); if(type.equals("pic")){ excelName=timeStr; @@ -274,9 +272,9 @@ Row row=sheet.createRow(rownum+i+1); //row.setHeight((short)(1500)); sheet.getRow(rownum+i+1).createCell(1).setCellValue(i+1); - sheet.getRow(rownum+i+1).createCell(2).setCellValue(bom.getParentCode()); - sheet.getRow(rownum+i+1).createCell(3).setCellValue(bom.getParentName()); - sheet.getRow(rownum+i+1).createCell(4).setCellValue(bom.getParentModel()); + //sheet.getRow(rownum+i+1).createCell(2).setCellValue(bom.getParentCode()); + //sheet.getRow(rownum+i+1).createCell(3).setCellValue(bom.getParentName()); + //sheet.getRow(rownum+i+1).createCell(4).setCellValue(bom.getParentModel()); sheet.getRow(rownum+i+1).createCell(5).setCellValue(bom.getCategory()); sheet.getRow(rownum+i+1).createCell(6).setCellValue(bom.getSubCode()); if(bom.getOldSubName()!=null&&!bom.getOldSubName().isEmpty()){ @@ -361,15 +359,15 @@ } } //鏌ヨ鎵�鏈変骇鍝佷腑娌℃湁涓庢寚瀹氭暎瑁呬欢鍏宠仈鐨勫瓙浠� - public Response getAllSubWithOutComponent(int componentId) { - List<ProductBom> list=mapper.getAllSubWithOutComponent(componentId); + public Response getAllSubWithOutMaterial(int MaterialId) { + List<ProductBom> list=mapper.getAllSubWithOutMaterial(MaterialId); return new Response().setII(1,list.size()>0?true:false,list,"杩斿洖鏁版嵁"); } //鏍规嵁姣嶆枡鍨嬪彿鏌ヨ瀛愪欢淇℃伅鍙婃湁鏈�鏂扮増鏈叧鑱旂殑鏁h浠朵俊鎭� - public Response getSubByComponentProduct(String parentModel) { - List<ProductBom> list=mapper.getSubByComponentProduct(parentModel); + public Response getSubByMaterialProduct(String parentModel) { + List<ProductBom> list=mapper.getSubByMaterialProduct(parentModel); //鏌ヨ鍑哄瓨鍦ㄦ浛鎹㈠叧绯诲緱鏁h浠� - List<ProductBom> replaceBoms=cponentMapper.getReplaceComponent(parentModel); + List<ProductBom> replaceBoms=cponentMapper.getReplaceMaterial(parentModel); if(replaceBoms!=null&&replaceBoms.size()>0){ replaceBoms.stream().forEach(replaceBom->{ //濡傛灉瀛樺湪鏇挎崲鍏崇郴锛屾煡璇㈠嚭鍘熷瓙浠剁殑鍏宠仈鍏崇郴(灏嗗師瀛愪欢鍚嶇О鏀惧湪oldSubName涓�) @@ -378,8 +376,8 @@ replaceBom.setReplaceStatus(1); if (replaceBom.getOldSubName() != null && !replaceBom.getOldSubName().isEmpty()) { //鏌ヨ鍑哄瓨鍦ㄧ殑鏃х殑鍏宠仈瀛愪欢,杩樿涓庡師BOM鐗堟湰涓�鑷� - List<Component> oldCponent = mapper.getOldComponent(replaceBom.getOldSubName()); - replaceBom.setComponents(oldCponent); + List<Material> oldCponent = mapper.getOldMaterial(replaceBom.getOldSubName()); + replaceBom.setMaterials(oldCponent); } } list.add(replaceBom); -- Gitblit v1.9.1