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.

1050 lines
61 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.dispatch.mapper.CallItemMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.foreverwin.mesnac.dispatch.model.CallItem">
<id column="HANDLE" property="handle" />
<result column="SITE" property="site" />
<result column="SFC_DISPATCH_BO" property="sfcDispatchBo" />
<result column="CALL_ITEM_NO" property="callItemNo" />
<result column="SHOP_ORDER" property="shopOrder" />
<result column="SFC" property="sfc" />
<result column="OPERATION" property="operation" />
<result column="STEP_ID" property="stepId" />
<result column="RESRCE" property="resrce" />
<result column="COMPONENT_BO" property="componentBo" />
<result column="CALL_TYPE" property="callType" />
<result column="REQUIRED_QTY" property="requiredQty" />
<result column="REQUIRED_DATE_TIME" property="requiredDateTime" />
<result column="STATUS" property="status" />
<result column="CALL_STATUS" property="callStatus" />
<result column="ISSUE_STATUS" property="issueStatus" />
<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" />
</resultMap>
<resultMap id="FullResultMap" type="com.foreverwin.mesnac.dispatch.model.CallItem" extends="BaseResultMap">
<result column="ITEM" property="item" />
<result column="ITEM_GROUP" property="itemGroup" />
<result column="COMPONENT" property="component" />
<result column="ITEM_DESCRIPTION" property="itemDescription" />
<result column="MATERIAL_TYPE" property="materialType" />
<result column="EMPLOYEE" property="employee" />
<result column="SOURCE_RESOURCE" property="sourceResource" />
<result column="WORK_ORDER" property="workOrder" />
<result column="ITEM_NUMBER" property="itemNumber" />
<result column="WORK_CENTER" property="workCenter" />
<result column="DISPATCH_NO" property="dispatchNo" />
<result column="DISPATCH_QTY" property="dispatchQty" />
<result column="RESOURCE_TYPE" property="resourceType" />
<result column="BLANKING_SIZE" property="blankingSize" />
<result column="OPERATION_DESCRIPTION" property="operationDescription" />
<result column="PLANNED_START_DATE" property="plannedStartDate" />
<result column="REMARK" property="remark" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
HANDLE, SITE, SFC_DISPATCH_BO, CALL_ITEM_NO, SHOP_ORDER, SFC, OPERATION, STEP_ID, RESRCE, COMPONENT_BO, CALL_TYPE, REQUIRED_QTY, REQUIRED_DATE_TIME, STATUS, CALL_STATUS, ISSUE_STATUS, CREATE_USER, CREATED_DATE_TIME, MODIFY_USER, MODIFIED_DATE_TIME
</sql>
<!-- BaseMapper标准查询/修改/删除 -->
<select id="selectById" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include> FROM Z_CALL_ITEM WHERE HANDLE=#{handle}
</select>
<select id="selectByMap" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include>
FROM Z_CALL_ITEM
<if test="cm!=null and !cm.isEmpty">
<where>
<foreach collection="cm.keys" item="k" separator="AND">
<if test="cm[k] != null">
${k} = #{cm[${k}]}
</if>
</foreach>
</where>
</if>
</select>
<select id="selectBatchIds" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include>
FROM Z_CALL_ITEM WHERE HANDLE IN (
<foreach item="item" index="index" collection="coll" separator=",">#{item}
</foreach>)
</select>
<select id="selectOne" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include> FROM Z_CALL_ITEM
<where>
<if test="ew.entity.handle!=null">
HANDLE=#{ew.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.sfcDispatchBo!=null"> AND SFC_DISPATCH_BO=#{ew.entity.sfcDispatchBo}</if>
<if test="ew.entity.callItemNo!=null"> AND CALL_ITEM_NO=#{ew.entity.callItemNo}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
<if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
<if test="ew.entity.componentBo!=null"> AND COMPONENT_BO=#{ew.entity.componentBo}</if>
<if test="ew.entity.callType!=null"> AND CALL_TYPE=#{ew.entity.callType}</if>
<if test="ew.entity.requiredQty!=null"> AND REQUIRED_QTY=#{ew.entity.requiredQty}</if>
<if test="ew.entity.requiredDateTime!=null"> AND REQUIRED_DATE_TIME=#{ew.entity.requiredDateTime}</if>
<if test="ew.entity.issueQty!=null"> AND ISSUE_QTY=#{ew.entity.issueQty}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.callStatus!=null"> AND CALL_STATUS=#{ew.entity.callStatus}</if>
<if test="ew.entity.issueStatus!=null"> AND ISSUE_STATUS=#{ew.entity.issueStatus}</if>
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifyUser!=null"> AND MODIFY_USER=#{ew.entity.modifyUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</where>
</select>
<select id="selectCount" resultType="Integer">
SELECT COUNT(1) FROM Z_CALL_ITEM
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.sfcDispatchBo!=null"> AND SFC_DISPATCH_BO=#{ew.entity.sfcDispatchBo}</if>
<if test="ew.entity.callItemNo!=null"> AND CALL_ITEM_NO=#{ew.entity.callItemNo}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
<if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
<if test="ew.entity.componentBo!=null"> AND COMPONENT_BO=#{ew.entity.componentBo}</if>
<if test="ew.entity.callType!=null"> AND CALL_TYPE=#{ew.entity.callType}</if>
<if test="ew.entity.requiredQty!=null"> AND REQUIRED_QTY=#{ew.entity.requiredQty}</if>
<if test="ew.entity.requiredDateTime!=null"> AND REQUIRED_DATE_TIME=#{ew.entity.requiredDateTime}</if>
<if test="ew.entity.issueQty!=null"> AND ISSUE_QTY=#{ew.entity.issueQty}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.callStatus!=null"> AND CALL_STATUS=#{ew.entity.callStatus}</if>
<if test="ew.entity.issueStatus!=null"> AND ISSUE_STATUS=#{ew.entity.issueStatus}</if>
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifyUser!=null"> AND MODIFY_USER=#{ew.entity.modifyUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<select id="selectList" resultMap="BaseResultMap">
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM Z_CALL_ITEM
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.sfcDispatchBo!=null"> AND SFC_DISPATCH_BO=#{ew.entity.sfcDispatchBo}</if>
<if test="ew.entity.callItemNo!=null"> AND CALL_ITEM_NO=#{ew.entity.callItemNo}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
<if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
<if test="ew.entity.componentBo!=null"> AND COMPONENT_BO=#{ew.entity.componentBo}</if>
<if test="ew.entity.callType!=null"> AND CALL_TYPE=#{ew.entity.callType}</if>
<if test="ew.entity.requiredQty!=null"> AND REQUIRED_QTY=#{ew.entity.requiredQty}</if>
<if test="ew.entity.requiredDateTime!=null"> AND REQUIRED_DATE_TIME=#{ew.entity.requiredDateTime}</if>
<if test="ew.entity.issueQty!=null"> AND ISSUE_QTY=#{ew.entity.issueQty}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.callStatus!=null"> AND CALL_STATUS=#{ew.entity.callStatus}</if>
<if test="ew.entity.issueStatus!=null"> AND ISSUE_STATUS=#{ew.entity.issueStatus}</if>
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifyUser!=null"> AND MODIFY_USER=#{ew.entity.modifyUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<select id="selectMaps" resultType="HashMap">
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM Z_CALL_ITEM
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.sfcDispatchBo!=null"> AND SFC_DISPATCH_BO=#{ew.entity.sfcDispatchBo}</if>
<if test="ew.entity.callItemNo!=null"> AND CALL_ITEM_NO=#{ew.entity.callItemNo}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
<if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
<if test="ew.entity.componentBo!=null"> AND COMPONENT_BO=#{ew.entity.componentBo}</if>
<if test="ew.entity.callType!=null"> AND CALL_TYPE=#{ew.entity.callType}</if>
<if test="ew.entity.requiredQty!=null"> AND REQUIRED_QTY=#{ew.entity.requiredQty}</if>
<if test="ew.entity.requiredDateTime!=null"> AND REQUIRED_DATE_TIME=#{ew.entity.requiredDateTime}</if>
<if test="ew.entity.issueQty!=null"> AND ISSUE_QTY=#{ew.entity.issueQty}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.callStatus!=null"> AND CALL_STATUS=#{ew.entity.callStatus}</if>
<if test="ew.entity.issueStatus!=null"> AND ISSUE_STATUS=#{ew.entity.issueStatus}</if>
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifyUser!=null"> AND MODIFY_USER=#{ew.entity.modifyUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<select id="selectObjs" resultType="Object">
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM Z_CALL_ITEM
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.sfcDispatchBo!=null"> AND SFC_DISPATCH_BO=#{ew.entity.sfcDispatchBo}</if>
<if test="ew.entity.callItemNo!=null"> AND CALL_ITEM_NO=#{ew.entity.callItemNo}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
<if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
<if test="ew.entity.componentBo!=null"> AND COMPONENT_BO=#{ew.entity.componentBo}</if>
<if test="ew.entity.callType!=null"> AND CALL_TYPE=#{ew.entity.callType}</if>
<if test="ew.entity.requiredQty!=null"> AND REQUIRED_QTY=#{ew.entity.requiredQty}</if>
<if test="ew.entity.requiredDateTime!=null"> AND REQUIRED_DATE_TIME=#{ew.entity.requiredDateTime}</if>
<if test="ew.entity.issueQty!=null"> AND ISSUE_QTY=#{ew.entity.issueQty}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.callStatus!=null"> AND CALL_STATUS=#{ew.entity.callStatus}</if>
<if test="ew.entity.issueStatus!=null"> AND ISSUE_STATUS=#{ew.entity.issueStatus}</if>
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifyUser!=null"> AND MODIFY_USER=#{ew.entity.modifyUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<select id="selectPage" resultMap="BaseResultMap">
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM Z_CALL_ITEM
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.sfcDispatchBo!=null"> AND SFC_DISPATCH_BO=#{ew.entity.sfcDispatchBo}</if>
<if test="ew.entity.callItemNo!=null"> AND CALL_ITEM_NO=#{ew.entity.callItemNo}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
<if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
<if test="ew.entity.componentBo!=null"> AND COMPONENT_BO=#{ew.entity.componentBo}</if>
<if test="ew.entity.callType!=null"> AND CALL_TYPE=#{ew.entity.callType}</if>
<if test="ew.entity.requiredQty!=null"> AND REQUIRED_QTY=#{ew.entity.requiredQty}</if>
<if test="ew.entity.requiredDateTime!=null"> AND REQUIRED_DATE_TIME=#{ew.entity.requiredDateTime}</if>
<if test="ew.entity.issueQty!=null"> AND ISSUE_QTY=#{ew.entity.issueQty}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.callStatus!=null"> AND CALL_STATUS=#{ew.entity.callStatus}</if>
<if test="ew.entity.issueStatus!=null"> AND ISSUE_STATUS=#{ew.entity.issueStatus}</if>
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifyUser!=null"> AND MODIFY_USER=#{ew.entity.modifyUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<select id="selectMapsPage" resultType="HashMap">
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM Z_CALL_ITEM
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.sfcDispatchBo!=null"> AND SFC_DISPATCH_BO=#{ew.entity.sfcDispatchBo}</if>
<if test="ew.entity.callItemNo!=null"> AND CALL_ITEM_NO=#{ew.entity.callItemNo}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
<if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
<if test="ew.entity.componentBo!=null"> AND COMPONENT_BO=#{ew.entity.componentBo}</if>
<if test="ew.entity.callType!=null"> AND CALL_TYPE=#{ew.entity.callType}</if>
<if test="ew.entity.requiredQty!=null"> AND REQUIRED_QTY=#{ew.entity.requiredQty}</if>
<if test="ew.entity.requiredDateTime!=null"> AND REQUIRED_DATE_TIME=#{ew.entity.requiredDateTime}</if>
<if test="ew.entity.issueQty!=null"> AND ISSUE_QTY=#{ew.entity.issueQty}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.callStatus!=null"> AND CALL_STATUS=#{ew.entity.callStatus}</if>
<if test="ew.entity.issueStatus!=null"> AND ISSUE_STATUS=#{ew.entity.issueStatus}</if>
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifyUser!=null"> AND MODIFY_USER=#{ew.entity.modifyUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<insert id="insert" parameterType="com.foreverwin.mesnac.dispatch.model.CallItem">
INSERT INTO Z_CALL_ITEM
<trim prefix="(" suffix=")" suffixOverrides=",">
HANDLE,
<if test="site!=null">SITE,</if>
<if test="sfcDispatchBo!=null">SFC_DISPATCH_BO,</if>
<if test="callItemNo!=null">CALL_ITEM_NO,</if>
<if test="shopOrder!=null">SHOP_ORDER,</if>
<if test="sfc!=null">SFC,</if>
<if test="operation!=null">OPERATION,</if>
<if test="stepId!=null">STEP_ID,</if>
<if test="resrce!=null">RESRCE,</if>
<if test="componentBo!=null">COMPONENT_BO,</if>
<if test="callType!=null">CALL_TYPE,</if>
<if test="requiredQty!=null">REQUIRED_QTY,</if>
<if test="requiredDateTime!=null">REQUIRED_DATE_TIME,</if>
<if test="issueQty!=null">ISSUE_QTY,</if>
<if test="status!=null">STATUS,</if>
<if test="callStatus!=null">CALL_STATUS,</if>
<if test="issueStatus!=null">ISSUE_STATUS,</if>
<if test="createUser!=null">CREATE_USER,</if>
<if test="createdDateTime!=null">CREATED_DATE_TIME,</if>
<if test="modifyUser!=null">MODIFY_USER,</if>
<if test="modifiedDateTime!=null">MODIFIED_DATE_TIME,</if>
</trim> VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{handle},
<if test="site!=null">#{site},</if>
<if test="sfcDispatchBo!=null">#{sfcDispatchBo},</if>
<if test="callItemNo!=null">#{callItemNo},</if>
<if test="shopOrder!=null">#{shopOrder},</if>
<if test="sfc!=null">#{sfc},</if>
<if test="operation!=null">#{operation},</if>
<if test="stepId!=null">#{stepId},</if>
<if test="resrce!=null">#{resrce},</if>
<if test="componentBo!=null">#{componentBo},</if>
<if test="callType!=null">#{callType},</if>
<if test="requiredQty!=null">#{requiredQty},</if>
<if test="requiredDateTime!=null">#{requiredDateTime},</if>
<if test="issueQty!=null">#{issueQty},</if>
<if test="status!=null">#{status},</if>
<if test="callStatus!=null">#{callStatus},</if>
<if test="issueStatus!=null">#{issueStatus},</if>
<if test="createUser!=null">#{createUser},</if>
<if test="createdDateTime!=null">#{createdDateTime},</if>
<if test="modifyUser!=null">#{modifyUser},</if>
<if test="modifiedDateTime!=null">#{modifiedDateTime},</if>
</trim>
</insert>
<insert id="insertAllColumn" parameterType="com.foreverwin.mesnac.dispatch.model.CallItem">
INSERT INTO Z_CALL_ITEM
<trim prefix="(" suffix=")" suffixOverrides=",">
<include refid="Base_Column_List"></include>
</trim> VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{handle},
#{site},
#{sfcDispatchBo},
#{callItemNo},
#{shopOrder},
#{sfc},
#{operation},
#{stepId},
#{resrce},
#{componentBo},
#{callType},
#{requiredQty},
#{requiredDateTime},
#{issueQty},
#{status},
#{callStatus},
#{issueStatus},
#{createUser},
#{createdDateTime},
#{modifyUser},
#{modifiedDateTime},
</trim>
</insert>
<update id="modifyById">
MODIFY Z_CALL_ITEM <trim prefix="SET" suffixOverrides=",">
<if test="et.site!=null">SITE=#{et.site},</if>
<if test="et.sfcDispatchBo!=null">SFC_DISPATCH_BO=#{et.sfcDispatchBo},</if>
<if test="et.callItemNo!=null">CALL_ITEM_NO=#{et.callItemNo},</if>
<if test="et.shopOrder!=null">SHOP_ORDER=#{et.shopOrder},</if>
<if test="et.sfc!=null">SFC=#{et.sfc},</if>
<if test="et.operation!=null">OPERATION=#{et.operation},</if>
<if test="et.stepId!=null">STEP_ID=#{et.stepId},</if>
<if test="et.resrce!=null">RESRCE=#{et.resrce},</if>
<if test="et.componentBo!=null">COMPONENT_BO=#{et.componentBo},</if>
<if test="et.callType!=null">CALL_TYPE=#{et.callType},</if>
<if test="et.requiredQty!=null">REQUIRED_QTY=#{et.requiredQty},</if>
<if test="et.requiredDateTime!=null">REQUIRED_DATE_TIME=#{et.requiredDateTime},</if>
<if test="et.issueQty!=null">ISSUE_QTY=#{et.issueQty},</if>
<if test="et.status!=null">STATUS=#{et.status},</if>
<if test="et.callStatus!=null">CALL_STATUS=#{et.callStatus},</if>
<if test="et.issueStatus!=null">ISSUE_STATUS=#{et.issueStatus},</if>
<if test="et.createUser!=null">CREATE_USER=#{et.createUser},</if>
<if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</if>
<if test="et.modifyUser!=null">MODIFY_USER=#{et.modifyUser},</if>
<if test="et.modifiedDateTime!=null">MODIFIED_DATE_TIME=#{et.modifiedDateTime},</if>
</trim> WHERE HANDLE=#{et.handle} <if test="et instanceof java.util.Map"><if test="et.MP_OPTLOCK_VERSION_ORIGINAL!=null">and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL}</if></if>
</update>
<update id="modifyAllColumnById">
MODIFY Z_CALL_ITEM <trim prefix="SET" suffixOverrides=",">
SITE=#{et.site},
SFC_DISPATCH_BO=#{et.sfcDispatchBo},
CALL_ITEM_NO=#{et.callItemNo},
SHOP_ORDER=#{et.shopOrder},
SFC=#{et.sfc},
OPERATION=#{et.operation},
STEP_ID=#{et.stepId},
RESRCE=#{et.resrce},
COMPONENT_BO=#{et.componentBo},
CALL_TYPE=#{et.callType},
REQUIRED_QTY=#{et.requiredQty},
REQUIRED_DATE_TIME=#{et.requiredDateTime},
ISSUE_QTY=#{et.issueQty},
STATUS=#{et.status},
CALL_STATUS=#{et.callStatus},
ISSUE_STATUS=#{et.issueStatus},
CREATE_USER=#{et.createUser},
CREATED_DATE_TIME=#{et.createdDateTime},
MODIFY_USER=#{et.modifyUser},
MODIFIED_DATE_TIME=#{et.modifiedDateTime},
</trim> WHERE HANDLE=#{et.handle} <if test="et instanceof java.util.Map"><if test="et.MP_OPTLOCK_VERSION_ORIGINAL!=null">and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL}</if></if>
</update>
<update id="modify">
MODIFY Z_CALL_ITEM <trim prefix="SET" suffixOverrides=",">
<if test="et.site!=null">SITE=#{et.site},</if>
<if test="et.sfcDispatchBo!=null">SFC_DISPATCH_BO=#{et.sfcDispatchBo},</if>
<if test="et.callItemNo!=null">CALL_ITEM_NO=#{et.callItemNo},</if>
<if test="et.shopOrder!=null">SHOP_ORDER=#{et.shopOrder},</if>
<if test="et.sfc!=null">SFC=#{et.sfc},</if>
<if test="et.operation!=null">OPERATION=#{et.operation},</if>
<if test="et.stepId!=null">STEP_ID=#{et.stepId},</if>
<if test="et.resrce!=null">RESRCE=#{et.resrce},</if>
<if test="et.componentBo!=null">COMPONENT_BO=#{et.componentBo},</if>
<if test="et.callType!=null">CALL_TYPE=#{et.callType},</if>
<if test="et.requiredQty!=null">REQUIRED_QTY=#{et.requiredQty},</if>
<if test="et.requiredDateTime!=null">REQUIRED_DATE_TIME=#{et.requiredDateTime},</if>
<if test="et.issueQty!=null">ISSUE_QTY=#{et.issueQty},</if>
<if test="et.status!=null">STATUS=#{et.status},</if>
<if test="et.callStatus!=null">CALL_STATUS=#{et.callStatus},</if>
<if test="et.issueStatus!=null">ISSUE_STATUS=#{et.issueStatus},</if>
<if test="et.createUser!=null">CREATE_USER=#{et.createUser},</if>
<if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</if>
<if test="et.modifyUser!=null">MODIFY_USER=#{et.modifyUser},</if>
<if test="et.modifiedDateTime!=null">MODIFIED_DATE_TIME=#{et.modifiedDateTime},</if>
</trim>
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
HANDLE=#{ew.entity.handle}
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.sfcDispatchBo!=null"> AND SFC_DISPATCH_BO=#{ew.entity.sfcDispatchBo}</if>
<if test="ew.entity.callItemNo!=null"> AND CALL_ITEM_NO=#{ew.entity.callItemNo}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
<if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
<if test="ew.entity.componentBo!=null"> AND COMPONENT_BO=#{ew.entity.componentBo}</if>
<if test="ew.entity.callType!=null"> AND CALL_TYPE=#{ew.entity.callType}</if>
<if test="ew.entity.requiredQty!=null"> AND REQUIRED_QTY=#{ew.entity.requiredQty}</if>
<if test="ew.entity.requiredDateTime!=null"> AND REQUIRED_DATE_TIME=#{ew.entity.requiredDateTime}</if>
<if test="ew.entity.issueQty!=null"> AND ISSUE_QTY=#{ew.entity.issueQty}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.callStatus!=null"> AND CALL_STATUS=#{ew.entity.callStatus}</if>
<if test="ew.entity.issueStatus!=null"> AND ISSUE_STATUS=#{ew.entity.issueStatus}</if>
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifyUser!=null"> AND MODIFY_USER=#{ew.entity.modifyUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</update>
<delete id="deleteById">
DELETE FROM Z_CALL_ITEM WHERE HANDLE=#{handle}
</delete>
<delete id="deleteByMap">
DELETE FROM Z_CALL_ITEM
<if test="cm!=null and !cm.isEmpty">
<where>
<foreach collection="cm.keys" item="k" separator="AND">
<if test="cm[k] != null">
${k} = #{cm[${k}]}
</if>
</foreach>
</where>
</if>
</delete>
<delete id="delete">
DELETE FROM Z_CALL_ITEM
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.sfcDispatchBo!=null"> AND SFC_DISPATCH_BO=#{ew.entity.sfcDispatchBo}</if>
<if test="ew.entity.callItemNo!=null"> AND CALL_ITEM_NO=#{ew.entity.callItemNo}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
<if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
<if test="ew.entity.componentBo!=null"> AND COMPONENT_BO=#{ew.entity.componentBo}</if>
<if test="ew.entity.callType!=null"> AND CALL_TYPE=#{ew.entity.callType}</if>
<if test="ew.entity.requiredQty!=null"> AND REQUIRED_QTY=#{ew.entity.requiredQty}</if>
<if test="ew.entity.requiredDateTime!=null"> AND REQUIRED_DATE_TIME=#{ew.entity.requiredDateTime}</if>
<if test="ew.entity.issueQty!=null"> AND ISSUE_QTY=#{ew.entity.issueQty}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.callStatus!=null"> AND CALL_STATUS=#{ew.entity.callStatus}</if>
<if test="ew.entity.issueStatus!=null"> AND ISSUE_STATUS=#{ew.entity.issueStatus}</if>
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifyUser!=null"> AND MODIFY_USER=#{ew.entity.modifyUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</delete>
<delete id="deleteBatchIds">
DELETE FROM Z_CALL_ITEM WHERE HANDLE IN (
<foreach item="item" index="index" collection="coll" separator=",">#{item}
</foreach>)
</delete>
<!-- BaseMapper标准查询/修改/删除 -->
<select id="selectEffectedCallItemByDispatchBo" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM Z_CALL_ITEM
WHERE SFC_DISPATCH_BO = #{sfcDispatchBo} AND STATUS IN ('802','803')
</select>
<delete id="deleteDispatchCallItem">
DELETE FROM Z_CALL_ITEM WHERE SFC_DISPATCH_BO IN
<foreach item="item" collection="list" separator="," open="(" close=")" index="">
#{item.handle}
</foreach>
</delete>
<select id="selectDispatchCallItem" resultMap="BaseResultMap">
SELECT ZSD.HANDLE SFC_DISPATCH_BO, ZSD.SITE, ZSD.SHOP_ORDER, ZSD.SFC, ZSD.DISPATCH_NO, ZSD.OPERATION, ZSD.STEP_ID, ZSD.RESRCE, BC.COMPONENT_GBO COMPONENT_BO,
SC.QTY*BC.QTY ISSUE_QTY, SC.QTY*BC.QTY-NVL(ZCI.REQUIRED_QTY,0) REQUIRED_QTY, ZSD.PLANNED_START_DATE REQUIRED_DATE_TIME, ZCI.HANDLE, ZCI.CALL_TYPE
FROM Z_SFC_DISPATCH ZSD
INNER JOIN SFC SC ON SC.SITE = ZSD.SITE AND SC.SFC = ZSD.SFC
INNER JOIN SFC_BOM SB ON SB.SFC_BO = SC.HANDLE
INNER JOIN BOM_COMPONENT BC ON BC.BOM_BO = SB.BOM_BO
INNER JOIN ITEM CP ON CP.HANDLE = BC.COMPONENT_GBO
INNER JOIN BOM_OPERATION BO ON BO.BOM_COMPONENT_BO = BC.HANDLE AND BO.OPERATION_BO = 'OperationBO:'||SC.SITE||','||ZSD.OPERATION||',#'
INNER JOIN CUSTOM_FIELDS CF ON CF.HANDLE = BC.HANDLE AND CF."ATTRIBUTE" = 'STEP_ID' AND CF.VALUE = ZSD.STEP_ID
LEFT JOIN Z_CALL_ITEM ZCI ON ZCI.SFC_DISPATCH_BO = ZSD.HANDLE AND ZCI.COMPONENT_BO = CP.HANDLE AND ZCI.STEP_ID = ZSD.STEP_ID
WHERE ZSD.HANDLE IN
<foreach item="item" collection="list" separator="," open="(" close=")" index="">
#{item.handle}
</foreach>
ORDER BY TO_NUMBER(CF.VALUE)
</select>
<select id="selectCallItemAndType" resultMap="FullResultMap">
SELECT ZCI.HANDLE, ZCI.SITE, ZCI.CALL_ITEM_NO, ZCI.SHOP_ORDER, ZCI.SFC, ZCI.SFC_DISPATCH_BO, ZCI.OPERATION, ZCI.STEP_ID, ZCI.RESRCE, ZCI.COMPONENT_BO, CP.MATERIAL_TYPE, ZCI.CALL_TYPE, ZCI.REQUIRED_QTY, ZCI.REQUIRED_DATE_TIME,
ZCI.ISSUE_QTY, ZCI.STATUS, ZCI.CALL_STATUS, ZCI.ISSUE_STATUS, ZCI.CREATE_USER, ZCI.CREATED_DATE_TIME, ZCI.MODIFY_USER, ZCI.MODIFIED_DATE_TIME
FROM Z_CALL_ITEM ZCI
INNER JOIN ITEM CP ON CP.HANDLE = ZCI.COMPONENT_BO
WHERE ZCI.SFC_DISPATCH_BO = #{sfcDispatchBo}
</select>
<select id="findCallItemList" resultMap="FullResultMap">
SELECT *
FROM (
SELECT ZCI.SITE, CF.VALUE WORK_ORDER, CS.VALUE ITEM_NUMBER, ZSD.WORK_CENTER, ZSD.SHOP_ORDER, ZSD.SFC, ZSD.DISPATCH_NO, IT.ITEM, ITT.DESCRIPTION ITEM_DESCRIPTION, ZSD.BLANKING_SIZE,
ZSD.STEP_ID, ZCI.SFC_DISPATCH_BO, ZSD.DISPATCH_STATUS, ZCI.OPERATION, OPT.DESCRIPTION OPERATION_DESCRIPTION, ZSD.RESOURCE_TYPE, ZCI.RESRCE, ZSD.DISPATCH_QTY, ZSD.PLANNED_START_DATE, ZSD.REMARK,
CASE WHEN VP.NEWS = '1' AND VP.CALLES = '0' AND VP.ISSUED = '0' THEN 'NONE'
WHEN VP.NEWS = '0' AND (VP.CALLES = '1' OR VP.ISSUED = '1') THEN 'ALL'
ELSE 'PART' END CALL_STATUS,
CASE WHEN (VP.NEWS = '1' OR VP.CALLES = '1') AND VP.ISSUED = '0' THEN 'NONE'
WHEN VP.NEWS = '0' AND VP.CALLES = '0' AND VP.ISSUED = '1' THEN 'ALL'
ELSE 'ALL' END ISSUE_STATUS
FROM Z_SFC_DISPATCH ZSD
INNER JOIN Z_CALL_ITEM ZCI ON ZCI.SFC_DISPATCH_BO = ZSD.HANDLE
INNER JOIN SHOP_ORDER SO ON SO.SITE = ZSD.SITE AND ZSD.SHOP_ORDER = SO.SHOP_ORDER
LEFT JOIN CUSTOM_FIELDS CF ON CF.HANDLE = SO.HANDLE AND CF.ATTRIBUTE = 'WORK_ORDER'
LEFT JOIN CUSTOM_FIELDS CS ON CS.HANDLE = SO.HANDLE AND CS.ATTRIBUTE = 'ITEM_NUMBER'
INNER JOIN ITEM IT ON IT.HANDLE = SO.ITEM_BO
LEFT JOIN ITEM_T ITT ON ITT.ITEM_BO = IT.HANDLE AND ITT.LOCALE = 'zh'
INNER JOIN ITEM CP ON CP.HANDLE = ZCI.COMPONENT_BO
INNER JOIN OPERATION OP ON OP.SITE = ZCI.SITE AND OP.OPERATION = ZCI.OPERATION AND OP.CURRENT_REVISION = 'true'
LEFT JOIN OPERATION_T OPT ON OPT.OPERATION_BO = OP.HANDLE AND OPT.LOCALE = 'zh'
LEFT JOIN (
SELECT SFC_DISPATCH_BO,
MAX(DECODE(STATUS, '801', '1', '0')) NEWS,
MAX(DECODE(STATUS, '802', '1', '0')) CALLES,
MAX(DECODE(STATUS, '803', '1', '0')) ISSUED,
MAX(DECODE(STATUS, '804', '1', '0')) CANCELED
FROM Z_CALL_ITEM
GROUP BY SFC_DISPATCH_BO
) VP ON VP.SFC_DISPATCH_BO = ZCI.SFC_DISPATCH_BO
WHERE ZSD.SITE = #{site}
<if test="dispatchNo != null and dispatchNo != ''">
AND ZSD.DISPATCH_NO = #{dispatchNo}
</if>
<if test="workCenter != null and workCenter != ''">
AND ZSD.WORK_CENTER = #{workCenter}
</if>
<if test="dispatchStatus != null and dispatchStatus != ''">
AND ZSD.DISPATCH_STATUS = #{dispatchStatus}
</if>
<if test="workOrder != null and workOrder != ''">
AND CF.VALUE LIKE '%' ||#{workOrder}|| '%'
</if>
<if test="shopOrder != null and shopOrder != ''">
AND SO.SHOP_ORDER = #{shopOrder}
</if>
<if test="resourceType != null and resourceType != ''">
AND ZSD.RESOURCE_TYPE = #{resourceType}
</if>
<if test="resrce != null and resrce != ''">
AND ZCI.RESRCE = #{resrce}
</if>
<if test="component != null and component != ''">
AND CP.ITEM = #{component}
</if>
<if test="startFromDate != null">
AND ZSD.PLANNED_START_DATE >= #{startFromDate}
</if>
<if test="startToDate != null">
AND ZSD.PLANNED_START_DATE &lt;= #{startToDate}
</if>
GROUP BY ZCI.SITE, CF.VALUE, CS.VALUE, ZSD.WORK_CENTER, ZSD.SHOP_ORDER, ZSD.SFC, ZSD.DISPATCH_NO, IT.ITEM, ITT.DESCRIPTION, ZSD.BLANKING_SIZE,
ZSD.STEP_ID, ZCI.SFC_DISPATCH_BO, ZSD.DISPATCH_STATUS, ZCI.OPERATION, OPT.DESCRIPTION, ZSD.RESOURCE_TYPE, ZCI.RESRCE, ZSD.DISPATCH_QTY, ZSD.PLANNED_START_DATE, ZSD.REMARK,
VP.NEWS, VP.CALLES, VP.ISSUED, VP.CANCELED
)
WHERE 1= 1
<if test="callStatus != null and callStatus != ''">
AND CALL_STATUS = #{callStatus}
</if>
<if test="issueStatus != null and issueStatus != ''">
AND ISSUE_STATUS = #{issueStatus}
</if>
ORDER BY SFC, STEP_ID
</select>
<select id="findCallItemDetailList" resultMap="FullResultMap">
SELECT ZCI.HANDLE, ZCI.SITE, ZCI.CALL_ITEM_NO, CF.VALUE WORK_ORDER, ZCI.SHOP_ORDER, ZCI.SFC, ZSD.DISPATCH_NO, CP.ITEM, CT.DESCRIPTION ITEM_DESCRIPTION, ZSD.BLANKING_SIZE, ZSD.STEP_ID,
ZCI.STATUS, ZCI.OPERATION, OT.DESCRIPTION OPERATION_DESCRIPTION, ZSD.RESOURCE_TYPE, ZCI.RESRCE, ZSD.EMPLOYEE, ZCI.REQUIRED_DATE_TIME, ZCI.REQUIRED_QTY, ZCI.CALL_TYPE, ZSD.PLANNED_START_DATE,
CASE WHEN ZCI.CALL_TYPE = 'OPERATION' AND CS.VALUE = 'Y' THEN N'外协'
WHEN ZCI.CALL_TYPE = 'OPERATION' AND (CS.VALUE IS NULL OR CS.VALUE = 'N') THEN ZSDD.RESRCE
WHEN ZSH.RESRCE IS NOT NULL THEN ZSH.RESRCE END SOURCE_RESOURCE
FROM Z_CALL_ITEM ZCI
INNER JOIN Z_SFC_DISPATCH ZSD ON ZSD.HANDLE = ZCI.SFC_DISPATCH_BO
INNER JOIN SFC SC ON SC.SITE = ZSD.SITE AND SC.SFC = ZSD.SFC
INNER JOIN SHOP_ORDER SO ON SO.SITE = ZCI.SITE AND SO.SHOP_ORDER = ZCI.SHOP_ORDER
LEFT JOIN CUSTOM_FIELDS CF ON CF.HANDLE = SO.HANDLE AND CF."ATTRIBUTE" = 'WORK_ORDER'
INNER JOIN ITEM CP ON CP.HANDLE = ZCI.COMPONENT_BO
LEFT JOIN ITEM_T CT ON CT.ITEM_BO = CP.HANDLE AND CT.LOCALE = 'zh'
INNER JOIN OPERATION OP ON OP.SITE = ZCI.SITE AND OP.OPERATION = ZCI.OPERATION AND OP.CURRENT_REVISION = 'true'
LEFT JOIN OPERATION_T OT ON OT.OPERATION_BO = OP.HANDLE AND OT.LOCALE = 'zh'
LEFT JOIN Z_SFC_DISPATCH ZSDD ON ZSDD.SITE = ZSD.SITE AND ZSDD.SFC = ZSD.SFC AND ZSDD.STEP_ID = ZSD.PREPOSITION_STEP_ID
INNER JOIN SFC_ROUTER SR ON SR.SFC_ROUTING_BO = 'SFCRoutingBO:'||SC.HANDLE
LEFT JOIN ROUTER_STEP RS ON RS.ROUTER_BO = SR.ROUTER_BO AND RS.STEP_ID = ZSDD.STEP_ID
LEFT JOIN ROUTER_OPERATION RO ON RO.ROUTER_STEP_BO = RS.HANDLE
LEFT JOIN CUSTOM_FIELDS CS ON CS.HANDLE = RO.HANDLE AND CS."ATTRIBUTE" = 'OUT_SOURCE'
LEFT JOIN (
SELECT SC.SITE, IV.ITEM_BO, ZS.SFC, ZS.DISPATCH_SEQ
FROM SFC SC
INNER JOIN INVENTORY IV ON IV.SITE = SC.SITE AND SC.SFC = IV.INVENTORY_ID
INNER JOIN (
SELECT SITE, SFC, MAX(DISPATCH_SEQ) DISPATCH_SEQ
FROM Z_SFC_DISPATCH
GROUP BY SITE, SFC
) ZS ON ZS.SITE = SC.SITE AND ZS.SFC = SC.SFC
WHERE IV.QTY_ON_HAND > 0
) VS ON VS.SITE = ZCI.SITE AND ZCI.SFC = VS.SFC AND VS.ITEM_BO = ZCI.COMPONENT_BO
LEFT JOIN Z_SFC_DISPATCH ZSH ON ZSH.SITE = VS.SITE AND ZSH.SFC = VS.SFC AND ZSH.DISPATCH_SEQ = VS.DISPATCH_SEQ
WHERE ZCI.SITE = #{site}
<if test="workCenter != null and workCenter != ''" >
AND ZSD.WORK_CENTER = #{workCenter}
</if>
<if test="workOrder != null and workOrder != ''" >
AND CF.VALUE = #{workOrder}
</if>
<if test="shopOrder != null and shopOrder != ''" >
AND SO.SHOP_ORDER = #{shopOrder}
</if>
<if test="dispatchNo != null and dispatchNo != ''" >
AND ZSD.DISPATCH_NO = #{dispatchNo}
</if>
<if test="dispatchStatus != null and dispatchStatus != ''" >
AND ZSD.DISPATCH_STATUS = #{dispatchStatus}
</if>
<if test="status != null and status != ''" >
AND ZCI.STATUS = #{status}
</if>
<if test="resourceType != null and resourceType != ''" >
AND ZSD.RESOURCE_TYPE = #{resourceType}
</if>
<if test="resrce != null and resrce != ''" >
AND ZSD.RESRCE = #{resrce}
</if>
<if test="component != null and component != ''" >
AND CP.ITEM = #{component}
</if>
<if test="callType != null and callType != ''" >
AND ZCI.CALL_TYPE = #{callType}
</if>
<if test="startFromDate != null">
AND ZSD.PLANNED_START_DATE >= #{startFromDate}
</if>
<if test="startToDate != null">
AND ZSD.PLANNED_START_DATE &lt;= #{startToDate}
</if>
<if test="requireFromDate != null">
AND ZCI.REQUIRED_DATE_TIME >= #{requireFromDate}
</if>
<if test="requireToDate != null">
AND ZCI.REQUIRED_DATE_TIME &lt;= #{requireToDate}
</if>
ORDER BY ZSD.SFC, ZSD.STEP_ID, ZCI.CALL_TYPE
</select>
<select id="findCallItemDetailListByDispatchBo" resultMap="FullResultMap">
SELECT ZCI.HANDLE, ZCI.SITE, ZCI.CALL_ITEM_NO, CF.VALUE WORK_ORDER, ZCI.SHOP_ORDER, ZCI.SFC, ZSD.DISPATCH_NO, CP.ITEM, CT.DESCRIPTION ITEM_DESCRIPTION, ZSD.BLANKING_SIZE, ZSD.STEP_ID,
ZCI.STATUS, ZCI.OPERATION, OT.DESCRIPTION OPERATION_DESCRIPTION, ZSD.RESOURCE_TYPE, ZCI.RESRCE, ZSD.EMPLOYEE, ZCI.REQUIRED_DATE_TIME, ZCI.REQUIRED_QTY, ZCI.CALL_TYPE, ZSD.PLANNED_START_DATE,
CASE WHEN ZCI.CALL_TYPE = 'OPERATION' AND CS.VALUE = 'Y' THEN N'外协'
WHEN ZCI.CALL_TYPE = 'OPERATION' AND (CS.VALUE IS NULL OR CS.VALUE = 'N') THEN ZSDD.RESRCE
WHEN ZSH.RESRCE IS NOT NULL THEN ZSH.RESRCE END SOURCE_RESOURCE
FROM Z_CALL_ITEM ZCI
INNER JOIN Z_SFC_DISPATCH ZSD ON ZSD.HANDLE = ZCI.SFC_DISPATCH_BO
INNER JOIN SFC SC ON SC.SITE = ZSD.SITE AND SC.SFC = ZSD.SFC
INNER JOIN SHOP_ORDER SO ON SO.SITE = ZCI.SITE AND SO.SHOP_ORDER = ZCI.SHOP_ORDER
LEFT JOIN CUSTOM_FIELDS CF ON CF.HANDLE = SO.HANDLE AND CF."ATTRIBUTE" = 'WORK_ORDER'
INNER JOIN ITEM CP ON CP.HANDLE = ZCI.COMPONENT_BO
LEFT JOIN ITEM_T CT ON CT.ITEM_BO = CP.HANDLE AND CT.LOCALE = 'zh'
INNER JOIN OPERATION OP ON OP.SITE = ZCI.SITE AND OP.OPERATION = ZCI.OPERATION AND OP.CURRENT_REVISION = 'true'
LEFT JOIN OPERATION_T OT ON OT.OPERATION_BO = OP.HANDLE AND OT.LOCALE = 'zh'
LEFT JOIN Z_SFC_DISPATCH ZSDD ON ZSDD.SITE = ZSD.SITE AND ZSDD.SFC = ZSD.SFC AND ZSDD.STEP_ID = ZSD.PREPOSITION_STEP_ID
INNER JOIN SFC_ROUTER SR ON SR.SFC_ROUTING_BO = 'SFCRoutingBO:'||SC.HANDLE
LEFT JOIN ROUTER_STEP RS ON RS.ROUTER_BO = SR.ROUTER_BO AND RS.STEP_ID = ZSDD.STEP_ID
LEFT JOIN ROUTER_OPERATION RO ON RO.ROUTER_STEP_BO = RS.HANDLE
LEFT JOIN CUSTOM_FIELDS CS ON CS.HANDLE = RO.HANDLE AND CS."ATTRIBUTE" = 'OUT_SOURCE'
LEFT JOIN (
SELECT SC.SITE, IV.ITEM_BO, ZS.SFC, ZS.DISPATCH_SEQ
FROM SFC SC
INNER JOIN INVENTORY IV ON IV.SITE = SC.SITE AND SC.SFC = IV.INVENTORY_ID
INNER JOIN (
SELECT SITE, SFC, MAX(DISPATCH_SEQ) DISPATCH_SEQ
FROM Z_SFC_DISPATCH
GROUP BY SITE, SFC
) ZS ON ZS.SITE = SC.SITE AND ZS.SFC = SC.SFC
WHERE IV.QTY_ON_HAND > 0
) VS ON VS.SITE = ZCI.SITE AND VS.ITEM_BO = ZCI.COMPONENT_BO
LEFT JOIN Z_SFC_DISPATCH ZSH ON ZSH.SITE = VS.SITE AND ZSH.SFC = VS.SFC AND ZSH.DISPATCH_SEQ = VS.DISPATCH_SEQ
WHERE ZCI.SITE = #{site}
AND ZCI.SFC_DISPATCH_BO IN
<foreach item="item" collection="list" separator="," open="(" close=")" index="">
#{item}
</foreach>
ORDER BY ZSD.SFC, ZSD.STEP_ID, ZCI.CALL_TYPE
</select>
<update id="updateCallItemStatusByDispatchBo">
UPDATE Z_CALL_ITEM SET STATUS = #{status}, MODIFY_USER = #{user}, MODIFIED_DATE_TIME = #{dateTime}
WHERE STATUS != '804' AND SFC_DISPATCH_BO IN
<foreach item="item" collection="list" separator="," open="(" close=")" index="">
#{item}
</foreach>
</update>
<update id="updateCallItemStatusByHandle">
UPDATE Z_CALL_ITEM SET STATUS = #{status}, MODIFY_USER = #{user}, MODIFIED_DATE_TIME = #{dateTime}
WHERE HANDLE IN
<foreach item="item" collection="list" separator="," open="(" close=")" index="">
#{item}
</foreach>
</update>
<update id="updateCallItemStatusByCallItemNo">
UPDATE Z_CALL_ITEM SET STATUS = #{status}, MODIFY_USER = #{user}, MODIFIED_DATE_TIME = #{dateTime}
WHERE STATUS != '804' AND CALL_ITEM_NO IN
<foreach item="item" collection="list" separator="," open="(" close=")" index="">
#{item}
</foreach>
</update>
<update id="refreshRequiredTime">
UPDATE Z_CALL_ITEM SET MODIFY_USER = #{user}, MODIFIED_DATE_TIME = #{dateTime}, REQUIRED_DATE_TIME = (
SELECT ZSD.PLANNED_START_DATE
FROM Z_SFC_DISPATCH ZSD
WHERE Z_CALL_ITEM.SFC_DISPATCH_BO = ZSD.HANDLE
)
WHERE Z_CALL_ITEM.CALL_ITEM_NO IN
<foreach item="item" collection="list" separator="," open="(" close=")" index="">
#{item}
</foreach>
</update>
<select id="findIssueMatchCallItemList" resultMap="FullResultMap">
SELECT B.HANDLE, B.SITE, B.CALL_ITEM_NO, B.SHOP_ORDER, B.SFC, B.RESRCE, B.REQUIRED_QTY, NVL(B.ISSUE_QTY,0) ISSUE_QTY, B.REQUIRED_DATE_TIME, B.STATUS
FROM Z_CALL_ITEM B
INNER JOIN Z_SFC_DISPATCH P ON B.SFC_DISPATCH_BO = P.HANDLE
INNER JOIN ITEM M ON B.COMPONENT_BO = M.HANDLE
INNER JOIN SHOP_ORDER Z ON Z.SITE = B.SITE AND Z.SHOP_ORDER = B.SHOP_ORDER
LEFT JOIN CUSTOM_FIELDS CF ON CF.HANDLE = Z.HANDLE AND CF."ATTRIBUTE" = 'WORK_ORDER'
WHERE B.SITE = #{site} AND M.ITEM = #{item}
AND (B.ISSUE_QTY IS NULL OR B.ISSUE_QTY &lt; B.REQUIRED_QTY)
<if test="blankingSize != null and blankingSize != ''">
AND P.BLANKING_SIZE = #{blankingSize}
</if>
<if test="workOrder != null and workOrder != ''">
AND CF.VALUE = #{workOrder}
</if>
<if test="resource != null and resource != ''">
AND B.RESRCE = #{resource}
</if>
ORDER BY B.REQUIRED_DATE_TIME
</select>
<select id="finsIssueItemListToResource" resultMap="FullResultMap">
SELECT VIP.SITE, VIP.WORK_ORDER, VIP.CALL_TYPE, VIP.ITEM_GROUP, VIP.ITEM_BO, VIP.ITEM, VIP.ITEM_DESCRIPTION, VIP.REQUIRED_QTY, VIP.BLANKING_SIZE, VIP.RESRCE, SIP.SOURCE_RESOURCE
FROM (
SELECT L.SITE, CF.VALUE WORK_ORDER, L.CALL_TYPE, IG.ITEM_GROUP, CP.HANDLE ITEM_BO, CP.ITEM, CT.DESCRIPTION ITEM_DESCRIPTION, SUM(L.REQUIRED_QTY)-SUM(NVL(L.ISSUE_QTY,0)) REQUIRED_QTY, W.BLANKING_SIZE, W.RESRCE
FROM Z_CALL_ITEM L
INNER JOIN Z_SFC_DISPATCH W ON L.SFC_DISPATCH_BO = W.HANDLE
INNER JOIN ITEM CP ON CP.HANDLE = L.COMPONENT_BO
LEFT JOIN ITEM_T CT ON CT.ITEM_BO = CP.HANDLE AND CT.LOCALE = 'zh'
LEFT JOIN ITEM_GROUP_MEMBER IGM ON IGM.ITEM_BO = CP.HANDLE
LEFT JOIN ITEM_GROUP IG ON IG.HANDLE = IGM.ITEM_GROUP_BO
INNER JOIN SHOP_ORDER SO ON SO.SITE = L.SITE AND SO.SHOP_ORDER = L.SHOP_ORDER
LEFT JOIN CUSTOM_FIELDS CF ON CF.HANDLE = SO.HANDLE AND CF."ATTRIBUTE" = 'WORK_ORDER'
WHERE L.SITE = #{site} AND L.STATUS = '802'
<if test="workCenter != null and workCenter != ''">
AND W.WORK_CENTER = #{workCenter}
</if>
<if test="resource != null and resource != ''">
AND W.RESRCE = #{resource}
</if>
<if test="shopOrder != null and shopOrder != ''">
AND SO.SHOP_ORDER = #{shopOrder}
</if>
<if test="workOrder != null and workOrder != ''">
AND CF.VALUE = #{workOrder}
</if>
<if test="requiredFromDT != null">
AND L.REQUIRED_DATE_TIME >= #{requiredFromDT}
</if>
<if test="requiredToDT != null">
AND L.REQUIRED_DATE_TIME &lt;= #{requiredToDT}
</if>
GROUP BY L.SITE, CF.VALUE, L.CALL_TYPE, IG.ITEM_GROUP, CP.HANDLE, CP.ITEM, CT.DESCRIPTION, W.BLANKING_SIZE, W.RESRCE
) VIP
LEFT JOIN (
SELECT L.SITE, L.ITEM_BO, ZD.RESRCE SOURCE_RESOURCE
FROM SFC L
INNER JOIN INVENTORY W ON W.SITE = L.SITE AND L.SFC = W.INVENTORY_ID
INNER JOIN (
SELECT SITE, SFC, MAX(DISPATCH_SEQ) DISPATCH_SEQ
FROM Z_SFC_DISPATCH GROUP BY SITE, SFC
) ZS ON ZS.SITE = L.SITE AND ZS.SFC = L.SFC
INNER JOIN Z_SFC_DISPATCH ZD ON ZD.SITE = ZS.SITE AND ZD.SFC = ZS.SFC AND ZD.DISPATCH_SEQ = ZS.DISPATCH_SEQ
WHERE W.QTY_ON_HAND > 0
) SIP
ON VIP.SITE = SIP.SITE AND VIP.ITEM_BO = SIP.ITEM_BO AND VIP.REQUIRED_QTY > 0
ORDER BY VIP.WORK_ORDER, VIP.ITEM
</select>
<select id="finsIssueItemListNoResource" resultMap="FullResultMap">
SELECT VIP.SITE, VIP.WORK_ORDER, VIP.CALL_TYPE, VIP.ITEM_GROUP, VIP.ITEM_BO, VIP.ITEM, VIP.ITEM_DESCRIPTION, VIP.REQUIRED_QTY, VIP.BLANKING_SIZE, SIP.SOURCE_RESOURCE
FROM (
SELECT L.SITE, CF.VALUE WORK_ORDER, L.CALL_TYPE, IG.ITEM_GROUP, CP.HANDLE ITEM_BO, CP.ITEM, CT.DESCRIPTION ITEM_DESCRIPTION, SUM(L.REQUIRED_QTY)-SUM(NVL(L.ISSUE_QTY,0)) REQUIRED_QTY, W.BLANKING_SIZE
FROM Z_CALL_ITEM L
INNER JOIN Z_SFC_DISPATCH W ON L.SFC_DISPATCH_BO = W.HANDLE
INNER JOIN ITEM CP ON CP.HANDLE = L.COMPONENT_BO
LEFT JOIN ITEM_T CT ON CT.ITEM_BO = CP.HANDLE AND CT.LOCALE = 'zh'
LEFT JOIN ITEM_GROUP_MEMBER IGM ON IGM.ITEM_BO = CP.HANDLE
LEFT JOIN ITEM_GROUP IG ON IG.HANDLE = IGM.ITEM_GROUP_BO
INNER JOIN SHOP_ORDER SO ON SO.SITE = L.SITE AND SO.SHOP_ORDER = L.SHOP_ORDER
LEFT JOIN CUSTOM_FIELDS CF ON CF.HANDLE = SO.HANDLE AND CF."ATTRIBUTE" = 'WORK_ORDER'
WHERE L.SITE = #{site} AND L.STATUS = '802'
<if test="workCenter != null and workCenter != ''">
AND W.WORK_CENTER = #{workCenter}
</if>
<if test="resource != null and resource != ''">
AND W.RESRCE = #{resource}
</if>
<if test="shopOrder != null and shopOrder != ''">
AND SO.SHOP_ORDER = #{shopOrder}
</if>
<if test="workOrder != null and workOrder != ''">
AND CF.VALUE = #{workOrder}
</if>
<if test="requiredFromDT != null">
AND L.REQUIRED_DATE_TIME >= #{requiredFromDT}
</if>
<if test="requiredToDT != null">
AND L.REQUIRED_DATE_TIME &lt;= #{requiredToDT}
</if>
GROUP BY L.SITE, CF.VALUE, L.CALL_TYPE, IG.ITEM_GROUP, CP.HANDLE, CP.ITEM, CT.DESCRIPTION, W.BLANKING_SIZE
) VIP
LEFT JOIN (
SELECT L.SITE, L.ITEM_BO, ZD.RESRCE SOURCE_RESOURCE
FROM SFC L
INNER JOIN INVENTORY W ON W.SITE = L.SITE AND L.SFC = W.INVENTORY_ID
INNER JOIN (
SELECT SITE, SFC, MAX(DISPATCH_SEQ) DISPATCH_SEQ
FROM Z_SFC_DISPATCH GROUP BY SITE, SFC
) ZS ON ZS.SITE = L.SITE AND ZS.SFC = L.SFC
INNER JOIN Z_SFC_DISPATCH ZD ON ZD.SITE = ZS.SITE AND ZD.SFC = ZS.SFC AND ZD.DISPATCH_SEQ = ZS.DISPATCH_SEQ
WHERE W.QTY_ON_HAND > 0
) SIP
ON VIP.SITE = SIP.SITE AND VIP.ITEM_BO = SIP.ITEM_BO AND VIP.REQUIRED_QTY > 0
ORDER BY VIP.WORK_ORDER, VIP.ITEM
</select>
<select id="findCallItemListPda" resultMap="FullResultMap">
SELECT MML.*,ZSD.PLANNED_START_DATE FROM
(
SELECT ZCI.SITE, CF.VALUE WORK_ORDER, WC.WORK_CENTER, WCT.DESCRIPTION WORK_CENTER_DESCRIPTION,
ZCI.SHOP_ORDER ,
IM.ITEM, IT.DESCRIPTION ITEM_DESCRIPTION,
CP.ITEM COMPONENT, ITT.DESCRIPTION COMPONENT_DESCRIPTION,
ZSD.BLANKING_SIZE,
ZCI.RESRCE, ZCI.CALL_TYPE,
/*MIN(SO.PLANNED_START_DATE) ,*/
SUM(ZCI.REQUIRED_QTY) REQUIRED_QTY
FROM Z_CALL_ITEM ZCI
INNER JOIN Z_SFC_DISPATCH ZSD ON ZSD.HANDLE = ZCI.SFC_DISPATCH_BO
INNER JOIN SHOP_ORDER SO ON SO.SITE = ZCI.SITE AND SO.SHOP_ORDER = ZCI.SHOP_ORDER
LEFT JOIN CUSTOM_FIELDS CF ON CF.HANDLE = SO.HANDLE AND CF."ATTRIBUTE" = 'WORK_ORDER'
INNER JOIN WORK_CENTER WC ON WC.HANDLE = SO.PLANNED_WORK_CENTER_BO
INNER JOIN WORK_CENTER_T WCT ON WCT.WORK_CENTER_BO = WC.HANDLE
INNER JOIN ITEM IM ON IM.HANDLE = SO.ITEM_BO
INNER JOIN ITEM_T IT ON IT.ITEM_BO = IM.HANDLE AND IT.LOCALE = #{local}
INNER JOIN ITEM CP ON CP.HANDLE = ZCI.COMPONENT_BO
INNER JOIN ITEM_T ITT ON ITT.ITEM_BO = CP.HANDLE AND ITT.LOCALE = #{local}
WHERE ZCI.SITE = #{site}
GROUP BY ZCI.SITE, CF.VALUE, WC.WORK_CENTER, IM.ITEM, ZSD.BLANKING_SIZE, CP.ITEM, ZCI.RESRCE, ZCI.CALL_TYPE,ZCI.SHOP_ORDER ,
WCT.DESCRIPTION ,IT.DESCRIPTION , ITT.DESCRIPTION
ORDER BY CF.VALUE ,ZCI.RESRCE, IM.ITEM ) MML
INNER JOIN
( SELECT ZSD.BLANKING_SIZE ,ZSD.RESRCE ,ZSD.WORK_CENTER ,ZSD.SHOP_ORDER ,
MIN(ZSD.PLANNED_START_DATE) PLANNED_START_DATE
FROM WIP.Z_SFC_DISPATCH ZSD
WHERE ZSD.SITE = #{site}
<if test="user != null and user != ''">AND ZSD.EMPLOYEE LIKE #{user}</if>
GROUP BY ZSD.WORK_CENTER ,ZSD.BLANKING_SIZE ,ZSD.SHOP_ORDER ,ZSD.RESRCE
) ZSD
ON ZSD.SHOP_ORDER = MML.SHOP_ORDER AND ZSD.BLANKING_SIZE = MML.BLANKING_SIZE
AND ZSD.RESRCE = MML.RESRCE AND ZSD.WORK_CENTER = MML.WORK_CENTER
<if test="callItem.workCenter != null and callItem.workCenter != ''">
AND MML.WORK_CENTER = #{callItem.workCenter}
</if>
<if test="callItem.resrce != null and callItem.resrce != ''">
AND MML.RESRCE = #{callItem.resrce}
</if>
<if test="callItem.component != null and callItem.component != ''">
AND MML.COMPONENT = #{callItem.component}
</if>
<if test="callItem.status != null and callItem.status != ''">
AND MML.STATUS = #{callItem.status}
</if>
<if test="callItem.startFromDate != null">
AND ZSD.PLANNED_START_DATE >= #{callItem.startFromDate}
</if>
<if test="callItem.startToDate != null">
AND ZSD.PLANNED_START_DATE &lt;= #{callItem.startToDate}
</if>
ORDER BY MML.SHOP_ORDER,MML.WORK_CENTER,MML.ITEM,MML.COMPONENT,MML.BLANKING_SIZE,ZSD.PLANNED_START_DATE
</select>
<select id="findRefreshCallItemPda" resultMap="FullResultMap">
SELECT CI.HANDLE ,CI.SFC ,CI.COMPONENT_BO ,BC.QTY REQUIRED_QTY, CF.VALUE STEP_ID
FROM Z_CALL_ITEM CI
LEFT JOIN SFC S ON S.SFC = CI.SFC
LEFT JOIN SFC_BOM SB ON SB.SFC_BO = S.HANDLE
LEFT JOIN BOM_COMPONENT BC ON BC.BOM_BO = SB.BOM_BO AND BC.COMPONENT_GBO = CI.COMPONENT_BO
LEFT JOIN CUSTOM_FIELDS CF ON CF.HANDLE = BC.HANDLE AND CF."ATTRIBUTE" = 'STEP_ID' AND CF.VALUE = CI.STEP_ID
WHERE HANDLE IN
<foreach item="item" collection="list" separator="," open="(" close=")" index="">
#{item}
</foreach>
</select>
</mapper>