| | |
| | | ) t where t.row between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize}) |
| | | </select> |
| | | |
| | | <sql id="groupLocWarnStatusCase"> |
| | | case |
| | | when mm.store_max is null and mm.store_min is null then '未设置' |
| | | when mm.store_max is not null and isnull(stock.anfme, 0) > mm.store_max then '超上限' |
| | | when mm.store_min is not null and isnull(stock.anfme, 0) < mm.store_min then '超下限' |
| | | else '正常' |
| | | end |
| | | </sql> |
| | | |
| | | <sql id="groupLocListCondition"> |
| | | where 1 = 1 |
| | | and (mm.memo is null or mm.memo != '打包上线') |
| | | <if test="matnr != null and matnr != ''"> |
| | | and mm.matnr like '%' + #{matnr} + '%' |
| | | </if> |
| | | <if test="maktx != null and maktx != ''"> |
| | | and mm.maktx like '%' + #{maktx} + '%' |
| | | </if> |
| | | <if test="specs != null and specs != ''"> |
| | | and mm.specs like '%' + #{specs} + '%' |
| | | </if> |
| | | <if test="warnStatus != null and warnStatus != ''"> |
| | | and |
| | | <include refid="groupLocWarnStatusCase"/> |
| | | = #{warnStatus} |
| | | </if> |
| | | </sql> |
| | | |
| | | <select id="groupLocList" resultType="com.zy.asrs.entity.param.AbnormalLocDetlParam"> |
| | | select * from |
| | | ( |
| | | select |
| | | row_number() over (order by mm.matnr asc) as row_num, |
| | | mm.matnr as matnr, |
| | | mm.maktx as maktx, |
| | | mm.specs as specs, |
| | | isnull(stock.anfme, 0) as anfme, |
| | | mm.store_max as storeMax, |
| | | mm.store_min as storeMin, |
| | | <include refid="groupLocWarnStatusCase"/> as warnStatus |
| | | from man_mat mm |
| | | left join ( |
| | | select |
| | | a.matnr, |
| | | sum(a.anfme) as anfme |
| | | from asr_loc_detl a |
| | | group by a.matnr |
| | | ) stock on stock.matnr = mm.matnr |
| | | <include refid="groupLocListCondition"/> |
| | | ) t |
| | | where t.row_num between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize}) |
| | | </select> |
| | | |
| | | <select id="groupLocListCount" resultType="java.lang.Integer"> |
| | | select count(1) |
| | | from man_mat mm |
| | | left join ( |
| | | select |
| | | a.matnr, |
| | | sum(a.anfme) as anfme |
| | | from asr_loc_detl a |
| | | group by a.matnr |
| | | ) stock on stock.matnr = mm.matnr |
| | | <include refid="groupLocListCondition"/> |
| | | </select> |
| | | |
| | | </mapper> |