huminmin
2026-04-23 5c70aeef9009aff8a507a7db681be7a9273aec50
导出销售台账送货单
已修改1个文件
37 ■■■■■ 文件已修改
src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
@@ -245,13 +245,22 @@
            for (SalesLedger ledger : ledgerList) {
                XSSFSheet sheet = workbook.createSheet(ledger.getSalesContractNo());
                sheet.setColumnWidth(0, 1310);  // 4.56 → 精准显示
                sheet.setColumnWidth(1, 4000);  // 15.06 → 精准显示
                sheet.setColumnWidth(2, 8980);  // 34.43 → 精准显示
                sheet.setColumnWidth(3, 1820);  // 6.56 → 精准显示
                sheet.setColumnWidth(4, 2880);  // 10.68 → 精准显示
                sheet.setColumnWidth(5, 5090);  // 19.31 → 精准显示
                sheet.setColumnWidth(6, 1410);  // 4.97 → 精准显示
                // 设置页边距(单位:英寸,1英寸=2.54厘米)
                sheet.getPrintSetup().setLandscape(false); // 纵向打印
                sheet.setMargin(Sheet.TopMargin, 0.54 / 2.54);     // 上页边距:0.54厘米
                sheet.setMargin(Sheet.BottomMargin, 0.54 / 2.54);  // 下页边距:0.54厘米
                sheet.setMargin(Sheet.LeftMargin, 0.41 / 2.54);   // 左页边距:0.41厘米
                sheet.setMargin(Sheet.RightMargin, 0.41 / 2.54);  // 右页边距:0.41厘米
                sheet.setMargin(Sheet.HeaderMargin, 0.77 / 2.54); // 页眉:0.77厘米
                sheet.setMargin(Sheet.FooterMargin, 0.27 / 2.54); // 页脚:0.27厘米
                sheet.setColumnWidth(0, 1310);
                sheet.setColumnWidth(1, 4000);
                sheet.setColumnWidth(2, 8980);
                sheet.setColumnWidth(3, 1820);
                sheet.setColumnWidth(4, 2880);
                sheet.setColumnWidth(5, 5090);
                sheet.setColumnWidth(6, 1410);
                CellStyle companyTitle = createBaseStyle(workbook, "宋体", (short) 20, true, true);
                CellStyle billTitle = createBaseStyle(workbook, "宋体", (short) 18, false, true);
@@ -303,11 +312,13 @@
                Row row7 = sheet.createRow(7);
                row7.createCell(0).setCellValue("地址:湖南省耒阳市创新创业园A1栋");
                Row row8 = sheet.createRow(8);
                row8.createCell(0).setCellValue("货物详细信息:");
                row8.setHeightInPoints((short) 3); // 行高3磅
                Row row9 = sheet.createRow(9);
                row9.createCell(0).setCellValue("货物详细信息:");
                int tableStart = 9;
                int tableStart = 10;
                Row headerRow = sheet.createRow(tableStart);
                headerRow.setHeightInPoints((short)22);
                headerRow.setHeightInPoints((short)18);
                String[] headers = {"序号", "物料编号", "品名/规格", "单位", "数量", "订单号", "共四联"};
                for (int i = 0; i < headers.length; i++) {
@@ -337,7 +348,7 @@
                for (int i = 0; i < productList.size(); i++) {
                    SalesLedgerProduct p = productList.get(i);
                    Row dataRow = sheet.createRow(currentRow++);
                    dataRow.setHeightInPoints((short)22);
                    dataRow.setHeightInPoints((short)18);
                    String materialCode = "";
                    if (p.getProductModelId() != null) {
@@ -373,7 +384,7 @@
                for (int i = 0; i < needEmpty; i++) {
                    int seq = productList.size() + i;
                    Row dataRow = sheet.createRow(currentRow++);
                    dataRow.setHeightInPoints((short)22);
                    dataRow.setHeightInPoints((short)18);
                    for (int c = 0; c <= 5; c++) dataRow.createCell(c).setCellStyle(dataCenterStyle);
@@ -392,7 +403,7 @@
                // 合计
                Row totalRow = sheet.createRow(currentRow);
                totalRow.setHeightInPoints((short)22);
                totalRow.setHeightInPoints((short)18);
                // 合计放在第二列,不合并单元格
                totalRow.createCell(1).setCellValue("合计");