change - 质量缺陷统计分析明细导出

master
yinq 8 months ago
parent 1ecef4bfb9
commit 5a0ece62de

@ -4,10 +4,7 @@ import com.aucma.common.core.controller.BaseController;
import com.aucma.common.core.domain.AjaxResult;
import com.aucma.common.core.page.TableDataInfo;
import com.aucma.common.utils.poi.ExcelUtil;
import com.aucma.report.domain.FewerMistakesReport;
import com.aucma.report.domain.ProductTraceabilityReport;
import com.aucma.report.domain.QualityDefectsStatisticalAnalysis;
import com.aucma.report.domain.QualityIssuesReport;
import com.aucma.report.domain.*;
import com.aucma.report.service.IQualityReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -64,6 +61,18 @@ public class QualityReportController extends BaseController {
return success(list);
}
/**
*
* @param hashMap
* @return
*/
@PostMapping("/qualityDefectsDetailList/export" )
public void qualityDefectsDetailListExport(HttpServletResponse response, @RequestParam(required = false) Map hashMap) {
List<QualityDefectsDetail> list = qualityReportService.qualityDefectsDetailListExport(hashMap);
ExcelUtil<QualityDefectsDetail> util = new ExcelUtil<>(QualityDefectsDetail. class);
util.exportExcel(response, list, "质量缺陷统计分析明细" );
}
/**
*
* @param hashMap

@ -0,0 +1,162 @@
package com.aucma.report.domain;
import com.aucma.common.annotation.Excel;
import com.aucma.common.core.domain.BaseEntity;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
*
*
* @author Yinq
* @date 2024-03-15
*/
public class QualityDefectsDetail extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
@Excel(name = "工厂")
@JsonProperty("FACTORY_NAME")
private String FACTORY_NAME;
/**
* 线
*/
@Excel(name = "产线")
@JsonProperty("PRODUCT_LINE_NAME")
private String PRODUCT_LINE_NAME;
/**
*
*/
@Excel(name = "质检工位编号")
@JsonProperty("STATION_CODE")
private String STATION_CODE;
/**
*
*/
@Excel(name = "质检工位名称")
@JsonProperty("STATION_NAME")
private String STATION_NAME;
/**
*
*/
@Excel(name = "检测数不合格数")
// @JsonProperty("REWORK_NUMBER")
private Long REWORK_NUMBER;
/**
*
*/
@Excel(name = "序号")
@JsonProperty("REWORK_NUMBER")
private Long SEQ;
/**
*
*/
@Excel(name = "缺陷名称")
@JsonProperty("QUALITY_DEFECT_NAME")
private String QUALITY_DEFECT_NAME;
/**
*
*/
@Excel(name = "缺陷数量")
@JsonProperty("DEFECT_NUMBER")
private Long DEFECT_NUMBER;
/**
* (%)
*/
@Excel(name = "比例(%)")
@JsonProperty("比例(%)")
private String RATE;
public Long getSEQ() {
return SEQ;
}
public void setSEQ(Long SEQ) {
this.SEQ = SEQ;
}
public String getQUALITY_DEFECT_NAME() {
return QUALITY_DEFECT_NAME;
}
public void setQUALITY_DEFECT_NAME(String QUALITY_DEFECT_NAME) {
this.QUALITY_DEFECT_NAME = QUALITY_DEFECT_NAME;
}
public Long getDEFECT_NUMBER() {
return DEFECT_NUMBER;
}
public void setDEFECT_NUMBER(Long DEFECT_NUMBER) {
this.DEFECT_NUMBER = DEFECT_NUMBER;
}
public String getFACTORY_NAME() {
return FACTORY_NAME;
}
public void setFACTORY_NAME(String FACTORY_NAME) {
this.FACTORY_NAME = FACTORY_NAME;
}
public String getPRODUCT_LINE_NAME() {
return PRODUCT_LINE_NAME;
}
public void setPRODUCT_LINE_NAME(String PRODUCT_LINE_NAME) {
this.PRODUCT_LINE_NAME = PRODUCT_LINE_NAME;
}
public String getSTATION_CODE() {
return STATION_CODE;
}
public void setSTATION_CODE(String STATION_CODE) {
this.STATION_CODE = STATION_CODE;
}
public String getSTATION_NAME() {
return STATION_NAME;
}
public void setSTATION_NAME(String STATION_NAME) {
this.STATION_NAME = STATION_NAME;
}
public Long getREWORK_NUMBER() {
return REWORK_NUMBER;
}
public void setREWORK_NUMBER(Long REWORK_NUMBER) {
this.REWORK_NUMBER = REWORK_NUMBER;
}
public String getRATE() {
return RATE;
}
public void setRATE(String RATE) {
this.RATE = RATE;
}
@Override
public String toString() {
return "QualityDefectsStatisticalAnalysis{" +
"FACTORY_NAME='" + FACTORY_NAME + '\'' +
", PRODUCT_LINE_NAME='" + PRODUCT_LINE_NAME + '\'' +
", STATION_CODE='" + STATION_CODE + '\'' +
", STATION_NAME='" + STATION_NAME + '\'' +
", REWORK_NUMBER=" + REWORK_NUMBER +
", RATE='" + RATE + '\'' +
'}';
}
}

