wang..123
2022-03-08 0d460265a3d1bf58f0f2144fb2d02b988a7171e4
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
<?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.LocNormalMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.zy.asrs.entity.LocNormal">
        <result column="matnr" property="matnr"/>
        <result column="maktx" property="maktx"/>
        <result column="lgnum" property="lgnum"/>
        <result column="type" property="type"/>
        <result column="mnemonic" property="mnemonic"/>
        <result column="supplier" property="supplier"/>
        <result column="warehouse" property="warehouse"/>
        <result column="warehouseName" property="warehouseName"/>
        <result column="brand" property="brand"/>
        <result column="anfme" property="anfme"/>
        <result column="bname" property="bname"/>
        <result column="memo" property="memo"/>
        <result column="modi_user" property="modiUser"/>
        <result column="modi_time" property="modiTime"/>
        <result column="appe_user" property="appeUser"/>
        <result column="appe_time" property="appeTime"/>
        <result column="state" property="state"/>
    </resultMap>
 
    <select id="getLocNormalData" resultMap="BaseResultMap">
      select * from asr_loc_normal
    </select>
 
    <!-- 更新平仓物料的数量 -->
    <update id="updateLocNormal">
        update asr_loc_normal set anfme = #{anfme,jdbcType=DECIMAL},
        modi_user = #{modiUser, jdbcType=DECIMAL}, modi_time = #{modiTime, jdbcType=TIMESTAMP}
        where matnr = #{matnr,jdbcType=VARCHAR} and id = #{id, jdbcType=DECIMAL}
    </update>
 
    <update id="outLocNormal">
        update asr_loc_normal set state = '2',modi_user = #{modiUser, jdbcType=DECIMAL},
        modi_time = #{modiTime, jdbcType=TIMESTAMP} where matnr = #{matnr,jdbcType=VARCHAR} and id = #{id, jdbcType=DECIMAL}
    </update>
 
    <update id="removeLocNormal">
        update asr_loc_normal set state = '3',modi_user = #{modiUser, jdbcType=DECIMAL},
        modi_time = #{modiTime, jdbcType=TIMESTAMP} where matnr = #{matnr,jdbcType=VARCHAR} and id = #{id, jdbcType=DECIMAL}
    </update>
 
    <insert id="pdaLocNormalIn">
        BEGIN
        <foreach collection="list" item="item" index="index">
            INSERT INTO asr_loc_normal (matnr, maktx, anfme, mnemonic, supplier, warehouse, state, lgnum, type, altme,
            appe_user, appe_time)
            VALUES (#{item.matnr,jdbcType=VARCHAR}, #{item.maktx,jdbcType=VARCHAR}, #{item.anfme,jdbcType=DECIMAL},
            #{item.mnemonic, jdbcType=VARCHAR}, #{item.supplier, jdbcType=VARCHAR},
            #{item.warehouse,jdbcType=VARCHAR}, '1',
            #{item.lgnum, jdbcType=VARCHAR}, #{item.type, jdbcType=VARCHAR},
            #{item.altme, jdbcType=VARCHAR},
            #{item.appeUser,jdbcType=DECIMAL},#{item.appeTime,jdbcType=TIMESTAMP})
        </foreach>
        END;
    </insert>
 
    <update id="pdaLocNormalUpdate">
        BEGIN
        <foreach collection="list" item="item" index="index">
            update asr_loc_normal set anfme = #{item.anfme,jdbcType=DECIMAL}
            where supplier = #{item.supplier,jdbcType=VARCHAR} and state = '1' and warehouse = #{item.warehouse,jdbcType=VARCHAR} and matnr = #{item.matnr,jdbcType=VARCHAR}
        </foreach>
        END;
    </update>
 
    <update id="withoutSupplierLocNormalUpdate">
        BEGIN
        <foreach collection="list" item="item" index="index">
            update asr_loc_normal set anfme = #{item.anfme,jdbcType=DECIMAL}
            where matnr = #{item.matnr,jdbcType=VARCHAR} and state = '1' and warehouse = #{item.warehouse,jdbcType=VARCHAR} and mnemonic = #{item.mnemonic, jdbcType=VARCHAR}
        </foreach>
        END;
    </update>
 
    <select id="pdaLocNormalQuery" resultMap="BaseResultMap">
        select id, matnr,maktx, warehouse,anfme from asr_loc_normal
        where 1 = 1
        <if test="warehouse != null and warehouse != ''">
            and warehouse = #{warehouse,jdbcType=VARCHAR}
        </if>
        <if test="matnr != null and matnr != ''">
            and matnr =#{matnr,jdbcType=VARCHAR}
        </if>
        <if test="billNo != null and billNo != ''">
            and supplier = #{billNo, jdbcType=VARCHAR}
        </if>
        and state = '1' COLLATE Chinese_PRC_CS_AS
    </select>
 
    <update id="pdaLocNormalOut1">
        update asr_loc_normal set state = '2',modi_user = #{modiUser, jdbcType=DECIMAL},modi_time = #{modiTime, jdbcType=TIMESTAMP}
        where matnr = #{matnr,jdbcType=VARCHAR} and warehouse = #{warehouse,jdbcType=VARCHAR} and id = #{id,jdbcType=DECIMAL}
    </update>
 
    <update id="pdaLocNormalOut2">
        update asr_loc_normal set anfme = #{anfme, jdbcType=DECIMAL},modi_user = #{modiUser, jdbcType=DECIMAL},modi_time = #{modiTime, jdbcType=TIMESTAMP}
        where matnr = #{matnr,jdbcType=VARCHAR} and warehouse = #{warehouse,jdbcType=VARCHAR} and id = #{id,jdbcType=DECIMAL}
    </update>
 
    <select id="pdaLocNormalWarehouseQuery" resultMap="BaseResultMap">
        select id,matnr, maktx, warehouse from asr_loc_normal
        where warehouse = #{warehouse, jdbcType=VARCHAR}
        and state = '1'
        <if test="matnr != ''">
            and matnr = #{matnr, jdbcType=VARCHAR}
        </if>
        COLLATE Chinese_PRC_CS_AS
    </select>
 
    <update id="pdaLocNormalMove">
        BEGIN
        <foreach collection="list" item="item" index="index">
            update asr_loc_normal set warehouse = #{item.warehouse,jdbcType=VARCHAR},
            modi_user = #{item.modiUser, jdbcType=DECIMAL},modi_time = #{item.modiTime, jdbcType=TIMESTAMP}
            where id = #{item.id,jdbcType=DECIMAL}
        </foreach>
        END;
    </update>
 
    <select id="queryLocNorlMatnr" resultMap="BaseResultMap">
        select a.*,b.name as warehouseName from asr_loc_normal a left join asr_loc_area b on a.warehouse = b.uuid
        where matnr = #{matnr} and state = '1'
        <if test="mnemonic != null and mnemonic != ''">
            and mnemonic = #{mnemonic}
        </if>
    </select>
</mapper>