|
|
@@ -921,6 +921,7 @@ public class ExcelUtil {
|
|
|
List<WorkstationData> workstations = dateData.getWorkstations();
|
|
|
|
|
|
int dateStartRow = currentRow; // 记录当前日期开始的行号
|
|
|
+ int workstationStartRow = dateStartRow;//记录当前日期开始的行号,作为第一个worK
|
|
|
|
|
|
for (WorkstationData workstation : workstations) {
|
|
|
Row dataRow = sheet.createRow(currentRow++);
|
|
|
@@ -961,7 +962,12 @@ public class ExcelUtil {
|
|
|
// 人员
|
|
|
Cell employeesCell = dataRow.createCell(6);
|
|
|
employeesCell.setCellStyle(cellStyle);
|
|
|
- employeesCell.setCellValue(workstation.getEmployees());
|
|
|
+ String employees = "";
|
|
|
+ employees = workstation.getEmployees();
|
|
|
+ if (employees.length() > 1) {
|
|
|
+ employees = employees.substring(1, employees.length() - 1);
|
|
|
+ }
|
|
|
+ employeesCell.setCellValue(employees);
|
|
|
|
|
|
// 任务安排
|
|
|
Cell taskCell = dataRow.createCell(7);
|
|
|
@@ -976,9 +982,38 @@ public class ExcelUtil {
|
|
|
// 备注
|
|
|
Cell remarksCell = dataRow.createCell(9);
|
|
|
remarksCell.setCellStyle(cellStyle);
|
|
|
- remarksCell.setCellValue("");
|
|
|
+ if(workstation.getWorkstationName().equals("搅拌摩擦焊工位")){
|
|
|
+ remarksCell.setCellValue("不在高新厂区用餐");
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ remarksCell.setCellValue("");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ List<Integer> countList = new ArrayList<>();
|
|
|
+ if (workstations != null && !workstations.isEmpty()) {
|
|
|
+ String currentWorkName = workstations.get(0).getWorkstationName();
|
|
|
+ int currentCount = 1;
|
|
|
+
|
|
|
+ // 从第二个元素开始遍历(索引从1开始)
|
|
|
+ for (int i = 1; i < workstations.size(); i++) {
|
|
|
+ WorkstationData currentData = workstations.get(i);
|
|
|
+ String workName = currentData.getWorkstationName();
|
|
|
+
|
|
|
+ // 如果当前元素的workId和基准workId相同,计数+1
|
|
|
+ if (currentWorkName.equals(workName)) {
|
|
|
+ currentCount++;
|
|
|
+ } else {
|
|
|
+ // 不同则将当前计数存入结果列表,更新基准workId和计数
|
|
|
+ countList.add(currentCount);
|
|
|
+ currentWorkName = workName;
|
|
|
+ currentCount = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 遍历结束后,将最后一个workId的计数存入结果列表(容易遗漏)
|
|
|
+ countList.add(currentCount);
|
|
|
}
|
|
|
-
|
|
|
// 添加合计行
|
|
|
if (!workstations.isEmpty()) {
|
|
|
Row totalRow = sheet.createRow(currentRow++);
|
|
|
@@ -1023,6 +1058,12 @@ public class ExcelUtil {
|
|
|
if (dateEndRow > dateStartRow) {
|
|
|
dateMergeRanges.add(new CellRangeAddress(dateStartRow, dateEndRow, 0, 0));
|
|
|
}
|
|
|
+ for(Integer length :countList) {
|
|
|
+ if (length > 1){
|
|
|
+ dateMergeRanges.add(new CellRangeAddress(workstationStartRow, workstationStartRow + length - 1, 1, 1));
|
|
|
+ }
|
|
|
+ workstationStartRow += length;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 执行日期列的单元格合并
|