自动化立体仓库 - WMS系统
whycq
2023-08-26 82bcd0328dddbaad65933e2fada22bc68e82b3d5
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<?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.ReportQueryMapper">
 
<!-- mapper不支持sql语句嵌套时,采用sql片段包含方式,解决xml标签问题 -->
<sql id="viewStockUseConditionSql">    
        <if test="row1!=null and row1!='' ">
            and row1 like '%' + #{row1} + '%'
        </if>
</sql>
 
<!-- 分页查询所有信息 -->
<select id="queryViewStockUseList" parameterType="com.zy.asrs.entity.ViewStockUseBean" resultType="com.zy.asrs.entity.ViewStockUseBean">
select top (#{pageSize}) * from asr_stk_use_view 
<where>
    row1 not in (select top ((#{pageNumber}-1)*#{pageSize}) row1 from asr_stk_use_view 
    <where>
        1=1
        <include refid="viewStockUseConditionSql"></include>        
    </where>
    order by row1 asc)
    <include refid="viewStockUseConditionSql"></include>
    <![CDATA[
        order by row1 asc
    ]]>
</where>
</select>
 
<select id="getViewStockUseCount" parameterType="com.zy.asrs.entity.ViewStockUseBean"    resultType="Integer">
select count(1) from asr_stk_use_view
<where>
<![CDATA[
    1=1
]]>
<include refid="viewStockUseConditionSql"></include>
</where>
</select>
 
<!-- 不分页查询所有信息,用于excel导出 -->
<select id="getViewStockUseAll" parameterType="com.zy.asrs.entity.ViewStockUseBean" resultType="com.zy.asrs.entity.ViewStockUseBean">
select * from asr_stk_use_view 
<where>
    <![CDATA[
         1=1
     ]]>
    <include refid="viewStockUseConditionSql"></include>
    <![CDATA[
        order by row1 asc
    ]]>
</where>
</select>
    <select id="selectWorkCountIn" resultType="com.zy.asrs.entity.ViewWorkCountInView">
        SELECT *
        FROM (
        select
            ROW_NUMBER() OVER(Order by a.oneday desc) as row
        , *
        FROM(
        SELECT * FROM asr_wrkin_count_view
                 WHERE
                 1 = 1 AND
                 (oneday >= #{start}
                 AND
                oneday &lt; #{end})
 
                 <if test="matnr != null and matnr !=''">
                     and matnr = #{matnr}
                 </if>
 
                ) a ) b
        WHERE 1=1 and b.row between ((#{curr}-1)*#{limit}+1) and (#{curr}*#{limit})
 
    </select>
    <select id="selectWorkCountInTotal" resultType="java.lang.Integer">
        SELECT COUNT(*) FROM asr_wrkin_count_view
        WHERE 1= 1 AND
        (oneday >= #{start}
        AND
        oneday &lt; #{end})
        <if test="matnr != null and matnr !='' ">
            and matnr = #{matnr}
        </if>
    </select>
    <select id="selectWorkCountOut" resultType="com.zy.asrs.entity.ViewWorkCountInView">
        SELECT *
        FROM (
                 select
                     ROW_NUMBER() OVER(Order by a.oneday desc) as row
        , *
                 FROM(
                         SELECT * FROM asr_wrkout_count_view
        WHERE
        1 = 1 AND
        (oneday > #{start}
        AND
        oneday &lt; #{end})
 
        <if test="matnr != null and matnr !=''">
            and matnr = #{matnr}
        </if>
        ) a ) b
        WHERE 1=1 and b.row between ((#{curr}-1)*#{limit}+1) and (#{curr}*#{limit})
    </select>
    <select id="selectWorkCountOutTotal" resultType="java.lang.Integer">
        SELECT COUNT(*) FROM asr_wrkout_count_view
        WHERE 1= 1 AND
        (oneday > #{start}
        AND
        oneday &lt; #{end})
        <if test="matnr != null and matnr !='' ">
            and matnr = #{matnr}
        </if>
    </select>
    <sql id="checkReportCondition">
        <if test="matnr!=null and matnr!='' ">
            and matnr like '%' + #{matnr} + '%'
        </if>
        <if test="maktx!=null and maktx!='' ">
            and maktx like '%' + #{maktx} + '%'
        </if>
        <if test="specs!=null and specs!='' ">
            and specs like '%' + #{specs} + '%'
        </if>
        <if test="batch!=null and batch!='' ">
            and batch like '%' + #{batch} + '%'
        </if>
        <if test="zpallet!=null and zpallet!='' ">
            and zpallet like '%' + #{zpallet} + '%'
        </if>
        <if test="locNo!=null and locNo!='' ">
            and locNo like '%' + #{locNo} + '%'
        </if>
        <if test="staNo!=null and staNo!='' ">
            and staNo like '%' + #{staNo} + '%'
        </if>
 
    </sql>
    <select id="selectCheckReport" resultType="com.zy.asrs.entity.result.CheckReport">
        SELECT  * FROM (
        SELECT ROW_NUMBER() OVER(Order by appeTime desc ) as row , * FROM asr_check_report WHERE 1 = 1
        <include refid="checkReportCondition"></include>  ) as a WHERE a.row between #{curr} and #{limit}
    </select>
    <select id="selectCheckReportCount" resultType="java.lang.Integer">
 
        SELECT COUNT(*) FROM asr_check_report WHERE 1 = 1
        <include refid="checkReportCondition"></include>
    </select>
 
</mapper>