|
|
|
<?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.anomaly.mapper.ReportMapper">
|
|
|
|
|
|
|
|
<select id="findIntegrationLog" resultType="map">
|
|
|
|
SELECT INTEGRATION_TYPE, CATEGORY, INTEGRATION_WAY,STATUS,REQUEST_DATE_TIME,TO_CHAR(RESULT_MESSAGE) RESULT_MESSAGE,TO_CHAR(PARAM) PARAM
|
|
|
|
FROM Z_INTEGRATION_LOG
|
|
|
|
<where>
|
|
|
|
SITE = #{integration.site}
|
|
|
|
<if test="integration.integrationType != null and integration.integrationType != ''">
|
|
|
|
AND INTEGRATION_TYPE = #{integration.integrationType}
|
|
|
|
</if>
|
|
|
|
<if test="integration.integrationWay != null and integration.integrationWay != ''">
|
|
|
|
AND INTEGRATION_WAY = #{integration.integrationWay}
|
|
|
|
</if>
|
|
|
|
<if test="integration.status != null and integration.status != ''">
|
|
|
|
AND STATUS = #{integration.status}
|
|
|
|
</if>
|
|
|
|
<if test="integration.startDateTime != null">
|
|
|
|
AND REQUEST_DATE_TIME >= #{integration.startDateTime}
|
|
|
|
</if>
|
|
|
|
<if test="integration.endDateTime != null">
|
|
|
|
AND REQUEST_DATE_TIME <= #{integration.endDateTime}
|
|
|
|
</if>
|
|
|
|
<if test="integration.param != null and integration.param != ''">
|
|
|
|
AND PARAM LIKE '%${integration.param}%'
|
|
|
|
</if>
|
|
|
|
</where>
|
|
|
|
ORDER BY REQUEST_DATE_TIME DESC
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="partsManufacturing" resultType="Map">
|
|
|
|
SELECT CF.VALUE ITEM_NUMBER,ZSD.SHOP_ORDER SHOP_ORDER,I.ITEM ITEM,IT.DESCRIPTION ITEM_DESCRIPTION,SO.QTY_TO_BUILD SHOP_ORDER_QTY , ZSD.OPERATION ,OT.DESCRIPTION OPERATION_DESCRIPTION,
|
|
|
|
ZNU.FULL_NAME OPERATION_USER,ZSD.SFC SFC,ZSD.DISPATCH_STATUS ,
|
|
|
|
ZSD.EARLIEST_START_DATE EARLIEST_START_DATE,ZSD.LATEST_END_DATE LATEST_END_DATE,
|
|
|
|
ZSD.ACTUAL_START_DATE ACTUAL_START_DATE,ZSD.ACTUAL_COMPLETE_DATE ACTUAL_COMPLETE_DATE
|
|
|
|
FROM SFC S
|
|
|
|
INNER JOIN SHOP_ORDER SO ON SO.HANDLE = S.SHOP_ORDER_BO
|
|
|
|
INNER JOIN ITEM I ON I.HANDLE = SO.ITEM_BO
|
|
|
|
LEFT JOIN ITEM_T IT ON IT.ITEM_BO = I.HANDLE AND IT.LOCALE = #{locale}
|
|
|
|
INNER JOIN Z_SFC_DISPATCH ZSD ON S.SFC = ZSD.SFC AND S.SITE = ZSD.SITE
|
|
|
|
AND ZSD.DISPATCH_SEQ = (
|
|
|
|
SELECT MAX(ZSD2.DISPATCH_SEQ) FROM Z_SFC_DISPATCH ZSD2 WHERE S.SFC = ZSD2.SFC AND S.SITE = ZSD2.SITE
|
|
|
|
)
|
|
|
|
INNER JOIN OPERATION O ON O.OPERATION = ZSD.OPERATION AND O.SITE = S.SITE AND O.CURRENT_REVISION = 'true'
|
|
|
|
INNER JOIN OPERATION_T OT ON OT.OPERATION_BO = O.HANDLE AND OT.LOCALE = #{locale}
|
|
|
|
INNER JOIN Z_NWA_USER ZNU ON ZNU.USER_NAME = ZSD.EMPLOYEE
|
|
|
|
LEFT JOIN CUSTOM_FIELDS CF ON CF.HANDLE = S.SHOP_ORDER_BO AND CF."ATTRIBUTE" = 'ITEM_NUMBER'
|
|
|
|
<where>
|
|
|
|
S.SITE = #{site}
|
|
|
|
<if test="partsManufacturing != null">
|
|
|
|
<if test="partsManufacturing.itemNumber != null and partsManufacturing.itemNumber != ''">
|
|
|
|
AND CF.VALUE LIKE '%${partsManufacturing.itemNumber}%'
|
|
|
|
</if>
|
|
|
|
<if test="partsManufacturing.shopOrder != null and partsManufacturing.shopOrder != ''">
|
|
|
|
AND ZSD.SHOP_ORDER LIKE '%${partsManufacturing.shopOrder}%'
|
|
|
|
</if>
|
|
|
|
<if test="partsManufacturing.item != null and partsManufacturing.item != ''">
|
|
|
|
AND I.ITEM LIKE '%${partsManufacturing.item}%'
|
|
|
|
</if>
|
|
|
|
<if test="partsManufacturing.itemDescription != null and partsManufacturing.itemDescription != ''">
|
|
|
|
AND IT.DESCRIPTION LIKE '%${partsManufacturing.itemDescription}%'
|
|
|
|
</if>
|
|
|
|
<if test="partsManufacturing.startDateTime != null">
|
|
|
|
AND ZSD.ACTUAL_START_DATE >= #{partsManufacturing.startDateTime}
|
|
|
|
</if>
|
|
|
|
<if test="partsManufacturing.endDateTime != null">
|
|
|
|
AND ZSD.ACTUAL_COMPLETE_DATE <= #{partsManufacturing.endDateTime}
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
</where>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="surplusReturnTable" resultType="map">
|
|
|
|
SELECT ZSR.INVENTORY INVENTORY,ZSR.ITEM_BO ITEM_BO,IT.DESCRIPTION ITEM_DESCRIPTION,ZSR.LENGHT LENGHT,
|
|
|
|
ZSR.WIDTH WIDTH,ZSR.NUMBERS NUMBERS,ZSR.QTY QTY,ZSR.CREATED_DATE_TIME CREATED_DATE_TIME
|
|
|
|
FROM
|
|
|
|
Z_SURPLUS_RETURN ZSR
|
|
|
|
INNER JOIN ITEM I ON I.HANDLE = ZSR.ITEM_BO
|
|
|
|
INNER JOIN ITEM_T IT ON IT.ITEM_BO = I.HANDLE
|
|
|
|
<where>
|
|
|
|
ZSR.SITE = #{site}
|
|
|
|
<if test="item != null and item != ''">
|
|
|
|
AND I.ITEM LIKE '%${item}%'
|
|
|
|
</if>
|
|
|
|
<if test="itemDescription != null and itemDescription != ''">
|
|
|
|
AND IT.DESCRIPTION LIKE '%${itemDescription}%'
|
|
|
|
</if>
|
|
|
|
</where>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="resourceRepair" resultType="map">
|
|
|
|
SELECT
|
|
|
|
ZRRT.HANDLE HANDLE,
|
|
|
|
CASE WHEN WC2.WORK_CENTER != 'NULL' THEN WC2.WORK_CENTER
|
|
|
|
ELSE WC.WORK_CENTER
|
|
|
|
END WORK_CENTER,
|
|
|
|
CASE WHEN WCT.DESCRIPTION != 'NULL' THEN WCT.DESCRIPTION
|
|
|
|
ELSE WCT2.DESCRIPTION
|
|
|
|
END WORK_CENTER_DESCRIPTION,
|
|
|
|
ZRRT.RESOURCE_NO,R.DESCRIPTION RESOURCE_DESCRIPTION,ZRRT.NC_CODE_NO, /*不良代码描述,维修人员*/
|
|
|
|
ZRRT.PRELIMINARY_REASON ,ZRRT.DEAL_WAY ,ZRRT.DEAL_WAY_DESCRIPTION ,
|
|
|
|
ZRITS.ITEM_BO ITEM_BO,
|
|
|
|
CASE WHEN ZRITS.ITEM_BO != 'NULL' THEN IT.DESCRIPTION
|
|
|
|
ELSE ZRITS.DESCRIPTION
|
|
|
|
END ITEM_DESCRIPTION,
|
|
|
|
CF.VALUE ITEM_SPEC,
|
|
|
|
ZRRT.ACTUAL_START_DATE ACTUAL_START_DATE,ZRRT.ACTUAL_COMPLETE_DATE ACTUAL_COMPLETE_DATE,
|
|
|
|
TRUNC(TO_NUMBER((ZRRT.ACTUAL_COMPLETE_DATE-ZRRT.ACTUAL_START_DATE)*24),2) SHUT_DOWN_TIME,
|
|
|
|
TRUNC(TO_NUMBER((ZRRT.WAIT_END_DATE -ZRRT.WAIT_START_DATE)*24),2) REPAIR_WAIT_TIME,
|
|
|
|
TRUNC(TO_NUMBER((ZRRT.ACTUAL_COMPLETE_DATE-ZRRT.ACTUAL_START_DATE-ZRRT.WAIT_TIME)*24),2) REPAIR_TIME,
|
|
|
|
ZRRT. STATUS ,ZRRT.REPORT_USER REPORT_USER,ZNU.FULL_NAME REPORT_USER_DESCRIPTION,
|
|
|
|
ZRRT.REPAIR_USERS ,ZRRT.REMARK
|
|
|
|
FROM
|
|
|
|
Z_RESOURCE_REPAIR_TASK ZRRT
|
|
|
|
INNER JOIN RESRCE R ON R.RESRCE = ZRRT.RESOURCE_NO AND R.SITE = ZRRT.SITE
|
|
|
|
INNER JOIN WORK_CENTER_MEMBER WCM ON WCM.WORK_CENTER_OR_RESOURCE_GBO = R.HANDLE
|
|
|
|
LEFT JOIN WORK_CENTER WC ON WC.HANDLE = WCM.WORK_CENTER_BO AND WC.WC_CATEGORY ='LEVEL3'
|
|
|
|
|
|
|
|
LEFT JOIN WORK_CENTER_MEMBER WCM2 ON WCM2.WORK_CENTER_OR_RESOURCE_GBO = WC.HANDLE
|
|
|
|
LEFT JOIN WORK_CENTER WC2 ON WC2.HANDLE = WCM.WORK_CENTER_BO AND WC2.WC_CATEGORY = 'LEVEL4'
|
|
|
|
|
|
|
|
LEFT JOIN WORK_CENTER_T WCT ON WCT.WORK_CENTER_BO = WC.HANDLE AND WCT.LOCALE = #{locale}
|
|
|
|
LEFT JOIN WORK_CENTER_T WCT2 ON WCT2.WORK_CENTER_BO = WC2.HANDLE AND WCT2.LOCALE = #{locale}
|
|
|
|
LEFT JOIN Z_RESOURCE_INSPECT_TASK_SPARE ZRITS ON ZRITS.RESOURCE_INSPECT_TASK_BO = ZRRT.HANDLE
|
|
|
|
LEFT JOIN ITEM_T IT ON IT.ITEM_BO = ZRITS.ITEM_BO AND IT.LOCALE = #{locale}
|
|
|
|
LEFT JOIN CUSTOM_FIELDS CF ON CF.HANDLE = ZRITS.ITEM_BO AND CF."ATTRIBUTE" = 'MAT_SPEC'
|
|
|
|
|
|
|
|
LEFT JOIN Z_NWA_USER ZNU ON ZNU.USER_NAME = ZRRT.REPORT_USER AND ZNU.SITE = ZRRT.SITE
|
|
|
|
<where>
|
|
|
|
ZRRT.SITE = #{site}
|
|
|
|
<if test="param.workCenter != null and param.workCenter != ''">
|
|
|
|
AND (WC.WORK_CENTER LIKE '%${param.workCenter}%' OR WC2.WORK_CENTER LIKE '%${param.workCenter}%' OR
|
|
|
|
WCT.DESCRIPTION LIKE '%${param.workCenter}%' OR WCT2.DESCRIPTION LIKE '%${param.workCenter}%')
|
|
|
|
</if>
|
|
|
|
<if test="param.resource != null and param.resource != ''">
|
|
|
|
AND (R.RESRCE LIKE '%${param.resource}%' OR R.DESCRIPTION LIKE '%${param.resource}%')
|
|
|
|
</if>
|
|
|
|
</where>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="findInspectionTask" resultType="java.util.HashMap" parameterType="java.util.HashMap">
|
|
|
|
SELECT WT.DESCRIPTION WORK_CENTER_DESCRIPTION, C2.VALUE ITEM_NUMBER, C3.VALUE PRODUCT_MODEL,IM.ITEM ITEM, IT.DESCRIPTION ITEM_DESCRIPTION,
|
|
|
|
ZT.SFC, ZT.OPERATION, OT.DESCRIPTION OPERATION_DESCRIPTION, ZT.RESRCE, RS.DESCRIPTION RESOURCE_DESCRIPTION, ZT.TASK_NO, ZT.CATEGORY,
|
|
|
|
ZT."RESULT", ZT.CREATE_USER, ZNU.FULL_NAME, ZT.MODIFIED_DATE_TIME
|
|
|
|
FROM Z_INSPECTION_TASK ZT
|
|
|
|
LEFT JOIN WORK_CENTER WC ON WC.SITE = ZT.SITE AND WC.WORK_CENTER = ZT.WORK_CENTER
|
|
|
|
LEFT JOIN WORK_CENTER_T WT ON WT.WORK_CENTER_BO = WC.HANDLE AND WT.LOCALE = 'zh'
|
|
|
|
INNER JOIN SHOP_ORDER SO ON ZT.SITE = SO.SITE AND ZT.SHOP_ORDER = SO.SHOP_ORDER
|
|
|
|
LEFT JOIN CUSTOM_FIELDS C1 ON C1.HANDLE = SO.HANDLE AND C1."ATTRIBUTE" = 'WORK_ORDER'
|
|
|
|
LEFT JOIN CUSTOM_FIELDS C2 ON C2.HANDLE = SO.HANDLE AND C2."ATTRIBUTE" = 'ITEM_NUMBER'
|
|
|
|
LEFT JOIN CUSTOM_FIELDS C3 ON C3.HANDLE = SO.HANDLE AND C3."ATTRIBUTE" = 'PRODUCT_MODEL'
|
|
|
|
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'
|
|
|
|
INNER JOIN OPERATION OP ON OP.SITE = ZT.SITE AND OP.OPERATION = ZT.OPERATION AND OP.CURRENT_REVISION = 'true'
|
|
|
|
LEFT JOIN OPERATION_T OT ON OT.OPERATION_BO = OP.HANDLE AND OT.LOCALE = 'zh'
|
|
|
|
INNER JOIN RESRCE RS ON RS.SITE = ZT.SITE AND RS.RESRCE = ZT.RESRCE
|
|
|
|
LEFT JOIN Z_NWA_USER ZNU ON ZNU.SITE = ZT.SITE AND ZNU.USER_NAME = ZT.CREATE_USER
|
|
|
|
WHERE ZT.SITE = #{site}
|
|
|
|
<if test="workCenter != null and workCenter != ''" >
|
|
|
|
AND WC.WORK_CENTER = #{workCenter}
|
|
|
|
</if>
|
|
|
|
<if test="category != null and category != ''" >
|
|
|
|
AND ZT.CATEGORY = #{category}
|
|
|
|
</if>
|
|
|
|
<if test="itemNumber != null and itemNumber != ''" >
|
|
|
|
AND C2.VALUE LIKE '%'||#{itemNumber}||'%'
|
|
|
|
</if>
|
|
|
|
<if test="model != null and model != ''" >
|
|
|
|
AND C3.VALUE LIKE '%'||#{model}||'%'
|
|
|
|
</if>
|
|
|
|
<if test="operation != null and operation != ''" >
|
|
|
|
AND ZT.OPERATION = #{operation}
|
|
|
|
</if>
|
|
|
|
<if test="resrce != null and resrce != ''" >
|
|
|
|
AND ZT.RESRCE = #{resrce}
|
|
|
|
</if>
|
|
|
|
<if test="result != null and result != ''" >
|
|
|
|
AND ZT.RESULT = #{result}
|
|
|
|
</if>
|
|
|
|
<if test="startFromDate != null and startFromDate != ''" >
|
|
|
|
AND ZT.MODIFIED_DATE_TIME >= TO_DATE(#{startFromDate}, 'YYYY-MM-DD')
|
|
|
|
</if>
|
|
|
|
<if test="startToDate != null and startToDate != ''" >
|
|
|
|
AND ZT.MODIFIED_DATE_TIME <= TO_DATE(#{startToDate}|| '23:59:59', 'YYYY-MM-DD HH24:MI:SS')
|
|
|
|
</if>
|
|
|
|
</select>
|
|
|
|
</mapper>
|