|
|
|
@ -3,7 +3,8 @@ package cn.estsh.i3plus.ext.mes.apiservice.utils;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.file.IMesFileService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pojo.constant.MesCommonConstant;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesWorkCellScanMonitorLog;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentLogDetail;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesProductionAssembly;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.model.report.MesTraceabilityReportDataModel;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.model.report.MesTraceabilityReportModel;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
|
|
|
|
@ -51,8 +52,21 @@ public class MesTraceabilityTemp {
|
|
|
|
|
//设备
|
|
|
|
|
Font equFont = new Font(bfChinese, 8, Font.NORMAL);
|
|
|
|
|
equFont.setColor(new BaseColor(196, 222, 249));
|
|
|
|
|
//装备配件记录
|
|
|
|
|
Font assemblyFont = new Font(bfChinese, 8, Font.NORMAL);
|
|
|
|
|
assemblyFont.setColor(BaseColor.BLACK);
|
|
|
|
|
BaseColor assemblyBackColor = new BaseColor(193, 255, 192);
|
|
|
|
|
//工艺参数
|
|
|
|
|
Font equipmentLogFont = new Font(bfChinese, 8, Font.NORMAL);
|
|
|
|
|
equipmentLogFont.setColor(BaseColor.BLACK);
|
|
|
|
|
BaseColor equipmentLogColor = new BaseColor(191, 255, 255);
|
|
|
|
|
//蓝色背景色
|
|
|
|
|
BaseColor backgroundColor = new BaseColor(84, 132, 216);
|
|
|
|
|
//加工记录背景颜色
|
|
|
|
|
BaseColor recordBackgroundColor = new BaseColor(196, 220, 255);
|
|
|
|
|
//边框
|
|
|
|
|
BaseColor boardColor = new BaseColor(169, 169, 171);
|
|
|
|
|
|
|
|
|
|
//创建临时文件
|
|
|
|
|
file.createNewFile();
|
|
|
|
|
PdfWriter.getInstance(document, new FileOutputStream(file));
|
|
|
|
@ -478,6 +492,7 @@ public class MesTraceabilityTemp {
|
|
|
|
|
equCell01.setBackgroundColor(backgroundColor);
|
|
|
|
|
equCell01.setHorizontalAlignment(Element.ALIGN_CENTER);
|
|
|
|
|
equCell01.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
|
|
|
|
equCell01.setBorderColor(BaseColor.WHITE);
|
|
|
|
|
equCell01.setPaddingBottom(3);
|
|
|
|
|
equCell01.setPaddingTop(1);
|
|
|
|
|
equCell01.setColspan(1);
|
|
|
|
@ -487,6 +502,7 @@ public class MesTraceabilityTemp {
|
|
|
|
|
equCell02.setBackgroundColor(backgroundColor);
|
|
|
|
|
equCell02.setHorizontalAlignment(Element.ALIGN_CENTER);
|
|
|
|
|
equCell02.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
|
|
|
|
equCell02.setBorderColor(BaseColor.WHITE);
|
|
|
|
|
equCell02.setPaddingBottom(3);
|
|
|
|
|
equCell02.setPaddingTop(1);
|
|
|
|
|
equCell02.setColspan(1);
|
|
|
|
@ -496,6 +512,7 @@ public class MesTraceabilityTemp {
|
|
|
|
|
equCell03.setBackgroundColor(backgroundColor);
|
|
|
|
|
equCell03.setHorizontalAlignment(Element.ALIGN_CENTER);
|
|
|
|
|
equCell03.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
|
|
|
|
equCell03.setBorderColor(BaseColor.WHITE);
|
|
|
|
|
equCell03.setPaddingBottom(3);
|
|
|
|
|
equCell03.setPaddingTop(1);
|
|
|
|
|
equCell03.setColspan(1);
|
|
|
|
@ -505,6 +522,7 @@ public class MesTraceabilityTemp {
|
|
|
|
|
equCell04.setBackgroundColor(backgroundColor);
|
|
|
|
|
equCell04.setHorizontalAlignment(Element.ALIGN_CENTER);
|
|
|
|
|
equCell04.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
|
|
|
|
equCell04.setBorderColor(BaseColor.WHITE);
|
|
|
|
|
equCell04.setPaddingBottom(3);
|
|
|
|
|
equCell04.setPaddingTop(1);
|
|
|
|
|
equCell04.setColspan(1);
|
|
|
|
@ -514,6 +532,7 @@ public class MesTraceabilityTemp {
|
|
|
|
|
equCell05.setBackgroundColor(backgroundColor);
|
|
|
|
|
equCell05.setHorizontalAlignment(Element.ALIGN_CENTER);
|
|
|
|
|
equCell05.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
|
|
|
|
equCell05.setBorderColor(BaseColor.WHITE);
|
|
|
|
|
equCell05.setPaddingBottom(3);
|
|
|
|
|
equCell05.setPaddingTop(1);
|
|
|
|
|
equCell05.setColspan(1);
|
|
|
|
@ -523,6 +542,7 @@ public class MesTraceabilityTemp {
|
|
|
|
|
equCell06.setBackgroundColor(backgroundColor);
|
|
|
|
|
equCell06.setHorizontalAlignment(Element.ALIGN_CENTER);
|
|
|
|
|
equCell06.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
|
|
|
|
equCell06.setBorderColor(BaseColor.WHITE);
|
|
|
|
|
equCell06.setPaddingBottom(3);
|
|
|
|
|
equCell06.setPaddingTop(1);
|
|
|
|
|
equCell06.setColspan(1);
|
|
|
|
@ -530,14 +550,18 @@ public class MesTraceabilityTemp {
|
|
|
|
|
|
|
|
|
|
// 构建每一列
|
|
|
|
|
PdfPCell equCell00 = new PdfPCell(new Paragraph(dataModel.getEquipmentCode(), tableValueFont));
|
|
|
|
|
equCell00.setBackgroundColor(recordBackgroundColor);
|
|
|
|
|
equCell00.setHorizontalAlignment(Element.ALIGN_LEFT);
|
|
|
|
|
equCell00.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
|
|
|
|
equCell00.setBorderColor(BaseColor.WHITE);
|
|
|
|
|
equCell00.setColspan(7);
|
|
|
|
|
equtable.addCell(equCell00);
|
|
|
|
|
|
|
|
|
|
PdfPCell equCell11 = new PdfPCell(new Paragraph(dataModel.getCraftCode(), tableValueFont));
|
|
|
|
|
equCell11.setHorizontalAlignment(Element.ALIGN_CENTER);
|
|
|
|
|
equCell11.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
|
|
|
|
equCell11.setBackgroundColor(recordBackgroundColor);
|
|
|
|
|
equCell11.setBorderColor(BaseColor.WHITE);
|
|
|
|
|
equCell11.setPaddingBottom(3);
|
|
|
|
|
equCell11.setPaddingTop(1);
|
|
|
|
|
equtable.addCell(equCell11);
|
|
|
|
@ -545,6 +569,8 @@ public class MesTraceabilityTemp {
|
|
|
|
|
PdfPCell equCell21 = new PdfPCell(new Paragraph(dataModel.getStartDateTime(), tableValueFont));
|
|
|
|
|
equCell21.setHorizontalAlignment(Element.ALIGN_CENTER);
|
|
|
|
|
equCell21.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
|
|
|
|
equCell21.setBackgroundColor(recordBackgroundColor);
|
|
|
|
|
equCell21.setBorderColor(BaseColor.WHITE);
|
|
|
|
|
equCell21.setPaddingBottom(3);
|
|
|
|
|
equCell21.setPaddingTop(1);
|
|
|
|
|
equtable.addCell(equCell21);
|
|
|
|
@ -552,6 +578,8 @@ public class MesTraceabilityTemp {
|
|
|
|
|
PdfPCell equCell31 = new PdfPCell(new Paragraph(dataModel.getCompleteDateTime(), tableValueFont));
|
|
|
|
|
equCell31.setHorizontalAlignment(Element.ALIGN_CENTER);
|
|
|
|
|
equCell31.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
|
|
|
|
equCell31.setBackgroundColor(recordBackgroundColor);
|
|
|
|
|
equCell31.setBorderColor(BaseColor.WHITE);
|
|
|
|
|
equCell31.setPaddingBottom(3);
|
|
|
|
|
equCell31.setPaddingTop(1);
|
|
|
|
|
equtable.addCell(equCell31);
|
|
|
|
@ -559,6 +587,8 @@ public class MesTraceabilityTemp {
|
|
|
|
|
PdfPCell equCell41 = new PdfPCell(new Paragraph(dataModel.getTrayNo(), tableValueFont));
|
|
|
|
|
equCell41.setHorizontalAlignment(Element.ALIGN_CENTER);
|
|
|
|
|
equCell41.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
|
|
|
|
equCell41.setBorderColor(BaseColor.WHITE);
|
|
|
|
|
equCell41.setBackgroundColor(recordBackgroundColor);
|
|
|
|
|
equCell41.setPaddingBottom(3);
|
|
|
|
|
equCell41.setPaddingTop(1);
|
|
|
|
|
equtable.addCell(equCell41);
|
|
|
|
@ -566,6 +596,8 @@ public class MesTraceabilityTemp {
|
|
|
|
|
PdfPCell equCell51 = new PdfPCell(new Paragraph(dataModel.getDurationStr(), tableValueFont));
|
|
|
|
|
equCell51.setHorizontalAlignment(Element.ALIGN_CENTER);
|
|
|
|
|
equCell51.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
|
|
|
|
equCell51.setBackgroundColor(recordBackgroundColor);
|
|
|
|
|
equCell51.setBorderColor(BaseColor.WHITE);
|
|
|
|
|
equCell51.setPaddingBottom(3);
|
|
|
|
|
equCell51.setPaddingTop(1);
|
|
|
|
|
equtable.addCell(equCell51);
|
|
|
|
@ -573,51 +605,76 @@ public class MesTraceabilityTemp {
|
|
|
|
|
PdfPCell equCell61 = new PdfPCell(new Paragraph(CommonEnumUtil.VALID == dataModel.getIsComplete() ? "OK" : "NO", tableValueFont));
|
|
|
|
|
equCell61.setHorizontalAlignment(Element.ALIGN_CENTER);
|
|
|
|
|
equCell61.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
|
|
|
|
equCell61.setBackgroundColor(recordBackgroundColor);
|
|
|
|
|
equCell61.setBorderColor(BaseColor.WHITE);
|
|
|
|
|
equCell61.setPaddingBottom(3);
|
|
|
|
|
equCell61.setPaddingTop(1);
|
|
|
|
|
equtable.addCell(equCell61);
|
|
|
|
|
int index = 0;
|
|
|
|
|
if (!CollectionUtils.isEmpty(dataModel.getMesWorkCellScanMonitorLogs())) {
|
|
|
|
|
for (MesWorkCellScanMonitorLog log : dataModel.getMesWorkCellScanMonitorLogs()) {
|
|
|
|
|
// 构建每一列
|
|
|
|
|
PdfPCell equcontentCell00 = new PdfPCell(new Paragraph("", tableValueFont));
|
|
|
|
|
equcontentCell00.setHorizontalAlignment(Element.ALIGN_LEFT);
|
|
|
|
|
equcontentCell00.setBorder(Rectangle.NO_BORDER);
|
|
|
|
|
equcontentCell00.setColspan(1);
|
|
|
|
|
equtable.addCell(equcontentCell00);
|
|
|
|
|
|
|
|
|
|
PdfPCell equcontentCell11 = new PdfPCell(new Paragraph(log.getMessage(), tableValueFont));
|
|
|
|
|
equcontentCell11.setHorizontalAlignment(Element.ALIGN_CENTER);
|
|
|
|
|
equcontentCell11.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
|
|
|
|
equcontentCell11.setPaddingBottom(3);
|
|
|
|
|
equcontentCell11.setPaddingTop(1);
|
|
|
|
|
|
|
|
|
|
if (index % 2 == 0) {
|
|
|
|
|
equcontentCell11.setBackgroundColor(new BaseColor(253, 239, 192));//黄色
|
|
|
|
|
} else {
|
|
|
|
|
equcontentCell11.setBackgroundColor(BaseColor.WHITE);//白色
|
|
|
|
|
// //设备信息
|
|
|
|
|
// PdfPCell equCell71 = new PdfPCell(new Paragraph(lz("test111111111111111111111111111111111111111"), whiteFont));
|
|
|
|
|
// equCell71.setBackgroundColor(backgroundColor);
|
|
|
|
|
// equCell71.setHorizontalAlignment(Element.ALIGN_CENTER);
|
|
|
|
|
// equCell71.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
|
|
|
|
// equCell71.setPaddingBottom(3);
|
|
|
|
|
// equCell71.setPaddingTop(1);
|
|
|
|
|
// equCell71.setColspan(7);
|
|
|
|
|
// equCell61.setBackgroundColor(recordBackgroundColor);
|
|
|
|
|
// equtable.addCell(equCell71);
|
|
|
|
|
//装配记录
|
|
|
|
|
if (!CollectionUtils.isEmpty(dataModel.getProductionAssemblyList())) {
|
|
|
|
|
for (MesProductionAssembly assembly : dataModel.getProductionAssemblyList()) {
|
|
|
|
|
PdfPCell assemblyCell1 = new PdfPCell(new Paragraph(assembly.getAssemblySn(), assemblyFont));
|
|
|
|
|
assemblyCell1.setPaddingBottom(3);
|
|
|
|
|
assemblyCell1.setPaddingTop(1);
|
|
|
|
|
assemblyCell1.setColspan(2);
|
|
|
|
|
assemblyCell1.setBackgroundColor(assemblyBackColor);
|
|
|
|
|
assemblyCell1.setBorderColor(boardColor);
|
|
|
|
|
equtable.addCell(assemblyCell1);
|
|
|
|
|
|
|
|
|
|
PdfPCell assemblyCell2 = new PdfPCell(new Paragraph(assembly.getAssemblyPartName(), assemblyFont));
|
|
|
|
|
assemblyCell2.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
|
|
|
|
assemblyCell2.setVerticalAlignment(Element.ALIGN_RIGHT);
|
|
|
|
|
assemblyCell2.setBorderColor(boardColor);
|
|
|
|
|
assemblyCell2.setPaddingBottom(3);
|
|
|
|
|
assemblyCell2.setPaddingTop(1);
|
|
|
|
|
assemblyCell2.setColspan(2);
|
|
|
|
|
assemblyCell2.setBackgroundColor(assemblyBackColor);
|
|
|
|
|
equtable.addCell(assemblyCell2);
|
|
|
|
|
|
|
|
|
|
PdfPCell assemblyCell3 = new PdfPCell(new Paragraph(assembly.getModifyDatetime(), assemblyFont));
|
|
|
|
|
assemblyCell3.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
|
|
|
|
assemblyCell3.setVerticalAlignment(Element.ALIGN_RIGHT);
|
|
|
|
|
assemblyCell3.setBorderColor(boardColor);
|
|
|
|
|
assemblyCell3.setPaddingBottom(3);
|
|
|
|
|
assemblyCell3.setPaddingTop(1);
|
|
|
|
|
assemblyCell3.setColspan(2);
|
|
|
|
|
assemblyCell3.setBackgroundColor(assemblyBackColor);
|
|
|
|
|
equtable.addCell(assemblyCell3);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//工艺参数
|
|
|
|
|
if (!CollectionUtils.isEmpty(dataModel.getMesEquipmentLogDetailList())) {
|
|
|
|
|
for (MesEquipmentLogDetail equipmentLogDetail : dataModel.getMesEquipmentLogDetailList()) {
|
|
|
|
|
|
|
|
|
|
equcontentCell11.setColspan(4);
|
|
|
|
|
PdfPCell equcontentCell11 = new PdfPCell(new Paragraph(equipmentLogDetail.getEquipVariableName(), equipmentLogFont));
|
|
|
|
|
equcontentCell11.setPaddingBottom(3);
|
|
|
|
|
equcontentCell11.setPaddingTop(1);
|
|
|
|
|
equcontentCell11.setBackgroundColor(equipmentLogColor);
|
|
|
|
|
equcontentCell11.setColspan(2);
|
|
|
|
|
equcontentCell11.setBorderColor(boardColor);
|
|
|
|
|
equtable.addCell(equcontentCell11);
|
|
|
|
|
|
|
|
|
|
PdfPCell equcontentCell21 = new PdfPCell(new Paragraph(log.getScanInfo(), tableValueFont));
|
|
|
|
|
PdfPCell equcontentCell21 = new PdfPCell(new Paragraph(equipmentLogDetail.getEquipVariableValue(), equipmentLogFont));
|
|
|
|
|
equcontentCell21.setHorizontalAlignment(Element.ALIGN_CENTER);
|
|
|
|
|
equcontentCell21.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
|
|
|
|
equcontentCell21.setBorderColor(boardColor);
|
|
|
|
|
equcontentCell21.setPaddingBottom(3);
|
|
|
|
|
equcontentCell21.setPaddingTop(1);
|
|
|
|
|
|
|
|
|
|
if (index % 2 == 0) {
|
|
|
|
|
equcontentCell21.setBackgroundColor(new BaseColor(253, 239, 192));//黄色
|
|
|
|
|
} else {
|
|
|
|
|
equcontentCell21.setBackgroundColor(BaseColor.WHITE);//白色
|
|
|
|
|
}
|
|
|
|
|
equcontentCell21.setBackgroundColor(equipmentLogColor);
|
|
|
|
|
equcontentCell21.setColspan(2);
|
|
|
|
|
equtable.addCell(equcontentCell21);
|
|
|
|
|
index++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
document.add(equtable);
|
|
|
|
|
}
|
|
|
|
|
// 关闭文档
|
|
|
|
|