Browse Source

优化一二线pdf格式

wenjinbiao 8 months ago
parent
commit
6c2698fe26

+ 2 - 1
snowy-common/src/main/java/vip/xiaonuo/common/util/CommonPdfUtil.java

@@ -65,7 +65,8 @@ public class CommonPdfUtil {
     public static PdfPCell createCenterPdfPCell(String text, int rowSpan, int colSpan, Font font) {
         PdfPCell cell = new PdfPCell(new Paragraph(text, font));
         cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
-        cell.setHorizontalAlignment(Element.ALIGN_LEFT);
+        //默认文字居中显示
+        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
         cell.setFixedHeight(fixedHeight);
         cell.setRowspan(rowSpan);
         cell.setColspan(colSpan);

+ 5 - 0
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/qyfrontlinewarehouse/service/impl/QyFrontlineWarehouseServiceImpl.java

@@ -204,6 +204,8 @@ public class QyFrontlineWarehouseServiceImpl extends ServiceImpl<QyFrontlineWare
 
         //设置账册编号
         PdfPCell accountCodeCell = CommonPdfUtil.createCenterPdfPCell(qyFrontlineWarehouse.getAccountCode(), 1, 7, CommonPdfUtil.NORMALFONT);
+        //设置文字居右
+        accountCodeCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
         pdfPTable.addCell(accountCodeCell);
 
         //设置二级表头
@@ -243,8 +245,11 @@ public class QyFrontlineWarehouseServiceImpl extends ServiceImpl<QyFrontlineWare
             pdfPTable.addCell(remarkCell);
         }
         PdfPCell amountCell = CommonPdfUtil.createCenterPdfPCell("合计",1, 2, CommonPdfUtil.NORMALFONT);
+        amountCell.setHorizontalAlignment(Element.ALIGN_LEFT);
         PdfPCell companyNameCell = CommonPdfUtil.createCenterPdfPCell("单位: " + qyFrontlineWarehouse.getCompanyName() ,1, 3, CommonPdfUtil.NORMALFONT);
+        companyNameCell.setHorizontalAlignment(Element.ALIGN_LEFT);
         PdfPCell creatorCell = CommonPdfUtil.createCenterPdfPCell("制单人: "+qyFrontlineWarehouse.getCreator(),1, 2, CommonPdfUtil.NORMALFONT);
+        creatorCell.setHorizontalAlignment(Element.ALIGN_LEFT);
 
         pdfPTable.addCell(amountCell);
         pdfPTable.addCell(companyNameCell);

+ 6 - 1
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/qysecondlinewarehouse/service/impl/QySecondlineWarehouseServiceImpl.java

@@ -20,6 +20,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.itextpdf.text.Document;
+import com.itextpdf.text.Element;
 import com.itextpdf.text.PageSize;
 import com.itextpdf.text.Rectangle;
 import com.itextpdf.text.pdf.PdfPCell;
@@ -190,7 +191,8 @@ public class QySecondlineWarehouseServiceImpl extends ServiceImpl<QySecondlineWa
         pdfPTable.addCell(firstHead);
 
         //设置账册编号
-        PdfPCell accountCodeCell = CommonPdfUtil.createCenterPdfPCell(qySecondlineWarehouse.getAccountCode(), 1, 7, CommonPdfUtil.NORMALFONT);
+        PdfPCell accountCodeCell = CommonPdfUtil.createCenterPdfPCell("NO:"+ qySecondlineWarehouse.getAccountCode(), 1, 7, CommonPdfUtil.NORMALFONT);
+        accountCodeCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
         pdfPTable.addCell(accountCodeCell);
 
         //设置二级表头
@@ -230,8 +232,11 @@ public class QySecondlineWarehouseServiceImpl extends ServiceImpl<QySecondlineWa
             pdfPTable.addCell(remarkCell);
         }
         PdfPCell amountCell = CommonPdfUtil.createCenterPdfPCell("合计",1, 2, CommonPdfUtil.NORMALFONT);
+        amountCell.setHorizontalAlignment(Element.ALIGN_LEFT);
         PdfPCell companyNameCell = CommonPdfUtil.createCenterPdfPCell("单位: " + qySecondlineWarehouse.getCompanyName() ,1, 3, CommonPdfUtil.NORMALFONT);
+        companyNameCell.setHorizontalAlignment(Element.ALIGN_LEFT);
         PdfPCell creatorCell = CommonPdfUtil.createCenterPdfPCell("制单人: "+qySecondlineWarehouse.getCreator(),1, 2, CommonPdfUtil.NORMALFONT);
+        creatorCell.setHorizontalAlignment(Element.ALIGN_LEFT);
 
         pdfPTable.addCell(amountCell);
         pdfPTable.addCell(companyNameCell);