|
|
@ -192,6 +192,229 @@ public class ExcelServiceImpl implements ExcelService { |
|
|
|
public void sheet(Workbook workbook, String templateId) { |
|
|
|
WorkorderTemplate template = getExportData(templateId); |
|
|
|
|
|
|
|
int stepCount = template.getWorkorderStepList().size();//工序卡数量 |
|
|
|
for (int stepNum = 0; stepNum < stepCount; stepNum++) { |
|
|
|
int lineNum = 0;//写入单元行 |
|
|
|
int firstLine= 0;//合并单元起始行 |
|
|
|
String stepName = template.getWorkorderStepList().get(stepNum).getName();//工序卡名称 |
|
|
|
Sheet sheet = workbook.createSheet(stepName);//创建工序卡 |
|
|
|
int processCount = template.getWorkorderStepList().get(stepNum).getWorkorderProcessList().size();//工序数量 |
|
|
|
//工序卡1 |
|
|
|
String stepId = template.getWorkorderStepList().get(stepNum).getId();//工序卡id |
|
|
|
for (int processNum = 0; processNum < processCount; processNum++) { |
|
|
|
//工序 |
|
|
|
String p_stepId = template.getWorkorderStepList().get(stepNum).getWorkorderProcessList().get(processNum).getStepId();//关联工序卡id |
|
|
|
if(p_stepId.equals(stepId)){ |
|
|
|
String processId = template.getWorkorderStepList().get(stepNum).getWorkorderProcessList().get(processNum).getId();//工序id |
|
|
|
String processName = template.getWorkorderStepList().get(stepNum).getWorkorderProcessList().get(processNum).getName();//工序名称 |
|
|
|
int itemCheckCount = template.getWorkorderStepList().get(stepNum).getWorkorderProcessList().get(processNum).getWorkorderItemCheckList().size();//检查项目数量 |
|
|
|
int lastLine = firstLine + itemCheckCount-1;//合并单元结束行 |
|
|
|
if(firstLine != lastLine){ |
|
|
|
sheet.addMergedRegion(new CellRangeAddress(firstLine,lastLine,0,0));//合并单元格 |
|
|
|
} |
|
|
|
for (int itemNum = 0; itemNum < itemCheckCount; itemNum++) { |
|
|
|
//检查项目 |
|
|
|
String i_processId = template.getWorkorderStepList().get(stepNum).getWorkorderProcessList().get(processNum).getWorkorderItemCheckList().get(itemNum).getProcessId();//关联工序id |
|
|
|
if(i_processId.equals(processId)){ |
|
|
|
String itemCheckId = template.getWorkorderStepList().get(stepNum).getWorkorderProcessList().get(processNum).getWorkorderItemCheckList().get(itemNum).getId();//检查项目id |
|
|
|
String itemCheckName = template.getWorkorderStepList().get(stepNum).getWorkorderProcessList().get(processNum).getWorkorderItemCheckList().get(itemNum).getName();//检查项目名称 |
|
|
|
|
|
|
|
Row row = sheet.createRow(lineNum); |
|
|
|
Cell cell1 = row.createCell(0); |
|
|
|
cell1.setCellValue(processName); |
|
|
|
Cell cell2 = row.createCell(1); |
|
|
|
cell2.setCellValue(itemCheckName); |
|
|
|
|
|
|
|
int paramOneCount = template.getWorkorderStepList().get(stepNum).getWorkorderProcessList().get(processNum).getWorkorderItemCheckList().get(itemNum).getWorkorderParamSteponeList().size(); |
|
|
|
for (int paramNum = 0; paramNum < paramOneCount; paramNum++) { |
|
|
|
String p_itemCheckId = template.getWorkorderStepList().get(stepNum).getWorkorderProcessList().get(processNum).getWorkorderItemCheckList().get(itemNum).getWorkorderParamSteponeList().get(paramNum).getProcessId();//关联检查项目id |
|
|
|
if(p_itemCheckId.equals(itemCheckId)) { |
|
|
|
|
|
|
|
//检查项目参数-工序卡1 |
|
|
|
WorkorderParamStepone paramStepone = template.getWorkorderStepList().get(stepNum).getWorkorderProcessList().get(processNum).getWorkorderItemCheckList().get(itemNum).getWorkorderParamSteponeList().get(paramNum); |
|
|
|
if (null != paramStepone) { |
|
|
|
//第n行第n列 |
|
|
|
Cell specs = row.createCell(2); |
|
|
|
specs.setCellValue(paramStepone.getSpecs()); |
|
|
|
Cell param1 = row.createCell(3); |
|
|
|
param1.setCellValue(paramStepone.getParam1()); |
|
|
|
Cell param2 = row.createCell(4); |
|
|
|
param2.setCellValue(paramStepone.getParam2()); |
|
|
|
Cell param3 = row.createCell(5); |
|
|
|
param3.setCellValue(paramStepone.getParam3()); |
|
|
|
Cell param4 = row.createCell(6); |
|
|
|
param4.setCellValue(paramStepone.getParam4()); |
|
|
|
Cell param5 = row.createCell(7); |
|
|
|
param5.setCellValue(paramStepone.getParam5()); |
|
|
|
Cell param6 = row.createCell(8); |
|
|
|
param6.setCellValue(paramStepone.getParam6()); |
|
|
|
Cell param7 = row.createCell(9); |
|
|
|
param7.setCellValue(paramStepone.getParam7()); |
|
|
|
Cell param8 = row.createCell(10); |
|
|
|
param8.setCellValue(paramStepone.getParam8()); |
|
|
|
Cell param9 = row.createCell(11); |
|
|
|
param9.setCellValue(paramStepone.getParam9()); |
|
|
|
Cell param10 = row.createCell(12); |
|
|
|
param10.setCellValue(paramStepone.getParam10()); |
|
|
|
Cell param11 = row.createCell(13); |
|
|
|
param11.setCellValue(paramStepone.getParam11()); |
|
|
|
Cell param12 = row.createCell(14); |
|
|
|
param12.setCellValue(paramStepone.getParam12()); |
|
|
|
Cell param13 = row.createCell(15); |
|
|
|
param13.setCellValue(paramStepone.getParam13()); |
|
|
|
Cell param14 = row.createCell(16); |
|
|
|
param14.setCellValue(paramStepone.getParam14()); |
|
|
|
Cell param15 = row.createCell(17); |
|
|
|
param15.setCellValue(paramStepone.getParam15()); |
|
|
|
Cell param16 = row.createCell(18); |
|
|
|
param16.setCellValue(paramStepone.getParam16()); |
|
|
|
Cell param17 = row.createCell(19); |
|
|
|
param17.setCellValue(paramStepone.getParam17()); |
|
|
|
Cell param18 = row.createCell(20); |
|
|
|
param18.setCellValue(paramStepone.getParam18()); |
|
|
|
Cell param19 = row.createCell(21); |
|
|
|
param19.setCellValue(paramStepone.getParam19()); |
|
|
|
Cell param20 = row.createCell(22); |
|
|
|
param20.setCellValue(paramStepone.getParam20()); |
|
|
|
Cell remark = row.createCell(23); |
|
|
|
remark.setCellValue(paramStepone.getRemark()); |
|
|
|
} else { |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//检查项目参数-工序卡2 |
|
|
|
int paramTwoCount = template.getWorkorderStepList().get(stepNum).getWorkorderProcessList().get(processNum).getWorkorderItemCheckList().get(itemNum).getWorkorderParamSteptwoList().size(); |
|
|
|
for (int paramNum = 0; paramNum < paramTwoCount; paramNum++) { |
|
|
|
String p_itemCheckId = template.getWorkorderStepList().get(stepNum).getWorkorderProcessList().get(processNum).getWorkorderItemCheckList().get(itemNum).getWorkorderParamSteptwoList().get(paramNum).getProcessId();//关联检查项目id |
|
|
|
if(p_itemCheckId.equals(itemCheckId)){ |
|
|
|
//工序卡1 |
|
|
|
WorkorderParamSteptwo paramSteptwo = template.getWorkorderStepList().get(stepNum).getWorkorderProcessList().get(processNum).getWorkorderItemCheckList().get(itemNum).getWorkorderParamSteptwoList().get(paramNum); |
|
|
|
if (null != paramSteptwo) { |
|
|
|
//第n行第n列 |
|
|
|
Cell specs = row.createCell(2); |
|
|
|
specs.setCellValue(paramSteptwo.getSpecs()); |
|
|
|
Cell param1 = row.createCell(3); |
|
|
|
param1.setCellValue(paramSteptwo.getParam1()); |
|
|
|
Cell param2 = row.createCell(4); |
|
|
|
param2.setCellValue(paramSteptwo.getParam2()); |
|
|
|
Cell param3 = row.createCell(5); |
|
|
|
param3.setCellValue(paramSteptwo.getParam3()); |
|
|
|
Cell param4 = row.createCell(6); |
|
|
|
param4.setCellValue(paramSteptwo.getParam4()); |
|
|
|
Cell param5 = row.createCell(7); |
|
|
|
param5.setCellValue(paramSteptwo.getParam5()); |
|
|
|
Cell param6 = row.createCell(8); |
|
|
|
param6.setCellValue(paramSteptwo.getParam6()); |
|
|
|
Cell param7 = row.createCell(9); |
|
|
|
param7.setCellValue(paramSteptwo.getParam7()); |
|
|
|
Cell param8 = row.createCell(10); |
|
|
|
param8.setCellValue(paramSteptwo.getParam8()); |
|
|
|
Cell param9 = row.createCell(11); |
|
|
|
param9.setCellValue(paramSteptwo.getParam9()); |
|
|
|
Cell param10 = row.createCell(12); |
|
|
|
param10.setCellValue(paramSteptwo.getParam10()); |
|
|
|
Cell operator = row.createCell(23); |
|
|
|
operator.setCellValue(paramSteptwo.getOperator()); |
|
|
|
} else { |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//检查项目参数-工序卡3 |
|
|
|
int paramThreeCount = template.getWorkorderStepList().get(stepNum).getWorkorderProcessList().get(processNum).getWorkorderItemCheckList().get(itemNum).getWorkorderParamStepthreeList().size(); |
|
|
|
for (int paramNum = 0; paramNum < paramThreeCount; paramNum++) { |
|
|
|
String p_itemCheckId = template.getWorkorderStepList().get(stepNum).getWorkorderProcessList().get(processNum).getWorkorderItemCheckList().get(itemNum).getWorkorderParamStepthreeList().get(paramNum).getProcessId();//关联检查项目id |
|
|
|
if(p_itemCheckId.equals(itemCheckId)){ |
|
|
|
//工序卡1 |
|
|
|
WorkorderParamStepthree paramStepthree = template.getWorkorderStepList().get(stepNum).getWorkorderProcessList().get(processNum).getWorkorderItemCheckList().get(itemNum).getWorkorderParamStepthreeList().get(paramNum); |
|
|
|
if (null != paramStepthree) { |
|
|
|
//第n行第n列 |
|
|
|
Cell specs = row.createCell(2); |
|
|
|
specs.setCellValue(paramStepthree.getSpecs()); |
|
|
|
Cell param1 = row.createCell(3); |
|
|
|
param1.setCellValue(paramStepthree.getParam1()); |
|
|
|
Cell param2 = row.createCell(4); |
|
|
|
param2.setCellValue(paramStepthree.getParam2()); |
|
|
|
Cell param3 = row.createCell(5); |
|
|
|
param3.setCellValue(paramStepthree.getParam3()); |
|
|
|
Cell param4 = row.createCell(6); |
|
|
|
param4.setCellValue(paramStepthree.getParam4()); |
|
|
|
Cell param5 = row.createCell(7); |
|
|
|
param5.setCellValue(paramStepthree.getParam5()); |
|
|
|
Cell param6 = row.createCell(8); |
|
|
|
param6.setCellValue(paramStepthree.getParam6()); |
|
|
|
Cell param7 = row.createCell(9); |
|
|
|
param7.setCellValue(paramStepthree.getParam7()); |
|
|
|
Cell param8 = row.createCell(10); |
|
|
|
param8.setCellValue(paramStepthree.getParam8()); |
|
|
|
Cell param9 = row.createCell(11); |
|
|
|
param9.setCellValue(paramStepthree.getParam9()); |
|
|
|
Cell param10 = row.createCell(12); |
|
|
|
param10.setCellValue(paramStepthree.getParam10()); |
|
|
|
Cell operator = row.createCell(23); |
|
|
|
operator.setCellValue(paramStepthree.getOperator()); |
|
|
|
} else { |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//检查项目参数-工序卡4 |
|
|
|
int paramFourCount = template.getWorkorderStepList().get(stepNum).getWorkorderProcessList().get(processNum).getWorkorderItemCheckList().get(itemNum).getWorkorderParamStepfourList().size(); |
|
|
|
for (int paramNum = 0; paramNum < paramFourCount; paramNum++) { |
|
|
|
String p_itemCheckId = template.getWorkorderStepList().get(stepNum).getWorkorderProcessList().get(processNum).getWorkorderItemCheckList().get(itemNum).getWorkorderParamStepfourList().get(paramNum).getProcessId();//关联检查项目id |
|
|
|
if(p_itemCheckId.equals(itemCheckId)){ |
|
|
|
//工序卡1 |
|
|
|
WorkorderParamStepfour paramStepfour = template.getWorkorderStepList().get(stepNum).getWorkorderProcessList().get(processNum).getWorkorderItemCheckList().get(itemNum).getWorkorderParamStepfourList().get(paramNum); |
|
|
|
if (null != paramStepfour) { |
|
|
|
//第n行第n列 |
|
|
|
Cell specs = row.createCell(2); |
|
|
|
specs.setCellValue(paramStepfour.getSpecs()); |
|
|
|
Cell param1 = row.createCell(3); |
|
|
|
param1.setCellValue(paramStepfour.getParam1()); |
|
|
|
Cell param2 = row.createCell(4); |
|
|
|
param2.setCellValue(paramStepfour.getParam2()); |
|
|
|
Cell param3 = row.createCell(5); |
|
|
|
param3.setCellValue(paramStepfour.getParam3()); |
|
|
|
Cell param4 = row.createCell(6); |
|
|
|
param4.setCellValue(paramStepfour.getParam4()); |
|
|
|
Cell param5 = row.createCell(7); |
|
|
|
param5.setCellValue(paramStepfour.getParam5()); |
|
|
|
Cell param6 = row.createCell(8); |
|
|
|
param6.setCellValue(paramStepfour.getParam6()); |
|
|
|
Cell param7 = row.createCell(9); |
|
|
|
param7.setCellValue(paramStepfour.getParam7()); |
|
|
|
Cell param8 = row.createCell(10); |
|
|
|
param8.setCellValue(paramStepfour.getParam8()); |
|
|
|
Cell param9 = row.createCell(11); |
|
|
|
param9.setCellValue(paramStepfour.getParam9()); |
|
|
|
Cell param10 = row.createCell(12); |
|
|
|
param10.setCellValue(paramStepfour.getParam10()); |
|
|
|
Cell operator = row.createCell(23); |
|
|
|
operator.setCellValue(paramStepfour.getOperator()); |
|
|
|
} else { |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
lineNum++;//行数增加 |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
firstLine = lastLine+1;//改变下一个起始行位置 |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//工作簿 |
|
|
|
public void sheetTest(Workbook workbook, String templateId) { |
|
|
|
WorkorderTemplate template = getExportData(templateId); |
|
|
|
|
|
|
|
int stepCount = template.getWorkorderStepList().size();//工序卡数量 |
|
|
|
for (int stepNum = 0; stepNum < stepCount; stepNum++) { |
|
|
|
int lineNum = 0;//写入单元行 |
|
|
|