ShipmentHeaderMapper.xml
3.69 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
<?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.shipmentHeader.mapper.ShipmentHeaderMapper">
<insert id="HeaderToHistory" parameterType="string">
INSERT INTO shipment_header_history (
code,warehouseCode,companyId,sourceCode,sourcePlatform,shipmentTypeId,shipTo,priority,station,totalQty,
totalLines,remark,uploadremark,uploadTime,appointmentTime,firstStatus,lastStatus,uploadStatus,created,
createdBy,lastUpdated,lastUpdatedBy,enable,deleted,userDef1,userDef2,userDef3)
SELECT
code,warehouseCode,companyId,sourceCode,sourcePlatform,shipmentTypeId,shipTo,priority,station,totalQty,
totalLines,remark,uploadremark,uploadTime,appointmentTime,firstStatus,lastStatus,uploadStatus,created,
createdBy,lastUpdated,lastUpdatedBy,enable,1,userDef1,userDef2,userDef3
FROM shipment_header WHERE code = #{code,jdbcType=VARCHAR}
</insert>
<insert id="DetailToHistory" parameterType="string">
INSERT INTO shipment_detail_history (
sourceLine,shipmentCode,materialCode,batch,lot,project,manufactureDate,agingDate,inventoryStatus,qty,
price,created,createdBy,lastUpdated,lastUpdatedBy,enable,deleted,userDef1,userDef2,userDef3)
SELECT
sourceLine,shipmentCode,materialCode,batch,lot,project,manufactureDate,agingDate,inventoryStatus,qty,
price,created,createdBy,lastUpdated,lastUpdatedBy,enable,1,userDef1,userDef2,userDef3
FROM shipment_detail WHERE shipmentCode = #{code,jdbcType=VARCHAR}
</insert>
<select id="list" resultType="com.huaheng.pc.shipment.shipmentHeader.domain.ShipmentHeader">
select * from shipment_header
<where>
<if test="shipmentCode != null">
and code = #{shipmentCode}
</if>
<if test="shipmentType != 0">
and shipmentTypeId = #{shipmentType}
</if>
<if test="company != 0">
and companyId = #{company}
</if>
<if test="firstStatus != null">
and firstStatus = #{firstStatus}
</if>
<if test="lastStatus != null">
and lastStatus = #{lastStatus}
</if>
<if test="beginTime != null">
and created >= #{beginTime}
</if>
<if test="endTime != null">
and created <= #{endTime}
</if>
</where>
</select>
<select id="getShipDetail" resultType="java.util.Map">
SELECT detail.id, detail.shipmentId, detail.shipmentCode, detail.materialCode, detail.materialName,detail.qty, detail.qtyCompleted, m.name, i.locationCode,inventoryStatus, '个' unit
FROM shipment_detail detail
INNER JOIN material m ON detail.materialId = m.id and m.deleted = FALSE AND detail.shipmentCode = #{code}
INNER JOIN sys_dict_data s ON s.dictType = 'inventoryStatus' AND detail.inventoryStatus = s.dictValue AND s.enable = TRUE AND s.deleted = FALSE
INNER JOIN inventory i ON i.materialCode = detail.materialCode
</select>
<select id="getContainerMaterial" resultType="java.util.Map">
SELECT rch.locationCode, rcd.id, rd.receiptId, m.barcode, m.name, rd.qty
FROM receipt_container_header rch
INNER JOIN receipt_container_detail rcd ON rcd.headerId = rch.id AND rch.receiptContainerCode = #{containerCode,jdbcType=VARCHAR}
INNER JOIN receipt_detail rd ON rd.id = rcd.receiptDetailId
INNER JOIN material m ON rd.materialId = m.id AND m.deleted = FALSE
</select>
</mapper>