TaskHeaderMapper.xml 9.79 KB
<?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.huaheng.pc.task.taskHeader.mapper.TaskHeaderMapper">
    <resultMap id="BaseResultMap" type="com.huaheng.pc.task.taskHeader.domain.TaskHeader">
        <!--@mbg.generated-->
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="warehouseCode" jdbcType="VARCHAR" property="warehouseCode"/>
        <result column="companyCode" jdbcType="VARCHAR" property="companyCode"/>
        <result column="taskType" jdbcType="VARCHAR" property="taskType"/>
        <result column="internalTaskType" jdbcType="VARCHAR" property="internalTaskType"/>
        <result column="referenceId" jdbcType="INTEGER" property="referenceId"/>
        <result column="referenceCode" jdbcType="VARCHAR" property="referenceCode"/>
        <result column="assignedUser" jdbcType="VARCHAR" property="assignedUser"/>
        <result column="confirmedBy" jdbcType="VARCHAR" property="confirmedBy"/>
        <result column="waveId" jdbcType="INTEGER" property="waveId"/>
        <result column="pickingCartCode" jdbcType="VARCHAR" property="pickingCartCode"/>
        <result column="pickingCartPos" jdbcType="VARCHAR" property="pickingCartPos"/>
        <result column="fromLocation" jdbcType="VARCHAR" property="fromLocation"/>
        <result column="toLocation" jdbcType="VARCHAR" property="toLocation"/>
        <result column="containerCode" jdbcType="VARCHAR" property="containerCode"/>
        <result column="startPickDateTime" jdbcType="TIMESTAMP" property="startPickDateTime"/>
        <result column="endPickDateTime" jdbcType="TIMESTAMP" property="endPickDateTime"/>
        <result column="rebatchLoc" jdbcType="VARCHAR" property="rebatchLoc"/>
        <result column="finishRebatch" jdbcType="INTEGER" property="finishRebatch"/>
        <result column="rebatchGroupCode" jdbcType="VARCHAR" property="rebatchGroupCode"/>
        <result column="allowRebatch" jdbcType="INTEGER" property="allowRebatch"/>
        <result column="taskProcessType" jdbcType="VARCHAR" property="taskProcessType"/>
        <result column="rebinBench" jdbcType="VARCHAR" property="rebinBench"/>
        <result column="rebined" jdbcType="INTEGER" property="rebined"/>
        <result column="startRebinDateTime" jdbcType="TIMESTAMP" property="startRebinDateTime"/>
        <result column="endRebinDateTime" jdbcType="TIMESTAMP" property="endRebinDateTime"/>
        <result column="rebinedBy" jdbcType="VARCHAR" property="rebinedBy"/>
        <result column="exceptionCode" jdbcType="VARCHAR" property="exceptionCode"/>
        <result column="exceptionHandledBy" jdbcType="VARCHAR" property="exceptionHandledBy"/>
        <result column="created" jdbcType="TIMESTAMP" property="created"/>
        <result column="createdBy" jdbcType="VARCHAR" property="createdBy"/>
        <result column="lastUpdated" jdbcType="TIMESTAMP" property="lastUpdated"/>
        <result column="lastUpdatedBy" jdbcType="VARCHAR" property="lastUpdatedBy"/>
        <result column="version" jdbcType="INTEGER" property="version"/>
        <result column="userDef1" jdbcType="VARCHAR" property="userDef1"/>
        <result column="userDef2" jdbcType="VARCHAR" property="userDef2"/>
        <result column="userDef3" jdbcType="VARCHAR" property="userDef3"/>
        <result column="processStamp" jdbcType="VARCHAR" property="processStamp"/>
        <result column="recvDock" jdbcType="VARCHAR" property="recvDock" />
        <result column="containQty" jdbcType="INTEGER" property="containQty" />
    </resultMap>
    <select id="getReceiptTask" resultType="java.util.Map">
   SELECT rd.id receiptDetailId,rd.receiptId,td.taskId, td.warehouseCode, td.id taskDetailId, td.status,
                 td.containerCode, td.qty, td.materialCode,rd.totalQty,td.materialSpec,
					rd.receiptCode,rd.inventorySts,
                 td.materialName, rd.batch, rd.lot, rd.projectNo,
                 rd.manufactureDate, rd.expirationDate
        FROM task_detail td
        INNER JOIN receipt_detail rd ON rd.id = td.billDetailId AND td.taskId = #{taskId,jdbcType=INTEGER}
   </select>

    <select id="UncompleteCount" resultType="java.lang.Integer">
        SELECT COUNT(*) AS count FROM task_header WHERE status &lt; 100 AND containerCode = #{containerCode} AND warehouseCode=#{warehouseCode}
    </select>

    <select id="getTasksStatus" resultType="com.huaheng.pc.task.taskHeader.domain.TaskHeader">
    select *
     FROM task_header
     where lastStatus &lt; 100
    </select>


    <sql id="Base_Column_List">
        <!--@mbg.generated-->
        id, warehouseCode, companyCode, taskType, internalTaskType, referenceId, referenceCode, fromLocation,
        assignedUser, confirmedBy, waveId, pickingCartCode, pickingCartPos, containerCode, toLocation,
        startPickDateTime, endPickDateTime, rebatchLoc, finishRebatch, rebatchGroupCode,
        allowRebatch, taskProcessType, rebinBench, rebined, startRebinDateTime, endRebinDateTime,
        rebinedBy, exceptionCode, exceptionHandledBy, created, createdBy, lastUpdated, lastUpdatedBy,
        version, userDef1, userDef2, userDef3,
        processStamp, containQty
    </sql>

    <select id="getUnCompleteTaskList" resultType="java.lang.Integer" parameterType="java.lang.String">
        select count(*) from task_header where status &lt; 100
        <choose>
            <when test="s !=null">
                and containerCode like CONCAT(#{s},'%')
            </when>
            <otherwise>
                and (containerCode like 'L%' or containerCode like 'B%')
            </otherwise>
        </choose>
        and taskType =800
    </select>

    <select id="autoCompleteDX" resultType="com.huaheng.pc.task.taskHeader.domain.TaskHeader">
        select * from task_header where warehouseCode='KS0001' and (containerCode like "X%" or containerCode like "D%") and status &lt; 100
    </select>

    <select id="selectLists" resultType="com.huaheng.pc.task.taskDetail.domain.TaskDetail">
        SELECT r.id, r.taskId,r.companyCode,r.warehouseCode,r.referenceCode,
               r.billCode,r.billDetailId,r.fromInventoryId,c.name companyName,

               r.materialCode, r.materialName,m.barCode barCode,m.spec,
               r.containerCode, r.fromLocation, r.toLocation,
               r.qty, t.taskType, r.status, r.lastUpdated, r.lastUpdatedBy,
               r.projectNo
        FROM task_detail r
        inner join task_header t on t.id=r.taskId
        inner join company c on r.companyCode=c.code
        inner join material m on r.warehouseCode=m.warehouseCode and m.code=r.materialCode

        <where>
            <if test="warehouseCode != null and warehouseCode != '' ">
                AND r.warehouseCode = #{warehouseCode}
            </if>
            <if test="companyCodeList != null and companyCodeList.size() > 0 ">
                AND r.companyCode in
                <foreach collection="companyCodeList" item="companyCodeItem" open="(" separator="," close=")">
                    #{companyCodeItem}
                </foreach>
            </if>
            and t.port = #{station} and r.containerCode like CONCAT(#{shelfNo},'%') and SUBSTRING(r.containerCode,6,1)=#{shelf} and r.status=10 order by r.referenceCode asc
        </where>
    </select>

    <select id="selectList1" resultType="com.huaheng.pc.task.taskDetail.domain.TaskDetail">
        SELECT r.id, r.taskId,r.companyCode,r.warehouseCode,
               r.referenceCode,c.name companyName,r.materialCode, r.materialName,
               m.barCode barCode,m.spec, r.containerCode, r.fromLocation,
               r.toLocation, r.qty, t.taskType, r.status,
               r.lastUpdated, r.lastUpdatedBy, r.projectNo
        FROM task_detail r
        inner join task_header t on t.id=r.taskId
        inner join company c on r.companyCode=c.code
        inner join material m on r.warehouseCode=m.warehouseCode and m.code=r.materialCode

        <where>
            <if test="warehouseCode != null and warehouseCode != '' ">
                AND r.warehouseCode = #{warehouseCode}
            </if>
            <if test="companyCodeList != null and companyCodeList.size() > 0 ">
                AND r.companyCode in
                <foreach collection="companyCodeList" item="companyCodeItem" open="(" separator="," close=")">
                    #{companyCodeItem}
                </foreach>
            </if>
            and t.port = #{station} and r.containerCode like CONCAT(#{shelfNo},'%') and r.status=10 order by r.referenceCode asc
        </where>
    </select>

    <select id="selectTaskLists" resultType="com.huaheng.pc.task.taskDetail.domain.TaskDetail">
        SELECT r.id, r.taskId,r.companyCode,r.warehouseCode,r.referenceCode,
               c.name companyName,
               r.materialCode, r.materialName,
               m.barCode barCode,m.spec, r.containerCode,
               r.fromLocation, r.toLocation, r.qty, t.taskType,
               r.status,  r.lastUpdated, r.lastUpdatedBy, r.projectNo
        FROM task_detail r
        inner join task_header t on t.id=r.taskId
        inner join company c on r.companyCode=c.code
        inner join material m on r.warehouseCode=m.warehouseCode and m.code=r.materialCode

        <where>
            <if test="warehouseCode != null and warehouseCode != '' ">
                AND r.warehouseCode = #{warehouseCode}
            </if>
            <if test="station != null and station != '' ">
                AND t.port = #{station}
            </if>
            <if test="companyCodeList != null and companyCodeList.size() > 0 ">
                AND r.companyCode in
                <foreach collection="companyCodeList" item="companyCodeItem" open="(" separator="," close=")">
                    #{companyCodeItem}
                </foreach>
            </if>
            and t.zoneCode='AGV' and r.status=10 order by r.referenceCode asc
        </where>
    </select>
</mapper>