ReceiptContainerHeaderMapper.xml 6.13 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.receipt.receiptContainerHeader.mapper.ReceiptContainerHeaderMapper">
    <select id="selectUnCompletedReceiptContainer" resultType="com.huaheng.pc.receipt.receiptContainerHeader.domain.ReceiptContainerHeader">
        SELECT id, receiptContainerCode, warehouseId, warehouseCode, taskType, status, created, createdBy
        FROM receipt_container_header
        WHERE status &lt; 20
        <if test="id != null ">
            AND id = #{id}
        </if>
        <if test="receiptContainerCode != null and receiptContainerCode != ''">
            AND receiptContainerCode = #{receiptContainerCode}
        </if>
        <if test="warehouseId != null ">
            AND warehouseId = #{warehouseId}
        </if>
        <if test="warehouseCode != null and warehouseCode != ''">
            AND warehouseCode = #{warehouseCode}
        </if>
        <if test="taskType != null ">
            AND taskType = #{taskType}
        </if>
        <if test="params != null and params.createdBegin != null and params.createdBegin != ''">
            AND created &gt;= #{params.createdBegin}
        </if>
        <if test="params != null and params.createdEnd != null and params.createdEnd != ''">
            AND created &lt;= #{params.createdEnd}
        </if>
        <if test="createdBy != null and createdBy != ''">
            AND createdBy = #{createdBy}
        </if>
    </select>

    <select id="getDetail" resultType="java.util.Map">
        SELECT d.id, d.receiptId, d.receiptCode, d.materialCode, d.batch, d.project, d.qtyCompleted, d.qty, d.project, m.name, s.dictLabel inventoryStatus, '个' unit
        FROM receipt_detail d
        INNER JOIN material m ON d.materialCode = m.code and m.deleted = FALSE AND d.receiptCode = #{receiptCode}
                                  AND m.warehouseCode=d.warehouseCode AND d.warehouseCode=#{warehouseCode} and m.zoneCode&lt;>'AGV'
        INNER JOIN sys_dict_data s ON s.dictType = 'inventoryStatus' AND d.inventoryStatus = s.dictValue AND s.warehouseCode=m.warehouseCode
                                        AND s.enable = TRUE AND s.deleted = FALSE
    </select>

    <select id="getAGVDetail" resultType="java.util.Map">
        SELECT d.id, d.receiptId, d.receiptCode, d.materialCode, d.batch, d.project, d.qtyCompleted, d.qty, d.project, m.name, s.dictLabel inventoryStatus, '个' unit
        FROM receipt_detail d
        INNER JOIN material m ON d.materialCode = m.code and m.deleted = FALSE AND d.receiptCode = #{receiptCode}
                                  AND m.warehouseCode=d.warehouseCode AND d.warehouseCode=#{warehouseCode} and m.zoneCode='AGV'
        INNER JOIN sys_dict_data s ON s.dictType = 'inventoryStatus' AND d.inventoryStatus = s.dictValue AND s.warehouseCode=m.warehouseCode
                                        AND s.enable = TRUE AND s.deleted = FALSE
    </select>

    <select id="getReceiptInfoByBill" resultType="java.util.Map">
        select rch.receiptContainerCode as 'containerCode', rch.locationCode, rch.taskType, rch.status,
        rcd.id, rcd.materialCode, rcd.materialName as 'materialName', rcd.materialSpec as 'materialSpec',
        rcd.qty, rcd.created, rcd.createdBy, rcd.headerId, rcd.receiptDetailId, rcd.project
        from receipt_container_header rch
        inner join receipt_container_detail rcd ON
        rcd.headerId=rch.id
        INNER JOIN material m ON rcd.materialCode = m.code
        where m.zoneCode&lt;>'AGV' AND  rch.warehouseCode=#{warehouseCode} and rcd.receiptCode=#{receiptCode}
</select>

    <select id="getAGVReceiptInfoByBill" resultType="java.util.Map">
        select rch.receiptContainerCode as 'containerCode', rch.locationCode, rch.taskType, rch.status,
        rcd.id, rcd.materialCode, rcd.materialName as 'materialName', rcd.materialSpec as 'materialSpec',
        rcd.qty, rcd.created, rcd.createdBy, rcd.headerId, rcd.receiptDetailId, rcd.project
        from receipt_container_header rch
        inner join receipt_container_detail rcd ON
        rcd.headerId=rch.id
        INNER JOIN material m ON rcd.materialCode = m.code
        where m.zoneCode='AGV' AND  rch.warehouseCode=#{warehouseCode} and rcd.receiptCode=#{receiptCode}
</select>

    <select id="selectListByLike"  resultType="com.huaheng.pc.receipt.receiptContainerHeader.domain.ReceiptContainerHeader">
        SELECT h.id, h.receiptContainerCode, h.locationCode, h.warehouseId, h.warehouseCode, h.taskType, h.status, h.created, h.createdBy
        FROM receipt_container_header h
        <if test="receiptCode != null and receiptCode != ''">
            INNER JOIN (SELECT DISTINCT headerId FROM receipt_container_detail WHERE receiptCode = #{receiptCode}) d
            ON h.id = d.headerId
        </if>
        <where>
            <if test="id != null ">
                AND h.id = #{id}
            </if>
            <if test="receiptContainerCode != null and receiptContainerCode != ''">
                AND h.receiptContainerCode = #{receiptContainerCode}
            </if>
            <if test="locationCode != null and locationCode != ''">
                AND h.locationCode = #{locationCode}
            </if>
            <if test="warehouseId != null ">
                AND h.warehouseId = #{warehouseId}
            </if>
            <if test="warehouseCode != null ">
                AND h.warehouseCode = #{warehouseCode}
            </if>
            <if test="taskType != null ">
                AND h.taskType = #{taskType}
            </if>
            <if test="status != null ">
                AND h.status = #{status}
            </if>
            <if test="params != null and params.createdBegin != null and params.createdBegin != ''">
                AND h.created &gt;= #{params.createdBegin}
            </if>
            <if test="params != null and params.createdEnd != null and params.createdEnd != ''">
                AND h.created &lt;= #{params.createdEnd}
            </if>
            <if test="createdBy != null and createdBy != ''">
                AND h.createdBy = #{createdBy}
            </if>
        </where>
    </select>


</mapper>