Browse Source

1、导出完善-补充常规参数信息

master
Aug 2 months ago
parent
commit
e7aa937a2d
1 changed files with 334 additions and 9 deletions
  1. +334
    -9
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/apiService/impl/ExcelServiceImpl.java

+ 334
- 9
jeecg-boot-module-system/src/main/java/org/jeecg/modules/apiService/impl/ExcelServiceImpl.java View File

@ -1,9 +1,6 @@
package org.jeecg.modules.apiService.impl;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
@ -188,8 +185,8 @@ public class ExcelServiceImpl implements ExcelService {
}
//常规参数
public int generalParam(Sheet sheet, WorkorderTemplate template, int stepNum, int generalNum){
//常规参数-工序卡1
public int generalParamOne(Sheet sheet, WorkorderTemplate template, int stepNum, int generalNum, CellStyle cellStyle){
//常规参数信息
WorkorderGeneralStepone generalStepone = template.getWorkorderStepList().get(stepNum).getWorkorderGeneralSteponeList().get(generalNum);
//设置跨行跨列
@ -202,6 +199,7 @@ public class ExcelServiceImpl implements ExcelService {
//第一行第一列
Cell cell11 = row1.createCell(0);
cell11.setCellValue("中试压缩机试作工序卡1(选配)");
cell11.setCellStyle(cellStyle);
//第二行
Row row2 = sheet.createRow(1);
@ -243,7 +241,7 @@ public class ExcelServiceImpl implements ExcelService {
Cell cell36 = row3.createCell(5);
cell36.setCellValue(generalStepone.getScribing1());
Cell cell37 = row3.createCell(6);
cell37.setCellValue("中试作业员1");
cell37.setCellValue("中试作业员");
Cell cell38 = row3.createCell(7);
cell38.setCellValue(generalStepone.getOperator());
@ -263,14 +261,311 @@ public class ExcelServiceImpl implements ExcelService {
Cell cell46 = row4.createCell(5);
cell46.setCellValue(generalStepone.getScribing2());
Cell cell47 = row4.createCell(6);
cell47.setCellValue("中试作业员2");
cell47.setCellValue("中试作业员");
Cell cell48 = row4.createCell(7);
cell48.setCellValue(generalStepone.getOperator());
return sheet.getLastRowNum();
}
//常规参数-工序卡2
public int generalParamTwo(Sheet sheet, WorkorderTemplate template, int stepNum, int generalNum, CellStyle cellStyle){
//常规参数信息
WorkorderGeneralSteptwo generalSteptwo = template.getWorkorderStepList().get(stepNum).getWorkorderGeneralSteptwoList().get(generalNum);
//设置跨行跨列
sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 9));
//第一行
Row row1 = sheet.createRow(0);
//第一行第一列
Cell cell11 = row1.createCell(0);
cell11.setCellValue("中试压缩机试作工序卡2");
cell11.setCellStyle(cellStyle);
//第二行
Row row2 = sheet.createRow(1);
//第二行第n列
Cell cell21 = row2.createCell(0);
cell21.setCellValue("委托担当");
Cell cell22 = row2.createCell(1);
cell22.setCellValue(template.getResponsibler());
Cell cell23 = row2.createCell(2);
cell23.setCellValue("指示书/流程编号:");
Cell cell24 = row2.createCell(3);
cell24.setCellValue(template.getTaskNo());
Cell cell25 = row2.createCell(4);
cell25.setCellValue("机种名");
Cell cell26 = row2.createCell(5);
cell26.setCellValue(template.getModel());
Cell cell27 = row2.createCell(6);
cell27.setCellValue("数量");
Cell cell28 = row2.createCell(7);
cell28.setCellValue(template.getNumber());
Cell cell29 = row2.createCell(8);
cell29.setCellValue("页数");
Cell cell210 = row2.createCell(9);
cell210.setCellValue("2/4");
//第三行
Row row3 = sheet.createRow(2);
//第三行第n列
Cell cell31 = row3.createCell(0);
cell31.setCellValue("部件名");
Cell cell32 = row3.createCell(1);
cell32.setCellValue(generalSteptwo.getComponent());
Cell cell33 = row3.createCell(2);
cell33.setCellValue("日期");
Cell cell34 = row3.createCell(3);
cell34.setCellValue(generalSteptwo.getCurrentdate());
Cell cell35 = row3.createCell(4);
cell35.setCellValue("中试确认");
Cell cell36 = row3.createCell(5);
cell36.setCellValue(generalSteptwo.getCreateBy());
Cell cell37 = row3.createCell(6);
cell37.setCellValue("品质确认");
Cell cell38 = row3.createCell(7);
cell38.setCellValue(generalSteptwo.getConfirmQuality());
Cell cell39 = row3.createCell(8);
cell39.setCellValue("研发确认");
Cell cell310 = row3.createCell(9);
cell310.setCellValue(generalSteptwo.getConfirmDevelop());
//第四行
Row row4 = sheet.createRow(3);
//第四行第n列
Cell cell41 = row4.createCell(0);
cell41.setCellValue("工序");
Cell cell42 = row4.createCell(1);
cell42.setCellValue("检查项目");
Cell cell43 = row4.createCell(2);
cell43.setCellValue("规格");
Cell cell44 = row4.createCell(3);
cell44.setCellValue("1");
Cell cell45 = row4.createCell(4);
cell45.setCellValue("2");
Cell cell46 = row4.createCell(5);
cell46.setCellValue("3");
Cell cell47 = row4.createCell(6);
cell47.setCellValue("4");
Cell cell48 = row4.createCell(7);
cell48.setCellValue("5");
Cell cell49 = row4.createCell(8);
cell49.setCellValue("6");
Cell cell410 = row4.createCell(9);
cell410.setCellValue("7");
Cell cell411 = row4.createCell(10);
cell411.setCellValue("8");
Cell cell412 = row4.createCell(11);
cell412.setCellValue("9");
Cell cell413 = row4.createCell(12);
cell413.setCellValue("10");
Cell cell414 = row4.createCell(13);
cell414.setCellValue("作业员");
return sheet.getLastRowNum();
}
//常规参数-工序卡3
public int generalParamThree(Sheet sheet, WorkorderTemplate template, int stepNum, int generalNum, CellStyle cellStyle){
//常规参数信息
WorkorderGeneralStepthree generalStepthree = template.getWorkorderStepList().get(stepNum).getWorkorderGeneralStepthreeList().get(generalNum);
//设置跨行跨列
sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 9));
//第一行
Row row1 = sheet.createRow(0);
//第一行第一列
Cell cell11 = row1.createCell(0);
cell11.setCellValue("中试压缩机试作工序卡3");
cell11.setCellStyle(cellStyle);
//第二行
Row row2 = sheet.createRow(1);
//第二行第n列
Cell cell21 = row2.createCell(0);
cell21.setCellValue("委托担当");
Cell cell22 = row2.createCell(1);
cell22.setCellValue(template.getResponsibler());
Cell cell23 = row2.createCell(2);
cell23.setCellValue("指示书/流程编号:");
Cell cell24 = row2.createCell(3);
cell24.setCellValue(template.getTaskNo());
Cell cell25 = row2.createCell(4);
cell25.setCellValue("机种名");
Cell cell26 = row2.createCell(5);
cell26.setCellValue(template.getModel());
Cell cell27 = row2.createCell(6);
cell27.setCellValue("数量");
Cell cell28 = row2.createCell(7);
cell28.setCellValue(template.getNumber());
Cell cell29 = row2.createCell(8);
cell29.setCellValue("页数");
Cell cell210 = row2.createCell(9);
cell210.setCellValue("3/4");
//第三行
Row row3 = sheet.createRow(2);
//第三行第n列
Cell cell31 = row3.createCell(0);
cell31.setCellValue("部件名");
Cell cell32 = row3.createCell(1);
cell32.setCellValue(generalStepthree.getComponent());
Cell cell33 = row3.createCell(2);
cell33.setCellValue("日期");
Cell cell34 = row3.createCell(3);
cell34.setCellValue(generalStepthree.getCurrentdate());
Cell cell35 = row3.createCell(4);
cell35.setCellValue("中试确认");
Cell cell36 = row3.createCell(5);
cell36.setCellValue(generalStepthree.getCreateBy());
Cell cell37 = row3.createCell(6);
cell37.setCellValue("品质确认");
Cell cell38 = row3.createCell(7);
cell38.setCellValue(generalStepthree.getConfirmQuality());
Cell cell39 = row3.createCell(8);
cell39.setCellValue("研发确认");
Cell cell310 = row3.createCell(9);
cell310.setCellValue(generalStepthree.getComfirmDevelop());
//第四行
Row row4 = sheet.createRow(3);
//第四行第n列
Cell cell41 = row4.createCell(0);
cell41.setCellValue("工序");
Cell cell42 = row4.createCell(1);
cell42.setCellValue("检查项目");
Cell cell43 = row4.createCell(2);
cell43.setCellValue("规格");
Cell cell44 = row4.createCell(3);
cell44.setCellValue("1");
Cell cell45 = row4.createCell(4);
cell45.setCellValue("2");
Cell cell46 = row4.createCell(5);
cell46.setCellValue("3");
Cell cell47 = row4.createCell(6);
cell47.setCellValue("4");
Cell cell48 = row4.createCell(7);
cell48.setCellValue("5");
Cell cell49 = row4.createCell(8);
cell49.setCellValue("6");
Cell cell410 = row4.createCell(9);
cell410.setCellValue("7");
Cell cell411 = row4.createCell(10);
cell411.setCellValue("8");
Cell cell412 = row4.createCell(11);
cell412.setCellValue("9");
Cell cell413 = row4.createCell(12);
cell413.setCellValue("10");
Cell cell414 = row4.createCell(13);
cell414.setCellValue("作业员");
return sheet.getLastRowNum();
}
//常规参数-工序卡4
public int generalParamFour(Sheet sheet, WorkorderTemplate template, int stepNum, int generalNum, CellStyle cellStyle){
//常规参数信息
WorkorderGeneralStepfour generalStepfour = template.getWorkorderStepList().get(stepNum).getWorkorderGeneralStepfourList().get(generalNum);
//设置跨行跨列
sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 9));
//第一行
Row row1 = sheet.createRow(0);
//第一行第一列
Cell cell11 = row1.createCell(0);
cell11.setCellValue("中试压缩机试作工序卡4(总成)");
cell11.setCellStyle(cellStyle);
//第二行
Row row2 = sheet.createRow(1);
//第二行第n列
Cell cell21 = row2.createCell(0);
cell21.setCellValue("委托担当");
Cell cell22 = row2.createCell(1);
cell22.setCellValue(template.getResponsibler());
Cell cell23 = row2.createCell(2);
cell23.setCellValue("指示书/流程编号:");
Cell cell24 = row2.createCell(3);
cell24.setCellValue(template.getTaskNo());
Cell cell25 = row2.createCell(4);
cell25.setCellValue("机种名");
Cell cell26 = row2.createCell(5);
cell26.setCellValue(template.getModel());
Cell cell27 = row2.createCell(6);
cell27.setCellValue("数量");
Cell cell28 = row2.createCell(7);
cell28.setCellValue(template.getNumber());
Cell cell29 = row2.createCell(8);
cell29.setCellValue("页数");
Cell cell210 = row2.createCell(9);
cell210.setCellValue("4/4");
//第三行
Row row3 = sheet.createRow(2);
//第三行第n列
Cell cell31 = row3.createCell(0);
cell31.setCellValue("部件名");
Cell cell32 = row3.createCell(1);
cell32.setCellValue(generalStepfour.getComponent());
Cell cell33 = row3.createCell(2);
cell33.setCellValue("日期");
Cell cell34 = row3.createCell(3);
cell34.setCellValue(generalStepfour.getCurrentdate());
Cell cell35 = row3.createCell(4);
cell35.setCellValue("中试确认");
Cell cell36 = row3.createCell(5);
cell36.setCellValue(generalStepfour.getCreateBy());
Cell cell37 = row3.createCell(6);
cell37.setCellValue("品质确认");
Cell cell38 = row3.createCell(7);
cell38.setCellValue(generalStepfour.getComfirmQuality());
Cell cell39 = row3.createCell(8);
cell39.setCellValue("研发确认");
Cell cell310 = row3.createCell(9);
cell310.setCellValue(generalStepfour.getComfirmDevelop());
//第四行
Row row4 = sheet.createRow(3);
//第四行第n列
Cell cell41 = row4.createCell(0);
cell41.setCellValue("工序");
Cell cell42 = row4.createCell(1);
cell42.setCellValue("检查项目");
Cell cell43 = row4.createCell(2);
cell43.setCellValue("规格");
Cell cell44 = row4.createCell(3);
cell44.setCellValue("1");
Cell cell45 = row4.createCell(4);
cell45.setCellValue("2");
Cell cell46 = row4.createCell(5);
cell46.setCellValue("3");
Cell cell47 = row4.createCell(6);
cell47.setCellValue("4");
Cell cell48 = row4.createCell(7);
cell48.setCellValue("5");
Cell cell49 = row4.createCell(8);
cell49.setCellValue("6");
Cell cell410 = row4.createCell(9);
cell410.setCellValue("7");
Cell cell411 = row4.createCell(10);
cell411.setCellValue("8");
Cell cell412 = row4.createCell(11);
cell412.setCellValue("9");
Cell cell413 = row4.createCell(12);
cell413.setCellValue("10");
Cell cell414 = row4.createCell(13);
cell414.setCellValue("作业员");
return sheet.getLastRowNum();
}
//工作簿
public void sheet(Workbook workbook, String templateId) {
//设置居中
CellStyle cellStyle = workbook.createCellStyle();
cellStyle.setAlignment(HorizontalAlignment.CENTER);//水平居中
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);//垂直居中
WorkorderTemplate template = getExportData(templateId);
int stepCount = template.getWorkorderStepList().size();//工序卡数量
@ -289,7 +584,37 @@ public class ExcelServiceImpl implements ExcelService {
for (int generalNum = 0; generalNum < generalOneCount; generalNum++) {
String g_stepId = template.getWorkorderStepList().get(stepNum).getWorkorderGeneralSteponeList().get(generalNum).getStepId();
if(g_stepId.equals(stepId)){
lineNum = generalParam(sheet, template, stepNum, generalNum) + 1;
lineNum = generalParamOne(sheet, template, stepNum, generalNum, cellStyle) + 1;
firstLine = lineNum;
}
}
//常规参数-工序卡2
int generalTwoCount = template.getWorkorderStepList().get(stepNum).getWorkorderGeneralSteptwoList().size();//常规参数数量
for (int generalNum = 0; generalNum < generalTwoCount; generalNum++) {
String g_stepId = template.getWorkorderStepList().get(stepNum).getWorkorderGeneralSteptwoList().get(generalNum).getStepId();
if(g_stepId.equals(stepId)){
lineNum = generalParamTwo(sheet, template, stepNum, generalNum, cellStyle) + 1;
firstLine = lineNum;
}
}
//常规参数-工序卡3
int generalThreeCount = template.getWorkorderStepList().get(stepNum).getWorkorderGeneralStepthreeList().size();//常规参数数量
for (int generalNum = 0; generalNum < generalThreeCount; generalNum++) {
String g_stepId = template.getWorkorderStepList().get(stepNum).getWorkorderGeneralStepthreeList().get(generalNum).getStepId();
if(g_stepId.equals(stepId)){
lineNum = generalParamThree(sheet, template, stepNum, generalNum, cellStyle) + 1;
firstLine = lineNum;
}
}
//常规参数-工序卡3
int generalFourCount = template.getWorkorderStepList().get(stepNum).getWorkorderGeneralStepfourList().size();//常规参数数量
for (int generalNum = 0; generalNum < generalFourCount; generalNum++) {
String g_stepId = template.getWorkorderStepList().get(stepNum).getWorkorderGeneralStepfourList().get(generalNum).getStepId();
if(g_stepId.equals(stepId)){
lineNum = generalParamFour(sheet, template, stepNum, generalNum, cellStyle) + 1;
firstLine = lineNum;
}
}


Loading…
Cancel
Save