Explorar o código

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/main/resources/templates/inboundOrderPdf.html
ezhizao_zx hai 3 semanas
pai
achega
f8251f4b29

+ 26 - 0
src/main/java/cn/ezhizao/common/utils/PdfUtil.java

@@ -91,4 +91,30 @@ public class PdfUtil {
         }
         return outputStream.toByteArray();
     }
+
+    public static byte[] html3Pdf(String content) {
+        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+        try {
+            ConverterProperties converterProperties = new ConverterProperties();
+            converterProperties.setCharset("UTF-8");
+            FontProvider fontProvider = new FontProvider();
+            PdfFont simsun = PdfFontFactory.createFont(FontProgramFactory.createFont("simsun.ttc", 1, false));
+            fontProvider.addFont(simsun.getFontProgram());
+            fontProvider.addSystemFonts();
+            converterProperties.setFontProvider(fontProvider);
+            //设置pdf纸张
+            PdfWriter writer = new PdfWriter(outputStream);
+            PdfDocument pdf = new PdfDocument(writer);
+            pdf.setTagged();
+            //设置纸张的大小,并且设置默认的pdf大小
+            PageSize pageSize = new PageSize(211f / 72 * 25.4f, 93f / 72 * 25.4f);
+//            PageSize pageSize = new PageSize(241f,140f);
+
+            pdf.setDefaultPageSize(pageSize);
+            HtmlConverter.convertToPdf(content,pdf,converterProperties);
+        } catch (Exception e) {
+            System.out.print("生成 PDF 失败,{}"+e);
+        }
+        return outputStream.toByteArray();
+    }
 }

+ 1 - 1
src/main/java/cn/ezhizao/project/business/controller/BizInboundOrderController.java

