From 833a285ef00a84fc1a88464eb3d7d1934cf71ff6 Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期四, 23 四月 2026 14:45:27 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_衡阳_鹏创电子' into dev_衡阳_鹏创电子

---
 src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java |   39 +++++++++++++++++++++------------------
 1 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
index e5bd365..6ebc49c 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
@@ -251,14 +251,22 @@
                 sheet.setColumnWidth(3, 2500);
                 sheet.setColumnWidth(4, 3000);
                 sheet.setColumnWidth(5, 4500);
-                sheet.setColumnWidth(6, 3500);
+                sheet.setColumnWidth(6, 2000);
 
                 CellStyle companyTitle = createBaseStyle(workbook, "瀹嬩綋", (short) 20, true, true);
                 CellStyle billTitle = createBaseStyle(workbook, "瀹嬩綋", (short) 18, true, true);
                 CellStyle headerStyle = createBorderStyle(workbook, "瀹嬩綋", (short) 12, true, true);
                 CellStyle dataCenterStyle = createBorderStyle(workbook, "瀹嬩綋", (short) 11, false, true);
-                CellStyle noBorder = createNoBorderStyle(workbook);
+
+                // 鏍峰紡1锛氬甫铏氱嚎 + 灞呬腑
                 CellStyle dashStyle = createDashBottomStyle(workbook);
+                dashStyle.setAlignment(HorizontalAlignment.CENTER);
+                dashStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+
+                // 鏍峰紡2锛氭棤杈规 + 灞呬腑锛堢粰浠撳簱鐢級
+                CellStyle centerNoBorder = createNoBorderStyle(workbook);
+                centerNoBorder.setAlignment(HorizontalAlignment.CENTER);
+                centerNoBorder.setVerticalAlignment(VerticalAlignment.CENTER);
 
                 // 鏍囬
                 Row row0 = sheet.createRow(0);
@@ -292,7 +300,6 @@
                 Row row7 = sheet.createRow(7);
                 row7.createCell(0).setCellValue("璐х墿璇︾粏淇℃伅锛�");
 
-                // 琛ㄥご锛氬叡鍥涜仈 + 铏氱嚎
                 int tableStart = 8;
                 Row headerRow = sheet.createRow(tableStart);
                 String[] headers = {"搴忓彿", "鐗╂枡缂栧彿", "鍝佸悕/瑙勬牸", "鍗曚綅", "鏁伴噺", "璁㈠崟鍙�", "鍏卞洓鑱�"};
@@ -306,22 +313,20 @@
                     }
                 }
 
-                // 鏌ヨ褰撳墠鍗曟嵁鎵�鏈変骇鍝�
+                // 鏌ヨ浜у搧
                 SalesLedgerProduct cond = new SalesLedgerProduct();
                 cond.setSalesLedgerId(ledger.getId());
                 List<SalesLedgerProduct> productList = salesLedgerProductServiceImpl.selectSalesLedgerProductList(cond);
 
                 BigDecimal totalQuantity = BigDecimal.ZERO;
                 for (SalesLedgerProduct p : productList) {
-                    if (p.getQuantity() != null) {
-                        totalQuantity = totalQuantity.add(p.getQuantity());
-                    }
+                    if (p.getQuantity() != null) totalQuantity = totalQuantity.add(p.getQuantity());
                 }
 
                 int currentRow = tableStart + 1;
                 String[] fourNames = {"瀛樻牴", "鍥炲崟", "瀹㈡埛", "浠撳簱"};
 
-                // ===================== 1. 鍏堟覆鏌撴墍鏈変骇鍝� =====================
+                // 1. 鎵�鏈変骇鍝�
                 for (int i = 0; i < productList.size(); i++) {
                     SalesLedgerProduct p = productList.get(i);
                     Row dataRow = sheet.createRow(currentRow++);
@@ -347,23 +352,21 @@
                         if (i <= 2) {
                             fourCell.setCellStyle(dashStyle);
                         } else {
-                            fourCell.setCellStyle(noBorder);
+                            fourCell.setCellStyle(centerNoBorder);
                         }
                     } else {
-                        fourCell.setCellStyle(noBorder);
+                        fourCell.setCellStyle(centerNoBorder);
                     }
                 }
 
-                // ===================== 2. 涓嶈冻6琛� 鈫� 琛ョ┖琛� =====================
+                // 2. 涓嶈冻6琛岃ˉ绌�
                 int minRow = 6;
                 int needEmpty = Math.max(0, minRow - productList.size());
                 for (int i = 0; i < needEmpty; i++) {
                     int seq = productList.size() + i;
                     Row dataRow = sheet.createRow(currentRow++);
 
-                    for (int c = 0; c <= 5; c++) {
-                        dataRow.createCell(c).setCellStyle(dataCenterStyle);
-                    }
+                    for (int c = 0; c <= 5; c++) dataRow.createCell(c).setCellStyle(dataCenterStyle);
 
                     Cell fourCell = dataRow.createCell(6);
                     if (seq < fourNames.length) {
@@ -371,20 +374,20 @@
                         if (seq <= 2) {
                             fourCell.setCellStyle(dashStyle);
                         } else {
-                            fourCell.setCellStyle(noBorder);
+                            fourCell.setCellStyle(centerNoBorder);
                         }
                     } else {
-                        fourCell.setCellStyle(noBorder);
+                        fourCell.setCellStyle(centerNoBorder);
                     }
                 }
 
-                // 鍚堣琛�
+                // 鍚堣
                 Row totalRow = sheet.createRow(currentRow);
                 sheet.addMergedRegion(new CellRangeAddress(currentRow, currentRow, 0, 3));
                 totalRow.createCell(0).setCellValue("鍚堣");
                 totalRow.createCell(4).setCellValue(totalQuantity.doubleValue());
                 fillMergeRange(sheet, currentRow, currentRow, 0, 5, dataCenterStyle);
-                totalRow.createCell(6).setCellStyle(noBorder);
+                totalRow.createCell(6).setCellStyle(centerNoBorder);
 
                 // 澶囨敞
                 currentRow++;

--
Gitblit v1.9.3