| | |
| | | |
| | | import java.io.IOException; |
| | | import java.io.OutputStream; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import com.itextpdf.text.*; |
| | | import com.itextpdf.text.pdf.*; |
| | |
| | | private static final String CHECKED_BOX = "☑"; |
| | | static Chunk square = new Chunk("o", new Font(Font.FontFamily.ZAPFDINGBATS, 12)); // 空方框 |
| | | static Chunk check = new Chunk("4", new Font(Font.FontFamily.ZAPFDINGBATS, 12)); // 带勾方框 |
| | | |
| | | //static SimpleDateFormat |
| | | BaseFont getBaseFont() throws DocumentException, IOException { |
| | | return BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED); |
| | | } |
| | |
| | | String personName = record.getUserNickname(); |
| | | Chunk block1 = square; |
| | | Chunk block2 = square; |
| | | Date programDate = null; |
| | | Date checkDate = null; |
| | | if(StringUtils.equals(record.getTaskDefinitionId(),"programmingTask")){ |
| | | block1 = check; |
| | | programDate = record.getCreateTime(); |
| | | }else if(StringUtils.equals(record.getTaskDefinitionId(),"check")){ |
| | | block2 = check; |
| | | checkDate = record.getCreateTime(); |
| | | } |
| | | Phrase p = new Phrase(" "+personName+" ",underLineFt); |
| | | |
| | |
| | | table.addCell(getCell("批准/日期",ft)); |
| | | |
| | | PdfPCell cell2 = new PdfPCell(); |
| | | cell2.addElement(new Phrase(" ",ft)); |
| | | cell2.setColspan(2); |
| | | cell2.addElement(new Phrase(ncProgram.getCode(),ft));//数控程序编号 |
| | | table.addCell(cell2); |
| | | table.addCell(getCell(" ",ft)); |
| | | table.addCell(getCell(" ",ft)); |
| | | |
| | | String pDateStr = " "; |
| | | if(programDate!=null){ |
| | | pDateStr = DateUtil.format(programDate,"yyyy-MM-dd"); |
| | | } |
| | | String checkDateStr = " "; |
| | | if(checkDate!=null){ |
| | | checkDateStr = DateUtil.format(programDate,"yyyy-MM-dd"); |
| | | } |
| | | table.addCell(getCell(pDateStr,ft));//编制日期 |
| | | table.addCell(getCell(checkDateStr,ft)); |
| | | table.addCell(getCell(" ",ft)); |
| | | |
| | | // 设置表格宽度占页面宽度的100% |