|
|
|
@ -118,15 +118,24 @@
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="qualityDefectsStatisticalAnalysisList" resultType="java.util.HashMap" parameterType="java.util.HashMap">
|
|
|
|
|
|
|
|
|
|
SELECT FACTORY_NAME,
|
|
|
|
|
PRODUCT_LINE_NAME,
|
|
|
|
|
STATION_CODE,
|
|
|
|
|
STATION_NAME,
|
|
|
|
|
COUNT(*) INSPECTION_NUMBER,
|
|
|
|
|
SUM(REWORK_NUMBER) REWORK_NUMBER,
|
|
|
|
|
ROUND((1 - SUM(REWORK_NUMBER) / COUNT(*)) * 100, 0) || '%' RATE
|
|
|
|
|
FROM (
|
|
|
|
|
SELECT FY.FACTORY_NAME,
|
|
|
|
|
BPP.PRODUCT_LINE_NAME,
|
|
|
|
|
BP.PRODUCT_LINE_CODE STATION_CODE,
|
|
|
|
|
BP.PRODUCT_LINE_NAME STATION_NAME,
|
|
|
|
|
COUNT(*) INSPECTION_NUMBER,
|
|
|
|
|
SUM(REWORK_NUMBER) REWORK_NUMBER,
|
|
|
|
|
ROUND((1 - SUM(REWORK_NUMBER) / COUNT(*)) * 100, 0) || '%' RATE
|
|
|
|
|
BP.PRODUCT_LINE_CODE STATION_CODE,
|
|
|
|
|
BP.PRODUCT_LINE_NAME STATION_NAME,
|
|
|
|
|
RQI.BAR_CODE,
|
|
|
|
|
MAX(CASE WHEN RQI.TREATMENT_MEASURE = '1' THEN 1 ELSE 0 END) REWORK_NUMBER
|
|
|
|
|
FROM REPORT_QUALITY_INSPECTION RQI
|
|
|
|
|
LEFT JOIN BASE_PRODUCTLINE BP ON BP.PRODUCT_LINE_CODE = RQI.STATION_CODE
|
|
|
|
|
LEFT JOIN BASE_PRODUCTLINE BP
|
|
|
|
|
ON BP.PRODUCT_LINE_CODE = RQI.STATION_CODE
|
|
|
|
|
LEFT JOIN BASE_PRODUCTLINE BPP ON BPP.PRODUCT_LINE_CODE = BP.PARENT_ID
|
|
|
|
|
LEFT JOIN BASE_FACTORY FY ON FY.FACTORY_CODE = BPP.PLANT_CODE
|
|
|
|
|
<where>
|
|
|
|
@ -140,8 +149,11 @@
|
|
|
|
|
AND TO_CHAR(RQI.INSPECTOR_TIME, 'YYYY-MM-DD HH24:MI:SS') BETWEEN #{beginBeginTime} AND #{endBeginTime}
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
GROUP BY FY.FACTORY_NAME, BPP.PRODUCT_LINE_NAME, BP.PRODUCT_LINE_CODE, BP.PRODUCT_LINE_NAME
|
|
|
|
|
ORDER BY BP.PRODUCT_LINE_CODE
|
|
|
|
|
GROUP BY FY.FACTORY_NAME, BPP.PRODUCT_LINE_NAME, BP.PRODUCT_LINE_CODE, BP.PRODUCT_LINE_NAME,
|
|
|
|
|
RQI.BAR_CODE
|
|
|
|
|
)
|
|
|
|
|
GROUP BY FACTORY_NAME, PRODUCT_LINE_NAME, STATION_CODE, STATION_NAME
|
|
|
|
|
ORDER BY REWORK_NUMBER
|
|
|
|
|
</select>
|
|
|
|
|
<select id="fewerMistakesReportList" resultType="java.util.HashMap" parameterType="java.util.HashMap">
|
|
|
|
|
SELECT FY.FACTORY_NAME,
|
|
|
|
@ -220,21 +232,53 @@
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="qualityDefectsDetailList" resultType="java.util.HashMap" parameterType="java.util.HashMap">
|
|
|
|
|
SELECT ROWNUM SEQ, SD.QUALITY_DEFECT_NAME, SD.DEFECT_NUMBER, ROUND(DEFECT_NUMBER / ALL_DEFECT * 100, 0) || '%'
|
|
|
|
|
WITH TotalDefects AS (
|
|
|
|
|
SELECT
|
|
|
|
|
COUNT(*) AS ALL_DEFECT
|
|
|
|
|
FROM
|
|
|
|
|
REPORT_QUALITY_INSPECTION RQI
|
|
|
|
|
WHERE
|
|
|
|
|
RQI.TREATMENT_MEASURE = 1
|
|
|
|
|
<if test="stationCode != null and stationCode != ''">
|
|
|
|
|
AND RQI.STATION_CODE = #{stationCode}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="beginBeginTime != null and beginBeginTime != '' and endBeginTime != null and endBeginTime != ''">
|
|
|
|
|
AND TO_CHAR(RQI.INSPECTOR_TIME, 'YYYY-MM-DD HH24:MI:SS') BETWEEN #{beginBeginTime} AND #{endBeginTime}
|
|
|
|
|
</if>
|
|
|
|
|
)
|
|
|
|
|
SELECT
|
|
|
|
|
ROW_NUMBER() OVER (ORDER BY RATE) AS SEQ,
|
|
|
|
|
SD.QUALITY_DEFECT_NAME,
|
|
|
|
|
SD.DEFECT_NUMBER,
|
|
|
|
|
RATE
|
|
|
|
|
FROM (
|
|
|
|
|
SELECT RQI.QUALITY_DEFECT_NAME,
|
|
|
|
|
COUNT(*) DEFECT_NUMBER,
|
|
|
|
|
SUM(COUNT(*)) OVER () ALL_DEFECT
|
|
|
|
|
FROM REPORT_QUALITY_INSPECTION RQI
|
|
|
|
|
WHERE RQI.TREATMENT_MEASURE = 1
|
|
|
|
|
SELECT
|
|
|
|
|
DA.QUALITY_DEFECT_NAME,
|
|
|
|
|
COUNT(*) AS DEFECT_NUMBER,
|
|
|
|
|
ROUND(COUNT(*) / TD.ALL_DEFECT * 100, 0) || '%' AS RATE
|
|
|
|
|
FROM (
|
|
|
|
|
SELECT
|
|
|
|
|
RQI.QUALITY_DEFECT_NAME,
|
|
|
|
|
RQI.BAR_CODE,
|
|
|
|
|
RQI.QUALITY_DEFECT_CODE
|
|
|
|
|
FROM
|
|
|
|
|
REPORT_QUALITY_INSPECTION RQI
|
|
|
|
|
WHERE
|
|
|
|
|
RQI.TREATMENT_MEASURE = 1
|
|
|
|
|
<if test="stationCode != null and stationCode != ''">
|
|
|
|
|
AND RQI.STATION_CODE = #{stationCode}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="beginBeginTime != null and beginBeginTime != '' and endBeginTime != null and endBeginTime != ''">
|
|
|
|
|
AND TO_CHAR(RQI.INSPECTOR_TIME, 'YYYY-MM-DD HH24:MI:SS') BETWEEN #{beginBeginTime} AND #{endBeginTime}
|
|
|
|
|
</if>
|
|
|
|
|
GROUP BY RQI.QUALITY_DEFECT_NAME) SD
|
|
|
|
|
GROUP BY
|
|
|
|
|
RQI.QUALITY_DEFECT_NAME, RQI.BAR_CODE, RQI.QUALITY_DEFECT_CODE
|
|
|
|
|
) DA
|
|
|
|
|
CROSS JOIN TotalDefects TD
|
|
|
|
|
GROUP BY
|
|
|
|
|
DA.QUALITY_DEFECT_NAME, TD.ALL_DEFECT
|
|
|
|
|
) SD
|
|
|
|
|
ORDER BY RATE
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="productTraceabilityReportList" resultType="ProductTraceabilityReport" parameterType="java.util.HashMap">
|
|
|
|
|