From 5c70aeef9009aff8a507a7db681be7a9273aec50 Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期四, 23 四月 2026 17:03:04 +0800
Subject: [PATCH] 导出销售台账送货单
---
src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java | 39 +++++++++++++++++++++++++--------------
1 files changed, 25 insertions(+), 14 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 9918fb8..125c7a6 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
+++ b/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("鍚堣");
@@ -486,7 +497,7 @@
if (date == null) {
return null;
}
- return date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
+ return date.format(DateTimeFormatter.ofPattern("yyyy/MM/dd"));
}
@Override
--
Gitblit v1.9.3