update 工时看板 数据

master
yinq 2 years ago
parent 1aec767ea7
commit 273e6bfdaf

@ -2785,30 +2785,32 @@ SELECT zab.CREATED_DATE_TIME,
<select id="workHoursCompletedBusinessUnit" resultType="java.util.Map" parameterType="java.util.HashMap">
-- 事业部完工工时占比(双环形图)
SELECT WIP."shortHandWorkOrder" "workOrder",
SUM(WIP."workHours") "workHours"
SUM(WIP."workHours") "workHours"
FROM (SELECT cf2.VALUE "workOrder",
CASE
WHEN INSTR(cf2.VALUE, '硫化') > 0 THEN '硫化'
WHEN INSTR(cf2.VALUE, '全钢') > 0 THEN '全钢'
WHEN INSTR(cf2.VALUE, '半钢') > 0 THEN '半钢'
WHEN INSTR(cf2.VALUE, '鼓') > 0 THEN '鼓'
WHEN INSTR(cf2.VALUE, '裁断') > 0 THEN '裁断'
WHEN INSTR(cf2.VALUE, '检测') > 0 THEN '检测'
WHEN INSTR(cf2.VALUE, '橡塑') > 0 THEN '橡塑'
WHEN INSTR(cf2.VALUE, '非公路') > 0 THEN '非公路'
WHEN INSTR(cf2.VALUE, '研究院') > 0 THEN '研究院'
WHEN INSTR(cf2.VALUE, '粉体') > 0 THEN '粉体'
ELSE '其他' END "shortHandWorkOrder",
SUM(CASE
WHEN ZSD.DISPATCH_STATUS = 'COMPLETE'
THEN ZSD.DISPATCH_QTY * ZSD.PROD_HOURS
ELSE 0 END) "workHours"
FROM Z_SFC_DISPATCH ZSD
LEFT JOIN SHOP_ORDER so ON so.SHOP_ORDER = zsd.SHOP_ORDER AND so.SITE = zsd.SITE
LEFT JOIN CUSTOM_FIELDS cf2 ON cf2.HANDLE = so.HANDLE AND cf2."ATTRIBUTE" = 'WORK_ORDER'
WHERE cf2.VALUE IS NOT NULL
GROUP BY cf2.VALUE
) WIP
CASE
WHEN INSTR(cf2.VALUE, '硫化') > 0 THEN '硫化'
WHEN INSTR(cf2.VALUE, '全钢') > 0 THEN '全钢'
WHEN INSTR(cf2.VALUE, '半钢') > 0 THEN '半钢'
WHEN INSTR(cf2.VALUE, '鼓') > 0 THEN '鼓'
WHEN INSTR(cf2.VALUE, '裁断') > 0 THEN '裁断'
WHEN INSTR(cf2.VALUE, '检测') > 0 THEN '检测'
WHEN INSTR(cf2.VALUE, '橡塑') > 0 THEN '橡塑'
WHEN INSTR(cf2.VALUE, '非公路') > 0 THEN '非公路'
WHEN INSTR(cf2.VALUE, '研究院') > 0 THEN '研究院'
WHEN INSTR(cf2.VALUE, '粉体') > 0 THEN '粉体'
ELSE '其他' END "shortHandWorkOrder",
SUM(CASE
WHEN ZSD.DISPATCH_STATUS = 'COMPLETE' AND
(ZSD.ACTUAL_COMPLETE_DATE + 8 / 24) >= trunc(sysdate, 'yyyy') AND
(ZSD.ACTUAL_COMPLETE_DATE + 8 / 24) &lt;= last_day(add_months(trunc(SYSDATE, 'y'), 11))
THEN ZSD.DISPATCH_QTY * ZSD.PROD_HOURS
ELSE 0 END) "workHours"
FROM Z_SFC_DISPATCH ZSD
LEFT JOIN SHOP_ORDER so ON so.SHOP_ORDER = zsd.SHOP_ORDER AND so.SITE = zsd.SITE
LEFT JOIN CUSTOM_FIELDS cf2 ON cf2.HANDLE = so.HANDLE AND cf2."ATTRIBUTE" = 'WORK_ORDER'
WHERE cf2.VALUE IS NOT NULL
GROUP BY cf2.VALUE
) WIP
GROUP BY WIP."shortHandWorkOrder"
ORDER BY WIP."shortHandWorkOrder"
</select>
@ -3292,7 +3294,7 @@ SELECT zab.CREATED_DATE_TIME,
</select>
<select id="totalWorkingHoursCompletedThisYear" resultType="java.util.Map">
WITH M_MONTH AS (
SELECT TO_CHAR(ADD_MONTHS(TRUNC(last_day(add_months(trunc(SYSDATE, 'y'), 11))), + ROWNUM - 24), 'yyyy-MM') MONTH
SELECT TO_CHAR(ADD_MONTHS(TRUNC(last_day(add_months(trunc(SYSDATE, 'y'), 11))), + ROWNUM - 12), 'yyyy-MM') MONTH
FROM DUAL
CONNECT BY 12 >= ROWNUM)
SELECT SUBSTR(M_MONTH.MONTH, 6) || '月' MONTH_MONTH,
@ -3301,7 +3303,7 @@ SELECT zab.CREATED_DATE_TIME,
ZSD.DISPATCH_QTY * ZSD.PROD_HOURS
ELSE 0 END, 2)) QTY,
SUM(ROUND(CASE
WHEN M_MONTH.MONTH = TO_CHAR(ZSD.PLANNED_START_DATE + 8 / 24, 'yyyy-mm') THEN
WHEN M_MONTH.MONTH = TO_CHAR(ZSD.PLANNED_COMP_DATE + 8 / 24, 'yyyy-mm') THEN
ZSD.DISPATCH_QTY * ZSD.PROD_HOURS
ELSE 0 END, 2)) PLAN_QTY
FROM Z_SFC_DISPATCH ZSD

Loading…
Cancel
Save