ReceiptContainerHeaderMapper.xml
7.51 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
<?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.receipt.receiptContainerHeader.mapper.ReceiptContainerHeaderMapper">
<select id="selectUnCompletedReceiptContainer" resultType="com.huaheng.pc.receipt.receiptContainerHeader.domain.ReceiptContainerHeader">
SELECT id, receiptContainerCode, warehouseId, warehouseCode, taskType, status, created, createdBy
FROM receipt_container_header
WHERE status < 20
<if test="id != null ">
AND id = #{id}
</if>
<if test="receiptContainerCode != null and receiptContainerCode != ''">
AND receiptContainerCode = #{receiptContainerCode}
</if>
<if test="warehouseId != null ">
AND warehouseId = #{warehouseId}
</if>
<if test="warehouseCode != null and warehouseCode != ''">
AND warehouseCode = #{warehouseCode}
</if>
<if test="taskType != null ">
AND taskType = #{taskType}
</if>
<if test="params != null and params.createdBegin != null and params.createdBegin != ''">
AND created >= #{params.createdBegin}
</if>
<if test="params != null and params.createdEnd != null and params.createdEnd != ''">
AND created <= #{params.createdEnd}
</if>
<if test="createdBy != null and createdBy != ''">
AND createdBy = #{createdBy}
</if>
</select>
<select id="getDetail" resultType="java.util.Map">
SELECT d.id, d.receiptId, d.receiptCode, d.materialCode, d.batch, d.lot, d.project, d.qtyCompleted, d.qty, m.specification materialSpec, m.name materialName,
s.dictLabel inventoryStatus, d.unit
FROM receipt_detail d
INNER JOIN material m ON d.materialCode = m.code and m.deleted = FALSE
AND d.receiptCode = #{receiptCode} and d.zoneCode<>'AGV' and d.zoneCode<>'QG'
AND m.warehouseCode=d.warehouseCode AND d.warehouseCode=#{warehouseCode}
INNER JOIN sys_dict_data s ON s.dictType = 'inventoryStatus' AND d.inventoryStatus = s.dictValue AND s.warehouseCode=m.warehouseCode
AND s.enable = TRUE AND s.deleted = FALSE
</select>
<select id="getAGVDetail" resultType="java.util.Map">
SELECT d.id, d.receiptId, d.receiptCode, d.materialCode, d.batch, d.lot, d.project, d.qtyCompleted, d.qty, m.specification materialSpec,
m.name materialName, s.dictLabel inventoryStatus,
m.masterUnit unit
FROM receipt_detail d
INNER JOIN material m ON d.materialCode = m.code and m.deleted = FALSE AND d.receiptCode = #{receiptCode} and d.zoneCode='AGV'
AND m.warehouseCode=d.warehouseCode AND d.warehouseCode=#{warehouseCode}
INNER JOIN sys_dict_data s ON s.dictType = 'inventoryStatus' AND d.inventoryStatus = s.dictValue AND s.warehouseCode=m.warehouseCode
AND s.enable = TRUE AND s.deleted = FALSE
</select>
<select id="getReceiptInfoByBill" resultType="java.util.Map">
select rch.receiptContainerCode as 'containerCode', rch.locationCode, rch.taskType, rch.status,
rcd.id, rcd.materialCode, rcd.materialName, rcd.materialSpec,rcd.project, rcd.batch, rcd.lot,
rcd.qty, rcd.created, rcd.createdBy, rcd.headerId, rcd.receiptDetailId, rcd.unit
from receipt_container_header rch
inner join receipt_container_detail rcd ON
rcd.headerId=rch.id
where rch.zoneCode<>'AGV' AND rch.warehouseCode=#{warehouseCode} and rcd.receiptCode=#{receiptCode}
</select>
<select id="getAGVReceiptInfoByBill" resultType="java.util.Map">
select rch.receiptContainerCode as 'containerCode', rch.locationCode, rch.taskType, rch.status,
rcd.id, rcd.materialCode, rcd.materialName as 'materialName', rcd.materialSpec as 'materialSpec',
rcd.qty, rcd.created, rcd.createdBy, rcd.headerId, rcd.receiptDetailId, rcd.project,rcd.project, rcd.batch, rcd.lot,
from receipt_container_header rch
inner join receipt_container_detail rcd ON
rcd.headerId=rch.id
where rch.zoneCode='AGV' AND rch.warehouseCode=#{warehouseCode} and rcd.receiptCode=#{receiptCode}
</select>
<select id="selectListByLike" resultType="com.huaheng.pc.receipt.receiptContainerHeader.domain.ReceiptContainerHeader">
SELECT h.id, h.receiptContainerCode, h.locationCode, h.warehouseId, h.warehouseCode,
h.taskType, h.status, h.created, h.createdBy, h.userDef1, h.station
FROM receipt_container_header h
<if test="receiptCode != null and receiptCode != ''">
INNER JOIN (SELECT DISTINCT headerId FROM receipt_container_detail WHERE receiptCode = #{receiptCode}) d
ON h.id = d.headerId
</if>
<where>
<if test="id != null ">
AND h.id = #{id}
</if>
<if test="receiptContainerCode != null and receiptContainerCode != ''">
AND h.receiptContainerCode = #{receiptContainerCode}
</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="status != null ">
AND h.status = #{status}
</if>
<if test="userDef1 != null ">
AND h.userDef1 = #{userDef1}
</if>
<if test="station != null ">
AND h.station = #{station}
</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="selectAgvListByLike" resultType="com.huaheng.pc.receipt.receiptContainerHeader.domain.ReceiptContainerHeader">
select id from receipt_container_header where warehouseCode=#{warehouseCode} and status=0 and receiptContainerCode like CONCAT(#{shelfNo},'%')
</select>
<select id="ReceiptContainerHeaderContainerStatus" resultType="com.huaheng.pc.receipt.receiptContainerHeader.domain.ReceiptContainerHeader">
select id, receiptContainerCode, warehouseId, warehouseCode, companyCode, taskType, status, created, createdBy, station
FROM receipt_container_header
WHERE
<if test="receiptContainerCode != ''">
receiptContainerCode = #{receiptContainerCode}
</if>
AND status = 0
</select>
<update id="updateList">
update receipt_container_header r
inner join container c
on r.warehouseCode=#{warehouseCode} and r.status=0 and r.receiptContainerCode
like CONCAT(#{shelfNo},'%')
and r.receiptContainerCode=c.code
set r.locationCode=c.locationCode
</update>
</mapper>