lxw
2022-09-03 26cdfa723406fc4cbb667401704d2cdd2547331b
下载替换件变红
5个文件已修改
450 ■■■■ 已修改文件
src/main/java/com/whyc/pojo/ProductBom.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/pojo/ProductBomHistory.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/CategoryService.java 130 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/ProductBomHistoryService.java 153 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/ProductBomService.java 140 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/pojo/ProductBom.java
@@ -104,6 +104,10 @@
    @ApiModelProperty(value = "定制单号")
    private String customCode;
    @TableField(exist = false)
    @ApiModelProperty(value = "是否是bom的管理,excel导出有用,0:原件,1:关联件")
    private Integer connFlag;
    public Integer getId() {
        return id;
    }
@@ -301,4 +305,16 @@
    public void setSubVersion(Integer subVersion) {
        this.subVersion = subVersion;
    }
    public Integer getMaterialId() {
        return materialId;
    }
    public Integer getConnFlag() {
        return connFlag;
    }
    public void setConnFlag(Integer connFlag) {
        this.connFlag = connFlag;
    }
}
src/main/java/com/whyc/pojo/ProductBomHistory.java
@@ -104,6 +104,9 @@
    @ApiModelProperty(value = "定制单号")
    private String customCode;
    @TableField(exist = false)
    @ApiModelProperty(value = "是否是bom的管理,excel导出有用,0:原件,1:关联件")
    private Integer connFlag;
    public Integer getId() {
        return id;
@@ -313,4 +316,12 @@
    public void setMaterialObj(Material materialObj) {
        this.materialObj = materialObj;
    }
    public Integer getConnFlag() {
        return connFlag;
    }
    public void setConnFlag(Integer connFlag) {
        this.connFlag = connFlag;
    }
}
src/main/java/com/whyc/service/CategoryService.java
@@ -3,10 +3,19 @@
import com.whyc.dto.Response;
import com.whyc.mapper.CategoryMapper;
import com.whyc.pojo.Category;
import com.whyc.util.ActionUtil;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.hssf.util.HSSFColor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.swing.*;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Random;
@Service
public class CategoryService {
@@ -19,4 +28,125 @@
        List<Category> list=mapper.getAllPermit();
        return  new Response().setII(1,list.size()>0,list,"权限信息");
    }
    public static void main(String[] args) {
        HSSFWorkbook wb=new HSSFWorkbook();
        HSSFSheet sheet=wb.createSheet();
//第一个样式和输出(边框)
        /*HSSFCellStyle style=wb.createCellStyle();
        style.setBorderBottom(HSSFCellStyle.BORDER_THIN); //设置底线和颜色
        style.setBottomBorderColor(HSSFColor.BLACK.index);
        style.setBorderLeft(HSSFCellStyle.BORDER_THIN); //设置左边线和颜色
        style.setLeftBorderColor(HSSFColor.BLACK.index);
        style.setBorderRight(HSSFCellStyle.BORDER_THIN); //设置右边线和颜色
        style.setRightBorderColor(HSSFColor.BLACK.index);
        style.setBorderTop(HSSFCellStyle.BORDER_THIN); //设置上面线和颜色
        style.setTopBorderColor(HSSFColor.BLACK.index);*/
        //HSSFRow row=sheet.createRow((short)1);
       // HSSFCell cell=row.createCell((short)1);
        /*cell.setCellValue("hello");
        cell.setCellStyle(style);*/
//第二个样式和输出(背景/前景色)
        /*style = wb.createCellStyle();
        style.setFillBackgroundColor(HSSFColor.ORANGE.index);//添加背景色,内容看不清楚
        style.setFillPattern(HSSFCellStyle.BIG_SPOTS);
        row=sheet.createRow((short)2);
        cell=row.createCell((short)2);
        cell.setCellValue("hello");
        cell.setCellStyle(style);
*/
        /*style = wb.createCellStyle();
        style.setFillForegroundColor(HSSFColor.ORANGE.index);//添加前景色,内容看的清楚
        style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
        row=sheet.createRow((short)3);
        cell=row.createCell((short)3);
        cell.setCellValue("hello");
        cell.setCellStyle(style);*/
        //HSSFFont font = wb.createFont();
//第三个样式和输出(字体)
        /*font.setFontHeightInPoints((short)8); //字体大小
        font.setFontName("Arial"); //什么字体
        font.setItalic(false); //是不倾斜
        font.setStrikeout(false); //是不是划掉
        font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); //字体加粗
        style = wb.createCellStyle(); //引用字体的这个样式
        style.setFont(font);
        row=sheet.createRow((short)4); //输出看结果
        cell=row.createCell((short)4);
        cell.setCellValue("BJ10012-1241");
        cell.setCellStyle(style);*/
//第四样式和输出(自定义颜色)
        /*style = wb.createCellStyle(); //设置颜色样式,后面定义颜色的值
        style.setFillForegroundColor(HSSFColor.LIME.index);
        style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
        row=sheet.createRow((short)5);
        cell=row.createCell((short)5);
        cell.setCellValue("BJ10012-1241");
        cell.setCellStyle(style);
        HSSFPalette palette = wb.getCustomPalette(); //定义颜色的值
        palette.setColorAtIndex(HSSFColor.LIME.index, (byte) 255, (byte) 0, (byte) 0);*/
//第五样式和输出(水平和垂直对齐)
        /*style = wb.createCellStyle();
        style.setAlignment(HSSFCellStyle.ALIGN_CENTER);//水平居中
        style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);//垂直居中
        row=sheet.createRow((short)6);
        cell=row.createCell((short)6);
        cell.setCellValue("BJ10012-1241");
        cell.setCellStyle(style);*/
//设置一个标题样式
        HSSFFont font = wb.createFont(); //设置字体的样式
        font.setFontHeightInPoints((short)8); //字体大小
        font.setFontName("Arial"); //什么字体
        font.setItalic(false); //是不倾斜
        font.setStrikeout(false); //是不是划掉
        font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); //字体加粗
        font.setColor(HSSFFont.COLOR_RED);
        HSSFCellStyle style = wb.createCellStyle(); //引用字体的这个样式
        style.setFont(font);
       /* style.setBorderBottom(HSSFCellStyle.BORDER_THIN); //设置底线和颜色
        style.setBottomBorderColor(HSSFColor.BLACK.index);
        style.setBorderLeft(HSSFCellStyle.BORDER_THIN); //设置左边线和颜色
        style.setLeftBorderColor(HSSFColor.BLACK.index);
        style.setBorderRight(HSSFCellStyle.BORDER_THIN); //设置右边线和颜色
        style.setRightBorderColor(HSSFColor.BLACK.index);
        style.setBorderTop(HSSFCellStyle.BORDER_THIN); //设置上面线和颜色
        style.setTopBorderColor(HSSFColor.BLACK.index);
        style.setAlignment(HSSFCellStyle.ALIGN_CENTER);//水平居中
        style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);//垂直居中*/
        //style.setFillForegroundColor(HSSFColor.RED.index);//添加前景色,内容看的清楚
        //style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
        HSSFRow row=sheet.createRow((short)7);
        HSSFCell cell=row.createCell((short)6);
        cell.setCellValue("lxw");
        //cell.setCellStyle(style);
        cell=row.createCell((short)7);
        cell.setCellValue("BJ10012-1241");
        //cell.setCellStyle(style);
        row.setRowStyle(style);
