change - add年度不良率同比报表

master
yinq 7 months ago
parent 973d1e7903
commit ee47ccebee

@ -236,4 +236,15 @@ public class QualityReportController extends BaseController {
ExcelUtil<DowngradeProportionReport> util = new ExcelUtil<>(DowngradeProportionReport. class);
util.exportExcel(response, list, "降级率报表" );
}
/**
*
* @param hashMap
* @return
*/
@GetMapping("/adverseRecordYearOnYearList")
public AjaxResult adverseRecordYearOnYearList(@RequestParam(required = false) Map hashMap) {
List<AdverseRecordYearOnYearReport> list = qualityReportService.adverseRecordYearOnYearList(hashMap);
return success(list);
}
}

@ -0,0 +1,137 @@
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 AdverseRecordYearOnYearReport extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 线
*/
@Excel(name = "产线编号")
@JsonProperty("PRODUCT_LINE_CODE")
private String PRODUCT_LINE_CODE;
/**
* 线
*/
@Excel(name = "产线名称")
@JsonProperty("PRODUCT_LINE_NAME")
private String PRODUCT_LINE_NAME;
/**
*
*/
@Excel(name = "工序编号")
@JsonProperty("PROCESS_CODE")
private String PROCESS_CODE;
/**
*
*/
@Excel(name = "工序名称")
@JsonProperty("PROCESS_NAME")
private String PROCESS_NAME;
/**
*
*/
@Excel(name = "月份")
@JsonProperty("INSPECTOR_MONTH")
private String INSPECTOR_MONTH;
/**
*
*/
@Excel(name = "异常数")
@JsonProperty("QUALITY_SUM")
private Long QUALITY_SUM;
/**
*
*/
@Excel(name = "产量")
@JsonProperty("OFF_LINE_NUM")
private Long OFF_LINE_NUM;
/**
*
*/
@Excel(name = "异常率")
@JsonProperty("REPAIR_RATE")
private String REPAIR_RATE;
public String getPRODUCT_LINE_CODE() {
return PRODUCT_LINE_CODE;
}
public void setPRODUCT_LINE_CODE(String PRODUCT_LINE_CODE) {
this.PRODUCT_LINE_CODE = PRODUCT_LINE_CODE;
}
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 getPROCESS_CODE() {
return PROCESS_CODE;
}
public void setPROCESS_CODE(String PROCESS_CODE) {
this.PROCESS_CODE = PROCESS_CODE;
}
public String getPROCESS_NAME() {
return PROCESS_NAME;
}
public void setPROCESS_NAME(String PROCESS_NAME) {
this.PROCESS_NAME = PROCESS_NAME;
}
public String getINSPECTOR_MONTH() {
return INSPECTOR_MONTH;
}
public void setINSPECTOR_MONTH(String INSPECTOR_MONTH) {
this.INSPECTOR_MONTH = INSPECTOR_MONTH;
}
public Long getQUALITY_SUM() {
return QUALITY_SUM;
}
public void setQUALITY_SUM(Long QUALITY_SUM) {
this.QUALITY_SUM = QUALITY_SUM;
}
public Long getOFF_LINE_NUM() {
return OFF_LINE_NUM;
}
public void setOFF_LINE_NUM(Long OFF_LINE_NUM) {
this.OFF_LINE_NUM = OFF_LINE_NUM;
}
public String getREPAIR_RATE() {
return REPAIR_RATE;
}
public void setREPAIR_RATE(String REPAIR_RATE) {
this.REPAIR_RATE = REPAIR_RATE;
}
}

@ -5,7 +5,7 @@ import com.aucma.common.core.domain.BaseEntity;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
*
* /
*
* @author Yinq
* @date 2024-03-15
@ -21,9 +21,9 @@ public class DowngradeProportionReport extends BaseEntity {
private String INSPECTOR_TIME;
/**
*
*
*/
@Excel(name = "样品机数")
@Excel(name = "异常数")
@JsonProperty("QUALITY_SUM")
private Long QUALITY_SUM;
@ -35,9 +35,9 @@ public class DowngradeProportionReport extends BaseEntity {
private Long OFF_LINE_NUM;
/**
*
*
*/
@Excel(name = "降级率")
@Excel(name = "异常率")
@JsonProperty("REPAIR_RATE")
private String REPAIR_RATE;

@ -150,4 +150,11 @@ public interface GeneralReportMapper {
* @return
*/
List<DowngradeProportionReport> downgradeProportionReportList(Map hashMap);
/**
*
* @param hashMap
* @return
*/
List<AdverseRecordYearOnYearReport> adverseRecordYearOnYearList(Map hashMap);
}

@ -92,4 +92,11 @@ public interface IQualityReportService
* @return
*/
List<DowngradeProportionReport> downgradeProportionReportList(Map hashMap);
/**
*
* @param hashMap
* @return
*/
List<AdverseRecordYearOnYearReport> adverseRecordYearOnYearList(Map hashMap);
}

@ -173,4 +173,17 @@ public class QualityReportServiceImpl implements IQualityReportService {
return reportMapper.downgradeProportionReportList(hashMap);
}
/**
*
* @param hashMap
* @return
*/
@Override
public List<AdverseRecordYearOnYearReport> adverseRecordYearOnYearList(Map hashMap) {
if (!hashMap.containsKey("year")){
return null;
}
return reportMapper.adverseRecordYearOnYearList(hashMap);
}
}

