TaskMapper.xml
4.48 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
<?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="getTaskByLocationCode" resultType="com.huaheng.pc.task.task.domain.Task">
SELECT * from task where firstStatus != 40 and (sourceLocation = #{location, jdbcType=VARCHAR} or destinationLocation = #{warehouse, jdbcType=VARCHAR} ) limit 1;
</select>
<select id="getContainerMaterial" resultType="java.util.HashMap">
SELECT rch.locationCode, rcd.id, rd.receiptId, m.barcode, m.name, rcd.qty
FROM receipt_container_header rch
INNER JOIN receipt_container_detail rcd ON rcd.headerId = rch.id AND rch.status=0 AND rch.receiptContainerCode = #{containerCode,jdbcType=VARCHAR}
INNER JOIN receipt_detail rd ON rd.id = rcd.receiptDetailId AND rd.deleted = FALSE
INNER JOIN material m ON rd.materialCode = m.`code` AND m.deleted = FALSE
</select>
<select id="getTaskReceipt" resultType="java.util.HashMap">
SELECT rh.warehouseId, rh.warehouseCode, rch.locationCode, rh.sourceCode, rd.sourceLine, rh.companyId, rh.companyCode,
rd.materialCode, rh.id receiptId, rh.code, rd.id receiptDetailId, rd.batch, rd.lot, rd.project, rd.manufactureDate,
rd.expirationDate, rd.inventoryStatus, rcd.qty, rd.price, td.id taskDetailId, td.status
FROM task_detail td
INNER JOIN receipt_container_detail rcd ON rcd.id = td.allocationId AND td.taskId = #{taskId,jdbcType=INTEGER}
INNER JOIN receipt_container_header rch ON rch.id = rcd.headerId
INNER JOIN receipt_detail rd ON rd.id = rcd.receiptDetailId
INNER JOIN receipt_header rh ON rh.id = rd.receiptId
</select>
<select id="getTasks" resultType="com.huaheng.pc.task.task.domain.Task">
SELECT id, warehouseId, warehouseCode, companyId, priority, type, station, containerId, containerCode, sourceLocation, destinationLocation, status, createdBy, beginTime, endTime, lastUpdated, lastUpdatedBy, userDef1, userDef2, userDef3
FROM task
<where>
<if test="id != null">
AND id = #{id}
</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="priority != null">
AND priority = #{priority}
</if>
<if test="type != null">
AND type = #{type}
</if>
<if test="station != null">
AND station = #{station}
</if>
<if test="containerId != null">
AND containerId = #{containerId}
</if>
<if test="containerCode != null">
AND containerCode = #{containerCode}
</if>
<if test="sourceLocation != null">
AND sourceLocation = #{sourceLocation}
</if>
<if test="destinationLocation != null">
AND destinationLocation = #{destinationLocation}
</if>
<if test="status != null">
AND status = #{status}
</if>
<if test="createdBy != null">
AND createdBy = #{createdBy}
</if>
<if test="beginTime != null">
AND beginTime = #{beginTime}
</if>
<if test="endTime != null">
AND endTime = #{endTime}
</if>
<if test="lastUpdated != null">
AND lastUpdated = #{lastUpdated}
</if>
<if test="lastUpdatedBy != null">
AND lastUpdatedBy = #{lastUpdatedBy}
</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>
</mapper>