From 9599ca82b0ee7f5b8fa3bf39aa1fe1bff4ff8e24 Mon Sep 17 00:00:00 2001 From: fengyuan_yang <1976974459@qq.com> Date: Fri, 6 Sep 2024 10:40:06 +0800 Subject: [PATCH] =?UTF-8?q?2024-09-06=20=E5=A2=9E=E5=8A=A0FAI=20FQC=20?= =?UTF-8?q?=E7=9A=84=E6=A3=80=E9=AA=8C=E6=98=8E=E7=BB=86=E6=8A=A5=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/pms/mapper/QcReportMapper.java | 12 + .../pms/service/Impl/QcReportServiceImpl.java | 46 ++ .../report/data/QcReportOtherData.java | 4 +- .../resources/mapper/pms/QcReportMapper.xml | 696 +++++++++++++++++- 4 files changed, 748 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/xujie/sys/modules/pms/mapper/QcReportMapper.java b/src/main/java/com/xujie/sys/modules/pms/mapper/QcReportMapper.java index 82192fd5..7bc6e64c 100644 --- a/src/main/java/com/xujie/sys/modules/pms/mapper/QcReportMapper.java +++ b/src/main/java/com/xujie/sys/modules/pms/mapper/QcReportMapper.java @@ -23,22 +23,34 @@ public interface QcReportMapper { IPage getFQCReport(Page qcReportDataPage, @Param("query") QcReportData data); + IPage getIQCDetailReport(Page qcDetailReportPage, @Param("query") QcDetailReport data); IPage getIQCDetailReportCount(Page qcDetailReportPage, @Param("query") QcDetailReport data); List downloadIQCDetailRecord(QcDetailReport data); + IPage getIPQCDetailReport(Page qcDetailReportPage, @Param("query") QcDetailReport data); IPage getIPQCDetailReportCount(Page qcDetailReportPage, @Param("query") QcDetailReport data); List downloadIPQCDetailRecord(QcDetailReport data); + IPage getFAIDetailReport(Page qcDetailReportPage, @Param("query") QcDetailReport data); + IPage getFAIDetailReportCount(Page qcDetailReportPage, @Param("query") QcDetailReport data); + + List downloadFAIDetailRecord(QcDetailReport data); + + IPage getFQCDetailReport(Page qcDetailReportPage, @Param("query") QcDetailReport data); + IPage getFQCDetailReportCount(Page qcDetailReportPage, @Param("query") QcDetailReport data); + + List downloadFQCDetailRecord(QcDetailReport data); + diff --git a/src/main/java/com/xujie/sys/modules/pms/service/Impl/QcReportServiceImpl.java b/src/main/java/com/xujie/sys/modules/pms/service/Impl/QcReportServiceImpl.java index 947eeda7..d3a3b49f 100644 --- a/src/main/java/com/xujie/sys/modules/pms/service/Impl/QcReportServiceImpl.java +++ b/src/main/java/com/xujie/sys/modules/pms/service/Impl/QcReportServiceImpl.java @@ -130,6 +130,20 @@ public class QcReportServiceImpl implements QcReportService { int writeCount = totalRowCount % pageSize == 0 ? (totalRowCount / pageSize) : (totalRowCount / pageSize + 1); // 创建 ExcelWriter EasyExcel.write(out, QcReportOtherData.class).sheet(String.valueOf(sheet)).doWrite(getIPQCData(writeCount, pageSize, data, result)); // 批量写入数据 + } else if ("fai".equals(data.getDownloadType())) { + IPage list = this.qcReportMapper.getFAIDetailReportCount(new Page(data.getPage(), data.getLimit()), data); + totalRowCount = (int)list.getTotal(); + int pageSize = ExcelConstant.PER_WRITE_ROW_COUNT; + int writeCount = totalRowCount % pageSize == 0 ? (totalRowCount / pageSize) : (totalRowCount / pageSize + 1); + // 创建 ExcelWriter + EasyExcel.write(out, QcReportOtherData.class).sheet(String.valueOf(sheet)).doWrite(getFAIData(writeCount, pageSize, data, result)); // 批量写入数据 + } else if ("fqc".equals(data.getDownloadType())) { + IPage list = this.qcReportMapper.getFQCDetailReportCount(new Page(data.getPage(), data.getLimit()), data); + totalRowCount = (int)list.getTotal(); + int pageSize = ExcelConstant.PER_WRITE_ROW_COUNT; + int writeCount = totalRowCount % pageSize == 0 ? (totalRowCount / pageSize) : (totalRowCount / pageSize + 1); + // 创建 ExcelWriter + EasyExcel.write(out, QcReportOtherData.class).sheet(String.valueOf(sheet)).doWrite(getFQCData(writeCount, pageSize, data, result)); // 批量写入数据 } // 下载EXCEL @@ -176,6 +190,38 @@ public class QcReportServiceImpl implements QcReportService { return allData; } + private List getFAIData(int writeCount, int pageSize, QcDetailReport data, Map result) { + List allData = new ArrayList<>(); + for (int i = 0; i < writeCount; i++) { + PageHelper.startPage(i + 1, pageSize); + List detailReports = this.qcReportMapper.downloadFAIDetailRecord(data); + if (!detailReports.isEmpty()) { + for (QcReportOtherData detailReport : detailReports) { + detailReport.setOperatorName(result.get(detailReport.getSite() + "_" + detailReport.getBuNo() + "_" + detailReport.getInspectionNo() + "_" + "coordination")); + detailReport.setResponsiblePersonName(result.get(detailReport.getSite() + "_" + detailReport.getBuNo() + "_" + detailReport.getInspectionNo() + "_" + "responsible")); + } + allData.addAll(detailReports); + } + } + return allData; + } + + private List getFQCData(int writeCount, int pageSize, QcDetailReport data, Map result) { + List allData = new ArrayList<>(); + for (int i = 0; i < writeCount; i++) { + PageHelper.startPage(i + 1, pageSize); + List detailReports = this.qcReportMapper.downloadFQCDetailRecord(data); + if (!detailReports.isEmpty()) { + for (QcReportOtherData detailReport : detailReports) { + detailReport.setOperatorName(result.get(detailReport.getSite() + "_" + detailReport.getBuNo() + "_" + detailReport.getInspectionNo() + "_" + "coordination")); + detailReport.setResponsiblePersonName(result.get(detailReport.getSite() + "_" + detailReport.getBuNo() + "_" + detailReport.getInspectionNo() + "_" + "responsible")); + } + allData.addAll(detailReports); + } + } + return allData; + } + private Map getOperatorNameMap() { String type1 = "coordination"; String type2 = "responsible"; diff --git a/src/main/java/com/xujie/sys/modules/report/data/QcReportOtherData.java b/src/main/java/com/xujie/sys/modules/report/data/QcReportOtherData.java index ce250411..db163ac2 100644 --- a/src/main/java/com/xujie/sys/modules/report/data/QcReportOtherData.java +++ b/src/main/java/com/xujie/sys/modules/report/data/QcReportOtherData.java @@ -33,7 +33,7 @@ public class QcReportOtherData extends QueryPage { private String disposalMeasures; @ExcelProperty(index = 6, value = "检验类型") - private String inspectionTypeName; + private String inspectionTypeNo; @ExcelProperty(index = 7, value = "送检日期") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") @@ -198,7 +198,7 @@ public class QcReportOtherData extends QueryPage { private String poItemNo; @ExcelIgnore - private String inspectionTypeNo; + private String inspectionTypeName; @ExcelIgnore private String resourceId; diff --git a/src/main/resources/mapper/pms/QcReportMapper.xml b/src/main/resources/mapper/pms/QcReportMapper.xml index 7c20c931..f7a67ad5 100644 --- a/src/main/resources/mapper/pms/QcReportMapper.xml +++ b/src/main/resources/mapper/pms/QcReportMapper.xml @@ -194,12 +194,8 @@ b.sampling_qty as itemSamplingQty, b.unqualified_quantity, b.item_result, - CASE WHEN b.item_result = 'Y' THEN '合格' - WHEN b.item_result = 'N' THEN '不合格' - END as itemResultDesc, - CASE WHEN b.value_type_db = 'T' THEN b.text_value - WHEN b.value_type_db = 'N' THEN CONVERT(varchar, b.number_value, 126) - END as textValue + CASE WHEN b.item_result = 'Y' THEN '合格' WHEN b.item_result = 'N' THEN '不合格' END as itemResultDesc, + CASE WHEN b.value_type_db = 'T' THEN b.text_value WHEN b.value_type_db = 'N' THEN CONVERT(varchar, b.number_value, 126) END as textValue FROM qc_ipqc_record as a LEFT JOIN qc_ipqc_detailed_record b ON a.site = b.site AND a.bu_no = b.bu_no AND a.inspection_no = b.inspection_no left join part as d on a.site = d.site and a.bu_no = d.sourceBu and a.part_no = d.part_no @@ -420,8 +416,6 @@ a.state, a.inspection_result, a.task_date, - a.inspection_type_no, - dbo.qc_get_inspection_type_name(a.site, a.inspection_type_no) as inspectionTypeName, a.inspection_cycle, a.order_no, a.operation_desc, @@ -1227,9 +1221,695 @@ AND dbo.joint_name2(a.site, a.bu_no, a.inspection_no, 'responsible') like '%' + #{responsiblePersonName} + '%' + AND b.item_result = #{itemResult} + + + ORDER BY + CASE WHEN a.state = '待检验' THEN 1 + WHEN a.state = '待审核' THEN 2 + WHEN a.state = '已完成' THEN 3 + END, a.task_date, c.num desc + + + + + + + + + + + + + + +