<?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.DigitalTwinMapper">
|
|
<!--总览:总库位、已用库位、今日库存、今日出库、今日入库-->
|
<select id="overview" resultType="Double">
|
SELECT COUNT(*) FROM asr_loc_mast WHERE loc_sts != 'Z'
|
<if test="areaId != null">
|
and area_id = #{areaId}
|
</if>
|
UNION ALL
|
SELECT COUNT(*) FROM asr_loc_mast WHERE loc_sts = 'F' or loc_sts = 'P' or loc_sts = 'Q' or loc_sts = 'R' or loc_sts = 'S' or loc_sts = 'X'
|
<if test="areaId != null">
|
and area_id = #{areaId}
|
</if>
|
UNION ALL
|
SELECT ISNULL(SUM(anfme), 0) FROM asr_loc_detl
|
<if test="areaId != null">
|
WHERE area_id = #{areaId}
|
</if>
|
UNION ALL
|
SELECT ISNULL(SUM(anfme), 0) FROM asr_wrkin_view WHERE CONVERT(VARCHAR, io_time, 23) = CONVERT(VARCHAR, GETDATE(), 23)
|
<if test="areaId != null">
|
and area_id = #{areaId}
|
</if>
|
UNION ALL
|
SELECT ISNULL(SUM(anfme), 0) FROM asr_wrkout_view WHERE CONVERT(VARCHAR, io_time, 23) = CONVERT(VARCHAR, GETDATE(), 23)
|
<if test="areaId != null">
|
and area_id = #{areaId}
|
</if>
|
</select>
|
|
<select id="recentOrder" resultType="com.zy.asrs.entity.digitaltwin.DtOrderVo">
|
SELECT CONVERT(VARCHAR, order_time, 23) as orderDate, COUNT(*) AS orderNum
|
FROM man_order
|
WHERE order_time BETWEEN #{startTime} AND #{endTime}
|
GROUP BY CONVERT(VARCHAR, order_time, 23)
|
</select>
|
|
<select id="recentInBound" resultType="com.zy.asrs.entity.digitaltwin.DtInAndOutBoundVo">
|
SELECT CONVERT(VARCHAR, io_time, 23) AS boundDate, SUM(anfme) AS inBoundNum
|
FROM asr_wrkin_view
|
WHERE io_time BETWEEN #{startTime} AND #{endTime}
|
<if test="areaId != null">
|
and area_id = #{areaId}
|
</if>
|
GROUP BY CONVERT(VARCHAR, io_time, 23)
|
</select>
|
|
<select id="recentOutBound" resultType="com.zy.asrs.entity.digitaltwin.DtInAndOutBoundVo">
|
SELECT CONVERT(VARCHAR, io_time, 23) AS boundDate, SUM(anfme) AS outBoundNum
|
FROM asr_wrkout_view
|
WHERE io_time BETWEEN #{startTime} AND #{endTime}
|
<if test="areaId != null">
|
and area_id = #{areaId}
|
</if>
|
GROUP BY CONVERT(VARCHAR, io_time, 23)
|
</select>
|
|
<select id="recentDetainMat" resultType="com.zy.asrs.entity.digitaltwin.DtDetainMatVo">
|
select
|
*
|
from (
|
select
|
ROW_NUMBER() OVER(Order by t.io_time desc) as row , *
|
from (
|
SELECT area_id AS belongAreaId, area_name AS belongAreaName, matnr AS matId, maktx AS matName,
|
loc_no AS lokId, '' AS lokName,
|
DATEDIFF(MINUTE, appe_time, GETDATE()) AS detainTime, appe_time AS inBoundTime
|
FROM asr_loc_detl WHERE appe_time < #{startTime}
|
<if test="areaId != null">
|
and area_id = #{areaId}
|
</if>
|
) t
|
) a where 1=1 and a.row between ((#{pageIndex}-1)*#{pageSize}+1) and (#{pageIndex}*#{pageSize})
|
</select>
|
|
</mapper>
|