李林
2023-10-07 658d4927d468c47208fd012d9128b09249c07eff
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
<?xml version="1.0" encoding="UTF-8"?>
 
<!--
  ~
  ~      Copyright (c) 2018-2025, ztt All rights reserved.
  ~
  ~  Redistribution and use in source and binary forms, with or without
  ~  modification, are permitted provided that the following conditions are met:
  ~
  ~ Redistributions of source code must retain the above copyright notice,
  ~  this list of conditions and the following disclaimer.
  ~  Redistributions in binary form must reproduce the above copyright
  ~  notice, this list of conditions and the following disclaimer in the
  ~  documentation and/or other materials provided with the distribution.
  ~  Neither the name of the pig4cloud.com developer nor the names of its
  ~  contributors may be used to endorse or promote products derived from
  ~  this software without specific prior written permission.
  ~  Author: ztt
  ~
  -->
 
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 
<mapper namespace="com.chinaztt.mes.warehouse.mapper.ReserveDetailMapper">
 
  <resultMap id="reserveDetailMap" type="com.chinaztt.mes.warehouse.entity.ReserveDetail">
                  <id property="id" column="id"/>
                        <result property="warehouseMainId" column="warehouse_main_id"/>
                        <result property="partId" column="part_id"/>
                        <result property="resQty" column="res_qty"/>
                        <result property="ppoQty" column="ppo_qty"/>
                        <result property="outQty" column="out_qty"/>
                        <result property="recvQty" column="recv_qty"/>
                        <result property="autoReceiveTime" column="auto_receive_time"/>
                        <result property="locationId" column="location_id"/>
                         <result property="status" column="status"/>
            </resultMap>
    <resultMap id="getReserveDetailMap" type="com.chinaztt.mes.warehouse.dto.ReserveDetailDTO">
        <id property="id" column="id"/>
        <result property="warehouseMainId" column="warehouse_main_id"/>
        <result property="partId" column="part_id"/>
        <result property="resQty" column="res_qty"/>
        <result property="ppoQty" column="ppo_qty"/>
        <result property="outQty" column="out_qty"/>
        <result property="recvQty" column="recv_qty"/>
        <result property="unit" column="unit"/>
        <result property="partNo" column="part_no"/>
        <result property="partName" column="part_name"/>
        <result property="specs" column="specs"/>
        <result property="autoReceiveTime" column="auto_receive_time"/>
        <result property="resNo" column="res_no"/>
        <result property="partBatchNo" column="part_batch_no"/>
        <result property="locNo" column="loc_no"/>
    </resultMap>
    <select id="getReservePage" resultMap="getReserveDetailMap">
        SELECT
        wrd."id",
        wrd.out_qty,
        wrd.ppo_qty,
        wrd.recv_qty,
        wrd.res_qty,
        wrd.part_id,
        wrd.location_id,
        wrd.status,
        bp.part_no,
        bp.part_name,
        bp.unit,
        bp.specs,
        bl.loc_no
        FROM
        warehouse_reserve_detail wrd
        LEFT JOIN basic_part bp ON bp."id" = wrd.part_id
        LEFT JOIN basic_location bl ON  bl."id" = wrd.location_id
        <if test="ew.emptyOfWhere == false">
            ${ew.customSqlSegment}
        </if>
    </select>
    <select id="getByReserveId" resultType="com.chinaztt.mes.warehouse.dto.ReserveDetailDTO">
        SELECT
    wrd."id",
    wrd.status,
    wrd.out_qty,
    wrd.ppo_qty,
    wrd.recv_qty,
    wrd.res_qty,
    wrd.part_id,
    bp.part_no,
    bp.part_name  description,
    bp.unit,
    bp.specs
FROM
    warehouse_reserve_detail wrd
    LEFT JOIN basic_part bp ON bp."id" = wrd.part_id
    WHERE wrd."id" = #{id}
    </select>
    <select id="getPage" resultMap="getReserveDetailMap">
        select
        wrd."id",
        wrd.out_qty,
        wrd.ppo_qty,
        wrd.recv_qty,
        wrd.res_qty,
        wrd.part_id,
        wrd.status,
        wrm.res_no,
        wpd.location_id,
        wpd.part_batch_no,
        wrd.auto_receive_time,
        bp.part_no,
        bp.part_name,
        wl.loc_no
        from
        warehouse_reserve_main wrm
        LEFT JOIN warehouse_reserve_detail wrd ON wrm."id" = wrd.warehouse_main_id
        LEFT JOIN warehouse_prepare_detail wpd ON wpd.warehouse_reserve_detail_id = wrd."id"
        LEFT JOIN basic_part bp ON bp."id" = wrd.part_id
        LEFT join basic_location wl ON wl."id"= wpd.location_id
        where wrd.status IN ('已拣料','已交接')
        <if test="ew.emptyOfWhere == false">
            ${ew.customSqlSegment}
        </if>
    </select>
    <select id="getByReserveDetail" resultType="com.chinaztt.mes.warehouse.dto.PrepareDetailDTO">
        SELECT
    wrd.warehouse_main_id,
    wpd."id",
    wpd.location_id,
    wpd.out_qty,
    wpd.part_batch_no,
    wpd.prepare_qty,
    wpd.part_id,
    wpd.warehouse_reserve_detail_id,
    wpd.update_time,
    bp.part_no,
    wl.loc_no,
    wrm.res_no,
    wrd.recv_qty
FROM
    warehouse_reserve_main wrm
        LEFT JOIN warehouse_reserve_detail wrd ON wrm."id" = wrd.warehouse_main_id
        LEFT JOIN warehouse_prepare_detail wpd ON wpd.warehouse_reserve_detail_id = wrd."id"
        LEFT JOIN basic_part bp ON bp."id" = wpd.part_id
        LEFT JOIN basic_location wl ON wl."id" = wpd.location_id
WHERE
    wpd."id" = #{ew.id}
    </select>
</mapper>