#
Junjie
2023-12-27 288f3d62008d7c68c36f7df3ff0a30efc5ca9459
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
<?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.LocDetlMapper">
 
    <sql id="stockOutCondition">
        <if test="map.loc_no!=null and map.loc_no!='' ">
            and a.loc_no like '%' + #{map.loc_no} + '%'
        </if>
        <if test="map.matnr!=null and map.matnr!='' ">
            and a.matnr like '%' + #{map.matnr} + '%'
        </if>
        <if test="map.maktx!=null and map.maktx!='' ">
            and a.maktx like '%' + #{map.maktx} + '%'
        </if>
        <if test="map.batch!=null and map.batch!='' ">
            and a.batch like '%' + #{map.batch} + '%'
        </if>
        <if test="map.anfme!=null and map.anfme!='' ">
            and a.anfme like '%' + #{map.anfme} + '%'
        </if>
        <if test="map.startTime!=null and map.endTime!=null">
            and a.modi_time between #{map.startTime} and #{map.endTime}
        </if>
        <if test="map.memo!=null and map.memo!='' and map.memo!='all'">
            and a.memo like '%' + #{map.memo} + '%'
        </if>
        <if test="map.memo!=null and map.memo!='' and map.memo=='all'">
            and a.memo is not null
            and a.memo !=''
        </if>
    </sql>
 
    <select id="getStockStatis" resultType="com.zy.asrs.common.wms.entity.LocDetl">
        select
        a.matnr
        , sum(a.anfme) as anfme
        from asr_loc_detl a
        where 1=1
        <include refid="stockOutCondition"></include>
        group by a.matnr
    </select>
 
    <select id="sum" resultType="java.lang.Integer">
        SELECT SUM(anfme) FROM asr_loc_detl
    </select>
 
</mapper>