//输出文件
        try {
            String name="workbook_"+ ActionUtil.sdfwithFTP.format(new Date()).replace(" ","_")+".xls";
            FileOutputStream fileOut = new FileOutputStream("D://"+name);
            wb.write(fileOut);
            fileOut.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
src/main/java/com/whyc/service/ProductBomHistoryService.java
@@ -136,6 +136,7 @@
        //处理存在关联关系的物料
        List<ProductBomHistory> endList=new ArrayList<>();
        list.stream().forEach(bomHistory -> {
            bomHistory.setConnFlag(0);
            endList.add(bomHistory);
            if(bomHistory.getMaterials()!=null&&bomHistory.getMaterials().size()>0){
                for (Material m:bomHistory.getMaterials()) {
@@ -145,12 +146,6 @@
                }
            }
        });
        HSSFWorkbook wb = new HSSFWorkbook();
        //字体格式-加粗
        HSSFCellStyle cellStyle = wb.createCellStyle();
        HSSFFont font = wb.createFont();
        font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
        cellStyle.setFont(font);
        String withOutDwg="doc_file/product"+File.separator+pHistory.getParentModel();
        if(pHistory.getCustomCode()!=null&&!pHistory.getCustomCode().isEmpty()){
            withOutDwg+=File.separator+pHistory.getCustomCode()+File.separator+version;
@@ -158,7 +153,7 @@
            withOutDwg+=File.separator+"standard"+File.separator+version;
        }
        //生成excel并将dwg文件放在同一报下压缩
        creatBomHsitoryExcel(req,resp,pHistory,endList,wb,withOutDwg);
        creatBomHsitoryExcel(req,resp,pHistory,endList,withOutDwg);
        //记录日志
        DocUser docUser= ActionUtil.getUser();
        String operationDetail="具体产品为:"+pHistory.toString();
@@ -167,11 +162,21 @@
        logService.recordOperationLog(docUser.getId(),docUser.getName(), UserOperation.TYPE_DOWNLOAD.getType(),new Date(),terminalIp,opreationMsg,operationDetail);
    }
    //根据产品信息创建excel表格并存放在指定目录
    public void creatBomHsitoryExcel(HttpServletRequest req, HttpServletResponse resp,ProductHistory pHistory,List<ProductBomHistory> list, HSSFWorkbook wb,String withOutDwg){
    public void creatBomHsitoryExcel(HttpServletRequest req, HttpServletResponse resp,ProductHistory pHistory,List<ProductBomHistory> list,String withOutDwg){
        String fileDirName = FileDirPath.getFileDirName();
        String rootFace="";
        String excelName="";
        String[] titleNames=new String[]{"序列","母物料编码","母物料名称","母物料型号","类别","子件编码","子件名称","子件型号"
                ,"基本单位","子件数量","生产商","封装类型/材质","元件编号/料厚","表面处理/物料详情","备注","图片"};
        //创建单个sheet
        HSSFWorkbook wb = new HSSFWorkbook();
        //字体格式-加粗
        HSSFCellStyle cellStyle = wb.createCellStyle();
        HSSFFont font = wb.createFont();
        font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
        font.setColor(HSSFFont.COLOR_RED);
        cellStyle.setFont(font);
        HSSFSheet sheet = wb.createSheet("bom_"+pHistory.getVersion()+"信息");
        sheet.setColumnWidth(1,5000);
        sheet.setColumnWidth(2,5000);
@@ -185,24 +190,14 @@
        //图片元素
        HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
        int rownum = 1;
        sheet.createRow(rownum);
        sheet.getRow(rownum).createCell(1).setCellValue("序列");
        sheet.getRow(rownum).createCell(2).setCellValue("母物料编码");
        sheet.getRow(rownum).createCell(3).setCellValue("母物料名称");
        sheet.getRow(rownum).createCell(4).setCellValue("母物料型号");
        sheet.getRow(rownum).createCell(5).setCellValue("类别");
        sheet.getRow(rownum).createCell(6).setCellValue("子件编码");
        sheet.getRow(rownum).createCell(7).setCellValue("子件名称");
        sheet.getRow(rownum).createCell(8).setCellValue("子件型号");
        sheet.getRow(rownum).createCell(9).setCellValue("基本单位");
        sheet.getRow(rownum).createCell(10).setCellValue("子件数量");
        sheet.getRow(rownum).createCell(11).setCellValue("生产商");
        sheet.getRow(rownum).createCell(12).setCellValue("封装类型/材质");
        sheet.getRow(rownum).createCell(13).setCellValue("元件编号/料厚");
        sheet.getRow(rownum).createCell(14).setCellValue("表面处理/物料详情");
        sheet.getRow(rownum).createCell(15).setCellValue("备注");
        sheet.getRow(rownum).createCell(16).setCellValue("图片");
        HSSFRow row=sheet.createRow(rownum);
        HSSFCell cell=row.createCell(0);
        if(titleNames.length>0){
            for (int i=0;i<titleNames.length;i++) {
                cell=row.createCell(i+1);
                cell.setCellValue(titleNames[i]);
            }
        }
        excelName=pHistory.getParentCode()+"_"+pHistory.getParentModel()+"_"+pHistory.getVersion();
        rootFace=fileDirName+ File.separator+excelName;
        File destfile = new File(rootFace);
@@ -222,23 +217,93 @@
                    File sourceFile=new File(fileDirName+ File.separator+dwgUrl);
                    bomService.copyFile(sourceFile,rootFace);
                }
                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(pHistory.getParentCode());
                sheet.getRow(rownum+i+1).createCell(3).setCellValue(pHistory.getParentName());
                sheet.getRow(rownum+i+1).createCell(4).setCellValue(pHistory.getParentModel());
                sheet.getRow(rownum+i+1).createCell(5).setCellValue(bomHistory.getCategory());
                sheet.getRow(rownum+i+1).createCell(6).setCellValue(bomHistory.getSubCode());
                sheet.getRow(rownum+i+1).createCell(7).setCellValue(bomHistory.getSubName());
                sheet.getRow(rownum+i+1).createCell(8).setCellValue(bomHistory.getSubModel());
                sheet.getRow(rownum+i+1).createCell(9).setCellValue(bomHistory.getUnit()==null?"":bomHistory.getUnit());
                sheet.getRow(rownum+i+1).createCell(10).setCellValue(bomHistory.getQuantity()==null?"":bomHistory.getQuantity().toString());
                sheet.getRow(rownum+i+1).createCell(11).setCellValue(bomHistory.getProducer()==null?"":bomHistory.getProducer());
                sheet.getRow(rownum+i+1).createCell(12).setCellValue(bomHistory.getMaterial());
                sheet.getRow(rownum+i+1).createCell(13).setCellValue(bomHistory.getThickness());
                sheet.getRow(rownum+i+1).createCell(14).setCellValue(bomHistory.getSurfaceDetail());
                sheet.getRow(rownum+i+1).createCell(15).setCellValue(bomHistory.getNotes());
                rownum=rownum+1;
                row=sheet.createRow(rownum);
                if(bomHistory.getConnFlag()==1){
                    cell=row.createCell(0);
                    cell.setCellValue("替换件");
                    cell.setCellStyle(cellStyle);
                    cell=row.createCell(1);
                    cell.setCellValue(i+1);
                    cell.setCellStyle(cellStyle);
                    cell=row.createCell(2);
                    cell.setCellValue(pHistory.getParentCode());
                    cell.setCellStyle(cellStyle);
                    cell=row.createCell(3);
                    cell.setCellValue(pHistory.getParentName());
                    cell.setCellStyle(cellStyle);
                    cell=row.createCell(4);
                    cell.setCellValue(pHistory.getParentModel());
                    cell.setCellStyle(cellStyle);
                    cell=row.createCell(5);
                    cell.setCellValue(bomHistory.getCategory());
                    cell.setCellStyle(cellStyle);
                    cell=row.createCell(6);
                    cell.setCellValue(bomHistory.getSubCode());
                    cell.setCellStyle(cellStyle);
                    cell=row.createCell(7);
                    cell.setCellValue(bomHistory.getSubName());
                    cell.setCellStyle(cellStyle);
                    cell=row.createCell(8);
                    cell.setCellValue(bomHistory.getSubModel());
                    cell.setCellStyle(cellStyle);
                    cell=row.createCell(9);
                    cell.setCellValue(bomHistory.getUnit()==null?"":bomHistory.getUnit());
                    cell.setCellStyle(cellStyle);
                    cell=row.createCell(10);
                    cell.setCellValue(bomHistory.getQuantity()==null?"": bomHistory.getQuantity().toString());
                    cell.setCellStyle(cellStyle);
                    cell=row.createCell(11);
                    cell.setCellValue(bomHistory.getProducer()==null?"":bomHistory.getProducer());
                    cell.setCellStyle(cellStyle);
                    cell=row.createCell(12);
                    cell.setCellValue(bomHistory.getMaterial());
                    cell.setCellStyle(cellStyle);
                    cell=row.createCell(12);
                    cell.setCellValue(bomHistory.getThickness());
                    cell.setCellStyle(cellStyle);
                    cell=row.createCell(13);
                    cell.setCellValue(bomHistory.getThickness());
                    cell.setCellStyle(cellStyle);
                    cell=row.createCell(14);
                    cell.setCellValue(bomHistory.getSurfaceDetail());
                    cell.setCellStyle(cellStyle);
                    cell=row.createCell(15);
                    cell.setCellValue(bomHistory.getNotes());
                    cell.setCellStyle(cellStyle);
                }else{
                    row.createCell(1).setCellValue(i+1);
                    row.createCell(2).setCellValue(pHistory.getParentCode());
                    row.createCell(3).setCellValue(pHistory.getParentName());
                    row.createCell(4).setCellValue(pHistory.getParentModel());
                    row.createCell(5).setCellValue(bomHistory.getCategory());
                    row.createCell(6).setCellValue(bomHistory.getSubCode());
                    row.createCell(7).setCellValue(bomHistory.getSubName());
                    row.createCell(8).setCellValue(bomHistory.getSubModel());
                    row.createCell(9).setCellValue(bomHistory.getUnit()==null?"":bomHistory.getUnit());
                    row.createCell(10).setCellValue(bomHistory.getQuantity()==null?"":bomHistory.getQuantity().toString());
                    row.createCell(11).setCellValue(bomHistory.getProducer()==null?"":bomHistory.getProducer());
                    row.createCell(12).setCellValue(bomHistory.getMaterial());
                    row.createCell(13).setCellValue(bomHistory.getThickness());
                    row.createCell(14).setCellValue(bomHistory.getSurfaceDetail());
                    row.createCell(15).setCellValue(bomHistory.getNotes());
                }
                if((bomHistory.getPictureUrl()!=null)&&(!bomHistory.getPictureUrl().isEmpty())){
                    ByteArrayOutputStream byteArrayOut = null;
                    try {
@@ -316,7 +381,6 @@
        bomHis.setSubName(m.getSubName());
        bomHis.setSubModel(m.getSubModel());
        bomHis.setUnit(m.getUnit());
        //bomHis.setQuantity(m.getQuantity());
        bomHis.setProducer(m.getProducer());
        bomHis.setMaterial(m.getMaterial());
        bomHis.setThickness(m.getThickness());
@@ -326,6 +390,7 @@
        bomHis.setDwgUrl(m.getDwgUrl());
        bomHis.setFileUrl(m.getFileUrl());
        bomHis.setCreateDate(m.getCreateDate());
        bomHis.setConnFlag(1);
        return  bomHis;
    }
src/main/java/com/whyc/service/ProductBomService.java
@@ -223,6 +223,7 @@
        //处理存在关联关系的物料
        List<ProductBom> endList=new ArrayList<>();
        list.stream().forEach(bom -> {
            bom.setConnFlag(0);
            endList.add(bom);
            if(bom.getMaterials()!=null&&bom.getMaterials().size()>0){
                for (Material m:bom.getMaterials()) {
@@ -240,7 +241,7 @@
            withOutDwg+=File.separator+"standard"+File.separator+version;
        }
        //生成excel并将dwg文件放在同一报下压缩
        creatBomExcel(req,resp,product,endList,wb,"bom",withOutDwg);
        creatBomExcel(req,resp,product,endList,wb,withOutDwg);
        //记录日志
        DocUser docUser= ActionUtil.getUser();
        String operationDetail="具体产品信息为:"+product.toString();
@@ -251,10 +252,12 @@
    //根据产品信息创建excel表格并存放在指定目录
    private void creatBomExcel(HttpServletRequest req, HttpServletResponse resp,Product product,List list, HSSFWorkbook wb,String type,String withOutDwg){
    private void creatBomExcel(HttpServletRequest req, HttpServletResponse resp,Product product,List list, HSSFWorkbook wb,String withOutDwg){
        String fileDirName = FileDirPath.getFileDirName();
        String rootFace="";
        String excelName="";
        String[] titleNames=new String[]{"序列","母物料编码","母物料名称","母物料型号","类别","子件编码","子件名称","子件型号"
                                        ,"基本单位","子件数量","生产商","封装类型/材质","元件编号/料厚","表面处理/物料详情","备注","图片"};
        //字体格式-加粗
        HSSFCellStyle cellStyle = wb.createCellStyle();
        HSSFFont font = wb.createFont();
@@ -275,29 +278,17 @@
        //图片元素
        HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
        int rownum = 1;
        sheet.createRow(rownum);
        sheet.getRow(rownum).createCell(1).setCellValue("序列");
        sheet.getRow(rownum).createCell(2).setCellValue("母物料编码");
        sheet.getRow(rownum).createCell(3).setCellValue("母物料名称");
        sheet.getRow(rownum).createCell(4).setCellValue("母物料型号");
        sheet.getRow(rownum).createCell(5).setCellValue("类别");
        sheet.getRow(rownum).createCell(6).setCellValue("子件编码");
        sheet.getRow(rownum).createCell(7).setCellValue("子件名称");
        sheet.getRow(rownum).createCell(8).setCellValue("子件型号");
        sheet.getRow(rownum).createCell(9).setCellValue("基本单位");
        sheet.getRow(rownum).createCell(10).setCellValue("子件数量");
        sheet.getRow(rownum).createCell(11).setCellValue("生产商");
        sheet.getRow(rownum).createCell(12).setCellValue("封装类型/材质");
        sheet.getRow(rownum).createCell(13).setCellValue("元件编号/料厚");
        sheet.getRow(rownum).createCell(14).setCellValue("表面处理/物料详情");
        sheet.getRow(rownum).createCell(15).setCellValue("备注");
        sheet.getRow(rownum).createCell(16).setCellValue("图片");
        HSSFRow row=sheet.createRow(rownum);
        HSSFCell cell=row.createCell(0);
        if(titleNames.length>0){
            for (int i=0;i<titleNames.length;i++) {
                cell=row.createCell(i+1);
                cell.setCellValue(titleNames[i]);
            }
        }
        //构建excel名称和创建文件夹
        excelName=product.getParentCode()+"_"+product.getParentModel();
        String timeStr= ActionUtil.sdfwithFTP.format(new Date());
        if(type.equals("pic")){
            excelName=timeStr;
        }
        rootFace=fileDirName+File.separator+excelName;
        File destfile = new File(rootFace);
        if(!destfile.exists()) {
@@ -315,23 +306,93 @@
                    File sourceFile=new File(fileDirName+ File.separator+dwgUrl);
                    copyFile(sourceFile,rootFace);
                }
                Row row=sheet.createRow(rownum+i+1);
                row.setRowStyle(cellStyle);
                sheet.getRow(rownum+i+1).createCell(1).setCellValue(i+1);
                sheet.getRow(rownum+i+1).createCell(2).setCellValue(product.getParentCode());
                sheet.getRow(rownum+i+1).createCell(3).setCellValue(product.getParentName());
                sheet.getRow(rownum+i+1).createCell(4).setCellValue(product.getParentModel());
                sheet.getRow(rownum+i+1).createCell(5).setCellValue(bom.getCategory());
                sheet.getRow(rownum+i+1).createCell(6).setCellValue(bom.getSubCode());
                sheet.getRow(rownum+i+1).createCell(7).setCellValue(bom.getSubName());
                sheet.getRow(rownum+i+1).createCell(8).setCellValue(bom.getSubModel());
                sheet.getRow(rownum+i+1).createCell(9).setCellValue(bom.getUnit()==null?"":bom.getUnit());
                sheet.getRow(rownum+i+1).createCell(10).setCellValue(bom.getQuantity()==null?"": bom.getQuantity().toString());
                sheet.getRow(rownum+i+1).createCell(11).setCellValue(bom.getProducer()==null?"":bom.getProducer());
                sheet.getRow(rownum+i+1).createCell(12).setCellValue(bom.getMaterial());
                sheet.getRow(rownum+i+1).createCell(13).setCellValue(bom.getThickness());
                sheet.getRow(rownum+i+1).createCell(14).setCellValue(bom.getSurfaceDetail());
                sheet.getRow(rownum+i+1).createCell(15).setCellValue(bom.getNotes());
                rownum=rownum+1;
                row=sheet.createRow(rownum);
                if(bom.getConnFlag()==1){
                    cell=row.createCell(0);
                    cell.setCellValue("替换件");
                    cell.setCellStyle(cellStyle);
                    cell=row.createCell(1);
                    cell.setCellValue(i+1);
                    cell.setCellStyle(cellStyle);
                    cell=row.createCell(2);
                    cell.setCellValue(product.getParentCode());
                    cell.setCellStyle(cellStyle);
                    cell=row.createCell(3);
                    cell.setCellValue(product.getParentName());
                    cell.setCellStyle(cellStyle);
                    cell=row.createCell(4);
                    cell.setCellValue(product.getParentModel());
                    cell.setCellStyle(cellStyle);
                    cell=row.createCell(5);
                    cell.setCellValue(bom.getCategory());
                    cell.setCellStyle(cellStyle);
                    cell=row.createCell(6);
                    cell.setCellValue(bom.getSubCode());
                    cell.setCellStyle(cellStyle);
                    cell=row.createCell(7);
                    cell.setCellValue(bom.getSubName());
                    cell.setCellStyle(cellStyle);
                    cell=row.createCell(8);
                    cell.setCellValue(bom.getSubModel());
                    cell.setCellStyle(cellStyle);
                    cell=row.createCell(9);
                    cell.setCellValue(bom.getUnit()==null?"":bom.getUnit());
                    cell.setCellStyle(cellStyle);
                    cell=row.createCell(10);
                    cell.setCellValue(bom.getQuantity()==null?"": bom.getQuantity().toString());
                    cell.setCellStyle(cellStyle);
                    cell=row.createCell(11);
                    cell.setCellValue(bom.getProducer()==null?"":bom.getProducer());
                    cell.setCellStyle(cellStyle);
                    cell=row.createCell(12);
                    cell.setCellValue(bom.getMaterial());
                    cell.setCellStyle(cellStyle);
                    cell=row.createCell(12);
                    cell.setCellValue(bom.getThickness());
                    cell.setCellStyle(cellStyle);
                    cell=row.createCell(13);
                    cell.setCellValue(bom.getThickness());
                    cell.setCellStyle(cellStyle);
                    cell=row.createCell(14);
                    cell.setCellValue(bom.getSurfaceDetail());
                    cell.setCellStyle(cellStyle);
                    cell=row.createCell(15);
                    cell.setCellValue(bom.getNotes());
                    cell.setCellStyle(cellStyle);
                }else{
                    row.createCell(1).setCellValue(i+1);
                    row.createCell(2).setCellValue(product.getParentCode());
                    row.createCell(3).setCellValue(product.getParentName());
                    row.createCell(4).setCellValue(product.getParentModel());
                    row.createCell(5).setCellValue(bom.getCategory());
                    row.createCell(6).setCellValue(bom.getSubCode());
                    row.createCell(7).setCellValue(bom.getSubName());
                    row.createCell(8).setCellValue(bom.getSubModel());
                    row.createCell(9).setCellValue(bom.getUnit()==null?"":bom.getUnit());
                    row.createCell(10).setCellValue(bom.getQuantity()==null?"": bom.getQuantity().toString());
                    row.createCell(11).setCellValue(bom.getProducer()==null?"":bom.getProducer());
                    row.createCell(12).setCellValue(bom.getMaterial());
                    row.createCell(13).setCellValue(bom.getThickness());
                    row.createCell(14).setCellValue(bom.getSurfaceDetail());
                    row.createCell(15).setCellValue(bom.getNotes());
                }
                if((bom.getPictureUrl()!=null)&&(!bom.getPictureUrl().isEmpty())){
                    ByteArrayOutputStream byteArrayOut = null;
                    try {
@@ -453,6 +514,7 @@
        bom.setDwgUrl(m.getDwgUrl());
        bom.setFileUrl(m.getFileUrl());
        bom.setCreateDate(m.getCreateDate());
        bom.setConnFlag(1);
        return  bom;
    }