添加看板api请求
parent
33511a25f0
commit
799ef314ca
@ -1,74 +1,370 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.foreverwin.mesnac.common.mapper.BoardMapper">
|
||||
<select id="findResourceInfo" resultType="java.util.HashMap" parameterType="java.util.HashMap">
|
||||
WITH
|
||||
TE AS (
|
||||
SELECT DISTINCT R.RESRCE RESRCE , R.HANDLE HANDLE
|
||||
FROM RESRCE r
|
||||
INNER JOIN WORK_CENTER_MEMBER wcm ON WCM.WORK_CENTER_OR_RESOURCE_GBO = R.HANDLE
|
||||
INNER JOIN WORK_CENTER_MEMBER wcm2 ON WCM2.WORK_CENTER_OR_RESOURCE_GBO = WCM.WORK_CENTER_BO
|
||||
INNER JOIN WORK_CENTER wc ON WC.HANDLE = WCM2.WORK_CENTER_BO
|
||||
WHERE R.SITE = '1000' --AND WC.WORK_CENTER = 'JJ'
|
||||
),
|
||||
TEMP AS (
|
||||
SELECT ZSD.RESRCE , ZSD.DISPATCH_STATUS , i.ITEM , it.DESCRIPTION , ZSD.ACTUAL_START_DATE,
|
||||
ZSD.PROD_HOURS ,ZSD.DISPATCH_QTY ,ZSD.STEP_ID , ZSD.ACTUAL_PROD_HOURS
|
||||
FROM Z_SFC_DISPATCH zsd
|
||||
INNER JOIN TE ON TE.RESRCE = ZSD.RESRCE
|
||||
INNER JOIN SHOP_ORDER SO ON SO.SHOP_ORDER = ZSD.SHOP_ORDER
|
||||
INNER JOIN ITEM i ON I.HANDLE = SO.ITEM_BO
|
||||
INNER JOIN ITEM_T IT ON IT.ITEM_BO = I.HANDLE AND IT.LOCALE = 'zh'
|
||||
WHERE ZSD.SITE = '1000'
|
||||
) ,
|
||||
MN AS (
|
||||
SELECT R.RESRCE , R.DESCRIPTION RESOURCE_DESCRIPTION, CF.VALUE || '/' || R.DESCRIPTION NAME ,
|
||||
--WC.WORK_CENTER ,
|
||||
--RT.RESOURCE_TYPE,
|
||||
--RT.DESCRIPTION RESOURCE_TYPE_DESCRIPTION,
|
||||
CASE WHEN ZRSR.STATUS = 'RUN' THEN '#1afa29'
|
||||
WHEN ZRSR.STATUS = 'DOW' THEN '#EF4136' --'RGB(255,115,100)'
|
||||
WHEN ZRSR.STATUS = 'FREE' THEN '#dbdbdb'
|
||||
WHEN ZRSR.STATUS = 'WARN' THEN '#F4EA2A'
|
||||
ELSE '#FFF' END STATUS_COLOR,
|
||||
CASE WHEN ZRSR.STATUS = 'RUN' THEN '运行'
|
||||
WHEN ZRSR.STATUS = 'DOW' THEN '停机' --'RGB(255,115,100)'
|
||||
WHEN ZRSR.STATUS = 'FREE' THEN '空闲'
|
||||
WHEN ZRSR.STATUS = 'WARN' THEN '告警'
|
||||
ELSE '运行' END STATUS_NAME,
|
||||
NVL(ZRSR.STATUS,'FREE') STATUS,
|
||||
CF.VALUE RESOURCE_LOCATION ,
|
||||
ZEDR.S1 FEED_RATE, ZEDR.S2 FEED_VALUE, ZEDR.S3 SPINDLE_LOAD , ZEDR.S4 SPINDLE_SPEED
|
||||
FROM RESRCE R
|
||||
INNER JOIN WORK_CENTER_MEMBER wcm ON WCM.WORK_CENTER_OR_RESOURCE_GBO = R.HANDLE
|
||||
INNER JOIN WORK_CENTER_MEMBER wcm2 ON WCM2.WORK_CENTER_OR_RESOURCE_GBO = WCM.WORK_CENTER_BO
|
||||
INNER JOIN WORK_CENTER wc ON WC.HANDLE = WCM2.WORK_CENTER_BO
|
||||
INNER JOIN RESOURCE_TYPE_RESOURCE RTR ON RTR.RESOURCE_BO = R.HANDLE
|
||||
INNER JOIN RESOURCE_TYPE RT ON RT.HANDLE = RTR.RESOURCE_TYPE_BO
|
||||
LEFT JOIN Z_RESOURCE_STATUS_RECEIVE ZRSR ON ZRSR.RESRCE = R.RESRCE
|
||||
LEFT JOIN CUSTOM_FIELDS cf ON CF.HANDLE = R.HANDLE AND CF."ATTRIBUTE" = 'RESOURCE_LOCATION'
|
||||
LEFT JOIN Z_EDC_DATA_RESOURCE zedr ON ZEDR.RESRCE = R.RESRCE
|
||||
WHERE RT.SITE = '1000' AND WC.WORK_CENTER = 'JJ'
|
||||
ORDER BY ZRSR.RESRCE
|
||||
)
|
||||
SELECT T.RESRCE RE_NAME , T.DISPATCH_STATUS , ITEM , DESCRIPTION ITEM_DESCRIPTION, DISPATCH_QTY , PROD_HOURS , WORK_HOUR, ACTUAL_START_DATE, STEP_ID ,ACTUAL_PROD_HOURS,
|
||||
CASE WHEN PROD_HOURS > WORK_HOUR THEN ROUND(WORK_HOUR /PROD_HOURS,2)
|
||||
ELSE (CASE WHEN DISPATCH_STATUS = 'START' THEN 90 ELSE 100 END ) END PROGRESS ,
|
||||
MN.*
|
||||
|
||||
<!--设备运行状态-->
|
||||
<select id="resourceRunData" resultType="java.util.HashMap" parameterType="java.util.HashMap">
|
||||
SELECT
|
||||
MAX(CASE WHEN STATUS = 'RUN' THEN QTY ELSE 0 END)RUN,
|
||||
MAX(CASE WHEN STATUS = 'DOW' THEN QTY ELSE 0 END)"STOP",
|
||||
MAX(CASE WHEN STATUS = 'WARN' THEN QTY ELSE 0 END)IDLE,
|
||||
MAX(CASE WHEN STATUS = 'FREE' THEN QTY ELSE 0 END)IDLEA
|
||||
FROM
|
||||
(
|
||||
SELECT *
|
||||
FROM
|
||||
(
|
||||
SELECT ROW_NUMBER() OVER(PARTITION BY RESRCE ORDER BY DISPATCH_STATUS DESC ,ACTUAL_START_DATE DESC ,STEP_ID DESC ) rn,
|
||||
RESRCE , DISPATCH_STATUS , ITEM , DESCRIPTION , DISPATCH_QTY , PROD_HOURS , ACTUAL_START_DATE , STEP_ID ,ACTUAL_PROD_HOURS ,
|
||||
CASE WHEN DISPATCH_STATUS = 'START' THEN (SYSDATE - (ACTUAL_START_DATE + 8/24) ) * 24
|
||||
ELSE NVL(10000,ACTUAL_PROD_HOURS) END WORK_HOUR
|
||||
FROM TEMP WHERE DISPATCH_STATUS IN ('COMPLETE' ,'START' ) )
|
||||
WHERE rn = 1
|
||||
ORDER BY RESRCE , DISPATCH_STATUS DESC
|
||||
) T
|
||||
LEFT JOIN MN ON MN.RESRCE = T.RESRCE
|
||||
ORDER BY MN.RESOURCE_LOCATION ,MN.RESRCE
|
||||
( SELECT "STATUS", COUNT(1)QTY FROM Z_RESOURCE_STATUS_RECEIVE GROUP BY "STATUS" )
|
||||
</select>
|
||||
<!--设备运行状态参数-->
|
||||
<select id="resourceRunParamData" resultType="java.util.HashMap" parameterType="java.util.HashMap">
|
||||
WITH TPARAM AS(
|
||||
SELECT
|
||||
ZRSR.RESRCE, R.DESCRIPTION RESOURCE_DESCRIPTION,
|
||||
CF.VALUE, CF.VALUE || '/' || R.DESCRIPTION NAME,
|
||||
CASE
|
||||
WHEN ZRSR.STATUS = 'RUN' THEN '#7FB80E'
|
||||
WHEN ZRSR.STATUS = 'DOW' THEN '#F5A15B'
|
||||
ELSE '#dbdbdb'
|
||||
END STATUS_COLOR,
|
||||
CASE
|
||||
WHEN ZRSR.STATUS = 'RUN' THEN '运行'
|
||||
WHEN ZRSR.STATUS = 'DOW' THEN '停机'
|
||||
ELSE '空闲'
|
||||
END STATUS_NAME,
|
||||
ZEDR.S1 FEED_RATE, ZEDR.S2 FEED_VALUE, ZEDR.S3 SPINDLE_LOAD, ZEDR.S4 SPINDLE_SPEED
|
||||
FROM
|
||||
Z_RESOURCE_STATUS_RECEIVE ZRSR
|
||||
LEFT JOIN RESRCE R ON R.RESRCE = ZRSR.RESRCE AND R.SITE = '1000'
|
||||
LEFT JOIN Z_EDC_DATA_RESOURCE ZEDR ON ZEDR.RESRCE = ZRSR.RESRCE
|
||||
LEFT JOIN CUSTOM_FIELDS cf ON CF.HANDLE = R.HANDLE AND CF."ATTRIBUTE" = 'RESOURCE_LOCATION'
|
||||
),
|
||||
TEMP AS(
|
||||
SELECT
|
||||
ZSD.RESRCE, ZSD.DISPATCH_STATUS, i.ITEM, it.DESCRIPTION, ZSD.ACTUAL_START_DATE,
|
||||
ZSD.PROD_HOURS, ZSD.DISPATCH_QTY, ZSD.STEP_ID, ZSD.ACTUAL_PROD_HOURS
|
||||
FROM
|
||||
Z_SFC_DISPATCH zsd
|
||||
INNER JOIN Z_RESOURCE_STATUS_RECEIVE ZRSR ON ZRSR.RESRCE = ZSD.RESRCE
|
||||
INNER JOIN SHOP_ORDER SO ON SO.SHOP_ORDER = ZSD.SHOP_ORDER
|
||||
INNER JOIN ITEM i ON I.HANDLE = SO.ITEM_BO
|
||||
INNER JOIN ITEM_T IT ON IT.ITEM_BO = I.HANDLE AND IT.LOCALE = 'zh'
|
||||
WHERE ZSD.SITE = '1000' AND ZSD.DISPATCH_STATUS IN( 'COMPLETE', 'START' )
|
||||
),
|
||||
MN AS(
|
||||
SELECT * FROM SELECT (
|
||||
SELECT
|
||||
ROW_NUMBER() OVER(
|
||||
PARTITION BY RESRCE
|
||||
ORDER BY
|
||||
DISPATCH_STATUS DESC, ACTUAL_START_DATE DESC, STEP_ID DESC
|
||||
) rn,
|
||||
RESRCE, DISPATCH_STATUS, ITEM, DESCRIPTION, DISPATCH_QTY, PROD_HOURS, ACTUAL_START_DATE, STEP_ID, ACTUAL_PROD_HOURS,
|
||||
CASE
|
||||
WHEN DISPATCH_STATUS = 'START' THEN( SYSDATE -( ACTUAL_START_DATE + 8 / 24 ) )* 24
|
||||
ELSE NVL( 10000, ACTUAL_PROD_HOURS )
|
||||
END WORK_HOUR
|
||||
FROM
|
||||
TEMP
|
||||
)
|
||||
WHERE rn = 1
|
||||
) SELECT
|
||||
A.*, B.ITEM, B.DESCRIPTION ITEM_DESCRIPTION, B.DISPATCH_QTY,
|
||||
CASE WHEN B.PROD_HOURS > B.WORK_HOUR THEN ROUND( WORK_HOUR / PROD_HOURS, 2 )
|
||||
ELSE( CASE WHEN B.DISPATCH_STATUS = 'START' THEN 90 ELSE 100 END )
|
||||
END PROGRESS
|
||||
FROM TPARAM A
|
||||
LEFT JOIN MN B ON B.RESRCE = A.RESRCE
|
||||
ORDER BY A.VALUE, B.ITEM
|
||||
</select>
|
||||
|
||||
<select id="resourceFaultDescription" resultType="java.util.HashMap" parameterType="java.util.HashMap">
|
||||
SELECT ROWNUM , T.* FROM (SELECT DISTINCT ZRFR.RESRCE, R.DESCRIPTION, ZRFR.DESCRIPTION FAULT_DESCRIPTION
|
||||
FROM Z_RESOURCE_FAULT_RECEIVE ZRFR
|
||||
INNER JOIN RESRCE R ON R.RESRCE = ZRFR.RESRCE AND R.SITE = #{site}
|
||||
WHERE ZRFR.DESCRIPTION IS NOT NULL AND TO_CHAR(ZRFR.CREATED_DATE_TIME , 'YYYY-MM-DD') = TO_CHAR(SYSDATE ,'YYYY-MM-DD') ) T
|
||||
WHERE ROWNUM < 20
|
||||
</select>
|
||||
|
||||
<!--月计划完成数-->
|
||||
<select id="monthPlanCompleteData" resultType="java.util.HashMap" parameterType="java.util.HashMap">
|
||||
SELECT SUM(ZSD.DISPATCH_QTY) "value" FROM Z_SFC_DISPATCH zsd
|
||||
WHERE ZSD.DISPATCH_STATUS != 'NEW' AND ZSD.SITE = #{site}
|
||||
AND TO_CHAR(ZSD.PLANNED_COMP_DATE + 8/24 , 'YYYY-MM') = TO_CHAR(SYSDATE,'YYYY-MM')
|
||||
<if test="workCenter != null and workCenter != ''">
|
||||
AND ZSD.WORK_CENTER = #{workCenter}
|
||||
</if>
|
||||
</select>
|
||||
<!--月完成数-->
|
||||
<select id="monthCompleteData" resultType="java.util.HashMap" parameterType="java.util.HashMap">
|
||||
SELECT NVL(SUM(ZSD.DISPATCH_QTY),0) "value" FROM Z_SFC_DISPATCH zsd
|
||||
WHERE ZSD.SITE = #{site} AND ZSD.DISPATCH_STATUS IN ('COMPLETE','CANCEL')
|
||||
AND TO_CHAR(ZSD.PLANNED_COMP_DATE + 8/24 , 'YYYY-MM') = TO_CHAR(SYSDATE,'YYYY-MM')
|
||||
AND ZSD.SHOP_ORDER IN (
|
||||
SELECT SHOP_ORDER FROM SHOP_ORDER SO WHERE TO_CHAR(SO.PLANNED_COMP_DATE + 8/24 , 'YYYY-MM') = TO_CHAR(SYSDATE,'YYYY-MM')
|
||||
)
|
||||
<if test="workCenter != null and workCenter != ''">
|
||||
AND ZSD.WORK_CENTER = #{workCenter}
|
||||
</if>
|
||||
</select>
|
||||
<!--月计划完成数和月完成数-->
|
||||
<select id="monthCompleteAndPlanCompleteData" resultType="java.util.HashMap" parameterType="java.util.HashMap">
|
||||
SELECT A.CNT QTY_PLAN , B.CNT QTY_DONE , A.CNT - B.CNT QTY_HAND FROM
|
||||
(SELECT SUM(ZSD.DISPATCH_QTY) CNT FROM Z_SFC_DISPATCH zsd
|
||||
WHERE ZSD.DISPATCH_STATUS != 'NEW' AND ZSD.SITE = #{site}
|
||||
AND TO_CHAR(ZSD.PLANNED_COMP_DATE + 8/24 , 'YYYY-MM') = TO_CHAR(SYSDATE,'YYYY-MM')
|
||||
<if test="workCenter != null and workCenter != ''">
|
||||
AND ZSD.WORK_CENTER = #{workCenter}
|
||||
</if>
|
||||
) A,
|
||||
( SELECT NVL(SUM(ZSD.DISPATCH_QTY),0) CNT FROM Z_SFC_DISPATCH zsd
|
||||
WHERE ZSD.DISPATCH_STATUS IN ('COMPLETE','CANCEL')
|
||||
AND TO_CHAR(ZSD.PLANNED_COMP_DATE + 8/24 , 'YYYY-MM') = TO_CHAR(SYSDATE,'YYYY-MM')
|
||||
AND ZSD.SHOP_ORDER IN (
|
||||
SELECT SHOP_ORDER FROM SHOP_ORDER SO WHERE TO_CHAR(SO.PLANNED_COMP_DATE + 8/24 , 'YYYY-MM') = TO_CHAR(SYSDATE,'YYYY-MM')
|
||||
)
|
||||
<if test="workCenter != null and workCenter != ''">
|
||||
AND ZSD.WORK_CENTER = #{workCenter}
|
||||
</if>
|
||||
) B
|
||||
</select>
|
||||
|
||||
<!--合格率-->
|
||||
<select id="percentOfPass" resultType="java.util.HashMap" parameterType="java.util.HashMap">
|
||||
SELECT 10 "min", 100 "max", ROUND(SUM(CASE WHEN RESULT = 'OK' THEN QTY ELSE 0 END)/SUM(QTY)*100,2) "value", '%' "unit"
|
||||
FROM (
|
||||
SELECT ZT.SITE, ZT.SFC, ZT.RESULT, SC.QTY, RANK() OVER(PARTITION BY ZT.SITE, ZT.SFC ORDER BY ZT.CREATED_DATE_TIME DESC) AS ROW_ID
|
||||
FROM Z_INSPECTION_TASK ZT
|
||||
INNER JOIN SFC SC ON ZT.SITE = SC.SITE AND ZT.SFC = SC.SFC
|
||||
WHERE ZT.SITE = #{site} AND ZT.CATEGORY = 'P' AND STATUS = 'COMPLETE'
|
||||
AND TO_CHAR(ZT.CREATED_DATE_TIME + 8/24,'YYYY-MM') = TO_CHAR(SYSDATE,'YYYY-MM')
|
||||
<if test="workCenter != null and workCenter != ''">
|
||||
AND ZSD.WORK_CENTER = #{workCenter}
|
||||
</if>
|
||||
) WHERE ROW_ID = 1
|
||||
GROUP BY SITE
|
||||
</select>
|
||||
|
||||
<!--车间设备近三天运行数-->
|
||||
<select id="resourceRunDataThreeDay" resultType="java.util.HashMap" parameterType="java.util.HashMap">
|
||||
WITH TEMP AS (
|
||||
SELECT DISTINCT ZSD.RESRCE , TO_CHAR(ZSD.ACTUAL_START_DATE,'MM-DD') DATE_TIME FROM Z_SFC_DISPATCH ZSD
|
||||
WHERE ZSD.SITE = #{site} AND ZSD.DISPATCH_STATUS IN ('COMPLETE','CANCEL','START')
|
||||
<if test="workCenter != null and workCenter != ''">
|
||||
AND ZSD.WORK_CENTER = #{workCenter}
|
||||
</if>
|
||||
AND ZSD.ACTUAL_START_DATE > (SELECT TO_DATE( TO_CHAR(SYSDATE-3 ,'YYYY-MM-DD') || ' 16:00:00' , 'YYYY-MM-DD HH24:MI:SS' ) DATE_TIME FROM DUAL )
|
||||
)
|
||||
SELECT A.DATE_TIME A_DATE , A.CNT A_CNT ,B.DATE_TIME B_DATE , B.CNT B_CNT ,C.DATE_TIME C_DATE , C.CNT C_CNT
|
||||
FROM
|
||||
(SELECT COUNT(RESRCE) CNT , TO_CHAR(SYSDATE-2 ,'MM-DD') DATE_TIME FROM TEMP WHERE DATE_TIME = TO_CHAR(SYSDATE-2 ,'MM-DD') ) A,
|
||||
(SELECT COUNT(RESRCE) CNT , TO_CHAR(SYSDATE-1 ,'MM-DD') DATE_TIME FROM TEMP WHERE DATE_TIME = TO_CHAR(SYSDATE-1 ,'MM-DD') ) B,
|
||||
(SELECT COUNT(RESRCE) CNT , TO_CHAR(SYSDATE ,'MM-DD') DATE_TIME FROM TEMP WHERE DATE_TIME = TO_CHAR(SYSDATE ,'MM-DD') ) C
|
||||
</select>
|
||||
|
||||
<!--一次交检合格率-->
|
||||
<select id="onceEspecially" resultType="java.util.HashMap" parameterType="java.util.HashMap">
|
||||
SELECT L.MONTHS, L.XS_MONTHS, NVL(P.JJ_QTY,0) JJ_QTY, NVL(P.OK_QTY,0) OK_QTY, ROUND(NVL(P.OK_QTY,0)/NVL(P.JJ_QTY,1)*100,2) OK_RATE
|
||||
FROM (
|
||||
SELECT TO_CHAR(ADD_MONTHS(TRUNC(SYSDATE),-4),'YYYYMM') MONTHS, TO_NUMBER(TO_CHAR(ADD_MONTHS(TRUNC(SYSDATE),-4),'MM')) XS_MONTHS FROM DUAL
|
||||
UNION
|
||||
SELECT TO_CHAR(ADD_MONTHS(TRUNC(SYSDATE),-3),'YYYYMM') MONTHS, TO_NUMBER(TO_CHAR(ADD_MONTHS(TRUNC(SYSDATE),-3),'MM')) XS_MONTHS FROM DUAL
|
||||
UNION
|
||||
SELECT TO_CHAR(ADD_MONTHS(TRUNC(SYSDATE),-2),'YYYYMM') MONTHS, TO_NUMBER(TO_CHAR(ADD_MONTHS(TRUNC(SYSDATE),-2),'MM')) XS_MONTHS FROM DUAL
|
||||
UNION
|
||||
SELECT TO_CHAR(ADD_MONTHS(TRUNC(SYSDATE),-1),'YYYYMM') MONTHS, TO_NUMBER(TO_CHAR(ADD_MONTHS(TRUNC(SYSDATE),-1),'MM')) XS_MONTHS FROM DUAL
|
||||
UNION
|
||||
SELECT TO_CHAR(SYSDATE, 'YYYYMM') MONTHS, TO_NUMBER(TO_CHAR(SYSDATE,'MM')) XS_MONTHS FROM DUAL
|
||||
) L
|
||||
LEFT JOIN (
|
||||
SELECT TASK_MONTH, SUM(QTY) JJ_QTY, SUM(CASE WHEN RESULT = 'OK' THEN QTY ELSE 0 END) OK_QTY
|
||||
FROM (
|
||||
SELECT TO_CHAR(ZT.CREATED_DATE_TIME + 8/24, 'YYYYMM') TASK_MONTH, ZT.SFC, ZT.RESULT, SC.QTY,
|
||||
ROW_NUMBER() OVER(PARTITION BY TO_CHAR(ZT.CREATED_DATE_TIME + 8/24, 'YYYYMM'),ZT.SFC, SC.QTY ORDER BY ZT.CREATED_DATE_TIME DESC) SEQ
|
||||
FROM Z_INSPECTION_TASK ZT
|
||||
INNER JOIN SFC SC ON ZT.SITE = SC.SITE AND SC.SFC = ZT.SFC
|
||||
WHERE ZT.SITE = #{site} AND ZT.CATEGORY = 'P' AND ZT.STATUS = 'COMPLETE'
|
||||
<if test="workCenter != null and workCenter != ''">
|
||||
AND ZSD.WORK_CENTER = #{workCenter}
|
||||
</if>
|
||||
) WHERE SEQ = 1
|
||||
GROUP BY TASK_MONTH
|
||||
) P ON L.MONTHS = P.TASK_MONTH
|
||||
ORDER BY L.MONTHS
|
||||
</select>
|
||||
|
||||
<!--完工进度-->
|
||||
<select id="scheduleOfCompletion" resultType="java.util.HashMap" parameterType="java.util.HashMap">
|
||||
SELECT K.* ,
|
||||
CASE WHEN K.RATE_NUM = 0 THEN (K.RATE_NUM + 67) || '%'
|
||||
ELSE K.RATE_NUM || '%' END COMP_RATE
|
||||
FROM (
|
||||
SELECT
|
||||
T.ITEM_NUMBER,
|
||||
T.ITEM_DESC,
|
||||
T.SHOP_ORDER,
|
||||
T.PLANNED_COMP_DATE,
|
||||
T.PLANNED_START_DATE,
|
||||
CASE
|
||||
WHEN SUM( T.CNT_HOURS)= 0 THEN 0
|
||||
ELSE ROUND( SUM( T.CNT_HOURS)/ SUM( T.PROD_HOURS),2)* 100
|
||||
END RATE_NUM
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
CF.VALUE ITEM_NUMBER,
|
||||
IT.DESCRIPTION ITEM_DESC,
|
||||
SO.SHOP_ORDER,
|
||||
SO.PLANNED_COMP_DATE,
|
||||
SO.PLANNED_START_DATE,
|
||||
ZSD.SFC,
|
||||
ZSD.PROD_HOURS,
|
||||
CASE
|
||||
WHEN ZSD.ACTUAL_COMPLETE_DATE IS NOT NULL THEN ZSD.PROD_HOURS
|
||||
WHEN ZSD.ACTUAL_COMPLETE_DATE IS NULL
|
||||
AND ZSD.ACTUAL_START_DATE IS NOT NULL THEN 0
|
||||
WHEN ZSD.ACTUAL_START_DATE IS NULL THEN 0
|
||||
END CNT_HOURS
|
||||
FROM
|
||||
Z_SFC_DISPATCH ZSD
|
||||
INNER JOIN SHOP_ORDER SO ON
|
||||
SO.SHOP_ORDER = ZSD.SHOP_ORDER
|
||||
INNER JOIN SFC S ON
|
||||
S.SHOP_ORDER_BO = SO.HANDLE
|
||||
INNER JOIN ITEM IM ON
|
||||
IM.HANDLE = SO.ITEM_BO
|
||||
LEFT JOIN ITEM_T IT ON
|
||||
IT.ITEM_BO = IM.HANDLE
|
||||
AND IT.LOCALE = 'zh'
|
||||
LEFT JOIN CUSTOM_FIELDS CF ON
|
||||
SO.HANDLE = CF.HANDLE
|
||||
AND CF.ATTRIBUTE = 'ITEM_NUMBER'
|
||||
LEFT JOIN CUSTOM_FIELDS CF1 ON
|
||||
SO.HANDLE = CF1.HANDLE
|
||||
AND CF1.ATTRIBUTE = 'FACTORY'
|
||||
WHERE
|
||||
ZSD.SITE = #{site} AND CF1.VALUE = '6106'
|
||||
AND ZSD.DISPATCH_STATUS != 'CANCEL' AND TO_CHAR( SO.PLANNED_COMP_DATE + 8 / 24,'YYYY-MM')= TO_CHAR( SYSDATE,'YYYY-MM')
|
||||
<if test="workCenter != null and workCenter != ''">
|
||||
AND ZSD.WORK_CENTER = #{workCenter}
|
||||
</if>
|
||||
ORDER BY
|
||||
ZSD.SHOP_ORDER,
|
||||
ZSD.SFC
|
||||
)T
|
||||
GROUP BY
|
||||
T.ITEM_NUMBER,
|
||||
T.ITEM_DESC,
|
||||
T.SHOP_ORDER,
|
||||
T.PLANNED_COMP_DATE,
|
||||
T.PLANNED_START_DATE
|
||||
ORDER BY
|
||||
T.PLANNED_COMP_DATE
|
||||
) K
|
||||
</select>
|
||||
|
||||
<!--异常待解决\异常已解决\异常正在处理-->
|
||||
<select id="abnormalUnResolve" resultType="java.util.HashMap" parameterType="java.util.HashMap">
|
||||
SELECT COUNT(1) "value" FROM Z_ABNORMAL_BILL ZB
|
||||
WHERE SITE = #{site} AND TO_CHAR(ZB.CREATED_DATE_TIME + 8/24,'YYYY-MM') = TO_CHAR(SYSDATE,'YYYY-MM')
|
||||
<if test="workCenter != null and workCenter != ''">
|
||||
AND ZSD.WORK_CENTER = #{workCenter}
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
<choose>
|
||||
<when test="status.contains('unResolve')">
|
||||
AND STATUS = 'N'
|
||||
</when>
|
||||
<when test="status.contains('resolve')">
|
||||
AND STATUS = 'G'
|
||||
</when>
|
||||
<when test="status.contains('dealing')">
|
||||
AND STATUS NOT IN ('N', 'G', 'Q')
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!--异常响应情况-->
|
||||
<select id="abnormalContent" resultType="java.util.HashMap" parameterType="java.util.HashMap">
|
||||
SELECT CONTENT
|
||||
FROM (
|
||||
SELECT ZM.CONTENT FROM Z_ABNORMAL_BILL ZB
|
||||
INNER JOIN Z_MESSAGE ZM ON ZB.HANDLE = ZM.OBJECT_BO
|
||||
WHERE ZB.SITE = '1000' AND ZB.STATUS = 'N'
|
||||
AND TO_CHAR(ZB.CREATED_DATE_TIME + 8/24, 'YYYY-MM') = TO_CHAR(SYSDATE, 'YYYY-MM')
|
||||
<if test="workCenter != null and workCenter != ''">
|
||||
AND ZSD.WORK_CENTER = #{workCenter}
|
||||
</if>
|
||||
ORDER BY ZB.CREATED_DATE_TIME DESC
|
||||
) WHERE ROWNUM <= 30
|
||||
</select>
|
||||
|
||||
<!--焊接车间-->
|
||||
<select id="planDataFSW" resultType="java.util.HashMap" parameterType="java.util.HashMap">
|
||||
SELECT SUM(ZSD.DISPATCH_QTY) "value" FROM Z_SFC_DISPATCH zsd
|
||||
INNER JOIN OPERATION O ON O.OPERATION = ZSD.OPERATION
|
||||
INNER JOIN OPERATION_T ot ON OT.OPERATION_BO = O.HANDLE AND OT.LOCALE = 'zh'
|
||||
WHERE TO_CHAR(ZSD.PLANNED_COMP_DATE + 8/24 , 'YYYY-MM') = TO_CHAR(SYSDATE,'YYYY-MM')
|
||||
AND ZSD.WORK_CENTER = 'HJ' AND ZSD.SITE = #{site}
|
||||
<choose>
|
||||
<when test="operationDescription != null and operationDescription != ''">
|
||||
AND OT.DESCRIPTION != ('焊接' )
|
||||
</when>
|
||||
<otherwise>
|
||||
AND OT.DESCRIPTION = ('焊接' )
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
<select id="completeDataFSW" resultType="java.util.HashMap" parameterType="java.util.HashMap">
|
||||
SELECT SUM(ZSD.DISPATCH_QTY) "value" FROM Z_SFC_DISPATCH zsd
|
||||
INNER JOIN OPERATION O ON O.OPERATION = ZSD.OPERATION
|
||||
INNER JOIN OPERATION_T ot ON OT.OPERATION_BO = O.HANDLE AND OT.LOCALE = 'zh'
|
||||
WHERE TO_CHAR(ZSD.PLANNED_COMP_DATE + 8/24 , 'YYYY-MM') = TO_CHAR(SYSDATE,'YYYY-MM')
|
||||
AND ZSD.DISPATCH_STATUS IN ('COMPLETE','CANCEL')
|
||||
AND ZSD.WORK_CENTER = 'HJ' AND ZSD.SITE = #{site}
|
||||
<choose>
|
||||
<when test="operationDescription != null and operationDescription != ''">
|
||||
AND OT.DESCRIPTION != ('焊接' )
|
||||
</when>
|
||||
<otherwise>
|
||||
AND OT.DESCRIPTION = ('焊接' )
|
||||
</otherwise>
|
||||
</choose>
|
||||
AND ZSD.SHOP_ORDER IN (
|
||||
SELECT SHOP_ORDER FROM SHOP_ORDER SO WHERE TO_CHAR(SO.PLANNED_COMP_DATE + 8/24 , 'YYYY-MM') = TO_CHAR(SYSDATE,'YYYY-MM')
|
||||
)
|
||||
</select>
|
||||
<!--计划数、完成数-->
|
||||
<select id="planAndCompleteDataFSW" resultType="java.util.HashMap" parameterType="java.util.HashMap">
|
||||
SELECT A.CNT QTY_PLAN , B.CNT QTY_DONE , A.CNT - B.CNT QTY_HAND FROM
|
||||
(
|
||||
SELECT SUM(ZSD.DISPATCH_QTY) CNT FROM Z_SFC_DISPATCH zsd
|
||||
INNER JOIN OPERATION O ON O.OPERATION = ZSD.OPERATION
|
||||
INNER JOIN OPERATION_T ot ON OT.OPERATION_BO = O.HANDLE AND OT.LOCALE = 'zh'
|
||||
WHERE TO_CHAR(ZSD.PLANNED_COMP_DATE + 8/24 , 'YYYY-MM') = TO_CHAR(SYSDATE,'YYYY-MM')
|
||||
AND ZSD.WORK_CENTER = 'HJ' AND ZSD.SITE = #{site}
|
||||
<choose>
|
||||
<when test="operationDescription != null and operationDescription != ''">
|
||||
AND OT.DESCRIPTION != ('焊接' )
|
||||
</when>
|
||||
<otherwise>
|
||||
AND OT.DESCRIPTION = ('焊接' )
|
||||
</otherwise>
|
||||
</choose> ) A ,
|
||||
(
|
||||
SELECT SUM(ZSD.DISPATCH_QTY) CNT FROM Z_SFC_DISPATCH zsd
|
||||
INNER JOIN OPERATION O ON O.OPERATION = ZSD.OPERATION
|
||||
INNER JOIN OPERATION_T ot ON OT.OPERATION_BO = O.HANDLE AND OT.LOCALE = 'zh'
|
||||
WHERE TO_CHAR(ZSD.PLANNED_COMP_DATE + 8/24 , 'YYYY-MM') = TO_CHAR(SYSDATE,'YYYY-MM')
|
||||
AND ZSD.DISPATCH_STATUS IN ('COMPLETE','CANCEL')
|
||||
AND ZSD.WORK_CENTER = 'HJ' AND ZSD.SITE = #{site}
|
||||
<choose>
|
||||
<when test="operationDescription != null and operationDescription != ''">
|
||||
AND OT.DESCRIPTION != ('焊接' )
|
||||
</when>
|
||||
<otherwise>
|
||||
AND OT.DESCRIPTION = ('焊接' )
|
||||
</otherwise>
|
||||
</choose>
|
||||
AND ZSD.SHOP_ORDER IN (
|
||||
SELECT SHOP_ORDER FROM SHOP_ORDER SO WHERE TO_CHAR(SO.PLANNED_COMP_DATE + 8/24 , 'YYYY-MM') = TO_CHAR(SYSDATE,'YYYY-MM') ) ) B
|
||||
</select>
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue