11-18-初版

This commit is contained in:
2025-11-18 02:29:54 +08:00
parent f372f22934
commit dfaadd4977
2 changed files with 502 additions and 677 deletions

View File

@ -387,7 +387,7 @@ public class BusTestServiceImpl {
}
/**
* 施工进度统计表第11-18行- 修正J,K列逐行合并
* 施工进度统计表第11-18行- 修正数据赋值问题
*/
private static void createConstructionProgressTable(Sheet sheet, Workbook workbook, int startRow,
CellStyle headerStyle, CellStyle contentStyle,
@ -429,7 +429,7 @@ public class BusTestServiceImpl {
l11Cell.setCellValue("备注");
l11Cell.setCellStyle(tableHeaderStyle);
// 数据行第12-18行共7行- 修正数据位置
// 数据行第12-18行共7行- 修正数据位置和赋值
String[][] progressData = {
{"基础", "光伏区", "", "164728", "3955", "104434", "63.4%", "6000", "设计值为根据7.18日最新电子版图纸统计包含未开工的五工区总设计容量约为357.5Mpw。"},
{"支架", "", "", "20591", "644", "6412", "31.1%", "1050", ""},
@ -446,17 +446,29 @@ public class BusTestServiceImpl {
// A列和B列不设置内容在合并区域中
// 从C列开始设置数据
for (int j = 0; j < progressData[i].length; j++) {
// 从C列开始设置数据C-I列
for (int j = 0; j < 7; j++) { // 只设置前7列数据C-I列
Cell cell = row.createCell(j + 2); // C列开始
cell.setCellValue(progressData[i][j]);
if (j < progressData[i].length) {
cell.setCellValue(progressData[i][j]);
}
cell.setCellStyle(contentStyle);
}
// 每行的J,K列单独合并
// 设置J,K列(下周计划完成)- 使用数据数组的第8个元素
Cell jkCell = row.createCell(9); // J列
if (progressData[i].length > 7) {
jkCell.setCellValue(progressData[i][7]); // 第8个元素是下周计划完成数据
}
jkCell.setCellStyle(contentStyle);
addMergedRegionSafe(sheet, startRow + 1 + i, startRow + 1 + i, 9, 10);
// 设置L列备注- 使用数据数组的第9个元素
Cell lCell = row.createCell(11); // L列
if (progressData[i].length > 8) {
lCell.setCellValue(progressData[i][8]); // 第9个元素是备注数据
}
lCell.setCellStyle(contentStyle);
}
// 设置合并区域
@ -471,14 +483,13 @@ public class BusTestServiceImpl {
sheet.addMergedRegion(new CellRangeAddress(startRow + 5, startRow + 7, 3, 3));
// L12:L18合并备注
sheet.addMergedRegion(new CellRangeAddress(startRow + 1, startRow + 7, 11, 11));
// 注意移除了J12:K18的整体合并改为逐行合并
} catch (IllegalStateException e) {
System.err.println("施工进度表合并区域设置失败: " + e.getMessage());
}
}
/**
* 设备材料表格第19-23行- 修正J,K列逐行合并
* 设备材料表格第19-23行- 修正数据赋值问题
*/
private static void createEquipmentMaterialTable(Sheet sheet, Workbook workbook, int startRow,
CellStyle headerStyle, CellStyle contentStyle,
@ -520,7 +531,7 @@ public class BusTestServiceImpl {
l19Cell.setCellValue("备注");
l19Cell.setCellStyle(tableHeaderStyle);
// 数据行 - 从第20行开始共4行数据- 修正数据位置
// 数据行 - 从第20行开始共4行数据- 修正数据位置和赋值
String[][] materialData = {
{"檩条、斜撑", "", "", "131728", "3752", "106745", "81.0%", "", ""},
{"立杆", "", "", "133841", "5549", "53372", "39.9%", "", ""},
@ -534,17 +545,29 @@ public class BusTestServiceImpl {
// A列和B列不设置内容在合并区域中
// 从C列开始设置数据
for (int j = 0; j < materialData[i].length; j++) {
// 从C列开始设置数据C-I列
for (int j = 0; j < 7; j++) { // 只设置前7列数据C-I列
Cell cell = row.createCell(j + 2); // C列开始
cell.setCellValue(materialData[i][j]);
if (j < materialData[i].length) {
cell.setCellValue(materialData[i][j]);
}
cell.setCellStyle(contentStyle);
}
// 每行的J,K列单独合并
// 设置J,K列(计划到货日期)- 使用数据数组的第8个元素
Cell jkCell = row.createCell(9); // J列
if (materialData[i].length > 7) {
jkCell.setCellValue(materialData[i][7]); // 第8个元素是计划到货日期数据
}
jkCell.setCellStyle(contentStyle);
addMergedRegionSafe(sheet, startRow + 1 + i, startRow + 1 + i, 9, 10);
// 设置L列备注- 使用数据数组的第9个元素
Cell lCell = row.createCell(11); // L列
if (materialData[i].length > 8) {
lCell.setCellValue(materialData[i][8]); // 第9个元素是备注数据
}
lCell.setCellStyle(contentStyle);
}
// 设置合并区域
@ -555,7 +578,6 @@ public class BusTestServiceImpl {
sheet.addMergedRegion(new CellRangeAddress(startRow, startRow + 4, 1, 1));
// L20:L23合并备注
sheet.addMergedRegion(new CellRangeAddress(startRow + 1, startRow + 4, 11, 11));
// 注意移除了J20:K23的整体合并改为逐行合并
} catch (IllegalStateException e) {
System.err.println("设备材料表合并区域设置失败: " + e.getMessage());
}