ShipmentDetailStatisticsMapper.xml
7.72 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
<?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,
case
when o.supply_unit = 'GJ' then '安徽楚江高精铜带有限公司'
when o.supply_unit = 'XC' then '安徽楚江科技新材料股份有限公司'
else ''
end as supplier,
o.workshop_id,
so.code as shipment_order_no,
so.create_time 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>
<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>
</select>
</mapper>