You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
157 lines
7.9 KiB
XML
157 lines
7.9 KiB
XML
<?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.quality.mapper.InspectionTaskManageMapper">
|
|
|
|
<!-- 通用查询映射结果 -->
|
|
<resultMap id="BaseResultMap" type="com.foreverwin.mesnac.quality.model.InspectionTaskManage">
|
|
<result column="HANDLE" property="handle"/>
|
|
<result column="SITE" property="site"/>
|
|
<result column="CATEGORY" property="category"/>
|
|
<result column="TASK_NO" property="taskNo"/>
|
|
<result column="DESCRIPTION" property="description"/>
|
|
<result column="STATUS" property="status"/>
|
|
<result column="INSPECTION_ITEM_BO" property="inspectionItemBo"/>
|
|
<result column="WORK_CENTER" property="workCenter"/>
|
|
<result column="SHOP_ORDER" property="shopOrder"/>
|
|
<result column="SFC" property="sfc"/>
|
|
<result column="ITEM" property="item"/>
|
|
<result column="ITEM_DESCRIPTION" property="itemDescription"/>
|
|
<result column="OPERATION" property="operation"/>
|
|
<result column="OPERATION_DESCRIPTION" property="operationDescription"/>
|
|
<result column="STEP_ID" property="stepId"/>
|
|
<result column="RESRCE" property="resrce"/>
|
|
<result column="RESULT" property="result"/>
|
|
<result column="COMMENTS" property="comments"/>
|
|
<result column="CREATE_USER" property="createUser"/>
|
|
<result column="CREATED_DATE_TIME" property="createdDateTime"/>
|
|
<result column="MODIFY_USER" property="modifyUser"/>
|
|
<result column="MODIFIED_DATE_TIME" property="modifiedDateTime"/>
|
|
<result column="FULL_NAME" property="fullName"/>
|
|
<result column="RESRCE_DESCRIPTION" property="resrceDescription"/>
|
|
<result column="SFC_QTY" property="sfcQty"/>
|
|
<result column="DISPATCH_USER" property="dispatchUser"/>
|
|
<result column="SFC_DISPATCH_BO" property="sfcdispatchBo"/>
|
|
<result column="NC_QTY" property="ncQty"/>
|
|
<result column="QUESTION_C" property="questionC"/>
|
|
<result column="ITEM_BO" property="itemBo"/>
|
|
<result column="MAIN_CHECK_USER" property="mainCheckUser"/>
|
|
<result column="CHECK_USER" property="checkUser"/>
|
|
<result column="CHECK_DATE_TIME" property="checkDateTime"/>
|
|
</resultMap>
|
|
|
|
<select id="findInspectionTask" resultMap="BaseResultMap">
|
|
SELECT B.HANDLE, B.SITE, B.CATEGORY, B.TASK_NO, B.DESCRIPTION, B.STATUS, B.INSPECTION_ITEM_BO, B.WORK_CENTER,
|
|
B.SHOP_ORDER, B.SFC,B.STEP_ID, B.OPERATION, B.RESRCE, B.RESULT,B.QUESTION_C, B.COMMENTS, B.CREATE_USER,
|
|
B.CREATED_DATE_TIME, B.MODIFY_USER, B.MODIFIED_DATE_TIME,
|
|
M.ITEM,M.HANDLE ITEM_BO, Z.DESCRIPTION ITEM_DESCRIPTION,ZNU.FULL_NAME FULL_NAME,RS.DESCRIPTION
|
|
RESRCE_DESCRIPTION,
|
|
O.OPERATION OPERATION,B.COMMENTS COMMENTS,
|
|
ZSD.EMPLOYEE_DESCRIPTION DISPATCH_USER,P.SHOP_ORDER,NVL(ZAB.NC_QTY, 0) NC_QTY,B.SFC_DISPATCH_BO,CF.VALUE
|
|
MAIN_CHECK_USER,
|
|
CASE WHEN B.CATEGORY = 'S' THEN '1' ELSE TO_CHAR( ZSD.DISPATCH_QTY ) END SFC_QTY,
|
|
CASE WHEN B.STATUS = 'COMPLETE' THEN TO_CHAR(ZNU2.FULL_NAME) ELSE '' END CHECK_USER,
|
|
CASE WHEN B.STATUS = 'COMPLETE' THEN TO_CHAR(B.MODIFIED_DATE_TIME,'yyyy-mm-dd hh24:mi:ss') ELSE '' END
|
|
CHECK_DATE_TIME,
|
|
CASE WHEN B.OPERATION='WX_6106GX' THEN OT.DESCRIPTION || '('|| CFS.VALUE || ')' ELSE OT.DESCRIPTION END
|
|
OPERATION_DESCRIPTION
|
|
FROM Z_INSPECTION_TASK B
|
|
INNER JOIN RESRCE RS ON B.SITE = RS.SITE AND RS.RESRCE = B.RESRCE
|
|
INNER JOIN OPERATION O ON O.OPERATION = B.OPERATION AND O.SITE = B.SITE
|
|
LEFT JOIN Z_SFC_DISPATCH ZSD ON ZSD.HANDLE = B.SFC_DISPATCH_BO
|
|
LEFT JOIN OPERATION_T OT ON OT.OPERATION_BO = O.HANDLE AND OT.LOCALE = 'zh'
|
|
INNER JOIN SFC S ON S.SFC = B.SFC AND S.SITE = B.SITE
|
|
LEFT JOIN CUSTOM_FIELDS CF ON CF.HANDLE = RS.HANDLE AND CF.ATTRIBUTE = 'CHECK_USR'
|
|
INNER JOIN SFC S ON S.SITE = B.SITE AND S.SFC = B.SFC
|
|
INNER JOIN SHOP_ORDER P ON P.HANDLE = S.SHOP_ORDER_BO
|
|
INNER JOIN ITEM M ON M.HANDLE = P.ITEM_BO
|
|
LEFT JOIN Z_NWA_USER ZNU ON ZNU.USER_NAME = B.CREATE_USER
|
|
LEFT JOIN Z_NWA_USER ZNU2 ON ZNU2.USER_NAME = B.MODIFY_USER
|
|
LEFT JOIN ITEM_T Z ON Z.ITEM_BO = M.HANDLE AND Z.LOCALE = 'zh'
|
|
LEFT JOIN Z_ABNORMAL_BILL ZAB ON B.HANDLE = ZAB.OBJECT_BO
|
|
LEFT JOIN CUSTOM_FIELDS CFS ON CFS.HANDLE = 'RouterOperationBO:RouterStepBO:'||ZSD.ROUTER_BO||','||B.STEP_ID AND
|
|
CFS.ATTRIBUTE='SOURCE_DESCRIPTION'
|
|
WHERE B.SITE = #{site}
|
|
<if test="workCenter != null and workCenter != ''">
|
|
AND B.WORK_CENTER = #{workCenter}
|
|
</if>
|
|
<if test="resrce != null and resrce != ''">
|
|
AND B.RESRCE = #{resrce}
|
|
</if>
|
|
<if test="checkUser != null and checkUser != ''">
|
|
AND CF.VALUE = #{checkUser}
|
|
</if>
|
|
<if test="dispatchUser != null and dispatchUser != ''">
|
|
AND ZSD.EMPLOYEE_DESCRIPTION = #{dispatchUser}
|
|
</if>
|
|
<if test="trueCheckUser != null and trueCheckUser != ''">
|
|
AND ZNU2.FULL_NAME like '%'||#{trueCheckUser}||'%'
|
|
</if>
|
|
<choose>
|
|
<when test="category != null and category != ''">
|
|
AND B.CATEGORY = #{category}
|
|
</when>
|
|
<otherwise>
|
|
AND (B.CATEGORY = 'S' OR B.CATEGORY = 'P')
|
|
</otherwise>
|
|
</choose>
|
|
<if test="taskNo != null and taskNo != ''">
|
|
AND B.TASK_NO =#{taskNo}
|
|
</if>
|
|
<if test="status != null and status != ''">
|
|
AND B.STATUS = #{status}
|
|
</if>
|
|
<if test="shopOrder != null and shopOrder != ''">
|
|
AND B.SHOP_ORDER = #{shopOrder}
|
|
</if>
|
|
<if test="sfc != null and sfc != ''">
|
|
AND B.SFC = #{sfc}
|
|
</if>
|
|
<if test="item != null and item != ''">
|
|
AND M.ITEM = #{item}
|
|
</if>
|
|
<if test="itemDescription != null and itemDescription != ''">
|
|
AND Z.DESCRIPTION like '%'||#{itemDescription}||'%'
|
|
</if>
|
|
<if test="operation != null and operation != ''">
|
|
AND B.OPERATION = #{operation}
|
|
</if>
|
|
<if test="stepId != null and stepId != ''">
|
|
AND B.STEP_ID = #{stepId}
|
|
</if>
|
|
<if test="shopOrder != null and shopOrder != ''">
|
|
AND P.SHOP_ORDER = #{shopOrder}
|
|
</if>
|
|
<if test="dateFrom != null">
|
|
AND B.CREATED_DATE_TIME >= #{dateFrom}
|
|
</if>
|
|
<if test="dateTo != null">
|
|
AND B.CREATED_DATE_TIME <= #{dateTo}
|
|
</if>
|
|
<if test="result != null and result != ''">
|
|
AND B.RESULT = #{result}
|
|
</if>
|
|
<if test="wxDescription != null and wxDescription != ''">
|
|
AND CFS.VALUE like '%'||#{wxDescription}||'%'
|
|
</if>
|
|
|
|
ORDER BY B.CREATED_DATE_TIME DESC
|
|
</select>
|
|
|
|
<select id="selectInspectionTaskDetail" resultType="com.foreverwin.mesnac.quality.model.InspectionTaskManageDetail"
|
|
flushCache="true">
|
|
SELECT ZD.HANDLE, ZD.TASK_BO, ZD.SITE, ZL.SEQ, ZL.PARAM_TYPE, ZL.INSPECTION_METHOD, ZL.PARAM_NO, ZL.DESCRIPTION,
|
|
ZL.MIN_VALUE, ZL.STANDARD_VALUE, ZL.MAX_VALUE, ZL.IS_REQUIRED,
|
|
ZL.TRUE_VALUE, ZL.FALSE_VALUE, ZL.CHECK_NUM, ZD.CHECK_VALUES, ZD.RESULT, ZD.REMARK
|
|
FROM Z_INSPECTION_TASK_DETAIL ZD
|
|
INNER JOIN Z_INSPECTION_ITEM_DETAIL ZL ON ZD.INSPECTION_ITEM_DETAIL_BO = ZL.HANDLE
|
|
WHERE ZD.TASK_BO = #{inspectionTaskBo}
|
|
</select>
|
|
|
|
<select id="selectInspectionItemDetail" resultType="com.foreverwin.mesnac.quality.model.InspectionTaskManageDetail">
|
|
SELECT ZL.HANDLE, ZL.SEQ, ZL.PARAM_TYPE, ZL.PARAM_NO, ZL.DESCRIPTION, ZL.INSPECTION_METHOD, ZL.MIN_VALUE,
|
|
ZL.STANDARD_VALUE, ZL.MAX_VALUE, ZL.TRUE_VALUE, ZL.FALSE_VALUE, ZL.CHECK_NUM, ZL.IS_REQUIRED
|
|
FROM Z_INSPECTION_ITEM_DETAIL ZL
|
|
WHERE ZL.INSPECTION_ITEM_BO = #{inspectionItemBo}
|
|
</select>
|
|
</mapper>
|