#
luxiaotao1123
2024-02-01 528d0da19f5fc3f5c78af3c99a1f2cfa914a27dd
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
88
89
<?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.common.wms.mapper.OrderDetlMapper">
 
    <sql id="pakOutPageCondition">
        <if test="map.order_id!=null and map.order_id!='' ">
            and mod.order_id = #{map.order_id}
        </if>
        <if test="map.matnr!=null and map.matnr!='' ">
            and mod.matnr = #{map.matnr}
        </if>
        <if test="map.maktx!=null and map.maktx!='' ">
            and mod.maktx = #{map.maktx}
        </if>
        <if test="map.batch!=null and map.batch!='' ">
            and mod.batch = #{map.batch}
        </if>
    </sql>
 
    <select id="selectWorkingDetls" resultType="com.zy.asrs.common.wms.entity.OrderDetl">
        select * from wms_order_detl
        where 1=1
        and order_id = #{orderId}
        and qty &lt; anfme
    </select>
 
    <select id="selectItem" resultType="com.zy.asrs.common.wms.entity.OrderDetl">
        select * from wms_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="getPakoutPage" resultType="com.zy.asrs.common.wms.entity.OrderDetl">
        select
        mod.*
        from wms_order_detl mod
        inner join wms_order mo on mod.order_id = mo.id
        inner join wms_doc_type mdt on mo.doc_type = mdt.doc_id
        where 1=1
        and mo.settle &lt;= 2
        and mo.status = 1
        and mdt.pakout = 1
        <include refid="pakOutPageCondition"></include>
    </select>
 
    <update id="increase">
        update wms_order_detl
        set qty = qty + #{qty}
        where 1=1
        and order_id = #{orderId}
        and matnr = #{matnr}
        and host_id = #{hostId}
        <choose>
            <when test="batch != null and batch != ''">
                and batch = #{batch}
            </when>
            <otherwise>
                and (batch IS NULL OR batch = '')
            </otherwise>
        </choose>
    </update>
 
    <update id="decrease">
        update wms_order_detl
        set qty = qty - #{qty}
        where 1=1
        and order_no = #{orderNo}
        and matnr = #{matnr}
        and host_id = #{hostId}
        <choose>
            <when test="batch != null and batch != ''">
                and batch = #{batch}
            </when>
            <otherwise>
                and (batch IS NULL OR batch = '')
            </otherwise>
        </choose>
    </update>
 
</mapper>