自动化立体仓库 - WMS系统
#
pang.jiabao
4 天以前 52b21b24130c75197c039ae0fd761e2ef5b43cb3
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
<?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.LocCountMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.zy.asrs.entity.LocCount">
        <result column="date" property="date" />
        <result column="area_id" property="areaId" />
        <result column="loc_num" property="locNum" />
        <result column="remain_num" property="remainNum" />
    </resultMap>
 
    <select id="getByAreaAndDate" resultType="com.zy.asrs.entity.LocCount">
        SELECT * FROM asr_loc_count
        WHERE area_id = #{areaId} AND date &gt; #{startDate} AND date &lt; #{endDate}
    </select>
 
    <select id="getByDate" resultType="com.zy.asrs.entity.LocCount">
        SELECT date, SUM(ISNULL(loc_num, 0)) AS loc_num, SUM(ISNULL(remain_num, 0)) AS remain_num
        FROM asr_loc_count
        GROUP BY date
    </select>
 
    <insert id="insertOrUpdate" parameterType="com.zy.asrs.entity.LocCount">
        IF EXISTS (SELECT date FROM asr_loc_count WHERE date = #{model.date} AND area_id = #{model.areaId})
            INSERT INTO asr_loc_count(date, area_id, loc_num, remain_num)
            VALUES (#{model.date}, #{model.areaId}, #{model.locNum}, #{model.remainNum})
        ELSE
            UPDATE asr_loc_count SET loc_num = #{model.locNum}, remain_num = #{model.remainNum}
    </insert>
 
    <select id="totalLoc" resultType="com.zy.asrs.entity.LocCount">
        SELECT area_id, COUNT(*) AS loc_num FROM asr_loc_mast WHERE loc_sts != 'Z' GROUP BY area_id
    </select>
 
    <select id="useLoc" resultType="com.zy.asrs.entity.LocCount">
        SELECT area_id, COUNT(*) AS loc_num 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'
        GROUP BY area_id
    </select>
 
</mapper>