From 39575abf1ae08e0e041b3fc081875afcebc05a84 Mon Sep 17 00:00:00 2001 From: zhaoxiaolin Date: Tue, 1 Apr 2025 11:04:49 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BD=E5=9D=AF=E6=8E=92=E5=88=97=E5=9B=BE?= =?UTF-8?q?=E3=80=81=E7=99=BD=E5=9D=AF=E6=80=A7=E8=83=BD=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/core/utils/poi/ExcelMapUtil.java | 55 ++++ .../op/mes/mapper/MesReportWorkMapper.java | 1 + .../impl/MesReportWorkServiceImpl.java | 8 +- .../mapper/mes/MesReportWorkMapper.xml | 19 +- .../controller/QcStaticTableController.java | 193 +++++++++++ .../com/op/quality/domain/QcStaticTable.java | 9 + .../quality/mapper/QcStaticTableMapper.java | 10 + .../service/IQcStaticTableService.java | 7 + .../impl/QcStaticTableServiceImpl.java | 303 ++++++++++++++++++ .../mapper/quality/QcProCheckMapper.xml | 4 - .../mapper/quality/QcStaticTableMapper.xml | 112 +++++++ 11 files changed, 708 insertions(+), 13 deletions(-) diff --git a/op-common/op-common-core/src/main/java/com/op/common/core/utils/poi/ExcelMapUtil.java b/op-common/op-common-core/src/main/java/com/op/common/core/utils/poi/ExcelMapUtil.java index a22e6414f..df2e75d7b 100644 --- a/op-common/op-common-core/src/main/java/com/op/common/core/utils/poi/ExcelMapUtil.java +++ b/op-common/op-common-core/src/main/java/com/op/common/core/utils/poi/ExcelMapUtil.java @@ -98,6 +98,53 @@ public class ExcelMapUtil { } } + // 指定要检查的列索引(例如,B列的索引是1) + int columnIndex = 0; + // 遍历所有行,从第二行开始(索引1),因为第一行可能是标题行 + for (int rowIndex = 2; rowIndex <= sheet.getLastRowNum(); ) { + Row currentRow = sheet.getRow(rowIndex); + if (currentRow != null) { + Cell currentCell = currentRow.getCell(columnIndex); + if (currentCell != null && currentCell.getCellType() == CellType.STRING) { // 假设我们处理字符串类型的单元格 + String currentValue = currentCell.getStringCellValue(); + + // 查找连续相同值的行 + int lastRowIndex = rowIndex; + while (lastRowIndex + 1 <= sheet.getLastRowNum()) { + Row nextRow = sheet.getRow(lastRowIndex + 1); + if (nextRow != null) { + Cell nextCell = nextRow.getCell(columnIndex); + if (nextCell != null && nextCell.getCellType() == CellType.STRING && + nextCell.getStringCellValue().equals(currentValue)) { + lastRowIndex++; // 继续向下查找 + } else { + break; // 找到不同值,停止查找 + } + } else { + break; // 没有更多行,停止查找 + } + } + + // 合并找到的行 + if (rowIndex != lastRowIndex) { // 只有在找到连续相同值的行时才进行合并 + sheet.addMergedRegion(new CellRangeAddress(rowIndex, lastRowIndex, 0, 0)); + } +// else{ +// sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 0)); +// } + + // 更新rowIndex以跳过已合并的行 + rowIndex = lastRowIndex + 1; // 从下一个未合并的行开始继续遍历 + } else { + // 如果当前单元格不是字符串类型,则直接跳到下一行 + rowIndex++; + } + } else { + // 如果当前行为空,则直接跳到下一行 + rowIndex++; + } + } + return workbook; } @@ -132,6 +179,14 @@ public class ExcelMapUtil { cellStyle.setFont(font); cellStyle.setAlignment(HorizontalAlignment.CENTER_SELECTION);//设置水平居中 cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);//设置垂直居中 + // 设置上边框 + cellStyle.setBorderTop(BorderStyle.THIN); + // 设置下边框 + cellStyle.setBorderBottom(BorderStyle.THIN); + // 设置左边框 + cellStyle.setBorderLeft(BorderStyle.THIN); + // 设置右边框 + cellStyle.setBorderRight(BorderStyle.THIN); cellStyle.setWrapText(true);//设置单元格内容自动换行 return cellStyle; } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesReportWorkMapper.java b/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesReportWorkMapper.java index f9658901b..8a234feb7 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesReportWorkMapper.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesReportWorkMapper.java @@ -241,4 +241,5 @@ public interface MesReportWorkMapper { List getReportWorksList(ConsumptionDiff consumptionDiff); + String getLastCPPC(MesReportWork rwork); } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesReportWorkServiceImpl.java b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesReportWorkServiceImpl.java index bbf407685..84bbc5dc8 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesReportWorkServiceImpl.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesReportWorkServiceImpl.java @@ -179,6 +179,10 @@ public class MesReportWorkServiceImpl implements IMesReportWorkService { pTabs.setTitle("第"+i+"层工单信息"); mesReportWork.setParentOrder("0"); List liblist0 = mesReportWorkMapper.getReportList(mesReportWork); + for(MesReportWork rwork:liblist0){ + String checkResult = mesReportWorkMapper.getLastCPPC(rwork); + rwork.setCheckResult(checkResult); + } pTabs.setLibList(liblist0); pTabs.setRemark(liblist0.get(0).getRemark()); @@ -463,7 +467,7 @@ public class MesReportWorkServiceImpl implements IMesReportWorkService { sumQua = sonMesReport.getQuantityFeedbackSum(); realQua = parentMesReport.getQuantityFeedbackSum(); workTime = sonMesReport.getWorkTime(); - useMan = sonMesReport.getUseMan(); + useMan = sonMesReport.getUseMan().add(parentMesReport.getUseMan()); dto.setQuantityAct(String.valueOf(sumQua)); dto.setQuantityFeedback(String.valueOf(realQua)); dto.setWorkTime(workTime); @@ -478,7 +482,7 @@ public class MesReportWorkServiceImpl implements IMesReportWorkService { dto.setCompleteRate(completeRate.toString()+"%"); //标准工时=母单数量*规格/产线标准效率 BigDecimal workTimeStandard = BigDecimal.ZERO; - if(dto.getEfficiency() != null){ + if(dto.getEfficiency() != null&&dto.getEfficiency().compareTo(BigDecimal.ZERO)!=0){ workTimeStandard = new BigDecimal(realQua) .multiply(new BigDecimal(dto.getSpec())) .divide(dto.getEfficiency(),2,BigDecimal.ROUND_HALF_UP); diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/MesReportWorkMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/MesReportWorkMapper.xml index 83479561a..09e3cda95 100644 --- a/op-modules/op-mes/src/main/resources/mapper/mes/MesReportWorkMapper.xml +++ b/op-modules/op-mes/src/main/resources/mapper/mes/MesReportWorkMapper.xml @@ -662,14 +662,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" pow.workorder_code_sap workorderCodeSap, mrw.remark,mrw.report_code reportCode, mrw.machine_code machineCode, - mrw.attr1,mrw.upload_status uploadStatus, - qct.check_result checkResult + mrw.attr1,mrw.upload_status uploadStatus from mes_report_work mrw left join pro_order_workorder pow on mrw.workorder_code = pow.workorder_code - left join qc_check_task qct on qct.check_type = 'checkTypeCPPC' - and qct.order_no = mrw.workorder_code - and mrw.batch = qct.income_batch_no - and qct.del_flag = '0' where mrw.del_flag='0' and pow.del_flag = '0' and mrw.workorder_code = #{workorderCode} @@ -682,6 +677,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" order by mrw.batch + + + + + + + +