@ -711,7 +711,13 @@
LEFT JOIN (SELECT INSPECTOR_TIME, NVL(COUNT(*), 0) QUALITY_SUM
FROM (SELECT TO_CHAR(RQI.INSPECTOR_TIME, 'YYYY-MM-DD') INSPECTOR_TIME, RQI.BAR_CODE
FROM REPORT_QUALITY_INSPECTION RQI
<if test="alarmType != null and alarmType == 1 ">
WHERE RQI.PROCESS_RESULT = 'KA'
</if>
<if test="alarmType != null and alarmType == 2 ">
WHERE RQI.PROCESS_RESULT = '报废重做'
</if>
GROUP BY TO_CHAR(RQI.INSPECTOR_TIME, 'YYYY-MM-DD'), RQI.BAR_CODE)
GROUP BY INSPECTOR_TIME) RQI ON VPO.PRODUCT_SCANTIME = RQI.INSPECTOR_TIME
CROSS JOIN (SELECT TO_CHAR(CUSTOM_DATA) || '%' TARGET
@ -721,5 +727,43 @@
GROUP BY SUBSTR(VPO.PRODUCT_SCANTIME, 1, DT.TIMESUB), TARGET
ORDER BY INSPECTOR_TIME
</select>
<select id="adverseRecordYearOnYearList" resultType="com.aucma.report.domain.AdverseRecordYearOnYearReport"
parameterType="java.util.HashMap">
WITH YEART AS (SELECT #{year} - 1 LASTYEAR, #{year} THISYEAR FROM DUAL)
SELECT BL.PRODUCT_LINE_CODE,
BL.PRODUCT_LINE_NAME,
BPS.PROCESS_CODE,
BPS.PROCESS_NAME,
SUM(ZSD.QUALITY_SUM) QUALITY_SUM,
SUM(ZSD.OFF_LINE_NUM) OFF_LINE_NUM,
TO_CHAR(ROUND(NVL(SUM(ZSD.QUALITY_SUM), 0) / SUM(ZSD.OFF_LINE_NUM) * 100, 2), 'FM99990.00') || '%' REPAIR_RATE,
ZSD.INSPECTOR_MONTH
FROM (
SELECT SD.STATION_CODE,
NVL(SUM(SD.ALARM_FLAG), 0) QUALITY_SUM,
NVL(COUNT(*), 0) OFF_LINE_NUM,
SD.INSPECTOR_MONTH
FROM (
SELECT RQI.BAR_CODE,
RQI.STATION_CODE,
MAX(CASE WHEN RQI.TREATMENT_MEASURE = '1' THEN 1 ELSE 0 END) ALARM_FLAG,
TO_CHAR(RQI.INSPECTOR_TIME, 'YYYY-MM') INSPECTOR_MONTH
FROM REPORT_QUALITY_INSPECTION RQI
CROSS JOIN YEART
WHERE RQI.INSPECTOR_TIME BETWEEN to_date(YEART.LASTYEAR || '-01-01 00:00:00', 'yyyy-mm-dd hh24:mi:ss')
AND to_date(YEART.THISYEAR || '-12-31 23:59:59', 'yyyy-mm-dd hh24:mi:ss')
GROUP BY RQI.BAR_CODE, RQI.STATION_CODE, TO_CHAR(RQI.INSPECTOR_TIME, 'YYYY-MM')
) SD
GROUP BY SD.STATION_CODE, SD.INSPECTOR_MONTH
) ZSD
LEFT JOIN BASE_PROCESS_STATION BPS
ON BPS.PROCESS_TYPE = 2 AND BPS.PARENT_ID LIKE '%' || ZSD.STATION_CODE || '%'
LEFT JOIN BASE_PRODUCTLINE BL ON BL.PRODUCT_LINE_CODE = BPS.PRODUCT_LINE_CODE
<if test="productionLine != null and productionLine != ''">
WHERE BL.PRODUCT_LINE_CODE = #{productionLine}
</if>
GROUP BY BL.PRODUCT_LINE_CODE, BL.PRODUCT_LINE_NAME, BPS.PROCESS_CODE, BPS.PROCESS_NAME, ZSD.INSPECTOR_MONTH
ORDER BY PROCESS_CODE, INSPECTOR_MONTH
</select>
</mapper>

Loading…
Cancel
Save