TaskMapper.xml 4.63 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.task.mapper.TaskMapper">

    <select id="getTaskByLocationCode" resultType="com.huaheng.pc.task.task.domain.Task">
       SELECT * from task where firstStatus != 40 and (sourceLocation = #{location, jdbcType=VARCHAR} or destinationLocation = #{warehouse, jdbcType=VARCHAR} ) and warehouseCode = #{warehouse} limit 1;
    </select>

    <select id="getContainerMaterial" resultType="java.util.HashMap">
        SELECT  h.locationCode, d.id, d.receiptId, d.receiptDetailId, d.receiptCode, d.materialCode barcode, d.materialName name, d.qty
        FROM receipt_container_header h
        INNER JOIN receipt_container_detail d ON d.headerId = h.id AND h.status=0 AND h.receiptContainerCode = #{containerCode,jdbcType=VARCHAR}
    </select>

    <select id="getReceiptTask" resultType="java.util.HashMap">
        SELECT  td.warehouseId, td.warehouseCode, td.id taskDetailId, td.destinationLocation, td.status, td.containerCode,
                 td.qty, td.billId, td.billDetailId, td.billCode, td.materialCode, td.materialName,
                 rd.sourceLine, rd.batch, rd.lot, rd.project, rd.manufactureDate, rd.expirationDate, rd.inventoryStatus,
                 rd.materialCode, rd.price
        FROM task_detail td
        INNER JOIN receipt_detail rd ON rd.id = td.billDetailId AND td.taskId = #{taskId,jdbcType=INTEGER}
    </select>

    <select id="getTasks" resultType="com.huaheng.pc.task.task.domain.Task">
        SELECT id, warehouseId, warehouseCode, companyId, priority, type, station, containerId, containerCode, sourceLocation, destinationLocation, status, createdBy, beginTime, endTime, lastUpdated, lastUpdatedBy, userDef1, userDef2, userDef3
        FROM task
        <where>
            <if test="id != null">
                AND id = #{id}
            </if>
            <if test="warehouseId != null">
                AND warehouseId = #{warehouseId}
            </if>
            <if test="warehouseCode != null">
                AND warehouseCode = #{warehouseCode}
            </if>
            <if test="companyId != null">
                AND companyId = #{companyId}
            </if>
            <if test="priority != null">
                AND priority = #{priority}
            </if>
            <if test="type != null">
                AND type = #{type}
            </if>
            <if test="station != null">
                AND station = #{station}
            </if>
            <if test="containerId != null">
                AND containerId = #{containerId}
            </if>
            <if test="containerCode != null">
                AND containerCode = #{containerCode}
            </if>
            <if test="sourceLocation != null">
                AND sourceLocation = #{sourceLocation}
            </if>
            <if test="destinationLocation != null">
                AND destinationLocation = #{destinationLocation}
            </if>
            <if test="status != null">
                AND status = #{status}
            </if>
            <if test="createdBy != null">
                AND createdBy = #{createdBy}
            </if>
            <if test="beginTime != null">
                AND beginTime = #{beginTime}
            </if>
            <if test="endTime != null">
                AND endTime = #{endTime}
            </if>
            <if test="lastUpdated != null">
                AND lastUpdated = #{lastUpdated}
            </if>
            <if test="lastUpdatedBy != null">
                AND lastUpdatedBy = #{lastUpdatedBy}
            </if>
            <if test="userDef1 != null">
                AND userDef1 = #{userDef1}
            </if>
            <if test="userDef2 != null">
                AND userDef2 = #{userDef2}
            </if>
            <if test="userDef3 != null">
                AND userDef3 = #{userDef3}
            </if>
            <if test="sectionStartTime != null">
                AND  created >= #{sectionStartTime}
            </if>
            <if test="sectionEndTime != null">
                AND  created &lt;= #{sectionEndTime}
            </if>
        </where>
    </select>

    <select id="findUncompleteCyccountTask" resultType="java.lang.Integer">
        SELECT COUNT(*) from task WHERE type=700 AND `lastStatus` &lt; 40 and warehouseId = #{warehouseId} AND containerCode = #{containerCode}
    </select>

    <select id="UncompleteCount" resultType="java.lang.Integer">
        SELECT COUNT(*) AS count FROM task WHERE lastStatus &lt; 40 AND containerCode = #{containerCode} AND warehouseId=#{warehouseId}
    </select>

</mapper>