huminmin
2026-04-23 1d72d19a9b7b6de6169e232fce5b026265f8375f
导出销售台账送货单
已修改1个文件
14 ■■■■ 文件已修改
src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
@@ -240,7 +240,6 @@
            response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
            response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
            // 固定使用 XSSFWorkbook
            XSSFWorkbook workbook = new XSSFWorkbook();
            for (SalesLedger ledger : ledgerList) {
@@ -254,7 +253,6 @@
                sheet.setColumnWidth(5, 4500);
                sheet.setColumnWidth(6, 3500);
                // 样式
                CellStyle companyTitle = createBaseStyle(workbook, "宋体", (short) 20, true, true);
                CellStyle billTitle = createBaseStyle(workbook, "宋体", (short) 18, true, true);
                CellStyle headerStyle = createBorderStyle(workbook, "宋体", (short) 12, true, true);
@@ -294,14 +292,17 @@
                Row row7 = sheet.createRow(7);
                row7.createCell(0).setCellValue("货物详细信息:");
                // 表头
                int tableStart = 8;
                Row headerRow = sheet.createRow(tableStart);
                String[] headers = {"序号", "物料编号", "品名/规格", "单位", "数量", "订单号", "共四联"};
                for (int i = 0; i < headers.length; i++) {
                    Cell hc = headerRow.createCell(i);
                    hc.setCellValue(headers[i]);
                    hc.setCellStyle(i == 6 ? noBorder : headerStyle);
                    if (i == 6) {
                        hc.setCellStyle(dashStyle);
                    } else {
                        hc.setCellStyle(headerStyle);
                    }
                }
                // 查询商品
@@ -319,12 +320,11 @@
                int minDataRow = 5;
                int totalNeedRow = Math.max(minDataRow, fourNames.length);
                // 数据行 + 固定四联行
                for (int i = 0; i < totalNeedRow; i++) {
                    SalesLedgerProduct p = i < productList.size() ? productList.get(i) : null;
                    Row dataRow = sheet.createRow(currentRow);
                    // 前6列赋值
                    // 前6列
                    if (p != null) {
                        String materialCode = "";
                        if (p.getProductModelId() != null) {
@@ -350,7 +350,7 @@
                        dataRow.getCell(c).setCellStyle(dataCenterStyle);
                    }
                    // 共四联列
                    // 第7列:共四联区域
                    Cell fourCell = dataRow.createCell(6);
                    if (i < fourNames.length) {
                        fourCell.setCellValue(fourNames[i]);