|
|
|
@ -199,4 +199,70 @@
|
|
|
|
|
AND ZT.MODIFIED_DATE_TIME <= TO_DATE(#{startToDate}|| '23:59:59', 'YYYY-MM-DD HH24:MI:SS')
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="findQualityInspectionReport" resultType="map">
|
|
|
|
|
SELECT zab.CREATED_DATE_TIME CREATED_DATE_TIME,zab.ABNORMAL_NO ABNORMAL_NO,
|
|
|
|
|
zab.PRODUCT_CATEGORY PRODUCT_CATEGORY,
|
|
|
|
|
CASE WHEN zab.DISCOVER = 'Z' THEN '自制'
|
|
|
|
|
WHEN zab.DISCOVER = 'W' THEN '外协'
|
|
|
|
|
WHEN zab.DISCOVER = 'D' THEN '到货'
|
|
|
|
|
WHEN zab.DISCOVER = 'K' THEN '客户'
|
|
|
|
|
ELSE ''
|
|
|
|
|
END DISCOVER ,
|
|
|
|
|
i.ITEM ITEM ,it.DESCRIPTION ITEM_DESCRIPTION,itemNumber.VALUE ITEM_NUMBER,
|
|
|
|
|
mapNo.VALUE MAP_NO,zab.PB_DESCRIPTION PB_DESCRIPTION,zsd.EMPLOYEE_DESCRIPTION OPERATOR,
|
|
|
|
|
CASE WHEN zab."TYPE" = 'Z' THEN '质量异常'
|
|
|
|
|
WHEN zab."TYPE" = 'Q' THEN '其他异常'
|
|
|
|
|
WHEN zab."TYPE" = 'S' THEN '设备异常' END "TYPE",
|
|
|
|
|
|
|
|
|
|
zab.REPORT_SEND_USER_GROUP INSPECTOR ,
|
|
|
|
|
zab.PB_GRADE PB_GRADE ,
|
|
|
|
|
zabd.PRINCIPAL_USER PRINCIPAL_USER,
|
|
|
|
|
LISTAGG(nct.DESCRIPTION , ';') WITHIN GROUP(ORDER BY zab.ABNORMAL_NO) NC_CODE_DESCRIPTION,
|
|
|
|
|
zabd.DUTY_CAUSE_DESCRIPTION DUTY_CAUSE_DESCRIPTION,zabd.BEFORE_MEASURE BEFORE_MEASURE,
|
|
|
|
|
CASE WHEN zabd.ABNORMAL_METHOD = 'X' THEN '线下换料'
|
|
|
|
|
WHEN zabd.ABNORMAL_METHOD = 'S' THEN '试装'
|
|
|
|
|
WHEN zabd.ABNORMAL_METHOD = 'R' THEN '让步放心'
|
|
|
|
|
WHEN zabd.ABNORMAL_METHOD = 'C' THEN '报废'
|
|
|
|
|
WHEN zabd.ABNORMAL_METHOD = 'P' THEN '配作'
|
|
|
|
|
WHEN zabd.ABNORMAL_METHOD = 'F' THEN '返修'
|
|
|
|
|
ELSE ''
|
|
|
|
|
END ABNORMAL_METHOD,zabd.RESOLVE_REMARK RESOLVE_REMARK,zabd.RESOLVE_USER RESOLVE_USER,
|
|
|
|
|
zabd.CLOSED_DATE_TIME CLOSED_DATE_TIME,zab.NC_QTY NC_QTY,zab.PB_QTY PB_QTY,
|
|
|
|
|
CASE WHEN (zabd.ABNORMAL_METHOD ='F' AND zab.SHOP_ORDER IS NOT NULL) THEN TO_CHAR(so.QTY_TO_BUILD,'9999')
|
|
|
|
|
WHEN zabd.ABNORMAL_METHOD = 'F' THEN TO_CHAR(zab.PB_QTY,'9999') ELSE '' END NUMBERS,
|
|
|
|
|
zsd.EMPLOYEE_DESCRIPTION DISPATCH_USER ,ot.DESCRIPTION OPERATION ,
|
|
|
|
|
r2.RESRCE RESRCE,r2.DESCRIPTION RESRCE_DESCRIPTION,zsd.RESOURCE_TYPE RESOURCE_TYPE,rt.DESCRIPTION RESOURCE_TYPE_DESCRIPTION
|
|
|
|
|
FROM Z_ABNORMAL_BILL zab
|
|
|
|
|
INNER JOIN Z_ABNORMAL_BILL_DISPOSE zabd ON zab.HANDLE = zabd.ABNORMAL_BILL_BO
|
|
|
|
|
LEFT JOIN Z_ABNORMAL_NC_CODE zanc ON zab.HANDLE = zanc.ABNORMAL_BILL_BO
|
|
|
|
|
LEFT JOIN NC_CODE nc ON zanc.NC_CODE = nc.NC_CODE AND nc.SITE = zab.SITE
|
|
|
|
|
LEFT JOIN NC_CODE_T nct ON nct.NC_CODE_BO = nc.HANDLE AND nct.LOCALE = #{locale}
|
|
|
|
|
INNER JOIN ITEM i ON i.HANDLE = zab.ITEM_BO
|
|
|
|
|
LEFT JOIN ITEM_T it ON it.ITEM_BO = i.HANDLE AND it.LOCALE = #{locale}
|
|
|
|
|
LEFT JOIN CUSTOM_FIELDS mapNo ON mapNo."ATTRIBUTE" = 'DWG_NO' AND mapNo.HANDLE = i.HANDLE
|
|
|
|
|
LEFT JOIN SHOP_ORDER so ON so.SHOP_ORDER = zab.SHOP_ORDER AND so.SITE = zab.SITE
|
|
|
|
|
LEFT JOIN ROUTER r ON r.HANDLE = zabd.ROUTER_BO
|
|
|
|
|
LEFT JOIN CUSTOM_FIELDS itemNumber ON itemNumber.HANDLE = so.HANDLE AND itemNumber."ATTRIBUTE" = 'ITEM_NUMBER'
|
|
|
|
|
LEFT JOIN SFC s ON s.SFC = zab.SFC AND s.SITE = zab.SITE
|
|
|
|
|
LEFT JOIN SFC_ROUTING SR ON SR.SFC_BO = S.HANDLE
|
|
|
|
|
LEFT JOIN SFC_ROUTER ST ON ST.SFC_ROUTING_BO = SR.HANDLE
|
|
|
|
|
LEFT JOIN SFC_STEP SS ON SS.SFC_ROUTER_BO = ST.HANDLE AND (SS.QTY_IN_QUEUE > 0 OR SS.QTY_IN_WORK > 0)
|
|
|
|
|
LEFT JOIN Z_SFC_DISPATCH zsd ON zsd.DISPATCH_NO = S.SFC || '-' || SS.STEP_ID
|
|
|
|
|
LEFT JOIN OPERATION o ON o.OPERATION = zsd.OPERATION AND o.SITE = zab.SITE AND o.CURRENT_REVISION ='true'
|
|
|
|
|
LEFT JOIN OPERATION_T ot ON ot.OPERATION_BO = o.HANDLE AND ot.LOCALE = #{locale}
|
|
|
|
|
LEFT JOIN RESRCE r2 ON r2.RESRCE = zsd.RESRCE AND r2.SITE = zab.SITE
|
|
|
|
|
LEFT JOIN RESOURCE_TYPE rt ON rt.RESOURCE_TYPE = zsd.RESOURCE_TYPE AND rt.SITE = zab.SITE
|
|
|
|
|
WHERE zab."TYPE" ='Z'
|
|
|
|
|
GROUP BY zab.CREATED_DATE_TIME ,zab.ABNORMAL_NO ,
|
|
|
|
|
i.ITEM ,it.DESCRIPTION ,itemNumber.VALUE ,
|
|
|
|
|
mapNo.VALUE ,zab.PB_DESCRIPTION ,zsd.EMPLOYEE_DESCRIPTION ,
|
|
|
|
|
zab."TYPE" ,zab.REPORT_SEND_USER_GROUP ,zabd.DUTY_DEPART ,zabd.PRINCIPAL_USER,DISCOVER ,
|
|
|
|
|
zab.PB_GRADE,zabd.DUTY_CAUSE_DESCRIPTION ,zabd.BEFORE_MEASURE,ABNORMAL_METHOD,
|
|
|
|
|
zabd.RESOLVE_REMARK ,zabd.RESOLVE_USER ,
|
|
|
|
|
zabd.CLOSED_DATE_TIME ,zab.NC_QTY ,zab.PB_QTY ,zab.SHOP_ORDER,so.QTY_TO_BUILD,
|
|
|
|
|
zsd.EMPLOYEE_DESCRIPTION ,ot.DESCRIPTION ,
|
|
|
|
|
r2.RESRCE,r2.DESCRIPTION,zsd.RESOURCE_TYPE,
|
|
|
|
|
rt.DESCRIPTION,zab.PRODUCT_CATEGORY
|
|
|
|
|
</select>
|
|
|
|
|
</mapper>
|