|
|
|
@ -269,7 +269,49 @@
|
|
|
|
|
|
|
|
|
|
<!--设备维修数据统计报表-->
|
|
|
|
|
<select id="findResourceRepairDataStatInfo" resultType="java.util.HashMap" parameterType="java.util.HashMap" >
|
|
|
|
|
|
|
|
|
|
WITH RUN_NUM AS (
|
|
|
|
|
SELECT sum(zrrt.RUN_TIME) RUN_TIME , NVL( TO_DATE(SUBSTR(ZRRT.SEND_DATE,0,7) ,'YYYY-MM') ,MAX(UP_TIME)) UP_TIME , ZRRT.RESRCE , SUBSTR(ZRRT.SEND_DATE,0,7) SEND_DATE
|
|
|
|
|
FROM Z_RESOURCE_RUN_TIME zrrt
|
|
|
|
|
WHERE ZRRT.SITE = #{site} AND TO_DATE(ZRRT.SEND_DATE ,'YYYY-MM-DD') > TO_DATE(SUBSTR(#{startFromDate},0,7) ,'YYYY-MM')
|
|
|
|
|
AND TO_DATE(ZRRT.SEND_DATE,'YYYY-MM-DD') < TO_DATE(SUBSTR(#{startToDate},0,7) ,'YYYY-MM')
|
|
|
|
|
GROUP BY ZRRT.RESRCE , SUBSTR(ZRRT.SEND_DATE,0,7)
|
|
|
|
|
) ,
|
|
|
|
|
REPAIR_INFO AS (
|
|
|
|
|
SELECT T.RESRCE, T.MON_DATE , SUM(REPAIR_TIME) - SUM(WAIT_TIME) REPAIR_STOP_TIME , SUM(REPAIR_TIME) REPAIR_TIME FROM
|
|
|
|
|
(SELECT ZRRT.RESOURCE_NO RESRCE , TO_CHAR(ZRRT.CREATED_DATE_TIME + 8/24 ,'YYYY-MM' ) MON_DATE ,
|
|
|
|
|
ROUND(NVL(0,ZRRT.WAIT_TIME)*24*60*60,0) WAIT_TIME,
|
|
|
|
|
CASE WHEN ZRRT.ACTUAL_COMPLETE_DATE IS NOT NULL THEN ROUND((ZRRT.ACTUAL_COMPLETE_DATE - ZRRT.ACTUAL_START_DATE)*24*60*60,0)
|
|
|
|
|
ELSE ROUND((SYSDATE - ZRRT.ACTUAL_START_DATE)*24*60*60,0) END REPAIR_TIME
|
|
|
|
|
FROM Z_RESOURCE_REPAIR_TASK zrrt
|
|
|
|
|
WHERE ZRRT.STATUS != '401' AND (ZRRT.CREATED_DATE_TIME + 8/24) > TO_DATE(SUBSTR(#{startFromDate},0,7) ,'YYYY-MM')
|
|
|
|
|
AND (ZRRT.CREATED_DATE_TIME + 8/24) < TO_DATE(SUBSTR(#{startToDate},0,7) ,'YYYY-MM') ) T
|
|
|
|
|
GROUP BY T.RESRCE ,T.MON_DATE
|
|
|
|
|
) ,
|
|
|
|
|
MN AS (
|
|
|
|
|
SELECT WC.WORK_CENTER, WCT.DESCRIPTION WORK_CENTER_DESCRIPTION , R.RESRCE , R.DESCRIPTION , TP.MON_DATE
|
|
|
|
|
FROM RESRCE r
|
|
|
|
|
LEFT JOIN (SELECT '1000' SITE ,TO_CHAR(add_months(TO_DATE(SUBSTR(#{startFromDate},0,7) ,'YYYY-MM') , ROWNUM -1), 'YYYY-MM') MON_DATE
|
|
|
|
|
FROM dual CONNECT BY rownum <= months_between(TO_DATE(SUBSTR(#{startToDate},0,7) ,'YYYY-MM') , TO_DATE(SUBSTR(#{startFromDate},0,7) ,'YYYY-MM') + 1)) TP ON TP.SITE = R.SITE
|
|
|
|
|
LEFT JOIN WORK_CENTER_MEMBER wcm ON WCM.WORK_CENTER_OR_RESOURCE_GBO = R.HANDLE
|
|
|
|
|
LEFT JOIN WORK_CENTER_MEMBER wcm2 ON WCM2.WORK_CENTER_OR_RESOURCE_GBO = WCM.WORK_CENTER_BO
|
|
|
|
|
LEFT JOIN WORK_CENTER_T wct ON WCT.WORK_CENTER_BO = WCM2.WORK_CENTER_BO
|
|
|
|
|
LEFT JOIN WORK_CENTER WC ON WC.HANDLE = WCM2.WORK_CENTER_BO
|
|
|
|
|
WHERE R.SITE = #{site}
|
|
|
|
|
<if test="workCenter != null and workCenter != ''" >
|
|
|
|
|
AND WC.WORK_CENTER = #{workCenter}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="resrce != null and resrce != ''" >
|
|
|
|
|
AND R.RESRCE = #{resrce}
|
|
|
|
|
</if>
|
|
|
|
|
)
|
|
|
|
|
SELECT MN.WORK_CENTER_DESCRIPTION , MN.RESRCE , MN.DESCRIPTION RESOURCE_DESCRIPTION, RN.UP_TIME UP_DATE, NVL(0,RN.RUN_TIME) RUN_TIME,
|
|
|
|
|
NVL(0,RI.REPAIR_STOP_TIME) REPAIR_STOP_TIME, NVL(0,RI.REPAIR_TIME) REPAIR_TIME,
|
|
|
|
|
CASE WHEN RI.REPAIR_STOP_TIME IS NOT NULL AND RN.RUN_TIME > 0 THEN ROUND(RI.REPAIR_STOP_TIME/RN.RUN_TIME,2) * 100 || '%'
|
|
|
|
|
ELSE 0 || '%' END RATE , MN.MON_DATE
|
|
|
|
|
FROM MN
|
|
|
|
|
LEFT JOIN REPAIR_INFO RI ON RI.RESRCE = MN.RESRCE AND RI.MON_DATE = MN.MON_DATE
|
|
|
|
|
LEFT JOIN RUN_NUM RN ON RN.RESRCE = MN.RESRCE AND RN.SEND_DATE = MN.MON_DATE
|
|
|
|
|
ORDER BY MN.MON_DATE, MN.RESRCE
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!--每日生产状态报表-->
|
|
|
|
|