and asr_loc_mast.loc_no like '%' + #{loc_no} + '%'
and specs like '%' + #{specs} + '%'
and matnr like '%' + #{matnr} + '%'
and stay_time > #{stay_time}
and (maktx like '%' + #{maktx} + '%'
or lgnum like '%' + #{maktx} + '%'
or tbnum like '%' + #{maktx} + '%'
or tbpos like '%' + #{maktx} + '%'
or zmatid like '%' + #{maktx} + '%'
or werks like '%' + #{maktx} + '%'
or anfme like '%' + #{maktx} + '%'
or altme like '%' + #{maktx} + '%'
or zpallet like '%' + #{maktx} + '%'
or bname like '%' + #{maktx} + '%'
)
= #{begin_date}
]]>
and loc_no like '%' + #{loc_no} + '%'
and floor = #{floor}
and loc_type1 = #{locType1}
and lev1 = #{lev1}
and matnr like '%' + #{matnr} + '%'
and stay_time > #{stay_time}
and (maktx like '%' + #{maktx} + '%'
)
= #{begin_date}
]]>
select
*
from (
select
ROW_NUMBER() over (order by stay_time desc) as row
, *
from
(
SELECT
GETDATE() AS today
, CONVERT(decimal, DATEDIFF(second,asr_loc_detl.appe_time, GETDATE()) / 86400.0, 9) AS stay_time
, asr_loc_detl.*
FROM asr_loc_detl
INNER JOIN asr_loc_mast ON asr_loc_detl.loc_no = asr_loc_mast.loc_no
where 1=1
) t
left join (select matnr as c ,store_max_date,store_max,store_min from man_mat) b
on t.matnr = b.c
left join (select matnr as f,sum(asr_loc_detl.anfme) as sum_qty from asr_loc_detl group by asr_loc_detl.matnr ) as z
on z.f= b.c
) a where a.row between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize})
select
count(1)
from (
select
ROW_NUMBER() over (order by stay_time desc) as row
, *
from
(
SELECT
GETDATE() AS today
, CONVERT(decimal, DATEDIFF(second,asr_loc_detl.appe_time, GETDATE()) / 86400.0, 9) AS stay_time
, dbo.asr_loc_detl.*
FROM asr_loc_detl
INNER JOIN asr_loc_mast ON asr_loc_detl.loc_no = asr_loc_mast.loc_no
where 1=1
) t
) a
select
*
from (
select
ROW_NUMBER() over (order by stay_time desc) as row
, *
from
(
SELECT
GETDATE() AS today
, CONVERT(decimal, DATEDIFF(second,all_loc_detl.appe_time, GETDATE()) / 86400.0, 9) AS stay_time
, all_loc_detl.*
FROM all_loc_detl
where 1=1
) t
left join (select matnr as c ,store_max_date,store_max,store_min from man_mat) b
on t.matnr = b.c
left join (select matnr as f,sum(asr_loc_detl.anfme) as sum_qty from asr_loc_detl group by asr_loc_detl.matnr ) as z
on z.f= b.c
) a where a.row between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize})
select
count(1)
from (
select
ROW_NUMBER() over (order by stay_time desc) as row
, *
from
(
SELECT
GETDATE() AS today
, CONVERT(decimal, DATEDIFF(second,all_loc_detl.appe_time, GETDATE()) / 86400.0, 9) AS stay_time
, all_loc_detl.*
FROM all_loc_detl
where 1=1
) t
) a
select
*
from (
select
ROW_NUMBER() over (order by stay_time desc) as row
, *
from
(
SELECT
GETDATE() AS today
, CONVERT(decimal, DATEDIFF(second,all_loc_detl.appe_time, GETDATE()) / 86400.0, 9) AS stay_time
, dbo.all_loc_detl.*
FROM all_loc_detl
INNER JOIN agv_loc_mast ON all_loc_detl.loc_no = agv_loc_mast.loc_no
where 1=1
) t
) a
SELECT
*
FROM
(
SELECT
ROW_NUMBER ( ) OVER ( ORDER BY stay_time DESC ) AS row, *
FROM
(
SELECT
GETDATE( ) AS today,
CONVERT ( DECIMAL, DATEDIFF( SECOND, all_loc_detl.appe_time, GETDATE( ) ) / 86400.0, 9 ) AS stay_time,
dbo.all_loc_detl.*
FROM
all_loc_detl
where 1=1
) t
) a