|
|
|
@ -52,9 +52,62 @@
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!--设备符合率报表-->
|
|
|
|
|
<!--设备负荷率报表-->
|
|
|
|
|
<select id="findResourceLoadRateInfo" resultType="java.util.HashMap" parameterType="java.util.HashMap" >
|
|
|
|
|
|
|
|
|
|
WITH TEMP AS (
|
|
|
|
|
SELECT ZSD.PLANNED_COMP_DATE ,ZSD.PLANNED_START_DATE ,ZSD.RESRCE
|
|
|
|
|
FROM Z_SFC_DISPATCH ZSD WHERE ZSD.SITE = #{site} AND ZSD.DISPATCH_STATUS IN ('START','COMPLETE','RELEASE')
|
|
|
|
|
)
|
|
|
|
|
SELECT RDT.* , SUM( (DECODE(A.CNT,NULL,0,A.CNT) + DECODE(B.CNT,NULL,0,B.CNT) + DECODE(C.CNT,NULL,0,C.CNT) + DECODE(D.CNT,NULL,0,D.CNT) ) ) PLAN_HOUR
|
|
|
|
|
,CASE WHEN RDT.CAPACITY_MAN_HOUR = 0 THEN '0%'
|
|
|
|
|
ELSE ROUND(SUM( (DECODE(A.CNT,NULL,0,A.CNT) + DECODE(B.CNT,NULL,0,B.CNT) + DECODE(C.CNT,NULL,0,C.CNT) + DECODE(D.CNT,NULL,0,D.CNT) ) ) / RDT.CAPACITY_MAN_HOUR , 4) * 100 || '%'
|
|
|
|
|
END RATE_DATA
|
|
|
|
|
FROM
|
|
|
|
|
( SELECT R.RESRCE , R.DESCRIPTION RESOURCE_DESCRIPTION, DATE_TIME, DECODE(CF.VALUE,NULL,0,CF.VALUE) CAPACITY_MAN_HOUR , WCA.WORK_CENTER CENTER ,
|
|
|
|
|
WCTA.DESCRIPTION CENTER_DESCRIPTION , WCB.WORK_CENTER , WCTB.DESCRIPTION WORK_CENTER_DESCRIPTION ,RT.RESOURCE_TYPE ,RT.DESCRIPTION RESOURCE_TYPE_DESCRIPTION
|
|
|
|
|
FROM RESRCE R
|
|
|
|
|
LEFT JOIN WORK_CENTER_MEMBER WCMA ON WCMA.WORK_CENTER_OR_RESOURCE_GBO = R.HANDLE
|
|
|
|
|
LEFT JOIN WORK_CENTER WCA ON WCA.HANDLE = WCMA.WORK_CENTER_BO
|
|
|
|
|
INNER JOIN WORK_CENTER_T WCTA ON WCTA.WORK_CENTER_BO = WCA.HANDLE AND WCTA.LOCALE = 'zh'
|
|
|
|
|
LEFT JOIN WORK_CENTER_MEMBER WCMB ON WCMB.WORK_CENTER_OR_RESOURCE_GBO = WCMA.WORK_CENTER_BO
|
|
|
|
|
INNER JOIN WORK_CENTER WCB ON WCB.HANDLE = WCMB.WORK_CENTER_BO
|
|
|
|
|
INNER JOIN WORK_CENTER_T WCTB ON WCTB.WORK_CENTER_BO = WCB.HANDLE AND WCTB.LOCALE = 'zh'
|
|
|
|
|
LEFT JOIN CUSTOM_FIELDS CF ON CF.HANDLE = R.HANDLE AND CF."ATTRIBUTE" = 'CAPACITY_MAN_HOUR'
|
|
|
|
|
LEFT JOIN Z_REPORT_DATE_TIME ON 1=1
|
|
|
|
|
LEFT JOIN RESOURCE_TYPE_RESOURCE RTR ON RTR.RESOURCE_BO = R.HANDLE
|
|
|
|
|
LEFT JOIN RESOURCE_TYPE RT ON RT.HANDLE = RTR.RESOURCE_TYPE_BO
|
|
|
|
|
WHERE R.SITE = #{site}
|
|
|
|
|
<if test="center != null and center != ''" >
|
|
|
|
|
AND WCA.WORK_CENTER = #{center}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="workCenter != null and workCenter != ''" >
|
|
|
|
|
AND WCB.WORK_CENTER = #{workCenter}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="resrce != null and resrce != ''" >
|
|
|
|
|
AND R.RESRCE = #{resrce}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="resourceType != null and resourceType != ''" >
|
|
|
|
|
AND RT.RESOURCE_TYPE = #{resourceType}
|
|
|
|
|
</if>
|
|
|
|
|
) RDT
|
|
|
|
|
LEFT JOIN
|
|
|
|
|
(SELECT DATE_TIME ,RESRCE , SUM( ROUND((PLANNED_COMP_DATE - START_DATE_TIME)*24, 4) ) CNT FROM Z_REPORT_DATE_TIME
|
|
|
|
|
LEFT JOIN TEMP ON PLANNED_START_DATE < START_DATE_TIME AND PLANNED_COMP_DATE > START_DATE_TIME AND PLANNED_COMP_DATE < END_DATE_TIME
|
|
|
|
|
GROUP BY RESRCE , DATE_TIME ) A ON A.DATE_TIME = RDT.DATE_TIME AND A.RESRCE = RDT.RESRCE
|
|
|
|
|
LEFT JOIN
|
|
|
|
|
(SELECT DATE_TIME ,RESRCE , COUNT(*) * 24 CNT FROM Z_REPORT_DATE_TIME
|
|
|
|
|
LEFT JOIN TEMP ON PLANNED_START_DATE < START_DATE_TIME AND PLANNED_COMP_DATE > END_DATE_TIME
|
|
|
|
|
GROUP BY RESRCE , DATE_TIME ) B ON B.DATE_TIME = RDT.DATE_TIME AND B.RESRCE = RDT.RESRCE
|
|
|
|
|
LEFT JOIN
|
|
|
|
|
(SELECT DATE_TIME ,RESRCE , SUM( ROUND((PLANNED_COMP_DATE - PLANNED_START_DATE)*24 , 4) ) CNT FROM Z_REPORT_DATE_TIME
|
|
|
|
|
LEFT JOIN TEMP ON PLANNED_START_DATE > START_DATE_TIME AND PLANNED_COMP_DATE < END_DATE_TIME
|
|
|
|
|
GROUP BY RESRCE , DATE_TIME ) C ON C.DATE_TIME = RDT.DATE_TIME AND C.RESRCE = RDT.RESRCE
|
|
|
|
|
LEFT JOIN
|
|
|
|
|
(SELECT DATE_TIME ,RESRCE , SUM( ROUND((END_DATE_TIME - PLANNED_START_DATE)*24 , 4) ) CNT FROM Z_REPORT_DATE_TIME
|
|
|
|
|
LEFT JOIN TEMP ON PLANNED_START_DATE > START_DATE_TIME AND PLANNED_START_DATE < END_DATE_TIME AND PLANNED_COMP_DATE > END_DATE_TIME
|
|
|
|
|
GROUP BY RESRCE , DATE_TIME ) D ON D.DATE_TIME = RDT.DATE_TIME AND D.RESRCE = RDT.RESRCE
|
|
|
|
|
GROUP BY RDT.RESRCE, RDT.RESOURCE_DESCRIPTION, RDT.DATE_TIME ,RDT.CAPACITY_MAN_HOUR , RDT.CENTER ,RDT.CENTER_DESCRIPTION ,RDT.WORK_CENTER ,RDT.WORK_CENTER_DESCRIPTION ,RDT.RESOURCE_TYPE ,RDT.RESOURCE_TYPE_DESCRIPTION
|
|
|
|
|
ORDER BY RDT.WORK_CENTER ,RDT.RESRCE, RDT.DATE_TIME
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!--设备维修数据统计报表-->
|
|
|
|
@ -125,7 +178,32 @@
|
|
|
|
|
<if test="actualStartToDate != null and actualStartToDate != ''" >
|
|
|
|
|
AND ZSD.ACTUAL_COMPLETE_DATE <= TO_DATE(#{actualStartToDate}|| '15:59:59', 'YYYY-MM-DD HH24:MI:SS')
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!--清空日期表-->
|
|
|
|
|
<delete id="deleteAllReportDateTime">
|
|
|
|
|
DELETE FROM Z_REPORT_DATE_TIME
|
|
|
|
|
</delete>
|
|
|
|
|
<!--插入日期数据-->
|
|
|
|
|
<insert id="insertReportDateTime" >
|
|
|
|
|
INSERT INTO Z_REPORT_DATE_TIME (SITE,DATE_TIME,START_DATE_TIME,END_DATE_TIME)
|
|
|
|
|
<foreach collection="list" item="reportDateTime" index="index" open="(" separator=" union all " close=")" >
|
|
|
|
|
SELECT #{reportDateTime.site, jdbcType=NVARCHAR},
|
|
|
|
|
#{reportDateTime.dateTime, jdbcType=NVARCHAR},
|
|
|
|
|
#{reportDateTime.startDateTime, jdbcType=DATE},
|
|
|
|
|
#{reportDateTime.endDateTime, jdbcType=DATE}
|
|
|
|
|
FROM DUAL
|
|
|
|
|
</foreach>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<!---->
|
|
|
|
|
<insert id="insertReportDateTimeByStartToDate" >
|
|
|
|
|
INSERT INTO Z_REPORT_DATE_TIME
|
|
|
|
|
SELECT #{site} ,TO_CHAR(TO_DATE(#{startFromDate},'YYYY-MM-DD') + ROWNUM -1, 'YYYY-MM-DD') , TO_DATE(#{startFromDate} || '16:00:00','yyyy-mm-dd hh24:mi:ss') + rownum -2 ,
|
|
|
|
|
TO_DATE(#{startFromDate} || '16:00:00','yyyy-mm-dd hh24:mi:ss') + rownum -1
|
|
|
|
|
FROM dual CONNECT BY rownum <= to_date( #{startToDate}, 'yyyy-mm-dd') - to_date( #{startFromDate}, 'yyyy-mm-dd') + 1
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</mapper>
|