@ -1,9 +1,6 @@
package com.aucma.report.service;
import com.aucma.report.domain.FewerMistakesReport;
import com.aucma.report.domain.ProductTraceabilityReport;
import com.aucma.report.domain.QualityDefectsStatisticalAnalysis;
import com.aucma.report.domain.QualityIssuesReport;
import com.aucma.report.domain.*;
import java.util.HashMap;
import java.util.List;
@ -74,4 +71,11 @@ public interface IQualityReportService
* @return
*/
List<HashMap<String, Object>> productTraceabilityDetailList(Map hashMap);
/**
*
* @param hashMap
* @return
*/
List<QualityDefectsDetail> qualityDefectsDetailListExport(Map hashMap);
}

@ -1,14 +1,12 @@
package com.aucma.report.service.impl;
import com.aucma.report.domain.FewerMistakesReport;
import com.aucma.report.domain.ProductTraceabilityReport;
import com.aucma.report.domain.QualityDefectsStatisticalAnalysis;
import com.aucma.report.domain.QualityIssuesReport;
import com.aucma.report.domain.*;
import com.aucma.report.mapper.GeneralReportMapper;
import com.aucma.report.service.IQualityReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -108,4 +106,35 @@ public class QualityReportServiceImpl implements IQualityReportService {
return reportMapper.productTraceabilityDetailList(hashMap);
}
/**
*
* @param hashMap
* @return
*/
@Override
public List<QualityDefectsDetail> qualityDefectsDetailListExport(Map hashMap) {
ArrayList<QualityDefectsDetail> defectsDetailArrayList = new ArrayList<>();
List<QualityDefectsStatisticalAnalysis> analysisList = this.qualityDefectsStatisticalAnalysisList(hashMap);
for (QualityDefectsStatisticalAnalysis item : analysisList) {
hashMap.put("stationCode",item.getSTATION_CODE());
List<HashMap<String, Object>> hashMaps = this.qualityDefectsDetailList(hashMap);
for (HashMap<String, Object> map : hashMaps) {
QualityDefectsDetail defectsDetail = new QualityDefectsDetail();
defectsDetail.setFACTORY_NAME(item.getFACTORY_NAME());
defectsDetail.setPRODUCT_LINE_NAME(item.getPRODUCT_LINE_NAME());
defectsDetail.setSTATION_CODE(item.getSTATION_CODE());
defectsDetail.setSTATION_NAME(item.getSTATION_NAME());
defectsDetail.setREWORK_NUMBER(item.getREWORK_NUMBER());
defectsDetail.setSEQ(Long.valueOf(String.valueOf(map.get("SEQ"))));
defectsDetail.setQUALITY_DEFECT_NAME(String.valueOf(map.get("QUALITY_DEFECT_NAME")));
defectsDetail.setDEFECT_NUMBER(Long.valueOf(String.valueOf(map.get("DEFECT_NUMBER"))));
defectsDetail.setRATE(String.valueOf(map.get("RATE")));
defectsDetailArrayList.add(defectsDetail);
}
}
return defectsDetailArrayList;
}
}

@ -286,7 +286,7 @@
SELECT
DA.QUALITY_DEFECT_NAME,
COUNT(*) AS DEFECT_NUMBER,
ROUND(COUNT(*) / TD.ALL_DEFECT * 100, 0) || '%' AS RATE
TO_CHAR(ROUND(COUNT(*) / TD.ALL_DEFECT * 100, 2), 'FM99990.00') || '%' AS RATE
FROM (
SELECT
RQI.QUALITY_DEFECT_NAME,

Loading…
Cancel
Save