TaskMapper.xml
12.9 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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
<?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.task.task.mapper.TaskMapper">
<select id="getUncompleteTask" resultType="com.huaheng.pc.task.task.domain.Task">
SELECT id, warehouseId, warehouseCode, uWarehouseCode, companyId, companyCode, priority, type, station, allocationHeadId, containerId, containerCode,
roadway, sourceLocation, destinationLocation, firstStatus, lastStatus, zoneCode, created, createdBy, beginTime, endTime, lastUpdated, lastUpdatedBy,
userDef1, userDef2, userDef3, deleted, isEmptyOut, isDoubleIn, secondDestinationLocation, sendAgain, bypass, port, weight, gateway
from task where firstStatus < 100 and containerCode = #{containerCode} AND warehouseCode=#{warehouseCode} limit 1;
</select>
<select id="getContainerMaterial" resultType="java.util.HashMap">
SELECT h.locationCode, d.id, d.receiptId, d.receiptDetailId, d.receiptCode, d.materialCode barcode, d.materialName name, d.materialSpec, d.qty,d.unit
FROM receipt_container_header h
INNER JOIN receipt_container_detail d ON d.headerId = h.id AND h.status=0 AND h.receiptContainerCode = #{containerCode,jdbcType=VARCHAR}
</select>
<select id="getReceiptTask" resultType="java.util.HashMap">
SELECT td.warehouseId, td.warehouseCode, td.id taskDetailId, td.destinationLocation, td.status,
td.containerCode, td.qty, td.billId, td.billDetailId, td.billCode, td.materialCode,
td.materialName, rd.sourceCode, rd.sourceLine, rd.batch, rd.lot, rd.project,
rd.manufactureDate, rd.expirationDate, rd.inventoryStatus, rd.price,td.unit
FROM task_detail td
INNER JOIN receipt_detail rd ON rd.id = td.billDetailId AND td.taskId = #{taskId,jdbcType=INTEGER}
</select>
<select id="getTasks" resultType="com.huaheng.pc.task.task.domain.Task">
SELECT t.id, t.warehouseId, t.warehouseCode, t.companyId, t.companyCode, t.priority, t.type, t.station,
t.allocationHeadId, t.containerId, t.containerCode, t.sourceLocation, t.destinationLocation, t.firstStatus,
t.lastStatus, t.created, t.createdBy, t.beginTime, t.endTime, t.lastUpdated, t.lastUpdatedBy, t.userDef1, t.zoneCode,
t.deleted, t.isEmptyOut, t.isDoubleIn, t.secondDestinationLocation, t.roadway,t.weight,t.userDef2,t.userDef3,
t.isEmptyOut, t.isDoubleIn, t.secondDestinationLocation, t.sendAgain, t.bypass, t.port, t.weight, t.gateway
FROM task t
<if test="billCode != null and billCode != ''">
INNER JOIN (SELECT DISTINCT taskId FROM task_detail WHERE billCode = #{billCode}) d
ON t.id = d.taskId
</if>
<where>
<if test="id != null ">
AND t.id = #{id}
</if>
<if test="roadway != null ">
AND t.roadway = #{roadway}
</if>
<if test="warehouseId != null ">
AND t.warehouseId = #{warehouseId}
</if>
<if test="warehouseCode != null and warehouseCode != '' ">
AND t.warehouseCode = #{warehouseCode}
</if>
<if test="companyIdList != null ">
AND t.companyId in
<foreach collection="companyIdList" item="companyIdItem" open="(" separator="," close=")">
#{companyIdItem}
</foreach>
</if>
<if test="companyId != null ">
AND t.companyId = #{companyId}
</if>
<if test="companyCodeList != null ">
AND t.companyCode in
<foreach collection="companyCodeList" item="companyCodeItem" open="(" separator="," close=")">
#{companyCodeItem}
</foreach>
</if>
<if test="companyCode != null and companyCode != '' ">
AND t.companyCode = #{companyCode}
</if>
<if test="priority != null ">
AND t.priority = #{priority}
</if>
<if test="type != null and type != '' ">
AND t.type = #{type}
</if>
<if test="station != null ">
AND t.station = #{station}
</if>
<if test="allocationHeadId != null ">
AND t.allocationHeadId = #{allocationHeadId}
</if>
<if test="containerId != null ">
AND t.containerId = #{containerId}
</if>
<if test="containerCode != null and containerCode != '' ">
AND t.containerCode = #{containerCode}
</if>
<if test="sourceLocation != null and sourceLocation != ''">
<bind name="sourceLocationPattern" value="'%' + sourceLocation + '%'" />
AND t.sourceLocation like #{sourceLocationPattern}
</if>
<if test="destinationLocation != null and destinationLocation != ''">
<bind name="destinationLocationPattern" value="'%' + destinationLocation + '%'" />
AND t.destinationLocation like #{destinationLocationPattern}
</if>
<if test="firstStatus != null ">
AND t.firstStatus = #{firstStatus}
</if>
<if test="lastStatus != null ">
AND t.lastStatus = #{lastStatus}
</if>
<if test="params != null and params.createdBegin != null and params.createdBegin != ''">
AND t.created >= #{params.createdBegin}
</if>
<if test="params != null and params.createdEnd != null and params.createdEnd != ''">
AND t.created <= #{params.createdEnd}
</if>
<if test="createdBy != null and createdBy != ''">
<bind name="createdByPattern" value="'%' + createdBy + '%'" />
AND t.createdBy like #{createdByPattern}
</if>
<if test="params != null and params.beginTimeBegin != null and params.beginTimeBegin != ''">
AND t.beginTime >= #{params.beginTimeBegin}
</if>
<if test="params != null and params.beginTimeEnd != null and params.beginTimeEnd != ''">
AND t.beginTime <= #{params.beginTimeEnd}
</if>
<if test="params != null and params.endTimeBegin != null and params.endTimeBegin != ''">
AND t.endTime >= #{params.endTimeBegin}
</if>
<if test="params != null and params.endTimeEnd != null and params.endTimeEnd != ''">
AND t.endTime <= #{params.endTimeEnd}
</if>
<if test="params != null and params.lastUpdatedBegin != null and params.lastUpdatedBegin != ''">
AND t.lastUpdated >= #{params.lastUpdatedBegin}
</if>
<if test="params != null and params.lastUpdatedEnd != null and params.lastUpdatedEnd != ''">
AND t.lastUpdated <= #{params.lastUpdatedEnd}
</if>
<if test="lastUpdatedBy != null and lastUpdatedBy != ''">
<bind name="lastUpdatedByPattern" value="'%' + lastUpdatedBy + '%'" />
AND t.lastUpdatedBy like #{lastUpdatedByPattern}
</if>
<if test="userDef1 != null and userDef1 != ''">
<bind name="userDef1Pattern" value="'%' + userDef1 + '%'" />
AND t.userDef1 like #{userDef1Pattern}
</if>
<if test="userDef2 != null and userDef2 != ''">
AND t.userDef2 = #{userDef2}
</if>
<if test="userDef3 != null and userDef3 != ''">
AND t.userDef3 = #{userDef3}
</if>
<if test="deleted != null ">
AND t.deleted = #{deleted}
</if>
<if test="isEmptyOut != null ">
AND t.isEmptyOut = #{isEmptyOut}
</if>
<if test="isDoubleIn != null ">
AND t.isDoubleIn = #{isDoubleIn}
</if>
<if test="secondDestinationLocation != null and secondDestinationLocation != ''">
AND t.secondDestinationLocation = #{secondDestinationLocationPattern}
</if>
<if test="zoneCode != null and zoneCode != '' ">
AND t.zoneCode = #{zoneCode}
</if>
</where>
</select>
<select id="findUncompleteCyccountTask" resultType="java.lang.Integer">
SELECT COUNT(id) from task WHERE type=700 AND `lastStatus` < 100 and warehouseId = #{warehouseId} AND containerCode = #{containerCode}
</select>
<select id="UncompleteCount" resultType="java.lang.Integer">
SELECT COUNT(id) AS count FROM task WHERE lastStatus < 100 AND containerCode = #{containerCode} AND warehouseId=#{warehouseId}
</select>
<select id="selectAgvListByLike" resultType="com.huaheng.pc.task.task.domain.Task">
select id, warehouseId, warehouseCode, uWarehouseCode, companyId, companyCode, priority, type, station, allocationHeadId, containerId, containerCode, roadway,
sourceLocation, destinationLocation, firstStatus, lastStatus, zoneCode, created, createdBy, beginTime, endTime, lastUpdated, lastUpdatedBy,
userDef1, userDef2, userDef3, deleted, isEmptyOut, isDoubleIn, secondDestinationLocation, sendAgain, weight
from task where warehouseCode=#{warehouseCode} and firstStatus = 1 and lastStatus = 1 and containerCode like CONCAT(#{shelfNo},'%')
</select>
<select id="getTasksStatus" resultType="com.huaheng.pc.task.task.domain.Task">
SELECT id, warehouseId, warehouseCode, uWarehouseCode, companyId, companyCode, priority, type, station, allocationHeadId, containerId, containerCode, roadway,
sourceLocation, destinationLocation, firstStatus, lastStatus, zoneCode, created, createdBy, beginTime, endTime, lastUpdated, lastUpdatedBy,
userDef1, userDef2, userDef3, deleted, isEmptyOut, isDoubleIn, secondDestinationLocation, sendAgain, weight
FROM task
where lastStatus < 100
</select>
<update id="setWcsTask">
UPDATE task
<set>
destinationLocation = #{destinationLocation,jdbcType=VARCHAR },
userDef3 = #{userDef3, jdbcType=VARCHAR},
weight = #{weight, jdbcType=FLOAT},
</set>
WHERE id = #{id,jdbcType=INTEGER}
</update>
<select id="selectReceiptConfirm" resultType="com.huaheng.pc.task.task.domain.Task">
SELECT id, warehouseId, warehouseCode, uWarehouseCode, companyId, companyCode, priority, type, station, allocationHeadId, containerId, containerCode, roadway,
sourceLocation, destinationLocation, firstStatus, lastStatus, zoneCode, created, createdBy, beginTime, endTime, lastUpdated, lastUpdatedBy,
userDef1, userDef2, userDef3, deleted, isEmptyOut, isDoubleIn, secondDestinationLocation, sendAgain, weight
FROM task
WHERE lastStatus = 100 AND (type = 100 OR type = 200)
LIMIT 1
</select>
<select id="selectShipmentConfirm" resultType="com.huaheng.pc.task.task.domain.Task">
SELECT id, warehouseId, warehouseCode, uWarehouseCode, companyId, companyCode, priority, type, station, allocationHeadId, containerId, containerCode, roadway,
sourceLocation, destinationLocation, firstStatus, lastStatus, zoneCode, created, createdBy, beginTime, endTime, lastUpdated, lastUpdatedBy,
userDef1, userDef2, userDef3, deleted, isEmptyOut, isDoubleIn, secondDestinationLocation, sendAgain, weight,confirmStatus
FROM task
WHERE lastStatus = 100 AND (type = 300 OR type = 400)
And confirmStatus = 0
order by id desc
LIMIT 1
</select>
<select id="selectShipmentConfirm4Retry" resultType="com.huaheng.pc.task.task.domain.Task">
SELECT id, warehouseId, warehouseCode, uWarehouseCode, companyId, companyCode, priority, type, station, allocationHeadId, containerId, containerCode, roadway,
sourceLocation, destinationLocation, firstStatus, lastStatus, zoneCode, created, createdBy, beginTime, endTime, lastUpdated, lastUpdatedBy,
userDef1, userDef2, userDef3, deleted, isEmptyOut, isDoubleIn, secondDestinationLocation, sendAgain, weight,confirmStatus
FROM task
WHERE lastStatus = 100 AND (type = 300 OR type = 400)
And 0 > confirmStatus
order by confirmStatus desc, id desc
LIMIT 1
</select>
<select id="getReceiptAGVTask" resultType="java.util.HashMap">
SELECT td.warehouseId, td.warehouseCode, td.id taskDetailId, td.destinationLocation, td.status,
td.containerCode, td.qty, td.billId, td.billDetailId, td.billCode, td.materialCode,
td.materialName, rd.sourceLine, rd.sourceLine, rd.batch, rd.lot, rd.project,
rd.manufactureDate, rd.expirationDate, rd.inventoryStatus, rd.price
FROM task_detail td
INNER JOIN receipt_detail rd ON rd.id = td.billDetailId AND td.taskId = #{taskId} and td.id=#{id}
</select>
</mapper>