|
|
|
@ -1492,4 +1492,66 @@
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
<select id="weekLoadRateReport" resultType="java.util.HashMap" parameterType="java.util.HashMap">
|
|
|
|
|
--资源负荷率报表(周维度)
|
|
|
|
|
SELECT CF.VALUE "weekCapacity",WIP.* FROM (WITH WEEK AS (
|
|
|
|
|
SELECT TRUNC(TO_DATE(TO_CHAR(sysdate, 'yyyy-MM-dd'), 'yyyy-MM-dd'), 'IW') WEEK0,
|
|
|
|
|
TRUNC(TO_DATE(TO_CHAR(sysdate, 'yyyy-MM-dd'), 'yyyy-MM-dd'), 'IW') + 7 * 1 WEEK1,
|
|
|
|
|
TRUNC(TO_DATE(TO_CHAR(sysdate, 'yyyy-MM-dd'), 'yyyy-MM-dd'), 'IW') + 7 * 2 WEEK2,
|
|
|
|
|
TRUNC(TO_DATE(TO_CHAR(sysdate, 'yyyy-MM-dd'), 'yyyy-MM-dd'), 'IW') + 7 * 3 WEEK3,
|
|
|
|
|
TRUNC(TO_DATE(TO_CHAR(sysdate, 'yyyy-MM-dd'), 'yyyy-MM-dd'), 'IW') + 7 * 4 WEEK4,
|
|
|
|
|
TRUNC(TO_DATE(TO_CHAR(sysdate, 'yyyy-MM-dd'), 'yyyy-MM-dd'), 'IW') + 7 * 5 WEEK5,
|
|
|
|
|
TRUNC(TO_DATE(TO_CHAR(sysdate, 'yyyy-MM-dd'), 'yyyy-MM-dd'), 'IW') + 7 * 6 WEEK6,
|
|
|
|
|
TRUNC(TO_DATE(TO_CHAR(sysdate, 'yyyy-MM-dd'), 'yyyy-MM-dd'), 'IW') + 7 * 7 WEEK7,
|
|
|
|
|
TRUNC(TO_DATE(TO_CHAR(sysdate, 'yyyy-MM-dd'), 'yyyy-MM-dd'), 'IW') + 7 * 8 WEEK8
|
|
|
|
|
FROM DUAL)
|
|
|
|
|
SELECT ZSD.OPERATION "operation",
|
|
|
|
|
R.DESCRIPTION "resourceDescription",
|
|
|
|
|
SUM(CASE
|
|
|
|
|
WHEN SYSDATE > ZSD.PLANNED_COMP_DATE THEN ZSD.DISPATCH_QTY * ZSD.PROD_HOURS ELSE 0 END) "tardinessWork",
|
|
|
|
|
SUM(CASE
|
|
|
|
|
WHEN ZSD.PLANNED_COMP_DATE >= TO_DATE(WEEK.WEEK0) AND ZSD.PLANNED_COMP_DATE <= TO_DATE(WEEK.WEEK1)
|
|
|
|
|
THEN ZSD.DISPATCH_QTY * ZSD.PROD_HOURS ELSE 0 END) "unWorkHours1",
|
|
|
|
|
SUM(CASE
|
|
|
|
|
WHEN ZSD.PLANNED_COMP_DATE >= TO_DATE(WEEK.WEEK1) AND ZSD.PLANNED_COMP_DATE <= TO_DATE(WEEK.WEEK2)
|
|
|
|
|
THEN ZSD.DISPATCH_QTY * ZSD.PROD_HOURS ELSE 0 END) "unWorkHours2",
|
|
|
|
|
SUM(CASE
|
|
|
|
|
WHEN ZSD.PLANNED_COMP_DATE >= TO_DATE(WEEK.WEEK2) AND ZSD.PLANNED_COMP_DATE <= TO_DATE(WEEK.WEEK3)
|
|
|
|
|
THEN ZSD.DISPATCH_QTY * ZSD.PROD_HOURS ELSE 0 END) "unWorkHours3",
|
|
|
|
|
SUM(CASE
|
|
|
|
|
WHEN ZSD.PLANNED_COMP_DATE >= TO_DATE(WEEK.WEEK3) AND ZSD.PLANNED_COMP_DATE <= TO_DATE(WEEK.WEEK4)
|
|
|
|
|
THEN ZSD.DISPATCH_QTY * ZSD.PROD_HOURS ELSE 0 END) "unWorkHours4",
|
|
|
|
|
SUM(CASE
|
|
|
|
|
WHEN ZSD.PLANNED_COMP_DATE >= TO_DATE(WEEK.WEEK4) AND ZSD.PLANNED_COMP_DATE <= TO_DATE(WEEK.WEEK5)
|
|
|
|
|
THEN ZSD.DISPATCH_QTY * ZSD.PROD_HOURS ELSE 0 END) "unWorkHours5",
|
|
|
|
|
SUM(CASE
|
|
|
|
|
WHEN ZSD.PLANNED_COMP_DATE >= TO_DATE(WEEK.WEEK5) AND ZSD.PLANNED_COMP_DATE <= TO_DATE(WEEK.WEEK6)
|
|
|
|
|
THEN ZSD.DISPATCH_QTY * ZSD.PROD_HOURS ELSE 0 END) "unWorkHours6",
|
|
|
|
|
SUM(CASE
|
|
|
|
|
WHEN ZSD.PLANNED_COMP_DATE >= TO_DATE(WEEK.WEEK6) AND ZSD.PLANNED_COMP_DATE <= TO_DATE(WEEK.WEEK7)
|
|
|
|
|
THEN ZSD.DISPATCH_QTY * ZSD.PROD_HOURS ELSE 0 END) "unWorkHours7",
|
|
|
|
|
SUM(CASE
|
|
|
|
|
WHEN ZSD.PLANNED_COMP_DATE >= TO_DATE(WEEK.WEEK7) AND ZSD.PLANNED_COMP_DATE <= TO_DATE(WEEK.WEEK8)
|
|
|
|
|
THEN ZSD.DISPATCH_QTY * ZSD.PROD_HOURS ELSE 0 END) "unWorkHours8",
|
|
|
|
|
R.RESRCE
|
|
|
|
|
FROM Z_SFC_DISPATCH ZSD
|
|
|
|
|
LEFT JOIN RESRCE R ON R.SITE = ZSD.SITE AND R.RESRCE = ZSD.RESRCE
|
|
|
|
|
CROSS JOIN WEEK
|
|
|
|
|
WHERE (ZSD.DISPATCH_STATUS != 'COMPLETE' AND ZSD.DISPATCH_STATUS != 'CANCEL' AND ZSD.DISPATCH_STATUS != 'PAUSE')
|
|
|
|
|
AND R.DESCRIPTION IS NOT NULL
|
|
|
|
|
AND ZSD.PLANNED_COMP_DATE IS NOT NULL
|
|
|
|
|
-- AND ZSD.CREATED_DATE_TIME > TO_DATE(TRUNC(TO_DATE(to_char(sysdate,'yyyy-MM-dd'),'yyyy-MM-dd'),'IW') - 8 * 7)
|
|
|
|
|
GROUP BY ZSD.OPERATION, R.DESCRIPTION,R.RESRCE
|
|
|
|
|
ORDER BY "tardinessWork" DESC) WIP
|
|
|
|
|
LEFT JOIN CUSTOM_FIELDS CF ON CF.ATTRIBUTE ='WEEK_CAPACITY' AND CF.HANDLE = 'ResourceBO:'|| #{site} || ','|| WIP.RESRCE
|
|
|
|
|
<where>
|
|
|
|
|
1=1
|
|
|
|
|
<if test="operation != null and operation != ''">
|
|
|
|
|
AND WIP."operation" = #{operation}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="resourceDescription != null and resourceDescription != ''">
|
|
|
|
|
AND WIP."resourceDescription" = #{resourceDescription}
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
</mapper>
|