ShipmentContainerHeaderMapper.xml
8.71 KB
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<?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.huaheng.pc.shipment.shipmentContainerHeader.mapper.ShipmentContainerHeaderMapper">
<select id="getShipmentContainerMaxAndMinStatusByShipmentID" resultType="java.util.Map">
SELECT MAX(`status`) maxStatus , MIN(`status`) minStatus from shipment_container_header t join shipment_container_detail b on t.id = b.headerId
WHERE b.shipmentHeaderId = #{shipmentId}
</select>
<select id="getShipmentContainerHeaderByContainerCode"
resultType="com.huaheng.pc.shipment.shipmentContainerHeader.domain.ShipmentContainerHeader">
SELECT * from shipment_container_header where shipmentContainerCode = #{containerCode} and `status` < 30 limit 1
</select>
<select id="listShipmentHeaders" resultType="com.huaheng.pc.shipment.shipmentHeader.domain.ShipmentHeader">
SELECT id, code, warehouseId, warehouseCode, companyId, companyCode, sourceCode, sourcePlatform, type, shipTo,
priority, station, totalQty, totalLines, remark, uploadremark, uploadTime, appointmentTime, firstStatus,
lastStatus, uploadStatus, created, createdBy, lastUpdated, lastUpdatedBy, enable, userDef1, userDef2, userDef3
FROM shipment_header
<where>
<if test="id != null">
AND id = #{id}
</if>
<if test="code != null">
AND code = #{code}
</if>
<if test="warehouseId != null">
AND warehouseId = #{warehouseId}
</if>
<if test="warehouseCode != null">
AND warehouseCode = #{warehouseCode}
</if>
<if test="companyId != null">
AND companyId = #{companyId}
</if>
<if test="companyCode != null">
AND companyCode = #{companyCode}
</if>
<if test="sourceCode != null">
AND sourceCode = #{sourceCode}
</if>
<if test="sourcePlatform != null">
AND sourcePlatform = #{sourcePlatform}
</if>
<if test="type != null">
AND type = #{type}
</if>
<if test="shipTo != null">
AND shipTo = #{shipTo}
</if>
<if test="priority != null">
AND priority = #{priority}
</if>
<if test="station != null">
AND station = #{station}
</if>
<if test="totalQty != null">
AND totalQty = #{totalQty}
</if>
<if test="totalLines != null">
AND totalLines = #{totalLines}
</if>
<if test="remark != null">
AND remark = #{remark}
</if>
<if test="uploadremark != null">
AND uploadremark = #{uploadremark}
</if>
<if test="uploadTime != null">
AND uploadTime = #{uploadTime}
</if>
<if test="appointmentTime != null">
AND appointmentTime = #{appointmentTime}
</if>
<if test="firstStatus != null">
AND firstStatus <= #{firstStatus}
</if>
<if test="lastStatus != null">
AND lastStatus >= #{lastStatus}
</if>
<if test="uploadStatus != null">
AND uploadStatus = #{uploadStatus}
</if>
<if test="created != null">
AND created = #{created}
</if>
<if test="createdBy != null">
AND createdBy = #{createdBy}
</if>
<if test="lastUpdated != null">
AND lastUpdated = #{lastUpdated}
</if>
<if test="lastUpdatedBy != null">
AND lastUpdatedBy = #{lastUpdatedBy}
</if>
<if test="enable != null">
AND enable = #{enable}
</if>
<if test="userDef1 != null">
AND userDef1 = #{userDef1}
</if>
<if test="userDef2 != null">
AND userDef2 = #{userDef2}
</if>
<if test="userDef3 != null">
AND userDef3 = #{userDef3}
</if>
<if test="sectionStartTime != null">
AND created >= #{sectionStartTime}
</if>
<if test="sectionEndTime != null">
AND created <= #{sectionEndTime}
</if>
</where>
</select>
<select id="getShipmentContainerHeaders" resultType="com.huaheng.pc.shipment.shipmentContainerHeader.domain.ShipmentContainerHeader">
SELECT h.id, h.shipmentContainerCode, h.locationCode, h.warehouseId, h.warehouseCode, h.taskType, h.taskTypeReal, h.status, h.created, h.createdBy
FROM shipment_container_header h
<if test="shipmentCode != null and shipmentCode != ''">
INNER JOIN (SELECT DISTINCT headerId FROM shipment_container_detail WHERE shipmentCode = #{shipmentCode}) d
ON h.id = d.headerId
</if>
<where>
<if test="id != null ">
AND h.id = #{id}
</if>
<if test="shipmentContainerCode != null and shipmentContainerCode != ''">
AND h.shipmentContainerCode = #{shipmentContainerCode}
</if>
<if test="locationCode != null and locationCode != ''">
AND h.locationCode = #{locationCode}
</if>
<if test="warehouseId != null ">
AND h.warehouseId = #{warehouseId}
</if>
<if test="warehouseCode != null ">
AND h.warehouseCode = #{warehouseCode}
</if>
<if test="taskType != null ">
AND h.taskType = #{taskType}
</if>
<if test="taskTypeReal != null ">
AND h.taskTypeReal = #{taskTypeReal}
</if>
<if test="status != null ">
AND h.status = #{status}
</if>
<if test="params != null and params.createdBegin != null and params.createdBegin != ''">
AND h.created >= #{params.createdBegin}
</if>
<if test="params != null and params.createdEnd != null and params.createdEnd != ''">
AND h.created <= #{params.createdEnd}
</if>
<if test="createdBy != null and createdBy != ''">
AND h.createdBy = #{createdBy}
</if>
</where>
</select>
<select id="selectUnPickted" resultType="com.huaheng.pc.shipment.shipmentContainerHeader.domain.ShipmentContainerHeader">
SELECT id, shipmentContainerCode, warehouseId, warehouseCode, taskType, status, created, createdBy
FROM shipment_container_header
WHERE status < 20 and status!=0
<if test="id != null">
AND id = #{id}
</if>
<if test="shipmentContainerCode != null and shipmentContainerCode != ''">
AND shipmentContainerCode = #{shipmentContainerCode}
</if>
<if test="warehouseId != null ">
AND warehouseId = #{warehouseId}
</if>
<if test="warehouseCode != null and warehouseCode != ''">
AND warehouseCode = #{warehouseCode}
</if>
</select>
<select id="selectUnPickteds" resultType="com.huaheng.pc.shipment.shipmentContainerHeader.domain.ShipmentContainerHeader">
SELECT id, shipmentContainerCode, warehouseId, warehouseCode, taskType, status, created, createdBy
FROM shipment_container_header
WHERE status=0
<if test="id != null">
AND id = #{id}
</if>
<if test="shipmentContainerCode != null and shipmentContainerCode != ''">
AND shipmentContainerCode = #{shipmentContainerCode}
</if>
<if test="warehouseId != null ">
AND warehouseId = #{warehouseId}
</if>
<if test="warehouseCode != null and warehouseCode != ''">
AND warehouseCode = #{warehouseCode}
</if>
</select>
<select id="selectAgvListByLike" resultType="com.huaheng.pc.shipment.shipmentContainerHeader.domain.ShipmentContainerHeader">
select id from shipment_container_header where warehouseCode=#{warehouseCode} and status=0 and shipmentContainerCode like CONCAT(#{shelfNo},'%')
</select>
<update id="updateList">
update shipment_container_header r inner join container c on r.warehouseCode=#{warehouseCode} and r.status=0 and r.shipmentContainerCode like CONCAT(#{shelfNo},'%')
and r.shipmentContainerCode=c.code set r.locationCode=c.locationCode
</update>
</mapper>