自动化立体仓库 - WMS系统
#
luxiaotao1123
2022-03-29 55aa93a62254ff4fdfd1bb4163e55cac09b40302
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?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.zy.asrs.mapper.OrderDetlMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.zy.asrs.entity.OrderDetl">
        <id column="id" property="id" />
        <result column="order_id" property="orderId" />
        <result column="order_no" property="orderNo" />
        <result column="anfme" property="anfme" />
        <result column="qty" property="qty" />
        <result column="matnr" property="matnr" />
        <result column="maktx" property="maktx" />
        <result column="name" property="name" />
        <result column="specs" property="specs" />
        <result column="model" property="model" />
        <result column="batch" property="batch" />
        <result column="unit" property="unit" />
        <result column="barcode" property="barcode" />
        <result column="supplier" property="supplier" />
        <result column="unit_price" property="unitPrice" />
        <result column="item_num" property="itemNum" />
        <result column="count" property="count" />
        <result column="weight" property="weight" />
        <result column="status" property="status" />
        <result column="create_by" property="createBy" />
        <result column="create_time" property="createTime" />
        <result column="update_by" property="updateBy" />
        <result column="update_time" property="updateTime" />
        <result column="memo" property="memo" />
 
    </resultMap>
 
    <select id="selectItem" resultMap="BaseResultMap">
        select * from man_order_detl
        where 1=1
        and order_id = #{orderId}
        and matnr = #{matnr}
        <choose>
            <when test="batch != null and batch != ''">
                and batch = #{batch}
            </when>
            <otherwise>
                and (batch IS NULL OR batch = '')
            </otherwise>
        </choose>
    </select>
 
    <select id="selectItemByOrderNo" resultMap="BaseResultMap">
        select * from man_order_detl
        where 1=1
        and order_no = #{orderNo}
        and matnr = #{matnr}
        <choose>
            <when test="batch != null and batch != ''">
                and batch = #{batch}
            </when>
            <otherwise>
                and (batch IS NULL OR batch = '')
            </otherwise>
        </choose>
    </select>
 
    <select id="selectWorkingDetls" resultMap="BaseResultMap">
        select * from man_order_detl
        where 1=1
        and order_id = #{orderId}
        and qty &lt; anfme
    </select>
 
    <update id="increase">
        update man_order_detl
        set qty = qty + #{qty}
        where 1=1
        and order_id = #{orderId}
        and matnr = #{matnr}
        <choose>
            <when test="batch != null and batch != ''">
                and batch = #{batch}
            </when>
            <otherwise>
                and (batch IS NULL OR batch = '')
            </otherwise>
        </choose>
    </update>
 
</mapper>