Blame view

src/main/resources/mybatis/receipt/ReceiptContainerHeaderMapper.xml 3.73 KB
1
2
3
4
<?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">
5
<mapper namespace="com.huaheng.pc.receipt.receiptContainerHeader.mapper.ReceiptContainerHeaderMapper">
tangying authored
6
    <select id="selectUnCompletedReceiptContainer" resultType="com.huaheng.pc.receipt.receiptContainerHeader.domain.ReceiptContainerHeader">
7
        SELECT id, receiptContainerCode,receiptCode, warehouseId, warehouseCode, taskType, status, created, createdBy
8
9
        FROM receipt_container_header
        WHERE status &lt; 40
tangying authored
10
11
12
        <if test="id != null ">
            AND id = #{id}
        </if>
13
14
15
        <if test="receiptContainerCode != null and receiptContainerCode != ''">
            <bind name="receiptContainerCodePattern" value="'%' + receiptContainerCode + '%'" />
            AND receiptContainerCode like #{receiptContainerCodePattern}
tangying authored
16
        </if>
17
18
19
20
        <if test="receiptCode != null and receiptCode != ''">
            <bind name="receiptCodePattern" value="'%' + receiptCode + '%'" />
            AND receiptCode like #{receiptCodePattern}
        </if>
tangying authored
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
        <if test="warehouseId != null ">
            AND warehouseId = #{warehouseId}
        </if>
        <if test="warehouseCode != null and warehouseCode != ''">
            <bind name="warehouseCodePattern" value="'%' + warehouseCode + '%'" />
            AND warehouseCode like #{warehouseCodePattern}
        </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 != ''">
            <bind name="createdByPattern" value="'%' + createdBy + '%'" />
            AND createdBy like #{createdByPattern}
        </if>
    </select>
42
43

    <select id="getDetail" resultType="java.util.Map">
44
        SELECT d.id, d.receiptId, d.receiptCode, d.materialCode, d.batch, d.project, d.qtyCompleted, d.qty, m.name, s.dictLabel inventoryStatus, '个' unit
45
        FROM receipt_detail d
46
47
48
49
        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}
        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
50
51
    </select>
huhai authored
52
53
54
55
56
57
58
59
    <select id="getReceiptInfoByBill" resultType="java.util.Map">
        select rch.id, rch.receiptContainerCode as 'containerCode',rch.locationCode,rch.taskType,rch.`status`,rcd.materialCode,m.`name` as 'materialName',rcd.qty,rcd.created,rcd.createdBy
        from receipt_container_header rch
        LEFT JOIN receipt_container_detail rcd ON rcd.headerId=rch.id and rch.warehouseCode=#{warehouseCode}
        INNER JOIN receipt_header rh on rcd.receiptId=rh.id and rh.deleted=FALSE  and rh.`code`=#{receiptCode}
        INNER JOIN material m ON rcd.materialCode = m.code and m.deleted = FALSE
    </select>
tangying authored
60
61
62
    <select id="CheckContainer" resultType="java.lang.Integer">
        SELECT COUNT(*) AS count FROM task WHERE lastStatus &lt; 40 AND containerCode = #{containerCode}
    </select>
63
64
65
66
67
68
    <update id="updateReceiptDetailQty">
        UPDATE receipt_detail d
        INNER JOIN receipt_container_detail cd ON d.id=cd.receiptDetailId AND cd.headerId=#{headerId}
        SET d.qtyCompleted = d.qtyCompleted - cd.qty
    </update>
69
70
</mapper>