|
|
|
@ -806,23 +806,29 @@
|
|
|
|
|
WEEK_END,
|
|
|
|
|
NVL(COUNT(*), 0) Q_SUM,
|
|
|
|
|
NVL(SUM(LEAK_SUM), 0) LEAK_SUM,
|
|
|
|
|
TO_CHAR(ROUND(SUM(LEAK_SUM) / COUNT(*) * 100, 2), 'FM99990.00') REPAIR_RATE,
|
|
|
|
|
'二线' PRODUCT_LINE_NAME
|
|
|
|
|
TO_CHAR(ROUND(SUM(LEAK_SUM) / COUNT(*) * 100, 2), 'FM99990.00') REPAIR_RATE,
|
|
|
|
|
PRODUCT_LINE_NAME PRODUCT_LINE_NAME
|
|
|
|
|
FROM (
|
|
|
|
|
SELECT TO_NUMBER(COLUMN_A) WEEK_NUMBER,
|
|
|
|
|
COLUMN_B WEEK_START,
|
|
|
|
|
COLUMN_C WEEK_END,
|
|
|
|
|
P2.PRODUCT_LINE_NAME,
|
|
|
|
|
BAR_CODE,
|
|
|
|
|
MAX(CASE WHEN QUALITY_DEFECT_NAME LIKE '%漏%' THEN 1 ELSE 0 END) LEAK_SUM
|
|
|
|
|
FROM (SELECT COLUMN_A, COLUMN_B, COLUMN_C
|
|
|
|
|
FROM TABLE (GET_YEAR_WEEK_TIME(${year}))) WEE
|
|
|
|
|
LEFT JOIN REPORT_QUALITY_INSPECTION RQI
|
|
|
|
|
LEFT JOIN BASE_PRODUCTLINE BP on RQI.STATION_CODE = BP.PRODUCT_LINE_CODE
|
|
|
|
|
LEFT JOIN BASE_PRODUCTLINE P2 on P2.PRODUCT_LINE_CODE = BP.PARENT_ID
|
|
|
|
|
ON RQI.BAR_CODE LIKE 'B%' AND
|
|
|
|
|
TO_CHAR(RQI.INSPECTOR_TIME, 'YYYY-MM-DD HH24:MI:SS') > WEE.COLUMN_B AND
|
|
|
|
|
TO_CHAR(RQI.INSPECTOR_TIME, 'YYYY-MM-DD HH24:MI:SS') <= WEE.COLUMN_C
|
|
|
|
|
GROUP BY COLUMN_A, COLUMN_B, COLUMN_C, BAR_CODE
|
|
|
|
|
<if test="PRODUCT_LINE_CODE != null and PRODUCT_LINE_CODE != ''">
|
|
|
|
|
WHERE P2.PRODUCT_LINE_CODE = #{PRODUCT_LINE_CODE}
|
|
|
|
|
</if>
|
|
|
|
|
GROUP BY COLUMN_A, COLUMN_B, COLUMN_C, P2.PRODUCT_LINE_NAME, BAR_CODE
|
|
|
|
|
)
|
|
|
|
|
GROUP BY WEEK_NUMBER, WEEK_START, WEEK_END
|
|
|
|
|
GROUP BY PRODUCT_LINE_NAME, WEEK_NUMBER, WEEK_START, WEEK_END
|
|
|
|
|
ORDER BY WEEK_NUMBER
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
@ -833,22 +839,25 @@
|
|
|
|
|
NVL(COUNT(*), 0) Q_SUM,
|
|
|
|
|
NVL(SUM(LEAK_SUM), 0) LEAK_SUM,
|
|
|
|
|
TO_CHAR(ROUND(SUM(LEAK_SUM) / COUNT(*) * 100, 2), 'FM99990.00') REPAIR_RATE,
|
|
|
|
|
'二线' PRODUCT_LINE_NAME
|
|
|
|
|
PRODUCT_LINE_NAME PRODUCT_LINE_NAME
|
|
|
|
|
FROM (
|
|
|
|
|
SELECT TO_NUMBER(COLUMN_A) WEEK_NUMBER,
|
|
|
|
|
COLUMN_B WEEK_START,
|
|
|
|
|
COLUMN_C WEEK_END,
|
|
|
|
|
P2.PRODUCT_LINE_NAME,
|
|
|
|
|
BAR_CODE,
|
|
|
|
|
MAX(CASE WHEN QUALITY_DEFECT_NAME LIKE '%漏%' THEN 1 ELSE 0 END) LEAK_SUM
|
|
|
|
|
FROM (SELECT COLUMN_A, COLUMN_B, COLUMN_C
|
|
|
|
|
FROM TABLE (GET_YEAR_MONTH_TIME(${year}))) WEE
|
|
|
|
|
LEFT JOIN REPORT_QUALITY_INSPECTION RQI
|
|
|
|
|
LEFT JOIN BASE_PRODUCTLINE BP on RQI.STATION_CODE = BP.PRODUCT_LINE_CODE
|
|
|
|
|
LEFT JOIN BASE_PRODUCTLINE P2 on P2.PRODUCT_LINE_CODE = BP.PARENT_ID
|
|
|
|
|
ON RQI.BAR_CODE LIKE 'B%' AND
|
|
|
|
|
TO_CHAR(RQI.INSPECTOR_TIME, 'YYYY-MM-DD HH24:MI:SS') > WEE.COLUMN_B AND
|
|
|
|
|
TO_CHAR(RQI.INSPECTOR_TIME, 'YYYY-MM-DD HH24:MI:SS') <= WEE.COLUMN_C
|
|
|
|
|
GROUP BY COLUMN_A, COLUMN_B, COLUMN_C, BAR_CODE
|
|
|
|
|
GROUP BY COLUMN_A, COLUMN_B, COLUMN_C, P2.PRODUCT_LINE_NAME ,BAR_CODE
|
|
|
|
|
)
|
|
|
|
|
GROUP BY WEEK_NUMBER, WEEK_START, WEEK_END
|
|
|
|
|
GROUP BY PRODUCT_LINE_NAME, WEEK_NUMBER, WEEK_START, WEEK_END
|
|
|
|
|
ORDER BY WEEK_NUMBER
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|