@@ -420,7 +420,7 @@ public class BizInboundOrderController extends BaseController {
         response.setContentType("application/pdf");
         String fileName = "产品入库单";
         response.setHeader("Content-Disposition", "filename=" + new String(fileName.getBytes()));
-        byte[] resources = PdfUtil.html2Pdf(templateContent);
+        byte[] resources = PdfUtil.html3Pdf(templateContent);
         ServletOutputStream outputStream = response.getOutputStream();
         outputStream.write(resources);
         outputStream.close();

+ 2 - 0
src/main/java/cn/ezhizao/project/business/domain/BizDaywork.java

@@ -350,6 +350,8 @@ public class BizDaywork extends BaseEntity {
     private Date submitTime;
     @TableField(exist = false)
     private BizCertificate certificate;
+    @TableField(exist = false)
+    private String specification;
 
     public BizDaywork() {}
 

+ 4 - 0
src/main/resources/mybatis/business/BizDayworkMapper.xml

@@ -799,6 +799,7 @@
         t2.production_plan_no,
         t2.line_number,
         t2.product_description as description,
+        t2.specification,
         t3.lot_code,
         t3.technology_version,
         t3.production_quantity,
@@ -849,6 +850,9 @@
             <if test="productDescription != null and productDescription != ''">
                 AND t2.product_description like concat('%',#{productDescription},'%')
             </if>
+            <if test="specification != null and specification != ''">
+                AND t2.specification  = #{specification}
+            </if>
             <if test="furnaceNumber != null  and furnaceNumber != ''">
                 AND t6.furnace_number = #{furnaceNumber}
             </if>

+ 30 - 25
src/main/resources/templates/inboundOrderPdf.html

@@ -5,12 +5,16 @@
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
     <style>
         @page {
-            margin: 15px 30px 20px 30px;
-            size: 257mm 93mm;
+            margin: 30px 20px 20px 10px;
+            size: 210mm 93mm;
         }
 
         body {
             font-family: Helvetica Neue,Helvetica,PingFang SC,Hiragino Sans GB,Microsoft YaHei,Arial,sans-serif;
+            -webkit-font-smoothing: antialiased;
+            -moz-osx-font-smoothing: grayscale;
+            color-adjust: exact;
+            -webkit-print-color-adjust: exact;
         }
 
         table {
@@ -62,6 +66,7 @@
             /* 移除默认的外边距 */
             margin: 0 ;
         }
+
     </style>
 </head>
 <#list inboundOrder.detailLists as detail>
@@ -69,55 +74,55 @@
 
 <!-- 标题行 -->
 <div class="title-row">
-    <div class="right-align1" style=" font-size: 12px ; margin-left: 5px;padding-right: 40px ">
+    <div class="right-align1" style=" font-size: 14px ; margin-left: 5px;padding-right: 40px ">
         厂别: <#if inboundOrder.tenantName??>${inboundOrder.tenantName} </#if>
     </div>
-    <div class="right-align1" style=" font-size: 12px ; margin-left: 5px;padding-right: 140px;">包装形式: ${inboundOrder.packageType} </div>
-    <div class="center-align1"  style="font-size: 14px ;padding-right: 200px; font-weight: 600;">大连德迈仕精密科技股份有限公司</div>
+    <div class="right-align1" style=" font-size: 14px ; margin-left: 5px;padding-right: 65px;">包装形式: ${inboundOrder.packageType} </div>
+    <div class="center-align1"  style="font-size: 16px ;padding-right: 90px; font-weight: 600;">大连德迈仕精密科技股份有限公司</div>
     <div class="left-align1"  style=" font-size: 14px ;font-weight: 600;">入库单号:${inboundOrder.inboundNumber}</div>
 </div>
 <!-- 标题行 -->
-<div class="title-row" style="margin-top: 5px ; font-size: 12px ;">
+<div class="title-row" style="margin-top: 3px ; font-size: 14px ;">
     <div class="right-align" style="margin-left: 5px; padding-right:5px;" >部门:${inboundOrder.deptCode} ${inboundOrder.deptName}</div>
     <div class="right-align" style="margin-left 5px; padding-right: 160px;">转运托盘码: ${inboundOrder.transferCode}</div>
     <div class="center-align" style="font-size: 15px ; padding-right: 325px; font-weight: 600;">产成品入库单</div>
     <div class="left-align" style="margin-right: 5px">第${detail_index+1}页 共 ${inboundOrder.detailLists?size}页</div>
 </div>
-<div class="title-row" style="margin-top: 5px ; font-size: 12px ;">
+<div class="title-row" style="margin-top: 3px ; font-size: 12px ;">
     <div class="right-align" style="margin-left: 5px;">客户: ${ inboundOrder.companyCode  } ${ inboundOrder.companyAlias} </div>
-    <div class="left-align" style="margin-left: 450px;">单据日期: ${inboundOrder.inboundDateStr } </div>
-    <div class="left-align" style="margin-left: 125px;">CDMS/JN-1-019</div>
+    <div class="left-align" style="margin-left: 258px;">单据日期: ${inboundOrder.inboundDateStr } </div>
+    <div class="left-align" style="margin-left: 103px;">CDMS/JH-1-019</div>
 </div>
-<div class="title-row" style="margin-top: 5px ; font-size: 10px ;">
+<div class="title-row" style="margin-top: 3px ; font-size: 12px ;">
     <div class="right-align" style="margin-left: 5px;">图号: ${ inboundOrder.drawingNo }</div>
-    <div class="center-align" style="margin-left: 120px;">规格: ${ inboundOrder.standard }</div>
-    <div class="left-align" style="margin-left: 260px;">产品编码: ${ inboundOrder.productCode }</div>
-    <div class="left-align" style="margin-left: 125px;">箱数: ${ inboundOrder.boxNumber }</div>
+    <div class="center-align" style="margin-left: 150px;">规格: ${ inboundOrder.standard }</div>
+    <div class="left-align" style="margin-left: 30px;">产品编码: ${ inboundOrder.productCode }</div>
+    <div class="left-align" style="margin-left: 30px;">箱数: ${ inboundOrder.boxNumber }</div>
 </div>
 <table>
     <!-- 第三行 -->
     <tr>
         <td style="width: 12px;">序号</td>
-        <td style="width: 76px;">批号</td>
-        <td style="width: 24px;">数量(支)</td>
-        <td style="width: 200px;">备注/客户批号/箱号等信息</td>
+        <td style="width: 60px;">批号</td>
+        <td style="width: 20px;">数量(支)</td>
+        <td style="width: 180px;">备注/客户批号/箱号等信息</td>
     </tr>
 
     <!-- 动态数据行 -->
     <#list detail as item>
     <tr>
-        <td style="width: 12px;">${ item_index + 1 }</td>
-        <td style="width: 76px;"  >
+        <td style="width: 14px;">${ item_index + 1 }</td>
+        <td style="width: 60px;"  >
             <#if item.lotCode??>
                 ${ item.lotCode }
             </#if>
         </td>
-        <td style="width: 24px;text-align: right;" >
+        <td style="width: 20px;text-align: right;" >
             <#if item.inboundNum??>
                 ${ item.inboundNum }
         </#if>
         </td>
-        <td style="width: 200px;" >
+        <td style="width: 180px;" >
             <#if item.remark??>
                 ${ item.remark }
             <#else>
@@ -134,12 +139,12 @@
     <td>支</td>
 </tr>
 </table>
-<div class="title-row"  style="margin-bottom: 5px;font-size: 10px ;">
+<div class="title-row"  style="margin-bottom: 5px;font-size: 12px ;">
     <!--    <div  style=" height: 25px"></div>-->
-    <div class="center-align"  style="margin-left: 60px;padding-right: 90px">保管员:${inboundOrder.storageNickName}</div>
-    <div class="center-align"  style="margin-left: 60px;padding-right: 120px">搬运员:</div>
-    <div class="center-align" style="margin-left: 60px;padding-right: 120px">录入员:${inboundOrder.inputNickName}</div>
-    <div class="left-align" style="margin-right: 15px">白-存根, 粉-生产, 黄-外协</div>
+    <div class="center-align"  style="margin-left: 60px;padding-right: 48px">保管员:${inboundOrder.storageNickName}</div>
+    <div class="center-align"  style="margin-left: 60px;padding-right: 78px">搬运员:</div>
+    <div class="center-align" style="margin-left: 60px;padding-right: 78px">录入员:${inboundOrder.inputNickName}</div>
+    <div class="left-align" style="margin-right: 15px">白-库房, 红-财务, 黄-存根</div>
 </div>
 </body>
 </#list>