ShipmentDetailStatisticsMapper.xml
10.4 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
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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
<?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.lframework.xingyun.sc.mappers.ShipmentDetailStatisticsMapper">
<resultMap id="ShipmentDetailStatistics" type="com.lframework.xingyun.sc.entity.ShipmentDetailStatistics">
<id column="id" property="id"/>
<result column="shipment_order_no" property="shipmentOrderNo"/>
<result column="workshop_name" property="workshopName"/>
<result column="dept_name" property="deptName"/>
<result column="region_name" property="regionName"/>
<result column="ordering_unit_name" property="orderingUnitName"/>
<result column="brand" property="brand"/>
<result column="thickness" property="thickness"/>
<result column="width" property="width"/>
<result column="length" property="length"/>
<result column="status" property="status"/>
<result column="quantity" property="quantity"/>
<result column="actual_shipment_quantity" property="actualShipmentQuantity"/>
<result column="sales_price" property="salesPrice"/>
<result column="thickness_tol_pos" property="thicknessTolPos"/>
<result column="thickness_tol_neg" property="thicknessTolNeg"/>
<result column="width_tol_pos" property="widthTolPos"/>
<result column="width_tol_neg" property="widthTolNeg"/>
<result column="length_tol_pos" property="lengthTolPos"/>
<result column="length_tol_neg" property="lengthTolNeg"/>
<result column="assessment_exceeds_agreement" property="assessmentExceedsAgreement"/>
<result column="shipping_cost" property="shippingCost"/>
<result column="return_freight" property="returnFreight"/>
<result column="industry" property="industry"/>
<result column="stock_up_company_name" property="stockUpCompanyName"/>
<result column="order_no" property="orderNo"/>
<result column="yield_batch_no" property="yieldBatchNo"/>
<result column="invoicing_status" property="invoicingStatus"/>
<result column="order_date" property="orderDate"/>
<result column="packaging_fee" property="packagingFee"/>
<result column="quality" property="quality"/>
<result column="num" property="num"/>
<result column="settlement_terms" property="settlementTerms"/>
<result column="processing_or_distribution" property="processingOrDistribution"/>
<result column="packaging_requirements" property="packagingRequirements"/>
<result column="shipment_date" property="shipmentDate"/>
<result column="supplier" property="supplier"/>
<result column="customer_short_name" property="customerShortName"/>
<result column="customer_type" property="customerType"/>
<result column="create_by_id" property="createById"/>
<result column="update_by_id" property="updateById"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="delivery_method" property="deliveryMethod"/>
</resultMap>
<sql id="ShipmentDetailStatistics_sql">
SELECT
tb.id,
tb.shipment_order_no,
tb.workshop_name,
tb.dept_name,
tb.region_name,
tb.ordering_unit_name,
tb.brand,
tb.thickness,
tb.width,
tb.length,
tb.status,
tb.quantity,
tb.actual_shipment_quantity,
tb.sales_price,
tb.thickness_tol_pos,
tb.thickness_tol_neg,
tb.width_tol_pos,
tb.width_tol_neg,
tb.length_tol_pos,
tb.length_tol_neg,
tb.assessment_exceeds_agreement,
tb.shipping_cost,
tb.return_freight,
tb.industry,
tb.stock_up_company_name,
tb.order_no,
tb.yield_batch_no,
tb.invoicing_status,
tb.order_date,
tb.packaging_fee,
tb.quality,
tb.num,
tb.settlement_terms,
tb.processing_or_distribution,
tb.packaging_requirements,
tb.shipment_date,
tb.supplier,
tb.customer_short_name,
tb.customer_type,
tb.create_by_id,
tb.update_by_id,
tb.create_time,
tb.update_time,
tb.delivery_method
FROM shipments_detail_statistics AS tb
</sql>
<select id="query" resultMap="ShipmentDetailStatistics">
<include refid="ShipmentDetailStatistics_sql"/>
<where>
<if test="vo.workshopName != null and vo.workshopName != ''">
AND tb.workshop_name LIKE CONCAT('%', #{vo.workshopName}, '%')
</if>
<if test="vo.deptName != null and vo.deptName != ''">
AND tb.dept_name LIKE CONCAT('%', #{vo.deptName}, '%')
</if>
<if test="vo.orderingUnitName != null and vo.orderingUnitName != ''">
AND tb.ordering_unit_name LIKE CONCAT('%', #{vo.orderingUnitName}, '%')
</if>
</where>
</select>
<select id="getShipmentDetailInfo" resultType="com.lframework.xingyun.sc.entity.ShipmentDetailStatistics">
select
sd.id,
sd.actual_shipment_quantity,
sd.yield_batch_no,
sd.num,
ol.brand,
ol.thickness,
ol.width,
ol.length,
ol.status,
ol.quantity,
ol.sales_price,
ol.thickness_tol_pos,
ol.thickness_tol_neg,
ol.width_tol_pos,
ol.width_tol_neg,
ol.length_tol_pos,
ol.length_tol_neg,
ol.assessment_exceeds_agreement,
ol.industry,
ol.packaging_fee,
ol.quality,
o.dept_id,
o.region,
o.ordering_unit,
o.shipping_cost,
o.delivery_method,
o.stock_up_company_id,
o.order_no,
o.invoicing_status,
o.order_date,
o.settlement_terms,
o.supply_unit as supplier,
o.workshop_id,
o.delivery_method,
so.code as shipment_order_no,
so.shipments_date as shipment_date,
sc.id as contract_id,
sc.type as contract_type,
sc.packaging_requirements,
cl.material_product_ratio,
cl.material_product_ratio_remarks
from shipments_plan_detail sd
inner join shipments_order_info so on sd.shipment_order_id = so.id
left join tbl_purchase_order_line ol on sd.order_spec_id = ol.id
left join purchase_order_info o on ol.purchase_order_id = o.id
left join tbl_contract_distributor_standard sc on o.contract_id = sc.id
left join tbl_contract_std_processing_line cl on sc.id = cl.contract_id
<where>
and sd.del_flag = false
<if test="vo.ids != null and vo.ids.size() > 0">
and sd.id in
<foreach collection="vo.ids" open="(" separator="," close=")" item="item">
#{item}
</foreach>
</if>
<if test="vo.orderNo != null and vo.orderNo != ''">
and o.order_no like concat('%', #{vo.orderNo}, '%')
</if>
<if test="vo.shipmentOrderNo != null and vo.shipmentOrderNo != ''">
and so.code like concat('%', #{vo.shipmentOrderNo}, '%')
</if>
</where>
order by so.create_time desc
</select>
<insert id="batchAdd">
INSERT INTO shipments_detail_statistics (
id,
shipment_order_no,
workshop_name,
dept_name,
region_name,
ordering_unit_name,
brand,
thickness,
width,
length,
status,
quantity,
actual_shipment_quantity,
sales_price,
thickness_tol_pos,
thickness_tol_neg,
width_tol_pos,
width_tol_neg,
length_tol_pos,
length_tol_neg,
assessment_exceeds_agreement,
shipping_cost,
return_freight,
industry,
stock_up_company_name,
order_no,
yield_batch_no,
invoicing_status,
order_date,
packaging_fee,
quality,
num,
settlement_terms,
processing_or_distribution,
packaging_requirements,
shipment_date,
supplier,
customer_short_name,
customer_type,
delivery_method
) VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.id},
#{item.shipmentOrderNo},
#{item.workshopName},
#{item.deptName},
#{item.regionName},
#{item.orderingUnitName},
#{item.brand},
#{item.thickness},
#{item.width},
#{item.length},
#{item.status},
#{item.quantity},
#{item.actualShipmentQuantity},
#{item.salesPrice},
#{item.thicknessTolPos},
#{item.thicknessTolNeg},
#{item.widthTolPos},
#{item.widthTolNeg},
#{item.lengthTolPos},
#{item.lengthTolNeg},
#{item.assessmentExceedsAgreement},
#{item.shippingCost},
#{item.returnFreight},
#{item.industry},
#{item.stockUpCompanyName},
#{item.orderNo},
#{item.yieldBatchNo},
#{item.invoicingStatus},
#{item.orderDate},
#{item.packagingFee},
#{item.quality},
#{item.num},
#{item.settlementTerms},
#{item.processingOrDistribution},
#{item.packagingRequirements},
#{item.shipmentDate},
#{item.supplier},
#{item.customerShortName},
#{item.customerType},
#{item.deliveryMethod}
)
</foreach>
</insert>
</mapper>