cuijian
2023-08-19 bdd0875d4b13a3f1ef472f64d4b6a95e0ef64b22
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
<?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="org.jeecg.modules.spare.mapper.SparePartCancellingStocksDetailMapper">
 
    <delete id="deleteByMainId" parameterType="java.lang.String">
        DELETE
        FROM mom_eam_spare_part_cancelling_stocks_detail
        WHERE spare_part_cancelling_id = #{mainId}
    </delete>
 
    <select id="getSparePartCancellingStocksDeatilList" parameterType="Map" resultType="Map">
 
        SELECT
        t10.id,
        t1.id AS sparePartInventoryId,
        t6.id as sparePartId,
        t6.num,
        t6.name,
        t6.model,
        t6.specification,
        t6.conversion_ratio as conversionRatio,
        t1.batch_num AS batchNum,
        t1.main_quantity AS mainQuantity,
        t1.auxiliary_quantity AS auxiliaryQuantity,
        t1.main_unit_id AS mainUnitId,
        t1.auxiliary_unit_id AS auxiliaryUnitId,
        t1.supplier_id as supplierId,
        t2.NAME AS mainUnitName,
        t3.NAME AS auxiliaryUnitName,
        t1.manufacture_date AS manufactureDate,
        t4.NAME AS supplierName,
        t1.validity_period AS validityPeriod,
        t1.validity_forecast AS validityForecast,
        t5.NAME AS warehouseName,
        t1.constructor_id AS constructorId,
        t7.name as constructorName,
        t10.outbound_main_quantity as outboundMainQuantity
        FROM
        mom_eam_spare_part_cancelling_stocks_detail t10
        left join mom_eam_spares_part_inventory t1 on t10.spare_part_inventory_id = t1.id
        LEFT JOIN mom_base_unit t2 ON t1.main_unit_id = t2.id
        LEFT JOIN mom_base_unit t3 ON t1.auxiliary_unit_id = t3.id
        LEFT JOIN mom_base_supplier t4 ON t1.supplier_id = t4.id
        LEFT JOIN mom_base_warehouse t5 ON t1.warehouse_id = t5.id
        LEFT JOIN mom_eam_spare_part t6 ON t1.spare_part_id = t6.id
        left join mom_base_constructor t7 on t1.constructor_id = t7.id
        WHERE t10.del_flag = '0'
        <if test="sparePartCancellingId != null and sparePartCancellingId != ''">
            and t10.spare_part_cancelling_id = #{sparePartCancellingId}
        </if>
        ORDER BY t10.create_time desc
    </select>
 
 
    <select id="getSparePartList" parameterType="Map" resultType="Map">
 
        SELECT
        t10.id,
        t1.id as sparePartInventoryId,
        t10.status,
        t10.spare_part_outbound_id as sparePartOutboundId,
        t6.id as sparePartId,
        t6.num,
        t6.name,
        t6.model,
        t6.specification,
        t6.conversion_ratio as conversionRatio,
        t1.batch_num AS batchNum,
        t1.main_unit_id AS mainUnitId,
        t1.auxiliary_unit_id AS auxiliaryUnitId,
        t1.supplier_id as supplierId,
        t2.name AS mainUnitName,
        t3.name AS auxiliaryUnitName,
        t1.manufacture_date AS manufactureDate,
        t4.name AS supplierName,
        t1.validity_period AS validityPeriod,
        t1.validity_forecast AS validityForecast,
        t5.name AS warehouseName,
        t1.constructor_id AS constructorId,
        t7.name as constructorName,
        t10.outbound_main_quantity as outboundMainQuantity,
        t10.outbound_auxiliary_quantity as outboundAuxiliaryQuantity,
        t8.status as outboundStatus,
        t8.num as sparePartOutboundNum,
        t1.warehouse_area_id AS warehouseAreaId,
        t11.name as warehouseAreaName,
        t1.warehouse_location_id AS warehouseLocationId,
        t12.num as warehouseLocationNum
        FROM
        mom_eam_spare_part_outbound_detail t10
        left join mom_eam_spares_part_inventory t1 on t10.spares_part_inventory_id = t1.id
        LEFT JOIN mom_base_unit t2 ON t1.main_unit_id = t2.id
        LEFT JOIN mom_base_unit t3 ON t1.auxiliary_unit_id = t3.id
        LEFT JOIN mom_base_supplier t4 ON t1.supplier_id = t4.id
        LEFT JOIN mom_base_warehouse t5 ON t1.warehouse_id = t5.id
        LEFT JOIN mom_eam_spare_part t6 ON t1.spare_part_id = t6.id
        left join mom_base_constructor t7 on t1.constructor_id = t7.id
        left join mom_eam_spare_part_outbound t8 on t8.id = t10.spare_part_outbound_id
 
        left join mom_base_warehouse_area t11 on t1.warehouse_area_id  = t11.id
        left join mom_base_warehouse_location t12 on t1.warehouse_location_id = t12.id
 
        WHERE t10.del_flag = '0' AND t1.main_quantity>0
        <if test="params.num != null and params.num != ''">
            and t6.num like concat('%',#{params.num},'%')
        </if>
        <if test="params.name != null and params.name != ''">
            and t6.name like concat('%',#{params.name},'%')
        </if>
        <if test="params.warehouseId != null and params.warehouseId != ''">
            and t1.warehouse_id = #{params.warehouseId}
        </if>
        ORDER BY t10.create_time desc
    </select>
 
 
 
 
    <!--明细获取-->
    <select id="getSparePartCanxellingStoksDetailsById" parameterType="Map" resultType="Map">
        SELECT
        t10.id,
        t1.id as sparePartInventoryId,
        t10.status,
        t10.spare_part_cancelling_id as sparePartCancellingId,
        t6.id as sparePartId,
        t6.num,
        t6.name,
        t6.model,
        t6.specification,
        t6.conversion_ratio as conversionRatio,
        t1.batch_num AS batchNum,
        t1.main_quantity AS mainQuantity,
        t1.auxiliary_quantity AS auxiliaryQuantity,
        t1.main_unit_id AS mainUnitId,
        t1.auxiliary_unit_id AS auxiliaryUnitId,
        t1.supplier_id as supplierId,
        t2.NAME AS mainUnitName,
        t3.NAME AS auxiliaryUnitName,
        t1.manufacture_date AS manufactureDate,
        t4.NAME AS supplierName,
        t1.validity_period AS validityPeriod,
        t1.validity_forecast AS validityForecast,
        t5.NAME AS warehouseName,
        t1.constructor_id AS constructorId,
        t7.name as constructorName,
        t10.outbound_main_quantity as outboundMainQuantity,
        t8.status as cancellingStatus,
        t1.warehouse_area_id AS warehouseAreaId,
        t11.name as warehouseAreaName,
        t1.warehouse_location_id AS warehouseLocationId,
        t12.num as warehouseLocationNum
        FROM
        mom_eam_spare_part_cancelling_stocks_detail t10
        left join mom_eam_spares_part_inventory t1 on t10.spare_part_inventory_id = t1.id
        LEFT JOIN mom_base_unit t2 ON t1.main_unit_id = t2.id
        LEFT JOIN mom_base_unit t3 ON t1.auxiliary_unit_id = t3.id
        LEFT JOIN mom_base_supplier t4 ON t1.supplier_id = t4.id
        LEFT JOIN mom_base_warehouse t5 ON t1.warehouse_id = t5.id
        LEFT JOIN mom_eam_spare_part t6 ON t1.spare_part_id = t6.id
        left join mom_base_constructor t7 on t1.constructor_id = t7.id
        left join mom_eam_spare_part_cancelling_stocks t8 on t8.id = t10.spare_part_cancelling_id
 
        left join mom_base_warehouse_area t11 on t1.warehouse_area_id  = t11.id
        left join mom_base_warehouse_location t12 on t1.warehouse_location_id = t12.id
        WHERE t10.del_flag = '0'
        <if test="params.sparePartCancellingId != null and params.sparePartCancellingId != ''">
            and t10.spare_part_cancelling_id = #{params.sparePartCancellingId}
        </if>
        <if test="params.status != null and params.status != ''">
            and t10.status = #{params.status}
        </if>
        <if test="params.warehouseId != null and params.warehouseId != ''">
            and t1.warehouse_id = #{params.warehouseId}
        </if>
        ORDER BY t10.create_time desc
    </select>
 
 
 
 
 
</mapper>